kwinrules: Improvements on Detect Properties button
Slight UX and code improvents: - Disable the detection button when property sheet is open. - Add a minimum limit (smallDuration) to the delay before detecting a window. Otherwise we freeze the window before even showing the button release feedback, which can feel unexpected - Prefer Q_INVOKABLE over public slot to expose method to QML
This commit is contained in:
parent
f26eeb9706
commit
bf7e7b2130
3 changed files with 8 additions and 6 deletions
|
@ -93,12 +93,16 @@ ScrollViewKCM {
|
|||
QQC2.Button {
|
||||
text: i18n("Detect Window Properties")
|
||||
icon.name: "edit-find"
|
||||
enabled: !propertySheet.sheetOpen
|
||||
onClicked: {
|
||||
rulesModel.detectWindowProperties(delaySpin.value);
|
||||
overlayModel.onlySuggestions = true;
|
||||
rulesModel.detectWindowProperties(Math.max(delaySpin.value * 1000,
|
||||
Kirigami.Units.shortDuration));
|
||||
}
|
||||
}
|
||||
QQC2.SpinBox {
|
||||
id: delaySpin
|
||||
enabled: !propertySheet.sheetOpen
|
||||
Layout.preferredWidth: Kirigami.Units.gridUnit * 8
|
||||
from: 0
|
||||
to: 30
|
||||
|
|
|
@ -809,9 +809,9 @@ QList<OptionsModel::Data> RulesModel::colorSchemesModelData() const
|
|||
return modelData;
|
||||
}
|
||||
|
||||
void RulesModel::detectWindowProperties(int secs)
|
||||
void RulesModel::detectWindowProperties(int miliseconds)
|
||||
{
|
||||
QTimer::singleShot(secs*1000, this, &RulesModel::selectX11Window);
|
||||
QTimer::singleShot(miliseconds, this, &RulesModel::selectX11Window);
|
||||
}
|
||||
|
||||
void RulesModel::selectX11Window()
|
||||
|
|
|
@ -76,9 +76,7 @@ public:
|
|||
void setDescription(const QString &description);
|
||||
QString warningMessage() const;
|
||||
|
||||
|
||||
public slots:
|
||||
void detectWindowProperties(int secs);
|
||||
Q_INVOKABLE void detectWindowProperties(int miliseconds);
|
||||
|
||||
signals:
|
||||
void descriptionChanged();
|
||||
|
|
Loading…
Reference in a new issue