Commit 331f1977 authored by Pino Toscano's avatar Pino Toscano

use QDialogButtonBox for the rows of action buttons

this gives them the proper layout and style for the platform, without
the need to do it manually
parent 7cde243c
......@@ -99,6 +99,8 @@ void KMouseTool::init_vars()
MTStroke::setUpperRight(w-1,0);
MTStroke::setLowerLeft(0,h-1);
MTStroke::setLowerRight(w-1,h-1);
buttonQuit = buttonBox->addButton(QString(), QDialogButtonBox::RejectRole);
}
void KMouseTool::resetSettings()
......@@ -229,15 +231,11 @@ KMouseTool::KMouseTool(QWidget *parent, const char *name)
connect(cbStart, &QCheckBox::stateChanged, this, &KMouseTool::settingsChanged);
connect(buttonStartStop, &QAbstractButton::clicked, this, &KMouseTool::startStopSelected);
KGuiItem::assign(buttonDefault, KStandardGuiItem::defaults());
connect(buttonDefault, &QAbstractButton::clicked, this, &KMouseTool::defaultSelected);
connect(buttonReset, &QAbstractButton::clicked, this, &KMouseTool::resetSelected);
KGuiItem::assign(buttonApply, KStandardGuiItem::apply());
connect(buttonApply, &QAbstractButton::clicked, this, &KMouseTool::applySelected);
KGuiItem::assign(buttonHelp, KStandardGuiItem::help());
connect(buttonHelp, &QAbstractButton::clicked, this, &KMouseTool::helpSelected);
KGuiItem::assign(buttonClose, KStandardGuiItem::close());
connect(buttonClose, &QAbstractButton::clicked, this, &KMouseTool::closeSelected);
connect(buttonBoxSettings->button(QDialogButtonBox::RestoreDefaults), &QAbstractButton::clicked, this, &KMouseTool::defaultSelected);
connect(buttonBoxSettings->button(QDialogButtonBox::Reset), &QAbstractButton::clicked, this, &KMouseTool::resetSelected);
connect(buttonBoxSettings->button(QDialogButtonBox::Apply), &QAbstractButton::clicked, this, &KMouseTool::applySelected);
connect(buttonBox, &QDialogButtonBox::helpRequested, this, &KMouseTool::helpSelected);
connect(buttonBox->button(QDialogButtonBox::Close), &QAbstractButton::clicked, this, &KMouseTool::closeSelected);
KGuiItem::assign(buttonQuit, KStandardGuiItem::quit());
connect(buttonQuit, &QAbstractButton::clicked, this, &KMouseTool::quitSelected);
......@@ -499,9 +497,9 @@ bool KMouseTool::defaultSettings()
// Value or state changed
void KMouseTool::settingsChanged ()
{
buttonReset->setEnabled (newSettings());
buttonApply->setEnabled (newSettings());
buttonDefault->setDisabled (defaultSettings());
buttonBoxSettings->button(QDialogButtonBox::Reset)->setEnabled (newSettings());
buttonBoxSettings->button(QDialogButtonBox::Apply)->setEnabled (newSettings());
buttonBoxSettings->button(QDialogButtonBox::RestoreDefaults)->setDisabled (defaultSettings());
}
// Buttons within the dialog
......
......@@ -81,6 +81,7 @@ private:
KMouseToolTray *trayIcon;
KHelpMenu *helpMenu;
QPushButton *buttonQuit;
/**
* Initialize all variables
......
......@@ -29,22 +29,6 @@
<property name="spacing">
<number>6</number>
</property>
<item row="2" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="0">
<widget class="QGroupBox" name="groupBox1">
<property name="title">
......@@ -117,36 +101,55 @@
</item>
</layout>
</item>
<item row="0" column="0">
<widget class="QLabel" name="movementLabel">
<property name="text">
<string>&amp;Minimum movement:</string>
<item row="0" column="1">
<widget class="QSpinBox" name="movementEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="buddy">
<cstring>movementEdit</cstring>
<property name="minimum">
<number>1</number>
</property>
</widget>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="cbStroke">
<property name="text">
<string>&amp;Enable strokes</string>
<property name="maximum">
<number>40</number>
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="dwellTimeLabel">
<item row="1" column="1">
<widget class="QSpinBox" name="dwellTimeEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>40</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="0" column="0">
<widget class="QLabel" name="movementLabel">
<property name="text">
<string>Dwell &amp;time (1/10 sec):</string>
<string>&amp;Minimum movement:</string>
</property>
<property name="buddy">
<cstring>dwellTimeEdit</cstring>
<cstring>movementEdit</cstring>
</property>
</widget>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="cbStart">
<property name="text">
<string>Start with &amp;desktop session</string>
</property>
</widget>
</item>
......@@ -160,73 +163,26 @@
</property>
</widget>
</item>
<item row="7" column="0" colspan="2">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="buttonDefault">
<property name="text">
<string>&amp;Defaults</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonReset">
<property name="text">
<string>&amp;Reset</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>31</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonApply">
<property name="text">
<string>&amp;Apply</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="6" column="0" colspan="2">
<widget class="QCheckBox" name="cbStart">
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="cbStroke">
<property name="text">
<string>Start with &amp;desktop session</string>
<string>&amp;Enable strokes</string>
</property>
</widget>
</item>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="cbClick">
<item row="1" column="0">
<widget class="QLabel" name="dwellTimeLabel">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string>A&amp;udible click</string>
<string>Dwell &amp;time (1/10 sec):</string>
</property>
<property name="buddy">
<cstring>dwellTimeEdit</cstring>
</property>
</widget>
</item>
......@@ -249,38 +205,17 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QSpinBox" name="dwellTimeEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>40</number>
</property>
<property name="value">
<number>5</number>
<item row="5" column="0" colspan="2">
<widget class="QCheckBox" name="cbClick">
<property name="text">
<string>A&amp;udible click</string>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QSpinBox" name="movementEdit">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>1</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>40</number>
<item row="7" column="0" colspan="2">
<widget class="QDialogButtonBox" name="buttonBoxSettings">
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Reset|QDialogButtonBox::RestoreDefaults</set>
</property>
</widget>
</item>
......@@ -357,66 +292,31 @@
</item>
</layout>
</item>
<item row="3" column="0">
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="leftMargin">
<number>0</number>
<item row="2" column="0">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="topMargin">
<number>0</number>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="rightMargin">
<number>0</number>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>30</height>
</size>
</property>
<property name="bottomMargin">
<number>0</number>
</spacer>
</item>
<item row="3" column="0">
<widget class="QDialogButtonBox" name="buttonBox">
<property name="standardButtons">
<set>QDialogButtonBox::Close|QDialogButtonBox::Help</set>
</property>
<item>
<widget class="QPushButton" name="buttonHelp">
<property name="text">
<string>&amp;Help</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>241</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonClose">
<property name="text">
<string>&amp;Close</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="buttonQuit">
<property name="text">
<string>&amp;Quit</string>
</property>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
<includes>
</includes>
<resources/>
<connections>
<connection>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment