4 files changed, 10 insertions, 2 deletions
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp index a3f8e10..6712870 100644 --- a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp | |||
@@ -1,31 +1,33 @@ | |||
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; | ||
6 | |||
5 | int main( int argc, char** argv ) | 7 | int main( int argc, char** argv ) |
6 | { | 8 | { |
7 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); | 9 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); |
8 | 10 | ||
9 | OConfigGroupSaver c1( app->config(), "MyGroup" ); | 11 | OConfigGroupSaver c1( app->config(), "MyGroup" ); |
10 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); | 12 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); |
11 | { | 13 | { |
12 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); | 14 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); |
13 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); | 15 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); |
14 | } // closing the scope returns to the last group | 16 | } // closing the scope returns to the last group |
15 | 17 | ||
16 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); | 18 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); |
17 | 19 | ||
18 | // do more stuff ... | 20 | // do more stuff ... |
19 | 21 | ||
20 | // 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) |
21 | app->config()->write(); | 23 | app->config()->write(); |
22 | 24 | ||
23 | // 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, |
24 | // because the destructor of the OConfigGroupSaver needs an application object | 26 | // because the destructor of the OConfigGroupSaver needs an application object |
25 | //delete app; // destructor deletes config which writes changes back to disk | 27 | //delete app; // destructor deletes config which writes changes back to disk |
26 | 28 | ||
27 | return 0; | 29 | return 0; |
28 | 30 | ||
29 | } | 31 | } |
30 | 32 | ||
31 | //#include "moc/oconfigdemo.moc" | 33 | //#include "moc/oconfigdemo.moc" |
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp index e8bf04f..0b8e1fe 100644 --- a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp | |||
@@ -1,67 +1,69 @@ | |||
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; | ||
21 | |||
20 | class DemoApp : public OApplication | 22 | class DemoApp : public OApplication |
21 | { | 23 | { |
22 | Q_OBJECT | 24 | Q_OBJECT |
23 | public: | 25 | public: |
24 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) | 26 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) |
25 | { | 27 | { |
26 | // you have access to your OApplication object via oApp | 28 | // you have access to your OApplication object via oApp |
27 | qDebug( "Process-wide OApplication object @ %0x", oApp ); | 29 | qDebug( "Process-wide OApplication object @ %0x", oApp ); |
28 | 30 | ||
29 | // you have access to global settings via OGlobalSettings | 31 | // you have access to global settings via OGlobalSettings |
30 | int mode = OGlobalSettings::debugMode(); | 32 | int mode = OGlobalSettings::debugMode(); |
31 | 33 | ||
32 | QVBox* vbox = new QVBox(); | 34 | QVBox* vbox = new QVBox(); |
33 | setMainWidget( vbox ); | 35 | setMainWidget( vbox ); |
34 | 36 | ||
35 | g = new QVButtonGroup( "Output Strategy", vbox ); | 37 | g = new QVButtonGroup( "Output Strategy", vbox ); |
36 | QRadioButton* r0 = new QRadioButton( "file", g ); | 38 | QRadioButton* r0 = new QRadioButton( "file", g ); |
37 | QRadioButton* r1 = new QRadioButton( "messagebox", g ); | 39 | QRadioButton* r1 = new QRadioButton( "messagebox", g ); |
38 | QRadioButton* r2 = new QRadioButton( "stderr", g ); | 40 | QRadioButton* r2 = new QRadioButton( "stderr", g ); |
39 | QRadioButton* r3 = new QRadioButton( "syslog", g ); | 41 | QRadioButton* r3 = new QRadioButton( "syslog", g ); |
40 | QRadioButton* r4 = new QRadioButton( "socket", g ); | 42 | QRadioButton* r4 = new QRadioButton( "socket", g ); |
41 | g->insert( r0, 0 ); | 43 | g->insert( r0, 0 ); |
42 | g->insert( r1, 1 ); | 44 | g->insert( r1, 1 ); |
43 | g->insert( r2, 2 ); | 45 | g->insert( r2, 2 ); |
44 | g->insert( r3, 3 ); | 46 | g->insert( r3, 3 ); |
45 | g->insert( r4, 4 ); | 47 | g->insert( r4, 4 ); |
46 | g->setRadioButtonExclusive( true ); | 48 | g->setRadioButtonExclusive( true ); |
47 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); | 49 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); |
48 | 50 | ||
49 | if ( mode != -1 ) g->setButton( mode ); | 51 | if ( mode != -1 ) g->setButton( mode ); |
50 | 52 | ||
51 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); | 53 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); |
52 | e = new QLineEdit( hbox ); | 54 | e = new QLineEdit( hbox ); |
53 | QPushButton* pb = new QPushButton( hbox ); | 55 | QPushButton* pb = new QPushButton( hbox ); |
54 | 56 | ||
55 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); | 57 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); |
56 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); | 58 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); |
57 | 59 | ||
58 | // show the additional debug mode dependent output information | 60 | // show the additional debug mode dependent output information |
59 | e->setText( OGlobalSettings::debugOutput() ); | 61 | e->setText( OGlobalSettings::debugOutput() ); |
60 | 62 | ||
61 | // buttos | 63 | // buttos |
62 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); | 64 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); |
63 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); | 65 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); |
64 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); | 66 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); |
65 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); | 67 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); |
66 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); | 68 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); |
67 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); | 69 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); |
diff --git a/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp index 2f5220b..56f1a0b 100644 --- a/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp +++ b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp | |||
@@ -1,13 +1,15 @@ | |||
1 | #include <opie2/oglobalsettings.h> | 1 | #include <opie2/oglobalsettings.h> |
2 | #include <iostream.h> | 2 | #include <iostream> |
3 | |||
4 | using namespace Opie::Core; | ||
3 | 5 | ||
4 | int main( int argc, char** argv ) | 6 | int main( int argc, char** argv ) |
5 | { | 7 | { |
6 | printf( "current debugmode seems to be '%d'\n", OGlobalSettings::debugMode() ); | 8 | printf( "current debugmode seems to be '%d'\n", OGlobalSettings::debugMode() ); |
7 | printf( "output information for this mode is '%s'\n", (const char*) OGlobalSettings::debugOutput() ); | 9 | printf( "output information for this mode is '%s'\n", (const char*) OGlobalSettings::debugOutput() ); |
8 | 10 | ||
9 | return 0; | 11 | return 0; |
10 | 12 | ||
11 | } | 13 | } |
12 | 14 | ||
13 | //#include "moc/oconfigdemo.moc" | 15 | //#include "moc/oconfigdemo.moc" |
diff --git a/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp b/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp index 0abf53e..2193565 100644 --- a/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp +++ b/libopie2/examples/opiecore/oprocessdemo/oprocessdemo.cpp | |||
@@ -1,11 +1,13 @@ | |||
1 | #include <opie2/oprocess.h> | 1 | #include <opie2/oprocess.h> |
2 | #include <iostream.h> | 2 | #include <iostream> |
3 | |||
4 | using namespace Opie::Core; | ||
3 | 5 | ||
4 | int main( int argc, char** argv ) | 6 | int main( int argc, char** argv ) |
5 | { | 7 | { |
6 | printf( "my own PID seems to be '%d'\n", OProcess::processPID( "oprocessdemo" ) ); | 8 | printf( "my own PID seems to be '%d'\n", OProcess::processPID( "oprocessdemo" ) ); |
7 | printf( "the PID of process 'Mickey' seems to be '%d'\n\n", OProcess::processPID( "Mickey" ) ); | 9 | printf( "the PID of process 'Mickey' seems to be '%d'\n\n", OProcess::processPID( "Mickey" ) ); |
8 | 10 | ||
9 | return 0; | 11 | return 0; |
10 | } | 12 | } |
11 | 13 | ||