author | zecke <zecke> | 2005-01-23 20:21:35 (UTC) |
---|---|---|
committer | zecke <zecke> | 2005-01-23 20:21:35 (UTC) |
commit | 8f2fbef1de1b3803a21d51752fee1014c951cc12 (patch) (unidiff) | |
tree | 9289dbe83d2f25af0e95adcad7e3e230920a9b12 | |
parent | da166ce6066568db9b7ac0bf5c2cc0dc9afb0776 (diff) | |
download | opie-8f2fbef1de1b3803a21d51752fee1014c951cc12.zip opie-8f2fbef1de1b3803a21d51752fee1014c951cc12.tar.gz opie-8f2fbef1de1b3803a21d51752fee1014c951cc12.tar.bz2 |
-Use the global directory for .obj and .moc
-Include the foo.moc to work better
The problem just came up yesterday
4 files changed, 1 insertions, 7 deletions
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp index 6712870..2ee4a65 100644 --- a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp | |||
@@ -1,33 +1,32 @@ | |||
1 | #include <opie2/oapplication.h> | 1 | #include <opie2/oapplication.h> |
2 | #include <opie2/oconfig.h> | 2 | #include <opie2/oconfig.h> |
3 | #include <qpe/config.h> | 3 | #include <qpe/config.h> |
4 | 4 | ||
5 | using namespace Opie::Core; | 5 | using namespace Opie::Core; |
6 | 6 | ||
7 | int main( int argc, char** argv ) | 7 | int main( int argc, char** argv ) |
8 | { | 8 | { |
9 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); | 9 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); |
10 | 10 | ||
11 | OConfigGroupSaver c1( app->config(), "MyGroup" ); | 11 | OConfigGroupSaver c1( app->config(), "MyGroup" ); |
12 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); | 12 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); |
13 | { | 13 | { |
14 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); | 14 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); |
15 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); | 15 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); |
16 | } // closing the scope returns to the last group | 16 | } // closing the scope returns to the last group |
17 | 17 | ||
18 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); | 18 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); |
19 | 19 | ||
20 | // do more stuff ... | 20 | // do more stuff ... |
21 | 21 | ||
22 | // in this (special) case it is necessary to manually call OConfig::write() (see below) | 22 | // in this (special) case it is necessary to manually call OConfig::write() (see below) |
23 | app->config()->write(); | 23 | app->config()->write(); |
24 | 24 | ||
25 | // can't delete the app when using the OConfigGroupSaver on top level scope, | 25 | // can't delete the app when using the OConfigGroupSaver on top level scope, |
26 | // because the destructor of the OConfigGroupSaver needs an application object | 26 | // because the destructor of the OConfigGroupSaver needs an application object |
27 | //delete app; // destructor deletes config which writes changes back to disk | 27 | //delete app; // destructor deletes config which writes changes back to disk |
28 | 28 | ||
29 | return 0; | 29 | return 0; |
30 | 30 | ||
31 | } | 31 | } |
32 | 32 | ||
33 | //#include "moc/oconfigdemo.moc" | ||
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro index 9721e99..b29c106 100644 --- a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro | |||
@@ -1,20 +1,18 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
3 | HEADERS = | 3 | HEADERS = |
4 | SOURCES = oconfigdemo.cpp | 4 | SOURCES = oconfigdemo.cpp |
5 | 5 | ||
6 | INCLUDEPATH += $(OPIEDIR)/include | 6 | INCLUDEPATH += $(OPIEDIR)/include |
7 | DEPENDPATH += $(OPIEDIR)/include | 7 | DEPENDPATH += $(OPIEDIR)/include |
8 | LIBS += -lopiecore2 | 8 | LIBS += -lopiecore2 |
9 | TARGET = oconfigdemo | 9 | TARGET = oconfigdemo |
10 | MOC_DIR = moc | ||
11 | OBJECTS_DIR = obj | ||
12 | 10 | ||
13 | !contains( platform, x11 ) { | 11 | !contains( platform, x11 ) { |
14 | include( $(OPIEDIR)/include.pro ) | 12 | include( $(OPIEDIR)/include.pro ) |
15 | } | 13 | } |
16 | 14 | ||
17 | contains( platform, x11 ) { | 15 | contains( platform, x11 ) { |
18 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 16 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
19 | } | 17 | } |
20 | 18 | ||
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp index c0369ef..b046d28 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp | |||
@@ -1,142 +1,142 @@ | |||
1 | /* QT */ | 1 | /* QT */ |
2 | 2 | ||
3 | #include <qvbox.h> | 3 | #include <qvbox.h> |
4 | #include <qhbox.h> | 4 | #include <qhbox.h> |
5 | #include <qvbuttongroup.h> | 5 | #include <qvbuttongroup.h> |
6 | #include <qhbuttongroup.h> | 6 | #include <qhbuttongroup.h> |
7 | #include <qlineedit.h> | 7 | #include <qlineedit.h> |
8 | #include <qradiobutton.h> | 8 | #include <qradiobutton.h> |
9 | #include <qpushbutton.h> | 9 | #include <qpushbutton.h> |
10 | 10 | ||
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | 12 | ||
13 | #include <qpe/config.h> | 13 | #include <qpe/config.h> |
14 | 14 | ||
15 | #include <opie2/odebug.h> | 15 | #include <opie2/odebug.h> |
16 | #include <opie2/oapplication.h> | 16 | #include <opie2/oapplication.h> |
17 | #include <opie2/oglobal.h> | 17 | #include <opie2/oglobal.h> |
18 | #include <opie2/oglobalsettings.h> | 18 | #include <opie2/oglobalsettings.h> |
19 | 19 | ||
20 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
21 | 21 | ||
22 | class DemoApp : public OApplication | 22 | class DemoApp : public OApplication |
23 | { | 23 | { |
24 | Q_OBJECT | 24 | Q_OBJECT |
25 | public: | 25 | public: |
26 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) | 26 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) |
27 | { | 27 | { |
28 | // you have access to your OApplication object via oApp | 28 | // you have access to your OApplication object via oApp |
29 | odebug << "Process-wide OApplication object @ " << oApp << "" << oendl; | 29 | odebug << "Process-wide OApplication object @ " << oApp << "" << oendl; |
30 | 30 | ||
31 | // you have access to global settings via OGlobalSettings | 31 | // you have access to global settings via OGlobalSettings |
32 | int mode = OGlobalSettings::debugMode(); | 32 | int mode = OGlobalSettings::debugMode(); |
33 | 33 | ||
34 | QVBox* vbox = new QVBox(); | 34 | QVBox* vbox = new QVBox(); |
35 | setMainWidget( vbox ); | 35 | setMainWidget( vbox ); |
36 | 36 | ||
37 | g = new QVButtonGroup( "Output Strategy", vbox ); | 37 | g = new QVButtonGroup( "Output Strategy", vbox ); |
38 | QRadioButton* r0 = new QRadioButton( "file", g ); | 38 | QRadioButton* r0 = new QRadioButton( "file", g ); |
39 | QRadioButton* r1 = new QRadioButton( "messagebox", g ); | 39 | QRadioButton* r1 = new QRadioButton( "messagebox", g ); |
40 | QRadioButton* r2 = new QRadioButton( "stderr", g ); | 40 | QRadioButton* r2 = new QRadioButton( "stderr", g ); |
41 | QRadioButton* r3 = new QRadioButton( "syslog", g ); | 41 | QRadioButton* r3 = new QRadioButton( "syslog", g ); |
42 | QRadioButton* r4 = new QRadioButton( "socket", g ); | 42 | QRadioButton* r4 = new QRadioButton( "socket", g ); |
43 | g->insert( r0, 0 ); | 43 | g->insert( r0, 0 ); |
44 | g->insert( r1, 1 ); | 44 | g->insert( r1, 1 ); |
45 | g->insert( r2, 2 ); | 45 | g->insert( r2, 2 ); |
46 | g->insert( r3, 3 ); | 46 | g->insert( r3, 3 ); |
47 | g->insert( r4, 4 ); | 47 | g->insert( r4, 4 ); |
48 | g->setRadioButtonExclusive( true ); | 48 | g->setRadioButtonExclusive( true ); |
49 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); | 49 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); |
50 | 50 | ||
51 | if ( mode != -1 ) g->setButton( mode ); | 51 | if ( mode != -1 ) g->setButton( mode ); |
52 | 52 | ||
53 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); | 53 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); |
54 | e = new QLineEdit( hbox ); | 54 | e = new QLineEdit( hbox ); |
55 | QPushButton* pb = new QPushButton( hbox ); | 55 | QPushButton* pb = new QPushButton( hbox ); |
56 | 56 | ||
57 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); | 57 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); |
58 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); | 58 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); |
59 | 59 | ||
60 | // show the additional debug mode dependent output information | 60 | // show the additional debug mode dependent output information |
61 | e->setText( OGlobalSettings::debugOutput() ); | 61 | e->setText( OGlobalSettings::debugOutput() ); |
62 | 62 | ||
63 | // buttos | 63 | // buttos |
64 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); | 64 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); |
65 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); | 65 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); |
66 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); | 66 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); |
67 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); | 67 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); |
68 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); | 68 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); |
69 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); | 69 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); |
70 | QPushButton* fatal = new QPushButton( "Emit a Fatal Output!", vbox ); | 70 | QPushButton* fatal = new QPushButton( "Emit a Fatal Output!", vbox ); |
71 | connect( fatal, SIGNAL( clicked() ), this, SLOT( emitFatalOutput() ) ); | 71 | connect( fatal, SIGNAL( clicked() ), this, SLOT( emitFatalOutput() ) ); |
72 | 72 | ||
73 | QPushButton* tb = new QPushButton( "Emit a Fatal Backtrace!", vbox ); | 73 | QPushButton* tb = new QPushButton( "Emit a Fatal Backtrace!", vbox ); |
74 | connect( tb, SIGNAL( clicked() ), this, SLOT( emitTBOutput() ) ); | 74 | connect( tb, SIGNAL( clicked() ), this, SLOT( emitTBOutput() ) ); |
75 | 75 | ||
76 | info->show(); | 76 | info->show(); |
77 | warn->show(); | 77 | warn->show(); |
78 | error->show(); | 78 | error->show(); |
79 | fatal->show(); | 79 | fatal->show(); |
80 | tb->show(); | 80 | tb->show(); |
81 | g->show(); | 81 | g->show(); |
82 | hbox->show(); | 82 | hbox->show(); |
83 | e->show(); | 83 | e->show(); |
84 | vbox->show(); | 84 | vbox->show(); |
85 | showMainWidget( vbox ); | 85 | showMainWidget( vbox ); |
86 | } | 86 | } |
87 | 87 | ||
88 | public slots: | 88 | public slots: |
89 | void chooseMethod(int method) | 89 | void chooseMethod(int method) |
90 | { | 90 | { |
91 | m = method; | 91 | m = method; |
92 | odebug << "choosing method: " << method << "" << oendl; | 92 | odebug << "choosing method: " << method << "" << oendl; |
93 | OConfig* g = OGlobal::config(); | 93 | OConfig* g = OGlobal::config(); |
94 | g->setGroup( "General" ); | 94 | g->setGroup( "General" ); |
95 | g->writeEntry( "debugMode", m ); | 95 | g->writeEntry( "debugMode", m ); |
96 | e->setText( OGlobalSettings::debugOutput() ); | 96 | e->setText( OGlobalSettings::debugOutput() ); |
97 | g->write(); | 97 | g->write(); |
98 | } | 98 | } |
99 | void updateDebugOutput() | 99 | void updateDebugOutput() |
100 | { | 100 | { |
101 | OConfig* g = OGlobal::config(); | 101 | OConfig* g = OGlobal::config(); |
102 | g->setGroup( "General" ); | 102 | g->setGroup( "General" ); |
103 | g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() ); | 103 | g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() ); |
104 | g->write(); | 104 | g->write(); |
105 | } | 105 | } |
106 | void emitInfoOutput() | 106 | void emitInfoOutput() |
107 | { | 107 | { |
108 | odebug << "This is a debug message" << oendl; | 108 | odebug << "This is a debug message" << oendl; |
109 | } | 109 | } |
110 | void emitWarningOutput() | 110 | void emitWarningOutput() |
111 | { | 111 | { |
112 | owarn << "This is a warning message" << oendl; | 112 | owarn << "This is a warning message" << oendl; |
113 | } | 113 | } |
114 | void emitErrorOutput() | 114 | void emitErrorOutput() |
115 | { | 115 | { |
116 | oerr << "This is an errror message" << oendl; | 116 | oerr << "This is an errror message" << oendl; |
117 | } | 117 | } |
118 | void emitFatalOutput() | 118 | void emitFatalOutput() |
119 | { | 119 | { |
120 | ofatal << "This is a fatal message" << oendl; | 120 | ofatal << "This is a fatal message" << oendl; |
121 | } | 121 | } |
122 | void emitTBOutput() | 122 | void emitTBOutput() |
123 | { | 123 | { |
124 | ofatal << "This is a fatal message + backtrace\n" + odBacktrace(); // odBacktrace includes \n | 124 | ofatal << "This is a fatal message + backtrace\n" + odBacktrace(); // odBacktrace includes \n |
125 | } | 125 | } |
126 | 126 | ||
127 | private: | 127 | private: |
128 | QButtonGroup* g; | 128 | QButtonGroup* g; |
129 | int m; | 129 | int m; |
130 | QLineEdit* e; | 130 | QLineEdit* e; |
131 | }; | 131 | }; |
132 | 132 | ||
133 | int main( int argc, char** argv ) | 133 | int main( int argc, char** argv ) |
134 | { | 134 | { |
135 | DemoApp* app = new DemoApp( argc, argv ); | 135 | DemoApp* app = new DemoApp( argc, argv ); |
136 | app->exec(); | 136 | app->exec(); |
137 | 137 | ||
138 | return 0; | 138 | return 0; |
139 | 139 | ||
140 | } | 140 | } |
141 | 141 | ||
142 | #include "moc/odebugdemo.moc" | 142 | #include "odebugdemo.moc" |
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro index 781d678..e06053c 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro | |||
@@ -1,20 +1,17 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
3 | HEADERS = | 3 | HEADERS = |
4 | SOURCES = odebugdemo.cpp | 4 | SOURCES = odebugdemo.cpp |
5 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
6 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
7 | LIBS += -lopiecore2 | 7 | LIBS += -lopiecore2 |
8 | TARGET = odebugdemo | 8 | TARGET = odebugdemo |
9 | 9 | ||
10 | OBJECTS_DIR = obj | ||
11 | |||
12 | !contains( platform, x11 ) { | 10 | !contains( platform, x11 ) { |
13 | include( $(OPIEDIR)/include.pro ) | 11 | include( $(OPIEDIR)/include.pro ) |
14 | } | 12 | } |
15 | 13 | ||
16 | contains( platform, x11 ) { | 14 | contains( platform, x11 ) { |
17 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 15 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
18 | } | 16 | } |
19 | 17 | ||
20 | MOC_DIR = moc | ||