summaryrefslogtreecommitdiff
authormickeyl <mickeyl>2003-10-02 15:53:52 (UTC)
committer mickeyl <mickeyl>2003-10-02 15:53:52 (UTC)
commit4c9bda8027049b7ea423471a213eca2068490b08 (patch) (side-by-side diff)
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) (show whitespace changes)
-rw-r--r--core/launcher/inputmethods.cpp14
-rw-r--r--core/launcher/inputmethods.h2
-rw-r--r--core/launcher/taskbar.cpp17
-rw-r--r--core/launcher/taskbar.h28
-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, 187 insertions, 27 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
@@ -59,30 +59,24 @@ static const char * tri_xpm[]={
"a c #000000",
". c None",
".........",
".........",
".........",
"....a....",
"...aaa...",
"..aaaaa..",
".aaaaaaa.",
".........",
"........."};
-static const int inputWidgetStyle = QWidget::WStyle_Customize |
- QWidget::WStyle_Tool |
- QWidget::WStyle_StaysOnTop |
- QWidget::WGroupLeader;
-
-
int InputMethod::operator <(const InputMethod& o) const
{
return name() < o.name();
}
int InputMethod::operator >(const InputMethod& o) const
{
return name() > o.name();
}
int InputMethod::operator <=(const InputMethod& o) const
{
return name() <= o.name();
}
@@ -95,24 +89,30 @@ int InputMethod::operator <=(const InputMethod& o) const
class IMToolButton : public QToolButton
{
public:
IMToolButton::IMToolButton( QWidget *parent ) : QToolButton( parent )
{ setWFlags( WStyle_Tool ); }
};
InputMethods::InputMethods( QWidget *parent ) :
QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ),
mkeyboard(0), imethod(0)
{
+ Config cfg( "Launcher" );
+ cfg.setGroup( "InputMethods" );
+ inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader;
+ inputWidgetStyle |= cfg.readBoolEntry( "Float", false ) ? QWidget::WStyle_DialogBorder : QWidget::WStyle_Tool;
+ inputWidgetWidth = cfg.readNumEntry( "Width", 100 );
+
setBackgroundMode( PaletteBackground );
QHBoxLayout *hbox = new QHBoxLayout( this );
kbdButton = new IMToolButton( this);
kbdButton->setFocusPolicy(NoFocus);
kbdButton->setToggleButton( TRUE );
if (parent->sizeHint().height() > 0)
kbdButton->setFixedHeight( parent->sizeHint().height() );
kbdButton->setFixedWidth( 32 );
kbdButton->setAutoRaise( TRUE );
kbdButton->setUsesBigPixmap( TRUE );
hbox->addWidget( kbdButton );
@@ -528,25 +528,25 @@ void InputMethods::qcopReceive( const QCString &msg, const QByteArray &data )
void InputMethods::showKbd( bool on )
{
if ( !mkeyboard )
return;
if ( on ) {
mkeyboard->resetState();
// HACK... Make the texteditor fit with all input methods
// Input methods should also never use more than about 40% of the screen
int height = QMIN( mkeyboard->widget->sizeHint().height(), 134 );
- mkeyboard->widget->resize( qApp->desktop()->width(), height );
+ mkeyboard->widget->resize( qApp->desktop()->width() * (inputWidgetWidth*0.01), height );
mkeyboard->widget->move( 0, mapToGlobal( QPoint() ).y() - height );
mkeyboard->widget->show();
} else {
mkeyboard->widget->hide();
}
emit inputToggled( on );
}
bool InputMethods::shown() const
{
return mkeyboard && mkeyboard->widget->isVisible();
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
@@ -94,17 +94,19 @@ private:
void chooseKeyboard(InputMethod* im);
void updateKeyboards(InputMethod *im);
private:
QToolButton *kbdButton;
QToolButton *kbdChoice;
QWidgetStack *imButton; // later will be widget stack
QToolButton *imChoice;
InputMethod *mkeyboard;
InputMethod *imethod;
QValueList<InputMethod> inputMethodList;
QValueList<InputMethod> inputModifierList;
+ int inputWidgetStyle;
+ int inputWidgetWidth;
};
#endif // __INPUT_METHODS_H__
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
@@ -19,24 +19,25 @@
**********************************************************************/
#include "startmenu.h"
#include "inputmethods.h"
#include "runningappbar.h"
#include "systray.h"
#include "wait.h"
#include "appicons.h"
#include "taskbar.h"
#include "server.h"
+#include <qtopia/config.h>
#include <qtopia/qpeapplication.h>
#ifdef QWS
#include <qtopia/qcopenvelope_qws.h>
#endif
#include <qtopia/global.h>
#include <qtopia/custom.h>
#include <qlabel.h>
#include <qlayout.h>
#include <qtimer.h>
#ifdef QWS
#include <qwindowsystem_qws.h>
@@ -163,24 +164,28 @@ private:
bool nl, cl;
};
//---------------------------------------------------------------------------
TaskBar::~TaskBar()
{
}
TaskBar::TaskBar() : QHBox(0, 0, WStyle_Customize | WStyle_Tool | WStyle_StaysOnTop | WGroupLeader)
{
+ Config cfg( "Launcher" );
+ cfg.setGroup( "InputMethods" );
+ resizeRunningApp = cfg.readBoolEntry( "Resize", true );
+
sm = new StartMenu( this );
connect( sm, SIGNAL(tabSelected(const QString&)), this,
SIGNAL(tabSelected(const QString&)) );
inputMethods = new InputMethods( this );
connect( inputMethods, SIGNAL(inputToggled(bool)),
this, SLOT(calcMaxWindowRect()) );
stack = new QWidgetStack( this );
stack->setSizePolicy( QSizePolicy( QSizePolicy::Expanding, QSizePolicy::Minimum ) );
label = new QLabel(stack);
@@ -282,44 +287,42 @@ void TaskBar::resizeEvent( QResizeEvent *e )
qWarning("TaskBar::resize event");
}
void TaskBar::styleChange( QStyle &s )
{
QHBox::styleChange( s );
calcMaxWindowRect();
}
void TaskBar::calcMaxWindowRect()
{
- /*
-#ifdef Q_WS_QWS
+ if ( resizeRunningApp )
+ {
+ #if defined(Q_WS_QWS)
QRect wr;
int displayWidth = qApp->desktop()->width();
QRect ir = inputMethods->inputRect();
if ( ir.isValid() ) {
wr.setCoords( 0, 0, displayWidth-1, ir.top()-1 );
} else {
wr.setCoords( 0, 0, displayWidth-1, y()-1 );
}
-
#if QT_VERSION < 0x030000
- QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,
- QSize(qt_screen->width(),qt_screen->height()))
- );
+ QWSServer::setMaxWindowRect( qt_screen->mapToDevice(wr,QSize(qt_screen->width(),qt_screen->height())) );
#else
QWSServer::setMaxWindowRect( wr );
#endif
#endif
- */
+ }
}
void TaskBar::receive( const QCString &msg, const QByteArray &data )
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "message(QString)" ) {
QString text;
stream >> text;
setStatusMessage( text );
} else if ( msg == "hideInputMethod()" ) {
inputMethods->hideInputMethod();
} else if ( msg == "showInputMethod()" ) {
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,83 +1,87 @@
/**********************************************************************
-** Copyright (C) 2000 Trolltech AS. All rights reserved.
+** Copyright (C) 2000-2002 Trolltech AS. All rights reserved.
**
-** This file is part of Qtopia Environment.
+** This file is part of the Qtopia Environment.
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
-#ifndef __TASKBAR_H__
-#define __TASKBAR_H__
+#ifndef TASKBAR_H
+#define TASKBAR_H
#include <qhbox.h>
+#include "serverinterface.h"
+#include "startmenu.h"
class QLabel;
class QTimer;
class InputMethods;
class Wait;
class SysTray;
class RunningAppBar;
class QWidgetStack;
class QTimer;
class QLabel;
-class StartMenu;
class LockKeyState;
+class AppLnkSet;
class TaskBar : public QHBox {
Q_OBJECT
public:
TaskBar();
~TaskBar();
- static QWidget *calibrate( bool );
+ void launchStartMenu() { if (sm) sm->launch(); }
+ void refreshStartMenu() { if (sm) sm->refreshMenu(); }
+ void setApplicationState( const QString &name, ServerInterface::ApplicationState state );
- bool recoverMemory();
+signals:
+ void tabSelected(const QString&);
- StartMenu *startMenu() const { return sm; }
public slots:
void startWait();
void stopWait(const QString&);
void stopWait();
+
void clearStatusBar();
void toggleNumLockState();
void toggleCapsLockState();
void toggleSymbolInput();
+ void calcMaxWindowRect();
protected:
void resizeEvent( QResizeEvent * );
void styleChange( QStyle & );
void setStatusMessage( const QString &text );
-public slots:
- void calcMaxWindowRect();
private slots:
void receive( const QCString &msg, const QByteArray &data );
private:
-
QTimer *waitTimer;
Wait *waitIcon;
InputMethods *inputMethods;
SysTray *sysTray;
RunningAppBar* runningAppBar;
QWidgetStack *stack;
QTimer *clearer;
QLabel *label;
LockKeyState* lockState;
StartMenu *sm;
+ bool resizeRunningApp;
};
-#endif // __TASKBAR_H__
+#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 @@
+/*
+                This file is part of the OPIE Project
+ =. Copyright (c) 2002 Trolltech AS <info@trolltech.com>
+             .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#include "inputmethodsettings.h"
+
+#include <qpe/config.h>
+#include <qpe/qlibrary.h>
+#include <qpe/qpeapplication.h>
+
+#include <qspinbox.h>
+#include <qcheckbox.h>
+#include <qlayout.h>
+#include <qlabel.h>
+#include <qwhatsthis.h>
+
+InputMethodSettings::InputMethodSettings( QWidget *parent, const char *name ):QWidget( parent, name )
+{
+ QBoxLayout *lay = new QVBoxLayout( this, 4, 4 );
+
+ _resize = new QCheckBox( tr( "Resize application on Popup" ), this );
+ _float = new QCheckBox( tr( "Enable floating and resizing" ), this );
+
+ QHBoxLayout* hbox = new QHBoxLayout( this, 4, 4 );
+ hbox->addWidget( new QLabel( "Initial Width:", this ) );
+ _size = new QSpinBox( 10, 100, 10, this );
+ _size->setSuffix( "%" );
+ hbox->addWidget( _size );
+ hbox->addStretch();
+
+ Config cfg( "Launcher" );
+ cfg.setGroup( "InputMethods" );
+ _resize->setChecked( cfg.readBoolEntry( "Resize", true ) );
+ _float->setChecked( cfg.readBoolEntry( "Float", false ) );
+ _size->setValue( cfg.readNumEntry( "Width", 100 ) );
+
+ lay->addWidget( _resize );
+ lay->addWidget( _float );
+ lay->addLayout( hbox );
+ lay->addWidget( new QLabel( tr( "<b>Note:</b> Changing these settings may need restarting Opie to become effective." ), this ) );
+
+ lay->addStretch();
+
+ QWhatsThis::add( _resize, tr( "Check, if you want the application to be automatically resized if the input method pops up." ) );
+ QWhatsThis::add( _float, tr( "Check, if you want to move and/or resize input methods" ) );
+ QWhatsThis::add( _size, tr( "Specify the percentage of the screen width for the input method" ) );
+}
+
+void InputMethodSettings::appletChanged()
+{
+}
+
+void InputMethodSettings::accept()
+{
+ qDebug( "InputMethodSettings::accept()" );
+ Config cfg( "Launcher" );
+ cfg.setGroup( "InputMethods" );
+ cfg.writeEntry( "Resize", _resize->isChecked() );
+ cfg.writeEntry( "Float", _float->isChecked() );
+ cfg.writeEntry( "Width", _size->value() );
+ cfg.write();
+}
+
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 @@
+/*
+               =. This file is part of the OPIE Project
+             .=l. Copyright (c) 2003 Michael Lauer <mickeyl@handhelds.org>
+           .>+-=
+ _;:,     .>    :=|. This file is free software; you can
+.> <`_,   >  .   <= redistribute it and/or modify it under
+:`=1 )Y*s>-.--   : the terms of the GNU General Public
+.="- .-=="i,     .._ License as published by the Free Software
+ - .   .-<_>     .<> Foundation; either version 2 of the License,
+     ._= =}       : or (at your option) any later version.
+    .%`+i>       _;_.
+    .i_,=:_.      -<s. This file is distributed in the hope that
+     +  .  -:.       = it will be useful, but WITHOUT ANY WARRANTY;
+    : ..    .:,     . . . without even the implied warranty of
+    =_        +     =;=|` MERCHANTABILITY or FITNESS FOR A
+  _.=:.       :    :=>`: PARTICULAR PURPOSE. See the GNU General
+..}^=.=       =       ; Public License for more details.
+++=   -.     .`     .:
+ :     =  ...= . :.=- You should have received a copy of the GNU
+ -.   .:....=;==+<; General Public License along with this file;
+  -_. . .   )=.  = see the file COPYING. If not, write to the
+    --        :-=` Free Software Foundation, Inc.,
+ 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA.
+
+*/
+
+#ifndef __IMETHOD_SETTINGS_H__
+#define __IMETHOD_SETTINGS_H__
+
+#include <qwidget.h>
+
+class QCheckBox;
+class QSpinBox;
+
+class InputMethodSettings : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ InputMethodSettings ( QWidget *parent = 0, const char *name = 0 );
+
+ void accept ( );
+
+ protected slots:
+ void appletChanged ( );
+
+ protected:
+ void init ( );
+
+ private:
+ QCheckBox* _resize;
+ QCheckBox* _float;
+ QSpinBox* _size;
+};
+
+#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
@@ -1,26 +1,28 @@
TEMPLATE = app
CONFIG += qt warn_on release
DESTDIR = $(OPIEDIR)/bin
HEADERS = launchersettings.h \
tabssettings.h \
taskbarsettings.h \
menusettings.h \
+ inputmethodsettings.h \
tabconfig.h \
tabdialog.h
SOURCES = main.cpp \
launchersettings.cpp \
tabssettings.cpp \
taskbarsettings.cpp \
menusettings.cpp \
+ inputmethodsettings.cpp \
tabdialog.cpp
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopie
TARGET = launchersettings
include ( $(OPIEDIR)/include.pro )
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
@@ -26,48 +26,51 @@
*/
#include <qlayout.h>
#include <qapplication.h>
#include <opie/otabwidget.h>
#include "launchersettings.h"
#include "tabssettings.h"
#include "menusettings.h"
#include "taskbarsettings.h"
-
+#include "inputmethodsettings.h"
LauncherSettings::LauncherSettings ( ) : QDialog ( 0, "LauncherSettings", false, WStyle_ContextHelp )
{
setCaption ( tr( "Launcher Settings" ));
QVBoxLayout *lay = new QVBoxLayout ( this, 4, 4 );
OTabWidget *tw = new OTabWidget ( this, "otab" );
lay-> addWidget ( tw );
m_tabs = new TabsSettings ( tw );
m_taskbar = new TaskbarSettings ( tw );
m_menu = new MenuSettings ( tw );
+ m_imethods = new InputMethodSettings ( tw );
tw-> addTab ( m_taskbar, "wait", tr( "Taskbar" ));
tw-> addTab ( m_menu, "go", tr( "O-Menu" ));
tw-> addTab ( m_tabs, "launchersettings/tabstab.png", tr( "Tabs" ));
+ tw-> addTab ( m_imethods, "launchersettings/inputmethod.png", tr( "InputMethods" ));
tw-> setCurrentTab ( m_taskbar );
}
void LauncherSettings::accept ( )
{
m_taskbar-> accept ( );
m_menu-> accept ( );
m_tabs-> accept ( );
+ m_imethods-> accept ( );
QDialog::accept ( );
}
void LauncherSettings::done ( int r )
{
QDialog::done ( r );
close ( );
}
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
@@ -24,29 +24,31 @@
Boston, MA 02111-1307, USA.
*/
#ifndef __LAUNCHER_SETTINGS_H__
#define __LAUNCHER_SETTINGS_H__
#include <qdialog.h>
class TabsSettings;
class TaskbarSettings;
class MenuSettings;
+class InputMethodSettings;
class LauncherSettings : public QDialog {
Q_OBJECT
public:
LauncherSettings ( );
virtual void accept ( );
virtual void done ( int r );
private:
TabsSettings *m_tabs;
TaskbarSettings *m_taskbar;
MenuSettings *m_menu;
+ InputMethodSettings* m_imethods;
};
#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