author | mickeyl <mickeyl> | 2005-05-31 14:34:22 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2005-05-31 14:34:22 (UTC) |
commit | 89417179ed4d38875dc3edce0f4e184edf13f1f2 (patch) (unidiff) | |
tree | 1924e9cf0a053519142554659ca4dd7632938735 | |
parent | 6d2273fb22e10474ae26dd249fa2836e100ffdaf (diff) | |
download | opie-89417179ed4d38875dc3edce0f4e184edf13f1f2.zip opie-89417179ed4d38875dc3edce0f4e184edf13f1f2.tar.gz opie-89417179ed4d38875dc3edce0f4e184edf13f1f2.tar.bz2 |
catch up with libopie2 improvements
-rw-r--r-- | examples/opiecore/onotifytest/main.cpp | 33 | ||||
-rw-r--r-- | examples/opiecore/onotifytest/main.h | 23 | ||||
-rw-r--r-- | examples/opiecore/onotifytest/onotifytest.pro | 1 | ||||
-rw-r--r-- | examples/opiecore/opcmciademo/main.cpp | 2 |
4 files changed, 46 insertions, 13 deletions
diff --git a/examples/opiecore/onotifytest/main.cpp b/examples/opiecore/onotifytest/main.cpp index 467ebc9..8374c59 100644 --- a/examples/opiecore/onotifytest/main.cpp +++ b/examples/opiecore/onotifytest/main.cpp | |||
@@ -1,59 +1,66 @@ | |||
1 | // (C) Michael 'Mickey' Lauer <mickey@Vanille.de> | 1 | // (C) Michael 'Mickey' Lauer <mickey@Vanille.de> |
2 | // LICENSE = "GPLv2" | 2 | // LICENSE = "GPLv2" |
3 | 3 | ||
4 | #include "main.h" | ||
5 | |||
4 | /* OPIE */ | 6 | /* OPIE */ |
5 | #include <opie2/odebug.h> | 7 | #include <opie2/odebug.h> |
6 | #include <opie2/oapplication.h> | 8 | #include <opie2/oapplication.h> |
7 | #include <opie2/ofilenotify.h> | 9 | #include <opie2/ofilenotify.h> |
8 | using namespace Opie::Core; | 10 | using namespace Opie::Core; |
9 | 11 | ||
10 | /* QT */ | 12 | /* QT */ |
13 | #include <qdir.h> | ||
11 | #include <qpushbutton.h> | 14 | #include <qpushbutton.h> |
15 | #include <qstringlist.h> | ||
12 | #include <qtextstream.h> | 16 | #include <qtextstream.h> |
17 | #include <qmessagebox.h> | ||
13 | 18 | ||
14 | class App : public OApplication | 19 | App::App( int argc, char** argv ) : QApplication( argc, argv ) |
15 | { | ||
16 | |||
17 | public: | ||
18 | OFile* tmpfoo; | ||
19 | |||
20 | App( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify test" ) | ||
21 | { | 20 | { |
22 | odebug << "App()" << oendl; | 21 | odebug << "App()" << oendl; |
23 | 22 | #if 0 | |
24 | tmpfoo = new OFile( "/tmp/foo" ); | 23 | tmpfoo = new OFile( "/tmp/foo" ); |
25 | if ( tmpfoo->open( IO_ReadWrite ) ) | 24 | if ( tmpfoo->open( IO_ReadWrite ) ) |
26 | { | 25 | { |
27 | QTextStream stream( tmpfoo ); | 26 | QTextStream stream( tmpfoo ); |
28 | stream << "This is my content"; | 27 | stream << "This is my content"; |
29 | } | 28 | } |
30 | 29 | ||
31 | QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) ); | 30 | QObject::connect( tmpfoo, SIGNAL(accessed(const QString&)), this, SLOT(quit()) ); |
32 | QObject::connect( tmpfoo, SIGNAL(closed(const QString&,bool)), this, SLOT(quit()) ); | 31 | QObject::connect( tmpfoo, SIGNAL(closed(const QString&,bool)), this, SLOT(quit()) ); |
32 | #endif | ||
33 | |||
34 | ODirNotification* tmpfoo = new ODirNotification( 0, 0 ); | ||
35 | |||
36 | int result = tmpfoo->watch( "/tmp/foo", false, CreateFile, 1 ); | ||
37 | QObject::connect( tmpfoo, SIGNAL(triggered(const QString&,unsigned int,const QString&)), | ||
38 | this, SLOT(triggered(const QString&,unsigned int,const QString&)) ); | ||
33 | } | 39 | } |
34 | 40 | ||
35 | ~App() | 41 | App::~App() |
36 | { | 42 | { |
37 | odebug << "~App()" << oendl; | 43 | odebug << "~App()" << oendl; |
38 | |||
39 | delete tmpfoo; | ||
40 | } | 44 | } |
41 | 45 | ||
42 | }; | 46 | void App::triggered( const QString& str1, unsigned int id, const QString& str2 ) |
47 | { | ||
48 | QMessageBox::information( qApp->desktop(), "info", QString( "%1\n%2\n%3" ).arg( str1 ).arg( id ).arg( str2 ) ); | ||
49 | } | ||
43 | 50 | ||
44 | int main( int argc, char** argv ) | 51 | int main( int argc, char** argv ) |
45 | { | 52 | { |
46 | App* app = new App( argc, argv ); | 53 | App* app = new App( argc, argv ); |
47 | QPushButton* b = new QPushButton( "Click me to close", 0 ); | 54 | QPushButton* b = new QPushButton( "Click me to close", 0 ); |
48 | QObject::connect( b, SIGNAL(clicked()), app, SLOT(quit()) ); | 55 | QObject::connect( b, SIGNAL(clicked()), qApp, SLOT(quit()) ); |
49 | b->resize( 200, 200 ); | 56 | b->resize( 200, 200 ); |
50 | b->move( 150, 150 ); | 57 | b->move( 150, 150 ); |
51 | b->show(); | 58 | b->show(); |
52 | app->setMainWidget( b ); | 59 | app->setMainWidget( b ); |
53 | app->exec(); | 60 | app->exec(); |
54 | delete app; | 61 | delete app; |
55 | 62 | ||
56 | return 0; | 63 | return 0; |
57 | 64 | ||
58 | } | 65 | } |
59 | 66 | ||
diff --git a/examples/opiecore/onotifytest/main.h b/examples/opiecore/onotifytest/main.h new file mode 100644 index 0000000..afad947 --- a/dev/null +++ b/examples/opiecore/onotifytest/main.h | |||
@@ -0,0 +1,23 @@ | |||
1 | // (C) Michael 'Mickey' Lauer <mickey@Vanille.de> | ||
2 | // LICENSE = "GPLv2" | ||
3 | |||
4 | #ifndef MAIN_H | ||
5 | #define MAIN_H | ||
6 | |||
7 | /* QT */ | ||
8 | #include <qapplication.h> | ||
9 | #include <qpushbutton.h> | ||
10 | #include <qtextstream.h> | ||
11 | |||
12 | class App : public QApplication | ||
13 | { | ||
14 | Q_OBJECT | ||
15 | public: | ||
16 | App( int argc, char** argv ); | ||
17 | ~App(); | ||
18 | |||
19 | public slots: | ||
20 | void triggered( const QString&, unsigned int, const QString& ); | ||
21 | }; | ||
22 | |||
23 | #endif | ||
diff --git a/examples/opiecore/onotifytest/onotifytest.pro b/examples/opiecore/onotifytest/onotifytest.pro index 4e0faec..51bda92 100644 --- a/examples/opiecore/onotifytest/onotifytest.pro +++ b/examples/opiecore/onotifytest/onotifytest.pro | |||
@@ -1,16 +1,17 @@ | |||
1 | TEMPLATE = app | 1 | TEMPLATE = app |
2 | CONFIG = qt warn_on | 2 | CONFIG = qt warn_on |
3 | HEADERS = main.h | ||
3 | SOURCES = main.cpp | 4 | SOURCES = main.cpp |
4 | INCLUDEPATH += $(OPIEDIR)/include | 5 | INCLUDEPATH += $(OPIEDIR)/include |
5 | DEPENDPATH += $(OPIEDIR)/include | 6 | DEPENDPATH += $(OPIEDIR)/include |
6 | LIBS += -lopiecore2 | 7 | LIBS += -lopiecore2 |
7 | TARGET = onotifytest | 8 | TARGET = onotifytest |
8 | 9 | ||
9 | !contains( platform, x11 ) { | 10 | !contains( platform, x11 ) { |
10 | include( $(OPIEDIR)/include.pro ) | 11 | include( $(OPIEDIR)/include.pro ) |
11 | } | 12 | } |
12 | 13 | ||
13 | contains( platform, x11 ) { | 14 | contains( platform, x11 ) { |
14 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib | 15 | LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib |
15 | } | 16 | } |
16 | 17 | ||
diff --git a/examples/opiecore/opcmciademo/main.cpp b/examples/opiecore/opcmciademo/main.cpp index 3ee22c2..dfc4287 100644 --- a/examples/opiecore/opcmciademo/main.cpp +++ b/examples/opiecore/opcmciademo/main.cpp | |||
@@ -2,23 +2,25 @@ | |||
2 | #include <opie2/odebug.h> | 2 | #include <opie2/odebug.h> |
3 | using namespace Opie::Core; | 3 | using namespace Opie::Core; |
4 | 4 | ||
5 | int main( int argc, char** argv ) | 5 | int main( int argc, char** argv ) |
6 | { | 6 | { |
7 | odebug << "start" << oendl; | 7 | odebug << "start" << oendl; |
8 | OPcmciaSystem* sys = OPcmciaSystem::instance(); | 8 | OPcmciaSystem* sys = OPcmciaSystem::instance(); |
9 | 9 | ||
10 | odebug << "number of detected sockets is = " << sys->count() << oendl; | 10 | odebug << "number of detected sockets is = " << sys->count() << oendl; |
11 | odebug << "number of populated sockets is = " << sys->cardCount() << oendl; | 11 | odebug << "number of populated sockets is = " << sys->cardCount() << oendl; |
12 | 12 | ||
13 | OPcmciaSystem::CardIterator it = sys->iterator(); | 13 | OPcmciaSystem::CardIterator it = sys->iterator(); |
14 | OPcmciaSocket* sock = 0; | 14 | OPcmciaSocket* sock = 0; |
15 | while ( sock = it.current() ) | 15 | while ( sock = it.current() ) |
16 | { | 16 | { |
17 | odebug << "card in socket # " << sock->number() << " is '" << sock->identity() << "'" << oendl; | 17 | odebug << "card in socket # " << sock->number() << " is '" << sock->identity() << "'" << oendl; |
18 | odebug << "card status is " << sock->status() << oendl; | ||
19 | odebug << "card function is " << sock->function() << oendl; | ||
18 | ++it; | 20 | ++it; |
19 | } | 21 | } |
20 | 22 | ||
21 | odebug << "end" << oendl; | 23 | odebug << "end" << oendl; |
22 | return 0; | 24 | return 0; |
23 | } | 25 | } |
24 | 26 | ||