author | zecke <zecke> | 2004-03-05 22:58:06 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-03-05 22:58:06 (UTC) |
commit | b4ec902435df4e3c834b7790c1dc70a235157477 (patch) (unidiff) | |
tree | 56f855525c3da4ca9efd02c148a967a41cc4cdcb /libopie | |
parent | 3dd27f86cf3865b771258d80048190e0ef6c3177 (diff) | |
download | opie-b4ec902435df4e3c834b7790c1dc70a235157477.zip opie-b4ec902435df4e3c834b7790c1dc70a235157477.tar.gz opie-b4ec902435df4e3c834b7790c1dc70a235157477.tar.bz2 |
Big Screen Extensions should only be in the new LIBOPIEUI2.
We can remove it without risking binary incompatible as these classes
were not in the 1.0 API release
21 files changed, 0 insertions, 2719 deletions
diff --git a/libopie/big-screen/IDEAS b/libopie/big-screen/IDEAS deleted file mode 100644 index 27a4d6e..0000000 --- a/libopie/big-screen/IDEAS +++ b/dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | Now that PDAs get a VGA resolution and Opie runs on Webpads | ||
2 | and could be used as a Kiosk secure environment the design | ||
3 | decision that were right for a 320x240/240x320 doesn't necessary | ||
4 | to be right for bigger screens. | ||
5 | |||
6 | Remember most desktops a few years ago had only a resolution | ||
7 | of 800x600. | ||
8 | Then also to remember is that a webpad with 640x480 is different to | ||
9 | a PDA with the same resolution. The PDA has a much smaller | ||
10 | physical display. | ||
11 | |||
12 | With higher resolution the feeling of a desktop comes. | ||
13 | |||
14 | Problems with current Opie: | ||
15 | -InputMethod use full width but most of the times are not high enough | ||
16 | This actually makes it harder to input and looks stupid. | ||
17 | -ToolBars only feels strange on bigger screens. Maybe do it like WinCE3 does | ||
18 | share the ToolBar with MenuBar if they're too big for the screen allow handles | ||
19 | to either show the left or right side. Note that the handle from Qt looks | ||
20 | bad and should be patched away | ||
21 | -The Escape/Close back to View does not make sense on bigger screens and desktop | ||
22 | on a desktop you might even want to show multiple views and detach from the 'system' | ||
23 | view | ||
24 | -Modality. Dunnow how you get back to the enter dialog without modality in Qt/E fix it? | ||
25 | On bigger screen this is not the problem you can move windows. But you should try | ||
26 | to be less modal in the future. | ||
27 | I've added a small to qpeapplication to iterate over the toplevel widgets 99% | ||
28 | ( click on the taskbar to iterate over the widgets first time nothing is changed ) | ||
29 | , BUT it should be avoided to use modality showMaximized(), exec() | ||
30 | INSTEAD we will use a modal helper where one can register to show a dialog for uid | ||
31 | type and will get a signal once the settings need to be applied, rejected or discarded. | ||
32 | This way you can almost work like with exec(), do not need to care for freeing. | ||
33 | Problems sometimes to have more than one dialog in memory is expensive. Allow queueing | ||
34 | and reusing this widget ( only set the Record new? ) | ||
35 | -Viewing on bigger screens you may want to have a seperate viewer widget ( topLevel ) which | ||
36 | might also get spon off from the normal operation. The (X) close go back does not make | ||
37 | sense on bigger screens and feels strange | ||
38 | -Sizing and Auto sizing of widgets | ||
39 | |||
40 | Widgets and Classes | ||
41 | |||
42 | Toolbar/Action and Popups: | ||
43 | While KParts with XMLGUI provide a fantastic technology to change the GUI | ||
44 | on the fly. Parsing these GUI descriptions is not an option for PDAs | ||
45 | specially not on start up. | ||
46 | Instead we will need to use normal object in this case QAction and QPopupMenuss. We | ||
47 | will then group these Actions into groups. Each group can have children and one | ||
48 | parent. Each group has two attributes one for the menubar and one for the toolbar. | ||
49 | Attributes for each might be | together. Always, Never, Auto are the attributes I | ||
50 | can think of tonite. Always will place this group always there, Never yeah never, | ||
51 | Automatic lets the later described Manager decide. Also one could or MightSpinOff | ||
52 | to a group. This way a child group might get spon off if enough place is there. | ||
53 | You cann add QAction and QPopupMenus to the group the Group will not take owner ship | ||
54 | and you might use your QAction in other places as well. | ||
55 | Toplevel groups need to be registered to the manager and this manager will depending | ||
56 | on global settings place and control MenuBar and ToolBar/ToolBar. | ||
57 | This allows to dynamically create toolbar on the fly | ||
58 | |||
59 | Modality class: | ||
60 | It'll be a template with a QSignal to tell about changes and a method to get to know | ||
61 | which action to be applied. It has three template parameters one for the WIdget used | ||
62 | and one for the type of uid and the last for the editor widget which | ||
63 | at least needs to provide some methods as well. | ||
64 | If you need to edit an widget you simply tell the helper about it. If present it'll | ||
65 | raise the widget or either queue it or create a new editor depending on a policy | ||
66 | one can set manually or get from the system. | ||
67 | |||
68 | Viewing: | ||
69 | We will provide a special OWidgetStack which either is a real QWidgetStack or a QList | ||
70 | of toplevel widgets to be raised. One has to see how one can use it with todolist | ||
71 | and datebook. specially the switching back and forth need to be handled but with possible | ||
72 | no code reordering ( least intrusive ) | ||
73 | Viewing II: | ||
74 | Example Advanced FM has a tabwidget but on a SIMpad it would make perfect sense to use a | ||
75 | QSplitter or QVBox. We will provide an OSplitter which either provides the one | ||
76 | or the other widget depending on the size | ||
77 | |||
78 | |||
79 | These small changes ( replacing Q with O + bit more) should make Opie a better environment for | ||
80 | bigger screens. The additional library memory is a fair trade off and memory can be recovered | ||
81 | by other technics \ No newline at end of file | ||
diff --git a/libopie/big-screen/big-screen.pro b/libopie/big-screen/big-screen.pro deleted file mode 100644 index f324d3c..0000000 --- a/libopie/big-screen/big-screen.pro +++ b/dev/null | |||
@@ -1,2 +0,0 @@ | |||
1 | HEADERS += big-screen/obigscreen_p.h big-screen/osplitter.h big-screen/owidgetstack.h #big-screen/omodalhelper.h | ||
2 | SOURCES += big-screen/osplitter.cpp big-screen/owidgetstack.cpp #big-screen/omodalhelper.cpp | ||
diff --git a/libopie/big-screen/example/osplitter_example.cpp b/libopie/big-screen/example/osplitter_example.cpp deleted file mode 100644 index e337379..0000000 --- a/libopie/big-screen/example/osplitter_example.cpp +++ b/dev/null | |||
@@ -1,28 +0,0 @@ | |||
1 | #include <qdir.h> | ||
2 | #include <qlayout.h> | ||
3 | |||
4 | #include "../osplitter.h" | ||
5 | |||
6 | #include <qpe/qpeapplication.h> | ||
7 | #include <opie/oapplicationfactory.h> | ||
8 | |||
9 | #include "osplitter_example.h" | ||
10 | |||
11 | OPIE_EXPORT_APP( OApplicationFactory<OSplitterExample> ) | ||
12 | |||
13 | OSplitterExample::OSplitterExample( QWidget *w,const char* n,WFlags f ) | ||
14 | : QWidget( w, n, f ){ | ||
15 | QVBoxLayout * lay = new QVBoxLayout(this); | ||
16 | OSplitter * splitter = new OSplitter( Horizontal, this ); | ||
17 | lay->addWidget( splitter ); | ||
18 | |||
19 | OFileSelector *selector = new OFileSelector( splitter, OFileSelector::FileSelector, | ||
20 | OFileSelector::Normal, QDir::homeDirPath(), | ||
21 | QString::null ); | ||
22 | splitter->addWidget( selector, "zoom", tr("Selector 1") ); | ||
23 | |||
24 | selector = new OFileSelector( splitter, OFileSelector::FileSelector, OFileSelector::Normal, | ||
25 | QDir::homeDirPath(), QString::null ); | ||
26 | splitter->addWidget( selector, "zoom", tr("Selector 2") ); | ||
27 | |||
28 | } | ||
diff --git a/libopie/big-screen/example/osplitter_example.h b/libopie/big-screen/example/osplitter_example.h deleted file mode 100644 index ae8f120..0000000 --- a/libopie/big-screen/example/osplitter_example.h +++ b/dev/null | |||
@@ -1,20 +0,0 @@ | |||
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 | #include <opie/ofileselector.h> | ||
10 | |||
11 | class OSplitterExample : public QWidget { | ||
12 | Q_OBJECT | ||
13 | public: | ||
14 | static QString appName() { return QString::fromLatin1("osplitter_example"); } | ||
15 | OSplitterExample( QWidget *parent, const char* name, WFlags fl ); | ||
16 | |||
17 | }; | ||
18 | |||
19 | |||
20 | #endif | ||
diff --git a/libopie/big-screen/example/osplitter_example.o b/libopie/big-screen/example/osplitter_example.o deleted file mode 100644 index e52d5d9..0000000 --- a/libopie/big-screen/example/osplitter_example.o +++ b/dev/null | |||
Binary files differ | |||
diff --git a/libopie/big-screen/example/osplitter_example.pro b/libopie/big-screen/example/osplitter_example.pro deleted file mode 100644 index b12bf17..0000000 --- a/libopie/big-screen/example/osplitter_example.pro +++ b/dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | CONFIG = qt warn_on | ||
2 | TEMPLATE = app | ||
3 | TARGET = osplitter_example | ||
4 | |||
5 | HEADERS = osplitter_example.h ../osplitter.h | ||
6 | SOURCES = osplitter_example.cpp ../osplitter.cpp | ||
7 | |||
8 | INCLUDEPATH += $(OPIEDIR)/include ../ | ||
9 | DEPENDSPATH += $(OPIEDIR)/include | ||
10 | |||
11 | LIBS += -lqpe -lopie | ||
12 | |||
13 | include ( $(OPIEDIR)/include.pro ) \ No newline at end of file | ||
diff --git a/libopie/big-screen/example/osplitter_mail.cpp b/libopie/big-screen/example/osplitter_mail.cpp deleted file mode 100644 index 4356baa..0000000 --- a/libopie/big-screen/example/osplitter_mail.cpp +++ b/dev/null | |||
@@ -1,82 +0,0 @@ | |||
1 | |||
2 | #include <qstring.h> | ||
3 | #include <qlabel.h> | ||
4 | #include <qheader.h> | ||
5 | #include <qlayout.h> | ||
6 | |||
7 | #include <qpe/qpeapplication.h> | ||
8 | #include <opie/oapplicationfactory.h> | ||
9 | |||
10 | #include "../osplitter.h" | ||
11 | |||
12 | #include "osplitter_mail.h" | ||
13 | |||
14 | |||
15 | OPIE_EXPORT_APP( OApplicationFactory<ListViews> ) | ||
16 | |||
17 | class Folder { | ||
18 | int dummy; | ||
19 | }; | ||
20 | |||
21 | // ----------------------------------------------------------------- | ||
22 | |||
23 | ListViews::ListViews( QWidget* p, const char* name, WFlags fl ) | ||
24 | : QWidget( p, name, fl ) { | ||
25 | qApp->installEventFilter( this ); | ||
26 | m_lstFolders.setAutoDelete( true ); | ||
27 | QHBoxLayout *lay = new QHBoxLayout(this); | ||
28 | |||
29 | m_splitter = new OSplitter( Horizontal, this, "SPlitter 1" ); | ||
30 | lay->addWidget( m_splitter ); | ||
31 | connect(m_splitter, SIGNAL(sizeChange(bool,const QSize&) ), | ||
32 | this, SLOT(slotSizeChange(bool,const QSize&) ) ); | ||
33 | |||
34 | m_overview = new QListView( m_splitter ); | ||
35 | m_overview->header()->setClickEnabled( FALSE ); | ||
36 | m_overview->addColumn( tr("Folder") ); | ||
37 | m_overview->setMaximumWidth( 200 ); | ||
38 | m_splitter->addWidget( m_overview, "zoom", tr("Folder Overview") ); | ||
39 | m_splitter->setSizeChange( 300 ); | ||
40 | |||
41 | /* OSplitter starts with the small mode */ | ||
42 | m_messages = 0; | ||
43 | m_message = m_attach = 0; | ||
44 | |||
45 | splitti = new OSplitter( Vertical, m_splitter, "Splitti2" ); | ||
46 | splitti->setSizeChange( 300 ); | ||
47 | splitti->setSizePolicy( QSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding ) ); | ||
48 | |||
49 | QLabel *lbl = new QLabel(splitti); | ||
50 | lbl->setTextFormat ( Qt::RichText ); | ||
51 | lbl->setText("<br><br><b>Test Test Test</b><br><br><p>Fooooo hjhh</p>"); | ||
52 | |||
53 | m_messages = new QListView( splitti ); | ||
54 | m_messages->addColumn(" Messages "); | ||
55 | |||
56 | folder1 = new QListView( splitti ); | ||
57 | folder1->addColumn( "Messages 2 " ); | ||
58 | |||
59 | splitti->addWidget(m_messages, "mail", tr("Mails") ); | ||
60 | splitti->addWidget(folder1, "folder", tr("Folder") ); | ||
61 | splitti->addWidget( lbl, "logo", tr("Label") ); | ||
62 | m_message = lbl; | ||
63 | |||
64 | m_splitter->addWidget( splitti ); | ||
65 | |||
66 | } | ||
67 | |||
68 | |||
69 | ListViews::~ListViews() { | ||
70 | |||
71 | } | ||
72 | |||
73 | |||
74 | bool ListViews::eventFilter( QObject* obj, QEvent* ev ) { | ||
75 | if (!obj->isWidgetType() ) | ||
76 | return false; | ||
77 | if ( ev->type() == QEvent::MouseButtonRelease ) { | ||
78 | qWarning(" name %s, class %s", obj->name(), obj->className() ); | ||
79 | } | ||
80 | |||
81 | return false; | ||
82 | } | ||
diff --git a/libopie/big-screen/example/osplitter_mail.h b/libopie/big-screen/example/osplitter_mail.h deleted file mode 100644 index b7e7efe..0000000 --- a/libopie/big-screen/example/osplitter_mail.h +++ b/dev/null | |||
@@ -1,49 +0,0 @@ | |||
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 | class Folder; | ||
18 | class QLabel; | ||
19 | |||
20 | class OSplitter; | ||
21 | class ListViews : public QWidget { | ||
22 | Q_OBJECT | ||
23 | public: | ||
24 | static QString appName() { return QString::fromLatin1("osplitter-mail"); } | ||
25 | ListViews( QWidget* parent, const char * name, WFlags fl ); | ||
26 | ~ListViews(); | ||
27 | |||
28 | bool eventFilter( QObject* , QEvent* ); | ||
29 | private: | ||
30 | void initFolders(); | ||
31 | void initFolder( Folder *folder, unsigned int &count ); | ||
32 | |||
33 | QListView *m_messages, *m_overview; | ||
34 | QLabel *m_message, *m_attach; | ||
35 | QList<QListView> m_folders; // used in tab mode | ||
36 | QList<Folder> m_lstFolders; | ||
37 | bool m_mode : 1; // bitfield | ||
38 | OSplitter *m_splitter; | ||
39 | OSplitter *splitti; | ||
40 | QListView *folder1; | ||
41 | #if 0 | ||
42 | //private slots: | ||
43 | // void slotFolderChanged( QListViewItem* ); | ||
44 | // void slotMessageChanged(); | ||
45 | // void slotSizeChange( bool, const QSize& ); | ||
46 | #endif | ||
47 | }; | ||
48 | |||
49 | #endif | ||
diff --git a/libopie/big-screen/example/osplitter_mail.pro b/libopie/big-screen/example/osplitter_mail.pro deleted file mode 100644 index ec6e626..0000000 --- a/libopie/big-screen/example/osplitter_mail.pro +++ b/dev/null | |||
@@ -1,12 +0,0 @@ | |||
1 | CONFIG += qt warn_on | ||
2 | TEMPLATE = app | ||
3 | TARGET = osplitter-mail | ||
4 | |||
5 | INCLUDEPATH += $(OPIEDIR)/include | ||
6 | DEPENDSPATH += $(OPIEDIR)/include | ||
7 | |||
8 | HEADERS = osplitter_mail.h | ||
9 | SOURCES = osplitter_mail.cpp | ||
10 | |||
11 | LIBS += -lqpe -lopie | ||
12 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/libopie/big-screen/example/owidgetstack_example.cpp b/libopie/big-screen/example/owidgetstack_example.cpp deleted file mode 100644 index a6b8201..0000000 --- a/libopie/big-screen/example/owidgetstack_example.cpp +++ b/dev/null | |||
@@ -1,131 +0,0 @@ | |||
1 | /* | ||
2 | * You may use, modify and distribute this example without any limitation | ||
3 | */ | ||
4 | |||
5 | #include <qaction.h> | ||
6 | #include <qtoolbar.h> | ||
7 | #include <qpopupmenu.h> | ||
8 | #include <qmenubar.h> | ||
9 | #include <qlayout.h> | ||
10 | #include <qlabel.h> | ||
11 | #include <qpushbutton.h> | ||
12 | #include <qsignalmapper.h> | ||
13 | |||
14 | #include <qpe/resource.h> | ||
15 | |||
16 | #include "../owidgetstack.h" | ||
17 | |||
18 | #include "owidgetstack_example.h" | ||
19 | |||
20 | #include <qpe/qpeapplication.h> | ||
21 | #include <opie/oapplicationfactory.h> | ||
22 | |||
23 | OPIE_EXPORT_APP( OApplicationFactory<StackExample> ) | ||
24 | |||
25 | StackExample::StackExample( QWidget* parent, const char* name, WFlags fl ) | ||
26 | : QMainWindow( parent, name, fl ) | ||
27 | { | ||
28 | m_stack = new OWidgetStack( this ); | ||
29 | setCentralWidget( m_stack ); | ||
30 | |||
31 | /* nice Signal Mapper ;) */ | ||
32 | QSignalMapper *sm = new QSignalMapper(this); | ||
33 | connect(sm, SIGNAL(mapped(int) ), m_stack, SLOT(raiseWidget(int)) ); | ||
34 | |||
35 | /* toolbar first but this should be known from the other examples */ | ||
36 | setToolBarsMovable( false ); | ||
37 | |||
38 | /* only a menubar here */ | ||
39 | QToolBar* holder = new QToolBar( this ); | ||
40 | holder->setHorizontalStretchable( true ); | ||
41 | |||
42 | QMenuBar *bar = new QMenuBar( holder ); | ||
43 | QPopupMenu *menu = new QPopupMenu( this ); | ||
44 | |||
45 | QAction* a = new QAction( tr("Show MainWidget"), Resource::loadPixmap("zoom"), | ||
46 | QString::null, 0, this, 0 ); | ||
47 | sm->setMapping(a, 1 ); | ||
48 | connect(a, SIGNAL(activated() ), | ||
49 | sm, SLOT(map() ) ); | ||
50 | a->addTo( menu ); | ||
51 | |||
52 | a = new QAction( tr("Show Details Small"), Resource::loadPixmap("zoom"), | ||
53 | QString::null, 0, this, 0 ); | ||
54 | sm->setMapping(a, 2 ); | ||
55 | connect(a, SIGNAL(activated() ), | ||
56 | sm, SLOT(map() ) ); | ||
57 | a->addTo( menu ); | ||
58 | |||
59 | a = new QAction( tr("Show Details More"), Resource::loadPixmap("zoom"), | ||
60 | QString::null, 0, this, 0 ); | ||
61 | sm->setMapping(a, 3 ); | ||
62 | connect(a, SIGNAL(activated() ), | ||
63 | sm, SLOT(map() ) ); | ||
64 | a->addTo( menu ); | ||
65 | |||
66 | a = new QAction( tr("Show Details All"), Resource::loadPixmap("zoom"), | ||
67 | QString::null, 0, this, 0 ); | ||
68 | sm->setMapping(a, 4 ); | ||
69 | connect(a, SIGNAL(activated() ), | ||
70 | sm, SLOT(map() ) ); | ||
71 | |||
72 | bar->insertItem( tr("Actions"), menu ); | ||
73 | |||
74 | /* now the gui */ | ||
75 | |||
76 | /* first widget, main widget */ | ||
77 | QWidget * wid = new QWidget( m_stack ); | ||
78 | QGridLayout *grid = new QGridLayout(wid, 2, 2 ); | ||
79 | |||
80 | QPushButton *btn = new QPushButton( tr("Show Details Small"), wid, "details1" ); | ||
81 | sm->setMapping(btn, 2 ); | ||
82 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | ||
83 | grid->addWidget( btn, 0, 0 ); | ||
84 | |||
85 | btn = new QPushButton( tr("Show Details Medium"), wid, "details2"); | ||
86 | sm->setMapping(btn, 3 ); | ||
87 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | ||
88 | grid->addWidget( btn, 0, 1 ); | ||
89 | |||
90 | btn = new QPushButton( tr("Show Details All"), wid, "details3"); | ||
91 | sm->setMapping(btn, 4 ); | ||
92 | connect(btn, SIGNAL(clicked()), sm, SLOT(map() ) ); | ||
93 | grid->addWidget( btn, 1, 1 ); | ||
94 | |||
95 | m_stack->addWidget( wid, 1 ); | ||
96 | m_main = wid; | ||
97 | |||
98 | QLabel *lbl = new QLabel(m_stack ); | ||
99 | lbl->setText(tr("Only small Details are shown here. Määh") ); | ||
100 | m_stack->addWidget( lbl, 2 ); | ||
101 | |||
102 | lbl = new QLabel( m_stack ); | ||
103 | lbl->setText( tr("Some more details....Wo ist das Schaf?") ); | ||
104 | m_stack->addWidget( lbl, 3 ); | ||
105 | |||
106 | lbl = new QLabel( m_stack ); | ||
107 | 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") ); | ||
108 | m_stack->addWidget( lbl, 4 ); | ||
109 | |||
110 | |||
111 | /* THE signal mapper does all the magic */ | ||
112 | m_stack->raiseWidget( m_main ); | ||
113 | } | ||
114 | |||
115 | |||
116 | StackExample::~StackExample() { | ||
117 | |||
118 | } | ||
119 | |||
120 | |||
121 | |||
122 | void StackExample::closeEvent( QCloseEvent* ev) { | ||
123 | /* if the close even came when we displayed a details */ | ||
124 | if (m_stack->visibleWidget() != m_main ) { | ||
125 | m_stack->raiseWidget( m_main ); | ||
126 | ev->ignore(); | ||
127 | return; | ||
128 | } | ||
129 | |||
130 | ev->accept(); | ||
131 | } | ||
diff --git a/libopie/big-screen/example/owidgetstack_example.h b/libopie/big-screen/example/owidgetstack_example.h deleted file mode 100644 index 7977b48..0000000 --- a/libopie/big-screen/example/owidgetstack_example.h +++ b/dev/null | |||
@@ -1,27 +0,0 @@ | |||
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 | |||
10 | |||
11 | class OWidgetStack; | ||
12 | class StackExample : public QMainWindow { | ||
13 | Q_OBJECT | ||
14 | public: | ||
15 | StackExample( QWidget* paren, const char* name, WFlags fl ); | ||
16 | ~StackExample(); | ||
17 | static QString appName() { return QString::fromLatin1("owidgetstack-example"); } | ||
18 | |||
19 | protected: | ||
20 | void closeEvent( QCloseEvent* e ); | ||
21 | private: | ||
22 | OWidgetStack* m_stack; | ||
23 | QWidget* m_main; | ||
24 | |||
25 | }; | ||
26 | |||
27 | #endif | ||
diff --git a/libopie/big-screen/example/owidgetstack_example.pro b/libopie/big-screen/example/owidgetstack_example.pro deleted file mode 100644 index ad1dc09..0000000 --- a/libopie/big-screen/example/owidgetstack_example.pro +++ b/dev/null | |||
@@ -1,13 +0,0 @@ | |||
1 | CONFIG += qt warn_on | ||
2 | TEMPLATE = app | ||
3 | TARGET = owidgetstack-example | ||
4 | |||
5 | SOURCES = ../owidgetstack.cpp owidgetstack_example.cpp | ||
6 | HEADERS = ../owidgetstack.h owidgetstack_example.h | ||
7 | |||
8 | INCLUDEPATH += $(OPIEDIR)/include | ||
9 | DEPENDSPATH += $(OPIEDIR)/include | ||
10 | |||
11 | LIBS += -lqpe | ||
12 | |||
13 | include ( $(OPIEDIR)/include.pro ) | ||
diff --git a/libopie/big-screen/obarcollection.h b/libopie/big-screen/obarcollection.h deleted file mode 100644 index 5822360..0000000 --- a/libopie/big-screen/obarcollection.h +++ b/dev/null | |||
@@ -1,107 +0,0 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@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 | #ifndef HAZE_OBAR_EXTENSION | ||
30 | #define HAZE_OBAR_EXTENSION | ||
31 | |||
32 | #include <qstring.h> | ||
33 | #include <qwidget.h> | ||
34 | |||
35 | class QAction; | ||
36 | class QPopupMenu; | ||
37 | |||
38 | /* | ||
39 | * ### TODO | ||
40 | * -Consider Life Updates | ||
41 | * -Make ValueBased like Opie-featurelist | ||
42 | */ | ||
43 | |||
44 | /** | ||
45 | * The different screen sizes have different look and feel. On bigger | ||
46 | * screens only a QToolBar feels strange. One is at least known to have | ||
47 | * a Help-Menu, a File Menu with Quit/Exit but instead of providing two | ||
48 | * different ways / two action sets we will group actions to gether and give | ||
49 | * them attributes when and where we might want them to be visible. | ||
50 | * We can also group actions. For example you could Group All Actions | ||
51 | * into the File Group. This means with many actions you would only have more toolbar | ||
52 | * actions but many sub menus in File. On bigger screen this would automatically | ||
53 | * expand to a full blown MenuBar and ToolButtons. | ||
54 | * | ||
55 | * @short Grouping of actions for dynamic Bar Generation | ||
56 | * @version 0.01 | ||
57 | * @author hOlgAr | ||
58 | */ | ||
59 | class OBarGroup { | ||
60 | public: | ||
61 | enum Preference { Allways, Never, IfPlace }; | ||
62 | OBarGroup( const QString& name, enum Preference groupPreference ); | ||
63 | ~OBarGroup(); | ||
64 | |||
65 | void add( QAction* action, enum Preference menuPreference, | ||
66 | enum Preference toolpreference ); | ||
67 | void add( const QString&, QPopupMenu* ); | ||
68 | |||
69 | void add( OBarGroup* ); | ||
70 | |||
71 | void remove( QAction* action ); | ||
72 | void remove( QMap* ); | ||
73 | |||
74 | protected: | ||
75 | OBarGroup* parent()const; | ||
76 | |||
77 | private: | ||
78 | }; | ||
79 | |||
80 | |||
81 | /** | ||
82 | * Add your groups in order to the bar manager | ||
83 | * and either call createGUI() on it, or tell it | ||
84 | * it the mainwindow and it is listening to the show event | ||
85 | * and then creates the toolbar | ||
86 | */ | ||
87 | class OBarManager : public QObject{ | ||
88 | public: | ||
89 | OBarManager( QWindow* parent ); | ||
90 | ~OBarManager(); | ||
91 | |||
92 | void add( OBarGroup*, int pos = -1 ); | ||
93 | void remove( OBarGroup* ); | ||
94 | |||
95 | bool eventFilter( QObject* , QEvent* ); | ||
96 | |||
97 | public slots: | ||
98 | void createGUI(); | ||
99 | }; | ||
100 | |||
101 | /* | ||
102 | * ### TODO GUI merging | ||
103 | */ | ||
104 | |||
105 | #endif | ||
106 | |||
107 | |||
diff --git a/libopie/big-screen/obigscreen_p.h b/libopie/big-screen/obigscreen_p.h deleted file mode 100644 index ed256d9..0000000 --- a/libopie/big-screen/obigscreen_p.h +++ b/dev/null | |||
@@ -1,20 +0,0 @@ | |||
1 | #ifndef OPIE_BIG_SCREEN_PRIVATE | ||
2 | #define OPIE_BIG_SCREEN_PRIVATE | ||
3 | |||
4 | namespace Opie { | ||
5 | |||
6 | struct OSplitterContainer { | ||
7 | bool operator==( const OSplitterContainer& o)const { | ||
8 | if (widget != o.widget ) return false; | ||
9 | if (icon != o.icon ) return false; | ||
10 | if (name != o.name ) return false; | ||
11 | return true; | ||
12 | } | ||
13 | QWidget* widget; | ||
14 | QString icon; | ||
15 | QString name; | ||
16 | }; | ||
17 | |||
18 | } | ||
19 | |||
20 | #endif | ||
diff --git a/libopie/big-screen/omodalhelper.cpp b/libopie/big-screen/omodalhelper.cpp deleted file mode 100644 index c5a47b3..0000000 --- a/libopie/big-screen/omodalhelper.cpp +++ b/dev/null | |||
@@ -1,165 +0,0 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@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 | #include <qpushbutton.h> | ||
30 | #include <qvbox.h> | ||
31 | #include <qlayout.h> | ||
32 | #include <qlabel.h> | ||
33 | |||
34 | #include "omodalhelper.h" | ||
35 | |||
36 | |||
37 | /* SIgnal handling */ | ||
38 | OModalHelperSignal::OModalHelperSignal( OModalHelperBase* base, QObject* parent ) | ||
39 | : QObject( parent, "OModal Helper Signal" ), m_base( base ) { | ||
40 | } | ||
41 | |||
42 | OModalHelperSignal::~OModalHelperSignal() { | ||
43 | /* special the ancestor deletes its creator */ | ||
44 | delete m_base; | ||
45 | } | ||
46 | |||
47 | |||
48 | /* Helper Controler */ | ||
49 | /* | ||
50 | * the dialogs signal will be slotted here | ||
51 | * and we will call into m_base | ||
52 | */ | ||
53 | OModalHelperControler::OModalHelperControler( OModalHelperBase* base, QObject* parent ) | ||
54 | : QObject(parent, "OModal Helper Controler" ), m_base( base ), m_dia( 0 ), m_id( -1 ) | ||
55 | { | ||
56 | } | ||
57 | |||
58 | TransactionID OModalHelperControler::transactionID()const { | ||
59 | return m_id; | ||
60 | } | ||
61 | |||
62 | void OModalHelperControler::setTransactionID( TransactionID id ) { | ||
63 | m_dia = 0; | ||
64 | m_id = id; | ||
65 | } | ||
66 | |||
67 | QDialog* OModalHelperControler::dialog()const { | ||
68 | return m_dia; | ||
69 | } | ||
70 | |||
71 | /* | ||
72 | * If we're in the New mode we will map the QDialog | ||
73 | * to the TransactionID | ||
74 | */ | ||
75 | void OModalHelperControler::done( int result ) { | ||
76 | if ( sender() && !sender()->isA("OModalQueuedDialog") ) | ||
77 | m_dia = static_cast<QDialog*>( sender() ); | ||
78 | |||
79 | m_base->done( result, m_id ); | ||
80 | } | ||
81 | |||
82 | void OModalHelperControler::next() { | ||
83 | m_base->next( m_id ); | ||
84 | } | ||
85 | |||
86 | void OModalHelperControler::prev() { | ||
87 | m_base->prev( m_id ); | ||
88 | } | ||
89 | |||
90 | /* The Queued Dialog inclusive QueuedBar */ | ||
91 | struct OModalQueueBar : public QHBox { | ||
92 | QPushButton* next; | ||
93 | QPushButton* prev; | ||
94 | QLabel * label; | ||
95 | |||
96 | OModalQueueBar( QWidget* parent ); | ||
97 | void setText( const QString& str ); | ||
98 | }; | ||
99 | |||
100 | OModalQueueBar::OModalQueueBar( QWidget* parent ) | ||
101 | : QWidget( parent, "OModal Queue Bar" ) { | ||
102 | prev = new QPushButton( this ); | ||
103 | prev->setText( OModalQueuedDialog::tr("Prev") ); | ||
104 | |||
105 | label = new QLabel(this); | ||
106 | |||
107 | next = new QPushButton( this ); | ||
108 | next->setText( OModalQueuedDialog::tr("Next") ); | ||
109 | } | ||
110 | |||
111 | void OModalQueueBar::setText( const QString& str ) { | ||
112 | label->setText( str ); | ||
113 | } | ||
114 | |||
115 | |||
116 | OModalQueuedDialog::OModalQueuedDialog( QDialog* mainWidget ) | ||
117 | : QDialog(0, "OModal Queued Dialog" ) | ||
118 | { | ||
119 | QVBoxLayout *lay = new QVBoxLayout( this ); | ||
120 | |||
121 | m_bar = new OModalQueueBar( this ); | ||
122 | lay->addWidget( m_bar ); | ||
123 | |||
124 | m_center = mainWidget; | ||
125 | m_center->reparent(this, 0, QPoint(0, 0) ); | ||
126 | lay->addWidget( m_center ); | ||
127 | |||
128 | |||
129 | connect(m_bar->next, SIGNAL(clicked() ), this, | ||
130 | SIGNAL(next() ) ); | ||
131 | connect(m_bar->prev, SIGNAL(clicked() ), this, | ||
132 | SIGNAL(prev() ) ); | ||
133 | |||
134 | } | ||
135 | |||
136 | OModalQueuedDialog::~OModalQueuedDialog() { | ||
137 | } | ||
138 | |||
139 | QDialog* OModalQueuedDialog::centerDialog()const { | ||
140 | return m_center; | ||
141 | } | ||
142 | |||
143 | void OModalQueuedDialog::setQueueBarEnabled( bool b) { | ||
144 | /* in Qt3 use setEnabled( bool ) */ | ||
145 | if (b) | ||
146 | m_bar->show(); | ||
147 | else | ||
148 | m_bar->hide(); | ||
149 | } | ||
150 | |||
151 | void OModalQueuedDialog::setRecord( int record, int count ) { | ||
152 | if (!record && !count ) { | ||
153 | hide(); | ||
154 | return; | ||
155 | }else | ||
156 | show(); | ||
157 | |||
158 | if ( count > 1 ) | ||
159 | m_bar->show(); | ||
160 | else | ||
161 | m_bar->hide(); | ||
162 | |||
163 | m_bar->setText( tr("Editing record %1 out of %2", | ||
164 | "Shows the current edited record out of an array of records").arg( record ). arg( count ) ); | ||
165 | } | ||
diff --git a/libopie/big-screen/omodalhelper.h b/libopie/big-screen/omodalhelper.h deleted file mode 100644 index 78a2ac9..0000000 --- a/libopie/big-screen/omodalhelper.h +++ b/dev/null | |||
@@ -1,708 +0,0 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@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 | #ifndef HAZE_OMODAL_HELPER_H | ||
30 | #define HAZE_OMODAL_HELPER_H | ||
31 | |||
32 | #include <qdialog.h> | ||
33 | #include <qwidget.h> | ||
34 | #include <qvaluelist.h> | ||
35 | #include <qmap.h> | ||
36 | #include <qvariant.h> | ||
37 | |||
38 | typedef int TransactionID; | ||
39 | |||
40 | class OModalHelperControler; | ||
41 | class OModalHelperSignal; | ||
42 | class QDialog; | ||
43 | |||
44 | struct OModalHelperBase { | ||
45 | virtual void done( int status, TransactionID ) = 0; | ||
46 | virtual void next( TransactionID ) = 0; | ||
47 | virtual void prev( TransactionID ) = 0; | ||
48 | }; | ||
49 | |||
50 | /** | ||
51 | * Modality sucks! ;) But it is easy to work with | ||
52 | * do exec() on a dialog and you know everything is funky. | ||
53 | * You only need to have one Dialog loaded and so on. | ||
54 | * This class helps you to work like with modality and help | ||
55 | * you to keep things in sync | ||
56 | * It's a template class but it sends signals once one Item is ready | ||
57 | * the signals contains the status and id of the item and then you | ||
58 | * need fetch it. | ||
59 | * Handled Records will stay available until the first call to retrieve | ||
60 | * either the record via the TransactionID or via the QValueList<Record>. Note | ||
61 | * that most functions do not take handled records into account. | ||
62 | * Also if you edit an record external you can tell this class and it'll | ||
63 | * call the merge() function of your widget to maybe merge in these changes. | ||
64 | * It also supports multiple modes. Either it can create new dialogs | ||
65 | * for each item or it can queue them depending on your usage. But it is | ||
66 | * so smart that if only one item is shown that the queue bar is not shown | ||
67 | * See the example for simple usage. | ||
68 | * | ||
69 | * @short helps to life without modaility | ||
70 | * @author hOlgAr | ||
71 | * @version 0.01 | ||
72 | */ | ||
73 | template<class Dialog, class Record, typename Id = int> | ||
74 | class OModalHelper : private OModalHelperBase{ | ||
75 | friend class OModalHelperSignal; | ||
76 | friend class OModalHelperControler; | ||
77 | public: | ||
78 | typedef QValueList<Record> RecordList; | ||
79 | typedef QMap<Id, Record> IdMap; | ||
80 | typedef QMap<TransactionID, Id> TransactionMap; | ||
81 | typedef QMap<QDialog*, TransactionID> DialogMap | ||
82 | enum Mode { Queue, New }; | ||
83 | OModalHelper(enum Mode mode, QObject* parnet ); | ||
84 | |||
85 | bool handles( Id id)const; | ||
86 | TransactionID transactionID( Id id)const; | ||
87 | |||
88 | void suspend( bool = true ); | ||
89 | |||
90 | void cancel(); | ||
91 | void cancel( TransactionID ); | ||
92 | |||
93 | void connectDone( QObject* rec, const char* slot ); | ||
94 | void connectAccepted( QObject* rec, const char* slot ); | ||
95 | void connectRejected( QObject* rec, const char* slot ); | ||
96 | |||
97 | TransactionID handle( Id id, const Record& rec = Record() ); | ||
98 | |||
99 | void edited( Id, int what, const QVariant& data ); | ||
100 | |||
101 | Record record( TransactionID )const; | ||
102 | RecordList recordsDone()const; | ||
103 | private: | ||
104 | virtual void done( int, TransactionID ); | ||
105 | virtual void next( TransactionID ); | ||
106 | virtual void prev( TransactionID ); | ||
107 | |||
108 | Record nextRecord( TransactionID &, int & )const; | ||
109 | Record prevRecord( TransactionID &, int & )const; | ||
110 | int pos( TransactionID )const; | ||
111 | Dialog* newDialogRecord( const Record& ); | ||
112 | |||
113 | private: | ||
114 | OModalHelperDialog *queuedDialog()const; // generate or recycle | ||
115 | OModalHelperDialog *m_dialog; | ||
116 | OModalHelperSignal *m_signal; // our signal | ||
117 | OModalHelperControler *m_controler; | ||
118 | IdMap m_ids; // maps ids (uids) to a record | ||
119 | IdMap m_doneIds; | ||
120 | TransactionMap m_transactions; // activate transactions | ||
121 | TransactionMap m_done; // done and waiting for getting picked | ||
122 | DialogMap m_editing; // only used for New Mode | ||
123 | enum Mode m_mode; // the mode we're in | ||
124 | bool m_disabled :1; | ||
125 | }; | ||
126 | |||
127 | |||
128 | |||
129 | /* ### FIXME use namespace with Qt3 */ | ||
130 | |||
131 | /* | ||
132 | * A note on flow. The Signal is used for QT Signals when | ||
133 | * a record is done. | ||
134 | * There is either one controler and this controler slot will | ||
135 | * be connected to a dialog signal. | ||
136 | * In Queue we get the next and prev signals and call the Helper. | ||
137 | * this then changes the Record of the dialog and sets the transactionId | ||
138 | * of the controler. | ||
139 | * For the new mode | ||
140 | * | ||
141 | */ | ||
142 | |||
143 | class OModalHelperSignal : public QObject { | ||
144 | Q_OBJECT | ||
145 | public: | ||
146 | OModalHelperSignal(OModalHelperBase* base, QObject* parent); | ||
147 | ~OModalHelperSignal(); | ||
148 | |||
149 | signals: | ||
150 | done( int status, TransactionID transaction ); | ||
151 | accepted( TransactionID transaction ); | ||
152 | rejected( TransactionID transaction ); | ||
153 | |||
154 | private: | ||
155 | OModalHelperBase* m_base; | ||
156 | }; | ||
157 | |||
158 | |||
159 | class OModalHelperControler : public QObject { | ||
160 | Q_OBJECT | ||
161 | public: | ||
162 | OModalHelperControler( OModalHelperBase* , QObject* parent); | ||
163 | virtual TransactionID transactionID()const; | ||
164 | void setTransactionID( TransactionID id ); | ||
165 | QDialog* dialog()const; | ||
166 | |||
167 | public slots: | ||
168 | virtual void done(int result ); | ||
169 | virtual void next(); | ||
170 | virtual void prev(); | ||
171 | private: | ||
172 | QDialog *m_dia; | ||
173 | TransactionID m_id; | ||
174 | OModalHelperBase *m_base; | ||
175 | } | ||
176 | |||
177 | struct OModalQueueBar; | ||
178 | class OModalQueuedDialog : public QDialog { | ||
179 | Q_OBJECT | ||
180 | public: | ||
181 | OModalQueuedDialog(QDialog *mainWidget); | ||
182 | ~OModalQueuedDialog(); | ||
183 | |||
184 | QDialog* centerDialog()const; | ||
185 | |||
186 | void setQueueBarEnabled( bool = true ); | ||
187 | void setRecord( int record, int count ); | ||
188 | |||
189 | signals: | ||
190 | void next(); | ||
191 | void prev(); | ||
192 | |||
193 | private: | ||
194 | OModalQueueBar *m_bar; | ||
195 | QDialog *m_center; | ||
196 | }; | ||
197 | |||
198 | |||
199 | /* | ||
200 | * Tcpp Template Implementation | ||
201 | */ | ||
202 | |||
203 | /** | ||
204 | * This is the simple Template c'tor. It takes the mode | ||
205 | * this helper should operate in and the parent object. | ||
206 | * This helper will be deleted when the parent gets deleted | ||
207 | * or you delete it yourself. | ||
208 | * | ||
209 | * @param mode The mode this dialog should be in | ||
210 | * @param parent The parent QObject of this helper. | ||
211 | */ | ||
212 | template<class Dialog, class Record, typename Id> | ||
213 | OModalHelper<Dialog, Record, Id>::OModalHelper( enum Mode mode, QObject* parent ) { | ||
214 | m_disabled = false; | ||
215 | m_mode = mode; | ||
216 | m_signal = new OModalHelperSignal( this, parent ); | ||
217 | m_controler = new OModalHelperControler( this, m_signal ); | ||
218 | } | ||
219 | |||
220 | |||
221 | /** | ||
222 | * This functions looks for your record and sees if it is | ||
223 | * handled with this helper. Note that done records | ||
224 | * will not be returned. | ||
225 | * | ||
226 | * @return true if the record is currenlty edited otherwise false | ||
227 | * | ||
228 | * @param Id The id which might be handled | ||
229 | */ | ||
230 | template<class Dialog, class Record, typename Id> | ||
231 | bool OModalHelper<Dialog, Record, Id>::handles( Id id )const { | ||
232 | if ( m_transactions.isEmpty() ) | ||
233 | return false; | ||
234 | |||
235 | TransactionMap::ConstIterator it = m_transactions.begin(); | ||
236 | for ( ; it != m_transactions.end(); ++it ) | ||
237 | if ( it.data() == id ) | ||
238 | return true; | ||
239 | |||
240 | return false; | ||
241 | } | ||
242 | |||
243 | |||
244 | /** | ||
245 | * just like handles( Id ) but returns the TransactionId | ||
246 | */ | ||
247 | template<class Dialog, class Record, typename Id> | ||
248 | TransactionID OModalHelper<Dialog, Record, Id>::transactionID( Id id)const { | ||
249 | if ( m_transactions.isEmpty() || !m_ids.contains( id ) ) | ||
250 | return 0; | ||
251 | |||
252 | TransactionMap::ConstIterator it = m_transactions.begin(); | ||
253 | for ( ; it != m_transactions.end(); ++it ) | ||
254 | if ( it.data() == id ) | ||
255 | return it.key(); | ||
256 | |||
257 | return 0; | ||
258 | } | ||
259 | |||
260 | /** | ||
261 | * If you're requested to flush your data and you do not want | ||
262 | * to call cancel with this method you can disable and enabled | ||
263 | * all dialogs. | ||
264 | * The state gets saved so if you want to handle a new record the dialog | ||
265 | * will be disabled as well. | ||
266 | * | ||
267 | * @param sus If true setDisabled(TRUE) will be called otherwise FALSE | ||
268 | */ | ||
269 | template<class Dialog, class Record, typename Id> | ||
270 | void OModalHelper<Dialog, Record, Id>::suspend(bool sus) { | ||
271 | m_disabled = sus; | ||
272 | if (m_mode == New ) | ||
273 | for (DialogMap::Iterator it = m_editing.begin(); it != m_editing.end(); ++it ) | ||
274 | it.key()->setDisabled( sus ); | ||
275 | else if (m_dialog ) | ||
276 | queuedDialog()->setDisabled( sus ); | ||
277 | } | ||
278 | |||
279 | /** | ||
280 | * Cancel will cancel all current operations and clear the list | ||
281 | * of done operations as well. | ||
282 | * This also clears all done operations you did not popped | ||
283 | */ | ||
284 | template<class Dialog, class Record, typename Id> | ||
285 | void OModalHelper<Dialog, Record, Id>::cancel() { | ||
286 | m_ids.clear(); | ||
287 | m_doneIds.clear(); | ||
288 | m_done.clear(); | ||
289 | m_transactions.clear(); | ||
290 | |||
291 | /* we also need to remove the QDialogs */ | ||
292 | /* and hide the queue dialog if present */ | ||
293 | if (m_mode == New && !m_editing.isEmpty() ) { | ||
294 | for (DialogMap::Iterator it = m_editing.begin(); it != m_editing.end(); ++it ) | ||
295 | delete it.key(); | ||
296 | |||
297 | m_editing.clear(); | ||
298 | }else if (m_dialog ) | ||
299 | queuedDialog()->setRecord( 0, 0 ); | ||
300 | |||
301 | m_controler->setTransactionID( 0 ); | ||
302 | } | ||
303 | |||
304 | |||
305 | /** | ||
306 | * This cancels editing of the record behind the Transaction Number | ||
307 | * Note that if editing is already done it will also be removed from this list | ||
308 | */ | ||
309 | template<class Dialog, class Record, typename Id> | ||
310 | void OModalHelper::cancel( TransactionID tid ) { | ||
311 | /* wrong tid */ | ||
312 | if (!m_transactions.contains( tid ) && !m_done.contains( tid) ) | ||
313 | return; | ||
314 | |||
315 | if (m_mode == New ) | ||
316 | /* reverse map eek */ | ||
317 | for (DialogMap::Iterator it = m_editing.begin(); it != m_editing.end(); ++it ) | ||
318 | if ( it.data() == tid ) { | ||
319 | it.key()->hide(); | ||
320 | delete it.key(); | ||
321 | it = m_editing.remove( it ); | ||
322 | break; | ||
323 | } | ||
324 | |||
325 | /* now remove from the various maps done and currently editing map*/ | ||
326 | if (m_transactions.contains( tid ) ) | ||
327 | m_ids.remove( m_transactions[tid] ); | ||
328 | if (m_done.contains( tid ) ) | ||
329 | m_doneIds.remove( m_done[tid ] ); | ||
330 | m_done.remove( tid ); | ||
331 | m_transactions.remove( tid ); | ||
332 | |||
333 | next( 0 ); | ||
334 | } | ||
335 | |||
336 | /** | ||
337 | * Connect to the done Signal. SIGNAL( done(int, TransactionID ) ) | ||
338 | * This signal gets emitted whenever a Record was accepted or rejected | ||
339 | * | ||
340 | * @param rec The object where the slot belongs to | ||
341 | * @param slot The slot which should be called. See the needed parameter above | ||
342 | */ | ||
343 | template<class Dialog, class Record, typename Id> | ||
344 | void OModalHelper<Dialog, Record, Id>::connectDone( QObject* rec, const char* slot ) { | ||
345 | QObject::connect(m_signal, SIGNAL(done(int, TransactionID) ), | ||
346 | rec, slot ); | ||
347 | } | ||
348 | |||
349 | /** | ||
350 | * Connect to the accepted Signal. SIGNAL( accepted(TransactionID ) ) | ||
351 | * This signal gets emitted whenever a Record was accepted | ||
352 | * | ||
353 | * @param rec The object where the slot belongs to | ||
354 | * @param slot The slot which should be called. See the needed parameter above | ||
355 | */ | ||
356 | template<class Dialog, class Record, typename Id> | ||
357 | void OModalHelper<Dialog, Record, Id>::connectAccepted( QObject* rec, const char* slot ) { | ||
358 | QObject::connect(m_signal, SIGNAL(accepted(TransactionID) ), | ||
359 | rec, slot ); | ||
360 | } | ||
361 | |||
362 | /** | ||
363 | * Same as the accepted method but this one gets emitted if the dialog | ||
364 | * got rejected. | ||
365 | * SIGNAL( rejected(TransactionID) ) | ||
366 | * | ||
367 | * @param rec The QObject of the slot | ||
368 | * @param slot The slot make sure the signature is correct | ||
369 | */ | ||
370 | template<class Dialog, class Record, typename Id> | ||
371 | void OModalHelper<Dialog, Record, Id>::connectRejected( QObject* rec, const char* slot ) { | ||
372 | QObject::connect(m_signal, SIGNAL(rejected(TransactionID) ), | ||
373 | rec, slot ); | ||
374 | } | ||
375 | |||
376 | /** | ||
377 | * Tell the helper to handle a record. If the record is currently handled | ||
378 | * it will be made active. | ||
379 | * Already handled record which are waiting getting popped are not taken into account | ||
380 | * Otherwise this helpers make the record editable. | ||
381 | * The record supplied needs to have a valid copy operator and constructor. | ||
382 | * In the case where the record is already present the parameter gets discarded. | ||
383 | * If you want the new record to be taken you need to cancel the Transaction first | ||
384 | * | ||
385 | * @param id The Identification of the Record. For PIM it would uid() | ||
386 | * @param rec The record we want to be edited | ||
387 | * | ||
388 | * @returns This functions returns the TransactionId assigned to the record | ||
389 | * | ||
390 | */ | ||
391 | template<class Dialog, class Record, typename Id> | ||
392 | TransactionID OModalHelper<Dialog, Record, Id>::handle( Id id, const Record& rec ) { | ||
393 | static TransactionID t_id = 0; | ||
394 | /* | ||
395 | *this method consists out of two parts divided each into New and Queued Mode. | ||
396 | * Either we have the dialog already, in this case we need to highlight the widget | ||
397 | * Or we need to add it. | ||
398 | */ | ||
399 | TransactionID tid = 0; | ||
400 | /* we already have the record lets see if it was done or not */ | ||
401 | if ( !(tid = transactionID( id ) ) ) { | ||
402 | if (m_mode == New ) { | ||
403 | /* lets find the dialog and show it need to reverse map*/ | ||
404 | for (DialogMap::Iterator it = m_editing.begin(); it != m_editing.end(); ++it ) | ||
405 | if ( it.data() == tid ) | ||
406 | it.key()->show(); | ||
407 | }else if (m_controler->transactionID() != tid ) { | ||
408 | int po = pos( tid ); | ||
409 | m_controler->setTransactionID( tid ); | ||
410 | static_cast<Dialog*>( queuedDialog()->centerDialog() )->setRecord( m_ids[ m_transactions[tid] ] ); | ||
411 | queuedDialog()->setRecord( po, m_transactions.count() ); | ||
412 | } | ||
413 | }else { | ||
414 | tid = ++t_id; | ||
415 | m_transactions.insert( tid, id ); | ||
416 | m_ids.insert( id, rec ); | ||
417 | |||
418 | if (m_mode == New ) | ||
419 | m_editing.insert( newDialogRecord( rec ), tid ); | ||
420 | else{ | ||
421 | m_controler->setTransactionID( tid ); | ||
422 | static_cast<Dialog*>( queuedDialog()->centerDialog() )->setRecord( rec ); | ||
423 | queuedDialog()->setRecord( m_transactions.count(), m_transactions.count() ); | ||
424 | } | ||
425 | } | ||
426 | return tid; | ||
427 | } | ||
428 | |||
429 | /** | ||
430 | * The goal of this helper is to help you to create non blocking | ||
431 | * GUIs. In the example of the todolist you can have the edit dialog | ||
432 | * but still change the priority or completion inline even if you currently | ||
433 | * edit the record. | ||
434 | * Your Dialog needs to have a Method setData(int,const QVariant& ) which will be called | ||
435 | * in these cases. | ||
436 | * If you edit anything while a record is edited call this function to merge the | ||
437 | * change in. Note if the record is not handled here we will ignore the request | ||
438 | * | ||
439 | */ | ||
440 | template<class Dialog, class Record, typename Id> | ||
441 | void OModalHelper<Dialog, Record, Id>::edited( Id id, int what, const QVariant& data ) { | ||
442 | int tid; | ||
443 | if (!( tid = transactionID( id ) ) ) | ||
444 | return; | ||
445 | |||
446 | if (m_mode == New ) { | ||
447 | for (DialogMap::Iterator it= m_editing.begin(); it != m_editing.end(); ++it ) | ||
448 | if ( it.data() == tid ) | ||
449 | it.key()->setData( what, data ); | ||
450 | }else{ | ||
451 | int po = pos( tid ); | ||
452 | Dialog* dia = static_cast<Dialog*>( queuedDialog()->centerDialog() ); | ||
453 | dia->setRecord( m_ids[id] ); | ||
454 | dia->setData( what, data ); | ||
455 | queuedDialog()->setRecord( pos, m_transactions.count() ); | ||
456 | } | ||
457 | } | ||
458 | |||
459 | /** | ||
460 | * This functions either returns the unedited record the done record | ||
461 | * or a new empty Record using Record(). | ||
462 | * If a done record is retrieved all traces are removed inside this class. This | ||
463 | * is what was called popping a record. This means when you call this function | ||
464 | * with the same TransactionID an Empty record is retrieved. | ||
465 | * | ||
466 | */ | ||
467 | template<class Dialog, class Record, typename Id> | ||
468 | Record OModalHelper<Dialog, Record, Id>::record( TransactionID tid)const { | ||
469 | if (m_transactions.contains( tid ) ) | ||
470 | return m_ids[ m_transactions[tid] ]; | ||
471 | else if (m_done.contains( tid ) ) { | ||
472 | Record rec = m_doneIds[ m_done[ tid] ]; | ||
473 | m_doneIds.remove( m_done[ tid ] ); | ||
474 | m_done.remove( tid ); | ||
475 | return rec; | ||
476 | }else | ||
477 | return Record(); | ||
478 | } | ||
479 | |||
480 | /** | ||
481 | * Returns all done Records and removes all references to them internally. A 2nd call to this will | ||
482 | * only contain done record that where edited past the point | ||
483 | */ | ||
484 | template<class Dialog, class Record, typename Id> | ||
485 | OModalHelper<Dialog,Record,Id>::RecordList OModalHelper<Dialog, Record, Id>::recordsDone()const { | ||
486 | RecordList list; | ||
487 | |||
488 | for (IdMap::ConstIterator it = m_doneIds.begin(); it != m_doneIds.end(); ++it ) | ||
489 | list.append( it.data() ); | ||
490 | |||
491 | /* clean up */ | ||
492 | m_done.clear(); | ||
493 | m_doneIds.clear(); | ||
494 | |||
495 | return list; | ||
496 | } | ||
497 | |||
498 | |||
499 | /** | ||
500 | * @internal | ||
501 | */ | ||
502 | template<class Dialog, class Record, typename Id> | ||
503 | void OModalHelper<Dialog, Record, Id>::done( int status, TransactionID tid) { | ||
504 | /* If we're in New mode the transaction Id does not count */ | ||
505 | Record rec; | ||
506 | |||
507 | if (m_mode == New ) { | ||
508 | Dialog *dia = static_cast<Dialog*>( m_controler->dialog() ); | ||
509 | m_controler->setTransactionID( 0 ); // set the internal dialog to 0l again | ||
510 | tid = m_editing[ dia ]; | ||
511 | m_editing.remove( dia ); | ||
512 | rec = dia->record(); | ||
513 | delete dia; | ||
514 | }else | ||
515 | rec = queuedDialog()->record(); | ||
516 | |||
517 | Id id = m_transactions[ tid ]; | ||
518 | if (result == QDialog::Accept ) { | ||
519 | m_doneIds.insert( is, rec ); | ||
520 | m_done.insert( tid, id ); | ||
521 | } | ||
522 | |||
523 | m_transactions.remove( tid ); | ||
524 | m_ids.remove( id ); | ||
525 | |||
526 | |||
527 | if (status == QDialog::Accept ) | ||
528 | emit m_signal->accepted( tid ); | ||
529 | else | ||
530 | emit m_signal->rejected( tid ); | ||
531 | |||
532 | emit m_signal->done( result, tid ); | ||
533 | |||
534 | next( 0 ); | ||
535 | } | ||
536 | |||
537 | /** | ||
538 | * @internal | ||
539 | */ | ||
540 | template<class Dialog, class Record, typename Id> | ||
541 | void OModalHelper<Dialog, Record, Id>::next( TransactionID tid) { | ||
542 | if (m_mode == New ) | ||
543 | return; | ||
544 | |||
545 | if (! (m_transactions.count() ) ) { | ||
546 | m_controler->setTransactionID( 0 ); | ||
547 | queuedDialog()->setRecord( 0, 0 ); | ||
548 | return; | ||
549 | } | ||
550 | |||
551 | int next; | ||
552 | Record rec; | ||
553 | |||
554 | /* save the maybe edited record before switching */ | ||
555 | Dialog *dia = static_cast<Dialog*>( queuedDialog()->centerDialog() ); | ||
556 | rec = dia->record(); | ||
557 | m_ids.replace( m_transactions[tid], rec ); | ||
558 | |||
559 | rec = nextRecord( tid, next ); | ||
560 | queuedDialog()->setRecord( next, m_transactions.count() ); | ||
561 | dia->setRecord( rec ); | ||
562 | |||
563 | m_controler->setTransactionID( tid ); // was changed during the next call | ||
564 | } | ||
565 | |||
566 | /** | ||
567 | * @internal | ||
568 | */ | ||
569 | /* | ||
570 | * code duplication should create a template fcuntion | ||
571 | * which takes a pointer to a function ( next, prev ) function | ||
572 | */ | ||
573 | template<class Dialog, class Record, typename Id> | ||
574 | void OModalHelper<Dialog, Record, Id>::prev( TransactionID tid ) { | ||
575 | if (m_mode == New ) | ||
576 | return; | ||
577 | |||
578 | if (! (m_transactions.count()) ) { | ||
579 | m_controler->setTransactionID( 0 ); | ||
580 | queuedDialog()->setRecord( 0, 0 ); | ||
581 | return; | ||
582 | } | ||
583 | |||
584 | int prev; | ||
585 | Record rec; | ||
586 | |||
587 | /* save the maybe edited record before switching */ | ||
588 | Dialog *dia = static_cast<Dialog*>( queuedDialog()->centerDialog() ); | ||
589 | rec = dia->record(); | ||
590 | m_ids.replace( m_transactions[tid], rec ); | ||
591 | |||
592 | rec = prevRecord( tid, prev ); | ||
593 | queuedDialog()->setRecord( prev, m_transactions.count() ); | ||
594 | dia->setRecord( rec ); | ||
595 | |||
596 | m_controler->setTransactionID( tid ); // was changed during the next call | ||
597 | } | ||
598 | |||
599 | /** | ||
600 | * @internal | ||
601 | */ | ||
602 | template<class Dialog, class Record, typename Id> | ||
603 | Record OModalHelper<Dialog, Record, Id>::nextRecord( TransactionID &tid, int &po ) { | ||
604 | /* if tid is == 0 we will take the first one */ | ||
605 | /* pos starts at 1 here */ | ||
606 | /* we know we're only called if there are records */ | ||
607 | Record rec; | ||
608 | TransactionMap::Iterator it; | ||
609 | if (!tid ) { | ||
610 | po = 1; | ||
611 | TransactionMap::Iterator it = m_transactions.begin(); | ||
612 | }else{ | ||
613 | po = pos( tid ); | ||
614 | /* if it is the last take the first as next */ | ||
615 | if ( po == m_transactions.count() ) { | ||
616 | po = 1; | ||
617 | it = m_transactions.begin(); | ||
618 | }else { | ||
619 | /* we know we're not the last and there is one after us */ | ||
620 | it = m_transactions.find( tid ); | ||
621 | ++it; ++po; | ||
622 | } | ||
623 | } | ||
624 | |||
625 | tid = it.key(); | ||
626 | rec = m_ids[ tid ]; | ||
627 | return rec; | ||
628 | } | ||
629 | |||
630 | /** | ||
631 | * @internal | ||
632 | */ | ||
633 | template<class Dialog, class Record, typename Id> | ||
634 | Record OModalHelper<Dialog, Record, Id>::prevRecord( TransactionID& tid, int& pos ) { | ||
635 | /* if tid is == 0 we will take the first one */ | ||
636 | /* pos starts at 1 here */ | ||
637 | /* we know we're only called if there are records */ | ||
638 | Record rec; | ||
639 | TransactionMap::Iterator it; | ||
640 | if (!tid ) { | ||
641 | po = 1; | ||
642 | TransactionMap::Iterator it = m_transactions.begin(); | ||
643 | }else{ | ||
644 | po = pos( tid ); | ||
645 | /* if it is the last take the first as next */ | ||
646 | if ( po == 1 ) { | ||
647 | po = m_transactions.count(); | ||
648 | it = m_transactions.end(); | ||
649 | --it; | ||
650 | }else { | ||
651 | /* we know we're not the first and there is one before us */ | ||
652 | it = m_transactions.find( tid ); | ||
653 | --it; --po; | ||
654 | } | ||
655 | } | ||
656 | |||
657 | tid = it.key(); | ||
658 | rec = m_ids[ tid ]; | ||
659 | return rec; | ||
660 | } | ||
661 | |||
662 | /** | ||
663 | * @internal | ||
664 | */ | ||
665 | template<class Dialog, class Record, typename Id> | ||
666 | int OModalHelper<Dialog, Record, Id>::pos( TransactionID id)const { | ||
667 | int i = 1; | ||
668 | for ( TransactionMap::ConstIterator it = m_transactions.begin(); it != m_transactions.end(); ++it, i++ ) | ||
669 | if ( it.key() == id ) | ||
670 | return i; | ||
671 | |||
672 | |||
673 | return 0; | ||
674 | } | ||
675 | |||
676 | /** | ||
677 | * @internal | ||
678 | */ | ||
679 | template<class Dialog, class Record, typename Id> | ||
680 | Dialog* OModalHelper<Dialog, Record, Id>::newDialogRecord( const Record& rec ) { | ||
681 | Dialog* dia = new Dialog; | ||
682 | dia->setRecord( rec ); | ||
683 | dia->setDisabled( m_disabled ); | ||
684 | |||
685 | QObject::connect(dia, SIGNAL(done(int) ), | ||
686 | m_controler, SLOT(done(int) ) ); | ||
687 | |||
688 | /* FIXME big screen QPEApplication needs fixed*/ | ||
689 | dia->show(); | ||
690 | } | ||
691 | |||
692 | template<class Record, class Dialog, typename Id> | ||
693 | OModalHelperDialog* OModalHelper<Record, Dialog, Id>::queuedDialog()const{ | ||
694 | if (!m_dialog ) { | ||
695 | m_dialog = new OModalHelperDialog; | ||
696 | m_dialog->setEnabled( m_disabled ); | ||
697 | |||
698 | QObject::connect(m_dialog, SIGNAL(done(int) ), | ||
699 | m_controler, SLOT(done(int) ) ); | ||
700 | QObject::connect(m_dialog, SIGNAL(next() ), | ||
701 | m_controler, SLOT(next() ) ); | ||
702 | QObject::connect(m_dialog, SIGNAL(prev() ), | ||
703 | m_controler, SLOT(prev() ) ); | ||
704 | } | ||
705 | return m_dialog; | ||
706 | } | ||
707 | |||
708 | #endif | ||
diff --git a/libopie/big-screen/osplitter.cpp b/libopie/big-screen/osplitter.cpp deleted file mode 100644 index 0c9ed6c..0000000 --- a/libopie/big-screen/osplitter.cpp +++ b/dev/null | |||
@@ -1,583 +0,0 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@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 | #include <qvaluelist.h> | ||
30 | #include <qvbox.h> | ||
31 | |||
32 | #include <opie/otabwidget.h> | ||
33 | |||
34 | #include "osplitter.h" | ||
35 | |||
36 | |||
37 | /** | ||
38 | * | ||
39 | * This is the constructor of OSplitter | ||
40 | * You might want to call setSizeChange to tell | ||
41 | * OSplitter to change its layout when a specefic | ||
42 | * mark was crossed. OSplitter sets a default value. | ||
43 | * | ||
44 | * You cann add widget with addWidget to the OSplitter. | ||
45 | * OSplitter supports also grouping of Splitters where they | ||
46 | * can share one OTabBar in small screen mode. This can be used | ||
47 | * for email clients like vies but see the example. | ||
48 | * | ||
49 | * @param orient The orientation wether to layout horizontal or vertical | ||
50 | * @param parent The parent of this widget | ||
51 | * @param name The name passed on to QObject | ||
52 | * @param fl Additional widgets flags passed to QWidget | ||
53 | * | ||
54 | * @short single c'tor of the OSplitter | ||
55 | */ | ||
56 | OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl ) | ||
57 | : QFrame( parent, name, fl ) | ||
58 | { | ||
59 | m_orient = orient; | ||
60 | m_hbox = 0; | ||
61 | m_size_policy = 330; | ||
62 | setFontPropagation( AllChildren ); | ||
63 | setPalettePropagation( AllChildren ); | ||
64 | |||
65 | /* start by default with the tab widget */ | ||
66 | m_tabWidget = 0; | ||
67 | m_parentTab = 0; | ||
68 | changeTab(); | ||
69 | |||
70 | } | ||
71 | |||
72 | |||
73 | /** | ||
74 | * Destructor destructs this object and cleans up. All child | ||
75 | * widgets will be deleted | ||
76 | * @see addWidget | ||
77 | */ | ||
78 | OSplitter::~OSplitter() { | ||
79 | qWarning("Deleted Splitter"); | ||
80 | m_splitter.setAutoDelete( true ); | ||
81 | m_splitter.clear(); | ||
82 | |||
83 | delete m_hbox; | ||
84 | delete m_tabWidget; | ||
85 | } | ||
86 | |||
87 | |||
88 | /** | ||
89 | * Sets the label for the Splitter. This label will be used | ||
90 | * if a parent splitter is arranged as TabWidget but | ||
91 | * this splitter is in fullscreen mode. Then a tab with OSplitter::label() | ||
92 | * and iconName() gets added. | ||
93 | * | ||
94 | * @param name The name of the Label | ||
95 | */ | ||
96 | void OSplitter::setLabel( const QString& name ) { | ||
97 | m_name = name; | ||
98 | } | ||
99 | |||
100 | /** | ||
101 | * @see setLabel but this is for the icon retrieved by Resource | ||
102 | * | ||
103 | * @param name The name of the icon in example ( "zoom" ) | ||
104 | */ | ||
105 | void OSplitter::setIconName( const QString& name ) { | ||
106 | m_icon = name; | ||
107 | } | ||
108 | |||
109 | |||
110 | /** | ||
111 | * returns the iconName | ||
112 | * @see setIconName | ||
113 | */ | ||
114 | QString OSplitter::iconName()const { | ||
115 | return m_icon; | ||
116 | } | ||
117 | |||
118 | /** | ||
119 | * returns the label set with setLabel | ||
120 | * @see setLabel | ||
121 | */ | ||
122 | QString OSplitter::label()const { | ||
123 | return m_name; | ||
124 | } | ||
125 | |||
126 | /** | ||
127 | * This function sets the size change policy of the splitter. | ||
128 | * If this size marked is crossed the splitter will relayout. | ||
129 | * Note: that depending on the set Orientation it'll either look | ||
130 | * at the width or height. | ||
131 | * Note: If you want to from side to side view to tabbed view you need | ||
132 | * to make sure that the size you supply is not smaller than the minimum | ||
133 | * size of your added widgets. Note that if you use widgets like QComboBoxes | ||
134 | * you need to teach them to accept smaller sizes as well @see QWidget::setSizePolicy | ||
135 | * | ||
136 | * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter. | ||
137 | * @return void | ||
138 | */ | ||
139 | void OSplitter::setSizeChange( int width_height ) { | ||
140 | m_size_policy = width_height; | ||
141 | QSize sz(width(), height() ); | ||
142 | QResizeEvent ev(sz, sz ); | ||
143 | resizeEvent(&ev); | ||
144 | } | ||
145 | |||
146 | /** | ||
147 | * This functions allows to add another OSplitter and to share | ||
148 | * the OTabBar in small screen mode. The ownerships gets transfered. | ||
149 | * OSplitters are always added after normal widget items | ||
150 | */ | ||
151 | void OSplitter::addWidget( OSplitter* split ) { | ||
152 | m_splitter.append( split ); | ||
153 | |||
154 | /* | ||
155 | * set tab widget | ||
156 | */ | ||
157 | if (m_tabWidget ) | ||
158 | setTabWidget( m_parentTab ); | ||
159 | else{ | ||
160 | Opie::OSplitterContainer con; | ||
161 | con.widget =split; | ||
162 | addToBox( con ); | ||
163 | } | ||
164 | } | ||
165 | |||
166 | /* | ||
167 | * If in a tab it should be removed | ||
168 | * and if in a hbox the reparent kills it too | ||
169 | */ | ||
170 | /** | ||
171 | * This removes the splitter again. You currently need to call this | ||
172 | * before you delete or otherwise you can get mem corruption | ||
173 | * or other weird behaviour. | ||
174 | * Owner ship gets transfered back to you it's current parent | ||
175 | * is 0 | ||
176 | */ | ||
177 | void OSplitter::removeWidget( OSplitter* split) { | ||
178 | split->setTabWidget( 0 ); | ||
179 | split->reparent( 0, 0, QPoint(0, 0) ); | ||
180 | } | ||
181 | |||
182 | /** | ||
183 | * Adds a widget to the Splitter. The widgets gets inserted | ||
184 | * at the end of either the Box or TabWidget. | ||
185 | * Ownership gets transfered and the widgets gets reparented. | ||
186 | * Note: icon and label is only available on small screensizes | ||
187 | * if size is smaller than the mark | ||
188 | * Warning: No null checking of the widget is done. Only on debug | ||
189 | * a message will be outputtet | ||
190 | * | ||
191 | * @param wid The widget which will be added | ||
192 | * @param icon The icon of the possible Tab | ||
193 | * @param label The label of the possible Tab | ||
194 | */ | ||
195 | void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) { | ||
196 | #ifdef DEBUG | ||
197 | if (!wid ) { | ||
198 | qWarning("Widget is not valid!"); | ||
199 | return; | ||
200 | } | ||
201 | #endif | ||
202 | Opie::OSplitterContainer cont; | ||
203 | cont.widget = wid; | ||
204 | cont.icon =icon; | ||
205 | cont.name = label; | ||
206 | |||
207 | m_container.append( cont ); | ||
208 | |||
209 | /* | ||
210 | * | ||
211 | */ | ||
212 | if (!m_splitter.isEmpty() && (m_tabWidget || m_parentTab ) ) | ||
213 | setTabWidget( m_parentTab ); | ||
214 | else { | ||
215 | if (m_hbox ) | ||
216 | addToBox( cont ); | ||
217 | else | ||
218 | addToTab( cont ); | ||
219 | } | ||
220 | } | ||
221 | |||
222 | |||
223 | /** | ||
224 | * Removes the widget from the tab widgets if necessary. | ||
225 | * OSplitter drops ownership of this widget and the widget | ||
226 | * will be reparented i tto 0. | ||
227 | * The widget will not be deleted. | ||
228 | * | ||
229 | * @param w The widget to be removed | ||
230 | */ | ||
231 | void OSplitter::removeWidget( QWidget* w) { | ||
232 | ContainerList::Iterator it; | ||
233 | for ( it = m_container.begin(); it != m_container.end(); ++it ) | ||
234 | if ( (*it).widget == w ) | ||
235 | break; | ||
236 | |||
237 | if (it == m_container.end() ) | ||
238 | return; | ||
239 | |||
240 | |||
241 | /* only tab needs to be removed.. box recognizes it */ | ||
242 | if ( !m_hbox ) | ||
243 | removeFromTab( w ); | ||
244 | |||
245 | |||
246 | /* Find reparent it and remove it from our list */ | ||
247 | |||
248 | w->reparent( 0, 0, QPoint(0, 0)); | ||
249 | it = m_container.remove( it ); | ||
250 | |||
251 | } | ||
252 | |||
253 | |||
254 | /** | ||
255 | * This method will give focus to the widget. If in a tabwidget | ||
256 | * the tabbar will be changed | ||
257 | * | ||
258 | * @param w The widget which will be set the current one | ||
259 | */ | ||
260 | void OSplitter::setCurrentWidget( QWidget* w) { | ||
261 | if (m_tabWidget ) | ||
262 | m_tabWidget->setCurrentTab( w ); | ||
263 | // else | ||
264 | // m_hbox->setFocus( w ); | ||
265 | |||
266 | } | ||
267 | |||
268 | /** | ||
269 | * This is an overloaded member function and only differs in the | ||
270 | * argument it takes. | ||
271 | * Searches list of widgets for label. It'll pick the first label it finds | ||
272 | * | ||
273 | * @param label Label to look for. First match will be taken | ||
274 | */ | ||
275 | void OSplitter::setCurrentWidget( const QString& label ) { | ||
276 | ContainerList::Iterator it; | ||
277 | for (it = m_container.begin(); it != m_container.end(); ++it ) { | ||
278 | if ( (*it).name == label ) { | ||
279 | setCurrentWidget( (*it).widget ); | ||
280 | break; | ||
281 | } | ||
282 | } | ||
283 | } | ||
284 | |||
285 | /** | ||
286 | * This will only work when the TabWidget is active | ||
287 | * If everything is visible this signal is kindly ignored | ||
288 | * @see OTabWidget::setCurrentTab(int) | ||
289 | * | ||
290 | * @param tab The tab to make current | ||
291 | */ | ||
292 | void OSplitter::setCurrentWidget( int tab ) { | ||
293 | if (m_tabWidget ) | ||
294 | m_tabWidget->setCurrentTab( tab ); | ||
295 | } | ||
296 | |||
297 | /** | ||
298 | * return the currently activated widget if in tab widget mode | ||
299 | * or null because all widgets are visible | ||
300 | */ | ||
301 | QWidget* OSplitter::currentWidget() const{ | ||
302 | if (m_tabWidget) | ||
303 | return m_tabWidget->currentWidget(); | ||
304 | else if (m_parentTab ) | ||
305 | return m_parentTab->currentWidget(); | ||
306 | |||
307 | return 0l; | ||
308 | } | ||
309 | /* wrong */ | ||
310 | #if 0 | ||
311 | /** | ||
312 | * @reimplented for internal reasons | ||
313 | * returns the sizeHint of one of its sub widgets | ||
314 | */ | ||
315 | QSize OSplitter::sizeHint()const { | ||
316 | if (m_parentTab ) | ||
317 | return QFrame::sizeHint(); | ||
318 | |||
319 | if (m_hbox ) | ||
320 | return m_hbox->sizeHint(); | ||
321 | else | ||
322 | return m_tabWidget->sizeHint(); | ||
323 | } | ||
324 | |||
325 | QSize OSplitter::minimumSizeHint()const { | ||
326 | if (m_parentTab ) | ||
327 | return QFrame::minimumSizeHint(); | ||
328 | if (m_hbox) | ||
329 | return m_hbox->sizeHint(); | ||
330 | else | ||
331 | return m_tabWidget->sizeHint(); | ||
332 | } | ||
333 | #endif | ||
334 | |||
335 | /** | ||
336 | * @reimplemented for internal reasons | ||
337 | */ | ||
338 | void OSplitter::resizeEvent( QResizeEvent* res ) { | ||
339 | QFrame::resizeEvent( res ); | ||
340 | /* | ||
341 | * | ||
342 | */ | ||
343 | // qWarning("Old size was width = %d height = %d", res->oldSize().width(), res->oldSize().height() ); | ||
344 | bool mode = true; | ||
345 | qWarning("New size is width = %d height = %d %s", res->size().width(), res->size().height(), name() ); | ||
346 | if ( res->size().width() > m_size_policy && | ||
347 | m_orient == Horizontal ) { | ||
348 | changeHBox(); | ||
349 | mode = false; | ||
350 | }else if ( (res->size().width() <= m_size_policy && | ||
351 | m_orient == Horizontal ) || | ||
352 | (res->size().height() <= m_size_policy && | ||
353 | m_orient == Vertical ) ) { | ||
354 | changeTab(); | ||
355 | }else if ( res->size().height() > m_size_policy && | ||
356 | m_orient == Vertical ) { | ||
357 | qWarning("Changng to vbox %s", name() ); | ||
358 | changeVBox(); | ||
359 | mode = false; | ||
360 | } | ||
361 | |||
362 | emit sizeChanged(mode, m_orient ); | ||
363 | } | ||
364 | |||
365 | /* | ||
366 | * Adds a container to a tab either the parent tab | ||
367 | * or our own | ||
368 | */ | ||
369 | void OSplitter::addToTab( const Opie::OSplitterContainer& con ) { | ||
370 | QWidget *wid = con.widget; | ||
371 | // not needed widgetstack will reparent as well wid.reparent(m_tabWidget, wid->getWFlags(), QPoint(0, 0) ); | ||
372 | if (m_parentTab ) | ||
373 | m_parentTab->addTab( wid, con.icon, con.name ); | ||
374 | else | ||
375 | m_tabWidget->addTab( wid, con.icon, con.name ); | ||
376 | } | ||
377 | |||
378 | |||
379 | /* | ||
380 | * adds a container to the box | ||
381 | */ | ||
382 | void OSplitter::addToBox( const Opie::OSplitterContainer& con ) { | ||
383 | QWidget* wid = con.widget; | ||
384 | wid->reparent(m_hbox, 0, QPoint(0, 0) ); | ||
385 | } | ||
386 | |||
387 | |||
388 | /* | ||
389 | * Removes a widget from the tab | ||
390 | */ | ||
391 | void OSplitter::removeFromTab( QWidget* wid ) { | ||
392 | if (m_parentTab ) | ||
393 | m_parentTab->removePage( wid ); | ||
394 | else | ||
395 | m_tabWidget->removePage( wid ); | ||
396 | } | ||
397 | |||
398 | /* | ||
399 | * switches over to a OTabWidget layout | ||
400 | * it is recursive | ||
401 | */ | ||
402 | void OSplitter::changeTab() { | ||
403 | /* if we're the owner of the tab widget */ | ||
404 | if (m_tabWidget ) { | ||
405 | raise(); | ||
406 | show(); | ||
407 | m_tabWidget->setGeometry( frameRect() ); | ||
408 | return; | ||
409 | } | ||
410 | |||
411 | qWarning(" New Tab Widget %s", name() ); | ||
412 | /* | ||
413 | * and add all widgets this will reparent them | ||
414 | * delete m_hbox set it to 0 | ||
415 | * | ||
416 | */ | ||
417 | OTabWidget *tab; | ||
418 | if ( m_parentTab ) { | ||
419 | hide(); | ||
420 | tab = m_parentTab; | ||
421 | /* expensive but needed cause we're called from setTabWidget and resizeEvent*/ | ||
422 | if (!m_container.isEmpty() ) { | ||
423 | ContainerList::Iterator it = m_container.begin(); | ||
424 | for (; it != m_container.end(); ++it ) | ||
425 | m_parentTab->removePage( (*it).widget ); | ||
426 | } | ||
427 | }else | ||
428 | tab = m_tabWidget = new OTabWidget( this ); | ||
429 | |||
430 | connect(tab, SIGNAL(currentChanged(QWidget*) ), | ||
431 | this, SIGNAL(currentChanged(QWidget*) ) ); | ||
432 | |||
433 | for ( ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { | ||
434 | qWarning("Widget is %s", (*it).name.latin1() ); | ||
435 | addToTab( (*it) ); | ||
436 | } | ||
437 | |||
438 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { | ||
439 | split->reparent(this, 0, QPoint(0, 0) ); | ||
440 | split->setTabWidget( tab ); | ||
441 | } | ||
442 | |||
443 | |||
444 | delete m_hbox; | ||
445 | m_hbox = 0; | ||
446 | if (!m_tabWidget ) | ||
447 | return; | ||
448 | |||
449 | m_tabWidget->setGeometry( frameRect() ); | ||
450 | m_tabWidget->show(); | ||
451 | |||
452 | } | ||
453 | |||
454 | /* | ||
455 | * changes over to a box | ||
456 | * this is recursive as well | ||
457 | */ | ||
458 | void OSplitter::changeHBox() { | ||
459 | if (m_hbox ) { | ||
460 | m_hbox->setGeometry( frameRect() ); | ||
461 | return; | ||
462 | } | ||
463 | |||
464 | qWarning("new HBox %s", name() ); | ||
465 | m_hbox = new QHBox( this ); | ||
466 | commonChangeBox(); | ||
467 | } | ||
468 | |||
469 | void OSplitter::changeVBox() { | ||
470 | if (m_hbox ) { | ||
471 | m_hbox->setGeometry( frameRect() ); | ||
472 | return; | ||
473 | } | ||
474 | |||
475 | qWarning("New VBOX %s", name() ); | ||
476 | m_hbox = new QVBox( this ); | ||
477 | |||
478 | commonChangeBox(); | ||
479 | |||
480 | } | ||
481 | |||
482 | /* | ||
483 | * common box code | ||
484 | * first remove and add children | ||
485 | * the other splitters | ||
486 | * it is recursive as well due the call to setTabWidget | ||
487 | */ | ||
488 | void OSplitter::commonChangeBox() { | ||
489 | qWarning(" Name of Splitters is %s", name() ); | ||
490 | |||
491 | for (ContainerList::Iterator it = m_container.begin(); it != m_container.end(); ++it ) { | ||
492 | /* only if parent tab.. m_tabWidgets gets deleted and would do that as well */ | ||
493 | if (m_parentTab ) | ||
494 | removeFromTab( (*it).widget ); | ||
495 | qWarning("Adding to box %s", (*it).name.latin1() ); | ||
496 | addToBox( (*it) ); | ||
497 | } | ||
498 | for ( OSplitter* split = m_splitter.first(); split; split = m_splitter.next() ) { | ||
499 | /* tell them the world had changed */ | ||
500 | split->setTabWidget( 0 ); | ||
501 | Opie::OSplitterContainer con; | ||
502 | con.widget = split; | ||
503 | // con.widget = split->m_tabWidget ? static_cast<QWidget*>(split->m_tabWidget) | ||
504 | // : static_cast<QWidget*>(split->m_hbox); | ||
505 | addToBox( con ); | ||
506 | } | ||
507 | |||
508 | |||
509 | |||
510 | if (m_parentTab ) | ||
511 | m_parentTab->addTab(m_hbox, iconName(), label() ); | ||
512 | else { | ||
513 | qWarning(" setting Box geometry for %s", name() ); | ||
514 | m_hbox->setGeometry( frameRect() ); | ||
515 | m_hbox->show(); | ||
516 | delete m_tabWidget; | ||
517 | m_tabWidget = 0; | ||
518 | show(); // also show this widget | ||
519 | } | ||
520 | } | ||
521 | |||
522 | /* | ||
523 | * sets the tabwidget, removes tabs, and relayouts the widget | ||
524 | */ | ||
525 | void OSplitter::setTabWidget( OTabWidget* wid) { | ||
526 | /* clean up cause m_parentTab will not be available for us */ | ||
527 | if ( m_parentTab ) { | ||
528 | if (m_hbox ) | ||
529 | m_parentTab->removePage( m_hbox ); | ||
530 | else if (!m_container.isEmpty() ){ | ||
531 | ContainerList::Iterator it = m_container.begin(); | ||
532 | for ( ; it != m_container.end(); ++it ) | ||
533 | m_parentTab->removePage( (*it).widget ); | ||
534 | } | ||
535 | } | ||
536 | /* the parent Splitter changed so either make us indepent or dep */ | ||
537 | |||
538 | m_parentTab = wid; | ||
539 | |||
540 | QWidget *tab = m_tabWidget; | ||
541 | QWidget *box = m_hbox; | ||
542 | m_hbox = 0; m_tabWidget = 0; | ||
543 | |||
544 | if ( layoutMode() ) | ||
545 | changeTab(); | ||
546 | else if (m_orient == Horizontal ) | ||
547 | changeHBox(); | ||
548 | else | ||
549 | changeVBox(); | ||
550 | |||
551 | /* our own crap is added and children from change* */ | ||
552 | delete tab; | ||
553 | delete box; | ||
554 | } | ||
555 | |||
556 | |||
557 | #if 0 | ||
558 | void OSplitter::reparentAll() { | ||
559 | if (m_container.isEmpty() ) | ||
560 | return; | ||
561 | |||
562 | ContainerList::Iterator it = m_container.begin(); | ||
563 | for ( ; it != m_container.end(); ++it ) | ||
564 | (*it).wid->reparent(0, 0, QPoint(0, 0) ); | ||
565 | |||
566 | |||
567 | } | ||
568 | #endif | ||
569 | |||
570 | /** | ||
571 | * @internal | ||
572 | */ | ||
573 | bool OSplitter::layoutMode()const { | ||
574 | if ( size().width() > m_size_policy && | ||
575 | m_orient == Horizontal ) { | ||
576 | return false; | ||
577 | }else if ( size().height() > m_size_policy && | ||
578 | m_orient == Vertical ) { | ||
579 | return false; | ||
580 | } | ||
581 | |||
582 | return true; | ||
583 | } | ||
diff --git a/libopie/big-screen/osplitter.h b/libopie/big-screen/osplitter.h deleted file mode 100644 index 61a247b..0000000 --- a/libopie/big-screen/osplitter.h +++ b/dev/null | |||
@@ -1,146 +0,0 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@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 | #ifndef OPIE_SPLITTER_H | ||
30 | #define OPIE_SPLITTER_H | ||
31 | |||
32 | #include <qstring.h> | ||
33 | |||
34 | #include <qframe.h> | ||
35 | #include <qvaluelist.h> | ||
36 | #include <qlist.h> | ||
37 | |||
38 | #include "obigscreen_p.h" | ||
39 | |||
40 | /* forward declarations */ | ||
41 | class OTabWidget; | ||
42 | class QHBox; | ||
43 | //template class QValueList<Opie::OSplitterContainer>; | ||
44 | |||
45 | /* | ||
46 | * TODO | ||
47 | * -check API docu | ||
48 | * -one more example | ||
49 | * -allow inserting at a position | ||
50 | */ | ||
51 | |||
52 | /** | ||
53 | * | ||
54 | * If you've widgets that could be placed side by side but you think | ||
55 | * on small resolutions is not enough place but it would really make sense | ||
56 | * on bigger resolutions this class will help you. | ||
57 | * You can add as many widgets you want to it. Set a poliy on which width/height it | ||
58 | * should switch the layout. | ||
59 | * You can either say to place widgets vertical or horizontal. | ||
60 | * This class uses QHBox, QVBox and QTAbWidget internally. | ||
61 | * OSplitter takes ownership of the widgets | ||
62 | * | ||
63 | * @since 1.2 | ||
64 | * | ||
65 | * @short a small dynamically changing its layout to store two or more widgets side by side | ||
66 | * @version 0.1 | ||
67 | * @author zecke | ||
68 | */ | ||
69 | class OSplitter : public QFrame{ | ||
70 | Q_OBJECT | ||
71 | public: | ||
72 | typedef QValueList<Opie::OSplitterContainer> ContainerList; | ||
73 | OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0, | ||
74 | const char* name = 0, WFlags fl = 0 ); | ||
75 | ~OSplitter(); | ||
76 | |||
77 | void setLabel( const QString& name ); | ||
78 | void setIconName( const QString& name ); | ||
79 | QString label()const; | ||
80 | QString iconName()const; | ||
81 | |||
82 | void setSizeChange( int width_height ); | ||
83 | |||
84 | void addWidget( OSplitter* splitter ); | ||
85 | void addWidget( QWidget* wid, const QString& icon, const QString& label ); | ||
86 | void removeWidget( QWidget* ); | ||
87 | void removeWidget( OSplitter* ); | ||
88 | |||
89 | void setCurrentWidget( QWidget* ); | ||
90 | void setCurrentWidget( const QString& label ); | ||
91 | void setCurrentWidget( int ); | ||
92 | QWidget* currentWidget()const; | ||
93 | |||
94 | |||
95 | signals: | ||
96 | /** | ||
97 | * Emitted if in tab and comes directly from the tab widget | ||
98 | * | ||
99 | */ | ||
100 | void currentChanged( QWidget* ); | ||
101 | |||
102 | /** | ||
103 | * emitted whenever a border is crossed | ||
104 | * true if in small screen mode | ||
105 | * false if in bigscreen | ||
106 | * this signal is emitted after the layout switch | ||
107 | * @param b The layout mode | ||
108 | * @param ori The orientation | ||
109 | */ | ||
110 | void sizeChanged( bool b, Orientation ori); | ||
111 | public: | ||
112 | // QSize sizeHint()const; | ||
113 | // QSize minimumSizeHint()const; | ||
114 | |||
115 | protected: | ||
116 | void resizeEvent( QResizeEvent* ); | ||
117 | |||
118 | private: | ||
119 | /* true if OTabMode */ | ||
120 | bool layoutMode()const; | ||
121 | // void reparentAll(); | ||
122 | void setTabWidget( OTabWidget*); | ||
123 | void addToTab( const Opie::OSplitterContainer& ); | ||
124 | void addToBox( const Opie::OSplitterContainer& ); | ||
125 | void removeFromTab( QWidget* ); | ||
126 | void changeTab(); | ||
127 | void changeHBox(); | ||
128 | void changeVBox(); | ||
129 | void commonChangeBox(); | ||
130 | QHBox *m_hbox; | ||
131 | OTabWidget *m_tabWidget; | ||
132 | OTabWidget *m_parentTab; | ||
133 | Orientation m_orient; | ||
134 | int m_size_policy; | ||
135 | |||
136 | ContainerList m_container; | ||
137 | QList<OSplitter> m_splitter; | ||
138 | |||
139 | QString m_icon, m_name; | ||
140 | |||
141 | struct Private; | ||
142 | Private *d; | ||
143 | }; | ||
144 | |||
145 | |||
146 | #endif | ||
diff --git a/libopie/big-screen/owidgetstack.cpp b/libopie/big-screen/owidgetstack.cpp deleted file mode 100644 index 967c54b..0000000 --- a/libopie/big-screen/owidgetstack.cpp +++ b/dev/null | |||
@@ -1,404 +0,0 @@ | |||
1 | #include <qapplication.h> | ||
2 | #include <qwidgetstack.h> | ||
3 | |||
4 | #include "owidgetstack.h" | ||
5 | |||
6 | namespace { | ||
7 | const int mode_size = 330; | ||
8 | } | ||
9 | |||
10 | /** | ||
11 | * This is the standard widget. For simple usage see the example. Normally this widget | ||
12 | * is the central widget of a QMainWindow. | ||
13 | * Use removeWidget before you delete a widget yourself. OWidgetStack does not | ||
14 | * yet recognize removal of children. | ||
15 | * | ||
16 | * @param parent The parent widget. It maybe 0 but then you need to take care of deletion. | ||
17 | * Or you use QPEApplication::showMainWidget(). | ||
18 | * @param name Name will be passed on to QObject | ||
19 | * @param fl Additional window flags passed to QFrame. see @Qt::WFlags | ||
20 | */ | ||
21 | OWidgetStack::OWidgetStack( QWidget* parent, const char* name, WFlags fl) | ||
22 | : QFrame( parent, name, fl ) | ||
23 | { | ||
24 | m_last = m_mWidget = 0; | ||
25 | m_forced = false; | ||
26 | |||
27 | QApplication::desktop()->installEventFilter( this ); | ||
28 | setFontPropagation ( AllChildren ); | ||
29 | setPalettePropagation( AllChildren ); | ||
30 | |||
31 | /* sets m_mode and initializes more */ | ||
32 | /* if you change this call change switchTop as well */ | ||
33 | m_stack = 0; | ||
34 | switchStack(); | ||
35 | } | ||
36 | |||
37 | /** | ||
38 | * The destructor. It deletes also all added widgets. | ||
39 | * | ||
40 | */ | ||
41 | OWidgetStack::~OWidgetStack() { | ||
42 | if (m_mode == BigScreen && !m_list.isEmpty() ) { | ||
43 | QMap<int, QWidget*>::Iterator it = m_list.begin(); | ||
44 | for ( ; it != m_list.end(); ++it ) | ||
45 | delete it.data(); | ||
46 | } | ||
47 | m_list.clear(); | ||
48 | |||
49 | } | ||
50 | |||
51 | /** | ||
52 | * return the mode of the desktop. There are currently two modes. SmallScreen | ||
53 | * with a normal PDA resolution and BigScreen with resolutions greater than | ||
54 | * 330 for width and height. | ||
55 | * You can also force the mode this widget is in with forceMode() | ||
56 | * Note that NoForce will be never returned from here | ||
57 | */ | ||
58 | enum OWidgetStack::Mode OWidgetStack::mode()const { | ||
59 | return m_mode; | ||
60 | } | ||
61 | |||
62 | /** | ||
63 | * You can also force one of the modes and then | ||
64 | * this widget stops on listening to size changes. You | ||
65 | * can revert to the scanning behaviour by setting mode | ||
66 | * to NoForce | ||
67 | */ | ||
68 | void OWidgetStack::forceMode( enum Mode mode) { | ||
69 | m_forced = mode != NoForce; | ||
70 | |||
71 | /* we need to see which mode we're in */ | ||
72 | if (!m_forced ) { | ||
73 | if ( QApplication::desktop()->width() >= | ||
74 | mode_size ) | ||
75 | mode = BigScreen; | ||
76 | else | ||
77 | mode = SmallScreen; | ||
78 | } | ||
79 | switch( mode ) { | ||
80 | case NoForce: | ||
81 | case SmallScreen: | ||
82 | switchStack(); | ||
83 | break; | ||
84 | case BigScreen: | ||
85 | switchTop(); | ||
86 | break; | ||
87 | |||
88 | } | ||
89 | |||
90 | m_mode = mode; | ||
91 | } | ||
92 | |||
93 | /** | ||
94 | * Adds a widget to the stack. The first widget added is considered | ||
95 | * to be the mainwindow. This is important because if Opie is in | ||
96 | * BigScreen mode the sizeHint of the MainWindow will be returned. | ||
97 | * In Small Screen the sizeHint of the QWidgetStack is returned. | ||
98 | * See QWidgetStack::sizeHint. | ||
99 | * This widget takes ownership of the widget and may even reparent. | ||
100 | * All windows will be hidden | ||
101 | * | ||
102 | * @param wid The QWidget to be added | ||
103 | * @param id An ID for the Widget. If the ID is duplicated the | ||
104 | last set widget will be related to the id | ||
105 | * | ||
106 | */ | ||
107 | void OWidgetStack::addWidget( QWidget* wid, int id) { | ||
108 | if (!wid) | ||
109 | return; | ||
110 | |||
111 | /* set our main widget */ | ||
112 | if (!m_mWidget) | ||
113 | m_mWidget = wid; | ||
114 | |||
115 | m_list.insert( id, wid ); | ||
116 | |||
117 | /** | ||
118 | * adding does not raise any widget | ||
119 | * But for our mainwidget we prepare | ||
120 | * the right position with the right parent | ||
121 | */ | ||
122 | if (m_mode == SmallScreen ) | ||
123 | m_stack->addWidget( wid,id ); | ||
124 | else if ( m_mWidget == wid ) { | ||
125 | wid->reparent(this, 0, contentsRect().topLeft() ); | ||
126 | wid->hide(); | ||
127 | }else { | ||
128 | wid->reparent(0, WType_TopLevel, QPoint(10, 10) ); | ||
129 | wid->hide(); | ||
130 | } | ||
131 | } | ||
132 | |||
133 | |||
134 | /** | ||
135 | * Remove the widget from the stack it'll be reparented to 0 | ||
136 | * and ownership is dropped. You need to delete it. | ||
137 | * If the removed widget was the mainwindow consider | ||
138 | * to call setMainWindow. | ||
139 | * | ||
140 | * @param wid The QWidget to be removed | ||
141 | */ | ||
142 | void OWidgetStack::removeWidget( QWidget* wid) { | ||
143 | if (!wid) | ||
144 | return; | ||
145 | |||
146 | if (m_mode == SmallScreen ) | ||
147 | m_stack->removeWidget( wid ); | ||
148 | |||
149 | |||
150 | wid->reparent(0, 0, QPoint(0, 0) ); | ||
151 | m_list.remove( id(wid) ); | ||
152 | |||
153 | if ( wid == m_mWidget ) | ||
154 | m_mWidget = 0; | ||
155 | } | ||
156 | |||
157 | #if 0 | ||
158 | /** | ||
159 | * @internal_resons | ||
160 | */ | ||
161 | QSizeHint OWidgetStack::sizeHint()const { | ||
162 | |||
163 | } | ||
164 | |||
165 | /** | ||
166 | * @internal_reasons | ||
167 | */ | ||
168 | QSizeHint OWidgetStack::minimumSizeHint()const { | ||
169 | |||
170 | } | ||
171 | #endif | ||
172 | |||
173 | /** | ||
174 | * This function tries to find the widget with the id. | ||
175 | * You supplied a possible id in addWIdget. Note that not | ||
176 | * QWidget::winId() is used. | ||
177 | * | ||
178 | * @param id The id to search for | ||
179 | * | ||
180 | * @return The widget or null | ||
181 | * @see addWidget | ||
182 | */ | ||
183 | QWidget* OWidgetStack::widget( int id) const { | ||
184 | return m_list[id]; | ||
185 | } | ||
186 | |||
187 | /** | ||
188 | * Tries to find the assigned id for the widget | ||
189 | * or returns -1 if no widget could be found | ||
190 | * @param wid The widget to look for | ||
191 | */ | ||
192 | int OWidgetStack::id( QWidget* wid)const{ | ||
193 | if (m_list.isEmpty() ) | ||
194 | return -1; | ||
195 | |||
196 | QMap<int, QWidget*>::ConstIterator it = m_list.begin(); | ||
197 | for ( ; it != m_list.end(); ++it ) | ||
198 | if ( it.data() == wid ) | ||
199 | break; | ||
200 | |||
201 | /* if not at the end return the key */ | ||
202 | return it == m_list.end() ? -1 : it.key(); | ||
203 | } | ||
204 | |||
205 | |||
206 | /** | ||
207 | * This function returns the currently visible | ||
208 | * widget. In BigScreen mode the mainwindow | ||
209 | * is returned | ||
210 | */ | ||
211 | QWidget* OWidgetStack::visibleWidget()const { | ||
212 | if (m_mode == SmallScreen ) | ||
213 | return m_stack->visibleWidget(); | ||
214 | else | ||
215 | return m_mWidget; | ||
216 | |||
217 | } | ||
218 | |||
219 | /** | ||
220 | * This method raises the widget wit the specefic id. | ||
221 | * Note that in BigScreen mode the widget is made visible | ||
222 | * but the other ( previous) visible widget(s) will not | ||
223 | * be made invisible. If you need this use hideWidget(). | ||
224 | * | ||
225 | * @param id Raise the widget with id | ||
226 | */ | ||
227 | void OWidgetStack::raiseWidget( int id) { | ||
228 | return raiseWidget( widget( id ) ); | ||
229 | } | ||
230 | |||
231 | /** | ||
232 | * This is an overloaded function and only differs in its parameters. | ||
233 | * @see raiseWidget( int ) | ||
234 | */ | ||
235 | void OWidgetStack::raiseWidget( QWidget* wid) { | ||
236 | m_last = wid; | ||
237 | if (m_mode == SmallScreen ) | ||
238 | m_stack->raiseWidget( wid ); | ||
239 | else { | ||
240 | int ide; | ||
241 | emit aboutToShow( wid ); | ||
242 | /* if someone is connected and the widget is actually available */ | ||
243 | if ( receivers( SIGNAL(aboutToShow(int) ) ) && | ||
244 | ( (ide = id( wid ) ) != -1 ) ) | ||
245 | emit aboutToShow( ide ); | ||
246 | |||
247 | /* ### FIXME PLACE THE WIDGET right */ | ||
248 | wid->show(); | ||
249 | } | ||
250 | } | ||
251 | |||
252 | /** | ||
253 | * This will hide the currently visible widget | ||
254 | * and raise the widget specified by the parameter. | ||
255 | * Note that this method does not use visibleWIdget but remembers | ||
256 | * the last raisedWidget | ||
257 | */ | ||
258 | void OWidgetStack::hideWidget( int id) { | ||
259 | /* hiding our main widget wouldn't be smart */ | ||
260 | if ( m_mode == BigScreen && m_last != m_mWidget ) | ||
261 | m_last->hide(); | ||
262 | raiseWidget( id ); | ||
263 | } | ||
264 | |||
265 | /** | ||
266 | * This is overloaded and only differs in the parameters | ||
267 | * it takes. | ||
268 | */ | ||
269 | void OWidgetStack::hideWidget( QWidget* wid) { | ||
270 | /* still not smart */ | ||
271 | if ( m_mode == BigScreen && m_last != m_mWidget ) | ||
272 | m_last->hide(); | ||
273 | |||
274 | raiseWidget( wid ); | ||
275 | } | ||
276 | |||
277 | |||
278 | bool OWidgetStack::eventFilter( QObject* obj, QEvent* e) { | ||
279 | qWarning(" %s %s", obj->name(), obj->className() ); | ||
280 | if ( e->type() == QEvent::Resize ) { | ||
281 | QResizeEvent *res = static_cast<QResizeEvent*>( e ); | ||
282 | QSize size = res->size(); | ||
283 | if ( size.width() >= mode_size ) | ||
284 | switchTop(); | ||
285 | else | ||
286 | switchStack(); | ||
287 | } | ||
288 | return false; | ||
289 | } | ||
290 | |||
291 | |||
292 | /** | ||
293 | * @internal_resons | ||
294 | */ | ||
295 | void OWidgetStack::resizeEvent( QResizeEvent* ev ) { | ||
296 | QFrame::resizeEvent( ev ); | ||
297 | if (m_mode == SmallScreen ) | ||
298 | m_stack->setGeometry( frameRect() ); | ||
299 | else | ||
300 | if (m_mWidget ) | ||
301 | m_mWidget->setGeometry( frameRect() ); | ||
302 | |||
303 | } | ||
304 | |||
305 | /** | ||
306 | * setMainWindow gives the OWidgetStack a hint which | ||
307 | * window should always stay inside the stack. | ||
308 | * Normally the first added widget is considered to be | ||
309 | * the mainwindow but you can change this with this | ||
310 | * function. | ||
311 | * If in BigScreen mode the current mainwindow will be reparented | ||
312 | * and hidden. The position will be taken by the new one. | ||
313 | * If the old MainWindow was hidden the new window will | ||
314 | * also be hidden. If the window was visible the new mainwindow | ||
315 | * will be made visible too and the old one hidden. If there | ||
316 | * was no mainwindow it will be hidden as well. | ||
317 | * | ||
318 | * @param wid The new mainwindow | ||
319 | */ | ||
320 | void OWidgetStack::setMainWindow( QWidget* wid ) { | ||
321 | if (m_mode == BigScreen ) { | ||
322 | bool wasVisible = false; | ||
323 | if (m_mWidget ) { | ||
324 | wasVisible = !m_mWidget->isHidden(); | ||
325 | /* hidden by default */ | ||
326 | m_mWidget->reparent(0, WType_TopLevel, QPoint(10, 10) ); | ||
327 | } | ||
328 | wid->reparent(this, 0, frameRect().topLeft() ); | ||
329 | |||
330 | if (wasVisible) | ||
331 | wid->show(); | ||
332 | } | ||
333 | |||
334 | m_mWidget = wid; | ||
335 | } | ||
336 | |||
337 | /** | ||
338 | * this is an overloaded member and only differs | ||
339 | * in the type of arguments. | ||
340 | * @see setMainWindow(QWidget*) | ||
341 | */ | ||
342 | void OWidgetStack::setMainWindow( int id) { | ||
343 | setMainWindow( widget( id ) ); | ||
344 | } | ||
345 | |||
346 | |||
347 | /* | ||
348 | * this function switches to a stack ;) | ||
349 | */ | ||
350 | void OWidgetStack::switchStack() { | ||
351 | if (m_stack ) { | ||
352 | m_stack->setGeometry( frameRect() ); | ||
353 | return; | ||
354 | } | ||
355 | |||
356 | m_mode = SmallScreen; | ||
357 | m_stack = new QWidgetStack(this); | ||
358 | |||
359 | connect(m_stack, SIGNAL(aboutToShow(QWidget*) ), | ||
360 | this, SIGNAL(aboutToShow(QWidget*) ) ); | ||
361 | connect(m_stack, SIGNAL(aboutToShow(int) ), | ||
362 | this, SIGNAL(aboutToShow(int) ) ); | ||
363 | |||
364 | /* now reparent the widgets... luckily QWidgetSatck does most of the work */ | ||
365 | if (m_list.isEmpty() ) | ||
366 | return; | ||
367 | |||
368 | QMap<int, QWidget*>::Iterator it = m_list.begin(); | ||
369 | for ( ; it != m_list.end(); ++it ) | ||
370 | m_stack->addWidget( it.data(), it.key() ); | ||
371 | |||
372 | |||
373 | } | ||
374 | |||
375 | /* | ||
376 | * we will switch to top level mode | ||
377 | * reparent the list of widgets and then delete the stack | ||
378 | */ | ||
379 | void OWidgetStack::switchTop() { | ||
380 | m_mode = BigScreen; | ||
381 | /* this works because it is guaranteed that switchStack was called at least once*/ | ||
382 | if (!m_stack && m_mWidget) { | ||
383 | m_mWidget->setGeometry( frameRect() ); | ||
384 | return; | ||
385 | }else if (!m_stack) | ||
386 | return; | ||
387 | |||
388 | if (!m_list.isEmpty() ) { | ||
389 | QMap<int, QWidget*>::Iterator it = m_list.begin(); | ||
390 | for ( ; it != m_list.end(); ++it ) { | ||
391 | /* better than reparenting twice */ | ||
392 | if ( it.data() == m_mWidget ) { | ||
393 | m_mWidget->reparent(this, 0, frameRect().topLeft() ); | ||
394 | m_mWidget->setGeometry( frameRect() ); | ||
395 | m_mWidget->show(); | ||
396 | }else | ||
397 | /* ### FIXME we need to place the widget better */ | ||
398 | it.data()->reparent(0, WType_TopLevel, QPoint(10, 10) ); | ||
399 | } | ||
400 | } | ||
401 | |||
402 | delete m_stack; | ||
403 | m_stack = 0; | ||
404 | } | ||
diff --git a/libopie/big-screen/owidgetstack.h b/libopie/big-screen/owidgetstack.h deleted file mode 100644 index 5179213..0000000 --- a/libopie/big-screen/owidgetstack.h +++ b/dev/null | |||
@@ -1,127 +0,0 @@ | |||
1 | /* | ||
2 | =. This file is part of the OPIE Project | ||
3 | .=l. Copyright (c) 2003 hOlgAr <zecke@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 | #ifndef OPIE_BIG_WIDGET_STACK_H | ||
30 | #define OPIE_BIG_WIDGET_STACK_H | ||
31 | |||
32 | #include <qframe.h> | ||
33 | #include <qmap.h> | ||
34 | |||
35 | class QWidgetStack; | ||
36 | /** | ||
37 | * | ||
38 | * OWidgetStack is the answer to the problem of using Opie at different screen | ||
39 | * sizes and to have a different behaviour. Most applications use a QWidgetStack | ||
40 | * to supply a view on click. And by clicking the (X) you go back but this | ||
41 | * behaviour feels strange on bigger screens. It's ok on smaller one because | ||
42 | * one can't determine the difference. | ||
43 | * This stack reads the default out of the size of the desktop widget but | ||
44 | * can be forced to have either the one or the other behaviour. | ||
45 | * The first widget added is considered the 'main' widget and its | ||
46 | * sizeHint will be taking if in BigScreen mode. | ||
47 | * In small screen mode this widget behaves exactly like a QWidgetStack and in BigScreen | ||
48 | * mode it'll use the MainWindow as child of this widget and arranges the others as | ||
49 | * hidden top level widgets. | ||
50 | * | ||
51 | * @version 0.1 | ||
52 | * @author hOlgAr F. | ||
53 | * @short Either a true stack or a list of top Level widgets | ||
54 | */ | ||
55 | class OWidgetStack : public QFrame { | ||
56 | Q_OBJECT | ||
57 | public: | ||
58 | enum Mode { SmallScreen, BigScreen, NoForce }; | ||
59 | OWidgetStack( QWidget* parent, const char* name = 0, WFlags fl = 0 ); | ||
60 | ~OWidgetStack(); | ||
61 | |||
62 | enum Mode mode()const; | ||
63 | void forceMode( enum Mode ); | ||
64 | |||
65 | void addWidget( QWidget* , int ); | ||
66 | void removeWidget( QWidget* ); | ||
67 | |||
68 | // QSizeHint sizeHint()const; | ||
69 | // QSizeHint minimumSizeHint()const; | ||
70 | |||
71 | QWidget *widget( int )const; | ||
72 | int id( QWidget* )const; | ||
73 | |||
74 | |||
75 | |||
76 | QWidget* visibleWidget() const; | ||
77 | |||
78 | bool eventFilter( QObject*, QEvent* ); | ||
79 | signals: | ||
80 | /** | ||
81 | * OWidgetStack monitors the Desktop Widget for | ||
82 | * size changes if it recignizes a change size it'll | ||
83 | * send a signal and adjust its mode. After the signal | ||
84 | * was emitted. During the signal a call to mode() the | ||
85 | * old mode will be returned. Note that if a size change happens | ||
86 | * but no modeChange no signal will be emitted | ||
87 | * | ||
88 | * | ||
89 | * @param mode The new mode of the desktop | ||
90 | */ | ||
91 | void modeChanged( enum Mode mode); | ||
92 | |||
93 | /** | ||
94 | * These two signals are emitted whenever we're about to | ||
95 | * show one of the widgets | ||
96 | */ | ||
97 | void aboutToShow( QWidget* ); | ||
98 | void aboutToShow( int ); | ||
99 | |||
100 | public slots: | ||
101 | void raiseWidget( int ); | ||
102 | void raiseWidget( QWidget* ); | ||
103 | void hideWidget( int ); | ||
104 | void hideWidget( QWidget* ); | ||
105 | void setMainWindow( QWidget* ); | ||
106 | void setMainWindow( int ); | ||
107 | |||
108 | protected: | ||
109 | void resizeEvent( QResizeEvent* ); | ||
110 | |||
111 | private: | ||
112 | void switchStack(); | ||
113 | void switchTop(); | ||
114 | QMap<int, QWidget*> m_list; | ||
115 | QWidgetStack *m_stack; | ||
116 | QWidget *m_mWidget; | ||
117 | QWidget *m_last; | ||
118 | |||
119 | enum Mode m_mode; | ||
120 | bool m_forced : 1; | ||
121 | |||
122 | struct Private; | ||
123 | Private *d; | ||
124 | }; | ||
125 | |||
126 | |||
127 | #endif | ||
diff --git a/libopie/libopie.pro b/libopie/libopie.pro index a3d01ab..145743d 100644 --- a/libopie/libopie.pro +++ b/libopie/libopie.pro | |||
@@ -1,114 +1,113 @@ | |||
1 | TEMPLATE = lib | 1 | TEMPLATE = lib |
2 | CONFIG += qte warn_on release | 2 | CONFIG += qte warn_on release |
3 | HEADERS = ofontmenu.h \ | 3 | HEADERS = ofontmenu.h \ |
4 | ocolorbutton.h \ | 4 | ocolorbutton.h \ |
5 | ofiledialog.h ofileselector.h \ | 5 | ofiledialog.h ofileselector.h \ |
6 | ofileselector_p.h \ | 6 | ofileselector_p.h \ |
7 | ocheckitem.h \ | 7 | ocheckitem.h \ |
8 | xmltree.h \ | 8 | xmltree.h \ |
9 | colordialog.h colorpopupmenu.h \ | 9 | colordialog.h colorpopupmenu.h \ |
10 | oclickablelabel.h oprocctrl.h \ | 10 | oclickablelabel.h oprocctrl.h \ |
11 | oprocess.h odevice.h odevicebutton.h \ | 11 | oprocess.h odevice.h odevicebutton.h \ |
12 | otimepicker.h otabwidget.h \ | 12 | otimepicker.h otabwidget.h \ |
13 | otabbar.h otabinfo.h \ | 13 | otabbar.h otabinfo.h \ |
14 | ofontselector.h \ | 14 | ofontselector.h \ |
15 | pim/opimrecord.h \ | 15 | pim/opimrecord.h \ |
16 | pim/otodo.h \ | 16 | pim/otodo.h \ |
17 | pim/orecordlist.h \ | 17 | pim/orecordlist.h \ |
18 | pim/opimaccesstemplate.h \ | 18 | pim/opimaccesstemplate.h \ |
19 | pim/opimaccessbackend.h \ | 19 | pim/opimaccessbackend.h \ |
20 | pim/otodoaccess.h \ | 20 | pim/otodoaccess.h \ |
21 | pim/otodoaccessbackend.h \ | 21 | pim/otodoaccessbackend.h \ |
22 | pim/oconversion.h \ | 22 | pim/oconversion.h \ |
23 | pim/ocontact.h \ | 23 | pim/ocontact.h \ |
24 | pim/ocontactfields.h \ | 24 | pim/ocontactfields.h \ |
25 | pim/ocontactaccess.h \ | 25 | pim/ocontactaccess.h \ |
26 | pim/ocontactaccessbackend.h \ | 26 | pim/ocontactaccessbackend.h \ |
27 | pim/ocontactaccessbackend_xml.h \ | 27 | pim/ocontactaccessbackend_xml.h \ |
28 | pim/ocontactaccessbackend_vcard.h \ | 28 | pim/ocontactaccessbackend_vcard.h \ |
29 | pim/obackendfactory.h \ | 29 | pim/obackendfactory.h \ |
30 | pim/opimcache.h \ | 30 | pim/opimcache.h \ |
31 | pim/otodoaccessvcal.h \ | 31 | pim/otodoaccessvcal.h \ |
32 | pim/orecur.h \ | 32 | pim/orecur.h \ |
33 | pim/opimstate.h \ | 33 | pim/opimstate.h \ |
34 | pim/opimxrefpartner.h \ | 34 | pim/opimxrefpartner.h \ |
35 | pim/opimxref.h \ | 35 | pim/opimxref.h \ |
36 | pim/opimxrefmanager.h \ | 36 | pim/opimxrefmanager.h \ |
37 | pim/opimmaintainer.h \ | 37 | pim/opimmaintainer.h \ |
38 | pim/opimnotify.h \ | 38 | pim/opimnotify.h \ |
39 | pim/opimnotifymanager.h \ | 39 | pim/opimnotifymanager.h \ |
40 | pim/opimmainwindow.h \ | 40 | pim/opimmainwindow.h \ |
41 | pim/opimresolver.h \ | 41 | pim/opimresolver.h \ |
42 | pim/oevent.h \ | 42 | pim/oevent.h \ |
43 | pim/otimezone.h \ | 43 | pim/otimezone.h \ |
44 | pim/odatebookaccess.h \ | 44 | pim/odatebookaccess.h \ |
45 | pim/odatebookaccessbackend.h \ | 45 | pim/odatebookaccessbackend.h \ |
46 | pim/odatebookaccessbackend_xml.h \ | 46 | pim/odatebookaccessbackend_xml.h \ |
47 | orecurrancewidget.h \ | 47 | orecurrancewidget.h \ |
48 | oticker.h owait.h | 48 | oticker.h owait.h |
49 | 49 | ||
50 | SOURCES = ofontmenu.cc \ | 50 | SOURCES = ofontmenu.cc \ |
51 | ocolorbutton.cpp \ | 51 | ocolorbutton.cpp \ |
52 | sharp_compat.cpp \ | 52 | sharp_compat.cpp \ |
53 | xmltree.cc \ | 53 | xmltree.cc \ |
54 | ofiledialog.cc ofileselector.cpp \ | 54 | ofiledialog.cc ofileselector.cpp \ |
55 | ocheckitem.cpp \ | 55 | ocheckitem.cpp \ |
56 | colordialog.cpp \ | 56 | colordialog.cpp \ |
57 | colorpopupmenu.cpp oclickablelabel.cpp \ | 57 | colorpopupmenu.cpp oclickablelabel.cpp \ |
58 | oprocctrl.cpp oprocess.cpp \ | 58 | oprocctrl.cpp oprocess.cpp \ |
59 | odevice.cpp odevicebutton.cpp otimepicker.cpp \ | 59 | odevice.cpp odevicebutton.cpp otimepicker.cpp \ |
60 | otabwidget.cpp otabbar.cpp \ | 60 | otabwidget.cpp otabbar.cpp \ |
61 | ofontselector.cpp \ | 61 | ofontselector.cpp \ |
62 | pim/otodo.cpp \ | 62 | pim/otodo.cpp \ |
63 | pim/opimrecord.cpp \ | 63 | pim/opimrecord.cpp \ |
64 | pim/otodoaccess.cpp \ | 64 | pim/otodoaccess.cpp \ |
65 | pim/otodoaccessbackend.cpp \ | 65 | pim/otodoaccessbackend.cpp \ |
66 | pim/otodoaccessxml.cpp \ | 66 | pim/otodoaccessxml.cpp \ |
67 | pim/oconversion.cpp \ | 67 | pim/oconversion.cpp \ |
68 | pim/ocontact.cpp \ | 68 | pim/ocontact.cpp \ |
69 | pim/ocontactfields.cpp \ | 69 | pim/ocontactfields.cpp \ |
70 | pim/ocontactaccess.cpp \ | 70 | pim/ocontactaccess.cpp \ |
71 | pim/ocontactaccessbackend_vcard.cpp \ | 71 | pim/ocontactaccessbackend_vcard.cpp \ |
72 | pim/ocontactaccessbackend_xml.cpp \ | 72 | pim/ocontactaccessbackend_xml.cpp \ |
73 | pim/otodoaccessvcal.cpp \ | 73 | pim/otodoaccessvcal.cpp \ |
74 | pim/orecur.cpp \ | 74 | pim/orecur.cpp \ |
75 | pim/opimstate.cpp \ | 75 | pim/opimstate.cpp \ |
76 | pim/opimxrefpartner.cpp \ | 76 | pim/opimxrefpartner.cpp \ |
77 | pim/opimxref.cpp \ | 77 | pim/opimxref.cpp \ |
78 | pim/opimxrefmanager.cpp \ | 78 | pim/opimxrefmanager.cpp \ |
79 | pim/opimmaintainer.cpp \ | 79 | pim/opimmaintainer.cpp \ |
80 | pim/opimnotify.cpp \ | 80 | pim/opimnotify.cpp \ |
81 | pim/opimnotifymanager.cpp \ | 81 | pim/opimnotifymanager.cpp \ |
82 | pim/opimmainwindow.cpp \ | 82 | pim/opimmainwindow.cpp \ |
83 | pim/opimresolver.cpp \ | 83 | pim/opimresolver.cpp \ |
84 | pim/oevent.cpp \ | 84 | pim/oevent.cpp \ |
85 | pim/otimezone.cpp \ | 85 | pim/otimezone.cpp \ |
86 | pim/odatebookaccess.cpp \ | 86 | pim/odatebookaccess.cpp \ |
87 | pim/odatebookaccessbackend.cpp \ | 87 | pim/odatebookaccessbackend.cpp \ |
88 | pim/odatebookaccessbackend_xml.cpp \ | 88 | pim/odatebookaccessbackend_xml.cpp \ |
89 | orecurrancewidget.cpp \ | 89 | orecurrancewidget.cpp \ |
90 | oticker.cpp owait.cpp | 90 | oticker.cpp owait.cpp |
91 | 91 | ||
92 | TARGET = opie | 92 | TARGET = opie |
93 | INCLUDEPATH += $(OPIEDIR)/include | 93 | INCLUDEPATH += $(OPIEDIR)/include |
94 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) | 94 | DESTDIR = $(OPIEDIR)/lib$(PROJMAK) |
95 | 95 | ||
96 | LIBS += -lqpe | 96 | LIBS += -lqpe |
97 | 97 | ||
98 | # Add SQL-Support if selected by config (eilers) | 98 | # Add SQL-Support if selected by config (eilers) |
99 | CONFTEST = $$system( echo $CONFIG_SQL_PIM_BACKEND ) | 99 | CONFTEST = $$system( echo $CONFIG_SQL_PIM_BACKEND ) |
100 | contains( CONFTEST, y ){ | 100 | contains( CONFTEST, y ){ |
101 | 101 | ||
102 | DEFINES += __USE_SQL | 102 | DEFINES += __USE_SQL |
103 | LIBS += -lopiedb2 | 103 | LIBS += -lopiedb2 |
104 | HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h pim/odatebookaccessbackend_sql.h | 104 | HEADERS += pim/otodoaccesssql.h pim/ocontactaccessbackend_sql.h pim/odatebookaccessbackend_sql.h |
105 | SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp pim/odatebookaccessbackend_sql.cpp | 105 | SOURCES += pim/otodoaccesssql.cpp pim/ocontactaccessbackend_sql.cpp pim/odatebookaccessbackend_sql.cpp |
106 | 106 | ||
107 | } | 107 | } |
108 | 108 | ||
109 | INTERFACES = otimepickerbase.ui orecurrancebase.ui | 109 | INTERFACES = otimepickerbase.ui orecurrancebase.ui |
110 | TARGET = opie | 110 | TARGET = opie |
111 | 111 | ||
112 | include ( big-screen/big-screen.pro ) | ||
113 | 112 | ||
114 | include ( $(OPIEDIR)/include.pro ) | 113 | include ( $(OPIEDIR)/include.pro ) |