Porting uic3->uic4 is fun.

svn path=/trunk/KDE/kdebase/workspace/; revision=731738
This commit is contained in:
Luboš Luňák 2007-11-01 18:51:01 +00:00
parent bb9ff25ec4
commit 26149b29fb
11 changed files with 217 additions and 234 deletions

View file

@ -3,8 +3,8 @@ ADD_DEFINITIONS(-DKCMRULES)
set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp) set(kwinrules_SRCS ruleswidget.cpp ruleslist.cpp kwinsrc.cpp detectwidget.cpp)
kde4_add_ui_files(kwinrules_SRCS ruleslistbase.ui detectwidgetbase.ui) kde4_add_ui_files(kwinrules_SRCS ruleslist.ui detectwidget.ui editshortcut.ui)
kde4_add_ui3_files(kwinrules_SRCS ruleswidgetbase.ui editshortcutbase.ui ) kde4_add_ui3_files(kwinrules_SRCS ruleswidgetbase.ui)
set(kwin_rules_dialog_KDEINIT_SRCS main.cpp ${kwinrules_SRCS}) set(kwin_rules_dialog_KDEINIT_SRCS main.cpp ${kwinrules_SRCS})

View file

@ -41,8 +41,9 @@ namespace KWin
{ {
DetectWidget::DetectWidget( QWidget* parent ) DetectWidget::DetectWidget( QWidget* parent )
: DetectWidgetBase( parent ) : QWidget( parent )
{ {
setupUi( this );
} }
DetectDialog::DetectDialog( QWidget* parent, const char* name ) DetectDialog::DetectDialog( QWidget* parent, const char* name )

View file

@ -20,8 +20,6 @@
#ifndef __DETECTWIDGET_H__ #ifndef __DETECTWIDGET_H__
#define __DETECTWIDGET_H__ #define __DETECTWIDGET_H__
#include "ui_detectwidgetbase.h"
#include <KDialog> #include <KDialog>
#include <kwindowsystem.h> #include <kwindowsystem.h>
@ -30,24 +28,17 @@
#include <QEvent> #include <QEvent>
#include <QByteArray> #include <QByteArray>
#include "ui_detectwidget.h"
namespace KWin namespace KWin
{ {
class DetectWidgetBase : public QWidget, public Ui::DetectWidgetBase
{
public:
DetectWidgetBase( QWidget *parent ) : QWidget( parent ) {
setupUi( this );
}
};
class DetectWidget class DetectWidget
: public DetectWidgetBase : public QWidget, public Ui_DetectWidget
{ {
Q_OBJECT Q_OBJECT
public: public:
DetectWidget( QWidget* parent = NULL ); explicit DetectWidget( QWidget* parent = NULL );
}; };
class DetectDialog class DetectDialog

View file

@ -2,8 +2,8 @@
<author></author> <author></author>
<comment></comment> <comment></comment>
<exportmacro></exportmacro> <exportmacro></exportmacro>
<class>KWin::DetectWidgetBase</class> <class>KWin::DetectWidget</class>
<widget class="QWidget" name="KWin::DetectWidgetBase" > <widget class="QWidget" name="KWin::DetectWidget" >
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>

View file

@ -0,0 +1,164 @@
<ui version="4.0" >
<class>EditShortcut</class>
<widget class="QWidget" name="EditShortcut" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>1194</width>
<height>447</height>
</rect>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QLabel" name="textLabel2" >
<property name="text" >
<string>A single shortcut can be easily assigned or cleared using the two buttons. Only shortcuts with modifiers can be used.&lt;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 &lt;i>base&lt;/i>+(&lt;i>list&lt;/i>), where base are modifiers and list is a list of keys.&lt;br>
For example "&lt;b>Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b>" will first try &lt;b>Shift+Alt+1&lt;/b>, then others with &lt;b>Shift+Ctrl+C&lt;/b> as the last one.</string>
</property>
<property name="textFormat" >
<enum>Qt::RichText</enum>
</property>
<property name="wordWrap" >
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="Line" name="line1" >
<property name="frameShape" >
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
<item>
<widget class="KLineEdit" native="1" name="shortcut" />
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton1" >
<property name="text" >
<string>&amp;Single Shortcut</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="pushButton2" >
<property name="text" >
<string>C&amp;lear</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType" >
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="Line" name="line2" >
<property name="frameShape" >
<enum>QFrame::HLine</enum>
</property>
<property name="frameShadow" >
<enum>QFrame::Sunken</enum>
</property>
</widget>
</item>
</layout>
</widget>
<layoutdefault spacing="6" margin="11" />
<layoutfunction spacing="KDialog::spacingHint" margin="KDialog::marginHint" />
<pixmapfunction>qPixmapFromMimeSource</pixmapfunction>
<customwidgets>
<customwidget>
<class>KLineEdit</class>
<extends>QWidget</extends>
<header>klineedit.h</header>
</customwidget>
</customwidgets>
<resources/>
<connections>
<connection>
<sender>pushButton1</sender>
<signal>clicked()</signal>
<receiver>EditShortcut</receiver>
<slot>editShortcut()</slot>
<hints>
<hint type="sourcelabel" >
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel" >
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
<connection>
<sender>pushButton2</sender>
<signal>clicked()</signal>
<receiver>EditShortcut</receiver>
<slot>clearShortcut()</slot>
<hints>
<hint type="sourcelabel" >
<x>20</x>
<y>20</y>
</hint>
<hint type="destinationlabel" >
<x>20</x>
<y>20</y>
</hint>
</hints>
</connection>
</connections>
</ui>

View file

@ -1,164 +0,0 @@
<!DOCTYPE UI><UI version="3.3" stdsetdef="1">
<class>EditShortcutBase</class>
<widget class="QWidget">
<property name="name">
<cstring>EditShortcutBase</cstring>
</property>
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>587</width>
<height>402</height>
</rect>
</property>
<vbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<widget class="QLabel">
<property name="name">
<cstring>textLabel2</cstring>
</property>
<property name="text">
<string>A single shortcut can be easily assigned or cleared using the two buttons. Only shortcuts with modifiers can be used.&lt;p&gt;
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 &lt;i&gt;base&lt;/i&gt;+(&lt;i&gt;list&lt;/i&gt;), where base are modifiers and list is a list of keys.&lt;br&gt;
For example "&lt;b&gt;Shift+Alt+(123) Shift+Ctrl+(ABC)&lt;/b&gt;" will first try &lt;b&gt;Shift+Alt+1&lt;/b&gt;, then others with &lt;b&gt;Shift+Ctrl+C&lt;/b&gt; as the last one.</string>
</property>
<property name="textFormat">
<enum>Qt::RichText</enum>
</property>
</widget>
<widget class="Line">
<property name="name">
<cstring>line1</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
<widget class="KLineEdit">
<property name="name">
<cstring>shortcut</cstring>
</property>
</widget>
<widget class="QLayoutWidget">
<property name="name">
<cstring>layout2</cstring>
</property>
<hbox>
<property name="name">
<cstring>unnamed</cstring>
</property>
<spacer>
<property name="name">
<cstring>spacer1</cstring>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pushButton1</cstring>
</property>
<property name="text">
<string>&amp;Single Shortcut</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer2</cstring>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
<widget class="QPushButton">
<property name="name">
<cstring>pushButton2</cstring>
</property>
<property name="text">
<string>C&amp;lear</string>
</property>
</widget>
<spacer>
<property name="name">
<cstring>spacer3</cstring>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>Expanding</enum>
</property>
<property name="sizeHint">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</hbox>
</widget>
<widget class="Line">
<property name="name">
<cstring>line2</cstring>
</property>
<property name="frameShape">
<enum>HLine</enum>
</property>
<property name="frameShadow">
<enum>Sunken</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</widget>
</vbox>
</widget>
<connections>
<connection>
<sender>pushButton1</sender>
<signal>clicked()</signal>
<receiver>EditShortcutBase</receiver>
<slot>editShortcut()</slot>
</connection>
<connection>
<sender>pushButton2</sender>
<signal>clicked()</signal>
<receiver>EditShortcutBase</receiver>
<slot>clearShortcut()</slot>
</connection>
</connections>
<slots>
<slot access="protected" specifier="pure virtual">editShortcut()</slot>
<slot access="protected" specifier="pure virtual">clearShortcut()</slot>
</slots>
<layoutdefaults spacing="6" margin="11"/>
<layoutfunctions spacing="KDialog::spacingHint" margin="KDialog::marginHint"/>
</UI>

View file

@ -30,8 +30,9 @@ namespace KWin
{ {
KCMRulesList::KCMRulesList( QWidget* parent) KCMRulesList::KCMRulesList( QWidget* parent)
: KCMRulesListBase( parent) : QWidget( parent)
{ {
setupUi( this );
// connect both current/selected, so that current==selected (stupid QListBox :( ) // connect both current/selected, so that current==selected (stupid QListBox :( )
connect( rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)), connect( rules_listbox, SIGNAL(itemChanged(QListWidgetItem*)),
SLOT(activeChanged())); SLOT(activeChanged()));

View file

@ -20,27 +20,15 @@
#ifndef __RULESLIST_H__ #ifndef __RULESLIST_H__
#define __RULESLIST_H__ #define __RULESLIST_H__
#include "ui_ruleslistbase.h"
#include "../../rules.h" #include "../../rules.h"
#include "ui_ruleslist.h"
namespace KWin namespace KWin
{ {
class KCMRulesListBase : public QWidget, public Ui::KCMRulesListBase
{
public:
KCMRulesListBase( QWidget *parent ) : QWidget( parent ) {
setupUi( this );
}
};
class KCMRulesList class KCMRulesList
: public KCMRulesListBase : public QWidget, Ui_KCMRulesList
{ {
Q_OBJECT Q_OBJECT
public: public:

View file

@ -2,8 +2,8 @@
<author></author> <author></author>
<comment></comment> <comment></comment>
<exportmacro></exportmacro> <exportmacro></exportmacro>
<class>KWin::KCMRulesListBase</class> <class>KWin::KCMRulesList</class>
<widget class="QWidget" name="KWin::KCMRulesListBase" > <widget class="QWidget" name="KWin::KCMRulesList" >
<property name="geometry" > <property name="geometry" >
<rect> <rect>
<x>0</x> <x>0</x>

View file

@ -48,8 +48,8 @@ namespace KWin
rule_##var->setWhatsThis( type##RuleDesc ); rule_##var->setWhatsThis( type##RuleDesc );
RulesWidget::RulesWidget( QWidget* parent ) RulesWidget::RulesWidget( QWidget* parent )
: RulesWidgetBase( parent ) : RulesWidgetBase( parent )
, detect_dlg( NULL ) , detect_dlg( NULL )
{ {
QString enableDesc = QString enableDesc =
i18n( "Enable this checkbox to alter this window property for the specified window(s)." ); 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() 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()); EditShortcutDialog dlg( topLevelWidget());
dlg.setShortcut( shortcut->text()); dlg.setShortcut( shortcut->text());
if( dlg.exec() == QDialog::Accepted ) if( dlg.exec() == QDialog::Accepted )
shortcut->setText( dlg.shortcut()); shortcut->setText( dlg.shortcut());
#endif
} }
RulesDialog::RulesDialog( QWidget* parent, const char* name ) RulesDialog::RulesDialog( QWidget* parent, const char* name )
@ -737,13 +732,10 @@ void RulesDialog::accept()
KDialog::accept(); KDialog::accept();
} }
#ifdef __GNUC__
#warning KShortcutDialog is gone
#endif
#if 0
EditShortcut::EditShortcut( QWidget* parent ) EditShortcut::EditShortcut( QWidget* parent )
: EditShortcutBase( parent ) : QWidget( parent )
{ {
setupUi( this );
} }
void EditShortcut::editShortcut() void EditShortcut::editShortcut()
@ -761,13 +753,13 @@ void EditShortcut::clearShortcut()
EditShortcutDialog::EditShortcutDialog( QWidget* parent, const char* name ) EditShortcutDialog::EditShortcutDialog( QWidget* parent, const char* name )
: KDialog( parent ) : KDialog( parent )
{ {
setObjectName( name ); setObjectName( name );
setModal( true ); setModal( true );
setCaption( i18n( "Edit Shortcut" ) ); setCaption( i18n( "Edit Shortcut" ) );
setButtons( Ok | Cancel ); setButtons( Ok | Cancel );
widget = new EditShortcut( this ); widget = new EditShortcut( this );
setMainWidget( widget ); setMainWidget( widget );
} }
void EditShortcutDialog::setShortcut( const QString& cut ) void EditShortcutDialog::setShortcut( const QString& cut )
@ -781,14 +773,20 @@ QString EditShortcutDialog::shortcut() const
} }
ShortcutDialog::ShortcutDialog( const KShortcut& cut, QWidget* parent ) ShortcutDialog::ShortcutDialog( const KShortcut& cut, QWidget* parent )
: KShortcutDialog( cut, parent ) : KDialog( parent )
, widget( new KShortcutWidget( this ))
{ {
widget->setShortcut( cut );
setMainWidget( widget );
} }
void ShortcutDialog::accept() 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()) if( seq.isEmpty())
break; break;
if( seq[0] == Qt::Key_Escape ) if( seq[0] == Qt::Key_Escape )
@ -798,21 +796,26 @@ void ShortcutDialog::accept()
} }
if( seq[0] == Qt::Key_Space ) if( seq[0] == Qt::Key_Space )
{ // clear { // clear
setShortcut( KShortcut()); widget->setShortcut( KShortcut());
KShortcutDialog::accept(); KDialog::accept();
return; return;
} }
if( (seq[0] & Qt::KeyboardModifierMask) == 0 ) if( (seq[0] & Qt::KeyboardModifierMask) == 0 )
{ // no shortcuts without modifiers { // no shortcuts without modifiers
KShortcut cut = shortcut(); KShortcut cut = shortcut();
cut.remove( seq ); cut.remove( seq );
setShortcut( cut ); widget->setShortcut( cut );
return; return;
} }
} }
KShortcutDialog::accept(); KDialog::accept();
} }
#endif
KShortcut ShortcutDialog::shortcut() const
{
return widget->shortcut();
}
} // namespace } // namespace
#include "ruleswidget.moc" #include "ruleswidget.moc"

