-rw-r--r-- | libopie2/opiecore/oapplication.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp index 1b85057..d340c0e 100644 --- a/libopie2/opiecore/oapplication.cpp +++ b/libopie2/opiecore/oapplication.cpp | |||
@@ -1,127 +1,127 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> | 3 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@Vanille.de> |
4 | =. | 4 | =. |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include <opie2/oapplication.h> | 30 | #include <opie2/oapplication.h> |
31 | #include <opie2/oconfig.h> | 31 | #include <opie2/oconfig.h> |
32 | #include <opie2/odebug.h> | 32 | #include <opie2/odebug.h> |
33 | 33 | ||
34 | #include <signal.h> | 34 | #include <signal.h> |
35 | #include <stdio.h> | 35 | #include <stdio.h> |
36 | 36 | ||
37 | OApplication* OApplication::_instance = 0; | 37 | OApplication* OApplication::_instance = 0; |
38 | 38 | ||
39 | /**************************************************************************************************/ | 39 | /************************************************************************************************** |
40 | /* OApplicationPrivate | 40 | * OApplicationPrivate |
41 | /**************************************************************************************************/ | 41 | **************************************************************************************************/ |
42 | 42 | ||
43 | class OApplicationPrivate | 43 | class OApplicationPrivate |
44 | { | 44 | { |
45 | public: | 45 | public: |
46 | OApplicationPrivate() {}; | 46 | OApplicationPrivate() {}; |
47 | ~OApplicationPrivate() {}; | 47 | ~OApplicationPrivate() {}; |
48 | }; | 48 | }; |
49 | 49 | ||
50 | /**************************************************************************************************/ | 50 | /************************************************************************************************** |
51 | /* OApplication | 51 | * OApplication |
52 | /**************************************************************************************************/ | 52 | **************************************************************************************************/ |
53 | 53 | ||
54 | 54 | ||
55 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) | 55 | OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) |
56 | :QPEApplication( argc, argv ), | 56 | :QPEApplication( argc, argv ), |
57 | _appname( rAppName ), | 57 | _appname( rAppName ), |
58 | _config( 0 ) | 58 | _config( 0 ) |
59 | { | 59 | { |
60 | init(); | 60 | init(); |
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | OApplication::~OApplication() | 64 | OApplication::~OApplication() |
65 | { | 65 | { |
66 | delete d; | 66 | delete d; |
67 | if ( _config ) | 67 | if ( _config ) |
68 | delete _config; | 68 | delete _config; |
69 | OApplication::_instance = 0; | 69 | OApplication::_instance = 0; |
70 | // after deconstruction of the one-and-only application object, | 70 | // after deconstruction of the one-and-only application object, |
71 | // the construction of another object is allowed | 71 | // the construction of another object is allowed |
72 | } | 72 | } |
73 | 73 | ||
74 | 74 | ||
75 | OConfig* OApplication::config() | 75 | OConfig* OApplication::config() |
76 | { | 76 | { |
77 | if ( !_config ) | 77 | if ( !_config ) |
78 | { | 78 | { |
79 | _config = new OConfig( _appname ); | 79 | _config = new OConfig( _appname ); |
80 | } | 80 | } |
81 | return _config; | 81 | return _config; |
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | void OApplication::init() | 85 | void OApplication::init() |
86 | { | 86 | { |
87 | d = new OApplicationPrivate(); | 87 | d = new OApplicationPrivate(); |
88 | if ( !OApplication::_instance ) | 88 | if ( !OApplication::_instance ) |
89 | { | 89 | { |
90 | OApplication::_instance = this; | 90 | OApplication::_instance = this; |
91 | 91 | ||
92 | /* register SIGSEGV handler to give programs an option | 92 | /* register SIGSEGV handler to give programs an option |
93 | * to exit gracefully, e.g. save or close devices or files. | 93 | * to exit gracefully, e.g. save or close devices or files. |
94 | struct sigaction sa; | 94 | struct sigaction sa; |
95 | sa.sa_handler = ( void (*)(int) ) &segv_handler; | 95 | sa.sa_handler = ( void (*)(int) ) &segv_handler; |
96 | sa.sa_flags = SA_SIGINFO | SA_RESTART; | 96 | sa.sa_flags = SA_SIGINFO | SA_RESTART; |
97 | sigemptyset(&sa.sa_mask); | 97 | sigemptyset(&sa.sa_mask); |
98 | sigaction(SIGSEGV, &sa, NULL); | 98 | sigaction(SIGSEGV, &sa, NULL); |
99 | */ | 99 | */ |
100 | } | 100 | } |
101 | else | 101 | else |
102 | { | 102 | { |
103 | ofatal << "OApplication: Can't create more than one OApplication object. Aborting." << oendl; | 103 | ofatal << "OApplication: Can't create more than one OApplication object. Aborting." << oendl; |
104 | //FIXME exit gracefully ? | 104 | //FIXME exit gracefully ? |
105 | ::exit( -1 ); | 105 | ::exit( -1 ); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | 109 | ||
110 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) | 110 | void OApplication::showMainWidget( QWidget* widget, bool nomax ) |
111 | { | 111 | { |
112 | QPEApplication::showMainWidget( widget, nomax ); | 112 | QPEApplication::showMainWidget( widget, nomax ); |
113 | widget->setCaption( _appname ); | 113 | widget->setCaption( _appname ); |
114 | } | 114 | } |
115 | 115 | ||
116 | 116 | ||
117 | void OApplication::setTitle( const QString& title ) const | 117 | void OApplication::setTitle( const QString& title ) const |
118 | { | 118 | { |
119 | if ( mainWidget() ) | 119 | if ( mainWidget() ) |
120 | { | 120 | { |
121 | if ( !title.isNull() ) | 121 | if ( !title.isNull() ) |
122 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); | 122 | mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); |
123 | else | 123 | else |
124 | mainWidget()->setCaption( _appname ); | 124 | mainWidget()->setCaption( _appname ); |
125 | } | 125 | } |
126 | } | 126 | } |
127 | 127 | ||