summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-10-02 15:53:52 (UTC)
committer mickeyl <mickeyl>2003-10-02 15:53:52 (UTC)
commit4c9bda8027049b7ea423471a213eca2068490b08 (patch) (unidiff)
treea2400c2a77847764cd09e4c882caf521e503a423
parent4dd842eacb6c04303932e4cbebedff14db7cbc87 (diff)
downloadopie-4c9bda8027049b7ea423471a213eca2068490b08.zip
opie-4c9bda8027049b7ea423471a213eca2068490b08.tar.gz
opie-4c9bda8027049b7ea423471a213eca2068490b08.tar.bz2
Start with some customization bits for inputmethods as part of the
BigScreen initiative. You can now choose to have free floating and resizable inputmethods. Two outstanding things: 1.) Hiding the inputmethod via the [x] button confuses the show/hide toggle button. 2.) The new size and position of a moved/resized inputmethod should be remembered.
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/inputmethods.cpp14
-rw-r--r--core/launcher/inputmethods.h2
-rw-r--r--core/launcher/taskbar.cpp41
-rw-r--r--core/launcher/taskbar.h30
-rw-r--r--core/settings/launcher/inputmethodsettings.cpp87
-rw-r--r--core/settings/launcher/inputmethodsettings.h57
-rw-r--r--core/settings/launcher/launcher.pro2
-rw-r--r--core/settings/launcher/launchersettings.cpp5
-rw-r--r--core/settings/launcher/launchersettings.h2
-rw-r--r--pics/launchersettings/inputmethod.pngbin0 -> 232 bytes
10 files changed, 200 insertions, 40 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp
index f0d8294..d89a366 100644
--- a/core/launcher/inputmethods.cpp
+++ b/core/launcher/inputmethods.cpp
@@ -68,12 +68,6 @@ static const char * tri_xpm[]={
68".........", 68".........",
69"........."}; 69"........."};
70 70
71static const int inputWidgetStyle = QWidget::WStyle_Customize |
72 QWidget::WStyle_Tool |
73 QWidget::WStyle_StaysOnTop |
74 QWidget::WGroupLeader;
75
76
77int InputMethod::operator <(const InputMethod& o) const 71int InputMethod::operator <(const InputMethod& o) const
78{ 72{
79 return name() < o.name(); 73 return name() < o.name();
@@ -104,6 +98,12 @@ InputMethods::InputMethods( QWidget *parent ) :
104 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ), 98 QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ),
105 mkeyboard(0), imethod(0) 99 mkeyboard(0), imethod(0)
106{ 100{
101 Config cfg( "Launcher" );
102 cfg.setGroup( "InputMethods" );
103 inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader;
104 inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : QWidget::WStyle_Tool;
105 inputWidgetWidth = cfg.readNumEntry( "Width", 100 );
106
107 setBackgroundMode( PaletteBackground ); 107 setBackgroundMode( PaletteBackground );
108 QHBoxLayout *hbox = new QHBoxLayout( this ); 108 QHBoxLayout *hbox = new QHBoxLayout( this );
109 109
@@ -537,7 +537,7 @@ void InputMethods::showKbd( bool on )
537 // HACK... Make the texteditor fit with all input methods 537 // HACK... Make the texteditor fit with all input methods
538 // Input methods should also never use more than about 40% of the screen 538 // Input methods should also never use more than about 40% of the screen
539 int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 ); 539 int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 );
540 mkeyboard->widget->resize( qApp->desktop()->width(), height ); 540 mkeyboard->widget->resize( qApp->desktop()->width() * (inputWidgetWidth*0.01), height );
541 mkeyboard->widget->move( 0, mapToGlobal( QPoint() ).y() - height ); 541 mkeyboard->widget->move( 0, mapToGlobal( QPoint() ).y() - height );
542 mkeyboard->widget->show(); 542 mkeyboard->widget->show();
543 } else { 543 } else {
diff --git a/core/launcher/inputmethods.h b/core/launcher/inputmethods.h
index 93b69de..246661a 100644
--- a/core/launcher/inputmethods.h
+++ b/core/launcher/inputmethods.h
@@ -103,6 +103,8 @@ private:
103 InputMethod *imethod; 103 InputMethod *imethod;
104 QValueList<InputMethod> inputMethodList; 104 QValueList<InputMethod> inputMethodList;
105 QValueList<InputMethod> inputModifierList; 105 QValueList<InputMethod> inputModifierList;
106 int inputWidgetStyle;
107 int inputWidgetWidth;
106}; 108};
107 109
108 110
diff --git a/core/launcher/taskbar.cpp b/core/launcher/taskbar.cpp
index 37fdb30..2966168 100644
--- a/core/launcher/taskbar.cpp
+++ b/core/launcher/taskbar.cpp
@@ -28,6 +28,7 @@
28#include "taskbar.h" 28#include "taskbar.h"
29#include "server.h" 29#include "server.h"
30 30
31#include <qtopia/config.h>
31#include <qtopia/qpeapplication.h> 32#include <qtopia/qpeapplication.h>
32#ifdef QWS 33#ifdef QWS
33#include <qtopia/qcopenvelope_qws.h> 34#include <qtopia/qcopenvelope_qws.h>
@@ -172,6 +173,10 @@ TaskBar::~TaskBar()
172 173
173TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader) 174TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
174{ 175{
176 Config cfg( "Launcher" );
177 cfg.setGroup( "InputMethods" );
178 resizeRunningApp = cfg.readBoolEntry( "Resize", true );
179
175 sm = new StartMenu( this ); 180 sm = new StartMenu( this );
176 connect( sm, SIGNAL(tabSelected(const QString&)), this, 181 connect( sm, SIGNAL(tabSelected(const QString&)), this,
177 SIGNAL(tabSelected(const QString&)) ); 182 SIGNAL(tabSelected(const QString&)) );
@@ -291,26 +296,24 @@ void TaskBar::styleChange( QStyle &s )
291 296
292void TaskBar::calcMaxWindowRect() 297void TaskBar::calcMaxWindowRect()
293{ 298{
294 /* 299 if ( resizeRunningApp )
295#ifdef Q_WS_QWS 300 {
296 QRect wr; 301 #if defined(Q_WS_QWS)
297 int displayWidth = qApp->desktop()->width(); 302 QRect wr;
298 QRect ir = inputMethods->inputRect(); 303 int displayWidth = qApp->desktop()->width();
299 if ( ir.isValid() ) { 304 QRect ir = inputMethods->inputRect();
300 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 ); 305 if ( ir.isValid() ) {
301 } else { 306 wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
302 wr.setCoords( 0, 0, displayWidth-1, y()-1 ); 307 } else {
308 wr.setCoords( 0, 0, displayWidth-1, y()-1 );
309 }
310 #if QT_VERSION < 0x030000
311 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,QSize(qt_screen->width(),qt_screen->height())) );
312 #else
313 QWSServer::setMaxWindowRect( wr );
314 #endif
315 #endif
303 } 316 }
304
305#if QT_VERSION < 0x030000
306 QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
307 QSize(qt_screen->width(),qt_screen->height()))
308 );
309#else
310 QWSServer::setMaxWindowRect( wr );
311#endif
312#endif
313 */
314} 317}
315 318
316void TaskBar::receive( const QCString &msg, const QByteArray &data ) 319void TaskBar::receive( const QCString &msg, const QByteArray &data )
diff --git a/core/launcher/taskbar.h b/core/launcher/taskbar.h
index 0cfc123..ed558b1 100644
--- a/core/launcher/taskbar.h
+++ b/core/launcher/taskbar.h
@@ -1,7 +1,7 @@
1/********************************************************************** 1/**********************************************************************
2** Copyright (C) 2000 Trolltech AS. All rights reserved. 2** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
3** 3**
4** This file is part of Qtopia Environment. 4** This file is part of the Qtopia Environment.
5** 5**
6** This file may be distributed and/or modified under the terms of the 6** This file may be distributed and/or modified under the terms of the
7** GNU General Public License version 2 as published by the Free Software 7** GNU General Public License version 2 as published by the Free Software
@@ -18,10 +18,12 @@
18** 18**
19**********************************************************************/ 19**********************************************************************/
20 20
21#ifndef __TASKBAR_H__ 21#ifndef TASKBAR_H
22#define __TASKBAR_H__ 22#define TASKBAR_H
23 23
24#include <qhbox.h> 24#include <qhbox.h>
25#include "serverinterface.h"
26#include "startmenu.h"
25 27
26class QLabel; 28class QLabel;
27class QTimer; 29class QTimer;
@@ -32,8 +34,8 @@ class RunningAppBar;
32class QWidgetStack; 34class QWidgetStack;
33class QTimer; 35class QTimer;
34class QLabel; 36class QLabel;
35class StartMenu;
36class LockKeyState; 37class LockKeyState;
38class AppLnkSet;
37 39
38class TaskBar : public QHBox { 40class TaskBar : public QHBox {
39 Q_OBJECT 41 Q_OBJECT
@@ -41,32 +43,33 @@ public:
41 TaskBar(); 43 TaskBar();
42 ~TaskBar(); 44 ~TaskBar();
43 45
44 static QWidget *calibrate( bool ); 46 void launchStartMenu() { if (sm) sm->launch(); }
47 void refreshStartMenu() { if (sm) sm->refreshMenu(); }
48 void setApplicationState( const QString &name, ServerInterface::ApplicationState state );
45 49
46 bool recoverMemory(); 50signals:
51 void tabSelected(const QString&);
47 52
48 StartMenu *startMenu() const { return sm; }
49public slots: 53public slots:
50 void startWait(); 54 void startWait();
51 void stopWait(const QString&); 55 void stopWait(const QString&);
52 void stopWait(); 56 void stopWait();
57
53 void clearStatusBar(); 58 void clearStatusBar();
54 void toggleNumLockState(); 59 void toggleNumLockState();
55 void toggleCapsLockState(); 60 void toggleCapsLockState();
56 void toggleSymbolInput(); 61 void toggleSymbolInput();
62 void calcMaxWindowRect();
57 63
58protected: 64protected:
59 void resizeEvent( QResizeEvent * ); 65 void resizeEvent( QResizeEvent * );
60 void styleChange( QStyle & ); 66 void styleChange( QStyle & );
61 void setStatusMessage( const QString &text ); 67 void setStatusMessage( const QString &text );
62 68
63public slots:
64 void calcMaxWindowRect();
65private slots: 69private slots:
66 void receive( const QCString &msg, const QByteArray &data ); 70 void receive( const QCString &msg, const QByteArray &data );
67 71
68private: 72private:
69
70 QTimer *waitTimer; 73 QTimer *waitTimer;
71 Wait *waitIcon; 74 Wait *waitIcon;
72 InputMethods *inputMethods; 75 InputMethods *inputMethods;
@@ -77,7 +80,8 @@ private:
77 QLabel *label; 80 QLabel *label;
78 LockKeyState* lockState; 81 LockKeyState* lockState;
79 StartMenu *sm; 82 StartMenu *sm;
83 bool resizeRunningApp;
80}; 84};
81 85
82 86
83#endif // __TASKBAR_H__ 87#endif // TASKBAR_H
diff --git a/core/settings/launcher/inputmethodsettings.cpp b/core/settings/launcher/inputmethodsettings.cpp
new file mode 100644
index 0000000..1aa1ae8
--- a/dev/null
+++ b/core/settings/launcher/inputmethodsettings.cpp
@@ -0,0 +1,87 @@
1/*
2                This file is part of the OPIE Project
3 =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
4             .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org>
5           .>+-=
6 _;:,     .>    :=|. This file is free software; you can
7.> <`_,   >  .   <= redistribute it and/or modify it under
8:`=1 )Y*s>-.--   : the terms of the GNU General Public
9.="- .-=="i,     .._ License as published by the Free Software
10 - .   .-<_>     .<> Foundation; either version 2 of the License,
11     ._= =}       : or (at your option) any later version.
12    .%`+i>       _;_.
13    .i_,=:_.      -<s. This file is distributed in the hope that
14     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
15    : ..    .:,     . . . without even the implied warranty of
16    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
17  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
18..}^=.=       =       ; Public License for more details.
19++=   -.     .`     .:
20 :     =  ...= . :.=- You should have received a copy of the GNU
21 -.   .:....=;==+<; General Public License along with this file;
22  -_. . .   )=.  = see the file COPYING. If not, write to the
23    --        :-=` Free Software Foundation, Inc.,
24 59 Temple Place - Suite 330,
25 Boston, MA 02111-1307, USA.
26
27*/
28
29#include "inputmethodsettings.h"
30
31#include <qpe/config.h>
32#include <qpe/qlibrary.h>
33#include <qpe/qpeapplication.h>
34
35#include <qspinbox.h>
36#include <qcheckbox.h>
37#include <qlayout.h>
38#include <qlabel.h>
39#include <qwhatsthis.h>
40
41InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name )
42{
43 QBoxLayout *lay = new QVBoxLayout( this, 4, 4 );
44
45 _resize = new QCheckBox( tr( "Resize application on Popup" ), this );
46 _float = new QCheckBox( tr( "Enable floating and resizing" ), this );
47
48 QHBoxLayout* hbox = new QHBoxLayout( this, 4, 4 );
49 hbox->addWidget( new QLabel( "Initial Width:", this ) );
50 _size = new QSpinBox( 10, 100, 10, this );
51 _size->setSuffix( "%" );
52 hbox->addWidget( _size );
53 hbox->addStretch();
54
55 Config cfg( "Launcher" );
56 cfg.setGroup( "InputMethods" );
57 _resize->setChecked( cfg.readBoolEntry( "Resize", true ) );
58 _float->setChecked( cfg.readBoolEntry( "Float", false ) );
59 _size->setValue( cfg.readNumEntry( "Width", 100 ) );
60
61 lay->addWidget( _resize );
62 lay->addWidget( _float );
63 lay->addLayout( hbox );
64 lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) );
65
66 lay->addStretch();
67
68 QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) );
69 QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) );
70 QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) );
71}
72
73void InputMethodSettings::appletChanged()
74{
75}
76
77void InputMethodSettings::accept()
78{
79 qDebug( "InputMethodSettings::accept()" );
80 Config cfg( "Launcher" );
81 cfg.setGroup( "InputMethods" );
82 cfg.writeEntry( "Resize", _resize->isChecked() );
83 cfg.writeEntry( "Float", _float->isChecked() );
84 cfg.writeEntry( "Width", _size->value() );
85 cfg.write();
86}
87
diff --git a/core/settings/launcher/inputmethodsettings.h b/core/settings/launcher/inputmethodsettings.h
new file mode 100644
index 0000000..486ee5e
--- a/dev/null
+++ b/core/settings/launcher/inputmethodsettings.h
@@ -0,0 +1,57 @@
1/*
2               =. This file is part of the OPIE Project
3             .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org>
4           .>+-=
5 _;:,     .>    :=|. This file is free software; you can
6.> <`_,   >  .   <= redistribute it and/or modify it under
7:`=1 )Y*s>-.--   : the terms of the GNU 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 file 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 General
17..}^=.=       =       ; Public License for more details.
18++=   -.     .`     .:
19 :     =  ...= . :.=- You should have received a copy of the GNU
20 -.   .:....=;==+<; General Public License along with this file;
21  -_. . .   )=.  = see the file COPYING. If not, write to the
22    --        :-=` Free Software Foundation, Inc.,
23 59 Temple Place - Suite 330,
24 Boston, MA 02111-1307, USA.
25
26*/
27
28#ifndef __IMETHOD_SETTINGS_H__
29#define __IMETHOD_SETTINGS_H__
30
31#include <qwidget.h>
32
33class QCheckBox;
34class QSpinBox;
35
36class InputMethodSettings : public QWidget
37{
38 Q_OBJECT
39
40 public:
41 InputMethodSettings ( QWidget *parent = 0, const char *name = 0 );
42
43 void accept ( );
44
45 protected slots:
46 void appletChanged ( );
47
48 protected:
49 void init ( );
50
51 private:
52 QCheckBox* _resize;
53 QCheckBox* _float;
54 QSpinBox* _size;
55};
56
57#endif
diff --git a/core/settings/launcher/launcher.pro b/core/settings/launcher/launcher.pro
index e532852..cea268d 100644
--- a/core/settings/launcher/launcher.pro
+++ b/core/settings/launcher/launcher.pro
@@ -5,6 +5,7 @@ HEADERS = launchersettings.h \
5 tabssettings.h \ 5 tabssettings.h \
6 taskbarsettings.h \ 6 taskbarsettings.h \
7 menusettings.h \ 7 menusettings.h \
8 inputmethodsettings.h \
8 tabconfig.h \ 9 tabconfig.h \
9 tabdialog.h 10 tabdialog.h
10 11
@@ -13,6 +14,7 @@ SOURCES = main.cpp \
13 tabssettings.cpp \ 14 tabssettings.cpp \
14 taskbarsettings.cpp \ 15 taskbarsettings.cpp \
15 menusettings.cpp \ 16 menusettings.cpp \
17 inputmethodsettings.cpp \
16 tabdialog.cpp 18 tabdialog.cpp
17 19
18INCLUDEPATH += $(OPIEDIR)/include 20INCLUDEPATH += $(OPIEDIR)/include
diff --git a/core/settings/launcher/launchersettings.cpp b/core/settings/launcher/launchersettings.cpp
index cb6e98a..3982194 100644
--- a/core/settings/launcher/launchersettings.cpp
+++ b/core/settings/launcher/launchersettings.cpp
@@ -35,7 +35,7 @@
35#include "tabssettings.h" 35#include "tabssettings.h"
36#include "menusettings.h" 36#include "menusettings.h"
37#include "taskbarsettings.h" 37#include "taskbarsettings.h"
38 38#include "inputmethodsettings.h"
39 39
40LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp ) 40LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp )
41{ 41{
@@ -49,10 +49,12 @@ LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false,
49 m_tabs = new TabsSettings ( tw ); 49 m_tabs = new TabsSettings ( tw );
50 m_taskbar = new TaskbarSettings ( tw ); 50 m_taskbar = new TaskbarSettings ( tw );
51 m_menu = new MenuSettings ( tw ); 51 m_menu = new MenuSettings ( tw );
52 m_imethods = new InputMethodSettings ( tw );
52 53
53 tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" )); 54 tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" ));
54 tw-> addTab ( m_menu, "go", tr( "O-Menu" )); 55 tw-> addTab ( m_menu, "go", tr( "O-Menu" ));
55 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" )); 56 tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" ));
57 tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" ));
56 58
57 tw-> setCurrentTab ( m_taskbar ); 59 tw-> setCurrentTab ( m_taskbar );
58} 60}
@@ -62,6 +64,7 @@ void LauncherSettings::accept ( )
62 m_taskbar-> accept ( ); 64 m_taskbar-> accept ( );
63 m_menu-> accept ( ); 65 m_menu-> accept ( );
64 m_tabs-> accept ( ); 66 m_tabs-> accept ( );
67 m_imethods-> accept ( );
65 68
66 QDialog::accept ( ); 69 QDialog::accept ( );
67} 70}
diff --git a/core/settings/launcher/launchersettings.h b/core/settings/launcher/launchersettings.h
index 56c916e..71165a3 100644
--- a/core/settings/launcher/launchersettings.h
+++ b/core/settings/launcher/launchersettings.h
@@ -33,6 +33,7 @@
33class TabsSettings; 33class TabsSettings;
34class TaskbarSettings; 34class TaskbarSettings;
35class MenuSettings; 35class MenuSettings;
36class InputMethodSettings;
36 37
37class LauncherSettings : public QDialog { 38class LauncherSettings : public QDialog {
38 Q_OBJECT 39 Q_OBJECT
@@ -47,6 +48,7 @@ private:
47 TabsSettings *m_tabs; 48 TabsSettings *m_tabs;
48 TaskbarSettings *m_taskbar; 49 TaskbarSettings *m_taskbar;
49 MenuSettings *m_menu; 50 MenuSettings *m_menu;
51 InputMethodSettings* m_imethods;
50}; 52};
51 53
52#endif 54#endif
diff --git a/pics/launchersettings/inputmethod.png b/pics/launchersettings/inputmethod.png
new file mode 100644
index 0000000..f5af6cb
--- a/dev/null
+++ b/pics/launchersettings/inputmethod.png
Binary files differ