summaryrefslogtreecommitdiff
authorzecke <zecke>2003-08-30 20:28:13 (UTC)
committer zecke <zecke>2003-08-30 20:28:13 (UTC)
commit43bcb5d6caf7bf2e8a31b61b7284a7c9299b6fd7 (patch) (unidiff)
tree020698c057a9193c9547415a65defe004534ab89
parent2f7bf038add502d20ab4c4e7faadba72e03d68fd (diff)
downloadopie-43bcb5d6caf7bf2e8a31b61b7284a7c9299b6fd7.zip
opie-43bcb5d6caf7bf2e8a31b61b7284a7c9299b6fd7.tar.gz
opie-43bcb5d6caf7bf2e8a31b61b7284a7c9299b6fd7.tar.bz2
Add IDEAS for Opie bigscreen extensions
and the first sketch of the OSplitter please take a look and comment
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie/big-screen/IDEAS81
-rw-r--r--libopie/big-screen/osplitter.cpp213
-rw-r--r--libopie/big-screen/osplitter.h102
3 files changed, 396 insertions, 0 deletions
diff --git a/libopie/big-screen/IDEAS b/libopie/big-screen/IDEAS
new file mode 100644
index 0000000..27a4d6e
--- a/dev/null
+++ b/libopie/big-screen/IDEAS
@@ -0,0 +1,81 @@
1Now that PDAs get a VGA resolution and Opie runs on Webpads
2and could be used as a Kiosk secure environment the design
3decision that were right for a 320x240/240x320 doesn't necessary
4to be right for bigger screens.
5
6Remember most desktops a few years ago had only a resolution
7of 800x600.
8Then also to remember is that a webpad with 640x480 is different to
9a PDA with the same resolution. The PDA has a much smaller
10physical display.
11
12With higher resolution the feeling of a desktop comes.
13
14Problems 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
40Widgets 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
79These small changes ( replacing Q with O + bit more) should make Opie a better environment for
80bigger screens. The additional library memory is a fair trade off and memory can be recovered
81by other technics \ No newline at end of file
diff --git a/libopie/big-screen/osplitter.cpp b/libopie/big-screen/osplitter.cpp
new file mode 100644
index 0000000..dcb5cc5
--- a/dev/null
+++ b/libopie/big-screen/osplitter.cpp
@@ -0,0 +1,213 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 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
37struct OSplitterContainer {
38 QWidget* widget;
39 const QString& icon
40 const QString& name;
41};
42
43
44/**
45 *
46 * This is the constructor of OSplitter
47 * You might want to call setSizeChange to tell
48 * OSplitter to change its layout when a specefic
49 * mark was crossed. OSplitter sets a default value.
50 *
51 * You cann add widget with addWidget to the OSplitter.
52 *
53 * @param orient The orientation wether to layout horizontal or vertical
54 * @param parent The parent of this widget
55 * @param name The name passed on to QObject
56 * @param fl Additional widgets flags passed to QWidget
57 *
58 * @short single c'tor of the OSplitter
59 */
60OSplitter::OSplitter( Orientation orient, QWidget* parent, const char* name, WFlags fl )
61 : QWidget( parent, name, fl )
62{
63 m_orient = orient;
64 m_hbox = 0;
65 m_tabWidget = 0;
66 m_size_policy = 330;
67}
68
69
70/**
71 * Destructor destructs this object and cleans up. All child
72 * widgets will be deleted
73 * @see addWidget
74 */
75OSplitter::~OSplitter() {
76 delete m_hbox;
77 delete m_tabWidget;
78}
79
80
81/**
82 * This function sets the size change policy of the splitter.
83 * If this size marked is crossed the splitter will relayout.
84 * Note that depending on the set Orientation it'll either look
85 * at the width or height.
86 *
87 * @param width_height The mark that will be watched. Interpreted depending on the Orientation of the Splitter.
88 * @return void
89 */
90void OSplitter::setSizeChange( int width_height ) {
91 m_size_policy = width_height;
92 relayout();
93}
94
95/**
96 * Adds a widget to the Splitter. The widgets gets inserted
97 * at the end of either the Box or TabWidget.
98 * Ownership gets transfered and the widgets gets reparented.
99 * Note: icon and label is only available on small screensizes
100 * if size is smaller than the mark
101 * Warning: No null checking of the widget is done. Only on debug
102 * a message will be outputtet
103 *
104 * @param wid The widget which will be added
105 * @param icon The icon of the possible Tab
106 * @param label The label of the possible Tab
107 */
108void OSplitter::addWidget( QWidget* wid, const QString& icon, const QString& label ) {
109#ifdef DEBUG
110 if (!wid ) {
111 qWarning("Widget is not valid!");
112 return;
113 }
114#endif
115 OSplitterContainer cont;
116 cont.widget = wid;
117 cont.icon =icon;
118 cont.label = label;
119
120 m_container.append( cont );
121
122 if (m_hbox )
123 addToBox( cont );
124 else
125 addToTab( cont );
126}
127
128
129/**
130 * Removes the widget from the tab widgets. OSplitter drops ownership
131 * of this widget and the widget will be reparented to 0.
132 * The widget will not be deleted.
133 *
134 * @param w The widget to be removed
135 */
136void OSplitter::removeWidget( QWidget* w) {
137 /* if not widget nor parent or parent not any of my master childs return */
138 if (!w && w->parent() && ( w->parent() != m_hbox || w->parent() != m_tabWidget ) )
139 return;
140
141 /* only tab needs to be removed.. box recognizes it */
142 if ( !m_hbox )
143 removeFromTab( w );
144
145
146 /* Find the widget, reparent it and remove it from our list */
147 ContainerList::Iterator it;
148 for ( it = m_container.begin(); it != m_container.end(); ++it )
149 if ( (*it).widget == w ) {
150 w.reparent( 0, w.getWFlags );
151 it = m_container.remove( it );
152 break;
153 }
154
155
156}
157
158
159/**
160 * This method will give focus to the widget. If in a tabwidget
161 * the tabbar will be changed
162 *
163 * @param w The widget which will be set the current one
164 */
165void OSplitter::setCurrentWidget( QWidget* w) {
166 if (m_tabWidget )
167 m_tabWidget->setCurrentWidget( w );
168 else
169 m_hbox->setFocus( w );
170
171}
172
173/**
174 * This is an overloaded member function and only differs in the argument it takes.
175 * Searches list of widgets for label. It'll pick the first label it finds
176 *
177 * @param label Label to look for. First match will be taken
178 */
179void OSplitter::setCurrentWidget( const QString& label ) {
180 ContainerList::Iterator it;
181 for (it = m_container.begin(); it != m_container.end(); ++it ) {
182 if ( (*it).name == label ) {
183 setCurrentWidget( (*it).widget );
184 break;
185 }
186 }
187}
188
189/**
190 * return the currently activated widget if in tab widget moud
191 * or null because all widgets are visible
192 */
193QWidget* OSplitter::currentWidget() {
194 if ( m_hbox )
195 return 0l;
196 else
197 return m_tabWidget->currentWidget();
198}
199
200
201/**
202 * @reimplented for internal reasons
203 * returns the sizeHint of one of its sub widgets
204 */
205QSize OSplitter::sizeHint()const {
206}
207
208/**
209 * @reimplemented for internal reasons
210 */
211void OSplitter::resizeEvent( QResizeEvent* res ) {
212
213}
diff --git a/libopie/big-screen/osplitter.h b/libopie/big-screen/osplitter.h
new file mode 100644
index 0000000..05849af
--- a/dev/null
+++ b/libopie/big-screen/osplitter.h
@@ -0,0 +1,102 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2002 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 <qwidget.h>
35#include <qvaluelist.h>
36
37
38/* forward declarations */
39class OTabWidget;
40class QHBox;
41struct OSplitterContainer;
42template class QValueList<OSplitterContainer>;
43
44
45/**
46 *
47 * If you've widgets that could be placed side by side but you think
48 * on small resolutions is not enough place but it would really make sense
49 * on bigger resolutions this class will help you.
50 * You can add as many widgets you want to it. Set a poliy on which width/height it
51 * should switch the layout.
52 * You can either say to place widgets vertical or horizontal.
53 * This class uses QHBox, QVBox and QTAbWidget internally.
54 * OSplitter takes ownership of the widgets
55 *
56 * @since 1.2
57 *
58 * @short a small dynamically changing its layout to store two or more widgets side by side
59 * @version 0.1
60 * @author zecke
61 */
62class OSplitter : public QWidget{
63 Q_OBJECT
64public:
65 typedef QValueList<OSplitterContainer> ContainerList;
66 OSplitter( Qt::Orientation = Horizontal, QWidget *parent = 0,
67 const char* name = 0, WFlags fl = 0 );
68 ~OSplitter();
69
70 void setSizeChange( int width_height );
71
72 void addWidget( QWidget* wid, const QString& icon, const QString& label );
73 void removeWidget( QWidget* );
74
75 void setCurrentWidget( QWidget* );
76 void setCurrentWidget( const QString& label );
77 QWidget* currentWidget();
78
79 QSize sizeHint()const;
80
81protected:
82 void resizeEvent( QResizeEvent* );
83
84private:
85 void relayout();
86 void addToTab( const OSplitterContainer& );
87 void addToBox( const OSplitterContainer& );
88 void removeFromTab( QWidget* );
89 void removeFromBox( QWidget* );
90 QHBox *m_hbox;
91 OTabWidget *m_tabWidget;
92 Orientation m_orient;
93 int m_size_policy;
94
95 ContainerList m_container;
96
97 struct Private;
98 Private *d;
99};
100
101
102#endif