Porting uic3->uic4 is fun.

svn path=/trunk/KDE/kdebase/workspace/; revision=731738
master
Luboš Luňák 17 years ago
parent bb9ff25ec4
commit 26149b29fb

@ -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})

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

@ -20,8 +20,6 @@
#ifndef __DETECTWIDGET_H__
#define __DETECTWIDGET_H__
#include "ui_detectwidgetbase.h"
#include <KDialog>
#include <kwindowsystem.h>
@ -30,24 +28,17 @@
#include <QEvent>
#include <QByteArray>
namespace KWin
{
#include "ui_detectwidget.h"
class DetectWidgetBase : public QWidget, public Ui::DetectWidgetBase
namespace KWin
{
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

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

@ -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>

@ -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>

@ -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()));

@ -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:

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

@ -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"

@ -22,10 +22,10 @@
#include <kdialog.h>
#include <kwindowsystem.h>
//#include <kshortcutdialog.h>
#include <kshortcutwidget.h>
#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

Loading…
Cancel
Save