author | tille <tille> | 2003-08-25 12:56:53 (UTC) |
---|---|---|
committer | tille <tille> | 2003-08-25 12:56:53 (UTC) |
commit | c817abf3b81ca47927433ede1efd9afddfc15a72 (patch) (unidiff) | |
tree | 3e5727ad9bd9b54475f04d2be33bb8db6e26636f /libopie2/opiecore | |
parent | ff72e85696d070efa03975ea8130807579a6e1d9 (diff) | |
download | opie-c817abf3b81ca47927433ede1efd9afddfc15a72.zip opie-c817abf3b81ca47927433ede1efd9afddfc15a72.tar.gz opie-c817abf3b81ca47927433ede1efd9afddfc15a72.tar.bz2 |
libopie2 compiles for qt3/x11 now
run:
qmake "platform=x11" libopie2.pro
-rw-r--r-- | libopie2/opiecore/oapplication.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiecore/oapplication.h | 10 | ||||
-rw-r--r-- | libopie2/opiecore/opiecore.pro | 11 |
3 files changed, 30 insertions, 3 deletions
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index 06d8ba2..84cab48 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp | |||
@@ -9,72 +9,77 @@ | |||
9 | .> <`_, > . <= redistribute it and/or modify it under | 9 | .> <`_, > . <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
11 | .="- .-=="i, .._ License as published by the Free Software | 11 | .="- .-=="i, .._ License as published by the Free Software |
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #include <opie2/oapplication.h> | 31 | #include <opie2/oapplication.h> |
32 | #include <opie2/oconfig.h> | 32 | #include <opie2/oconfig.h> |
33 | #include <opie2/odebug.h> | ||
33 | 34 | ||
34 | #include <signal.h> | 35 | #include <signal.h> |
35 | #include <stdio.h> | 36 | #include <stdio.h> |
36 | 37 | ||
37 | OApplication* OApplication::_instance = 0; | 38 | OApplication* OApplication::_instance = 0; |
38 | 39 | ||
39 | /**************************************************************************************************/ | 40 | /**************************************************************************************************/ |
40 | /* OApplicationPrivate | 41 | /* OApplicationPrivate |
41 | /**************************************************************************************************/ | 42 | /**************************************************************************************************/ |
42 | 43 | ||
43 | class OApplicationPrivate | 44 | class OApplicationPrivate |
44 | { | 45 | { |
45 | public: | 46 | public: |
46 | OApplicationPrivate() {}; | 47 | OApplicationPrivate() {}; |
47 | ~OApplicationPrivate() {}; | 48 | ~OApplicationPrivate() {}; |
48 | }; | 49 | }; |
49 | 50 | ||
50 | /**************************************************************************************************/ | 51 | /**************************************************************************************************/ |
51 | /* OApplication | 52 | /* OApplication |
52 | /**************************************************************************************************/ | 53 | /**************************************************************************************************/ |
53 | 54 | ||
54 | 55 | ||
55 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) | 56 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) |
57 | #ifdef QWS | ||
56 | :QPEApplication( argc, argv ), | 58 | :QPEApplication( argc, argv ), |
59 | #else | ||
60 | :QApplication( argc, argv ), | ||
61 | #endif | ||
57 | _appname( rAppName ), | 62 | _appname( rAppName ), |
58 | _config( 0 ) | 63 | _config( 0 ) |
59 | { | 64 | { |
60 | init(); | 65 | init(); |
61 | } | 66 | } |
62 | 67 | ||
63 | 68 | ||
64 | OApplication::~OApplication() | 69 | OApplication::~OApplication() |
65 | { | 70 | { |
66 | delete d; | 71 | delete d; |
67 | if ( _config ) | 72 | if ( _config ) |
68 | delete _config; | 73 | delete _config; |
69 | OApplication::_instance = 0; | 74 | OApplication::_instance = 0; |
70 | // after deconstruction of the one-and-only application object, | 75 | // after deconstruction of the one-and-only application object, |
71 | // the construction of another object is allowed | 76 | // the construction of another object is allowed |
72 | } | 77 | } |
73 | 78 | ||
74 | 79 | ||
75 | OConfig* OApplication::config() | 80 | OConfig* OApplication::config() |
76 | { | 81 | { |
77 | if ( !_config ) | 82 | if ( !_config ) |
78 | { | 83 | { |
79 | _config = new OConfig( _appname ); | 84 | _config = new OConfig( _appname ); |
80 | } | 85 | } |
@@ -86,40 +91,47 @@ void OApplication::init() | |||
86 | { | 91 | { |
87 | d = new OApplicationPrivate(); | 92 | d = new OApplicationPrivate(); |
88 | if ( !OApplication::_instance ) | 93 | if ( !OApplication::_instance ) |
89 | { | 94 | { |
90 | OApplication::_instance = this; | 95 | OApplication::_instance = this; |
91 | 96 | ||
92 | /* register SIGSEGV handler to give programs an option | 97 | /* register SIGSEGV handler to give programs an option |
93 | * to exit gracefully, e.g. save or close devices or files. | 98 | * to exit gracefully, e.g. save or close devices or files. |
94 | struct sigaction sa; | 99 | struct sigaction sa; |
95 | sa.sa_handler = ( void (*)(int) ) &segv_handler; | 100 | sa.sa_handler = ( void (*)(int) ) &segv_handler; |
96 | sa.sa_flags = SA_SIGINFO | SA_RESTART; | 101 | sa.sa_flags = SA_SIGINFO | SA_RESTART; |
97 | sigemptyset(&sa.sa_mask); | 102 | sigemptyset(&sa.sa_mask); |
98 | sigaction(SIGSEGV, &sa, NULL); | 103 | sigaction(SIGSEGV, &sa, NULL); |
99 | */ | 104 | */ |
100 | } | 105 | } |
101 | else | 106 | else |
102 | { | 107 | { |
103 | qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); | 108 | qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); |
104 | } | 109 | } |
105 | } | 110 | } |
106 | 111 | ||
107 | 112 | ||
108 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) | 113 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) |
109 | { | 114 | { |
115 | #ifdef QWS | ||
110 | QPEApplication::showMainWidget( widget, nomax ); | 116 | QPEApplication::showMainWidget( widget, nomax ); |
117 | #else | ||
118 | // tille: I am quit sure if this is the right way to do.. | ||
119 | odDebug(nomax,7) << "ignoring nomax"; | ||
120 | setMainWidget( widget ); | ||
121 | widget->show(); | ||
122 | #endif | ||
111 | widget->setCaption( _appname ); | 123 | widget->setCaption( _appname ); |
112 | } | 124 | } |
113 | 125 | ||
114 | 126 | ||
115 | void OApplication::setTitle( const QString& title ) const | 127 | void OApplication::setTitle( const QString& title ) const |
116 | { | 128 | { |
117 | if ( mainWidget() ) | 129 | if ( mainWidget() ) |
118 | { | 130 | { |
119 | if ( !title.isNull() ) | 131 | if ( !title.isNull() ) |
120 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); | 132 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); |
121 | else | 133 | else |
122 | mainWidget()->setCaption( _appname ); | 134 | mainWidget()->setCaption( _appname ); |
123 | } | 135 | } |
124 | } | 136 | } |
125 | 137 | ||
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h index 6bc2b1c..3043910 100644 --- a/libopie2/opiecore/oapplication.h +++ b/libopie2/opiecore/oapplication.h | |||
@@ -12,54 +12,62 @@ | |||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | 12 | - . .-<_> .<> Foundation; either version 2 of the License, |
13 | ._= =} : or (at your option) any later version. | 13 | ._= =} : or (at your option) any later version. |
14 | .%`+i> _;_. | 14 | .%`+i> _;_. |
15 | .i_,=:_. -<s. This program is distributed in the hope that | 15 | .i_,=:_. -<s. This program is distributed in the hope that |
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
17 | : .. .:, . . . without even the implied warranty of | 17 | : .. .:, . . . without even the implied warranty of |
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= = ; Library General Public License for more | 20 | ..}^=.= = ; Library General Public License for more |
21 | ++= -. .` .: details. | 21 | ++= -. .` .: details. |
22 | : = ...= . :.=- | 22 | : = ...= . :.=- |
23 | -. .:....=;==+<; You should have received a copy of the GNU | 23 | -. .:....=;==+<; You should have received a copy of the GNU |
24 | -_. . . )=. = Library General Public License along with | 24 | -_. . . )=. = Library General Public License along with |
25 | -- :-=` this library; see the file COPYING.LIB. | 25 | -- :-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 26 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 27 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 28 | Boston, MA 02111-1307, USA. |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef OAPPLICATION_H | 31 | #ifndef OAPPLICATION_H |
32 | #define OAPPLICATION_H | 32 | #define OAPPLICATION_H |
33 | 33 | ||
34 | #define oApp OApplication::oApplication() | 34 | #define oApp OApplication::oApplication() |
35 | 35 | ||
36 | #ifdef QWS | ||
36 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #else | ||
39 | #include <qapplication.h> | ||
40 | #endif | ||
37 | 41 | ||
38 | class OApplicationPrivate; | 42 | class OApplicationPrivate; |
39 | class OConfig; | 43 | class OConfig; |
40 | 44 | ||
41 | class OApplication: public QPEApplication | 45 | #ifdef QWS |
46 | class OApplication : public QPEApplication | ||
47 | #else | ||
48 | class OApplication : public QApplication | ||
49 | #endif | ||
42 | { | 50 | { |
43 | Q_OBJECT | 51 | Q_OBJECT |
44 | 52 | ||
45 | public: | 53 | public: |
46 | /** | 54 | /** |
47 | * Constructor. Parses command-line arguments and sets the window caption. | 55 | * Constructor. Parses command-line arguments and sets the window caption. |
48 | * | 56 | * |
49 | * @param rAppName application name. Will be used for finding the | 57 | * @param rAppName application name. Will be used for finding the |
50 | * associated message, icon and configuration files | 58 | * associated message, icon and configuration files |
51 | * | 59 | * |
52 | */ | 60 | */ |
53 | OApplication( int& argc, char** argv, const QCString& rAppName ); | 61 | OApplication( int& argc, char** argv, const QCString& rAppName ); |
54 | /** | 62 | /** |
55 | * Destructor. Destroys the application object and its children. | 63 | * Destructor. Destroys the application object and its children. |
56 | */ | 64 | */ |
57 | virtual ~OApplication(); | 65 | virtual ~OApplication(); |
58 | /** | 66 | /** |
59 | * @returns the process-wide application object | 67 | * @returns the process-wide application object |
60 | * | 68 | * |
61 | * This is similar to the global @ref QApplication pointer qApp. It | 69 | * This is similar to the global @ref QApplication pointer qApp. It |
62 | * allows access to the single global OApplication object, since | 70 | * allows access to the single global OApplication object, since |
63 | * more than one cannot be created in the same application. It | 71 | * more than one cannot be created in the same application. It |
64 | * saves you the trouble of having to pass the pointer explicitly | 72 | * saves you the trouble of having to pass the pointer explicitly |
65 | * to every function that may require it. | 73 | * to every function that may require it. |
diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro index ed7d6d7..c8a291a 100644 --- a/libopie2/opiecore/opiecore.pro +++ b/libopie2/opiecore/opiecore.pro | |||
@@ -2,30 +2,37 @@ TEMPLATE = lib | |||
2 | CONFIG += qt warn_on debug | 2 | CONFIG += qt warn_on debug |
3 | DESTDIR = $(OPIEDIR)/lib | 3 | DESTDIR = $(OPIEDIR)/lib |
4 | HEADERS = oapplication.h \ | 4 | HEADERS = oapplication.h \ |
5 | oconfig.h \ | 5 | oconfig.h \ |
6 | ocompletionbase.h \ | 6 | ocompletionbase.h \ |
7 | ocompletion.h \ | 7 | ocompletion.h \ |
8 | odebug.h \ | 8 | odebug.h \ |
9 | oglobal.h \ | 9 | oglobal.h \ |
10 | oglobalsettings.h \ | 10 | oglobalsettings.h \ |
11 | osortablevaluelist.h | 11 | osortablevaluelist.h |
12 | 12 | ||
13 | SOURCES = oapplication.cpp \ | 13 | SOURCES = oapplication.cpp \ |
14 | oconfig.cpp \ | 14 | oconfig.cpp \ |
15 | ocompletionbase.cpp \ | 15 | ocompletionbase.cpp \ |
16 | ocompletion.cpp \ | 16 | ocompletion.cpp \ |
17 | odebug.cpp \ | 17 | odebug.cpp \ |
18 | oglobal.cpp \ | 18 | oglobal.cpp \ |
19 | oglobalsettings.cpp | 19 | oglobalsettings.cpp |
20 | 20 | ||
21 | INTERFACES = | 21 | INTERFACES = |
22 | TARGET = opiecore2 | 22 | TARGET = opiecore2 |
23 | VERSION = 1.8.1 | 23 | VERSION = 1.8.1 |
24 | INCLUDEPATH += $(OPIEDIR)/include | 24 | INCLUDEPATH += $(OPIEDIR)/include |
25 | DEPENDPATH += $(OPIEDIR)/include | 25 | DEPENDPATH += $(OPIEDIR)/include |
26 | LIBS = -lqpe | ||
27 | MOC_DIR = moc | 26 | MOC_DIR = moc |
28 | OBJECTS_DIR = obj | 27 | OBJECTS_DIR = obj |
29 | 28 | ||
30 | include ( $(OPIEDIR)/include.pro ) | 29 | |
30 | !contains( platform, x11 ) { | ||
31 | LIBS = -lqpe | ||
32 | include ( $(OPIEDIR)/include.pro ) | ||
33 | } | ||
34 | |||
35 | contains( platform, x11 ) { | ||
36 | LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
37 | } | ||
31 | 38 | ||