author | mickeyl <mickeyl> | 2003-12-02 16:00:17 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-12-02 16:00:17 (UTC) |
commit | 7b74f202db22d458c43b2063ae128bf79b0e9777 (patch) (unidiff) | |
tree | f974e1a4a4b71c3e5a9d09620f07f4993f16011d | |
parent | e215d4b2bc542b557913ba3dcd57fd20a5a2a0fe (diff) | |
download | opie-7b74f202db22d458c43b2063ae128bf79b0e9777.zip opie-7b74f202db22d458c43b2063ae128bf79b0e9777.tar.gz opie-7b74f202db22d458c43b2063ae128bf79b0e9777.tar.bz2 |
warning: file restrucuration on server ahead
be sure to do a complete checkout of libopie2 again tomorrow
-rw-r--r-- | libopie2/opiecore/oapplication.cpp | 7 | ||||
-rw-r--r-- | libopie2/opiecore/oapplication.h | 3 | ||||
-rw-r--r-- | libopie2/opiecore/oglobal.cpp | 6 |
3 files changed, 8 insertions, 8 deletions
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index c3cacce..1b85057 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp | |||
@@ -1,126 +1,127 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the Opie Project | 2 | � � � � � � � � This file is part of the Opie Project |
3 | 3 | � � � � � � � Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | |
4 | � � � � � � � Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
5 | =. | 4 | =. |
6 | .=l. | 5 | .=l. |
7 | � � � � � �.>+-= | 6 | � � � � � �.>+-= |
8 | �_;:, � � .> � �:=|. This program is free software; you can | 7 | �_;:, � � .> � �:=|. This program is free software; you can |
9 | .> <`_, � > �. � <= redistribute it and/or modify it under | 8 | .> <`_, � > �. � <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public |
11 | .="- .-=="i, � � .._ License as published by the Free Software | 10 | .="- .-=="i, � � .._ License as published by the Free Software |
12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 11 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
13 | � � �._= =} � � � : or (at your option) any later version. | 12 | � � �._= =} � � � : or (at your option) any later version. |
14 | � � .%`+i> � � � _;_. | 13 | � � .%`+i> � � � _;_. |
15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that | 14 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that |
16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 15 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
17 | � � : .. � �.:, � � . . . without even the implied warranty of | 16 | � � : .. � �.:, � � . . . without even the implied warranty of |
18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU | 18 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= � � � = � � � ; Library General Public License for more | 19 | ..}^=.= � � � = � � � ; Library General Public License for more |
21 | ++= � -. � � .` � � .: details. | 20 | ++= � -. � � .` � � .: details. |
22 | �: � � = �...= . :.=- | 21 | �: � � = �...= . :.=- |
23 | �-. � .:....=;==+<; You should have received a copy of the GNU | 22 | �-. � .:....=;==+<; You should have received a copy of the GNU |
24 | � -_. . . � )=. �= Library General Public License along with | 23 | � -_. . . � )=. �= Library General Public License along with |
25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. | 24 | � � -- � � � �:-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
29 | */ | 28 | */ |
30 | 29 | ||
31 | #include <opie2/oapplication.h> | 30 | #include <opie2/oapplication.h> |
32 | #include <opie2/oconfig.h> | 31 | #include <opie2/oconfig.h> |
33 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
34 | 33 | ||
35 | #include <signal.h> | 34 | #include <signal.h> |
36 | #include <stdio.h> | 35 | #include <stdio.h> |
37 | 36 | ||
38 | OApplication* OApplication::_instance = 0; | 37 | OApplication* OApplication::_instance = 0; |
39 | 38 | ||
40 | /**************************************************************************************************/ | 39 | /**************************************************************************************************/ |
41 | /* OApplicationPrivate | 40 | /* OApplicationPrivate |
42 | /**************************************************************************************************/ | 41 | /**************************************************************************************************/ |
43 | 42 | ||
44 | class OApplicationPrivate | 43 | class OApplicationPrivate |
45 | { | 44 | { |
46 | public: | 45 | public: |
47 | OApplicationPrivate() {}; | 46 | OApplicationPrivate() {}; |
48 | ~OApplicationPrivate() {}; | 47 | ~OApplicationPrivate() {}; |
49 | }; | 48 | }; |
50 | 49 | ||
51 | /**************************************************************************************************/ | 50 | /**************************************************************************************************/ |
52 | /* OApplication | 51 | /* OApplication |
53 | /**************************************************************************************************/ | 52 | /**************************************************************************************************/ |
54 | 53 | ||
55 | 54 | ||
56 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) | 55 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) |
57 | :QPEApplication( argc, argv ), | 56 | :QPEApplication( argc, argv ), |
58 | _appname( rAppName ), | 57 | _appname( rAppName ), |
59 | _config( 0 ) | 58 | _config( 0 ) |
60 | { | 59 | { |
61 | init(); | 60 | init(); |
62 | } | 61 | } |
63 | 62 | ||
64 | 63 | ||
65 | OApplication::~OApplication() | 64 | OApplication::~OApplication() |
66 | { | 65 | { |
67 | delete d; | 66 | delete d; |
68 | if ( _config ) | 67 | if ( _config ) |
69 | delete _config; | 68 | delete _config; |
70 | OApplication::_instance = 0; | 69 | OApplication::_instance = 0; |
71 | // after deconstruction of the one-and-only application object, | 70 | // after deconstruction of the one-and-only application object, |
72 | // the construction of another object is allowed | 71 | // the construction of another object is allowed |
73 | } | 72 | } |
74 | 73 | ||
75 | 74 | ||
76 | OConfig* OApplication::config() | 75 | OConfig* OApplication::config() |
77 | { | 76 | { |
78 | if ( !_config ) | 77 | if ( !_config ) |
79 | { | 78 | { |
80 | _config = new OConfig( _appname ); | 79 | _config = new OConfig( _appname ); |
81 | } | 80 | } |
82 | return _config; | 81 | return _config; |
83 | } | 82 | } |
84 | 83 | ||
85 | 84 | ||
86 | void OApplication::init() | 85 | void OApplication::init() |
87 | { | 86 | { |
88 | d = new OApplicationPrivate(); | 87 | d = new OApplicationPrivate(); |
89 | if ( !OApplication::_instance ) | 88 | if ( !OApplication::_instance ) |
90 | { | 89 | { |
91 | OApplication::_instance = this; | 90 | OApplication::_instance = this; |
92 | 91 | ||
93 | /* register SIGSEGV handler to give programs an option | 92 | /* register SIGSEGV handler to give programs an option |
94 | * to exit gracefully, e.g. save or close devices or files. | 93 | * to exit gracefully, e.g. save or close devices or files. |
95 | struct sigaction sa; | 94 | struct sigaction sa; |
96 | sa.sa_handler = ( void (*)(int) ) &segv_handler; | 95 | sa.sa_handler = ( void (*)(int) ) &segv_handler; |
97 | sa.sa_flags = SA_SIGINFO | SA_RESTART; | 96 | sa.sa_flags = SA_SIGINFO | SA_RESTART; |
98 | sigemptyset(&sa.sa_mask); | 97 | sigemptyset(&sa.sa_mask); |
99 | sigaction(SIGSEGV, &sa, NULL); | 98 | sigaction(SIGSEGV, &sa, NULL); |
100 | */ | 99 | */ |
101 | } | 100 | } |
102 | else | 101 | else |
103 | { | 102 | { |
104 | qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); | 103 | ofatal << "OApplication: Can't create more than one OApplication object. Aborting." << oendl; |
104 | //FIXME exit gracefully ? | ||
105 | ::exit( -1 ); | ||
105 | } | 106 | } |
106 | } | 107 | } |
107 | 108 | ||
108 | 109 | ||
109 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) | 110 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) |
110 | { | 111 | { |
111 | QPEApplication::showMainWidget( widget, nomax ); | 112 | QPEApplication::showMainWidget( widget, nomax ); |
112 | widget->setCaption( _appname ); | 113 | widget->setCaption( _appname ); |
113 | } | 114 | } |
114 | 115 | ||
115 | 116 | ||
116 | void OApplication::setTitle( const QString& title ) const | 117 | void OApplication::setTitle( const QString& title ) const |
117 | { | 118 | { |
118 | if ( mainWidget() ) | 119 | if ( mainWidget() ) |
119 | { | 120 | { |
120 | if ( !title.isNull() ) | 121 | if ( !title.isNull() ) |
121 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); | 122 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); |
122 | else | 123 | else |
123 | mainWidget()->setCaption( _appname ); | 124 | mainWidget()->setCaption( _appname ); |
124 | } | 125 | } |
125 | } | 126 | } |
126 | 127 | ||
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h index 72a659e..cc506a2 100644 --- a/libopie2/opiecore/oapplication.h +++ b/libopie2/opiecore/oapplication.h | |||
@@ -1,105 +1,104 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the Opie Project | 2 | � � � � � � � � This file is part of the Opie Project |
3 | 3 | � � � � � � � Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | |
4 | � � � � � � � Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
5 | =. | 4 | =. |
6 | .=l. | 5 | .=l. |
7 | � � � � � �.>+-= | 6 | � � � � � �.>+-= |
8 | �_;:, � � .> � �:=|. This program is free software; you can | 7 | �_;:, � � .> � �:=|. This program is free software; you can |
9 | .> <`_, � > �. � <= redistribute it and/or modify it under | 8 | .> <`_, � > �. � <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public |
11 | .="- .-=="i, � � .._ License as published by the Free Software | 10 | .="- .-=="i, � � .._ License as published by the Free Software |
12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 11 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
13 | � � �._= =} � � � : or (at your option) any later version. | 12 | � � �._= =} � � � : or (at your option) any later version. |
14 | � � .%`+i> � � � _;_. | 13 | � � .%`+i> � � � _;_. |
15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that | 14 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that |
16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 15 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
17 | � � : .. � �.:, � � . . . without even the implied warranty of | 16 | � � : .. � �.:, � � . . . without even the implied warranty of |
18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU | 18 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= � � � = � � � ; Library General Public License for more | 19 | ..}^=.= � � � = � � � ; Library General Public License for more |
21 | ++= � -. � � .` � � .: details. | 20 | ++= � -. � � .` � � .: details. |
22 | �: � � = �...= . :.=- | 21 | �: � � = �...= . :.=- |
23 | �-. � .:....=;==+<; You should have received a copy of the GNU | 22 | �-. � .:....=;==+<; You should have received a copy of the GNU |
24 | � -_. . . � )=. �= Library General Public License along with | 23 | � -_. . . � )=. �= Library General Public License along with |
25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. | 24 | � � -- � � � �:-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
29 | */ | 28 | */ |
30 | 29 | ||
31 | #ifndef OAPPLICATION_H | 30 | #ifndef OAPPLICATION_H |
32 | #define OAPPLICATION_H | 31 | #define OAPPLICATION_H |
33 | 32 | ||
34 | #define oApp OApplication::oApplication() | 33 | #define oApp OApplication::oApplication() |
35 | 34 | ||
36 | 35 | ||
37 | #include <qpe/qpeapplication.h> | 36 | #include <qpe/qpeapplication.h> |
38 | 37 | ||
39 | 38 | ||
40 | class OApplicationPrivate; | 39 | class OApplicationPrivate; |
41 | class OConfig; | 40 | class OConfig; |
42 | 41 | ||
43 | 42 | ||
44 | class OApplication : public QPEApplication | 43 | class OApplication : public QPEApplication |
45 | { | 44 | { |
46 | Q_OBJECT | 45 | Q_OBJECT |
47 | 46 | ||
48 | public: | 47 | public: |
49 | /** | 48 | /** |
50 | * Constructor. Parses command-line arguments and sets the window caption. | 49 | * Constructor. Parses command-line arguments and sets the window caption. |
51 | * | 50 | * |
52 | * @param rAppName application name. Will be used for finding the | 51 | * @param rAppName application name. Will be used for finding the |
53 | * associated message, icon and configuration files | 52 | * associated message, icon and configuration files |
54 | * | 53 | * |
55 | */ | 54 | */ |
56 | OApplication( int& argc, char** argv, const QCString& rAppName ); | 55 | OApplication( int& argc, char** argv, const QCString& rAppName ); |
57 | /** | 56 | /** |
58 | * Destructor. Destroys the application object and its children. | 57 | * Destructor. Destroys the application object and its children. |
59 | */ | 58 | */ |
60 | virtual ~OApplication(); | 59 | virtual ~OApplication(); |
61 | /** | 60 | /** |
62 | * @returns the process-wide application object | 61 | * @returns the process-wide application object |
63 | * | 62 | * |
64 | * This is similar to the global @ref QApplication pointer qApp. It | 63 | * This is similar to the global @ref QApplication pointer qApp. It |
65 | * allows access to the single global OApplication object, since | 64 | * allows access to the single global OApplication object, since |
66 | * more than one cannot be created in the same application. It | 65 | * more than one cannot be created in the same application. It |
67 | * saves you the trouble of having to pass the pointer explicitly | 66 | * saves you the trouble of having to pass the pointer explicitly |
68 | * to every function that may require it. | 67 | * to every function that may require it. |
69 | */ | 68 | */ |
70 | static OApplication* oApplication() { return _instance; }; | 69 | static OApplication* oApplication() { return _instance; }; |
71 | /** | 70 | /** |
72 | * Returns the application name as given during creation. | 71 | * Returns the application name as given during creation. |
73 | * | 72 | * |
74 | * @returns a reference to the application name | 73 | * @returns a reference to the application name |
75 | */ | 74 | */ |
76 | const QCString& appName() const { return _appname; }; | 75 | const QCString& appName() const { return _appname; }; |
77 | /** | 76 | /** |
78 | * @returns the application session config object. | 77 | * @returns the application session config object. |
79 | * | 78 | * |
80 | * @see OConfig | 79 | * @see OConfig |
81 | */ | 80 | */ |
82 | OConfig* config(); | 81 | OConfig* config(); |
83 | /** | 82 | /** |
84 | * Shows the main @a widget and sets the name of the application as window caption. | 83 | * Shows the main @a widget and sets the name of the application as window caption. |
85 | */ | 84 | */ |
86 | virtual void showMainWidget( QWidget* widget, bool nomax = false ); | 85 | virtual void showMainWidget( QWidget* widget, bool nomax = false ); |
87 | /** | 86 | /** |
88 | * Set the application title. The application title will be concatenated | 87 | * Set the application title. The application title will be concatenated |
89 | * to the application name given in the constructor. | 88 | * to the application name given in the constructor. |
90 | * | 89 | * |
91 | * @param title the title. If not given, resets caption to appname | 90 | * @param title the title. If not given, resets caption to appname |
92 | */ | 91 | */ |
93 | virtual void setTitle( const QString& title = QString::null ) const; | 92 | virtual void setTitle( const QString& title = QString::null ) const; |
94 | 93 | ||
95 | protected: | 94 | protected: |
96 | void init(); | 95 | void init(); |
97 | 96 | ||
98 | private: | 97 | private: |
99 | const QCString _appname; | 98 | const QCString _appname; |
100 | static OApplication* _instance; | 99 | static OApplication* _instance; |
101 | OConfig* _config; | 100 | OConfig* _config; |
102 | OApplicationPrivate* d; | 101 | OApplicationPrivate* d; |
103 | }; | 102 | }; |
104 | 103 | ||
105 | #endif // OAPPLICATION_H | 104 | #endif // OAPPLICATION_H |
diff --git a/libopie2/opiecore/oglobal.cpp b/libopie2/opiecore/oglobal.cpp index ae2fcb6..3390ec0 100644 --- a/libopie2/opiecore/oglobal.cpp +++ b/libopie2/opiecore/oglobal.cpp | |||
@@ -1,43 +1,43 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the Opie Project | 2 | � � � � � � � � This file is part of the Opie Project |
3 | 3 | � � � � � � � Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | |
4 | � � � � � � � Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
5 | =. | 4 | =. |
6 | .=l. | 5 | .=l. |
7 | � � � � � �.>+-= | 6 | � � � � � �.>+-= |
8 | �_;:, � � .> � �:=|. This program is free software; you can | 7 | �_;:, � � .> � �:=|. This program is free software; you can |
9 | .> <`_, � > �. � <= redistribute it and/or modify it under | 8 | .> <`_, � > �. � <= redistribute it and/or modify it under |
10 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public |
11 | .="- .-=="i, � � .._ License as published by the Free Software | 10 | .="- .-=="i, � � .._ License as published by the Free Software |
12 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 11 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
13 | � � �._= =} � � � : or (at your option) any later version. | 12 | � � �._= =} � � � : or (at your option) any later version. |
14 | � � .%`+i> � � � _;_. | 13 | � � .%`+i> � � � _;_. |
15 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that | 14 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that |
16 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 15 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
17 | � � : .. � �.:, � � . . . without even the implied warranty of | 16 | � � : .. � �.:, � � . . . without even the implied warranty of |
18 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
19 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU | 18 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU |
20 | ..}^=.= � � � = � � � ; Library General Public License for more | 19 | ..}^=.= � � � = � � � ; Library General Public License for more |
21 | ++= � -. � � .` � � .: details. | 20 | ++= � -. � � .` � � .: details. |
22 | �: � � = �...= . :.=- | 21 | �: � � = �...= . :.=- |
23 | �-. � .:....=;==+<; You should have received a copy of the GNU | 22 | �-. � .:....=;==+<; You should have received a copy of the GNU |
24 | � -_. . . � )=. �= Library General Public License along with | 23 | � -_. . . � )=. �= Library General Public License along with |
25 | � � -- � � � �:-=` this library; see the file COPYING.LIB. | 24 | � � -- � � � �:-=` this library; see the file COPYING.LIB. |
26 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
27 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
28 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
29 | */ | 28 | */ |
30 | 29 | ||
31 | #include <opie2/oglobal.h> | 30 | #include <opie2/oglobal.h> |
32 | 31 | ||
33 | OConfig* OGlobal::_config = 0; | 32 | OConfig* OGlobal::_config = 0; |
34 | 33 | ||
35 | OConfig* OGlobal::config() | 34 | OConfig* OGlobal::config() |
36 | { | 35 | { |
37 | if ( !OGlobal::_config ) | 36 | if ( !OGlobal::_config ) |
38 | { | 37 | { |
38 | // odebug classes are reading config, so can't use them here! | ||
39 | qDebug( "OGlobal::creating global configuration instance." ); | 39 | qDebug( "OGlobal::creating global configuration instance." ); |
40 | OGlobal::_config = new OConfig( "global" ); | 40 | OGlobal::_config = new OConfig( "global" ); |
41 | } | 41 | } |
42 | return OGlobal::_config; | 42 | return OGlobal::_config; |
43 | } | 43 | } |