View file

@ -22,10 +22,10 @@
#include <kdialog.h> #include <kdialog.h>
#include <kwindowsystem.h> #include <kwindowsystem.h>
//#include <kshortcutdialog.h> #include <kshortcutwidget.h>
#include "ruleswidgetbase.h" #include "ruleswidgetbase.h"
#include "editshortcutbase.h" #include "ui_editshortcut.h"
namespace KWin namespace KWin
{ {
@ -110,17 +110,13 @@ class RulesDialog
Rules* rules; Rules* rules;
}; };
#ifdef __GNUC__
#warning KShortcutDialog is gone
#endif //__GNUC__
#if 0
class EditShortcut class EditShortcut
: public EditShortcutBase : public QWidget, public Ui_EditShortcut
{ {
Q_OBJECT Q_OBJECT
public: public:
EditShortcut( QWidget* parent = NULL ); EditShortcut( QWidget* parent = NULL );
protected: protected slots:
void editShortcut(); void editShortcut();
void clearShortcut(); void clearShortcut();
}; };
@ -139,14 +135,17 @@ class EditShortcutDialog
// slightly duped from utils.cpp // slightly duped from utils.cpp
class ShortcutDialog class ShortcutDialog
: public KShortcutDialog : public KDialog
{ {
Q_OBJECT Q_OBJECT
public: public:
ShortcutDialog( const KShortcut& cut, QWidget* parent = NULL ); ShortcutDialog( const KShortcut& cut, QWidget* parent = NULL );
virtual void accept(); virtual void accept();
KShortcut shortcut() const;
private:
KShortcutWidget* widget;
}; };
#endif //0
} // namespace } // namespace
#endif #endif