-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 @@ -1,4 +1,12 @@ 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 @@ -10,5 +10,11 @@ TARGET = oconfigdemo 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 @@ -7,7 +7,13 @@ DEPENDPATH += $(OPIEDIR)/include 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 @@ -10,6 +10,14 @@ TARGET = olistviewdemo 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 @@ -54,7 +54,7 @@ class OApplicationPrivate OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) - :QPEApplication( argc, argv ), + :OpieApplication( argc, argv ), _appname( rAppName ), _config( 0 ) { @@ -108,7 +108,7 @@ 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 @@ -34,14 +34,14 @@ #define oApp OApplication::oApplication() -#include <qpe/qpeapplication.h> +#include "opieapplication.h" class OApplicationPrivate; 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 @@ -39,7 +39,7 @@ #include <opie2/oconfig.h> 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 @@ -35,7 +35,7 @@ //FIXME: Implement for X11 or reuse libqpe/Config there also? //FIXME: Or rather use QSettings also for libqpe? -#include <qpe/config.h> +#include "opieconfig.h" class QColor; class QFont; @@ -45,7 +45,7 @@ class QFont; * featuring additional handling of color and font entries */ -class OConfig : public Config +class OConfig : public OpieConfig { public: /** @@ -63,7 +63,7 @@ class OConfig : public Config * @returns the name of the current group. * 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 @@ -32,5 +32,5 @@ 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 @@ -34,7 +34,7 @@ #include <qpe/global.h> #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? // once we totally skip libqpe it should ideally swallow Global -zecke 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 @@ -1,7 +1,10 @@ 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 \ odebug.h \ @@ -9,7 +12,11 @@ HEADERS = oconfig.h \ oglobalsettings.h \ osortablevaluelist.h -SOURCES = oconfig.cpp \ + +SOURCES = oapplication.cpp \ + opieapplication.cpp \ + oconfig.cpp \ + opieconfig.cpp \ ocompletionbase.cpp \ ocompletion.cpp \ odebug.cpp \ @@ -26,14 +33,11 @@ OBJECTS_DIR = obj !contains( platform, x11 ) { - HEADERS += oapplication.h - SOURCES += oapplication.cpp LIBS = -lqpe include ( $(OPIEDIR)/include.pro ) } contains( platform, x11 ) { - message( NOT building oapplication for X11 ) LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib } |