20 files changed, 526 insertions, 0 deletions
diff --git a/examples/opiecore/oconfigdemo/.cvsignore b/examples/opiecore/oconfigdemo/.cvsignore new file mode 100644 index 0000000..db3635b --- a/dev/null +++ b/examples/opiecore/oconfigdemo/.cvsignore | |||
@@ -0,0 +1,8 @@ | |||
1 | oconfigdemo | ||
2 | Makefile* | ||
3 | obj | ||
4 | moc* | ||
5 | *moc | ||
6 | *.o | ||
7 | ~* | ||
8 | |||
diff --git a/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/examples/opiecore/oconfigdemo/oconfigdemo.cpp new file mode 100644 index 0000000..2ee4a65 --- a/dev/null +++ b/examples/opiecore/oconfigdemo/oconfigdemo.cpp | |||
@@ -0,0 +1,32 @@ | |||
1 | #include <opie2/oapplication.h> | ||
2 | #include <opie2/oconfig.h> | ||
3 | #include <qpe/config.h> | ||
4 | |||
5 | using namespace Opie::Core; | ||
6 | |||
7 | int main( int argc, char** argv ) | ||
8 | { | ||
9 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); | ||
10 | |||
11 | OConfigGroupSaver c1( app->config(), "MyGroup" ); | ||
12 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); | ||
13 | { | ||
14 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); | ||
15 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); | ||
16 | } // closing the scope returns to the last group | ||
17 | |||
18 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); | ||
19 | |||
20 | // do more stuff ... | ||
21 | |||
22 | // in this (special) case it is necessary to manually call OConfig::write() (see below) | ||
23 | app->config()->write(); | ||
24 | |||
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 | ||
27 | //delete app; // destructor deletes config which writes changes back to disk | ||
28 | |||
29 | return 0; | ||
30 | |||
31 | } | ||
32 | |||
diff --git a/examples/opiecore/oconfigdemo/oconfigdemo.pro b/examples/opiecore/oconfigdemo/oconfigdemo.pro new file mode 100644 index 0000000..b29c106 --- a/dev/null +++ b/examples/opiecore/oconfigdemo/oconfigdemo.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = oconfigdemo.cpp | ||
5 | |||
6 | INCLUDEPATH += $(OPIEDIR)/include | ||
7 | DEPENDPATH += $(OPIEDIR)/include | ||
8 | LIBS += -lopiecore2 | ||
9 | TARGET = oconfigdemo | ||
10 | |||
11 | !contains( platform, x11 ) { | ||
12 | include( $(OPIEDIR)/include.pro ) | ||
13 | } | ||
14 | |||
15 | contains( platform, x11 ) { | ||
16 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
17 | } | ||
18 | |||
diff --git a/examples/opiecore/odebugdemo/.cvsignore b/examples/opiecore/odebugdemo/.cvsignore new file mode 100644 index 0000000..731667d --- a/dev/null +++ b/examples/opiecore/odebugdemo/.cvsignore | |||
@@ -0,0 +1,8 @@ | |||
1 | odebugdemo | ||
2 | Makefile* | ||
3 | obj | ||
4 | moc* | ||
5 | *moc | ||
6 | *.o | ||
7 | ~* | ||
8 | |||
diff --git a/examples/opiecore/odebugdemo/odebugdemo.cpp b/examples/opiecore/odebugdemo/odebugdemo.cpp new file mode 100644 index 0000000..b046d28 --- a/dev/null +++ b/examples/opiecore/odebugdemo/odebugdemo.cpp | |||
@@ -0,0 +1,142 @@ | |||
1 | /* QT */ | ||
2 | |||
3 | #include <qvbox.h> | ||
4 | #include <qhbox.h> | ||
5 | #include <qvbuttongroup.h> | ||
6 | #include <qhbuttongroup.h> | ||
7 | #include <qlineedit.h> | ||
8 | #include <qradiobutton.h> | ||
9 | #include <qpushbutton.h> | ||
10 | |||
11 | /* OPIE */ | ||
12 | |||
13 | #include <qpe/config.h> | ||
14 | |||
15 | #include <opie2/odebug.h> | ||
16 | #include <opie2/oapplication.h> | ||
17 | #include <opie2/oglobal.h> | ||
18 | #include <opie2/oglobalsettings.h> | ||
19 | |||
20 | using namespace Opie::Core; | ||
21 | |||
22 | class DemoApp : public OApplication | ||
23 | { | ||
24 | Q_OBJECT | ||
25 | public: | ||
26 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) | ||
27 | { | ||
28 | // you have access to your OApplication object via oApp | ||
29 | odebug << "Process-wide OApplication object @ " << oApp << "" << oendl; | ||
30 | |||
31 | // you have access to global settings via OGlobalSettings | ||
32 | int mode = OGlobalSettings::debugMode(); | ||
33 | |||
34 | QVBox* vbox = new QVBox(); | ||
35 | setMainWidget( vbox ); | ||
36 | |||
37 | g = new QVButtonGroup( "Output Strategy", vbox ); | ||
38 | QRadioButton* r0 = new QRadioButton( "file", g ); | ||
39 | QRadioButton* r1 = new QRadioButton( "messagebox", g ); | ||
40 | QRadioButton* r2 = new QRadioButton( "stderr", g ); | ||
41 | QRadioButton* r3 = new QRadioButton( "syslog", g ); | ||
42 | QRadioButton* r4 = new QRadioButton( "socket", g ); | ||
43 | g->insert( r0, 0 ); | ||
44 | g->insert( r1, 1 ); | ||
45 | g->insert( r2, 2 ); | ||
46 | g->insert( r3, 3 ); | ||
47 | g->insert( r4, 4 ); | ||
48 | g->setRadioButtonExclusive( true ); | ||
49 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); | ||
50 | |||
51 | if ( mode != -1 ) g->setButton( mode ); | ||
52 | |||
53 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); | ||
54 | e = new QLineEdit( hbox ); | ||
55 | QPushButton* pb = new QPushButton( hbox ); | ||
56 | |||
57 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); | ||
58 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); | ||
59 | |||
60 | // show the additional debug mode dependent output information | ||
61 | e->setText( OGlobalSettings::debugOutput() ); | ||
62 | |||
63 | // buttos | ||
64 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); | ||
65 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); | ||
66 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); | ||
67 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); | ||
68 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); | ||
69 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); | ||
70 | QPushButton* fatal = new QPushButton( "Emit a Fatal Output!", vbox ); | ||
71 | connect( fatal, SIGNAL( clicked() ), this, SLOT( emitFatalOutput() ) ); | ||
72 | |||
73 | QPushButton* tb = new QPushButton( "Emit a Fatal Backtrace!", vbox ); | ||
74 | connect( tb, SIGNAL( clicked() ), this, SLOT( emitTBOutput() ) ); | ||
75 | |||
76 | info->show(); | ||
77 | warn->show(); | ||
78 | error->show(); | ||
79 | fatal->show(); | ||
80 | tb->show(); | ||
81 | g->show(); | ||
82 | hbox->show(); | ||
83 | e->show(); | ||
84 | vbox->show(); | ||
85 | showMainWidget( vbox ); | ||
86 | } | ||
87 | |||
88 | public slots: | ||
89 | void chooseMethod(int method) | ||
90 | { | ||
91 | m = method; | ||
92 | odebug << "choosing method: " << method << "" << oendl; | ||
93 | OConfig* g = OGlobal::config(); | ||
94 | g->setGroup( "General" ); | ||
95 | g->writeEntry( "debugMode", m ); | ||
96 | e->setText( OGlobalSettings::debugOutput() ); | ||
97 | g->write(); | ||
98 | } | ||
99 | void updateDebugOutput() | ||
100 | { | ||
101 | OConfig* g = OGlobal::config(); | ||
102 | g->setGroup( "General" ); | ||
103 | g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() ); | ||
104 | g->write(); | ||
105 | } | ||
106 | void emitInfoOutput() | ||
107 | { | ||
108 | odebug << "This is a debug message" << oendl; | ||
109 | } | ||
110 | void emitWarningOutput() | ||
111 | { | ||
112 | owarn << "This is a warning message" << oendl; | ||
113 | } | ||
114 | void emitErrorOutput() | ||
115 | { | ||
116 | oerr << "This is an errror message" << oendl; | ||
117 | } | ||
118 | void emitFatalOutput() | ||
119 | { | ||
120 | ofatal << "This is a fatal message" << oendl; | ||
121 | } | ||
122 | void emitTBOutput() | ||
123 | { | ||
124 | ofatal << "This is a fatal message + backtrace\n" + odBacktrace(); // odBacktrace includes \n | ||
125 | } | ||
126 | |||
127 | private: | ||
128 | QButtonGroup* g; | ||
129 | int m; | ||
130 | QLineEdit* e; | ||
131 | }; | ||
132 | |||
133 | int main( int argc, char** argv ) | ||
134 | { | ||
135 | DemoApp* app = new DemoApp( argc, argv ); | ||
136 | app->exec(); | ||
137 | |||
138 | return 0; | ||
139 | |||
140 | } | ||
141 | |||
142 | #include "odebugdemo.moc" | ||
diff --git a/examples/opiecore/odebugdemo/odebugdemo.pro b/examples/opiecore/odebugdemo/odebugdemo.pro new file mode 100644 index 0000000..e06053c --- a/dev/null +++ b/examples/opiecore/odebugdemo/odebugdemo.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = odebugdemo.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lopiecore2 | ||
8 | TARGET = odebugdemo | ||
9 | |||
10 | !contains( platform, x11 ) { | ||
11 | include( $(OPIEDIR)/include.pro ) | ||
12 | } | ||
13 | |||
14 | contains( platform, x11 ) { | ||
15 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
16 | } | ||
17 | |||
diff --git a/examples/opiecore/oglobalsettingsdemo/.cvsignore b/examples/opiecore/oglobalsettingsdemo/.cvsignore new file mode 100644 index 0000000..d564c61 --- a/dev/null +++ b/examples/opiecore/oglobalsettingsdemo/.cvsignore | |||
@@ -0,0 +1,8 @@ | |||
1 | oglobalsettingsdemo | ||
2 | Makefile* | ||
3 | obj | ||
4 | moc* | ||
5 | *moc | ||
6 | *.o | ||
7 | ~* | ||
8 | |||
diff --git a/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp new file mode 100644 index 0000000..37bcf13 --- a/dev/null +++ b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp | |||
@@ -0,0 +1,15 @@ | |||
1 | #include <opie2/oglobalsettings.h> | ||
2 | #include <stdio.h> | ||
3 | |||
4 | using namespace Opie::Core; | ||
5 | |||
6 | int main( int argc, char** argv ) | ||
7 | { | ||
8 | printf( "current debugmode seems to be '%d'\n", OGlobalSettings::debugMode() ); | ||
9 | printf( "output information for this mode is '%s'\n", (const char*) OGlobalSettings::debugOutput() ); | ||
10 | |||
11 | return 0; | ||
12 | |||
13 | } | ||
14 | |||
15 | //#include "moc/oconfigdemo.moc" | ||
diff --git a/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro new file mode 100644 index 0000000..d7bed05 --- a/dev/null +++ b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = oglobalsettingsdemo.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lopiecore2 | ||
8 | TARGET = oglobalsettingsdemo | ||
9 | MOC_DIR = moc | ||
10 | OBJECTS_DIR = obj | ||
11 | |||
12 | include( $(OPIEDIR)/include.pro ) | ||
13 | |||
14 | |||
diff --git a/examples/opiecore/okeyconfigmanager/README b/examples/opiecore/okeyconfigmanager/README new file mode 100644 index 0000000..327b7c2 --- a/dev/null +++ b/examples/opiecore/okeyconfigmanager/README | |||
@@ -0,0 +1 @@ | |||
See opieui/okeyconfigwidget for an example of possible usage \ No newline at end of file | |||
diff --git a/examples/opiecore/onotifydemo/.cvsignore b/examples/opiecore/onotifydemo/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/examples/opiecore/onotifydemo/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/examples/opiecore/onotifydemo/onotifydemo.cpp b/examples/opiecore/onotifydemo/onotifydemo.cpp new file mode 100644 index 0000000..b9ff9db --- a/dev/null +++ b/examples/opiecore/onotifydemo/onotifydemo.cpp | |||
@@ -0,0 +1,144 @@ | |||
1 | /* OPIE */ | ||
2 | #include <opie2/odebug.h> | ||
3 | #include <opie2/oapplication.h> | ||
4 | #include <opie2/ofiledialog.h> | ||
5 | #include <opie2/olistview.h> | ||
6 | #include <opie2/ofilenotify.h> | ||
7 | using namespace Opie::Core; | ||
8 | using namespace Opie::Ui; | ||
9 | |||
10 | /* QT */ | ||
11 | #include <qcheckbox.h> | ||
12 | #include <qvbox.h> | ||
13 | #include <qhbox.h> | ||
14 | #include <qhbuttongroup.h> | ||
15 | #include <qvbuttongroup.h> | ||
16 | #include <qmessagebox.h> | ||
17 | #include <qpushbutton.h> | ||
18 | |||
19 | class DemoApp : public OApplication | ||
20 | { | ||
21 | Q_OBJECT | ||
22 | public: | ||
23 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify demo" ) | ||
24 | { | ||
25 | |||
26 | QVBox* vbox = new QVBox(); | ||
27 | setMainWidget( vbox ); | ||
28 | |||
29 | l = new OListView( vbox ); | ||
30 | l->addColumn( "Notification Path" ); | ||
31 | l->addColumn( "Trigger Type" ); | ||
32 | l->addColumn( "Trigger Mask" ); | ||
33 | l->setColumnAlignment( 1, AlignCenter ); | ||
34 | l->setColumnAlignment( 2, AlignCenter ); | ||
35 | |||
36 | QHBox* hbox = new QHBox( vbox ); | ||
37 | |||
38 | g2 = new QVButtonGroup( "Specify Trigger Type", hbox ); | ||
39 | //QCheckBox* c1 = new QCheckBox( "Multi", g2 ); | ||
40 | QCheckBox* c2 = new QCheckBox( "Access", g2 ); | ||
41 | QCheckBox* c3 = new QCheckBox( "Modify", g2 ); | ||
42 | QCheckBox* c4 = new QCheckBox( "Create", g2 ); | ||
43 | QCheckBox* c5 = new QCheckBox( "Delete", g2 ); | ||
44 | QCheckBox* c6 = new QCheckBox( "Rename", g2 ); | ||
45 | QCheckBox* c7 = new QCheckBox( "Attrib", g2 ); | ||
46 | g2->insert( c2, Access ); | ||
47 | g2->insert( c3, Modify ); | ||
48 | g2->insert( c4, Create ); | ||
49 | g2->insert( c5, Delete ); | ||
50 | g2->insert( c6, Rename ); | ||
51 | g2->insert( c7, Attrib ); | ||
52 | connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) ); | ||
53 | |||
54 | g1 = new QVButtonGroup( "Add/Remove", hbox ); | ||
55 | QPushButton* plus1 = new QPushButton( "Add\n&Single", g1 ); | ||
56 | QPushButton* plus2 = new QPushButton( "Add\n&Multi", g1 ); | ||
57 | QPushButton* minus = new QPushButton( "&Remove\nIt!", g1 ); | ||
58 | g1->insert( plus1, 0 ); | ||
59 | g1->insert( plus2, 1 ); | ||
60 | g1->insert( minus, 2 ); | ||
61 | connect( plus1, SIGNAL( clicked() ), this, SLOT( addSingle() ) ); | ||
62 | connect( plus2, SIGNAL( clicked() ), this, SLOT( addMulti() ) ); | ||
63 | connect( minus, SIGNAL( clicked() ), this, SLOT( delTrigger() ) ); | ||
64 | |||
65 | g1->show(); | ||
66 | g2->show(); | ||
67 | l->show(); | ||
68 | hbox->show(); | ||
69 | vbox->show(); | ||
70 | showMainWidget( vbox ); | ||
71 | } | ||
72 | |||
73 | public: | ||
74 | void addTrigger( bool multi = false ) | ||
75 | { | ||
76 | if ( !m ) | ||
77 | { | ||
78 | QMessageBox::warning( 0, "Add Trigger", "<p>Can't add trigger without at least one selected trigger type</p>", "&Sorry", 0 ); | ||
79 | return; | ||
80 | } | ||
81 | |||
82 | QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll ); | ||
83 | if ( !filename.isEmpty() ) | ||
84 | { | ||
85 | odebug << "Filename = " << filename << oendl; | ||
86 | |||
87 | int fntype = m; | ||
88 | if ( multi ) fntype |=(int) Multi; | ||
89 | |||
90 | QString modifier = QString().sprintf( " = 0x%08x", fntype ); | ||
91 | new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier ); | ||
92 | if ( !multi ) | ||
93 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | ||
94 | else | ||
95 | OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype ); | ||
96 | } | ||
97 | else | ||
98 | { | ||
99 | odebug << "cancelled." << oendl; | ||
100 | } | ||
101 | } | ||
102 | |||
103 | public slots: | ||
104 | void modifierClicked( int modifier ) { m = static_cast<OFileNotificationType>( (int)m ^ int(modifier) ); }; | ||
105 | void addSingle() { addTrigger(); }; | ||
106 | void addMulti() { addTrigger( true ); }; | ||
107 | |||
108 | void delTrigger() | ||
109 | { | ||
110 | QListViewItem* item = l->selectedItem(); | ||
111 | if ( !item ) | ||
112 | { | ||
113 | QMessageBox::warning( 0, "Del Trigger", "<p>No trigger selected!</p>", "&Sorry", 0 ); | ||
114 | return; | ||
115 | } | ||
116 | else | ||
117 | { | ||
118 | QString filename( item->text( 0 ) ); | ||
119 | odebug << "Filename = " << filename << oendl; | ||
120 | } | ||
121 | } | ||
122 | |||
123 | void trigger() | ||
124 | { | ||
125 | owarn << "FIRE!" << oendl; | ||
126 | } | ||
127 | |||
128 | private: | ||
129 | OListView* l; | ||
130 | QButtonGroup* g1; | ||
131 | QButtonGroup* g2; | ||
132 | OFileNotificationType m; | ||
133 | }; | ||
134 | |||
135 | int main( int argc, char** argv ) | ||
136 | { | ||
137 | DemoApp* app = new DemoApp( argc, argv ); | ||
138 | app->exec(); | ||
139 | |||
140 | return 0; | ||
141 | |||
142 | } | ||
143 | |||
144 | #include "moc/onotifydemo.moc" | ||
diff --git a/examples/opiecore/onotifydemo/onotifydemo.pro b/examples/opiecore/onotifydemo/onotifydemo.pro new file mode 100644 index 0000000..d2c9138 --- a/dev/null +++ b/examples/opiecore/onotifydemo/onotifydemo.pro | |||
@@ -0,0 +1,18 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = onotifydemo.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lopiecore2 -lopieui2 | ||
8 | TARGET = onotifydemo | ||
9 | |||
10 | !contains( platform, x11 ) { | ||
11 | include( $(OPIEDIR)/include.pro ) | ||
12 | } | ||
13 | |||
14 | contains( platform, x11 ) { | ||
15 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | ||
16 | } | ||
17 | |||
18 | MOC_DIR = moc | ||
diff --git a/examples/opiecore/opiecore.pro b/examples/opiecore/opiecore.pro new file mode 100644 index 0000000..39ffd3b --- a/dev/null +++ b/examples/opiecore/opiecore.pro | |||
@@ -0,0 +1,2 @@ | |||
1 | TEMPLATE = subdirs | ||
2 | unix:SUBDIRS = odebugdemo oconfigdemo oglobalsettingsdemo onotifydemo oprocessdemo oplugins | ||
diff --git a/examples/opiecore/oplugins/.cvsignore b/examples/opiecore/oplugins/.cvsignore new file mode 100644 index 0000000..514e011 --- a/dev/null +++ b/examples/opiecore/oplugins/.cvsignore | |||
@@ -0,0 +1,3 @@ | |||
1 | oplugins | ||
2 | Makefile | ||
3 | .moc | ||
diff --git a/examples/opiecore/oplugins/oplugins.cpp b/examples/opiecore/oplugins/oplugins.cpp new file mode 100644 index 0000000..26623be --- a/dev/null +++ b/examples/opiecore/oplugins/oplugins.cpp | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * You may copy, modify and or distribute without any limitation | ||
3 | */ | ||
4 | #include <opie2/odebug.h> | ||
5 | #include <opie2/opluginloader.h> | ||
6 | |||
7 | #include <opie2/todayplugininterface.h> | ||
8 | |||
9 | using Opie::Core::OPluginItem; | ||
10 | using Opie::Core::OGenericPluginLoader; | ||
11 | using Opie::Core::OPluginLoader; | ||
12 | |||
13 | void debugLst( const OPluginItem::List& lst ) { | ||
14 | for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it ) | ||
15 | odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl; | ||
16 | } | ||
17 | |||
18 | |||
19 | int main( void ) { | ||
20 | OGenericPluginLoader loader( "today", true ); | ||
21 | loader.setAutoDelete( true ); | ||
22 | |||
23 | odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl; | ||
24 | |||
25 | OPluginItem::List lst = loader.allAvailable( true ); | ||
26 | debugLst( lst ); | ||
27 | |||
28 | lst = loader.filtered( true ); | ||
29 | debugLst( lst ); | ||
30 | |||
31 | for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) { | ||
32 | QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface ); | ||
33 | } | ||
34 | |||
35 | OPluginLoader loader2("today",true); | ||
36 | OPluginItem::List lst2 = loader2.allAvailable( true ); | ||
37 | debugLst( lst2 ); | ||
38 | |||
39 | for( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){ | ||
40 | TodayPluginInterface* iface = loader2.load<TodayPluginInterface>( *it, IID_TodayPluginInterface ); | ||
41 | } | ||
42 | |||
43 | |||
44 | /* | ||
45 | * now it's autodelete so cleaned up for us | ||
46 | */ | ||
47 | } | ||
diff --git a/examples/opiecore/oplugins/oplugins.pro b/examples/opiecore/oplugins/oplugins.pro new file mode 100644 index 0000000..03f8e4d --- a/dev/null +++ b/examples/opiecore/oplugins/oplugins.pro | |||
@@ -0,0 +1,11 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG += qt warn_on | ||
3 | |||
4 | SOURCES = oplugins.cpp | ||
5 | |||
6 | INCLUDEPATH += $(OPIEDIR)/include | ||
7 | DEPENDSPATH += $(OPIEDIR)/include | ||
8 | |||
9 | LIBS += -lopiecore2 | ||
10 | |||
11 | include( $(OPIEDIR)/include.pro ) | ||
diff --git a/examples/opiecore/oprocessdemo/.cvsignore b/examples/opiecore/oprocessdemo/.cvsignore new file mode 100644 index 0000000..ab9cb4d --- a/dev/null +++ b/examples/opiecore/oprocessdemo/.cvsignore | |||
@@ -0,0 +1,7 @@ | |||
1 | oprocessdemo | ||
2 | Makefile* | ||
3 | moc* | ||
4 | *moc | ||
5 | *.o | ||
6 | ~* | ||
7 | |||
diff --git a/examples/opiecore/oprocessdemo/oprocessdemo.cpp b/examples/opiecore/oprocessdemo/oprocessdemo.cpp new file mode 100644 index 0000000..c5fc328 --- a/dev/null +++ b/examples/opiecore/oprocessdemo/oprocessdemo.cpp | |||
@@ -0,0 +1,13 @@ | |||
1 | #include <opie2/oprocess.h> | ||
2 | #include <stdio.h> | ||
3 | |||
4 | using namespace Opie::Core; | ||
5 | |||
6 | int main( int argc, char** argv ) | ||
7 | { | ||
8 | printf( "my own PID seems to be '%d'\n", OProcess::processPID( "oprocessdemo" ) ); | ||
9 | printf( "the PID of process 'Mickey' seems to be '%d'\n\n", OProcess::processPID( "Mickey" ) ); | ||
10 | |||
11 | return 0; | ||
12 | } | ||
13 | |||
diff --git a/examples/opiecore/oprocessdemo/oprocessdemo.pro b/examples/opiecore/oprocessdemo/oprocessdemo.pro new file mode 100644 index 0000000..7efc614 --- a/dev/null +++ b/examples/opiecore/oprocessdemo/oprocessdemo.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on | ||
3 | HEADERS = | ||
4 | SOURCES = oprocessdemo.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lopiecore2 | ||
8 | TARGET = oprocessdemo | ||
9 | |||
10 | include( $(OPIEDIR)/include.pro ) | ||
11 | |||
12 | |||