From 26149b29fb1896980daf34ecb096edeadf695b46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubo=C5=A1=20Lu=C5=88=C3=A1k?= Date: Thu, 1 Nov 2007 18:51:01 +0000 Subject: [PATCH] Porting uic3->uic4 is fun. svn path=/trunk/KDE/kdebase/workspace/; revision=731738 --- kcmkwin/kwinrules/CMakeLists.txt | 4 +- kcmkwin/kwinrules/detectwidget.cpp | 3 +- kcmkwin/kwinrules/detectwidget.h | 17 +- .../{detectwidgetbase.ui => detectwidget.ui} | 4 +- kcmkwin/kwinrules/editshortcut.ui | 164 ++++++++++++++++++ kcmkwin/kwinrules/editshortcutbase.ui | 164 ------------------ kcmkwin/kwinrules/ruleslist.cpp | 3 +- kcmkwin/kwinrules/ruleslist.h | 16 +- .../{ruleslistbase.ui => ruleslist.ui} | 4 +- kcmkwin/kwinrules/ruleswidget.cpp | 53 +++--- kcmkwin/kwinrules/ruleswidget.h | 19 +- 11 files changed, 217 insertions(+), 234 deletions(-) rename kcmkwin/kwinrules/{detectwidgetbase.ui => detectwidget.ui} (98%) create mode 100644 kcmkwin/kwinrules/editshortcut.ui delete mode 100644 kcmkwin/kwinrules/editshortcutbase.ui rename kcmkwin/kwinrules/{ruleslistbase.ui => ruleslist.ui} (96%) diff --git a/kcmkwin/kwinrules/CMakeLists.txt b/kcmkwin/kwinrules/CMakeLists.txt index 90c5ccc767..c709b8896e 100644 --- a/kcmkwin/kwinrules/CMakeLists.txt +++ b/kcmkwin/kwinrules/CMakeLists.txt @@ -3,8 +3,8 @@ ADD_DEFINITIONS(-DKCMRULES) set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp) -kde4_add_ui_files(kwinrules_SRCS ruleslistbase.ui detectwidgetbase.ui) -kde4_add_ui3_files(kwinrules_SRCS ruleswidgetbase.ui editshortcutbase.ui ) +kde4_add_ui_files(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui) +kde4_add_ui3_files(kwinrules_SRCS ruleswidgetbase.ui) set(kwin_rules_dialog_KDEINIT_SRCS main.cpp ${kwinrules_SRCS}) diff --git a/kcmkwin/kwinrules/detectwidget.cpp b/kcmkwin/kwinrules/detectwidget.cpp index 63cf0be13d..1cd0394185 100644 --- a/kcmkwin/kwinrules/detectwidget.cpp +++ b/kcmkwin/kwinrules/detectwidget.cpp @@ -41,8 +41,9 @@ namespace KWin { DetectWidget::DetectWidget( QWidget* parent ) -: DetectWidgetBase( parent ) + : QWidget( parent ) { + setupUi( this ); } DetectDialog::DetectDialog( QWidget* parent, const char* name ) diff --git a/kcmkwin/kwinrules/detectwidget.h b/kcmkwin/kwinrules/detectwidget.h index ea6319225b..f8d65c0707 100644 --- a/kcmkwin/kwinrules/detectwidget.h +++ b/kcmkwin/kwinrules/detectwidget.h @@ -20,8 +20,6 @@ #ifndef __DETECTWIDGET_H__ #define __DETECTWIDGET_H__ -#include "ui_detectwidgetbase.h" - #include #include @@ -30,24 +28,17 @@ #include #include +#include "ui_detectwidget.h" + namespace KWin { -class DetectWidgetBase : public QWidget, public Ui::DetectWidgetBase -{ -public: - DetectWidgetBase( QWidget *parent ) : QWidget( parent ) { - setupUi( this ); - } -}; - - class DetectWidget - : public DetectWidgetBase + : public QWidget, public Ui_DetectWidget { Q_OBJECT public: - DetectWidget( QWidget* parent = NULL ); + explicit DetectWidget( QWidget* parent = NULL ); }; class DetectDialog diff --git a/kcmkwin/kwinrules/detectwidgetbase.ui b/kcmkwin/kwinrules/detectwidget.ui similarity index 98% rename from kcmkwin/kwinrules/detectwidgetbase.ui rename to kcmkwin/kwinrules/detectwidget.ui index bcf683e076..e5e4b69b6f 100644 --- a/kcmkwin/kwinrules/detectwidgetbase.ui +++ b/kcmkwin/kwinrules/detectwidget.ui @@ -2,8 +2,8 @@ - KWin::DetectWidgetBase - + KWin::DetectWidget + 0 diff --git a/kcmkwin/kwinrules/editshortcut.ui b/kcmkwin/kwinrules/editshortcut.ui new file mode 100644 index 0000000000..f5bdbbb6a3 --- /dev/null +++ b/kcmkwin/kwinrules/editshortcut.ui @@ -0,0 +1,164 @@ + + EditShortcut + + + + 0 + 0 + 1194 + 447 + + + + + + + A single shortcut can be easily assigned or cleared using the two buttons. Only shortcuts with modifiers can be used.<p> +It is possible to have several possible shortcuts, and the first available shortcut will be used. The shortcuts are specified using space-separated shortcut sets. One set is specified as <i>base</i>+(<i>list</i>), where base are modifiers and list is a list of keys.<br> +For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try <b>Shift+Alt+1</b>, then others with <b>Shift+Ctrl+C</b> as the last one. + + + Qt::RichText + + + true + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + &Single Shortcut + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + C&lear + + + + + + + Qt::Vertical + + + QSizePolicy::Expanding + + + + 40 + 20 + + + + + + + + + + QFrame::HLine + + + QFrame::Sunken + + + + + + + + qPixmapFromMimeSource + + + KLineEdit + QWidget +
klineedit.h
+
+
+ + + + pushButton1 + clicked() + EditShortcut + editShortcut() + + + 20 + 20 + + + 20 + 20 + + + + + pushButton2 + clicked() + EditShortcut + clearShortcut() + + + 20 + 20 + + + 20 + 20 + + + + +
diff --git a/kcmkwin/kwinrules/editshortcutbase.ui b/kcmkwin/kwinrules/editshortcutbase.ui deleted file mode 100644 index 0256a15644..0000000000 --- a/kcmkwin/kwinrules/editshortcutbase.ui +++ /dev/null @@ -1,164 +0,0 @@ - -EditShortcutBase - - - EditShortcutBase - - - - 0 - 0 - 587 - 402 - - - - - unnamed - - - - textLabel2 - - - A single shortcut can be easily assigned or cleared using the two buttons. Only shortcuts with modifiers can be used.<p> -It is possible to have several possible shortcuts, and the first available shortcut will be used. The shortcuts are specified using space-separated shortcut sets. One set is specified as <i>base</i>+(<i>list</i>), where base are modifiers and list is a list of keys.<br> -For example "<b>Shift+Alt+(123) Shift+Ctrl+(ABC)</b>" will first try <b>Shift+Alt+1</b>, then others with <b>Shift+Ctrl+C</b> as the last one. - - - Qt::RichText - - - - - line1 - - - HLine - - - Sunken - - - Qt::Horizontal - - - - - shortcut - - - - - layout2 - - - - unnamed - - - - spacer1 - - - Qt::Horizontal - - - Expanding - - - - 40 - 20 - - - - - - pushButton1 - - - &Single Shortcut - - - - - spacer2 - - - Qt::Horizontal - - - Expanding - - - - 40 - 20 - - - - - - pushButton2 - - - C&lear - - - - - spacer3 - - - Qt::Horizontal - - - Expanding - - - - 40 - 20 - - - - - - - - line2 - - - HLine - - - Sunken - - - Qt::Horizontal - - - - - - - pushButton1 - clicked() - EditShortcutBase - editShortcut() - - - pushButton2 - clicked() - EditShortcutBase - clearShortcut() - - - - editShortcut() - clearShortcut() - - - - diff --git a/kcmkwin/kwinrules/ruleslist.cpp b/kcmkwin/kwinrules/ruleslist.cpp index f8cb52f641..9f707cf3b1 100644 --- a/kcmkwin/kwinrules/ruleslist.cpp +++ b/kcmkwin/kwinrules/ruleslist.cpp @@ -30,8 +30,9 @@ namespace KWin { KCMRulesList::KCMRulesList( QWidget* parent) -: KCMRulesListBase( parent) + : QWidget( parent) { + setupUi( this ); // connect both current/selected, so that current==selected (stupid QListBox :( ) connect( rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)), SLOT(activeChanged())); diff --git a/kcmkwin/kwinrules/ruleslist.h b/kcmkwin/kwinrules/ruleslist.h index 915a848921..53c1155b03 100644 --- a/kcmkwin/kwinrules/ruleslist.h +++ b/kcmkwin/kwinrules/ruleslist.h @@ -20,27 +20,15 @@ #ifndef __RULESLIST_H__ #define __RULESLIST_H__ -#include "ui_ruleslistbase.h" - - - #include "../../rules.h" +#include "ui_ruleslist.h" namespace KWin { -class KCMRulesListBase : public QWidget, public Ui::KCMRulesListBase -{ -public: - KCMRulesListBase( QWidget *parent ) : QWidget( parent ) { - setupUi( this ); - } -}; - - class KCMRulesList - : public KCMRulesListBase + : public QWidget, Ui_KCMRulesList { Q_OBJECT public: diff --git a/kcmkwin/kwinrules/ruleslistbase.ui b/kcmkwin/kwinrules/ruleslist.ui similarity index 96% rename from kcmkwin/kwinrules/ruleslistbase.ui rename to kcmkwin/kwinrules/ruleslist.ui index 68727970e5..9e8ce24922 100644 --- a/kcmkwin/kwinrules/ruleslistbase.ui +++ b/kcmkwin/kwinrules/ruleslist.ui @@ -2,8 +2,8 @@ - KWin::KCMRulesListBase - + KWin::KCMRulesList + 0 diff --git a/kcmkwin/kwinrules/ruleswidget.cpp b/kcmkwin/kwinrules/ruleswidget.cpp index ead0021da0..91a6c4e3af 100644 --- a/kcmkwin/kwinrules/ruleswidget.cpp +++ b/kcmkwin/kwinrules/ruleswidget.cpp @@ -48,8 +48,8 @@ namespace KWin rule_##var->setWhatsThis( type##RuleDesc ); RulesWidget::RulesWidget( QWidget* parent ) -: RulesWidgetBase( parent ) -, detect_dlg( NULL ) + : RulesWidgetBase( parent ) + , detect_dlg( NULL ) { QString enableDesc = i18n( "Enable this checkbox to alter this window property for the specified window(s)." ); @@ -679,15 +679,10 @@ void RulesWidget::prepareWindowSpecific( WId window ) void RulesWidget::shortcutEditClicked() { -#ifdef __GNUC__ -#warning KShortcutDialog is gone, and it is a good opportunity to clean up here -#endif -#if 0 EditShortcutDialog dlg( topLevelWidget()); dlg.setShortcut( shortcut->text()); if( dlg.exec() == QDialog::Accepted ) shortcut->setText( dlg.shortcut()); -#endif } RulesDialog::RulesDialog( QWidget* parent, const char* name ) @@ -737,13 +732,10 @@ void RulesDialog::accept() KDialog::accept(); } -#ifdef __GNUC__ -#warning KShortcutDialog is gone -#endif -#if 0 EditShortcut::EditShortcut( QWidget* parent ) -: EditShortcutBase( parent ) + : QWidget( parent ) { + setupUi( this ); } void EditShortcut::editShortcut() @@ -761,13 +753,13 @@ void EditShortcut::clearShortcut() EditShortcutDialog::EditShortcutDialog( QWidget* parent, const char* name ) : KDialog( parent ) { - setObjectName( name ); - setModal( true ); - setCaption( i18n( "Edit Shortcut" ) ); - setButtons( Ok | Cancel ); + setObjectName( name ); + setModal( true ); + setCaption( i18n( "Edit Shortcut" ) ); + setButtons( Ok | Cancel ); - widget = new EditShortcut( this ); - setMainWidget( widget ); + widget = new EditShortcut( this ); + setMainWidget( widget ); } void EditShortcutDialog::setShortcut( const QString& cut ) @@ -781,14 +773,20 @@ QString EditShortcutDialog::shortcut() const } ShortcutDialog::ShortcutDialog( const KShortcut& cut, QWidget* parent ) - : KShortcutDialog( cut, parent ) + : KDialog( parent ) + , widget( new KShortcutWidget( this )) { + widget->setShortcut( cut ); + setMainWidget( widget ); } void ShortcutDialog::accept() { - foreach( const QKeySequence &seq, shortcut() ) + for( int i = 0; + i < 2; + ++i ) { + QKeySequence seq = i == 0 ? shortcut().primary() : shortcut().alternate(); if( seq.isEmpty()) break; if( seq[0] == Qt::Key_Escape ) @@ -798,21 +796,26 @@ void ShortcutDialog::accept() } if( seq[0] == Qt::Key_Space ) { // clear - setShortcut( KShortcut()); - KShortcutDialog::accept(); + widget->setShortcut( KShortcut()); + KDialog::accept(); return; } if( (seq[0] & Qt::KeyboardModifierMask) == 0 ) { // no shortcuts without modifiers KShortcut cut = shortcut(); cut.remove( seq ); - setShortcut( cut ); + widget->setShortcut( cut ); return; } } - KShortcutDialog::accept(); + KDialog::accept(); } -#endif + +KShortcut ShortcutDialog::shortcut() const + { + return widget->shortcut(); + } + } // namespace #include "ruleswidget.moc" diff --git a/kcmkwin/kwinrules/ruleswidget.h b/kcmkwin/kwinrules/ruleswidget.h index b0905fca3d..940309010c 100644 --- a/kcmkwin/kwinrules/ruleswidget.h +++ b/kcmkwin/kwinrules/ruleswidget.h @@ -22,10 +22,10 @@ #include #include -//#include +#include #include "ruleswidgetbase.h" -#include "editshortcutbase.h" +#include "ui_editshortcut.h" namespace KWin { @@ -110,17 +110,13 @@ class RulesDialog Rules* rules; }; -#ifdef __GNUC__ -#warning KShortcutDialog is gone -#endif //__GNUC__ -#if 0 class EditShortcut - : public EditShortcutBase + : public QWidget, public Ui_EditShortcut { Q_OBJECT public: EditShortcut( QWidget* parent = NULL ); - protected: + protected slots: void editShortcut(); void clearShortcut(); }; @@ -139,14 +135,17 @@ class EditShortcutDialog // slightly duped from utils.cpp class ShortcutDialog - : public KShortcutDialog + : public KDialog { Q_OBJECT public: ShortcutDialog( const KShortcut& cut, QWidget* parent = NULL ); virtual void accept(); + KShortcut shortcut() const; + private: + KShortcutWidget* widget; }; -#endif //0 + } // namespace #endif