summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--examples/opiecore/oconfigdemo/.cvsignore8
-rw-r--r--examples/opiecore/oconfigdemo/oconfigdemo.cpp32
-rw-r--r--examples/opiecore/oconfigdemo/oconfigdemo.pro18
-rw-r--r--examples/opiecore/odebugdemo/.cvsignore8
-rw-r--r--examples/opiecore/odebugdemo/odebugdemo.cpp142
-rw-r--r--examples/opiecore/odebugdemo/odebugdemo.pro17
-rw-r--r--examples/opiecore/oglobalsettingsdemo/.cvsignore8
-rw-r--r--examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp15
-rw-r--r--examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro14
-rw-r--r--examples/opiecore/okeyconfigmanager/README1
-rw-r--r--examples/opiecore/onotifydemo/.cvsignore6
-rw-r--r--examples/opiecore/onotifydemo/onotifydemo.cpp144
-rw-r--r--examples/opiecore/onotifydemo/onotifydemo.pro18
-rw-r--r--examples/opiecore/opiecore.pro2
-rw-r--r--examples/opiecore/oplugins/.cvsignore3
-rw-r--r--examples/opiecore/oplugins/oplugins.cpp47
-rw-r--r--examples/opiecore/oplugins/oplugins.pro11
-rw-r--r--examples/opiecore/oprocessdemo/.cvsignore7
-rw-r--r--examples/opiecore/oprocessdemo/oprocessdemo.cpp13
-rw-r--r--examples/opiecore/oprocessdemo/oprocessdemo.pro12
-rw-r--r--examples/opiemm/opiemm.pro3
-rw-r--r--examples/opiemm/osoundsystemdemo/.cvsignore7
-rw-r--r--examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp66
-rw-r--r--examples/opiemm/osoundsystemdemo/osoundsystemdemo.pro12
-rw-r--r--examples/opieui/okeyconfigwidget/keyconfig.pro12
-rw-r--r--examples/opieui/okeyconfigwidget/testwidget.cpp128
-rw-r--r--examples/opieui/okeyconfigwidget/testwidget.h40
-rw-r--r--examples/opieui/olistviewdemo/main.cpp29
-rw-r--r--examples/opieui/olistviewdemo/olistviewdemo.cpp86
-rw-r--r--examples/opieui/olistviewdemo/olistviewdemo.h51
-rw-r--r--examples/opieui/olistviewdemo/olistviewdemo.pro23
-rw-r--r--examples/opieui/opieui.pro5
-rw-r--r--examples/opieui/osplitter_example/osplitter_example.cpp34
-rw-r--r--examples/opieui/osplitter_example/osplitter_example.h19
-rw-r--r--examples/opieui/osplitter_example/osplitter_example.pro13
-rw-r--r--examples/opieui/osplitter_example/osplitter_mail.cpp81
-rw-r--r--examples/opieui/osplitter_example/osplitter_mail.h51
-rw-r--r--examples/opieui/osplitter_example/osplitter_mail.pro12
-rw-r--r--examples/opieui/oversatileviewdemo/1.pngbin0 -> 1969 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/1small.pngbin0 -> 708 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/2.pngbin0 -> 2333 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/2small.pngbin0 -> 875 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/3.pngbin0 -> 2009 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/3small.pngbin0 -> 921 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/4.pngbin0 -> 2076 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/4small.pngbin0 -> 762 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/5.pngbin0 -> 2266 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/5small.pngbin0 -> 743 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/6.pngbin0 -> 2491 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/6small.pngbin0 -> 894 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_closed.pngbin0 -> 675 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_closed32.pngbin0 -> 2105 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_opened.pngbin0 -> 743 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/folder_opened32.pngbin0 -> 2112 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/leaf.pngbin0 -> 717 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/leaf32.pngbin0 -> 1904 bytes
-rw-r--r--examples/opieui/oversatileviewdemo/main.cpp32
-rw-r--r--examples/opieui/oversatileviewdemo/opieuidemo.cpp203
-rw-r--r--examples/opieui/oversatileviewdemo/opieuidemo.h60
-rw-r--r--examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp160
-rw-r--r--examples/opieui/oversatileviewdemo/oversatileviewdemo.h77
-rw-r--r--examples/opieui/oversatileviewdemo/oversatileviewdemo.pro17
-rw-r--r--examples/opieui/owidgetstack_example/owidgetstack_example.cpp133
-rw-r--r--examples/opieui/owidgetstack_example/owidgetstack_example.h27
-rw-r--r--examples/opieui/owidgetstack_example/owidgetstack_example.pro13
65 files changed, 1920 insertions, 0 deletions
diff --git a/examples/opiecore/oconfigdemo/.cvsignore b/examples/opiecore/oconfigdemo/.cvsignore
new file mode 100644
index 0000000..db3635b
--- a/dev/null
+++ b/examples/opiecore/oconfigdemo/.cvsignore
@@ -0,0 +1,8 @@
1oconfigdemo
2Makefile*
3obj
4moc*
5*moc
6*.o
7~*
8
diff --git a/examples/opiecore/oconfigdemo/oconfigdemo.cpp b/examples/opiecore/oconfigdemo/oconfigdemo.cpp
new file mode 100644
index 0000000..2ee4a65
--- a/dev/null
+++ b/examples/opiecore/oconfigdemo/oconfigdemo.cpp
@@ -0,0 +1,32 @@
1#include <opie2/oapplication.h>
2#include <opie2/oconfig.h>
3#include <qpe/config.h>
4
5using namespace Opie::Core;
6
7int main( int argc, char** argv )
8{
9 OApplication* app = new OApplication( argc, argv, "MyConfigDemoApplication" );
10
11 OConfigGroupSaver c1( app->config(), "MyGroup" );
12 app->config()->writeEntry( "AnEntry", "InMyGroup" );
13 {
14 OConfigGroupSaver c2( c1.config(), "AnotherGroup" );
15 app->config()->writeEntry( "AnEntry", "InAnotherGroup" );
16 } // closing the scope returns to the last group
17
18 app->config()->writeEntry( "AnotherEntry", "InMyGroup" );
19
20 // do more stuff ...
21
22 // in this (special) case it is necessary to manually call OConfig::write() (see below)
23 app->config()->write();
24
25 // can't delete the app when using the OConfigGroupSaver on top level scope,
26 // because the destructor of the OConfigGroupSaver needs an application object
27 //delete app; // destructor deletes config which writes changes back to disk
28
29 return 0;
30
31}
32
diff --git a/examples/opiecore/oconfigdemo/oconfigdemo.pro b/examples/opiecore/oconfigdemo/oconfigdemo.pro
new file mode 100644
index 0000000..b29c106
--- a/dev/null
+++ b/examples/opiecore/oconfigdemo/oconfigdemo.pro
@@ -0,0 +1,18 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = oconfigdemo.cpp
5
6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lopiecore2
9TARGET = oconfigdemo
10
11!contains( platform, x11 ) {
12 include( $(OPIEDIR)/include.pro )
13}
14
15contains( platform, x11 ) {
16 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
17}
18
diff --git a/examples/opiecore/odebugdemo/.cvsignore b/examples/opiecore/odebugdemo/.cvsignore
new file mode 100644
index 0000000..731667d
--- a/dev/null
+++ b/examples/opiecore/odebugdemo/.cvsignore
@@ -0,0 +1,8 @@
1odebugdemo
2Makefile*
3obj
4moc*
5*moc
6*.o
7~*
8
diff --git a/examples/opiecore/odebugdemo/odebugdemo.cpp b/examples/opiecore/odebugdemo/odebugdemo.cpp
new file mode 100644
index 0000000..b046d28
--- a/dev/null
+++ b/examples/opiecore/odebugdemo/odebugdemo.cpp
@@ -0,0 +1,142 @@
1/* QT */
2
3#include <qvbox.h>
4#include <qhbox.h>
5#include <qvbuttongroup.h>
6#include <qhbuttongroup.h>
7#include <qlineedit.h>
8#include <qradiobutton.h>
9#include <qpushbutton.h>
10
11/* OPIE */
12
13#include <qpe/config.h>
14
15#include <opie2/odebug.h>
16#include <opie2/oapplication.h>
17#include <opie2/oglobal.h>
18#include <opie2/oglobalsettings.h>
19
20using namespace Opie::Core;
21
22class DemoApp : public OApplication
23{
24Q_OBJECT
25public:
26 DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 debug demo" )
27 {
28 // you have access to your OApplication object via oApp
29 odebug << "Process-wide OApplication object @ " << oApp << "" << oendl;
30
31 // you have access to global settings via OGlobalSettings
32 int mode = OGlobalSettings::debugMode();
33
34 QVBox* vbox = new QVBox();
35 setMainWidget( vbox );
36
37 g = new QVButtonGroup( "Output Strategy", vbox );
38 QRadioButton* r0 = new QRadioButton( "file", g );
39 QRadioButton* r1 = new QRadioButton( "messagebox", g );
40 QRadioButton* r2 = new QRadioButton( "stderr", g );
41 QRadioButton* r3 = new QRadioButton( "syslog", g );
42 QRadioButton* r4 = new QRadioButton( "socket", g );
43 g->insert( r0, 0 );
44 g->insert( r1, 1 );
45 g->insert( r2, 2 );
46 g->insert( r3, 3 );
47 g->insert( r4, 4 );
48 g->setRadioButtonExclusive( true );
49 connect( g, SIGNAL( clicked(int) ), this, SLOT( chooseMethod(int) ) );
50
51 if ( mode != -1 ) g->setButton( mode );
52
53 QHButtonGroup* hbox = new QHButtonGroup( "Extra Output Information", vbox );
54 e = new QLineEdit( hbox );
55 QPushButton* pb = new QPushButton( hbox );
56
57 connect( e, SIGNAL( returnPressed() ), this, SLOT( updateDebugOutput() ) );
58 connect( pb, SIGNAL( clicked() ), this, SLOT( updateDebugOutput() ) );
59
60 // show the additional debug mode dependent output information
61 e->setText( OGlobalSettings::debugOutput() );
62
63 // buttos
64 QPushButton* info = new QPushButton( "Emit Debug(Info) Output!", vbox );
65 connect( info, SIGNAL( clicked() ), this, SLOT( emitInfoOutput() ) );
66 QPushButton* warn = new QPushButton( "Emit a Warning Output!", vbox );
67 connect( warn, SIGNAL( clicked() ), this, SLOT( emitWarningOutput() ) );
68 QPushButton* error = new QPushButton( "Emit an Error Output!", vbox );
69 connect( error, SIGNAL( clicked() ), this, SLOT( emitErrorOutput() ) );
70 QPushButton* fatal = new QPushButton( "Emit a Fatal Output!", vbox );
71 connect( fatal, SIGNAL( clicked() ), this, SLOT( emitFatalOutput() ) );
72
73 QPushButton* tb = new QPushButton( "Emit a Fatal Backtrace!", vbox );
74 connect( tb, SIGNAL( clicked() ), this, SLOT( emitTBOutput() ) );
75
76 info->show();
77 warn->show();
78 error->show();
79 fatal->show();
80 tb->show();
81 g->show();
82 hbox->show();
83 e->show();
84 vbox->show();
85 showMainWidget( vbox );
86 }
87
88public slots:
89 void chooseMethod(int method)
90 {
91 m = method;
92 odebug << "choosing method: " << method << "" << oendl;
93 OConfig* g = OGlobal::config();
94 g->setGroup( "General" );
95 g->writeEntry( "debugMode", m );
96 e->setText( OGlobalSettings::debugOutput() );
97 g->write();
98 }
99 void updateDebugOutput()
100 {
101 OConfig* g = OGlobal::config();
102 g->setGroup( "General" );
103 g->writeEntry( "debugOutput"+QString::number(OGlobalSettings::debugMode()), e->text() );
104 g->write();
105 }
106 void emitInfoOutput()
107 {
108 odebug << "This is a debug message" << oendl;
109 }
110 void emitWarningOutput()
111 {
112 owarn << "This is a warning message" << oendl;
113 }
114 void emitErrorOutput()
115 {
116 oerr << "This is an errror message" << oendl;
117 }
118 void emitFatalOutput()
119 {
120 ofatal << "This is a fatal message" << oendl;
121 }
122 void emitTBOutput()
123 {
124 ofatal << "This is a fatal message + backtrace\n" + odBacktrace(); // odBacktrace includes \n
125 }
126
127private:
128 QButtonGroup* g;
129 int m;
130 QLineEdit* e;
131};
132
133int main( int argc, char** argv )
134{
135 DemoApp* app = new DemoApp( argc, argv );
136 app->exec();
137
138 return 0;
139
140}
141
142#include "odebugdemo.moc"
diff --git a/examples/opiecore/odebugdemo/odebugdemo.pro b/examples/opiecore/odebugdemo/odebugdemo.pro
new file mode 100644
index 0000000..e06053c
--- a/dev/null
+++ b/examples/opiecore/odebugdemo/odebugdemo.pro
@@ -0,0 +1,17 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = odebugdemo.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2
8TARGET = odebugdemo
9
10!contains( platform, x11 ) {
11 include( $(OPIEDIR)/include.pro )
12}
13
14contains( platform, x11 ) {
15 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
16}
17
diff --git a/examples/opiecore/oglobalsettingsdemo/.cvsignore b/examples/opiecore/oglobalsettingsdemo/.cvsignore
new file mode 100644
index 0000000..d564c61
--- a/dev/null
+++ b/examples/opiecore/oglobalsettingsdemo/.cvsignore
@@ -0,0 +1,8 @@
1oglobalsettingsdemo
2Makefile*
3obj
4moc*
5*moc
6*.o
7~*
8
diff --git a/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp
new file mode 100644
index 0000000..37bcf13
--- a/dev/null
+++ b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.cpp
@@ -0,0 +1,15 @@
1#include <opie2/oglobalsettings.h>
2#include <stdio.h>
3
4using namespace Opie::Core;
5
6int main( int argc, char** argv )
7{
8 printf( "current debugmode seems to be '%d'\n", OGlobalSettings::debugMode() );
9 printf( "output information for this mode is '%s'\n", (const char*) OGlobalSettings::debugOutput() );
10
11 return 0;
12
13}
14
15//#include "moc/oconfigdemo.moc"
diff --git a/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro
new file mode 100644
index 0000000..d7bed05
--- a/dev/null
+++ b/examples/opiecore/oglobalsettingsdemo/oglobalsettingsdemo.pro
@@ -0,0 +1,14 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = oglobalsettingsdemo.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2
8TARGET = oglobalsettingsdemo
9MOC_DIR = moc
10OBJECTS_DIR = obj
11
12include( $(OPIEDIR)/include.pro )
13
14
diff --git a/examples/opiecore/okeyconfigmanager/README b/examples/opiecore/okeyconfigmanager/README
new file mode 100644
index 0000000..327b7c2
--- a/dev/null
+++ b/examples/opiecore/okeyconfigmanager/README
@@ -0,0 +1 @@
See opieui/okeyconfigwidget for an example of possible usage \ No newline at end of file
diff --git a/examples/opiecore/onotifydemo/.cvsignore b/examples/opiecore/onotifydemo/.cvsignore
new file mode 100644
index 0000000..8f7300c
--- a/dev/null
+++ b/examples/opiecore/onotifydemo/.cvsignore
@@ -0,0 +1,6 @@
1Makefile*
2moc*
3*moc
4*.o
5~*
6
diff --git a/examples/opiecore/onotifydemo/onotifydemo.cpp b/examples/opiecore/onotifydemo/onotifydemo.cpp
new file mode 100644
index 0000000..b9ff9db
--- a/dev/null
+++ b/examples/opiecore/onotifydemo/onotifydemo.cpp
@@ -0,0 +1,144 @@
1/* OPIE */
2#include <opie2/odebug.h>
3#include <opie2/oapplication.h>
4#include <opie2/ofiledialog.h>
5#include <opie2/olistview.h>
6#include <opie2/ofilenotify.h>
7using namespace Opie::Core;
8using namespace Opie::Ui;
9
10/* QT */
11#include <qcheckbox.h>
12#include <qvbox.h>
13#include <qhbox.h>
14#include <qhbuttongroup.h>
15#include <qvbuttongroup.h>
16#include <qmessagebox.h>
17#include <qpushbutton.h>
18
19class DemoApp : public OApplication
20{
21 Q_OBJECT
22public:
23 DemoApp( int argc, char** argv ) : OApplication( argc, argv, "libopie2 notify demo" )
24 {
25
26 QVBox* vbox = new QVBox();
27 setMainWidget( vbox );
28
29 l = new OListView( vbox );
30 l->addColumn( "Notification Path" );
31 l->addColumn( "Trigger Type" );
32 l->addColumn( "Trigger Mask" );
33 l->setColumnAlignment( 1, AlignCenter );
34 l->setColumnAlignment( 2, AlignCenter );
35
36 QHBox* hbox = new QHBox( vbox );
37
38 g2 = new QVButtonGroup( "Specify Trigger Type", hbox );
39 //QCheckBox* c1 = new QCheckBox( "Multi", g2 );
40 QCheckBox* c2 = new QCheckBox( "Access", g2 );
41 QCheckBox* c3 = new QCheckBox( "Modify", g2 );
42 QCheckBox* c4 = new QCheckBox( "Create", g2 );
43 QCheckBox* c5 = new QCheckBox( "Delete", g2 );
44 QCheckBox* c6 = new QCheckBox( "Rename", g2 );
45 QCheckBox* c7 = new QCheckBox( "Attrib", g2 );
46 g2->insert( c2, Access );
47 g2->insert( c3, Modify );
48 g2->insert( c4, Create );
49 g2->insert( c5, Delete );
50 g2->insert( c6, Rename );
51 g2->insert( c7, Attrib );
52 connect( g2, SIGNAL( pressed(int) ), this, SLOT( modifierClicked(int) ) );
53
54 g1 = new QVButtonGroup( "Add/Remove", hbox );
55 QPushButton* plus1 = new QPushButton( "Add\n&Single", g1 );
56 QPushButton* plus2 = new QPushButton( "Add\n&Multi", g1 );
57 QPushButton* minus = new QPushButton( "&Remove\nIt!", g1 );
58 g1->insert( plus1, 0 );
59 g1->insert( plus2, 1 );
60 g1->insert( minus, 2 );
61 connect( plus1, SIGNAL( clicked() ), this, SLOT( addSingle() ) );
62 connect( plus2, SIGNAL( clicked() ), this, SLOT( addMulti() ) );
63 connect( minus, SIGNAL( clicked() ), this, SLOT( delTrigger() ) );
64
65 g1->show();
66 g2->show();
67 l->show();
68 hbox->show();
69 vbox->show();
70 showMainWidget( vbox );
71 }
72
73public:
74 void addTrigger( bool multi = false )
75 {
76 if ( !m )
77 {
78 QMessageBox::warning( 0, "Add Trigger", "<p>Can't add trigger without at least one selected trigger type</p>", "&Sorry", 0 );
79 return;
80 }
81
82 QString filename = OFileDialog::getOpenFileName( OFileSelector::ExtendedAll );
83 if ( !filename.isEmpty() )
84 {
85 odebug << "Filename = " << filename << oendl;
86
87 int fntype = m;
88 if ( multi ) fntype |=(int) Multi;
89
90 QString modifier = QString().sprintf( " = 0x%08x", fntype );
91 new OListViewItem( l, filename, multi ? "MULTI" : "SINGLE", modifier );
92 if ( !multi )
93 OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype );
94 else
95 OFileNotification::singleShot( filename, this, SLOT( trigger() ), (OFileNotificationType) fntype );
96 }
97 else
98 {
99 odebug << "cancelled." << oendl;
100 }
101 }
102
103public slots:
104 void modifierClicked( int modifier ) { m = static_cast<OFileNotificationType>( (int)m ^ int(modifier) ); };
105 void addSingle() { addTrigger(); };
106 void addMulti() { addTrigger( true ); };
107
108 void delTrigger()
109 {
110 QListViewItem* item = l->selectedItem();
111 if ( !item )
112 {
113 QMessageBox::warning( 0, "Del Trigger", "<p>No trigger selected!</p>", "&Sorry", 0 );
114 return;
115 }
116 else
117 {
118 QString filename( item->text( 0 ) );
119 odebug << "Filename = " << filename << oendl;
120 }
121 }
122
123 void trigger()
124 {
125 owarn << "FIRE!" << oendl;
126 }
127
128private:
129 OListView* l;
130 QButtonGroup* g1;
131 QButtonGroup* g2;
132 OFileNotificationType m;
133};
134
135int main( int argc, char** argv )
136{
137 DemoApp* app = new DemoApp( argc, argv );
138 app->exec();
139
140 return 0;
141
142}
143
144#include "moc/onotifydemo.moc"
diff --git a/examples/opiecore/onotifydemo/onotifydemo.pro b/examples/opiecore/onotifydemo/onotifydemo.pro
new file mode 100644
index 0000000..d2c9138
--- a/dev/null
+++ b/examples/opiecore/onotifydemo/onotifydemo.pro
@@ -0,0 +1,18 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = onotifydemo.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2 -lopieui2
8TARGET = onotifydemo
9
10!contains( platform, x11 ) {
11 include( $(OPIEDIR)/include.pro )
12}
13
14contains( platform, x11 ) {
15 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
16}
17
18MOC_DIR = moc
diff --git a/examples/opiecore/opiecore.pro b/examples/opiecore/opiecore.pro
new file mode 100644
index 0000000..39ffd3b
--- a/dev/null
+++ b/examples/opiecore/opiecore.pro
@@ -0,0 +1,2 @@
1TEMPLATE = subdirs
2unix:SUBDIRS = odebugdemo oconfigdemo oglobalsettingsdemo onotifydemo oprocessdemo oplugins
diff --git a/examples/opiecore/oplugins/.cvsignore b/examples/opiecore/oplugins/.cvsignore
new file mode 100644
index 0000000..514e011
--- a/dev/null
+++ b/examples/opiecore/oplugins/.cvsignore
@@ -0,0 +1,3 @@
1oplugins
2Makefile
3.moc
diff --git a/examples/opiecore/oplugins/oplugins.cpp b/examples/opiecore/oplugins/oplugins.cpp
new file mode 100644
index 0000000..26623be
--- a/dev/null
+++ b/examples/opiecore/oplugins/oplugins.cpp
@@ -0,0 +1,47 @@
1/*
2 * You may copy, modify and or distribute without any limitation
3 */
4#include <opie2/odebug.h>
5#include <opie2/opluginloader.h>
6
7#include <opie2/todayplugininterface.h>
8
9using Opie::Core::OPluginItem;
10using Opie::Core::OGenericPluginLoader;
11using Opie::Core::OPluginLoader;
12
13void debugLst( const OPluginItem::List& lst ) {
14 for ( OPluginItem::List::ConstIterator it = lst.begin(); it != lst.end(); ++it )
15 odebug << "Name " << (*it).name() << " " << (*it).path() << " " << (*it).position() << oendl;
16}
17
18
19int main( void ) {
20 OGenericPluginLoader loader( "today", true );
21 loader.setAutoDelete( true );
22
23 odebug << "IS in Safe Mode" << loader.isInSafeMode() << oendl;
24
25 OPluginItem::List lst = loader.allAvailable( true );
26 debugLst( lst );
27
28 lst = loader.filtered( true );
29 debugLst( lst );
30
31 for ( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ) {
32 QUnknownInterface* iface = loader.load( *it, IID_TodayPluginInterface );
33 }
34
35 OPluginLoader loader2("today",true);
36 OPluginItem::List lst2 = loader2.allAvailable( true );
37 debugLst( lst2 );
38
39 for( OPluginItem::List::Iterator it = lst.begin(); it != lst.end(); ++it ){
40 TodayPluginInterface* iface = loader2.load<TodayPluginInterface>( *it, IID_TodayPluginInterface );
41 }
42
43
44 /*
45 * now it's autodelete so cleaned up for us
46 */
47}
diff --git a/examples/opiecore/oplugins/oplugins.pro b/examples/opiecore/oplugins/oplugins.pro
new file mode 100644
index 0000000..03f8e4d
--- a/dev/null
+++ b/examples/opiecore/oplugins/oplugins.pro
@@ -0,0 +1,11 @@
1TEMPLATE = app
2CONFIG += qt warn_on
3
4SOURCES = oplugins.cpp
5
6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDSPATH += $(OPIEDIR)/include
8
9LIBS += -lopiecore2
10
11include( $(OPIEDIR)/include.pro )
diff --git a/examples/opiecore/oprocessdemo/.cvsignore b/examples/opiecore/oprocessdemo/.cvsignore
new file mode 100644
index 0000000..ab9cb4d
--- a/dev/null
+++ b/examples/opiecore/oprocessdemo/.cvsignore
@@ -0,0 +1,7 @@
1oprocessdemo
2Makefile*
3moc*
4*moc
5*.o
6~*
7
diff --git a/examples/opiecore/oprocessdemo/oprocessdemo.cpp b/examples/opiecore/oprocessdemo/oprocessdemo.cpp
new file mode 100644
index 0000000..c5fc328
--- a/dev/null
+++ b/examples/opiecore/oprocessdemo/oprocessdemo.cpp
@@ -0,0 +1,13 @@
1#include <opie2/oprocess.h>
2#include <stdio.h>
3
4using namespace Opie::Core;
5
6int main( int argc, char** argv )
7{
8 printf( "my own PID seems to be '%d'\n", OProcess::processPID( "oprocessdemo" ) );
9 printf( "the PID of process 'Mickey' seems to be '%d'\n\n", OProcess::processPID( "Mickey" ) );
10
11 return 0;
12}
13
diff --git a/examples/opiecore/oprocessdemo/oprocessdemo.pro b/examples/opiecore/oprocessdemo/oprocessdemo.pro
new file mode 100644
index 0000000..7efc614
--- a/dev/null
+++ b/examples/opiecore/oprocessdemo/oprocessdemo.pro
@@ -0,0 +1,12 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = oprocessdemo.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2
8TARGET = oprocessdemo
9
10include( $(OPIEDIR)/include.pro )
11
12
diff --git a/examples/opiemm/opiemm.pro b/examples/opiemm/opiemm.pro
new file mode 100644
index 0000000..0522ebe
--- a/dev/null
+++ b/examples/opiemm/opiemm.pro
@@ -0,0 +1,3 @@
1TEMPLATE = subdirs
2SUBDIRS = osoundsystemdemo
3
diff --git a/examples/opiemm/osoundsystemdemo/.cvsignore b/examples/opiemm/osoundsystemdemo/.cvsignore
new file mode 100644
index 0000000..0c98558
--- a/dev/null
+++ b/examples/opiemm/osoundsystemdemo/.cvsignore
@@ -0,0 +1,7 @@
1osoundsystemdemo
2Makefile*
3moc*
4*moc
5*.o
6~*
7
diff --git a/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp b/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp
new file mode 100644
index 0000000..f74a1b9
--- a/dev/null
+++ b/examples/opiemm/osoundsystemdemo/osoundsystemdemo.cpp
@@ -0,0 +1,66 @@
1/*
2 =. This file is part of the Opie Project
3 .=l. Copyright (C) 2004 Opie Team <opie-devel@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 */
30#include <opie2/osoundsystem.h>
31#include <opie2/odebug.h>
32
33using namespace Opie::MM;
34
35int main( int argc, char** argv )
36{
37 odebug << "OPIE Sound System Demo" << oendl;
38
39 OSoundSystem* sound = OSoundSystem::instance();
40
41 OSoundSystem::CardIterator it = sound->iterator();
42/*
43 while ( it.current() )
44 {
45 odebug << "DEMO: OSoundSystem contains Interface '" << it.current()->name() << "'" << oendl;
46 ++it;
47 }
48
49*/
50 OSoundCard* card = it.current();
51
52 OMixerInterface* mixer = card->mixer();
53
54 QStringList channels = mixer->allChannels();
55
56 for ( QStringList::Iterator it = channels.begin(); it != channels.end(); ++it )
57 {
58 bool stereo = mixer->isStereo( *it );
59 odebug << "OSSDEMO: Mixer has channel " << *it << ( stereo ? "[stereo]" : "[mono]" ) << oendl;
60 odebug << "OSSDEMO: +--- volume " << ( mixer->volume( *it ) & 0xff )
61 << " (left) | " << ( mixer->volume( *it ) >> 8 ) << " (right)" << oendl;
62 }
63
64 return 0;
65
66}
diff --git a/examples/opiemm/osoundsystemdemo/osoundsystemdemo.pro b/examples/opiemm/osoundsystemdemo/osoundsystemdemo.pro
new file mode 100644
index 0000000..95924be
--- a/dev/null
+++ b/examples/opiemm/osoundsystemdemo/osoundsystemdemo.pro
@@ -0,0 +1,12 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS =
4SOURCES = osoundsystemdemo.cpp
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include
7LIBS += -lopiecore2 -lopiemm2
8TARGET = osoundsystemdemo
9MOC_DIR = moc
10OBJECTS_DIR = obj
11
12include( $(OPIEDIR)/include.pro )
diff --git a/examples/opieui/okeyconfigwidget/keyconfig.pro b/examples/opieui/okeyconfigwidget/keyconfig.pro
new file mode 100644
index 0000000..5f379ef
--- a/dev/null
+++ b/examples/opieui/okeyconfigwidget/keyconfig.pro
@@ -0,0 +1,12 @@
1CONFIG += qt
2
3TEMPLATE = app
4SOURCES = testwidget.cpp
5HEADERS = testwidget.h
6
7INCLUDEPATH += $(OPIEDIR)/include $(OPIEDIR)/noncore/graphics/opie-eye/lib/
8DESTPATH += $(OPIEDIR)/include
9
10LIBS += -lopieui2 -lopiecore2
11
12include( $(OPIEDIR)/include.pro )
diff --git a/examples/opieui/okeyconfigwidget/testwidget.cpp b/examples/opieui/okeyconfigwidget/testwidget.cpp
new file mode 100644
index 0000000..6d2c773
--- a/dev/null
+++ b/examples/opieui/okeyconfigwidget/testwidget.cpp
@@ -0,0 +1,128 @@
1#include "testwidget.h"
2
3#include <opie2/okeyconfigwidget.h>
4
5#include <opie2/oapplicationfactory.h>
6#include <opie2/otabwidget.h>
7
8#include <qpe/qpeapplication.h>
9
10#include <qevent.h>
11#include <qlayout.h>
12#include <qpushbutton.h>
13#include <qmainwindow.h>
14#include <qdialog.h>
15
16
17/**
18 * QObject with signals and slots inside a .cpp
19 * requires the .moc at the bottom! and a run of qmake
20 */
21class MainWindow : public QMainWindow {
22 Q_OBJECT
23public:
24 static QString appName() {
25 return QString::fromLatin1("keyconfig");
26 }
27 MainWindow( QWidget*, const char*, WFlags fl );
28 ~MainWindow() {}
29private slots:
30 void slotClicked();
31private:
32 Opie::Core::OKeyConfigManager *m_manager;
33};
34
35
36OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<MainWindow> )
37
38
39MainWindow::MainWindow( QWidget* parent, const char* name, WFlags fl )
40 : QMainWindow( parent, name, fl )
41{
42 QVBoxLayout *lay = new QVBoxLayout( this );
43 QPushButton *btn = new QPushButton( tr("Configure" ), this );
44 TestMainWindow *wid = new TestMainWindow( this, "name", 0 );
45
46 lay->addWidget( btn );
47 lay->addWidget( wid );
48 m_manager = wid->manager();
49
50 connect( btn, SIGNAL(clicked()), this, SLOT(slotClicked()) );
51}
52
53void MainWindow::slotClicked() {
54 QDialog diag( this, "name", true );
55 diag.setCaption( tr( "Manage Keys" ) );
56
57 QHBoxLayout *lay = new QHBoxLayout( &diag );
58 Opie::Ui::OKeyConfigWidget *wid = new Opie::Ui::OKeyConfigWidget( &diag, "key config" );
59 wid->setChangeMode( Opie::Ui::OKeyConfigWidget::Queue );
60 wid->insert( tr("MainWindow Options" ), m_manager );
61 wid->load();
62
63 lay->addWidget( wid );
64
65 if ( QPEApplication::execDialog( &diag ) == QDialog::Accepted ) {
66 wid->save();
67 }
68}
69
70TestMainWindow::TestMainWindow( QWidget* parent, const char* slot, WFlags fl )
71 : Opie::Ui::OListView( parent, slot, fl)
72{
73 addColumn( tr( "A Doo" ) );
74 addColumn( tr( "B Doo" ) );
75
76 m_config = new Opie::Core::OConfig( "test_config_foo" );
77
78 /* generate the black list */
79 Opie::Core::OKeyPair::List blackList;
80 blackList.append( Opie::Core::OKeyPair::leftArrowKey() );
81 blackList.append( Opie::Core::OKeyPair::rightArrowKey() );
82 blackList.append( Opie::Core::OKeyPair::downArrowKey() );
83 blackList.append( Opie::Core::OKeyPair::upArrowKey() );
84
85 m_manager = new Opie::Core::OKeyConfigManager( m_config, "Key Group",
86 blackList, false, this, "Key Manager" );
87
88 m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Delete Action" ), "delete_key", QPixmap(),
89 10, Opie::Core::OKeyPair( Qt::Key_D, Qt::ShiftButton ), this,
90 SLOT(slotDelete(QWidget*,QKeyEvent*)) ) );
91 m_manager->addKeyConfig( Opie::Core::OKeyConfigItem( tr( "Show Action" ), "show_key", QPixmap(),
92 11, Opie::Core::OKeyPair( Qt::Key_S, Qt::AltButton ) ) );
93
94 connect(m_manager, SIGNAL(actionActivated(QWidget*,QKeyEvent*,const Opie::Core::OKeyConfigItem&)),
95 this, SLOT(slotAction(QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem&)) );
96// when commenting the line below out the keyPressEvent will work
97 m_manager->handleWidget( this );
98 m_manager->load();
99}
100
101TestMainWindow::~TestMainWindow() {
102 m_manager->save();
103 delete m_config;
104}
105
106Opie::Core::OKeyConfigManager* TestMainWindow::manager() {
107 return m_manager;
108}
109
110/*
111 * This only works if we do not handle the even with m_manager->handleWidget( this )
112 * So this is only for demo purposes
113 */
114void TestMainWindow::keyPressEvent( QKeyEvent* ev ) {
115 owarn << "String is "+ m_manager->handleKeyEvent( ev ).text() << oendl;
116 owarn << "Id was " << m_manager->handleKeyEventId( ev ) << " " << ev->key() << " " << ev->state() << " " << ev->ascii() << "" << oendl;
117 ev->ignore();
118}
119
120void TestMainWindow::slotDelete( QWidget* wid, QKeyEvent* ev ) {
121 owarn << "Slot Delete " << wid << " " << ev->key() << " " << ev->state() << "" << oendl;
122}
123
124void TestMainWindow::slotAction( QWidget* wid, QKeyEvent* ev, const Opie::Core::OKeyConfigItem& item) {
125 owarn << "Slot Action " << wid << " " << ev->key() << " " << ev->state() << " " << item.text() << " " << item.id() << "" << oendl;
126}
127
128#include "testwidget.moc"
diff --git a/examples/opieui/okeyconfigwidget/testwidget.h b/examples/opieui/okeyconfigwidget/testwidget.h
new file mode 100644
index 0000000..6ecb346
--- a/dev/null
+++ b/examples/opieui/okeyconfigwidget/testwidget.h
@@ -0,0 +1,40 @@
1#ifndef TEST_WIDGET_H
2#define TEST_WIDGET_H
3
4#include <qmainwindow.h>
5
6#include <opie2/olistview.h>
7
8namespace Opie{
9namespace Ui{
10 class OTabWidget;
11 class OListView;
12}
13namespace Core {
14 class OConfig;
15 class OKeyConfigManager;
16 class OKeyConfigItem;
17}
18}
19class QKeyEvent;
20
21
22class TestMainWindow : public Opie::Ui::OListView {
23 Q_OBJECT
24public:
25
26 TestMainWindow(QWidget* parent, const char*, WFlags fl );
27 ~TestMainWindow();
28
29 Opie::Core::OKeyConfigManager *manager();
30protected:
31 void keyPressEvent( QKeyEvent* );
32private slots:
33 void slotDelete( QWidget*, QKeyEvent* );
34 void slotAction( QWidget*, QKeyEvent*, const Opie::Core::OKeyConfigItem& );
35private:
36 Opie::Core::OConfig *m_config;
37 Opie::Core::OKeyConfigManager *m_manager;
38};
39
40#endif
diff --git a/examples/opieui/olistviewdemo/main.cpp b/examples/opieui/olistviewdemo/main.cpp
new file mode 100644
index 0000000..cd49c28
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/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 "olistviewdemo.h"
17#include <opie2/oapplication.h>
18
19using namespace Opie::Ui;
20using namespace Opie::Core;
21
22int main( int argc, char **argv )
23{
24 OApplication a( argc, argv, "OListViewDemo" );
25 OListViewDemo e;
26 a.showMainWidget(&e);
27 return a.exec();
28}
29
diff --git a/examples/opieui/olistviewdemo/olistviewdemo.cpp b/examples/opieui/olistviewdemo/olistviewdemo.cpp
new file mode 100644
index 0000000..4c05620
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/olistviewdemo.cpp
@@ -0,0 +1,86 @@
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 "olistviewdemo.h"
34
35/* OPIE */
36#include <opie2/olistview.h>
37#include <opie2/odebug.h>
38
39/* QT */
40#include <qstring.h>
41#include <qpixmap.h>
42#include <qlistview.h>
43
44using namespace Opie::Ui;
45
46OListViewDemo::OListViewDemo( QWidget* parent, const char* name, WFlags f )
47 :QVBox( parent, name, f )
48{
49 lv = new ONamedListView( this );
50 lv->setRootIsDecorated( true );
51 lv->addColumns( QStringList::split( ' ', "Column1 Column2 Column3 Column4" ) );
52
53 ONamedListViewItem* item = new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
54 item->setText( "Column2", "ModifiedText" );
55 item->setText( "Column5", "ThisColumnDoesNotExits" );
56
57 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
58 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
59 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Minni" ) );
60 item = new ONamedListViewItem( lv, QStringList::split( ' ', "XXX YYY ZZZ ***" ) );
61 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
62 new ONamedListViewItem( lv, QStringList::split( ' ', "Text1 Text2 Text3 Text4" ) );
63
64 new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) );
65 new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) );
66 new ONamedListViewItem( item, QStringList::split( ' ', "SubText1 Text2 Text3 Text4" ) );
67 item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComes" ) );
68 item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 HereItComesSoon" ) );
69 item = new ONamedListViewItem( item, QStringList::split( ' ', "Text1 Text2 Text3 Mickey" ) );
70
71 if ( lv->find( 3, "Mickey", 3 ) )
72 odebug << "found Mickey :-)" << oendl;
73 else
74 odebug << "did not found Mickey :-(" << oendl;
75
76 if ( lv->find( 3, "Minni", 0 ) )
77 odebug << "found Minni :-)" << oendl;
78 else
79 odebug << "did not found Minni :-(" << oendl;
80
81}
82
83OListViewDemo::~OListViewDemo()
84{
85}
86
diff --git a/examples/opieui/olistviewdemo/olistviewdemo.h b/examples/opieui/olistviewdemo/olistviewdemo.h
new file mode 100644
index 0000000..0b5c498
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/olistviewdemo.h
@@ -0,0 +1,51 @@
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 OLISTVIEWDEMO_H
33#define OLISTVIEWDEMO_H
34
35#include <qvbox.h>
36#include <opie2/olistview.h>
37
38class OListViewDemo: public QVBox
39{
40 Q_OBJECT
41
42 public:
43 OListViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 );
44 virtual ~OListViewDemo();
45
46 private:
47 Opie::Ui::ONamedListView* lv;
48
49};
50
51#endif
diff --git a/examples/opieui/olistviewdemo/olistviewdemo.pro b/examples/opieui/olistviewdemo/olistviewdemo.pro
new file mode 100644
index 0000000..52c3ceb
--- a/dev/null
+++ b/examples/opieui/olistviewdemo/olistviewdemo.pro
@@ -0,0 +1,23 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS = olistviewdemo.h
4SOURCES = olistviewdemo.cpp \
5 main.cpp
6INCLUDEPATH += $(OPIEDIR)/include
7DEPENDPATH += $(OPIEDIR)/include
8LIBS += -lopieui2 -lopiecore2 -lqpe
9TARGET = olistviewdemo
10MOC_DIR = moc
11OBJECTS_DIR = obj
12
13
14
15
16!contains( platform, x11 ) {
17 include( $(OPIEDIR)/include.pro )
18}
19
20contains( platform, x11 ) {
21 LIBS += -L$(OPIEDIR)/lib -Wl,-rpath,$(OPIEDIR)/lib
22}
23
diff --git a/examples/opieui/opieui.pro b/examples/opieui/opieui.pro
new file mode 100644
index 0000000..853ac50
--- a/dev/null
+++ b/examples/opieui/opieui.pro
@@ -0,0 +1,5 @@
1TEMPLATE = subdirs
2SUBDIRS = olistviewdemo owidgetstack_example osplitter_example
3
4
5
diff --git a/examples/opieui/osplitter_example/osplitter_example.cpp b/examples/opieui/osplitter_example/osplitter_example.cpp
new file mode 100644
index 0000000..07c7e51
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_example.cpp
@@ -0,0 +1,34 @@
1#include "osplitter_example.h"
2
3/* OPIE */
4
5#include <opie2/osplitter.h>
6#include <opie2/ofileselector.h>
7#include <qpe/qpeapplication.h>
8#include <opie2/oapplicationfactory.h>
9
10/* QT*/
11#include <qdir.h>
12#include <qlayout.h>
13
14using namespace Opie::Ui;
15using namespace Opie::Core;
16
17OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> )
18
19OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f )
20 : QWidget( w, n, f ){
21 QVBoxLayout * lay = new QVBoxLayout(this);
22 OSplitter * splitter = new OSplitter( Horizontal, this );
23 lay->addWidget( splitter );
24
25 OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector,
26 OFileSelector::Normal, QDir::homeDirPath(),
27 QString::null );
28 splitter->addWidget( selector, "zoom", tr("Selector 1") );
29
30 selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal,
31 QDir::homeDirPath(), QString::null );
32 splitter->addWidget( selector, "zoom", tr("Selector 2") );
33
34}
diff --git a/examples/opieui/osplitter_example/osplitter_example.h b/examples/opieui/osplitter_example/osplitter_example.h
new file mode 100644
index 0000000..0cf28aa
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_example.h
@@ -0,0 +1,19 @@
1/*
2 * May be used, copied and modified wihtout any limitation
3 */
4
5#ifndef OSPlitter_EXAMPLE_H
6#define OSPlitter_EXAMPLE_H
7
8#include <qvbox.h>
9
10class OSplitterExample : public QWidget {
11 Q_OBJECT
12public:
13 static QString appName() { return QString::fromLatin1("osplitter_example"); }
14 OSplitterExample( QWidget *parent, const char* name, WFlags fl );
15
16};
17
18
19#endif
diff --git a/examples/opieui/osplitter_example/osplitter_example.pro b/examples/opieui/osplitter_example/osplitter_example.pro
new file mode 100644
index 0000000..9f156a1
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_example.pro
@@ -0,0 +1,13 @@
1CONFIG = qt warn_on
2TEMPLATE = app
3TARGET = osplitter_example
4
5HEADERS = osplitter_example.h
6SOURCES = osplitter_example.cpp
7
8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDSPATH += $(OPIEDIR)/include
10
11LIBS += -lqpe -lopieui2
12
13include( $(OPIEDIR)/include.pro )
diff --git a/examples/opieui/osplitter_example/osplitter_mail.cpp b/examples/opieui/osplitter_example/osplitter_mail.cpp
new file mode 100644
index 0000000..d747bd9
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_mail.cpp
@@ -0,0 +1,81 @@
1
2#include <qstring.h>
3#include <qlabel.h>
4#include <qheader.h>
5#include <qlayout.h>
6
7#include <qpe/qpeapplication.h>
8
9#include <opie2/oapplicationfactory.h>
10#include "osplitter_mail.h"
11
12using namespace Opie::Ui;
13
14OPIE_EXPORT_APP( OApplicationFactory<ListViews> )
15
16class Folder {
17 int dummy;
18};
19
20// -----------------------------------------------------------------
21
22ListViews::ListViews( QWidget* p, const char* name, WFlags fl )
23 : QWidget( p, name, fl ) {
24 qApp->installEventFilter( this );
25 m_lstFolders.setAutoDelete( true );
26 QHBoxLayout *lay = new QHBoxLayout(this);
27
28 m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" );
29 lay->addWidget( m_splitter );
30 connect(m_splitter, SIGNAL(sizeChanged(bool,Orientation) ),
31 this, SLOT(slotSizeChange(bool,Orientation) ) );
32
33 m_overview = new QListView( m_splitter );
34 m_overview->header()->setClickEnabled( FALSE );
35 m_overview->addColumn( tr("Folder") );
36// m_overview->setMaximumWidth( 200 );
37 m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") );
38 m_splitter->setSizeChange( 300 );
39
40 /* OSplitter starts with the small mode */
41 m_messages = 0;
42 m_message = m_attach = 0;
43
44 splitti = new OSplitter( Vertical, m_splitter, "Splitti2" );
45 splitti->setSizeChange( 300 );
46 splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) );
47
48 QLabel *lbl = new QLabel(splitti);
49 lbl->setTextFormat ( Qt::RichText );
50 lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>");
51
52 m_messages = new QListView( splitti );
53 m_messages->addColumn(" Messages ");
54
55 folder1 = new QListView( splitti );
56 folder1->addColumn( "Messages 2 " );
57
58 splitti->addWidget(m_messages, "mail", tr("Mails") );
59 splitti->addWidget(folder1, "folder", tr("Folder") );
60 splitti->addWidget( lbl, "logo", tr("Label") );
61 m_message = lbl;
62
63 m_splitter->addWidget( splitti );
64
65}
66
67
68ListViews::~ListViews() {
69
70}
71
72
73bool ListViews::eventFilter( QObject* obj, QEvent* ev ) {
74 if (!obj->isWidgetType() )
75 return false;
76 if ( ev->type() == QEvent::MouseButtonRelease ) {
77 owarn << " name " << obj->name() << ", class " << obj->className() << "" << oendl;
78 }
79
80 return false;
81}
diff --git a/examples/opieui/osplitter_example/osplitter_mail.h b/examples/opieui/osplitter_example/osplitter_mail.h
new file mode 100644
index 0000000..67961fb
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_mail.h
@@ -0,0 +1,51 @@
1/*
2 * You may use, modify and distribute this code without any limitation
3 */
4
5/*
6 * Header file for a more complete email client like
7 * layout
8 */
9
10#ifndef OPIE_SPLITTER_MAIL_EXAMPLE_H
11#define OPIE_SPLITTER_MAIL_EXAMPLE_H
12
13#include <qwidget.h>
14#include <qlist.h>
15#include <qlistview.h>
16
17#include <opie2/osplitter.h>
18
19
20class Folder;
21class QLabel;
22
23class ListViews : public QWidget {
24 Q_OBJECT
25public:
26 static QString appName() { return QString::fromLatin1("osplitter-mail"); }
27 ListViews( QWidget* parent, const char * name, WFlags fl );
28 ~ListViews();
29
30 bool eventFilter( QObject* , QEvent* );
31private:
32 void initFolders();
33 void initFolder( Folder *folder, unsigned int &count );
34
35 QListView *m_messages, *m_overview;
36 QLabel *m_message, *m_attach;
37 QList<QListView> m_folders; // used in tab mode
38 QList<Folder> m_lstFolders;
39 bool m_mode : 1; // bitfield
40 Opie::Ui::OSplitter *m_splitter;
41 Opie::Ui::OSplitter *splitti;
42 QListView *folder1;
43#if 0
44//private slots:
45// void slotFolderChanged( QListViewItem* );
46// void slotMessageChanged();
47// void slotSizeChange( bool, const QSize& );
48#endif
49};
50
51#endif
diff --git a/examples/opieui/osplitter_example/osplitter_mail.pro b/examples/opieui/osplitter_example/osplitter_mail.pro
new file mode 100644
index 0000000..f9c43ef
--- a/dev/null
+++ b/examples/opieui/osplitter_example/osplitter_mail.pro
@@ -0,0 +1,12 @@
1CONFIG += qt warn_on
2TEMPLATE = app
3TARGET = osplitter-mail
4
5INCLUDEPATH += $(OPIEDIR)/include
6DEPENDSPATH += $(OPIEDIR)/include
7
8HEADERS = osplitter_mail.h
9SOURCES = osplitter_mail.cpp
10
11LIBS += -lqpe -lopieui2
12include( $(OPIEDIR)/include.pro )
diff --git a/examples/opieui/oversatileviewdemo/1.png b/examples/opieui/oversatileviewdemo/1.png
new file mode 100644
index 0000000..0e2e41b
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/1.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/1small.png b/examples/opieui/oversatileviewdemo/1small.png
new file mode 100644
index 0000000..ce6b262
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/1small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/2.png b/examples/opieui/oversatileviewdemo/2.png
new file mode 100644
index 0000000..8a0181d
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/2.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/2small.png b/examples/opieui/oversatileviewdemo/2small.png
new file mode 100644
index 0000000..82a4431
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/2small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/3.png b/examples/opieui/oversatileviewdemo/3.png
new file mode 100644
index 0000000..8a58d6c
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/3.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/3small.png b/examples/opieui/oversatileviewdemo/3small.png
new file mode 100644
index 0000000..073ba55
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/3small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/4.png b/examples/opieui/oversatileviewdemo/4.png
new file mode 100644
index 0000000..198891b
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/4.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/4small.png b/examples/opieui/oversatileviewdemo/4small.png
new file mode 100644
index 0000000..7f1cc01
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/4small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/5.png b/examples/opieui/oversatileviewdemo/5.png
new file mode 100644
index 0000000..ee7344a
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/5.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/5small.png b/examples/opieui/oversatileviewdemo/5small.png
new file mode 100644
index 0000000..105b038
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/5small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/6.png b/examples/opieui/oversatileviewdemo/6.png
new file mode 100644
index 0000000..72c3692
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/6.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/6small.png b/examples/opieui/oversatileviewdemo/6small.png
new file mode 100644
index 0000000..1db2a30
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/6small.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_closed.png b/examples/opieui/oversatileviewdemo/folder_closed.png
new file mode 100644
index 0000000..4157333
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_closed.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_closed32.png b/examples/opieui/oversatileviewdemo/folder_closed32.png
new file mode 100644
index 0000000..acc992c
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_closed32.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_opened.png b/examples/opieui/oversatileviewdemo/folder_opened.png
new file mode 100644
index 0000000..5e7e37e
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_opened.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/folder_opened32.png b/examples/opieui/oversatileviewdemo/folder_opened32.png
new file mode 100644
index 0000000..acd3265
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/folder_opened32.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/leaf.png b/examples/opieui/oversatileviewdemo/leaf.png
new file mode 100644
index 0000000..c8435ec
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/leaf.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/leaf32.png b/examples/opieui/oversatileviewdemo/leaf32.png
new file mode 100644
index 0000000..5e90ead
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/leaf32.png
Binary files differ
diff --git a/examples/opieui/oversatileviewdemo/main.cpp b/examples/opieui/oversatileviewdemo/main.cpp
new file mode 100644
index 0000000..e48395a
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/main.cpp
@@ -0,0 +1,32 @@
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
20using namespace Opie::Core;
21using namespace Opie::Ui;
22
23int main( int argc, char **argv )
24{
25 OApplication a( argc, argv, "Opie UI Demo" );
26 odebug << "." << oendl;
27 OpieUIDemo e;
28 odebug << "." << oendl;
29 a.showMainWidget(&e);
30 odebug << "." << oendl;
31 return a.exec();
32}
diff --git a/examples/opieui/oversatileviewdemo/opieuidemo.cpp b/examples/opieui/oversatileviewdemo/opieuidemo.cpp
new file mode 100644
index 0000000..a2cdd5a
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/opieuidemo.cpp
@@ -0,0 +1,203 @@
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#include <qpe/qpeapplication.h>
29#include <qpe/global.h>
30
31// Opie
32
33#include <opie2/odevice.h>
34
35#include <opie2/ocompletionbox.h>
36#include <opie2/olineedit.h>
37#include <opie2/ocombobox.h>
38#include <opie2/oeditlistbox.h>
39#include <opie2/oselector.h>
40#include <opie2/opopupmenu.h>
41
42#include <qtabwidget.h>
43#include "oversatileviewdemo.h"
44
45// Local
46
47#include "opieuidemo.h"
48
49using namespace Opie::Core;
50using namespace Opie::Ui;
51
52enum Demos { ocompletionbox, olineedit, ocombobox, oeditlistbox, oselector };
53
54OpieUIDemo::OpieUIDemo( QWidget* parent, const char* name, WFlags fl )
55 : QMainWindow( parent, name, fl )
56{
57
58 QMenuBar* mbar = this->menuBar();
59 OPopupMenu* demo = new OPopupMenu( this );
60 demo->setTitle( "Title" );
61 demo->setItemParameter( demo->insertItem( "OCompletionBox", this, SLOT( demo(int) ) ), ocompletionbox );
62 demo->setItemParameter( demo->insertItem( "OLineEdit", this, SLOT( demo(int) ) ), olineedit );
63 demo->setItemParameter( demo->insertItem( "OComboBox", this, SLOT( demo(int) ) ), ocombobox );
64 demo->setItemParameter( demo->insertItem( "OEditListBox", this, SLOT( demo(int) ) ), oeditlistbox );
65 demo->setItemParameter( demo->insertItem( "OSelector", this, SLOT( demo(int) ) ), oselector );
66 mbar->insertItem( "Demonstrate", demo );
67
68 build();
69
70}
71
72OpieUIDemo::~OpieUIDemo()
73{
74}
75
76void OpieUIDemo::build()
77{
78 main = new QTabWidget( this, "tabwidget" );
79 setCentralWidget( main );
80 main->show();
81
82 main->addTab( new OVersatileViewDemo( main ), "VersatileView" );
83}
84
85
86void OpieUIDemo::demo( int d )
87{
88 switch (d)
89 {
90 case ocompletionbox: demoOCompletionBox(); break;
91 case olineedit: demoOLineEdit(); break;
92 case ocombobox: demoOComboBox(); break;
93 case oeditlistbox: demoOEditListBox(); break;
94 case oselector: demoOSelector(); break;
95
96 }
97
98}
99
100void OpieUIDemo::demoOCompletionBox()
101{
102 odebug << "ocompletionbox" << oendl;
103
104 OCompletionBox* box = new OCompletionBox( 0 );
105 box->insertItem( "This CompletionBox" );
106 box->insertItem( "Says 'Hello World'" );
107 box->insertItem( "Here are some" );
108 box->insertItem( "Additional Items" );
109 box->insertItem( "Complete Completion Box" );
110
111 connect( box, SIGNAL( activated(const QString&) ), this, SLOT( messageBox(const QString&) ) );
112 box->popup();
113
114}
115
116void OpieUIDemo::demoOLineEdit()
117{
118 odebug << "olineedit" << oendl;
119
120 OLineEdit *edit = new OLineEdit( 0, "lineedit" );
121
122 edit->setCompletionMode( OGlobalSettings::CompletionPopup );
123 OCompletion* comp = edit->completionObject();
124
125 QStringList list;
126 list << "mickeyl@handhelds.org";
127 list << "mickey@tm.informatik.uni-frankfurt.de";
128 list << "mickey@vanille.de";
129
130 comp->setItems( list );
131
132 edit->show();
133
134}
135
136void OpieUIDemo::demoOComboBox()
137{
138 odebug << "ocombobox" << oendl;
139
140 OComboBox *combo = new OComboBox( true, 0, "combobox" );
141
142 combo->setCompletionMode( OGlobalSettings::CompletionPopup );
143 OCompletion* comp = combo->completionObject();
144
145 QStringList ilist;
146 ilist << "kergoth@handhelds.org";
147 ilist << "harlekin@handhelds.org";
148 ilist << "groucho@handhelds.org";
149 combo->insertStringList( ilist );
150
151 QStringList clist;
152 clist << "mickeyl@handhelds.org";
153 clist << "mickey@tm.informatik.uni-frankfurt.de";
154 clist << "mickey@vanille.de";
155 comp->setItems( clist );
156
157 combo->show();
158
159}
160
161void OpieUIDemo::demoOEditListBox()
162{
163 odebug << "oeditlistbox" << oendl;
164
165 OEditListBox* edit = new OEditListBox( "OEditListBox", 0, "editlistbox" );
166
167 edit->lineEdit()->setCompletionMode( OGlobalSettings::CompletionPopup );
168 OCompletion* comp = edit->lineEdit()->completionObject();
169 QStringList clist;
170 clist << "Completion everywhere";
171 clist << "Cool Completion everywhere";
172 clist << "History History History";
173 comp->setItems( clist );
174
175 QStringList list;
176 list << "kergoth@handhelds.org";
177 list << "harlekin@handhelds.org";
178 list << "groucho@handhelds.org";
179 list << "mickeyl@handhelds.org";
180 edit->insertStringList( list );
181
182 edit->show();
183
184}
185
186void OpieUIDemo::demoOSelector()
187{
188 odebug << "oselector" << oendl;
189
190 OHSSelector* sel = new OHSSelector( 0, "gradientselector" );
191 //#sel->resize( QSize( 200, 30 ) );
192 //#sel->setColors( QColor( 90, 190, 60 ), QColor( 200, 55, 255 ) );
193 //#sel->setText( "Dark", "Light" );
194
195 sel->show();
196}
197
198void OpieUIDemo::messageBox( const QString& text )
199{
200 QString info;
201 info = "You have selected '" + text + "'";
202 QMessageBox::information( this, "OpieUIDemo", info );
203}
diff --git a/examples/opieui/oversatileviewdemo/opieuidemo.h b/examples/opieui/oversatileviewdemo/opieuidemo.h
new file mode 100644
index 0000000..382885f
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/opieuidemo.h
@@ -0,0 +1,60 @@
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
21namespace Opie {
22namespace Ui {
23class OVersatileView;
24}
25}
26class QTabWidget;
27class QVBox;
28
29class OpieUIDemo : public QMainWindow {
30 Q_OBJECT
31
32public:
33
34 OpieUIDemo( QWidget* parent = 0, const char* name = 0, WFlags fl = WType_TopLevel );
35 ~OpieUIDemo();
36
37 void demoOCompletionBox();
38 void demoOLineEdit();
39 void demoOComboBox();
40 void demoOEditListBox();
41 void demoOSelector();
42
43public slots:
44 void demo( int );
45 void messageBox( const QString& text );
46
47protected:
48 void build();
49 void buildVV( QVBox* b );
50
51private:
52 QTabWidget* main;
53
54 Opie::Ui::OVersatileView* vv;
55
56};
57
58
59
60#endif
diff --git a/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp b/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
new file mode 100644
index 0000000..e8bbdb1
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/oversatileviewdemo.cpp
@@ -0,0 +1,160 @@
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
41using namespace Opie::Ui;
42
43OVersatileViewDemo::OVersatileViewDemo( QWidget* parent, const char* name, WFlags f )
44 :QVBox( parent, name, f )
45{
46 vv = new OVersatileView( this );
47
48 vv->addColumn( "First" );
49 vv->addColumn( "2nd" );
50 vv->addColumn( "IIIrd" );
51
52 QString counter;
53
54 QPixmap leaf( "leaf.png" );
55 QPixmap opened( "folder_opened.png" );
56 QPixmap closed( "folder_closed.png" );
57
58 QPixmap leaf32( "leaf32.png" );
59 QPixmap opened32( "folder_opened32.png" );
60 QPixmap closed32( "folder_closed32.png" );
61
62 vv->setDefaultPixmaps( OVersatileView::Tree, leaf, opened, closed );
63 vv->setDefaultPixmaps( OVersatileView::Icons, leaf32, opened32, closed32 );
64
65 OVersatileViewItem* item;
66 OVersatileViewItem* item2;
67
68 for ( int i = 0; i < 5; ++i )
69 {
70 counter.sprintf( "%d", i );
71 item = new OVersatileViewItem( vv, "Item", "Text", "Some more", counter );
72 item->setRenameEnabled( true );
73 item2 = new OVersatileViewItem( item, "OSubitem", "123", "...", counter );
74 item2->setRenameEnabled( true );
75
76 }
77
78 connect( vv, SIGNAL( selectionChanged() ), this, SLOT( selectionChanged() ) );
79 connect( vv, SIGNAL( selectionChanged(OVersatileViewItem*) ), this, SLOT( selectionChanged(OVersatileViewItem*) ) );
80 connect( vv, SIGNAL( currentChanged(OVersatileViewItem*) ), this, SLOT( currentChanged(OVersatileViewItem*) ) );
81 connect( vv, SIGNAL( clicked(OVersatileViewItem*) ), this, SLOT( clicked(OVersatileViewItem*) ) );
82 connect( vv, SIGNAL( pressed(OVersatileViewItem*) ), this, SLOT( pressed(OVersatileViewItem*) ) );
83
84 connect( vv, SIGNAL( doubleClicked(OVersatileViewItem*) ), this, SLOT( doubleClicked(OVersatileViewItem*) ) );
85 connect( vv, SIGNAL( returnPressed(OVersatileViewItem*) ), this, SLOT( returnPressed(OVersatileViewItem*) ) );
86
87 connect( vv, SIGNAL( onItem(OVersatileViewItem*) ), this, SLOT( onItem(OVersatileViewItem*) ) );
88 connect( vv, SIGNAL( onViewport() ), this, SLOT( onViewport() ) );
89
90 connect( vv, SIGNAL( expanded(OVersatileViewItem*) ), this, SLOT( expanded(OVersatileViewItem*) ) );
91 connect( vv, SIGNAL( collapsed(OVersatileViewItem*) ), this, SLOT( collapsed(OVersatileViewItem*) ) );
92
93 connect( vv, SIGNAL( moved() ), this, SLOT( moved() ) );
94
95 connect( vv, SIGNAL( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ), this, SLOT( contextMenuRequested(OVersatileViewItem*,const QPoint&,int) ) );
96
97}
98
99OVersatileViewDemo::~OVersatileViewDemo()
100{
101}
102
103void OVersatileViewDemo::selectionChanged()
104{
105 odebug << "received signal selectionChanged()" << oendl;
106}
107void OVersatileViewDemo::selectionChanged( OVersatileViewItem * item )
108{
109 odebug << "received signal selectionChanged(OVersatileViewItem*)" << oendl;
110}
111void OVersatileViewDemo::currentChanged( OVersatileViewItem * item )
112{
113 odebug << "received signal currentChanged( OVersatileViewItem * )" << oendl;
114}
115void OVersatileViewDemo::clicked( OVersatileViewItem * item )
116{
117 odebug << "received signal clicked( OVersatileViewItem * )" << oendl;
118}
119void OVersatileViewDemo::pressed( OVersatileViewItem * item )
120{
121 odebug << "received signal pressed( OVersatileViewItem * )" << oendl;
122}
123
124void OVersatileViewDemo::doubleClicked( OVersatileViewItem *item )
125{
126 odebug << "received signal doubleClicked( OVersatileViewItem *item )" << oendl;
127}
128void OVersatileViewDemo::returnPressed( OVersatileViewItem *item )
129{
130 odebug << "received signal returnPressed( OVersatileViewItem *item )" << oendl;
131}
132
133void OVersatileViewDemo::onItem( OVersatileViewItem *item )
134{
135 odebug << "received signal onItem( OVersatileViewItem *item )" << oendl;
136}
137void OVersatileViewDemo::onViewport()
138{
139 odebug << "received signal onViewport()" << oendl;
140}
141
142void OVersatileViewDemo::expanded( OVersatileViewItem *item )
143{
144 odebug << "received signal expanded( OVersatileViewItem *item )" << oendl;
145}
146
147void OVersatileViewDemo::collapsed( OVersatileViewItem *item )
148{
149 odebug << "received signal collapsed( OVersatileViewItem *item )" << oendl;
150}
151
152void OVersatileViewDemo::moved()
153{
154 odebug << "received signal moved( OVersatileViewItem *item )" << oendl;
155}
156
157void OVersatileViewDemo::contextMenuRequested( OVersatileViewItem *item, const QPoint& pos, int col )
158{
159 odebug << "received signal contextMenuRequested( OVersatileViewItem *item )" << oendl;
160}
diff --git a/examples/opieui/oversatileviewdemo/oversatileviewdemo.h b/examples/opieui/oversatileviewdemo/oversatileviewdemo.h
new file mode 100644
index 0000000..35e2c3c
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/oversatileviewdemo.h
@@ -0,0 +1,77 @@
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
37namespace Opie {
38namespace Ui {
39class OVersatileView;
40class OVersatileViewItem;
41}
42}
43
44class OVersatileViewDemo: public QVBox
45{
46 Q_OBJECT
47
48 public:
49 OVersatileViewDemo( QWidget* parent=0, const char* name=0, WFlags f=0 );
50 virtual ~OVersatileViewDemo();
51
52 public slots:
53 void selectionChanged();
54 void selectionChanged( Opie::Ui::OVersatileViewItem * );
55 void currentChanged( Opie::Ui::OVersatileViewItem * );
56 void clicked( Opie::Ui::OVersatileViewItem * );
57 void pressed( OPie::Ui::OVersatileViewItem * );
58
59 void doubleClicked( Opie::Ui::OVersatileViewItem *item );
60 void returnPressed( Opie::Ui::OVersatileViewItem *item );
61
62 void onItem( Opie::Ui::OVersatileViewItem *item );
63 void onViewport();
64
65 void expanded( Opie::Ui::OVersatileViewItem *item );
66 void collapsed( Opie::Ui::OVersatileViewItem *item );
67
68 void moved();
69
70 void contextMenuRequested( Opie::Ui::OVersatileViewItem *item, const QPoint&, int col );
71
72 private:
73 Opie::Ui::OVersatileView* vv;
74
75};
76
77#endif
diff --git a/examples/opieui/oversatileviewdemo/oversatileviewdemo.pro b/examples/opieui/oversatileviewdemo/oversatileviewdemo.pro
new file mode 100644
index 0000000..ff78095
--- a/dev/null
+++ b/examples/opieui/oversatileviewdemo/oversatileviewdemo.pro
@@ -0,0 +1,17 @@
1TEMPLATE = app
2CONFIG = qt warn_on
3HEADERS = opieuidemo.h \
4 oversatileviewdemo.h
5SOURCES = opieuidemo.cpp \
6 oversatileviewdemo.cpp \
7 main.cpp
8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDPATH += $(OPIEDIR)/include
10LIBS += -lopieui2 -lopiecore2
11TARGET = opieuidemo
12MOC_DIR = moc
13OBJECTS_DIR = obj
14
15include( $(OPIEDIR)/include.pro )
16
17
diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.cpp b/examples/opieui/owidgetstack_example/owidgetstack_example.cpp
new file mode 100644
index 0000000..272e42b
--- a/dev/null
+++ b/examples/opieui/owidgetstack_example/owidgetstack_example.cpp
@@ -0,0 +1,133 @@
1/*
2 * You may use, modify and distribute this example without any limitation
3 */
4
5#include "owidgetstack_example.h"
6
7/* OPIE */
8#include <opie2/oapplicationfactory.h>
9#include <opie2/owidgetstack.h>
10#include <qpe/resource.h>
11
12/* QT */
13#include <qaction.h>
14#include <qtoolbar.h>
15#include <qpopupmenu.h>
16#include <qmenubar.h>
17#include <qlayout.h>
18#include <qlabel.h>
19#include <qpushbutton.h>
20#include <qsignalmapper.h>
21
22using namespace Opie::Core;
23using namespace Opie::Ui;
24
25OPIE_EXPORT_APP( OApplicationFactory<StackExample> )
26
27StackExample::StackExample( QWidget* parent, const char* name, WFlags fl )
28 : QMainWindow( parent, name, fl )
29{
30 m_stack = new OWidgetStack( this );
31 setCentralWidget( m_stack );
32
33 /* nice Signal Mapper ;) */
34 QSignalMapper *sm = new QSignalMapper(this);
35 connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) );
36
37 /* toolbar first but this should be known from the other examples */
38 setToolBarsMovable( false );
39
40 /* only a menubar here */
41 QToolBar* holder = new QToolBar( this );
42 holder->setHorizontalStretchable( true );
43
44 QMenuBar *bar = new QMenuBar( holder );
45 QPopupMenu *menu = new QPopupMenu( this );
46
47 QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"),
48 QString::null, 0, this, 0 );
49 sm->setMapping(a, 1 );
50 connect(a, SIGNAL(activated() ),
51 sm, SLOT(map() ) );
52 a->addTo( menu );
53
54 a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"),
55 QString::null, 0, this, 0 );
56 sm->setMapping(a, 2 );
57 connect(a, SIGNAL(activated() ),
58 sm, SLOT(map() ) );
59 a->addTo( menu );
60
61 a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"),
62 QString::null, 0, this, 0 );
63 sm->setMapping(a, 3 );
64 connect(a, SIGNAL(activated() ),
65 sm, SLOT(map() ) );
66 a->addTo( menu );
67
68 a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"),
69 QString::null, 0, this, 0 );
70 sm->setMapping(a, 4 );
71 connect(a, SIGNAL(activated() ),
72 sm, SLOT(map() ) );
73
74 bar->insertItem( tr("Actions"), menu );
75
76 /* now the gui */
77
78 /* first widget, main widget */
79 QWidget * wid = new QWidget( m_stack );
80 QGridLayout *grid = new QGridLayout(wid, 2, 2 );
81
82 QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" );
83 sm->setMapping(btn, 2 );
84 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
85 grid->addWidget( btn, 0, 0 );
86
87 btn = new QPushButton( tr("Show Details Medium"), wid, "details2");
88 sm->setMapping(btn, 3 );
89 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
90 grid->addWidget( btn, 0, 1 );
91
92 btn = new QPushButton( tr("Show Details All"), wid, "details3");
93 sm->setMapping(btn, 4 );
94 connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) );
95 grid->addWidget( btn, 1, 1 );
96
97 m_stack->addWidget( wid, 1 );
98 m_main = wid;
99
100 QLabel *lbl = new QLabel(m_stack );
101 lbl->setText(tr("Only small Details are shown here. Määh") );
102 m_stack->addWidget( lbl, 2 );
103
104 lbl = new QLabel( m_stack );
105 lbl->setText( tr("Some more details....Wo ist das Schaf?") );
106 m_stack->addWidget( lbl, 3 );
107
108 lbl = new QLabel( m_stack );
109 lbl->setText( tr("<qt>Ne nicht in Bayerisch Gmain sondern in Berlin<br>Vermiss und meine Augen werden nicht eckig, da mein Bildschirm abgerundet ist<br>Es lebe Hamburg Süd,weiss du, verstehst du? ;)<br>Susi ist dOOf, es lebe die Ofenecke...", "hard to translate that") );
110 m_stack->addWidget( lbl, 4 );
111
112
113 /* THE signal mapper does all the magic */
114 m_stack->raiseWidget( m_main );
115}
116
117
118StackExample::~StackExample() {
119
120}
121
122
123
124void StackExample::closeEvent( QCloseEvent* ev) {
125 /* if the close even came when we displayed a details */
126 if (m_stack->visibleWidget() != m_main ) {
127 m_stack->raiseWidget( m_main );
128 ev->ignore();
129 return;
130 }
131
132 ev->accept();
133}
diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.h b/examples/opieui/owidgetstack_example/owidgetstack_example.h
new file mode 100644
index 0000000..c9b70cb
--- a/dev/null
+++ b/examples/opieui/owidgetstack_example/owidgetstack_example.h
@@ -0,0 +1,27 @@
1/*
2 * You may use, modify and distribute this example without any limitation
3 */
4
5#ifndef O_STACK_EXAMPLE_SIMPLE_H
6#define O_STACK_EXAMPLE_SIMPLE_H
7
8#include <qmainwindow.h>
9#include <opie2/owidgetstack.h>
10
11
12class StackExample : public QMainWindow {
13 Q_OBJECT
14public:
15 StackExample( QWidget* paren, const char* name, WFlags fl );
16 ~StackExample();
17 static QString appName() { return QString::fromLatin1("owidgetstack-example"); }
18
19protected:
20 void closeEvent( QCloseEvent* e );
21private:
22 Opie::Ui::OWidgetStack* m_stack;
23 QWidget* m_main;
24
25};
26
27#endif
diff --git a/examples/opieui/owidgetstack_example/owidgetstack_example.pro b/examples/opieui/owidgetstack_example/owidgetstack_example.pro
new file mode 100644
index 0000000..4cfce9c
--- a/dev/null
+++ b/examples/opieui/owidgetstack_example/owidgetstack_example.pro
@@ -0,0 +1,13 @@
1CONFIG += qt warn_on
2TEMPLATE = app
3TARGET = owidgetstack-example
4
5SOURCES = owidgetstack_example.cpp
6HEADERS = owidgetstack_example.h
7
8INCLUDEPATH += $(OPIEDIR)/include
9DEPENDSPATH += $(OPIEDIR)/include
10
11LIBS += -lqpe -lopieui2
12
13include( $(OPIEDIR)/include.pro )