47 files changed, 1091 insertions, 0 deletions
diff --git a/libopie2/examples/.cvsignore b/libopie2/examples/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/config.in b/libopie2/examples/config.in new file mode 100644 index 0000000..d18e479 --- a/dev/null +++ b/libopie2/examples/config.in | |||
@@ -0,0 +1,6 @@ | |||
1 | config LIBOPIE2EXAMPLES | ||
2 | boolean "libopie2 examples" | ||
3 | default "n" | ||
4 | depends ( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2NET && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2UI | ||
5 | comment "the examples need a libqpe, libopie2core, libopie2db, libopie2net, libopie2pim and libopie2ui" | ||
6 | depends !(( LIBQPE || LIBQPE-X11 ) && LIBOPIE2CORE && LIBOPIE2NET && LIBOPIE2UI && LIBOPIE2PIM && LIBOPIE2UI) | ||
diff --git a/libopie2/examples/examples.pro b/libopie2/examples/examples.pro new file mode 100644 index 0000000..2ae7eb7 --- a/dev/null +++ b/libopie2/examples/examples.pro | |||
@@ -0,0 +1,4 @@ | |||
1 | TEMPLATE = subdirs | ||
2 | unix:SUBDIRS = opieui opienet opiecore | ||
3 | |||
4 | #include ( ../../../include.pro ) | ||
diff --git a/libopie2/examples/opiecore/.cvsignore b/libopie2/examples/opiecore/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opiecore/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opiecore/oconfigdemo/.cvsignore b/libopie2/examples/opiecore/oconfigdemo/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opiecore/oconfigdemo/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp new file mode 100644 index 0000000..a3f8e10 --- a/dev/null +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.cpp | |||
@@ -0,0 +1,31 @@ | |||
1 | #include <opie2/oapplication.h> | ||
2 | #include <opie2/oconfig.h> | ||
3 | #include <qpe/config.h> | ||
4 | |||
5 | int main( int argc, char** argv ) | ||
6 | { | ||
7 | OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" ); | ||
8 | |||
9 | OConfigGroupSaver c1( app->config(), "MyGroup" ); | ||
10 | app->config()->writeEntry( "AnEntry", "InMyGroup" ); | ||
11 | { | ||
12 | OConfigGroupSaver c2( c1.config(), "AnotherGroup" ); | ||
13 | app->config()->writeEntry( "AnEntry", "InAnotherGroup" ); | ||
14 | } // closing the scope returns to the last group | ||
15 | |||
16 | app->config()->writeEntry( "AnotherEntry", "InMyGroup" ); | ||
17 | |||
18 | // do more stuff ... | ||
19 | |||
20 | // in this (special) case it is necessary to manually call OConfig::write() (see below) | ||
21 | app->config()->write(); | ||
22 | |||
23 | // can't delete the app when using the OConfigGroupSaver on top level scope, | ||
24 | // because the destructor of the OConfigGroupSaver needs an application object | ||
25 | //delete app; // destructor deletes config which writes changes back to disk | ||
26 | |||
27 | return 0; | ||
28 | |||
29 | } | ||
30 | |||
31 | //#include "moc/oconfigdemo.moc" | ||
diff --git a/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro new file mode 100644 index 0000000..0109c57 --- a/dev/null +++ b/libopie2/examples/opiecore/oconfigdemo/oconfigdemo.pro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on debug | ||
3 | HEADERS = | ||
4 | SOURCES = oconfigdemo.cpp | ||
5 | |||
6 | INCLUDEPATH += $(OPIEDIR)/include | ||
7 | DEPENDPATH += $(OPIEDIR)/include | ||
8 | LIBS += -lopiecore2 | ||
9 | TARGET = oconfigdemo | ||
10 | MOC_DIR = moc | ||
11 | OBJECTS_DIR = obj | ||
12 | |||
13 | include ( $(OPIEDIR)/include.pro ) | ||
14 | |||
diff --git a/libopie2/examples/opiecore/odebugdemo/.cvsignore b/libopie2/examples/opiecore/odebugdemo/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opiecore/odebugdemo/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp new file mode 100644 index 0000000..74886fa --- a/dev/null +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp | |||
@@ -0,0 +1,138 @@ | |||
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 | class DemoApp : public OApplication | ||
21 | { | ||
22 | Q_OBJECT | ||
23 | public: | ||
24 | DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" ) | ||
25 | { | ||
26 | // you have access to your OApplication object via oApp | ||
27 | qDebug( "Process-wide OApplication object @ %0x", oApp ); | ||
28 | |||
29 | // you have access to global settings via OGlobalSettings | ||
30 | int mode = OGlobalSettings::debugMode(); | ||
31 | |||
32 | QVBox* vbox = new QVBox(); | ||
33 | setMainWidget( vbox ); | ||
34 | |||
35 | g = new QVButtonGroup( "Output Strategy", vbox ); | ||
36 | QRadioButton* r0 = new QRadioButton( "file", g ); | ||
37 | QRadioButton* r1 = new QRadioButton( "messagebox", g ); | ||
38 | QRadioButton* r2 = new QRadioButton( "stderr", g ); | ||
39 | QRadioButton* r3 = new QRadioButton( "syslog", g ); | ||
40 | QRadioButton* r4 = new QRadioButton( "socket", g ); | ||
41 | g->insert( r0, 0 ); | ||
42 | g->insert( r1, 1 ); | ||
43 | g->insert( r2, 2 ); | ||
44 | g->insert( r3, 3 ); | ||
45 | g->insert( r4, 4 ); | ||
46 | g->setRadioButtonExclusive( true ); | ||
47 | connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) ); | ||
48 | |||
49 | if ( mode != -1 ) g->setButton( mode ); | ||
50 | |||
51 | QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox ); | ||
52 | e = new QLineEdit( hbox ); | ||
53 | QPushButton* pb = new QPushButton( hbox ); | ||
54 | |||
55 | connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) ); | ||
56 | connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) ); | ||
57 | |||
58 | // show the additional debug mode dependent output information | ||
59 | e->setText( OGlobalSettings::debugOutput() ); | ||
60 | |||
61 | // buttos | ||
62 | QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox ); | ||
63 | connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) ); | ||
64 | QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox ); | ||
65 | connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) ); | ||
66 | QPushButton* error = new QPushButton( "Emit an Error Output!", vbox ); | ||
67 | connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) ); | ||
68 | QPushButton* fatal = new QPushButton( "Emit a Fatal Output!", vbox ); | ||
69 | connect( fatal, SIGNAL( clicked() ), this, SLOT( emitFatalOutput() ) ); | ||
70 | |||
71 | QPushButton* tb = new QPushButton( "Emit a Fatal Backtrace!", vbox ); | ||
72 | connect( tb, SIGNAL( clicked() ), this, SLOT( emitTBOutput() ) ); | ||
73 | |||
74 | info->show(); | ||
75 | warn->show(); | ||
76 | error->show(); | ||
77 | fatal->show(); | ||
78 | tb->show(); | ||
79 | g->show(); | ||
80 | hbox->show(); | ||
81 | e->show(); | ||
82 | vbox->show(); | ||
83 | showMainWidget( vbox ); | ||
84 | } | ||
85 | |||
86 | public slots: | ||
87 | void chooseMethod(int method) | ||
88 | { | ||
89 | m = method; | ||
90 | qDebug( "choosing method: %d", method ); | ||
91 | OConfig* g = OGlobal::config(); | ||
92 | g->setGroup( "General" ); | ||
93 | g->writeEntry( "debugMode", m ); | ||
94 | e->setText( OGlobalSettings::debugOutput() ); | ||
95 | } | ||
96 | void updateDebugOutput() | ||
97 | { | ||
98 | OConfig* g = OGlobal::config(); | ||
99 | g->setGroup( "General" ); | ||
100 | g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() ); | ||
101 | } | ||
102 | void emitInfoOutput() | ||
103 | { | ||
104 | odebug << "This is a debug message" << oendl; | ||
105 | } | ||
106 | void emitWarningOutput() | ||
107 | { | ||
108 | owarn << "This is a warning message" << oendl; | ||
109 | } | ||
110 | void emitErrorOutput() | ||
111 | { | ||
112 | oerr << "This is an errror message" << oendl; | ||
113 | } | ||
114 | void emitFatalOutput() | ||
115 | { | ||
116 | ofatal << "This is a fatal message" << oendl; | ||
117 | } | ||
118 | void emitTBOutput() | ||
119 | { | ||
120 | ofatal << "This is a fatal message + backtrace\n" + odBacktrace(); // odBacktrace includes \n | ||
121 | } | ||
122 | |||
123 | private: | ||
124 | QButtonGroup* g; | ||
125 | int m; | ||
126 | QLineEdit* e; | ||
127 | }; | ||
128 | |||
129 | int main( int argc, char** argv ) | ||
130 | { | ||
131 | DemoApp* app = new DemoApp( argc, argv ); | ||
132 | app->exec(); | ||
133 | |||
134 | return 0; | ||
135 | |||
136 | } | ||
137 | |||
138 | #include "moc/odebugdemo.moc" | ||
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro new file mode 100644 index 0000000..a725105 --- a/dev/null +++ b/libopie2/examples/opiecore/odebugdemo/odebugdemo.pro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on debug | ||
3 | HEADERS = | ||
4 | SOURCES = odebugdemo.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lopiecore2 | ||
8 | TARGET = odebugdemo | ||
9 | MOC_DIR = moc | ||
10 | OBJECTS_DIR = obj | ||
11 | |||
12 | include ( $(OPIEDIR)/include.pro ) | ||
13 | |||
14 | |||
diff --git a/libopie2/examples/opiecore/oglobalsettingsdemo/.cvsignore b/libopie2/examples/opiecore/oglobalsettingsdemo/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opiecore/oglobalsettingsdemo/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp new file mode 100644 index 0000000..2f5220b --- a/dev/null +++ b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp | |||
@@ -0,0 +1,13 @@ | |||
1 | #include <opie2/oglobalsettings.h> | ||
2 | #include <iostream.h> | ||
3 | |||
4 | int main( int argc, char** argv ) | ||
5 | { | ||
6 | printf( "current debugmode seems to be '%d'\n", OGlobalSettings::debugMode() ); | ||
7 | printf( "output information for this mode is '%s'\n", (const char*) OGlobalSettings::debugOutput() ); | ||
8 | |||
9 | return 0; | ||
10 | |||
11 | } | ||
12 | |||
13 | //#include "moc/oconfigdemo.moc" | ||
diff --git a/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro new file mode 100644 index 0000000..7fbecce --- a/dev/null +++ b/libopie2/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro | |||
@@ -0,0 +1,14 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on debug | ||
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/libopie2/examples/opiecore/opiecore.pro b/libopie2/examples/opiecore/opiecore.pro new file mode 100644 index 0000000..8f3aedc --- a/dev/null +++ b/libopie2/examples/opiecore/opiecore.pro | |||
@@ -0,0 +1,3 @@ | |||
1 | TEMPLATE = subdirs | ||
2 | unix:SUBDIRS = odebugdemo oconfigdemo oglobalsettingsdemo | ||
3 | |||
diff --git a/libopie2/examples/opienet/.cvsignore b/libopie2/examples/opienet/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opienet/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opienet/miniwellenreiter/.cvsignore b/libopie2/examples/opienet/miniwellenreiter/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opienet/miniwellenreiter/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp new file mode 100644 index 0000000..aec9cc7 --- a/dev/null +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.cpp | |||
@@ -0,0 +1,199 @@ | |||
1 | #include <qdict.h> | ||
2 | #include <qsocketnotifier.h> | ||
3 | #include <qstring.h> | ||
4 | #include <opie2/onetwork.h> | ||
5 | #include <qapplication.h> | ||
6 | #include <opie2/opcap.h> | ||
7 | #include <cerrno> | ||
8 | #include <cstdio> | ||
9 | #include <cstdlib> | ||
10 | #include <cstring> | ||
11 | |||
12 | //======================== Station help class =============================== | ||
13 | |||
14 | class Station | ||
15 | { | ||
16 | public: | ||
17 | Station( QString t, int c, bool w ) : type(t), channel(c), wep(w), beacons(1) {}; | ||
18 | ~Station() {}; | ||
19 | |||
20 | QString type; | ||
21 | int channel; | ||
22 | bool wep; | ||
23 | int beacons; | ||
24 | }; | ||
25 | |||
26 | QDict<Station> stations; | ||
27 | |||
28 | //======================== Application class =============================== | ||
29 | |||
30 | class Wellenreiter : public QApplication | ||
31 | { | ||
32 | Q_OBJECT | ||
33 | public: | ||
34 | Wellenreiter( int argc, char** argv ) : QApplication( argc, argv ) | ||
35 | { | ||
36 | |||
37 | ONetwork* net = ONetwork::instance(); | ||
38 | |||
39 | if ( argc < 3 ) | ||
40 | { | ||
41 | printf( "Usage: ./%s <interface> <driver> <interval>\n", argv[0] ); | ||
42 | printf( "\n" ); | ||
43 | printf( "Valid wireless interfaces (detected) are:\n" ); | ||
44 | |||
45 | ONetwork::InterfaceIterator it = net->iterator(); | ||
46 | while ( it.current() ) | ||
47 | { | ||
48 | if ( it.current()->isWireless() ) | ||
49 | { | ||
50 | printf( " - '%s' (MAC=%s) (IPv4=%s)\n", (const char*) it.current()->name(), | ||
51 | (const char*) it.current()->macAddress().toString(), | ||
52 | (const char*) it.current()->ipV4Address() ); | ||
53 | } | ||
54 | ++it; | ||
55 | } | ||
56 | exit( -1 ); | ||
57 | } | ||
58 | |||
59 | printf( "****************************************************\n" ); | ||
60 | printf( "* Wellenreiter mini edition 1.0 (C) 2003 M-M-M *\n" ); | ||
61 | printf( "****************************************************\n" ); | ||
62 | printf( "\n\n" ); | ||
63 | |||
64 | QString interface( argv[1] ); | ||
65 | QString driver( argv[2] ); | ||
66 | |||
67 | printf( "Trying to use '%s' as %s-controlled device...\n", (const char*) interface, (const char*) driver ); | ||
68 | |||
69 | // sanity checks before downcasting | ||
70 | ONetworkInterface* iface = net->interface( interface ); | ||
71 | if ( !iface ) | ||
72 | { | ||
73 | printf( "Interface '%s' doesn't exist. Exiting.\n", (const char*) interface ); | ||
74 | exit( -1 ); | ||
75 | } | ||
76 | if ( !iface->isWireless() ) | ||
77 | { | ||
78 | printf( "Interface '%s' doesn't support wireless extensions. Exiting.\n", (const char*) interface ); | ||
79 | exit( -1 ); | ||
80 | } | ||
81 | |||
82 | // downcast should be safe now | ||
83 | wiface = (OWirelessNetworkInterface*) iface; | ||
84 | printf( "Using wireless interface '%s' for scanning (current SSID is '%s')...\n", (const char*) interface, (const char*) wiface->SSID() ); | ||
85 | |||
86 | /* | ||
87 | |||
88 | // ifconfig down the interface - this enable more crash-proof | ||
89 | // scanning with drivers like spectrum_cs... | ||
90 | if ( wiface->isUp() ) | ||
91 | { | ||
92 | printf( "Interface status is up... switching to down... " ); | ||
93 | wiface->setUp( false ); | ||
94 | if ( wiface->isUp() ) | ||
95 | { | ||
96 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); | ||
97 | exit( -1 ); | ||
98 | } | ||
99 | else | ||
100 | { | ||
101 | printf( "ok.\n" ); | ||
102 | } | ||
103 | } | ||
104 | else | ||
105 | printf( "Interface status is already down - good.\n" ); | ||
106 | |||
107 | */ | ||
108 | |||
109 | // ifconfig +promisc the interface to receive all packets | ||
110 | if ( !wiface->promiscuousMode() ) | ||
111 | { | ||
112 | printf( "Interface status is not promisc... switching to promisc... " ); | ||
113 | wiface->setPromiscuousMode( true ); | ||
114 | if ( !wiface->promiscuousMode() ) | ||
115 | { | ||
116 | printf( "failed (%s). Exiting.\n", strerror( errno ) ); | ||
117 | exit( -1 ); | ||
118 | } | ||
119 | else | ||
120 | { | ||
121 | printf( "ok.\n" ); | ||
122 | } | ||
123 | } | ||
124 | else | ||
125 | printf( "Interface status is already promisc - good.\n" ); | ||
126 | |||
127 | // connect a monitoring strategy to the interface | ||
128 | if ( driver == "orinoco" ) | ||
129 | new OOrinocoMonitoringInterface( wiface ); | ||
130 | else | ||
131 | { | ||
132 | printf( "Unknown driver. Exiting\n" ); | ||
133 | exit( -1 ); | ||
134 | } | ||
135 | |||
136 | // enable monitoring mode | ||
137 | printf( "Enabling monitor mode...\n" ); | ||
138 | wiface->setMonitorMode( true ); | ||
139 | |||
140 | // open a packet capturer | ||
141 | cap = new OPacketCapturer(); | ||
142 | cap->open( interface ); | ||
143 | if ( !cap->isOpen() ) | ||
144 | { | ||
145 | printf( "Unable to open libpcap (%s). Exiting.\n", strerror( errno ) ); | ||
146 | exit( -1 ); | ||
147 | } | ||
148 | |||
149 | // set capturer to non-blocking mode | ||
150 | cap->setBlocking( false ); | ||
151 | |||
152 | // start channel hopper | ||
153 | wiface->setChannelHopping( 1000 ); | ||
154 | |||
155 | // connect | ||
156 | connect( cap, SIGNAL( receivedPacket(OPacket*) ), this, SLOT( receivePacket(OPacket*) ) ); | ||
157 | |||
158 | } | ||
159 | |||
160 | ~Wellenreiter() {}; | ||
161 | |||
162 | public slots: | ||
163 | void receivePacket(OPacket* p) | ||
164 | { | ||
165 | if (!p) | ||
166 | { | ||
167 | printf( "(empty packet received)\n" ); | ||
168 | return; | ||
169 | } | ||
170 | |||
171 | OWaveLanManagementPacket* beacon = (OWaveLanManagementPacket*) p->child( "802.11 Management" ); | ||
172 | |||
173 | if ( beacon ) | ||
174 | { | ||
175 | if ( stations.find( beacon->SSID() ) ) | ||
176 | stations[beacon->SSID()]->beacons++; | ||
177 | else | ||
178 | { | ||
179 | printf( "found new network @ channel %d, SSID = '%s'\n", wiface->channel(), (const char*) beacon->SSID() ); | ||
180 | stations.insert( beacon->SSID(), new Station( "unknown", wiface->channel(), | ||
181 | ((OWaveLanPacket*) beacon->parent())->usesWep() ) ); | ||
182 | } | ||
183 | } | ||
184 | } | ||
185 | private: | ||
186 | OPacketCapturer* cap; | ||
187 | OWirelessNetworkInterface* wiface; | ||
188 | }; | ||
189 | |||
190 | |||
191 | int main( int argc, char** argv ) | ||
192 | { | ||
193 | Wellenreiter w( argc, argv ); | ||
194 | w.exec(); | ||
195 | return 0; | ||
196 | } | ||
197 | |||
198 | #include "miniwellenreiter.moc" | ||
199 | |||
diff --git a/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro new file mode 100644 index 0000000..7ce535c --- a/dev/null +++ b/libopie2/examples/opienet/miniwellenreiter/miniwellenreiter.pro | |||
@@ -0,0 +1,13 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on debug | ||
3 | HEADERS = | ||
4 | SOURCES = miniwellenreiter.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lopiecore2 -lopienet2 | ||
8 | TARGET = miniwellenreiter | ||
9 | MOC_DIR = moc | ||
10 | OBJECTS_DIR = obj | ||
11 | |||
12 | include ( $(OPIEDIR)/include.pro ) | ||
13 | |||
diff --git a/libopie2/examples/opienet/onetworkdemo/.cvsignore b/libopie2/examples/opienet/onetworkdemo/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opienet/onetworkdemo/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp new file mode 100644 index 0000000..7703b4c --- a/dev/null +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -0,0 +1,35 @@ | |||
1 | #include <opie2/onetwork.h> | ||
2 | |||
3 | int main( int argc, char** argv ) | ||
4 | { | ||
5 | qDebug( "OPIE Network Demo" ); | ||
6 | |||
7 | ONetwork* net = ONetwork::instance(); | ||
8 | |||
9 | ONetwork::InterfaceIterator it = net->iterator(); | ||
10 | |||
11 | while ( it.current() ) | ||
12 | { | ||
13 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); | ||
14 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); | ||
15 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); | ||
16 | if ( it.current()->isWireless() ) | ||
17 | { | ||
18 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); | ||
19 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); | ||
20 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); | ||
21 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); | ||
22 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); | ||
23 | |||
24 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) | ||
25 | //{ | ||
26 | qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP() ); | ||
27 | //} | ||
28 | |||
29 | } | ||
30 | ++it; | ||
31 | } | ||
32 | |||
33 | return 0; | ||
34 | |||
35 | } | ||
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.pro b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.pro new file mode 100644 index 0000000..2d71aa0 --- a/dev/null +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.pro | |||
@@ -0,0 +1,12 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on debug | ||
3 | HEADERS = | ||
4 | SOURCES = onetworkdemo.cpp | ||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDPATH += $(OPIEDIR)/include | ||
7 | LIBS += -lopiecore2 -lopienet2 | ||
8 | TARGET = onetworkdemo | ||
9 | MOC_DIR = moc | ||
10 | OBJECTS_DIR = obj | ||
11 | |||
12 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/libopie2/examples/opienet/opienet.pro b/libopie2/examples/opienet/opienet.pro new file mode 100644 index 0000000..c7800a9 --- a/dev/null +++ b/libopie2/examples/opienet/opienet.pro | |||
@@ -0,0 +1,3 @@ | |||
1 | TEMPLATE = subdirs | ||
2 | SUBDIRS = miniwellenreiter onetworkdemo | ||
3 | |||
diff --git a/libopie2/examples/opieui/.cvsignore b/libopie2/examples/opieui/.cvsignore new file mode 100644 index 0000000..8f7300c --- a/dev/null +++ b/libopie2/examples/opieui/.cvsignore | |||
@@ -0,0 +1,6 @@ | |||
1 | Makefile* | ||
2 | moc* | ||
3 | *moc | ||
4 | *.o | ||
5 | ~* | ||
6 | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/1.png b/libopie2/examples/opieui/oversatileviewdemo/1.png new file mode 100644 index 0000000..0e2e41b --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/1.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/1small.png b/libopie2/examples/opieui/oversatileviewdemo/1small.png new file mode 100644 index 0000000..ce6b262 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/1small.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/2.png b/libopie2/examples/opieui/oversatileviewdemo/2.png new file mode 100644 index 0000000..8a0181d --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/2.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/2small.png b/libopie2/examples/opieui/oversatileviewdemo/2small.png new file mode 100644 index 0000000..82a4431 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/2small.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/3.png b/libopie2/examples/opieui/oversatileviewdemo/3.png new file mode 100644 index 0000000..8a58d6c --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/3.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/3small.png b/libopie2/examples/opieui/oversatileviewdemo/3small.png new file mode 100644 index 0000000..073ba55 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/3small.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/4.png b/libopie2/examples/opieui/oversatileviewdemo/4.png new file mode 100644 index 0000000..198891b --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/4.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/4small.png b/libopie2/examples/opieui/oversatileviewdemo/4small.png new file mode 100644 index 0000000..7f1cc01 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/4small.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/5.png b/libopie2/examples/opieui/oversatileviewdemo/5.png new file mode 100644 index 0000000..ee7344a --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/5.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/5small.png b/libopie2/examples/opieui/oversatileviewdemo/5small.png new file mode 100644 index 0000000..105b038 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/5small.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/6.png b/libopie2/examples/opieui/oversatileviewdemo/6.png new file mode 100644 index 0000000..72c3692 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/6.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/6small.png b/libopie2/examples/opieui/oversatileviewdemo/6small.png new file mode 100644 index 0000000..1db2a30 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/6small.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/folder_closed.png b/libopie2/examples/opieui/oversatileviewdemo/folder_closed.png new file mode 100644 index 0000000..4157333 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/folder_closed.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/folder_closed32.png b/libopie2/examples/opieui/oversatileviewdemo/folder_closed32.png new file mode 100644 index 0000000..acc992c --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/folder_closed32.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/folder_opened.png b/libopie2/examples/opieui/oversatileviewdemo/folder_opened.png new file mode 100644 index 0000000..5e7e37e --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/folder_opened.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/folder_opened32.png b/libopie2/examples/opieui/oversatileviewdemo/folder_opened32.png new file mode 100644 index 0000000..acd3265 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/folder_opened32.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/leaf.png b/libopie2/examples/opieui/oversatileviewdemo/leaf.png new file mode 100644 index 0000000..c8435ec --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/leaf.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/leaf32.png b/libopie2/examples/opieui/oversatileviewdemo/leaf32.png new file mode 100644 index 0000000..5e90ead --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/leaf32.png | |||
Binary files differ | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/main.cpp b/libopie2/examples/opieui/oversatileviewdemo/main.cpp new file mode 100644 index 0000000..d8c01a4 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/main.cpp | |||
@@ -0,0 +1,29 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #include "opieuidemo.h" | ||
17 | |||
18 | #include <opie2/oapplication.h> | ||
19 | |||
20 | int main( int argc, char **argv ) | ||
21 | { | ||
22 | OApplication a( argc, argv, "Opie UI Demo" ); | ||
23 | qDebug( "." ); | ||
24 | OpieUIDemo e; | ||
25 | qDebug( "." ); | ||
26 | a.showMainWidget(&e); | ||
27 | qDebug( "." ); | ||
28 | return a.exec(); | ||
29 | } | ||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieui.pro b/libopie2/examples/opieui/oversatileviewdemo/opieui.pro new file mode 100644 index 0000000..8ad5fc9 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/opieui.pro | |||
@@ -0,0 +1,17 @@ | |||
1 | TEMPLATE = app | ||
2 | CONFIG = qt warn_on debug | ||
3 | HEADERS = opieuidemo.h \ | ||
4 | oversatileviewdemo.h | ||
5 | SOURCES = opieuidemo.cpp \ | ||
6 | oversatileviewdemo.cpp \ | ||
7 | main.cpp | ||
8 | INCLUDEPATH += $(OPIEDIR)/include | ||
9 | DEPENDPATH += $(OPIEDIR)/include | ||
10 | LIBS += -lopieui2 -lopiecore2 | ||
11 | TARGET = opieuidemo | ||
12 | MOC_DIR = moc | ||
13 | OBJECTS_DIR = obj | ||
14 | |||
15 | include ( $(OPIEDIR)/include.pro ) | ||
16 | |||
17 | |||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp new file mode 100644 index 0000000..197669c --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp | |||
@@ -0,0 +1,205 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | ***********************************************************************/ | ||
15 | |||
16 | // Qt | ||
17 | |||
18 | #include <qcolor.h> | ||
19 | #include <qpopupmenu.h> | ||
20 | #include <qmenubar.h> | ||
21 | #include <qmessagebox.h> | ||
22 | #include <qvbox.h> | ||
23 | #include <qstring.h> | ||
24 | #include <qstringlist.h> | ||
25 | |||
26 | // Qtopia | ||
27 | |||
28 | #ifdef QWS | ||
29 | #include <qpe/qpeapplication.h> | ||
30 | #include <qpe/global.h> | ||
31 | #endif | ||
32 | |||
33 | // Opie | ||
34 | |||
35 | #ifdef QWS | ||
36 | #include <opie/odevice.h> | ||
37 | using namespace Opie; | ||
38 | #endif | ||
39 | |||
40 | #include <opie2/ocompletionbox.h> | ||
41 | #include <opie2/olineedit.h> | ||
42 | #include <opie2/ocombobox.h> | ||
43 | #include <opie2/oeditlistbox.h> | ||
44 | #include <opie2/oselector.h> | ||
45 | #include <opie2/opopupmenu.h> | ||
46 | |||
47 | #include <qtabwidget.h> | ||
48 | #include "oversatileviewdemo.h" | ||
49 | |||
50 | // Local | ||
51 | |||
52 | #include "opieuidemo.h" | ||
53 | |||
54 | enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; | ||
55 | |||
56 | OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) | ||
57 | : QMainWindow( parent, name, fl ) | ||
58 | { | ||
59 | |||
60 | QMenuBar* mbar = this->menuBar(); | ||
61 | OPopupMenu* demo = new OPopupMenu( this ); | ||
62 | demo->setTitle( "Title" ); | ||
63 | demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); | ||
64 | demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); | ||
65 | demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); | ||
66 | demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); | ||
67 | demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); | ||
68 | mbar->insertItem( "Demonstrate", demo ); | ||
69 | |||
70 | build(); | ||
71 | |||
72 | } | ||
73 | |||
74 | OpieUIDemo::~OpieUIDemo() | ||
75 | { | ||
76 | } | ||
77 | |||
78 | void OpieUIDemo::build() | ||
79 | { | ||
80 | main = new QTabWidget( this, "tabwidget" ); | ||
81 | setCentralWidget( main ); | ||
82 | main->show(); | ||
83 | |||
84 | main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); | ||
85 | } | ||
86 | |||
87 | |||
88 | void OpieUIDemo::demo( int d ) | ||
89 | { | ||
90 | switch (d) | ||
91 | { | ||
92 | case ocompletionbox: demoOCompletionBox(); break; | ||
93 | case olineedit: demoOLineEdit(); break; | ||
94 | case ocombobox: demoOComboBox(); break; | ||
95 | case oeditlistbox: demoOEditListBox(); break; | ||
96 | case oselector: demoOSelector(); break; | ||
97 | |||
98 | } | ||
99 | |||
100 | } | ||
101 | |||
102 | void OpieUIDemo::demoOCompletionBox() | ||
103 | { | ||
104 | qDebug( "ocompletionbox" ); | ||
105 | |||
106 | OCompletionBox* box = new OCompletionBox( 0 ); | ||
107 | box->insertItem( "This CompletionBox" ); | ||
108 | box->insertItem( "Says 'Hello World'" ); | ||
109 | box->insertItem( "Here are some" ); | ||
110 | box->insertItem( "Additional Items" ); | ||
111 | box->insertItem( "Complete Completion Box" ); | ||
112 | |||
113 | connect( box, SIGNAL( activated( const QString& ) ), this, SLOT( messageBox( const QString& ) ) ); | ||
114 | box->popup(); | ||
115 | |||
116 | } | ||
117 | |||
118 | void OpieUIDemo::demoOLineEdit() | ||
119 | { | ||
120 | qDebug( "olineedit" ); | ||
121 | |||
122 | OLineEdit *edit = new OLineEdit( 0, "lineedit" ); | ||
123 | |||
124 | edit->setCompletionMode( OGlobalSettings::CompletionPopup ); | ||
125 | OCompletion* comp = edit->completionObject(); | ||
126 | |||
127 | QStringList list; | ||
128 | list << "mickeyl@handhelds.org"; | ||
129 | list << "mickey@tm.informatik.uni-frankfurt.de"; | ||
130 | list << "mickey@vanille.de"; | ||
131 | |||
132 | comp->setItems( list ); | ||
133 | |||
134 | edit->show(); | ||
135 | |||
136 | } | ||
137 | |||
138 | void OpieUIDemo::demoOComboBox() | ||
139 | { | ||
140 | qDebug( "ocombobox" ); | ||
141 | |||
142 | OComboBox *combo = new OComboBox( true, 0, "combobox" ); | ||
143 | |||
144 | combo->setCompletionMode( OGlobalSettings::CompletionPopup ); | ||
145 | OCompletion* comp = combo->completionObject(); | ||
146 | |||
147 | QStringList ilist; | ||
148 | ilist << "kergoth@handhelds.org"; | ||
149 | ilist << "harlekin@handhelds.org"; | ||
150 | ilist << "groucho@handhelds.org"; | ||
151 | combo->insertStringList( ilist ); | ||
152 | |||
153 | QStringList clist; | ||
154 | clist << "mickeyl@handhelds.org"; | ||
155 | clist << "mickey@tm.informatik.uni-frankfurt.de"; | ||
156 | clist << "mickey@vanille.de"; | ||
157 | comp->setItems( clist ); | ||
158 | |||
159 | combo->show(); | ||
160 | |||
161 | } | ||
162 | |||
163 | void OpieUIDemo::demoOEditListBox() | ||
164 | { | ||
165 | qDebug( "oeditlistbox" ); | ||
166 | |||
167 | OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" ); | ||
168 | |||
169 | edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup ); | ||
170 | OCompletion* comp = edit->lineEdit()->completionObject(); | ||
171 | QStringList clist; | ||
172 | clist << "Completion everywhere"; | ||
173 | clist << "Cool Completion everywhere"; | ||
174 | clist << "History History History"; | ||
175 | comp->setItems( clist ); | ||
176 | |||
177 | QStringList list; | ||
178 | list << "kergoth@handhelds.org"; | ||
179 | list << "harlekin@handhelds.org"; | ||
180 | list << "groucho@handhelds.org"; | ||
181 | list << "mickeyl@handhelds.org"; | ||
182 | edit->insertStringList( list ); | ||
183 | |||
184 | edit->show(); | ||
185 | |||
186 | } | ||
187 | |||
188 | void OpieUIDemo::demoOSelector() | ||
189 | { | ||
190 | qDebug( "oselector" ); | ||
191 | |||
192 | OHSSelector* sel = new OHSSelector( 0, "gradientselector" ); | ||
193 | //#sel->resize( QSize( 200, 30 ) ); | ||
194 | //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) ); | ||
195 | //#sel->setText( "Dark", "Light" ); | ||
196 | |||
197 | sel->show(); | ||
198 | } | ||
199 | |||
200 | void OpieUIDemo::messageBox( const QString& text ) | ||
201 | { | ||
202 | QString info; | ||
203 | info = "You have selected '" + text + "'"; | ||
204 | QMessageBox::information( this, "OpieUIDemo", info ); | ||
205 | } | ||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.h b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.h new file mode 100644 index 0000000..0519ae6 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.h | |||
@@ -0,0 +1,56 @@ | |||
1 | /********************************************************************** | ||
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | ||
3 | ** | ||
4 | ** This file is part of Opie Environment. | ||
5 | ** | ||
6 | ** This file may be distributed and/or modified under the terms of the | ||
7 | ** GNU General Public License version 2 as published by the Free Software | ||
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | ||
9 | ** packaging of this file. | ||
10 | ** | ||
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | ||
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | ||
13 | ** | ||
14 | **********************************************************************/ | ||
15 | |||
16 | #ifndef OPIEUIDEMO_H | ||
17 | #define OPIEUIDEMO_H | ||
18 | |||
19 | #include <qmainwindow.h> | ||
20 | |||
21 | class OVersatileView; | ||
22 | class QTabWidget; | ||
23 | class QVBox; | ||
24 | |||
25 | class OpieUIDemo : public QMainWindow { | ||
26 | Q_OBJECT | ||
27 | |||
28 | public: | ||
29 | |||
30 | OpieUIDemo( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel ); | ||
31 | ~OpieUIDemo(); | ||
32 | |||
33 | void demoOCompletionBox(); | ||
34 | void demoOLineEdit(); | ||
35 | void demoOComboBox(); | ||
36 | void demoOEditListBox(); | ||
37 | void demoOSelector(); | ||
38 | |||
39 | public slots: | ||
40 | void demo( int ); | ||
41 | void messageBox( const QString& text ); | ||
42 | |||
43 | protected: | ||
44 | void build(); | ||
45 | void buildVV( QVBox* b ); | ||
46 | |||
47 | private: | ||
48 | QTabWidget* main; | ||
49 | |||
50 | OVersatileView* vv; | ||
51 | |||
52 | }; | ||
53 | |||
54 | |||
55 | |||
56 | #endif | ||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp new file mode 100644 index 0000000..cf1e443 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp | |||
@@ -0,0 +1,158 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Michael 'Mickey' Lauer | ||
5 | <mickey@tm.informatik.uni-frankfurt.de> | ||
6 | =. | ||
7 | .=l. | ||
8 | .>+-= | ||
9 | _;:, .> :=|. This program is free software; you can | ||
10 | .> <`_, > . <= redistribute it and/or modify it under | ||
11 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
12 | .="- .-=="i, .._ License as published by the Free Software | ||
13 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
14 | ._= =} : or (at your option) any later version. | ||
15 | .%`+i> _;_. | ||
16 | .i_,=:_. -<s. This program is distributed in the hope that | ||
17 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
18 | : .. .:, . . . without even the implied warranty of | ||
19 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
20 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
21 | ..}^=.= = ; Library General Public License for more | ||
22 | ++= -. .` .: details. | ||
23 | : = ...= . :.=- | ||
24 | -. .:....=;==+<; You should have received a copy of the GNU | ||
25 | -_. . . )=. = Library General Public License along with | ||
26 | -- :-=` this library; see the file COPYING.LIB. | ||
27 | If not, write to the Free Software Foundation, | ||
28 | Inc., 59 Temple Place - Suite 330, | ||
29 | Boston, MA 02111-1307, USA. | ||
30 | |||
31 | */ | ||
32 | |||
33 | #include "oversatileviewdemo.h" | ||
34 | #include <opie2/oversatileview.h> | ||
35 | #include <opie2/oversatileviewitem.h> | ||
36 | |||
37 | #include <qstring.h> | ||
38 | #include <qpixmap.h> | ||
39 | #include <qlistview.h> | ||
40 | |||
41 | OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) | ||
42 | :QVBox( parent, name, f ) | ||
43 | { | ||
44 | vv = new OVersatileView( this ); | ||
45 | |||
46 | vv->addColumn( "First" ); | ||
47 | vv->addColumn( "2nd" ); | ||
48 | vv->addColumn( "IIIrd" ); | ||
49 | |||
50 | QString counter; | ||
51 | |||
52 | QPixmap leaf( "leaf.png" ); | ||
53 | QPixmap opened( "folder_opened.png" ); | ||
54 | QPixmap closed( "folder_closed.png" ); | ||
55 | |||
56 | QPixmap leaf32( "leaf32.png" ); | ||
57 | QPixmap opened32( "folder_opened32.png" ); | ||
58 | QPixmap closed32( "folder_closed32.png" ); | ||
59 | |||
60 | vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed ); | ||
61 | vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 ); | ||
62 | |||
63 | OVersatileViewItem* item; | ||
64 | OVersatileViewItem* item2; | ||
65 | |||
66 | for ( int i = 0; i < 5; ++i ) | ||
67 | { | ||
68 | counter.sprintf( "%d", i ); | ||
69 | item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter ); | ||
70 | item->setRenameEnabled( true ); | ||
71 | item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter ); | ||
72 | item2->setRenameEnabled( true ); | ||
73 | |||
74 | } | ||
75 | |||
76 | connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); | ||
77 | connect( vv, SIGNAL( selectionChanged( OVersatileViewItem * ) ), this, SLOT( selectionChanged( OVersatileViewItem * ) ) ); | ||
78 | connect( vv, SIGNAL( currentChanged( OVersatileViewItem * ) ), this, SLOT( currentChanged( OVersatileViewItem * ) ) ); | ||
79 | connect( vv, SIGNAL( clicked( OVersatileViewItem * ) ), this, SLOT( clicked( OVersatileViewItem * ) ) ); | ||
80 | connect( vv, SIGNAL( pressed( OVersatileViewItem * ) ), this, SLOT( pressed( OVersatileViewItem * ) ) ); | ||
81 | |||
82 | connect( vv, SIGNAL( doubleClicked( OVersatileViewItem * ) ), this, SLOT( doubleClicked( OVersatileViewItem * ) ) ); | ||
83 | connect( vv, SIGNAL( returnPressed( OVersatileViewItem * ) ), this, SLOT( returnPressed( OVersatileViewItem * ) ) ); | ||
84 | |||
85 | connect( vv, SIGNAL( onItem( OVersatileViewItem * ) ), this, SLOT( onItem( OVersatileViewItem * ) ) ); | ||
86 | connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) ); | ||
87 | |||
88 | connect( vv, SIGNAL( expanded( OVersatileViewItem * ) ), this, SLOT( expanded( OVersatileViewItem * ) ) ); | ||
89 | connect( vv, SIGNAL( collapsed( OVersatileViewItem * ) ), this, SLOT( collapsed( OVersatileViewItem * ) ) ); | ||
90 | |||
91 | connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) ); | ||
92 | |||
93 | connect( vv, SIGNAL( contextMenuRequested( OVersatileViewItem *, const QPoint&, int ) ), this, SLOT( contextMenuRequested( OVersatileViewItem *, const QPoint&, int ) ) ); | ||
94 | |||
95 | } | ||
96 | |||
97 | OVersatileViewDemo::~OVersatileViewDemo() | ||
98 | { | ||
99 | } | ||
100 | |||
101 | void OVersatileViewDemo::selectionChanged() | ||
102 | { | ||
103 | qDebug( "received signal selectionChanged()" ); | ||
104 | } | ||
105 | void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item ) | ||
106 | { | ||
107 | qDebug( "received signal selectionChanged(OVersatileViewItem*)" ); | ||
108 | } | ||
109 | void OVersatileViewDemo::currentChanged( OVersatileViewItem * item ) | ||
110 | { | ||
111 | qDebug( "received signal currentChanged( OVersatileViewItem * )" ); | ||
112 | } | ||
113 | void OVersatileViewDemo::clicked( OVersatileViewItem * item ) | ||
114 | { | ||
115 | qDebug( "received signal clicked( OVersatileViewItem * )" ); | ||
116 | } | ||
117 | void OVersatileViewDemo::pressed( OVersatileViewItem * item ) | ||
118 | { | ||
119 | qDebug( "received signal pressed( OVersatileViewItem * )" ); | ||
120 | } | ||
121 | |||
122 | void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item ) | ||
123 | { | ||
124 | qDebug( "received signal doubleClicked( OVersatileViewItem *item )" ); | ||
125 | } | ||
126 | void OVersatileViewDemo::returnPressed( OVersatileViewItem *item ) | ||
127 | { | ||
128 | qDebug( "received signal returnPressed( OVersatileViewItem *item )" ); | ||
129 | } | ||
130 | |||
131 | void OVersatileViewDemo::onItem( OVersatileViewItem *item ) | ||
132 | { | ||
133 | qDebug( "received signal onItem( OVersatileViewItem *item )" ); | ||
134 | } | ||
135 | void OVersatileViewDemo::onViewport() | ||
136 | { | ||
137 | qDebug( "received signal onViewport()" ); | ||
138 | } | ||
139 | |||
140 | void OVersatileViewDemo::expanded( OVersatileViewItem *item ) | ||
141 | { | ||
142 | qDebug( "received signal expanded( OVersatileViewItem *item )" ); | ||
143 | } | ||
144 | |||
145 | void OVersatileViewDemo::collapsed( OVersatileViewItem *item ) | ||
146 | { | ||
147 | qDebug( "received signal collapsed( OVersatileViewItem *item )" ); | ||
148 | } | ||
149 | |||
150 | void OVersatileViewDemo::moved() | ||
151 | { | ||
152 | qDebug( "received signal moved( OVersatileViewItem *item )" ); | ||
153 | } | ||
154 | |||
155 | void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col ) | ||
156 | { | ||
157 | qDebug( "received signal contextMenuRequested( OVersatileViewItem *item )" ); | ||
158 | } | ||
diff --git a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.h b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.h new file mode 100644 index 0000000..79318d0 --- a/dev/null +++ b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.h | |||
@@ -0,0 +1,73 @@ | |||
1 | /* | ||
2 | This file is part of the Opie Project | ||
3 | |||
4 | Copyright (C) 2003 Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de> | ||
5 | =. | ||
6 | .=l. | ||
7 | .>+-= | ||
8 | _;:, .> :=|. This program is free software; you can | ||
9 | .> <`_, > . <= redistribute it and/or modify it under | ||
10 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
11 | .="- .-=="i, .._ License as published by the Free Software | ||
12 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
13 | ._= =} : or (at your option) any later version. | ||
14 | .%`+i> _;_. | ||
15 | .i_,=:_. -<s. This program is distributed in the hope that | ||
16 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
17 | : .. .:, . . . without even the implied warranty of | ||
18 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
19 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
20 | ..}^=.= = ; Library General Public License for more | ||
21 | ++= -. .` .: details. | ||
22 | : = ...= . :.=- | ||
23 | -. .:....=;==+<; You should have received a copy of the GNU | ||
24 | -_. . . )=. = Library General Public License along with | ||
25 | -- :-=` this library; see the file COPYING.LIB. | ||
26 | If not, write to the Free Software Foundation, | ||
27 | Inc., 59 Temple Place - Suite 330, | ||
28 | Boston, MA 02111-1307, USA. | ||
29 | |||
30 | */ | ||
31 | |||
32 | #ifndef OVERSATILEVIEWDEMO_H | ||
33 | #define OVERSATILEVIEWDEMO_H | ||
34 | |||
35 | #include <qvbox.h> | ||
36 | |||
37 | class OVersatileView; | ||
38 | class OVersatileViewItem; | ||
39 | |||
40 | class OVersatileViewDemo: public QVBox | ||
41 | { | ||
42 | Q_OBJECT | ||
43 | |||
44 | public: | ||
45 | OVersatileViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 ); | ||
46 | virtual ~OVersatileViewDemo(); | ||
47 | |||
48 | public slots: | ||
49 | void selectionChanged(); | ||
50 | void selectionChanged( OVersatileViewItem * ); | ||
51 | void currentChanged( OVersatileViewItem * ); | ||
52 | void clicked( OVersatileViewItem * ); | ||
53 | void pressed( OVersatileViewItem * ); | ||
54 | |||
55 | void doubleClicked( OVersatileViewItem *item ); | ||
56 | void returnPressed( OVersatileViewItem *item ); | ||
57 | |||
58 | void onItem( OVersatileViewItem *item ); | ||
59 | void onViewport(); | ||
60 | |||
61 | void expanded( OVersatileViewItem *item ); | ||
62 | void collapsed( OVersatileViewItem *item ); | ||
63 | |||
64 | void moved(); | ||
65 | |||
66 | void contextMenuRequested( OVersatileViewItem *item, const QPoint&, int col ); | ||
67 | |||
68 | private: | ||
69 | OVersatileView* vv; | ||
70 | |||
71 | }; | ||
72 | |||
73 | #endif | ||