summaryrefslogtreecommitdiff
path: root/libopie2
Unidiff
Diffstat (limited to 'libopie2') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiecore/oapplication.cpp11
-rw-r--r--libopie2/opiecore/oapplication.h11
-rw-r--r--libopie2/opiecore/opiecore.pro9
3 files changed, 8 insertions, 23 deletions
diff --git a/libopie2/opiecore/oapplication.cpp b/libopie2/opiecore/oapplication.cpp
index 84cab48..c3cacce 100644
--- a/libopie2/opiecore/oapplication.cpp
+++ b/libopie2/opiecore/oapplication.cpp
@@ -25,113 +25,102 @@
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#include <opie2/odebug.h>
34 34
35#include <signal.h> 35#include <signal.h>
36#include <stdio.h> 36#include <stdio.h>
37 37
38OApplication* OApplication::_instance = 0; 38OApplication* OApplication::_instance = 0;
39 39
40/**************************************************************************************************/ 40/**************************************************************************************************/
41/* OApplicationPrivate 41/* OApplicationPrivate
42/**************************************************************************************************/ 42/**************************************************************************************************/
43 43
44class OApplicationPrivate 44class OApplicationPrivate
45{ 45{
46 public: 46 public:
47 OApplicationPrivate() {}; 47 OApplicationPrivate() {};
48 ~OApplicationPrivate() {}; 48 ~OApplicationPrivate() {};
49}; 49};
50 50
51/**************************************************************************************************/ 51/**************************************************************************************************/
52/* OApplication 52/* OApplication
53/**************************************************************************************************/ 53/**************************************************************************************************/
54 54
55 55
56OApplication::OApplication( int& argc, char** argv, const QCString& rAppName ) 56OApplication::OApplication( int& argc, char** argv, const QCString& rAppName )
57#ifdef QWS
58 :QPEApplication( argc, argv ), 57 :QPEApplication( argc, argv ),
59#else
60 :QApplication( argc, argv ),
61#endif
62 _appname( rAppName ), 58 _appname( rAppName ),
63 _config( 0 ) 59 _config( 0 )
64{ 60{
65 init(); 61 init();
66} 62}
67 63
68 64
69OApplication::~OApplication() 65OApplication::~OApplication()
70{ 66{
71 delete d; 67 delete d;
72 if ( _config ) 68 if ( _config )
73 delete _config; 69 delete _config;
74 OApplication::_instance = 0; 70 OApplication::_instance = 0;
75 // after deconstruction of the one-and-only application object, 71 // after deconstruction of the one-and-only application object,
76 // the construction of another object is allowed 72 // the construction of another object is allowed
77} 73}
78 74
79 75
80OConfig* OApplication::config() 76OConfig* OApplication::config()
81{ 77{
82 if ( !_config ) 78 if ( !_config )
83 { 79 {
84 _config = new OConfig( _appname ); 80 _config = new OConfig( _appname );
85 } 81 }
86 return _config; 82 return _config;
87} 83}
88 84
89 85
90void OApplication::init() 86void OApplication::init()
91{ 87{
92 d = new OApplicationPrivate(); 88 d = new OApplicationPrivate();
93 if ( !OApplication::_instance ) 89 if ( !OApplication::_instance )
94 { 90 {
95 OApplication::_instance = this; 91 OApplication::_instance = this;
96 92
97 /* register SIGSEGV handler to give programs an option 93 /* register SIGSEGV handler to give programs an option
98 * to exit gracefully, e.g. save or close devices or files. 94 * to exit gracefully, e.g. save or close devices or files.
99 struct sigaction sa; 95 struct sigaction sa;
100 sa.sa_handler = ( void (*)(int) ) &segv_handler; 96 sa.sa_handler = ( void (*)(int) ) &segv_handler;
101 sa.sa_flags = SA_SIGINFO | SA_RESTART; 97 sa.sa_flags = SA_SIGINFO | SA_RESTART;
102 sigemptyset(&sa.sa_mask); 98 sigemptyset(&sa.sa_mask);
103 sigaction(SIGSEGV, &sa, NULL); 99 sigaction(SIGSEGV, &sa, NULL);
104 */ 100 */
105 } 101 }
106 else 102 else
107 { 103 {
108 qFatal( "OApplication: Can't create more than one OApplication object. Aborting." ); 104 qFatal( "OApplication: Can't create more than one OApplication object. Aborting." );
109 } 105 }
110} 106}
111 107
112 108
113void OApplication::showMainWidget( QWidget* widget, bool nomax ) 109void OApplication::showMainWidget( QWidget* widget, bool nomax )
114{ 110{
115#ifdef QWS
116 QPEApplication::showMainWidget( widget, nomax ); 111 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
123 widget->setCaption( _appname ); 112 widget->setCaption( _appname );
124} 113}
125 114
126 115
127void OApplication::setTitle( const QString& title ) const 116void OApplication::setTitle( const QString& title ) const
128{ 117{
129 if ( mainWidget() ) 118 if ( mainWidget() )
130 { 119 {
131 if ( !title.isNull() ) 120 if ( !title.isNull() )
132 mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title ); 121 mainWidget()->setCaption( QString(_appname) + QString( " - " ) + title );
133 else 122 else
134 mainWidget()->setCaption( _appname ); 123 mainWidget()->setCaption( _appname );
135 } 124 }
136} 125}
137 126
diff --git a/libopie2/opiecore/oapplication.h b/libopie2/opiecore/oapplication.h
index 3043910..72a659e 100644
--- a/libopie2/opiecore/oapplication.h
+++ b/libopie2/opiecore/oapplication.h
@@ -4,78 +4,73 @@
4              Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de> 4              Copyright (C) 2003 Michael Lauer <mickey@tm.informatik.uni-frankfurt.de>
5 =. 5 =.
6 .=l. 6 .=l.
7           .>+-= 7           .>+-=
8 _;:,     .>    :=|. This program is free software; you can 8 _;:,     .>    :=|. This program is free software; you can
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#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
37#include <qpe/qpeapplication.h> 37#include <qpe/qpeapplication.h>
38#else 38
39#include <qapplication.h>
40#endif
41 39
42class OApplicationPrivate; 40class OApplicationPrivate;
43class OConfig; 41class OConfig;
44 42
45#ifdef QWS 43
46class OApplication : public QPEApplication 44class OApplication : public QPEApplication
47#else
48class OApplication : public QApplication
49#endif
50{ 45{
51 Q_OBJECT 46 Q_OBJECT
52 47
53 public: 48 public:
54 /** 49 /**
55 * Constructor. Parses command-line arguments and sets the window caption. 50 * Constructor. Parses command-line arguments and sets the window caption.
56 * 51 *
57 * @param rAppName application name. Will be used for finding the 52 * @param rAppName application name. Will be used for finding the
58 * associated message, icon and configuration files 53 * associated message, icon and configuration files
59 * 54 *
60 */ 55 */
61 OApplication( int& argc, char** argv, const QCString& rAppName ); 56 OApplication( int& argc, char** argv, const QCString& rAppName );
62 /** 57 /**
63 * Destructor. Destroys the application object and its children. 58 * Destructor. Destroys the application object and its children.
64 */ 59 */
65 virtual ~OApplication(); 60 virtual ~OApplication();
66 /** 61 /**
67 * @returns the process-wide application object 62 * @returns the process-wide application object
68 * 63 *
69 * This is similar to the global @ref QApplication pointer qApp. It 64 * This is similar to the global @ref QApplication pointer qApp. It
70 * allows access to the single global OApplication object, since 65 * allows access to the single global OApplication object, since
71 * more than one cannot be created in the same application. It 66 * more than one cannot be created in the same application. It
72 * saves you the trouble of having to pass the pointer explicitly 67 * saves you the trouble of having to pass the pointer explicitly
73 * to every function that may require it. 68 * to every function that may require it.
74 */ 69 */
75 static OApplication* oApplication() { return _instance; }; 70 static OApplication* oApplication() { return _instance; };
76 /** 71 /**
77 * Returns the application name as given during creation. 72 * Returns the application name as given during creation.
78 * 73 *
79 * @returns a reference to the application name 74 * @returns a reference to the application name
80 */ 75 */
81 const QCString& appName() const { return _appname; }; 76 const QCString& appName() const { return _appname; };
diff --git a/libopie2/opiecore/opiecore.pro b/libopie2/opiecore/opiecore.pro
index c8a291a..18c6986 100644
--- a/libopie2/opiecore/opiecore.pro
+++ b/libopie2/opiecore/opiecore.pro
@@ -1,38 +1,39 @@
1TEMPLATE = lib 1TEMPLATE = lib
2CONFIG += qt warn_on debug 2CONFIG += qt warn_on debug
3DESTDIR = $(OPIEDIR)/lib 3DESTDIR = $(OPIEDIR)/lib
4HEADERS = oapplication.h \ 4HEADERS = oconfig.h \
5 oconfig.h \
6 ocompletionbase.h \ 5 ocompletionbase.h \
7 ocompletion.h \ 6 ocompletion.h \
8 odebug.h \ 7 odebug.h \
9 oglobal.h \ 8 oglobal.h \
10 oglobalsettings.h \ 9 oglobalsettings.h \
11 osortablevaluelist.h 10 osortablevaluelist.h
12 11
13SOURCES = oapplication.cpp \ 12SOURCES = oconfig.cpp \
14 oconfig.cpp \
15 ocompletionbase.cpp \ 13 ocompletionbase.cpp \
16 ocompletion.cpp \ 14 ocompletion.cpp \
17 odebug.cpp \ 15 odebug.cpp \
18 oglobal.cpp \ 16 oglobal.cpp \
19 oglobalsettings.cpp 17 oglobalsettings.cpp
20 18
21INTERFACES = 19INTERFACES =
22TARGET = opiecore2 20TARGET = opiecore2
23VERSION = 1.8.1 21VERSION = 1.8.1
24INCLUDEPATH += $(OPIEDIR)/include 22INCLUDEPATH += $(OPIEDIR)/include
25DEPENDPATH += $(OPIEDIR)/include 23DEPENDPATH += $(OPIEDIR)/include
26MOC_DIR = moc 24MOC_DIR = moc
27OBJECTS_DIR = obj 25OBJECTS_DIR = obj
28 26
29 27
30!contains( platform, x11 ) { 28!contains( platform, x11 ) {
29 HEADERS += oapplication.h
30 SOURCES += oapplication.cpp
31 LIBS = -lqpe 31 LIBS = -lqpe
32 include ( $(OPIEDIR)/include.pro ) 32 include ( $(OPIEDIR)/include.pro )
33} 33}
34 34
35contains( platform, x11 ) { 35contains( platform, x11 ) {
36 message( NOT building oapplication for X11 )
36 LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib 37 LIBS = -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
37} 38}
38 39