9 files changed, 165 insertions, 71 deletions
diff --git a/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp b/libopie2/examples/opiecore/odebugdemo/odebugdemo.cpp index 0b8e1fe..c0369ef 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 | qDebug( "Process-wide OApplication object @ %0x", oApp ); | 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 | qDebug( "choosing method: %d", method ); | 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 "moc/odebugdemo.moc" |
diff --git a/libopie2/examples/opiedb/sqltest/main.cpp b/libopie2/examples/opiedb/sqltest/main.cpp index adca5fd..24b7b21 100644 --- a/libopie2/examples/opiedb/sqltest/main.cpp +++ b/libopie2/examples/opiedb/sqltest/main.cpp | |||
@@ -1,30 +1,62 @@ | |||
1 | #include <qdir.h> | 1 | /* |
2 | =. This file is part of the Opie Project | ||
3 | .=l. Copyright (C) 2004 Opie Team <opie@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
2 | 26 | ||
3 | #include <qpe/qpeapplication.h> | 27 | */ |
28 | |||
29 | /* OPIE */ | ||
4 | #include <opie2/osqlmanager.h> | 30 | #include <opie2/osqlmanager.h> |
5 | #include <opie2/osqlquery.h> | 31 | #include <opie2/osqlquery.h> |
6 | #include <opie2/osqldriver.h> | 32 | #include <opie2/osqldriver.h> |
7 | #include <opie2/osqlresult.h> | 33 | #include <opie2/osqlresult.h> |
34 | #include <opie2/odebug.h> | ||
35 | |||
36 | #include <qpe/qpeapplication.h> | ||
37 | |||
38 | /* QT */ | ||
39 | #include <qdir.h> | ||
8 | 40 | ||
9 | using namespace Opie::DB; | 41 | using namespace Opie::DB; |
10 | int main( int argc, char* argv[] ) { | 42 | int main( int argc, char* argv[] ) { |
11 | 43 | ||
12 | QPEApplication app( argc, argv ); | 44 | QPEApplication app( argc, argv ); |
13 | OSQLManager man; | 45 | OSQLManager man; |
14 | man.registerPath( QDir::currentDirPath() ); | 46 | man.registerPath( QDir::currentDirPath() ); |
15 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | 47 | OSQLBackEnd::ValueList list = man.queryBackEnd(); |
16 | 48 | ||
17 | OSQLDriver *driver = man.standard(); | 49 | OSQLDriver *driver = man.standard(); |
18 | qWarning("testmain" + driver->id() ); | 50 | owarn << "testmain" + driver->id() << oendl; |
19 | driver->setUrl("/home/ich/test2vhgytry"); | 51 | driver->setUrl("/home/ich/test2vhgytry"); |
20 | if ( driver->open() ) { | 52 | if ( driver->open() ) { |
21 | qWarning("could open"); | 53 | owarn << "could open" << oendl; |
22 | }else | 54 | }else |
23 | qWarning("wasn't able to open"); | 55 | owarn << "wasn't able to open" << oendl; |
24 | OSQLRawQuery raw("select * from t2" ); | 56 | OSQLRawQuery raw("select * from t2" ); |
25 | OSQLResult res = driver->query( &raw ); | 57 | OSQLResult res = driver->query( &raw ); |
26 | 58 | ||
27 | OSQLRawQuery raw2( "insert into t2 VALUES(ROWID,'Meine Mutter') "); | 59 | OSQLRawQuery raw2( "insert into t2 VALUES(ROWID,'Meine Mutter') "); |
28 | res = driver->query(&raw2); | 60 | res = driver->query(&raw2); |
29 | 61 | ||
30 | }; | 62 | }; |
diff --git a/libopie2/examples/opiedb/sqltest/spaltenweise.cpp b/libopie2/examples/opiedb/sqltest/spaltenweise.cpp index e1a4d5d..c11724c 100644 --- a/libopie2/examples/opiedb/sqltest/spaltenweise.cpp +++ b/libopie2/examples/opiedb/sqltest/spaltenweise.cpp | |||
@@ -1,43 +1,43 @@ | |||
1 | #include <qdir.h> | 1 | #include <qdir.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <opie2/osqlmanager.h> | 4 | #include <opie2/osqlmanager.h> |
5 | #include <opie2/osqlquery.h> | 5 | #include <opie2/osqlquery.h> |
6 | #include <opie2/osqldriver.h> | 6 | #include <opie2/osqldriver.h> |
7 | #include <opie2/osqlresult.h> | 7 | #include <opie2/osqlresult.h> |
8 | 8 | ||
9 | using namespace Opie::DB; | 9 | using namespace Opie::DB; |
10 | 10 | ||
11 | int main( int argc, char* argv[] ) { | 11 | int main( int argc, char* argv[] ) { |
12 | 12 | ||
13 | QPEApplication app( argc, argv ); | 13 | QPEApplication app( argc, argv ); |
14 | OSQLManager man; | 14 | OSQLManager man; |
15 | man.registerPath( QDir::currentDirPath() ); | 15 | man.registerPath( QDir::currentDirPath() ); |
16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | 16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); |
17 | 17 | ||
18 | OSQLDriver *driver = man.standard(); | 18 | OSQLDriver *driver = man.standard(); |
19 | qWarning("testmain" + driver->id() ); | 19 | owarn << "testmain" + driver->id() << oendl; |
20 | driver->setUrl("/home/ich/spaltenweise"); | 20 | driver->setUrl("/home/ich/spaltenweise"); |
21 | if ( driver->open() ) { | 21 | if ( driver->open() ) { |
22 | qWarning("could open"); | 22 | owarn << "could open" << oendl; |
23 | }else | 23 | }else |
24 | qWarning("wasn't able to open"); | 24 | owarn << "wasn't able to open" << oendl; |
25 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(" | 25 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(" |
26 | "uid,categories,completed," | 26 | "uid,categories,completed," |
27 | "progress,summary,HasDate," | 27 | "progress,summary,HasDate," |
28 | "DateDay,DateMonth,DateYear," | 28 | "DateDay,DateMonth,DateYear," |
29 | "priority,description)" ); | 29 | "priority,description)" ); |
30 | 30 | ||
31 | OSQLResult res = driver->query( raw ); | 31 | OSQLResult res = driver->query( raw ); |
32 | delete raw; | 32 | delete raw; |
33 | for (int i = 0; i< 10000; i++ ) { | 33 | for (int i = 0; i< 10000; i++ ) { |
34 | int uid = i; | 34 | int uid = i; |
35 | OSQLRawQuery raw("insert into todolist VALUES("+ | 35 | OSQLRawQuery raw("insert into todolist VALUES("+ |
36 | QString::number(uid)+ ",'-122324;-12132',1,100,"+ | 36 | QString::number(uid)+ ",'-122324;-12132',1,100,"+ |
37 | "'Summary234-"+QString::number(uid)+"',1,5,8,2002,1,"+ | 37 | "'Summary234-"+QString::number(uid)+"',1,5,8,2002,1,"+ |
38 | "'Description\n12344')"); | 38 | "'Description\n12344')"); |
39 | OSQLResult res = driver->query( &raw ); | 39 | OSQLResult res = driver->query( &raw ); |
40 | 40 | ||
41 | } | 41 | } |
42 | return 0; | 42 | return 0; |
43 | }; | 43 | }; |
diff --git a/libopie2/examples/opiedb/sqltest/zeilenweise.cpp b/libopie2/examples/opiedb/sqltest/zeilenweise.cpp index 2d11ac5..126e797 100644 --- a/libopie2/examples/opiedb/sqltest/zeilenweise.cpp +++ b/libopie2/examples/opiedb/sqltest/zeilenweise.cpp | |||
@@ -1,86 +1,86 @@ | |||
1 | #include <qdir.h> | 1 | #include <qdir.h> |
2 | 2 | ||
3 | #include <qpe/qpeapplication.h> | 3 | #include <qpe/qpeapplication.h> |
4 | #include <opie2/osqlmanager.h> | 4 | #include <opie2/osqlmanager.h> |
5 | #include <opie2/osqlquery.h> | 5 | #include <opie2/osqlquery.h> |
6 | #include <opie2/osqldriver.h> | 6 | #include <opie2/osqldriver.h> |
7 | #include <opie2/osqlresult.h> | 7 | #include <opie2/osqlresult.h> |
8 | 8 | ||
9 | using namespace Opie::DB; | 9 | using namespace Opie::DB; |
10 | 10 | ||
11 | int main( int argc, char* argv[] ) { | 11 | int main( int argc, char* argv[] ) { |
12 | 12 | ||
13 | QPEApplication app( argc, argv ); | 13 | QPEApplication app( argc, argv ); |
14 | OSQLManager man; | 14 | OSQLManager man; |
15 | man.registerPath( QDir::currentDirPath() ); | 15 | man.registerPath( QDir::currentDirPath() ); |
16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); | 16 | OSQLBackEnd::ValueList list = man.queryBackEnd(); |
17 | 17 | ||
18 | OSQLDriver *driver = man.standard(); | 18 | OSQLDriver *driver = man.standard(); |
19 | qWarning("testmain" + driver->id() ); | 19 | owarn << "testmain" + driver->id() << oendl; |
20 | driver->setUrl("/home/ich/zeilenweise"); | 20 | driver->setUrl("/home/ich/zeilenweise"); |
21 | if ( driver->open() ) { | 21 | if ( driver->open() ) { |
22 | qWarning("could open"); | 22 | owarn << "could open" << oendl; |
23 | }else | 23 | }else |
24 | qWarning("wasn't able to open"); | 24 | owarn << "wasn't able to open" << oendl; |
25 | OSQLRawQuery raw2("BEGIN TRANSACTION"); | 25 | OSQLRawQuery raw2("BEGIN TRANSACTION"); |
26 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(uid,key,value)"); | 26 | OSQLRawQuery *raw = new OSQLRawQuery("create table todolist(uid,key,value)"); |
27 | OSQLResult res = driver->query( &raw2 ); | 27 | OSQLResult res = driver->query( &raw2 ); |
28 | res = driver->query( raw ); | 28 | res = driver->query( raw ); |
29 | delete raw; | 29 | delete raw; |
30 | for (int i = 0; i< 10000; i++ ) { | 30 | for (int i = 0; i< 10000; i++ ) { |
31 | int uid = i; | 31 | int uid = i; |
32 | OSQLRawQuery *raw; | 32 | OSQLRawQuery *raw; |
33 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid)+",'Categories',"+"'-122324;-12132')"); | 33 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid)+",'Categories',"+"'-122324;-12132')"); |
34 | OSQLResult res = driver->query(raw ); | 34 | OSQLResult res = driver->query(raw ); |
35 | delete raw; | 35 | delete raw; |
36 | 36 | ||
37 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid) + | 37 | raw = new OSQLRawQuery("insert into todolist VALUES("+QString::number(uid) + |
38 | ",'Completed',1)" ); | 38 | ",'Completed',1)" ); |
39 | res = driver->query(raw ); | 39 | res = driver->query(raw ); |
40 | delete raw; | 40 | delete raw; |
41 | 41 | ||
42 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 42 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
43 | QString::number(uid)+",'Progress',100)" ); | 43 | QString::number(uid)+",'Progress',100)" ); |
44 | res = driver->query( raw ); | 44 | res = driver->query( raw ); |
45 | delete raw; | 45 | delete raw; |
46 | 46 | ||
47 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 47 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
48 | QString::number(uid)+",'Summary',"+ | 48 | QString::number(uid)+",'Summary',"+ |
49 | "'Summary234-"+ QString::number(uid) + "')"); | 49 | "'Summary234-"+ QString::number(uid) + "')"); |
50 | res = driver->query( raw ); | 50 | res = driver->query( raw ); |
51 | delete raw; | 51 | delete raw; |
52 | 52 | ||
53 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 53 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
54 | QString::number(uid)+",'HasDate',1)"); | 54 | QString::number(uid)+",'HasDate',1)"); |
55 | res = driver->query( raw ); | 55 | res = driver->query( raw ); |
56 | delete raw; | 56 | delete raw; |
57 | 57 | ||
58 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 58 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
59 | QString::number(uid)+",'DateDay',5)"); | 59 | QString::number(uid)+",'DateDay',5)"); |
60 | res = driver->query( raw ); | 60 | res = driver->query( raw ); |
61 | delete raw; | 61 | delete raw; |
62 | 62 | ||
63 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 63 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
64 | QString::number(uid)+",'DateMonth',8)"); | 64 | QString::number(uid)+",'DateMonth',8)"); |
65 | res = driver->query( raw ); | 65 | res = driver->query( raw ); |
66 | delete raw; | 66 | delete raw; |
67 | 67 | ||
68 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 68 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
69 | QString::number(uid)+",'DateYear',2002)"); | 69 | QString::number(uid)+",'DateYear',2002)"); |
70 | res = driver->query( raw ); | 70 | res = driver->query( raw ); |
71 | delete raw; | 71 | delete raw; |
72 | 72 | ||
73 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 73 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
74 | QString::number(uid)+",'Priority',1)"); | 74 | QString::number(uid)+",'Priority',1)"); |
75 | res = driver->query( raw ); | 75 | res = driver->query( raw ); |
76 | delete raw; | 76 | delete raw; |
77 | 77 | ||
78 | raw = new OSQLRawQuery("insert into todolist VALUES("+ | 78 | raw = new OSQLRawQuery("insert into todolist VALUES("+ |
79 | QString::number(uid)+",'Description','" + | 79 | QString::number(uid)+",'Description','" + |
80 | QString::number(uid) + "Description\n12344')"); | 80 | QString::number(uid) + "Description\n12344')"); |
81 | res = driver->query( raw ); | 81 | res = driver->query( raw ); |
82 | delete raw; | 82 | delete raw; |
83 | } | 83 | } |
84 | OSQLRawQuery raw3("COMMIT"); | 84 | OSQLRawQuery raw3("COMMIT"); |
85 | res = driver->query(&raw3 ); | 85 | res = driver->query(&raw3 ); |
86 | }; | 86 | }; |
diff --git a/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp b/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp index 8d421fd..bdf2149 100644 --- a/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp +++ b/libopie2/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp | |||
@@ -1,34 +1,65 @@ | |||
1 | /* | ||
2 | =. This file is part of the Opie Project | ||
3 | .=l. Copyright (C) 2004 Opie Team <opie@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | /* OPIE */ | ||
1 | #include <opie2/osoundsystem.h> | 30 | #include <opie2/osoundsystem.h> |
31 | #include <opie2/odebug.h> | ||
2 | 32 | ||
3 | using namespace Opie::MM; | 33 | using namespace Opie::MM; |
4 | 34 | ||
5 | int main( int argc, char** argv ) | 35 | int main( int argc, char** argv ) |
6 | { | 36 | { |
7 | qDebug( "OPIE Sound System Demo" ); | 37 | odebug << "OPIE Sound System Demo" << oendl; |
8 | 38 | ||
9 | OSoundSystem* sound = OSoundSystem::instance(); | 39 | OSoundSystem* sound = OSoundSystem::instance(); |
10 | 40 | ||
11 | OSoundSystem::CardIterator it = sound->iterator(); | 41 | OSoundSystem::CardIterator it = sound->iterator(); |
12 | /* | 42 | /* |
13 | while ( it.current() ) | 43 | while ( it.current() ) |
14 | { | 44 | { |
15 | qDebug( "DEMO: OSoundSystem contains Interface '%s'", (const char*) it.current()->name() ); | 45 | odebug << "DEMO: OSoundSystem contains Interface '" << it.current()->name() << "'" << oendl; |
16 | ++it; | 46 | ++it; |
17 | } | 47 | } |
18 | 48 | ||
19 | */ | 49 | */ |
20 | OSoundCard* card = it.current(); | 50 | OSoundCard* card = it.current(); |
21 | 51 | ||
22 | OMixerInterface* mixer = card->mixer(); | 52 | OMixerInterface* mixer = card->mixer(); |
23 | 53 | ||
24 | QStringList channels = mixer->allChannels(); | 54 | QStringList channels = mixer->allChannels(); |
25 | 55 | ||
26 | for ( QStringList::Iterator it = channels.begin(); it != channels.end(); ++it ) | 56 | for ( QStringList::Iterator it = channels.begin(); it != channels.end(); ++it ) |
27 | { | 57 | { |
28 | qDebug( "OSSDEMO: Mixer has channel %s", (const char*) *it ); | 58 | odebug << "OSSDEMO: Mixer has channel " << *it << "" << oendl; |
29 | qDebug( "OSSDEMO: +--- volume %d (left) | %d (right)", mixer->volume( *it ) & 0xff, mixer->volume( *it ) >> 8 ); | 59 | odebug << "OSSDEMO: +--- volume " << ( mixer->volume( *it ) & 0xff ) |
60 | << " (left) | " << ( mixer->volume( *it ) >> 8 ) << " (right)" << oendl; | ||
30 | } | 61 | } |
31 | 62 | ||
32 | return 0; | 63 | return 0; |
33 | 64 | ||
34 | } | 65 | } |
diff --git a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp index 4f8af60..65866af 100644 --- a/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp +++ b/libopie2/examples/opienet/onetworkdemo/onetworkdemo.cpp | |||
@@ -1,145 +1,176 @@ | |||
1 | /* | ||
2 | =. This file is part of the Opie Project | ||
3 | .=l. Copyright (C) 2004 Opie Team <opie@handhelds.org> | ||
4 | .>+-= | ||
5 | _;:, .> :=|. This library is free software; you can | ||
6 | .> <`_, > . <= redistribute it and/or modify it under | ||
7 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | ||
8 | .="- .-=="i, .._ License as published by the Free Software | ||
9 | - . .-<_> .<> Foundation; either version 2 of the License, | ||
10 | ._= =} : or (at your option) any later version. | ||
11 | .%`+i> _;_. | ||
12 | .i_,=:_. -<s. This library is distributed in the hope that | ||
13 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | ||
14 | : .. .:, . . . without even the implied warranty of | ||
15 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | ||
16 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | ||
17 | ..}^=.= = ; Library General Public License for more | ||
18 | ++= -. .` .: details. | ||
19 | : = ...= . :.=- | ||
20 | -. .:....=;==+<; You should have received a copy of the GNU | ||
21 | -_. . . )=. = Library General Public License along with | ||
22 | -- :-=` this library; see the file COPYING.LIB. | ||
23 | If not, write to the Free Software Foundation, | ||
24 | Inc., 59 Temple Place - Suite 330, | ||
25 | Boston, MA 02111-1307, USA. | ||
26 | |||
27 | */ | ||
28 | |||
29 | /* OPIE */ | ||
1 | #include <opie2/onetwork.h> | 30 | #include <opie2/onetwork.h> |
2 | #include <opie2/ostation.h> | 31 | #include <opie2/ostation.h> |
3 | #include <opie2/omanufacturerdb.h> | 32 | #include <opie2/omanufacturerdb.h> |
33 | #include <opie2/odebug.h> | ||
4 | 34 | ||
35 | /* STD */ | ||
5 | #include <unistd.h> | 36 | #include <unistd.h> |
6 | 37 | ||
7 | using namespace Opie::Net; | 38 | using namespace Opie::Net; |
8 | 39 | ||
9 | int main( int argc, char** argv ) | 40 | int main( int argc, char** argv ) |
10 | { | 41 | { |
11 | qDebug( "OPIE Network Demo" ); | 42 | odebug << "OPIE Network Demo" << oendl; |
12 | 43 | ||
13 | ONetwork* net = ONetwork::instance(); | 44 | ONetwork* net = ONetwork::instance(); |
14 | 45 | ||
15 | ONetwork::InterfaceIterator it = net->iterator(); | 46 | ONetwork::InterfaceIterator it = net->iterator(); |
16 | 47 | ||
17 | while ( it.current() ) | 48 | while ( it.current() ) |
18 | { | 49 | { |
19 | qDebug( "DEMO: ONetwork contains Interface '%s'", (const char*) it.current()->name() ); | 50 | odebug << "DEMO: ONetwork contains Interface '" << it.current()->name() << "'" << oendl; |
20 | qDebug( "DEMO: Datalink code is '%d'", it.current()->dataLinkType() ); | 51 | odebug << "DEMO: Datalink code is '" << it.current()->dataLinkType() << "'" << oendl; |
21 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString() ); | 52 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString() << "'" << oendl; |
22 | qDebug( "DEMO: MAC Address is '%s'", (const char*) it.current()->macAddress().toString(true) ); | 53 | odebug << "DEMO: MAC Address is '" << it.current()->macAddress().toString(true) << "'" << oendl; |
23 | qDebug( "DEMO: MAC Manufacturer seems to be '%s'", (const char*) it.current()->macAddress().manufacturer() ); | 54 | odebug << "DEMO: MAC Manufacturer seems to be '" << it.current()->macAddress().manufacturer() << "'" << oendl; |
24 | qDebug( "DEMO: Manufacturertest1 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "08:00:87" ) ); | 55 | odebug << "DEMO: Manufacturertest1 = '" << OManufacturerDB::instance()->lookupExt( "08:00:87" ) << "'" << oendl; |
25 | qDebug( "DEMO: Manufacturertest2 = '%s'", (const char*) OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) ); | 56 | odebug << "DEMO: Manufacturertest2 = '" << OManufacturerDB::instance()->lookupExt( "E2:0C:0F" ) << "'" << oendl; |
26 | qDebug( "Demo: IPv4 Address is '%s'", (const char*) it.current()->ipV4Address() ); | 57 | odebug << "Demo: IPv4 Address is '" << it.current()->ipV4Address() << "'" << oendl; |
27 | if ( it.current()->isWireless() ) | 58 | if ( it.current()->isWireless() ) |
28 | { | 59 | { |
29 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); | 60 | OWirelessNetworkInterface* iface = static_cast<OWirelessNetworkInterface*>( it.current() ); |
30 | qDebug( "DEMO: '%s' seems to feature the wireless extensions.", (const char*) iface->name() ); | 61 | odebug << "DEMO: '" << iface->name() << "' seems to feature the wireless extensions." << oendl; |
31 | qDebug( "DEMO: Current SSID is '%s'", (const char*) iface->SSID() ); | 62 | odebug << "DEMO: Current SSID is '" << iface->SSID() << "'" << oendl; |
32 | qDebug( "DEMO: Antenna is tuned to '%f', that is channel %d", iface->frequency(), iface->channel() ); | 63 | odebug << "DEMO: Antenna is tuned to '" << iface->frequency() << "', that is channel " << iface->channel() << "" << oendl; |
33 | 64 | ||
34 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) | 65 | //if ( iface->mode() == OWirelessNetworkInterface::adhoc ) |
35 | //{ | 66 | //{ |
36 | //qDebug( "DEMO: Associated AP has MAC Address '%s'", (const char*) iface->associatedAP().toString() ); | 67 | //odebug << "DEMO: Associated AP has MAC Address '" << iface->associatedAP().toString() << "'" << oendl; |
37 | //} | 68 | //} |
38 | 69 | ||
39 | /* | 70 | /* |
40 | 71 | ||
41 | // nickname | 72 | // nickname |
42 | qDebug( "DEMO: Current NickName is '%s'", (const char*) iface->nickName() ); | 73 | odebug << "DEMO: Current NickName is '" << iface->nickName() << "'" << oendl; |
43 | iface->setNickName( "MyNickName" ); | 74 | iface->setNickName( "MyNickName" ); |
44 | if ( iface->nickName() != "MyNickName" ) | 75 | if ( iface->nickName() != "MyNickName" ) |
45 | qDebug( "DEMO: Warning! Can't change nickname" ); | 76 | odebug << "DEMO: Warning! Can't change nickname" << oendl; |
46 | else | 77 | else |
47 | qDebug( "DEMO: Nickname change successful." ); | 78 | odebug << "DEMO: Nickname change successful." << oendl; |
48 | 79 | ||
49 | /* | 80 | /* |
50 | 81 | ||
51 | // operation mode | 82 | // operation mode |
52 | qDebug( "DEMO: Current OperationMode is '%s'", (const char*) iface->mode() ); | 83 | odebug << "DEMO: Current OperationMode is '" << iface->mode() << "'" << oendl; |
53 | iface->setMode( "adhoc" ); | 84 | iface->setMode( "adhoc" ); |
54 | if ( iface->mode() != "adhoc" ) | 85 | if ( iface->mode() != "adhoc" ) |
55 | qDebug( "DEMO: Warning! Can't change operation mode" ); | 86 | odebug << "DEMO: Warning! Can't change operation mode" << oendl; |
56 | else | 87 | else |
57 | qDebug( "DEMO: Operation Mode change successful." ); | 88 | odebug << "DEMO: Operation Mode change successful." << oendl; |
58 | 89 | ||
59 | // RF channel | 90 | // RF channel |
60 | qDebug( "DEMO: Current Channel is '%d'", iface->channel() ); | 91 | odebug << "DEMO: Current Channel is '" << iface->channel() << "'" << oendl; |
61 | iface->setChannel( 1 ); | 92 | iface->setChannel( 1 ); |
62 | if ( iface->channel() != 1 ) | 93 | if ( iface->channel() != 1 ) |
63 | qDebug( "DEMO: Warning! Can't change RF channel" ); | 94 | odebug << "DEMO: Warning! Can't change RF channel" << oendl; |
64 | else | 95 | else |
65 | qDebug( "DEMO: RF channel change successful." ); | 96 | odebug << "DEMO: RF channel change successful." << oendl; |
66 | 97 | ||
67 | iface->setMode( "managed" ); | 98 | iface->setMode( "managed" ); |
68 | 99 | ||
69 | */ | 100 | */ |
70 | 101 | ||
71 | /* | 102 | /* |
72 | 103 | ||
73 | // network scan | 104 | // network scan |
74 | 105 | ||
75 | OStationList* stations = iface->scanNetwork(); | 106 | OStationList* stations = iface->scanNetwork(); |
76 | if ( stations ) | 107 | if ( stations ) |
77 | { | 108 | { |
78 | qDebug( "DEMO: # of stations around = %d", stations->count() ); | 109 | odebug << "DEMO: # of stations around = " << stations->count() << "" << oendl; |
79 | OStation* station; | 110 | OStation* station; |
80 | for ( station = stations->first(); station != 0; station = stations->next() ) | 111 | for ( station = stations->first(); station != 0; station = stations->next() ) |
81 | { | 112 | { |
82 | qDebug( "DEMO: station dump following..." ); | 113 | odebug << "DEMO: station dump following..." << oendl; |
83 | station->dump(); | 114 | station->dump(); |
84 | } | 115 | } |
85 | } | 116 | } |
86 | 117 | ||
87 | else | 118 | else |
88 | { | 119 | { |
89 | qDebug( "DEMO: Warning! Scan didn't work!" ); | 120 | odebug << "DEMO: Warning! Scan didn't work!" << oendl; |
90 | } | 121 | } |
91 | 122 | ||
92 | /* | 123 | /* |
93 | 124 | ||
94 | // first some wrong calls to check if this is working | 125 | // first some wrong calls to check if this is working |
95 | iface->setPrivate( "seppel", 10 ); | 126 | iface->setPrivate( "seppel", 10 ); |
96 | iface->setPrivate( "monitor", 0 ); | 127 | iface->setPrivate( "monitor", 0 ); |
97 | 128 | ||
98 | // now the real deal | 129 | // now the real deal |
99 | iface->setPrivate( "monitor", 2, 2, 3 ); | 130 | iface->setPrivate( "monitor", 2, 2, 3 ); |
100 | 131 | ||
101 | // trying to set hw address to 12:34:56:AB:CD:EF | 132 | // trying to set hw address to 12:34:56:AB:CD:EF |
102 | 133 | ||
103 | /* | 134 | /* |
104 | 135 | ||
105 | OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); | 136 | OMacAddress addr = OMacAddress::fromString( "12:34:56:AB:CD:EF" ); |
106 | iface->setUp( false ); | 137 | iface->setUp( false ); |
107 | iface->setMacAddress( addr ); | 138 | iface->setMacAddress( addr ); |
108 | iface->setUp( true ); | 139 | iface->setUp( true ); |
109 | qDebug( "DEMO: MAC Address now is '%s'", (const char*) iface->macAddress().toString() ); | 140 | odebug << "DEMO: MAC Address now is '" << iface->macAddress().toString() << "'" << oendl; |
110 | 141 | ||
111 | */ | 142 | */ |
112 | 143 | ||
113 | // monitor test | 144 | // monitor test |
114 | 145 | ||
115 | |||
116 | 146 | ||
117 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 147 | |
148 | odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl; | ||
118 | iface->setMode( "monitor" ); | 149 | iface->setMode( "monitor" ); |
119 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 150 | odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl; |
120 | 151 | ||
121 | sleep( 1 ); | 152 | sleep( 1 ); |
122 | 153 | ||
123 | iface->setChannel( 1 ); | 154 | iface->setChannel( 1 ); |
124 | iface->setMode( "managed" ); | 155 | iface->setMode( "managed" ); |
125 | 156 | ||
126 | //sleep( 1 ); | 157 | //sleep( 1 ); |
127 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 158 | odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl; |
128 | 159 | ||
129 | /*iface->setMode( "adhoc" ); | 160 | /*iface->setMode( "adhoc" ); |
130 | sleep( 1 ); | 161 | sleep( 1 ); |
131 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 162 | odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl; |
132 | iface->setMode( "managed" ); | 163 | iface->setMode( "managed" ); |
133 | sleep( 1 ); | 164 | sleep( 1 ); |
134 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() ); | 165 | odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl; |
135 | iface->setMode( "master" ); | 166 | iface->setMode( "master" ); |
136 | sleep( 1 ); | 167 | sleep( 1 ); |
137 | qDebug( "DEMO: current interface mode is '%s'", (const char*) iface->mode() );*/ | 168 | odebug << "DEMO: current interface mode is '" << iface->mode() << "'" << oendl; */ |
138 | 169 | ||
139 | } | 170 | } |
140 | ++it; | 171 | ++it; |
141 | } | 172 | } |
142 | 173 | ||
143 | return 0; | 174 | return 0; |
144 | 175 | ||
145 | } | 176 | } |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/main.cpp b/libopie2/examples/opieui/oversatileviewdemo/main.cpp index bcda14c..e48395a 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/main.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/main.cpp | |||
@@ -1,32 +1,32 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | **********************************************************************/ | 14 | **********************************************************************/ |
15 | 15 | ||
16 | #include "opieuidemo.h" | 16 | #include "opieuidemo.h" |
17 | 17 | ||
18 | #include <opie2/oapplication.h> | 18 | #include <opie2/oapplication.h> |
19 | 19 | ||
20 | using namespace Opie::Core; | 20 | using namespace Opie::Core; |
21 | using namespace Opie::Ui; | 21 | using namespace Opie::Ui; |
22 | 22 | ||
23 | int main( int argc, char **argv ) | 23 | int main( int argc, char **argv ) |
24 | { | 24 | { |
25 | OApplication a( argc, argv, "Opie UI Demo" ); | 25 | OApplication a( argc, argv, "Opie UI Demo" ); |
26 | qDebug( "." ); | 26 | odebug << "." << oendl; |
27 | OpieUIDemo e; | 27 | OpieUIDemo e; |
28 | qDebug( "." ); | 28 | odebug << "." << oendl; |
29 | a.showMainWidget(&e); | 29 | a.showMainWidget(&e); |
30 | qDebug( "." ); | 30 | odebug << "." << oendl; |
31 | return a.exec(); | 31 | return a.exec(); |
32 | } | 32 | } |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp index 754a744..a2cdd5a 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/opieuidemo.cpp | |||
@@ -1,203 +1,203 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. | 2 | ** Copyright (C) 2002 Michael 'Mickey' Lauer. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Opie Environment. | 4 | ** This file is part of Opie Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 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 | 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 | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 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. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ***********************************************************************/ | 14 | ***********************************************************************/ |
15 | 15 | ||
16 | // Qt | 16 | // Qt |
17 | 17 | ||
18 | #include <qcolor.h> | 18 | #include <qcolor.h> |
19 | #include <qpopupmenu.h> | 19 | #include <qpopupmenu.h> |
20 | #include <qmenubar.h> | 20 | #include <qmenubar.h> |
21 | #include <qmessagebox.h> | 21 | #include <qmessagebox.h> |
22 | #include <qvbox.h> | 22 | #include <qvbox.h> |
23 | #include <qstring.h> | 23 | #include <qstring.h> |
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | 25 | ||
26 | // Qtopia | 26 | // Qtopia |
27 | 27 | ||
28 | #include <qpe/qpeapplication.h> | 28 | #include <qpe/qpeapplication.h> |
29 | #include <qpe/global.h> | 29 | #include <qpe/global.h> |
30 | 30 | ||
31 | // Opie | 31 | // Opie |
32 | 32 | ||
33 | #include <opie2/odevice.h> | 33 | #include <opie2/odevice.h> |
34 | 34 | ||
35 | #include <opie2/ocompletionbox.h> | 35 | #include <opie2/ocompletionbox.h> |
36 | #include <opie2/olineedit.h> | 36 | #include <opie2/olineedit.h> |
37 | #include <opie2/ocombobox.h> | 37 | #include <opie2/ocombobox.h> |
38 | #include <opie2/oeditlistbox.h> | 38 | #include <opie2/oeditlistbox.h> |
39 | #include <opie2/oselector.h> | 39 | #include <opie2/oselector.h> |
40 | #include <opie2/opopupmenu.h> | 40 | #include <opie2/opopupmenu.h> |
41 | 41 | ||
42 | #include <qtabwidget.h> | 42 | #include <qtabwidget.h> |
43 | #include "oversatileviewdemo.h" | 43 | #include "oversatileviewdemo.h" |
44 | 44 | ||
45 | // Local | 45 | // Local |
46 | 46 | ||
47 | #include "opieuidemo.h" | 47 | #include "opieuidemo.h" |
48 | 48 | ||
49 | using namespace Opie::Core; | 49 | using namespace Opie::Core; |
50 | using namespace Opie::Ui; | 50 | using namespace Opie::Ui; |
51 | 51 | ||
52 | enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; | 52 | enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector }; |
53 | 53 | ||
54 | OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) | 54 | OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl ) |
55 | : QMainWindow( parent, name, fl ) | 55 | : QMainWindow( parent, name, fl ) |
56 | { | 56 | { |
57 | 57 | ||
58 | QMenuBar* mbar = this->menuBar(); | 58 | QMenuBar* mbar = this->menuBar(); |
59 | OPopupMenu* demo = new OPopupMenu( this ); | 59 | OPopupMenu* demo = new OPopupMenu( this ); |
60 | demo->setTitle( "Title" ); | 60 | demo->setTitle( "Title" ); |
61 | demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); | 61 | demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox ); |
62 | demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); | 62 | demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit ); |
63 | demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); | 63 | demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox ); |
64 | demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); | 64 | demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox ); |
65 | demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); | 65 | demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector ); |
66 | mbar->insertItem( "Demonstrate", demo ); | 66 | mbar->insertItem( "Demonstrate", demo ); |
67 | 67 | ||
68 | build(); | 68 | build(); |
69 | 69 | ||
70 | } | 70 | } |
71 | 71 | ||
72 | OpieUIDemo::~OpieUIDemo() | 72 | OpieUIDemo::~OpieUIDemo() |
73 | { | 73 | { |
74 | } | 74 | } |
75 | 75 | ||
76 | void OpieUIDemo::build() | 76 | void OpieUIDemo::build() |
77 | { | 77 | { |
78 | main = new QTabWidget( this, "tabwidget" ); | 78 | main = new QTabWidget( this, "tabwidget" ); |
79 | setCentralWidget( main ); | 79 | setCentralWidget( main ); |
80 | main->show(); | 80 | main->show(); |
81 | 81 | ||
82 | main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); | 82 | main->addTab( new OVersatileViewDemo( main ), "VersatileView" ); |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | void OpieUIDemo::demo( int d ) | 86 | void OpieUIDemo::demo( int d ) |
87 | { | 87 | { |
88 | switch (d) | 88 | switch (d) |
89 | { | 89 | { |
90 | case ocompletionbox: demoOCompletionBox(); break; | 90 | case ocompletionbox: demoOCompletionBox(); break; |
91 | case olineedit: demoOLineEdit(); break; | 91 | case olineedit: demoOLineEdit(); break; |
92 | case ocombobox: demoOComboBox(); break; | 92 | case ocombobox: demoOComboBox(); break; |
93 | case oeditlistbox: demoOEditListBox(); break; | 93 | case oeditlistbox: demoOEditListBox(); break; |
94 | case oselector: demoOSelector(); break; | 94 | case oselector: demoOSelector(); break; |
95 | 95 | ||
96 | } | 96 | } |
97 | 97 | ||
98 | } | 98 | } |
99 | 99 | ||
100 | void OpieUIDemo::demoOCompletionBox() | 100 | void OpieUIDemo::demoOCompletionBox() |
101 | { | 101 | { |
102 | qDebug( "ocompletionbox" ); | 102 | odebug << "ocompletionbox" << oendl; |
103 | 103 | ||
104 | OCompletionBox* box = new OCompletionBox( 0 ); | 104 | OCompletionBox* box = new OCompletionBox( 0 ); |
105 | box->insertItem( "This CompletionBox" ); | 105 | box->insertItem( "This CompletionBox" ); |
106 | box->insertItem( "Says 'Hello World'" ); | 106 | box->insertItem( "Says 'Hello World'" ); |
107 | box->insertItem( "Here are some" ); | 107 | box->insertItem( "Here are some" ); |
108 | box->insertItem( "Additional Items" ); | 108 | box->insertItem( "Additional Items" ); |
109 | box->insertItem( "Complete Completion Box" ); | 109 | box->insertItem( "Complete Completion Box" ); |
110 | 110 | ||
111 | connect( box, SIGNAL( activated(const QString&) ), this, SLOT( messageBox(const QString&) ) ); | 111 | connect( box, SIGNAL( activated(const QString&) ), this, SLOT( messageBox(const QString&) ) ); |
112 | box->popup(); | 112 | box->popup(); |
113 | 113 | ||
114 | } | 114 | } |
115 | 115 | ||
116 | void OpieUIDemo::demoOLineEdit() | 116 | void OpieUIDemo::demoOLineEdit() |
117 | { | 117 | { |
118 | qDebug( "olineedit" ); | 118 | odebug << "olineedit" << oendl; |
119 | 119 | ||
120 | OLineEdit *edit = new OLineEdit( 0, "lineedit" ); | 120 | OLineEdit *edit = new OLineEdit( 0, "lineedit" ); |
121 | 121 | ||
122 | edit->setCompletionMode( OGlobalSettings::CompletionPopup ); | 122 | edit->setCompletionMode( OGlobalSettings::CompletionPopup ); |
123 | OCompletion* comp = edit->completionObject(); | 123 | OCompletion* comp = edit->completionObject(); |
124 | 124 | ||
125 | QStringList list; | 125 | QStringList list; |
126 | list << "mickeyl@handhelds.org"; | 126 | list << "mickeyl@handhelds.org"; |
127 | list << "mickey@tm.informatik.uni-frankfurt.de"; | 127 | list << "mickey@tm.informatik.uni-frankfurt.de"; |
128 | list << "mickey@vanille.de"; | 128 | list << "mickey@vanille.de"; |
129 | 129 | ||
130 | comp->setItems( list ); | 130 | comp->setItems( list ); |
131 | 131 | ||
132 | edit->show(); | 132 | edit->show(); |
133 | 133 | ||
134 | } | 134 | } |
135 | 135 | ||
136 | void OpieUIDemo::demoOComboBox() | 136 | void OpieUIDemo::demoOComboBox() |
137 | { | 137 | { |
138 | qDebug( "ocombobox" ); | 138 | odebug << "ocombobox" << oendl; |
139 | 139 | ||
140 | OComboBox *combo = new OComboBox( true, 0, "combobox" ); | 140 | OComboBox *combo = new OComboBox( true, 0, "combobox" ); |
141 | 141 | ||
142 | combo->setCompletionMode( OGlobalSettings::CompletionPopup ); | 142 | combo->setCompletionMode( OGlobalSettings::CompletionPopup ); |
143 | OCompletion* comp = combo->completionObject(); | 143 | OCompletion* comp = combo->completionObject(); |
144 | 144 | ||
145 | QStringList ilist; | 145 | QStringList ilist; |
146 | ilist << "kergoth@handhelds.org"; | 146 | ilist << "kergoth@handhelds.org"; |
147 | ilist << "harlekin@handhelds.org"; | 147 | ilist << "harlekin@handhelds.org"; |
148 | ilist << "groucho@handhelds.org"; | 148 | ilist << "groucho@handhelds.org"; |
149 | combo->insertStringList( ilist ); | 149 | combo->insertStringList( ilist ); |
150 | 150 | ||
151 | QStringList clist; | 151 | QStringList clist; |
152 | clist << "mickeyl@handhelds.org"; | 152 | clist << "mickeyl@handhelds.org"; |
153 | clist << "mickey@tm.informatik.uni-frankfurt.de"; | 153 | clist << "mickey@tm.informatik.uni-frankfurt.de"; |
154 | clist << "mickey@vanille.de"; | 154 | clist << "mickey@vanille.de"; |
155 | comp->setItems( clist ); | 155 | comp->setItems( clist ); |
156 | 156 | ||
157 | combo->show(); | 157 | combo->show(); |
158 | 158 | ||
159 | } | 159 | } |
160 | 160 | ||
161 | void OpieUIDemo::demoOEditListBox() | 161 | void OpieUIDemo::demoOEditListBox() |
162 | { | 162 | { |
163 | qDebug( "oeditlistbox" ); | 163 | odebug << "oeditlistbox" << oendl; |
164 | 164 | ||
165 | OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" ); | 165 | OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" ); |
166 | 166 | ||
167 | edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup ); | 167 | edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup ); |
168 | OCompletion* comp = edit->lineEdit()->completionObject(); | 168 | OCompletion* comp = edit->lineEdit()->completionObject(); |
169 | QStringList clist; | 169 | QStringList clist; |
170 | clist << "Completion everywhere"; | 170 | clist << "Completion everywhere"; |
171 | clist << "Cool Completion everywhere"; | 171 | clist << "Cool Completion everywhere"; |
172 | clist << "History History History"; | 172 | clist << "History History History"; |
173 | comp->setItems( clist ); | 173 | comp->setItems( clist ); |
174 | 174 | ||
175 | QStringList list; | 175 | QStringList list; |
176 | list << "kergoth@handhelds.org"; | 176 | list << "kergoth@handhelds.org"; |
177 | list << "harlekin@handhelds.org"; | 177 | list << "harlekin@handhelds.org"; |
178 | list << "groucho@handhelds.org"; | 178 | list << "groucho@handhelds.org"; |
179 | list << "mickeyl@handhelds.org"; | 179 | list << "mickeyl@handhelds.org"; |
180 | edit->insertStringList( list ); | 180 | edit->insertStringList( list ); |
181 | 181 | ||
182 | edit->show(); | 182 | edit->show(); |
183 | 183 | ||
184 | } | 184 | } |
185 | 185 | ||
186 | void OpieUIDemo::demoOSelector() | 186 | void OpieUIDemo::demoOSelector() |
187 | { | 187 | { |
188 | qDebug( "oselector" ); | 188 | odebug << "oselector" << oendl; |
189 | 189 | ||
190 | OHSSelector* sel = new OHSSelector( 0, "gradientselector" ); | 190 | OHSSelector* sel = new OHSSelector( 0, "gradientselector" ); |
191 | //#sel->resize( QSize( 200, 30 ) ); | 191 | //#sel->resize( QSize( 200, 30 ) ); |
192 | //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) ); | 192 | //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) ); |
193 | //#sel->setText( "Dark", "Light" ); | 193 | //#sel->setText( "Dark", "Light" ); |
194 | 194 | ||
195 | sel->show(); | 195 | sel->show(); |
196 | } | 196 | } |
197 | 197 | ||
198 | void OpieUIDemo::messageBox( const QString& text ) | 198 | void OpieUIDemo::messageBox( const QString& text ) |
199 | { | 199 | { |
200 | QString info; | 200 | QString info; |
201 | info = "You have selected '" + text + "'"; | 201 | info = "You have selected '" + text + "'"; |
202 | QMessageBox::information( this, "OpieUIDemo", info ); | 202 | QMessageBox::information( this, "OpieUIDemo", info ); |
203 | } | 203 | } |
diff --git a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp index b6d59aa..e8bbdb1 100644 --- a/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp +++ b/libopie2/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp | |||
@@ -1,160 +1,160 @@ | |||
1 | /* | 1 | /* |
2 | � � � � � � � � This file is part of the Opie Project | 2 | � � � � � � � � This file is part of the Opie Project |
3 | 3 | ||
4 | � � � � � � � Copyright (C) 2003 Michael 'Mickey' Lauer | 4 | � � � � � � � Copyright (C) 2003 Michael 'Mickey' Lauer |
5 | <mickey@tm.informatik.uni-frankfurt.de> | 5 | <mickey@tm.informatik.uni-frankfurt.de> |
6 | =. | 6 | =. |
7 | .=l. | 7 | .=l. |
8 | � � � � � �.>+-= | 8 | � � � � � �.>+-= |
9 | �_;:, � � .> � �:=|. This program is free software; you can | 9 | �_;:, � � .> � �:=|. This program is free software; you can |
10 | .> <`_, � > �. � <= redistribute it and/or modify it under | 10 | .> <`_, � > �. � <= redistribute it and/or modify it under |
11 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public | 11 | :`=1 )Y*s>-.-- � : the terms of the GNU Library General Public |
12 | .="- .-=="i, � � .._ License as published by the Free Software | 12 | .="- .-=="i, � � .._ License as published by the Free Software |
13 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, | 13 | �- . � .-<_> � � .<> Foundation; either version 2 of the License, |
14 | � � �._= =} � � � : or (at your option) any later version. | 14 | � � �._= =} � � � : or (at your option) any later version. |
15 | � � .%`+i> � � � _;_. | 15 | � � .%`+i> � � � _;_. |
16 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that | 16 | � � .i_,=:_. � � �-<s. This program is distributed in the hope that |
17 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; | 17 | � � �+ �. �-:. � � � = it will be useful, but WITHOUT ANY WARRANTY; |
18 | � � : .. � �.:, � � . . . without even the implied warranty of | 18 | � � : .. � �.:, � � . . . without even the implied warranty of |
19 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A | 19 | � � =_ � � � �+ � � =;=|` MERCHANTABILITY or FITNESS FOR A |
20 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU | 20 | � _.=:. � � � : � �:=>`: PARTICULAR PURPOSE. See the GNU |
21 | ..}^=.= � � � = � � � ; Library General Public License for more | 21 | ..}^=.= � � � = � � � ; Library General Public License for more |
22 | ++= � -. � � .` � � .: details. | 22 | ++= � -. � � .` � � .: details. |
23 | �: � � = �...= . :.=- | 23 | �: � � = �...= . :.=- |
24 | �-. � .:....=;==+<; You should have received a copy of the GNU | 24 | �-. � .:....=;==+<; You should have received a copy of the GNU |
25 | � -_. . . � )=. �= Library General Public License along with | 25 | � -_. . . � )=. �= Library General Public License along with |
26 | � � -- � � � �:-=` this library; see the file COPYING.LIB. | 26 | � � -- � � � �:-=` this library; see the file COPYING.LIB. |
27 | If not, write to the Free Software Foundation, | 27 | If not, write to the Free Software Foundation, |
28 | Inc., 59 Temple Place - Suite 330, | 28 | Inc., 59 Temple Place - Suite 330, |
29 | Boston, MA 02111-1307, USA. | 29 | Boston, MA 02111-1307, USA. |
30 | 30 | ||
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include "oversatileviewdemo.h" | 33 | #include "oversatileviewdemo.h" |
34 | #include <opie2/oversatileview.h> | 34 | #include <opie2/oversatileview.h> |
35 | #include <opie2/oversatileviewitem.h> | 35 | #include <opie2/oversatileviewitem.h> |
36 | 36 | ||
37 | #include <qstring.h> | 37 | #include <qstring.h> |
38 | #include <qpixmap.h> | 38 | #include <qpixmap.h> |
39 | #include <qlistview.h> | 39 | #include <qlistview.h> |
40 | 40 | ||
41 | using namespace Opie::Ui; | 41 | using namespace Opie::Ui; |
42 | 42 | ||
43 | OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) | 43 | OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f ) |
44 | :QVBox( parent, name, f ) | 44 | :QVBox( parent, name, f ) |
45 | { | 45 | { |
46 | vv = new OVersatileView( this ); | 46 | vv = new OVersatileView( this ); |
47 | 47 | ||
48 | vv->addColumn( "First" ); | 48 | vv->addColumn( "First" ); |
49 | vv->addColumn( "2nd" ); | 49 | vv->addColumn( "2nd" ); |
50 | vv->addColumn( "IIIrd" ); | 50 | vv->addColumn( "IIIrd" ); |
51 | 51 | ||
52 | QString counter; | 52 | QString counter; |
53 | 53 | ||
54 | QPixmap leaf( "leaf.png" ); | 54 | QPixmap leaf( "leaf.png" ); |
55 | QPixmap opened( "folder_opened.png" ); | 55 | QPixmap opened( "folder_opened.png" ); |
56 | QPixmap closed( "folder_closed.png" ); | 56 | QPixmap closed( "folder_closed.png" ); |
57 | 57 | ||
58 | QPixmap leaf32( "leaf32.png" ); | 58 | QPixmap leaf32( "leaf32.png" ); |
59 | QPixmap opened32( "folder_opened32.png" ); | 59 | QPixmap opened32( "folder_opened32.png" ); |
60 | QPixmap closed32( "folder_closed32.png" ); | 60 | QPixmap closed32( "folder_closed32.png" ); |
61 | 61 | ||
62 | vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed ); | 62 | vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed ); |
63 | vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 ); | 63 | vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 ); |
64 | 64 | ||
65 | OVersatileViewItem* item; | 65 | OVersatileViewItem* item; |
66 | OVersatileViewItem* item2; | 66 | OVersatileViewItem* item2; |
67 | 67 | ||
68 | for ( int i = 0; i < 5; ++i ) | 68 | for ( int i = 0; i < 5; ++i ) |
69 | { | 69 | { |
70 | counter.sprintf( "%d", i ); | 70 | counter.sprintf( "%d", i ); |
71 | item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter ); | 71 | item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter ); |
72 | item->setRenameEnabled( true ); | 72 | item->setRenameEnabled( true ); |
73 | item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter ); | 73 | item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter ); |
74 | item2->setRenameEnabled( true ); | 74 | item2->setRenameEnabled( true ); |
75 | 75 | ||
76 | } | 76 | } |
77 | 77 | ||
78 | connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); | 78 | connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) ); |
79 | connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) ); | 79 | connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) ); |
80 | connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) ); | 80 | connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) ); |
81 | connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) ); | 81 | connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) ); |
82 | connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) ); | 82 | connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) ); |
83 | 83 | ||
84 | connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) ); | 84 | connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) ); |
85 | connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) ); | 85 | connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) ); |
86 | 86 | ||
87 | connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) ); | 87 | connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) ); |
88 | connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) ); | 88 | connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) ); |
89 | 89 | ||
90 | connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) ); | 90 | connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) ); |
91 | connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) ); | 91 | connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) ); |
92 | 92 | ||
93 | connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) ); | 93 | connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) ); |
94 | 94 | ||
95 | connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) ); | 95 | connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) ); |
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | OVersatileViewDemo::~OVersatileViewDemo() | 99 | OVersatileViewDemo::~OVersatileViewDemo() |
100 | { | 100 | { |
101 | } | 101 | } |
102 | 102 | ||
103 | void OVersatileViewDemo::selectionChanged() | 103 | void OVersatileViewDemo::selectionChanged() |
104 | { | 104 | { |
105 | qDebug( "received signal selectionChanged()" ); | 105 | odebug << "received signal selectionChanged()" << oendl; |
106 | } | 106 | } |
107 | void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item ) | 107 | void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item ) |
108 | { | 108 | { |
109 | qDebug( "received signal selectionChanged(OVersatileViewItem*)" ); | 109 | odebug << "received signal selectionChanged(OVersatileViewItem*)" << oendl; |
110 | } | 110 | } |
111 | void OVersatileViewDemo::currentChanged( OVersatileViewItem * item ) | 111 | void OVersatileViewDemo::currentChanged( OVersatileViewItem * item ) |
112 | { | 112 | { |
113 | qDebug( "received signal currentChanged( OVersatileViewItem * )" ); | 113 | odebug << "received signal currentChanged( OVersatileViewItem * )" << oendl; |
114 | } | 114 | } |
115 | void OVersatileViewDemo::clicked( OVersatileViewItem * item ) | 115 | void OVersatileViewDemo::clicked( OVersatileViewItem * item ) |
116 | { | 116 | { |
117 | qDebug( "received signal clicked( OVersatileViewItem * )" ); | 117 | odebug << "received signal clicked( OVersatileViewItem * )" << oendl; |
118 | } | 118 | } |
119 | void OVersatileViewDemo::pressed( OVersatileViewItem * item ) | 119 | void OVersatileViewDemo::pressed( OVersatileViewItem * item ) |
120 | { | 120 | { |
121 | qDebug( "received signal pressed( OVersatileViewItem * )" ); | 121 | odebug << "received signal pressed( OVersatileViewItem * )" << oendl; |
122 | } | 122 | } |
123 | 123 | ||
124 | void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item ) | 124 | void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item ) |
125 | { | 125 | { |
126 | qDebug( "received signal doubleClicked( OVersatileViewItem *item )" ); | 126 | odebug << "received signal doubleClicked( OVersatileViewItem *item )" << oendl; |
127 | } | 127 | } |
128 | void OVersatileViewDemo::returnPressed( OVersatileViewItem *item ) | 128 | void OVersatileViewDemo::returnPressed( OVersatileViewItem *item ) |
129 | { | 129 | { |
130 | qDebug( "received signal returnPressed( OVersatileViewItem *item )" ); | 130 | odebug << "received signal returnPressed( OVersatileViewItem *item )" << oendl; |
131 | } | 131 | } |
132 | 132 | ||
133 | void OVersatileViewDemo::onItem( OVersatileViewItem *item ) | 133 | void OVersatileViewDemo::onItem( OVersatileViewItem *item ) |
134 | { | 134 | { |
135 | qDebug( "received signal onItem( OVersatileViewItem *item )" ); | 135 | odebug << "received signal onItem( OVersatileViewItem *item )" << oendl; |
136 | } | 136 | } |
137 | void OVersatileViewDemo::onViewport() | 137 | void OVersatileViewDemo::onViewport() |
138 | { | 138 | { |
139 | qDebug( "received signal onViewport()" ); | 139 | odebug << "received signal onViewport()" << oendl; |
140 | } | 140 | } |
141 | 141 | ||
142 | void OVersatileViewDemo::expanded( OVersatileViewItem *item ) | 142 | void OVersatileViewDemo::expanded( OVersatileViewItem *item ) |
143 | { | 143 | { |
144 | qDebug( "received signal expanded( OVersatileViewItem *item )" ); | 144 | odebug << "received signal expanded( OVersatileViewItem *item )" << oendl; |
145 | } | 145 | } |
146 | 146 | ||
147 | void OVersatileViewDemo::collapsed( OVersatileViewItem *item ) | 147 | void OVersatileViewDemo::collapsed( OVersatileViewItem *item ) |
148 | { | 148 | { |
149 | qDebug( "received signal collapsed( OVersatileViewItem *item )" ); | 149 | odebug << "received signal collapsed( OVersatileViewItem *item )" << oendl; |
150 | } | 150 | } |
151 | 151 | ||
152 | void OVersatileViewDemo::moved() | 152 | void OVersatileViewDemo::moved() |
153 | { | 153 | { |
154 | qDebug( "received signal moved( OVersatileViewItem *item )" ); | 154 | odebug << "received signal moved( OVersatileViewItem *item )" << oendl; |
155 | } | 155 | } |
156 | 156 | ||
157 | void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col ) | 157 | void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col ) |
158 | { | 158 | { |
159 | qDebug( "received signal contextMenuRequested( OVersatileViewItem *item )" ); | 159 | odebug << "received signal contextMenuRequested( OVersatileViewItem *item )" << oendl; |
160 | } | 160 | } |