author | sandman <sandman> | 2002-06-21 00:30:56 (UTC) |
---|---|---|
committer | sandman <sandman> | 2002-06-21 00:30:56 (UTC) |
commit | b5951d300371cbe78fa94163aa882419e3d08d4b (patch) (side-by-side diff) | |
tree | cc52dbcba8666a86f38585b6e5032c31324e60bf | |
parent | 56649b4725b2e98d786d06f83d4b3281ea1090fb (diff) | |
download | opie-b5951d300371cbe78fa94163aa882419e3d08d4b.zip opie-b5951d300371cbe78fa94163aa882419e3d08d4b.tar.gz opie-b5951d300371cbe78fa94163aa882419e3d08d4b.tar.bz2 |
Fix for background drawing to make taskbar look nice with liquid style
-rw-r--r-- | core/launcher/inputmethods.cpp | 2 | ||||
-rw-r--r-- | core/launcher/mrulist.cpp | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/core/launcher/inputmethods.cpp b/core/launcher/inputmethods.cpp index da98e07..ac72b02 100644 --- a/core/launcher/inputmethods.cpp +++ b/core/launcher/inputmethods.cpp @@ -1,204 +1,206 @@ /********************************************************************** ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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. ** **********************************************************************/ #define QTOPIA_INTERNAL_LANGLIST #include "inputmethods.h" #include <qpe/config.h> #include <qpe/qpeapplication.h> #include <qpe/inputmethodinterface.h> #include <qpe/qlibrary.h> #include <qpe/global.h> #include <qpopupmenu.h> #include <qpushbutton.h> #include <qtoolbutton.h> #include <qwidget.h> #include <qlayout.h> #include <qtimer.h> #include <qdir.h> #include <stdlib.h> #include <qtranslator.h> #ifdef Q_WS_QWS #include <qwindowsystem_qws.h> #include <qwsevent_qws.h> #endif #ifdef SINGLE_APP #include "handwritingimpl.h" #include "keyboardimpl.h" #include "pickboardimpl.h" #endif /* XPM */ static const char * tri_xpm[]={ "9 9 2 1", "a c #000000", ". c None", ".........", ".........", ".........", "....a....", "...aaa...", "..aaaaa..", ".aaaaaaa.", ".........", "........."}; static const int inputWidgetStyle = QWidget::WStyle_Customize | QWidget::WStyle_Tool | QWidget::WStyle_StaysOnTop | QWidget::WGroupLeader; InputMethods::InputMethods( QWidget *parent ) : QWidget( parent, "InputMethods", WStyle_Tool | WStyle_Customize ) { method = NULL; + setBackgroundMode ( PaletteBackground ); + QHBoxLayout *hbox = new QHBoxLayout( this ); kbdButton = new QToolButton( this ); kbdButton->setFocusPolicy(NoFocus); kbdButton->setToggleButton( TRUE ); kbdButton->setFixedHeight( 17 ); kbdButton->setFixedWidth( 32 ); kbdButton->setAutoRaise( TRUE ); kbdButton->setUsesBigPixmap( TRUE ); hbox->addWidget( kbdButton ); connect( kbdButton, SIGNAL(toggled(bool)), this, SLOT(showKbd(bool)) ); kbdChoice = new QToolButton( this ); kbdChoice->setFocusPolicy(NoFocus); kbdChoice->setPixmap( QPixmap( (const char **)tri_xpm ) ); kbdChoice->setFixedHeight( 17 ); kbdChoice->setFixedWidth( 12 ); kbdChoice->setAutoRaise( TRUE ); hbox->addWidget( kbdChoice ); connect( kbdChoice, SIGNAL(clicked()), this, SLOT(chooseKbd()) ); connect( (QPEApplication*)qApp, SIGNAL(clientMoused()), this, SLOT(resetStates()) ); loadInputMethods(); } InputMethods::~InputMethods() { #ifndef SINGLE_APP QValueList<InputMethod>::Iterator mit; for ( mit = inputMethodList.begin(); mit != inputMethodList.end(); ++mit ) { int i = (*mit).interface->release(); (*mit).library->unload(); delete (*mit).library; } #endif } void InputMethods::hideInputMethod() { kbdButton->setOn( FALSE ); } void InputMethods::showInputMethod() { kbdButton->setOn( TRUE ); } void InputMethods::showInputMethod(const QString& name) { int i = 0; QValueList<InputMethod>::Iterator it; InputMethod *im = 0; for ( it = inputMethodList.begin(); it != inputMethodList.end(); ++it, i++ ) { if ( (*it).interface->name() == name ) { im = &(*it); break; } } if ( im ) chooseMethod(im); } void InputMethods::resetStates() { if ( method ) method->interface->resetState(); } QRect InputMethods::inputRect() const { if ( !method || !method->widget->isVisible() ) return QRect(); else return method->widget->geometry(); } void InputMethods::loadInputMethods() { #ifndef SINGLE_APP hideInputMethod(); method = 0; QValueList<InputMethod>::Iterator mit; for ( mit = inputMethodList.begin(); mit != inputMethodList.end(); ++mit ) { (*mit).interface->release(); (*mit).library->unload(); delete (*mit).library; } inputMethodList.clear(); QString path = QPEApplication::qpeDir() + "/plugins/inputmethods"; QDir dir( path, "lib*.so" ); QStringList list = dir.entryList(); QStringList::Iterator it; for ( it = list.begin(); it != list.end(); ++it ) { InputMethodInterface *iface = 0; QLibrary *lib = new QLibrary( path + "/" + *it ); if ( lib->queryInterface( IID_InputMethod, (QUnknownInterface**)&iface ) == QS_OK ) { InputMethod input; input.library = lib; input.interface = iface; input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); inputMethodList.append( input ); QString type = (*it).left( (*it).find(".") ); QStringList langs = Global::languageList(); for (QStringList::ConstIterator lit = langs.begin(); lit!=langs.end(); ++lit) { QString lang = *lit; QTranslator * trans = new QTranslator(qApp); QString tfn = QPEApplication::qpeDir()+"/i18n/"+lang+"/"+type+".qm"; if ( trans->load( tfn )) qApp->installTranslator( trans ); else delete trans; } } else { delete lib; } } #else InputMethod input; input.interface = new HandwritingImpl(); input.widget = input.interface->inputMethod( 0, inputWidgetStyle ); input.interface->onKeyPress( this, SLOT(sendKey(ushort,ushort,ushort,bool,bool)) ); inputMethodList.append( input ); diff --git a/core/launcher/mrulist.cpp b/core/launcher/mrulist.cpp index 5590d38..0530fd6 100644 --- a/core/launcher/mrulist.cpp +++ b/core/launcher/mrulist.cpp @@ -1,223 +1,224 @@ /********************************************************************** ** Copyright (C) 2002 Holger 'zecke' Freyther ** Copyright (C) 2000 Trolltech AS. All rights reserved. ** ** This file is part of 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. ** **********************************************************************/ #include "mrulist.h" #include <qpe/global.h> #include <qpe/applnk.h> #include <qpe/resource.h> #include <qframe.h> #include <qpushbutton.h> #include <qtoolbutton.h> #include <qpopupmenu.h> #include <qpainter.h> #include <qwindowsystem_qws.h> QList<MRUList> *MRUList::MRUListWidgets = NULL; QList<AppLnk> *MRUList::task = NULL; MRUList::MRUList( QWidget *parent ) : QFrame( parent ), selected(-1), oldsel(-1) { - setBackgroundMode( PaletteButton ); + setBackgroundMode( PaletteBackground ); if (!MRUListWidgets) MRUListWidgets = new QList<MRUList>; if (!task) task = new QList<AppLnk>; MRUListWidgets->append( this ); } MRUList::~MRUList() { if (MRUListWidgets) MRUListWidgets->remove( this ); if (task) task->setAutoDelete( TRUE ); } QSize MRUList::sizeHint() const { return QSize( frameWidth(), 16 ); } // thanks to John from Trolltech void MRUList::removeTask(const QString &appName ) { qWarning("MRULList::removeTask( %s)", appName.latin1() ); if(appName.isEmpty() ) return; if(!task ) // at least it should be called once before return; unsigned int i= 0; for ( ; i < task->count(); i++ ) { AppLnk *t = task->at(i); if ( t->exec() == appName ) task->remove(); } for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) MRUListWidgets->at(i)->update(); } void MRUList::addTask( const AppLnk *appLnk ) { qWarning("Add Task" ); if ( !appLnk ) return; unsigned int i = 0; if ( !task ) return; i = 0; for ( ; i < task->count(); i++ ) { AppLnk *t = task->at(i); if ( t->exec() == appLnk->exec() ) { if (i != 0) { task->remove(); task->prepend( t ); } for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) MRUListWidgets->at(i)->update(); return; } } // check which tasks are running and delete them from the list AppLnk *t = new AppLnk( *appLnk ); // DocLnks have an overloaded virtual function exec() t->setExec( appLnk->exec() ); task->prepend( t ); if ( task->count() > 6 ) { t = task->last(); task->remove(); Global::terminate(t); delete t; } for (unsigned i = 0; i < MRUListWidgets->count(); i++ ) MRUListWidgets->at(i)->update(); } bool MRUList::quitOldApps() { QStringList appsstarted; QStringList appsrunning; for ( int i=task->count()-1; i>=0; --i ) { AppLnk *t = task->at(i); appsstarted.append(t->exec()); } const QList<QWSWindow> &list = qwsServer->clientWindows(); QWSWindow* w; for (QListIterator<QWSWindow> it(list); (w=it.current()); ++it) { QString app = w->client()->identity(); if ( appsstarted.contains(app) && !appsrunning.contains(app) ) appsrunning.append(app); } if ( appsrunning.count() > 1 ) { QStringList::ConstIterator it = appsrunning.begin(); ++it; // top stays running! for (; it != appsrunning.end(); it++) { for ( int i=task->count()-1; i>=0; --i ) { AppLnk *t = task->at(i); if ( t->exec() == *it ){ task->remove(i ); delete t; Global::terminate(t); } } } return TRUE; } else { return FALSE; } } void MRUList::mousePressEvent(QMouseEvent *e) { selected = 0; int x=0; QListIterator<AppLnk> it( *task ); for ( ; it.current(); ++it,++selected,x+=15 ) { if ( x + 15 <= width() ) { if ( e->x() >= x && e->x() < x+15 ) { if ( selected < (int)task->count() ) { repaint(FALSE); return; } } } else { break; } } selected = -1; repaint( FALSE ); } void MRUList::mouseReleaseEvent(QMouseEvent *) { if ( selected >= 0 ) { if ( parentWidget() ) if ( parentWidget()->isA( "QPopupMenu" ) ) parentWidget()->hide(); Global::execute( task->at(selected)->exec() ); selected = -1; oldsel = -1; update(); } } void MRUList::paintEvent( QPaintEvent * ) { QPainter p( this ); AppLnk *t; int x = 0; int y = (height() - 14) / 2; int i = 0; - p.fillRect( 0, 0, width(), height(), colorGroup().background() ); +// p.fillRect( 0, 0, width(), height(), colorGroup().background() ); + erase ( ); if ( task ) { QListIterator<AppLnk> it( *task ); for ( ; it.current(); i++, ++it ) { if ( x + 15 <= width() ) { t = it.current(); if ( (int)i == selected ) p.fillRect( x, y, 15, t->pixmap().height()+1, colorGroup().highlight() ); else if ( (int)i == oldsel ) p.eraseRect( x, y, 15, t->pixmap().height()+1 ); p.drawPixmap( x, y, t->pixmap() ); x += 15; } } } } |