From e91351d2c22ab041b85f49e243e1f510edf7984e Mon Sep 17 00:00:00 2001 From: sandman Date: Mon, 23 Dec 2002 03:24:31 +0000 Subject: small bugfixes and speedup --- diff --git a/core/settings/button/buttonsettings.cpp b/core/settings/button/buttonsettings.cpp index c71514c..8b0b0a8 100644 --- a/core/settings/button/buttonsettings.cpp +++ b/core/settings/button/buttonsettings.cpp @@ -60,6 +60,7 @@ ButtonSettings::ButtonSettings ( ) : QDialog ( 0, "ButtonSettings", false, WStyle_ContextHelp ) { const QValueList &buttons = ODevice::inst ( )-> buttons ( ); + (void) ButtonUtils::inst ( ); // initialise setCaption ( tr( "Button Settings" )); @@ -133,6 +134,7 @@ ButtonSettings::ButtonSettings ( ) toplay-> addStretch ( 10 ); m_last_button = 0; + m_lock = false; m_timer = new QTimer ( this ); connect ( m_timer, SIGNAL( timeout ( )), this, SLOT( keyTimeout ( ))); @@ -208,6 +210,10 @@ void ButtonSettings::edit ( buttoninfo *bi, bool hold ) { qDebug ( "remap %s for %s", hold ? "hold" : "press", bi-> m_button-> userText ( ). latin1 ( )); + if ( m_lock ) + return; + m_lock = true; + RemapDlg *d = new RemapDlg ( bi-> m_button, hold, this ); d-> showMaximized ( ); @@ -227,6 +233,8 @@ void ButtonSettings::edit ( buttoninfo *bi, bool hold ) } delete d; + + m_lock = false; } void ButtonSettings::accept ( ) diff --git a/core/settings/button/buttonsettings.h b/core/settings/button/buttonsettings.h index f571825..d41a209 100644 --- a/core/settings/button/buttonsettings.h +++ b/core/settings/button/buttonsettings.h @@ -67,6 +67,7 @@ private: buttoninfo *m_last_button; QList m_infos; + bool m_lock; }; #endif diff --git a/core/settings/button/buttonutils.cpp b/core/settings/button/buttonutils.cpp index bb70047..91d2af3 100644 --- a/core/settings/button/buttonutils.cpp +++ b/core/settings/button/buttonutils.cpp @@ -101,19 +101,27 @@ void ButtonUtils::insertActions ( QListViewItem *here ) void ButtonUtils::insertAppLnks ( QListViewItem *here ) { - QStringList types = m_apps-> types ( ); + QStringList types = m_apps-> types ( ); + QListViewItem *typeitem [types. count ( )]; + int i = 0; for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { QListViewItem *item = new QListViewItem ( here, m_apps-> typeName ( *it )); item-> setPixmap ( 0, m_apps-> typePixmap ( *it )); - - for ( QListIterator appit ( m_apps-> children ( )); *appit; ++appit ) { - AppLnk *l = *appit; - + + typeitem [i++] = item; + } + + for ( QListIterator appit ( m_apps-> children ( )); *appit; ++appit ) { + AppLnk *l = *appit; + + int i = 0; + for ( QStringList::Iterator it = types. begin ( ); it != types. end ( ); ++it ) { if ( l-> type ( ) == *it ) { - QListViewItem *sub = new QListViewItem ( item, l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" ); + QListViewItem *sub = new QListViewItem ( typeitem [i], l-> name ( ), QString ( "QPE/Application/" ) + l-> exec ( ), "raise()" ); sub-> setPixmap ( 0, l-> pixmap ( )); } - } + i++; + } } } diff --git a/core/settings/button/remapdlg.cpp b/core/settings/button/remapdlg.cpp index 511d0e7..a251bd4 100644 --- a/core/settings/button/remapdlg.cpp +++ b/core/settings/button/remapdlg.cpp @@ -1,6 +1,7 @@ #include #include #include +#include #include "remapdlg.h" #include "buttonutils.h" @@ -46,6 +47,11 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c : RemapDlgBase ( parent, name, true, WStyle_ContextHelp ) { setCaption ( tr( "%1 %2", "(hold|press) buttoname" ). arg( hold ? tr( "Held" ) : tr( "Pressed" )). arg ( b-> userText ( ))); + + m_current = 0; + + static const char * const def_channels [] = { "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 }; + w_channel-> insertStrList ((const char **) def_channels ); m_msg = hold ? b-> heldAction ( ) : b-> pressedAction ( ); m_msg_preset = hold ? b-> factoryPresetHeldAction ( ) : b-> factoryPresetPressedAction ( ); @@ -59,23 +65,30 @@ RemapDlg::RemapDlg ( const Opie::ODeviceButton *b, bool hold, QWidget *parent, c ButtonUtils::inst ( )-> insertActions ( it ); it-> setOpen ( true ); - it = new NoSortItem ( w_list, 4, tr( "Show" )); - ButtonUtils::inst ( )-> insertAppLnks ( it ); + m_map_show = new NoSortItem ( w_list, 4, tr( "Show" )); m_current = m_map_custom; w_list-> setCurrentItem ( m_current ); - static const char * const def_channels [] = { - "QPE/Application/", "QPE/Launcher", "QPE/System", "QPE/TaskBar", "QPE/", 0 - }; - - w_channel-> insertStrList ((const char **) def_channels ); + QTimer::singleShot ( 0, this, SLOT( delayedInit ( ))); } RemapDlg::~RemapDlg ( ) { } +void RemapDlg::delayedInit ( ) +{ + bool b = w_list-> viewport ( )-> isUpdatesEnabled ( ); + w_list-> viewport ( )-> setUpdatesEnabled ( false ); + + ButtonUtils::inst ( )-> insertAppLnks ( m_map_show ); + + w_list-> viewport ( )-> setUpdatesEnabled ( b ); + + m_map_show-> repaint ( ); +} + void RemapDlg::itemChanged ( QListViewItem *it ) { bool enabled = false; diff --git a/core/settings/button/remapdlg.h b/core/settings/button/remapdlg.h index 8c9cc02..046a22f 100644 --- a/core/settings/button/remapdlg.h +++ b/core/settings/button/remapdlg.h @@ -20,6 +20,9 @@ public: public slots: virtual void itemChanged ( QListViewItem * ); virtual void textChanged ( const QString & ); + +private slots: + void delayedInit ( ); private: Opie::OQCopMessage m_msg; @@ -30,6 +33,7 @@ private: QListViewItem *m_map_none; QListViewItem *m_map_preset; QListViewItem *m_map_custom; + QListViewItem *m_map_show; }; #endif -- cgit v0.9.0.2