-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 @@ -1,14 +1,20 @@ TEMPLATE = app CONFIG = qt warn_on debug HEADERS = SOURCES = oconfigdemo.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lopiecore2 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 @@ -1,13 +1,19 @@ TEMPLATE = app CONFIG = qt warn_on debug HEADERS = SOURCES = odebugdemo.cpp INCLUDEPATH += $(OPIEDIR)/include 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 @@ -1,15 +1,23 @@ TEMPLATE = app CONFIG = qt warn_on debug HEADERS = olistviewdemo.h SOURCES = olistviewdemo.cpp \ main.cpp INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include LIBS += -lopieui2 -lopiecore2 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 @@ -45,25 +45,25 @@ class OApplicationPrivate { public: OApplicationPrivate() {}; ~OApplicationPrivate() {}; }; /**************************************************************************************************/ /* OApplication /**************************************************************************************************/ OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) - :QPEApplication( argc, argv ), + :OpieApplication( argc, argv ), _appname( rAppName ), _config( 0 ) { init(); } OApplication::~OApplication() { delete d; if ( _config ) delete _config; @@ -99,25 +99,25 @@ void OApplication::init() sigaction(SIGSEGV, &sa, NULL); */ } else { qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); } } void OApplication::showMainWidget( QWidget* widget, bool nomax ) { - QPEApplication::showMainWidget( widget, nomax ); + OpieApplication::showMainWidget( widget, nomax ); widget->setCaption( _appname ); } void OApplication::setTitle( const QString& title ) const { if ( mainWidget() ) { if ( !title.isNull() ) mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); else mainWidget()->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 @@ -25,32 +25,32 @@ -- :-=` 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 OAPPLICATION_H #define OAPPLICATION_H #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 public: /** * Constructor. Parses command-line arguments and sets the window caption. * * @param rAppName application name. Will be used for finding the * associated message, icon and configuration files * */ OApplication( int& argc, char** argv, const QCString& rAppName ); 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 @@ -30,25 +30,25 @@ */ /* QT */ #include <qfont.h> #include <qcolor.h> /* OPIE */ #include <opie2/oconfig.h> OConfig::OConfig( const QString &name, Domain domain ) - :Config( name, domain ) + :OpieConfig( name, domain ) { } OConfig::~OConfig() { } QColor OConfig::readColorEntry( const QString& key, const QColor* pDefault ) const { QColor aRetColor; int nRed = 0, nGreen = 0, nBlue = 0; 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 @@ -26,53 +26,53 @@ -- :-=` 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 OCONFIG_H #define OCONFIG_H //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; /** * A Configuration class based on the Qtopia @ref Config class * featuring additional handling of color and font entries */ -class OConfig : public Config +class OConfig : public OpieConfig { public: /** * Constructs a OConfig object with a @a name. */ OConfig( const QString &name, Domain domain = User ); /** * Destructs the OConfig object. * * Writes back any dirty configuration entries, and destroys * dynamically created objects. */ virtual ~OConfig(); /** * @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. */ QColor readColorEntry( const QString& key, const QColor* pDefault ) const; /** * @returns a @ref QFont value or a @a default value if the key is not found. */ QFont readFontEntry( const QString& key, const QFont* pDefault ) const; }; /** * @brief Helper class for easier use of OConfig groups. 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 @@ -23,14 +23,14 @@ -. .:....=;==+<; 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 <opie2/oglobal.h> 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 @@ -25,25 +25,25 @@ -- :-=` 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 OGLOBAL_H #define OGLOBAL_H #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 class OGlobal : public Global { public: // do we want to put that into OApplication as in KApplication -zecke static OConfig* config(); }; #endif // OGLOBAL_H 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,39 +1,43 @@ 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 \ oglobal.h \ oglobalsettings.h \ osortablevaluelist.h -SOURCES = oconfig.cpp \ + +SOURCES = oapplication.cpp \ + opieapplication.cpp \ + oconfig.cpp \ + opieconfig.cpp \ ocompletionbase.cpp \ ocompletion.cpp \ odebug.cpp \ oglobal.cpp \ oglobalsettings.cpp INTERFACES = TARGET = opiecore2 VERSION = 1.8.1 INCLUDEPATH += $(OPIEDIR)/include DEPENDPATH += $(OPIEDIR)/include MOC_DIR = moc 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 } |