-rw-r--r-- | libopie2/examples/examples.pro | 10 | ||||
-rw-r--r-- | libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro | 8 | ||||
-rw-r--r-- | libopie2/examples/opiecore/odebugdemo/odebugdemo.pro | 10 | ||||
-rw-r--r-- | libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro | 10 | ||||
-rw-r--r-- | libopie2/opiecore/oapplication.cpp | 4 | ||||
-rw-r--r-- | libopie2/opiecore/oapplication.h | 4 | ||||
-rw-r--r-- | libopie2/opiecore/oconfig.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/oconfig.h | 6 | ||||
-rw-r--r-- | libopie2/opiecore/oglobal.cpp | 2 | ||||
-rw-r--r-- | libopie2/opiecore/oglobal.h | 2 | ||||
-rw-r--r-- | libopie2/opiecore/opieapplication.cpp | 48 | ||||
-rw-r--r-- | libopie2/opiecore/opieapplication.h | 58 | ||||
-rw-r--r-- | libopie2/opiecore/opieconfig.cpp | 69 | ||||
-rw-r--r-- | libopie2/opiecore/opieconfig.h | 79 | ||||
-rw-r--r-- | libopie2/opiecore/opiecore.pro | 14 |
15 files changed, 306 insertions, 20 deletions
diff --git a/libopie2/examples/examples.pro b/libopie2/examples/examples.pro index c1ed98e..b2d47b0 100644 --- a/libopie2/examples/examples.pro +++ b/libopie2/examples/examples.pro @@ -2,3 +2,11 @@ TEMPLATE = subdirs unix:SUBDIRS = opieui opienet opiecore opiemm opiedb -#include ( ../../../include.pro ) + +!contains( platform, x11 ) { + include ( $(OPIEDIR)/include.pro ) +} + +contains( platform, x11 ) { + LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib +} + diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro index 0109c57..9b59106 100644 --- a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro @@ -11,4 +11,10 @@ MOC_DIR = moc OBJECTS_DIR = obj -include ( $(OPIEDIR)/include.pro ) +!contains( platform, x11 ) { + include ( $(OPIEDIR)/include.pro ) +} + +contains( platform, x11 ) { + LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib +} diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro index 4cd815f..c52cd02 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro @@ -8,6 +8,12 @@ LIBS += -lopiecore2 TARGET = odebugdemo -include ( $(OPIEDIR)/include.pro ) - MOC_DIR = moc OBJECTS_DIR = obj + +!contains( platform, x11 ) { + include ( $(OPIEDIR)/include.pro ) +} + +contains( platform, x11 ) { + LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib +} diff --git a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro index aabe733..99eb41a 100644 --- a/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro +++ b/libopie2/examples/opieui/olistviewdemo/olistviewdemo.pro @@ -11,5 +11,13 @@ MOC_DIR = moc OBJECTS_DIR = obj -include ( $(OPIEDIR)/include.pro ) + +!contains( platform, x11 ) { + include ( $(OPIEDIR)/include.pro ) +} + +contains( platform, x11 ) { + LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib +} + diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index c3cacce..12f33cc 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp @@ -55,5 +55,5 @@ class OApplicationPrivate OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) - :QPEApplication( argc, argv ), + :OpieApplication( argc, argv ), _appname( rAppName ), _config( 0 ) @@ -109,5 +109,5 @@ void OApplication::init() void OApplication::showMainWidget( QWidget* widget, bool nomax ) { - QPEApplication::showMainWidget( widget, nomax ); + OpieApplication::showMainWidget( widget, nomax ); widget->setCaption( _appname ); } diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h index 72a659e..da5b905 100644 --- a/libopie2/opiecore/oapplication.h +++ b/libopie2/opiecore/oapplication.h @@ -35,5 +35,5 @@ -#include <qpe/qpeapplication.h> +#include "opieapplication.h" @@ -42,5 +42,5 @@ class OConfig; -class OApplication : public QPEApplication +class OApplication : public OpieApplication { Q_OBJECT diff --git a/libopie2/opiecore/oconfig.cpp b/libopie2/opiecore/oconfig.cpp index 40edbc7..dc4d0b3 100644 --- a/libopie2/opiecore/oconfig.cpp +++ b/libopie2/opiecore/oconfig.cpp @@ -40,5 +40,5 @@ OConfig::OConfig( const QString &name, Domain domain ) - :Config( name, domain ) + :OpieConfig( name, domain ) { } diff --git a/libopie2/opiecore/oconfig.h b/libopie2/opiecore/oconfig.h index 444d280..e7d3be6 100644 --- a/libopie2/opiecore/oconfig.h +++ b/libopie2/opiecore/oconfig.h @@ -36,5 +36,5 @@ //FIXME: Or rather use QSettings also for libqpe? -#include <qpe/config.h> +#include "opieconfig.h" class QColor; @@ -46,5 +46,5 @@ class QFont; */ -class OConfig : public Config +class OConfig : public OpieConfig { public: @@ -64,5 +64,5 @@ class OConfig : public Config * The current group is used for searching keys and accessing entries. */ - const QString& group() { return git.key(); }; + const QString& group() { return group(); }; /** * @returns a @ref QColor entry or a @a default value if the key is not found. diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp index 2eb4108..f6071be 100644 --- a/libopie2/opiecore/oglobal.cpp +++ b/libopie2/opiecore/oglobal.cpp @@ -33,4 +33,4 @@ OConfig* OGlobal::config() { - return &globalconfig; + return globalconfig; } diff --git a/libopie2/opiecore/oglobal.h b/libopie2/opiecore/oglobal.h index 34f211e..23cedde 100644 --- a/libopie2/opiecore/oglobal.h +++ b/libopie2/opiecore/oglobal.h @@ -35,5 +35,5 @@ #include <opie2/oconfig.h> -static OConfig globalconfig = OConfig( "global" ); +static OConfig *globalconfig = new OConfig( "global" ); //FIXME: Is it wise or even necessary to inherit OGlobal from Global? diff --git a/libopie2/opiecore/opieapplication.cpp b/libopie2/opiecore/opieapplication.cpp new file mode 100644 index 0000000..7ff7b44 --- a/dev/null +++ b/libopie2/opiecore/opieapplication.cpp @@ -0,0 +1,48 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2003 Patrick S. Vogt <tille@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + + +#include "opieapplication.h" + +OpieApplication::OpieApplication( int& argc, char** argv) +#ifdef QWS + : QPEApplication(argc,argv) +#else + : QApplication(argc,argv) +#endif +{}; + +#ifndef QWS +void OpieApplication::showMainWidget( QWidget* widget, bool nomax ) +{ + setMainWidget( widget ); + widget->show(); +}; +#endif diff --git a/libopie2/opiecore/opieapplication.h b/libopie2/opiecore/opieapplication.h new file mode 100644 index 0000000..a864ee9 --- a/dev/null +++ b/libopie2/opiecore/opieapplication.h @@ -0,0 +1,58 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2003 Patrick S. Vogt <tille@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef OPIE_APPLICATION_H +#define OPIE_APPLICATION_H + +#ifdef QWS +#include <qpe/qpeapplication.h> +#else +#include <qapplication.h> +#endif + +class OpieApplication +#ifdef QWS +: public QPEApplication +#else +: public QApplication +#endif +{ + public: + OpieApplication( int& argc, char** argv ); + +#ifndef QWS + void showMainWidget( QWidget* widget, bool nomax=false ); +#endif +}; + + +#endif + + diff --git a/libopie2/opiecore/opieconfig.cpp b/libopie2/opiecore/opieconfig.cpp new file mode 100644 index 0000000..ac65977 --- a/dev/null +++ b/libopie2/opiecore/opieconfig.cpp @@ -0,0 +1,69 @@ +/* + This file is part of the Opie Project + + Copyright (C) 2003 Patrick S. Vogt <tille@handhelds.org> + =. + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + + +#include "opieconfig.h" + +OpieConfig::OpieConfig( const QString &name, Domain domain ) +#ifdef QWS + :Config( name, domain ) +{ +#else + :QSettings(Native), hasGroup(false) +{ + Scope s; + switch (domain) { + case File: s = QSettings::Global; + break; + case User: s = QSettings::User; + break; + } + setPath("libopie2", name, s ); +#endif +} + + +#ifndef QWS + +void OpieConfig::setGroup( const QString& key) +{ + if (hasGroup) endGroup(); + hasGroup = true; + beginGroup( key ); +}; + +bool OpieConfig::hasKey ( const QString & key ) const +{ + bool *ok; + readEntry( key, QString::null, ok ); + return *ok; +}; +#endif + diff --git a/libopie2/opiecore/opieconfig.h b/libopie2/opiecore/opieconfig.h new file mode 100644 index 0000000..011ac86 --- a/dev/null +++ b/libopie2/opiecore/opieconfig.h @@ -0,0 +1,79 @@ +/* + This file is part of the Opie Project + + (C) 2003 Patrick S. Vogt + .=l. + .>+-= + _;:, .> :=|. This program is free software; you can +.> <`_, > . <= redistribute it and/or modify it under +:`=1 )Y*s>-.-- : the terms of the GNU Library General Public +.="- .-=="i, .._ License as published by the Free Software + - . .-<_> .<> Foundation; either version 2 of the License, + ._= =} : or (at your option) any later version. + .%`+i> _;_. + .i_,=:_. -<s. This program is distributed in the hope that + + . -:. = it will be useful, but WITHOUT ANY WARRANTY; + : .. .:, . . . without even the implied warranty of + =_ + =;=|` MERCHANTABILITY or FITNESS FOR A + _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU +..}^=.= = ; Library General Public License for more +++= -. .` .: details. + : = ...= . :.=- + -. .:....=;==+<; You should have received a copy of the GNU + -_. . . )=. = Library General Public License along with + -- :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. +*/ + +#ifndef OPIECONFIG_H +#define OPIECONFIG_H + + +#ifdef QWS +#include <qpe/config.h> +#else +#include <qsettings.h> +#endif + + +class OpieConfig +#ifdef QWS + : public Config +#else +: public QSettings +#endif +{ + + public: +#ifndef QWS + enum Domain { File, User }; +#endif + + OpieConfig( const QString&, Domain ); + +#ifndef QWS + void setGroup( const QString& key); + bool hasKey ( const QString & key ) const; +#endif + + /** + * @returns the name of the current group. + * The current group is used for searching keys and accessing entries. + */ + const QString& group() +#ifdef QWS + { return git.key(); }; +#else + { return group(); }; +#endif + +#ifndef QWS + private: + bool hasGroup; +#endif + +}; + +#endif // OPIECONFIG_H diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro index 18c6986..fe5800e 100644 --- a/libopie2/opiecore/opiecore.pro +++ b/libopie2/opiecore/opiecore.pro @@ -2,5 +2,8 @@ TEMPLATE = lib CONFIG += qt warn_on debug DESTDIR = $(OPIEDIR)/lib -HEADERS = oconfig.h \ +HEADERS = oapplication.h \ + opieapplication.h \ + oconfig.h \ + opieconfig.h \ ocompletionbase.h \ ocompletion.h \ @@ -10,5 +13,9 @@ HEADERS = oconfig.h \ osortablevaluelist.h -SOURCES = oconfig.cpp \ + +SOURCES = oapplication.cpp \ + opieapplication.cpp \ + oconfig.cpp \ + opieconfig.cpp \ ocompletionbase.cpp \ ocompletion.cpp \ @@ -27,6 +34,4 @@ OBJECTS_DIR = obj !contains( platform, x11 ) { - HEADERS += oapplication.h - SOURCES += oapplication.cpp LIBS = -lqpe include ( $(OPIEDIR)/include.pro ) @@ -34,5 +39,4 @@ OBJECTS_DIR = obj contains( platform, x11 ) { - message( NOT building oapplication for X11 ) LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib } |