You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lxqt-config-packaging/debian/patches/improve-ui-lxqt-config-moni...

150 lines
5.6 KiB

Description: lxqt-config-monitor: Improve UI behind Apply button in Advanced
settings dlg
.
This patch implements four UI changes explained elaborately below:
.
1) Activate existing Apply button in Advanced settings dialog
.
The Apply button now applies settings from the Saved Settings
(LXQt::ConfigDialog) page.
.
It had no active connections before.
.
2) Show saved settings on select
.
Details for saved settings was shown on 'activation' signal which
is on most platforms generated on mouse double-click or by
pressing the Enter key. It is more natural to expect the details
page to update on single mouse click or by selecting the
next/previous item by down/up arrow keys.
.
On mouse double-click one would expect to actually _activate_ the
setting, not merely show the details.
.
This also ensures, the selected settings is always displayed
before applying.
.
3) Remove Apply button from Saved settings page
.
The button did its job applying only the local configuration from
the Saved Settings (LXQt::ConfigDialog) page, but until there are
more configuration pages in the dialog its purpose is hidden and
confusing, appearing as a duplicate for the dialog's own Apply
button.
.
The button may find its way back once it makes sense to have it
there again.
.
4) Apply selected settings on mouse double-click
.
It is expected intuitively activating the selected saved settings
on mouse double-click. Enable this behavior.
Author: vc-01 <vlado.chren@gmail.com>
Origin: upstream
Bug: https://github.com/lxqt/lxqt-config/issues/577
Applied-Upstream: 3005400ce273b117833a8043f03af39f7596101d
Last-Update: 2023-12-22
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
--- a/lxqt-config-monitor/managesavedsettings.cpp
+++ b/lxqt-config-monitor/managesavedsettings.cpp
@@ -23,6 +23,7 @@
#include "monitor.h"
#include <QDebug>
#include <QInputDialog>
+#include <QMessageBox>
#include <QDateTime>
Q_DECLARE_METATYPE(MonitorSavedSettings)
@@ -37,18 +38,21 @@ ManageSavedSettings::ManageSavedSettings
ui.setupUi(this);
- connect(ui.allConfigs, &QListWidget::itemActivated, this, &ManageSavedSettings::showSelectedConfig);
- connect(ui.deletePushButton, &QPushButton::clicked, this, &ManageSavedSettings::onDeleteItem);
- connect(ui.renamePushButton, &QPushButton::clicked, this, &ManageSavedSettings::onRenameItem);
- connect(ui.applyPushButton, &QPushButton::clicked, this, &ManageSavedSettings::onApplyItem);
+ connect(ui.allConfigs, &QListWidget::itemSelectionChanged, this, &ManageSavedSettings::showSelectedConfig);
+ connect(ui.allConfigs, &QListWidget::itemDoubleClicked, this, &ManageSavedSettings::onApplyItem);
+ connect(ui.deletePushButton, &QPushButton::clicked, this, &ManageSavedSettings::onDeleteItem);
+ connect(ui.renamePushButton, &QPushButton::clicked, this, &ManageSavedSettings::onRenameItem);
loadSettings();
}
-void ManageSavedSettings::showSelectedConfig(QListWidgetItem * item)
+void ManageSavedSettings::showSelectedConfig()
{
- MonitorSavedSettings o = item->data(Qt::UserRole).value<MonitorSavedSettings>();
+ QListWidgetItem * currItem = ui.allConfigs->currentItem();
+ if (currItem == nullptr)
+ return;
+ MonitorSavedSettings o = currItem->data(Qt::UserRole).value<MonitorSavedSettings>();
QString text;
for(int i=0; i < o.monitors.size(); i++) {
MonitorSettings setting = o.monitors[i];
@@ -77,7 +81,6 @@ void ManageSavedSettings::showSelectedCo
}
text += QLatin1String("<br/>");
ui.selectedSettingsTextEdit->setText(text);
- ui.applyPushButton->setEnabled(isHardwareCompatible(o));
}
@@ -164,6 +167,14 @@ void ManageSavedSettings::onApplyItem()
if (ui.allConfigs->currentItem() == nullptr)
return;
MonitorSavedSettings settings = ui.allConfigs->currentItem()->data(Qt::UserRole).value<MonitorSavedSettings>();
+
+ if (!isHardwareCompatible(settings)) {
+ QMessageBox::information(this, tr("Settings Activation Failed"),
+ tr("Selected settings cannot be applied with currently active monitors.\n\n"
+ "Please choose from the highlighted configurations."));
+ return;
+ }
+
applySettings(config, settings.monitors);
}
--- a/lxqt-config-monitor/managesavedsettings.h
+++ b/lxqt-config-monitor/managesavedsettings.h
@@ -41,7 +41,7 @@ public slots:
*/
void loadSettings();
- void showSelectedConfig(QListWidgetItem * item);
+ void showSelectedConfig();
void onDeleteItem();
--- a/lxqt-config-monitor/managesavedsettings.ui
+++ b/lxqt-config-monitor/managesavedsettings.ui
@@ -46,13 +46,6 @@
</property>
</widget>
</item>
- <item>
- <widget class="QPushButton" name="applyPushButton">
- <property name="text">
- <string>Apply</string>
- </property>
- </widget>
- </item>
</layout>
</item>
<item row="0" column="1">
--- a/lxqt-config-monitor/settingsdialog.cpp
+++ b/lxqt-config-monitor/settingsdialog.cpp
@@ -31,4 +31,10 @@ SettingsDialog::SettingsDialog(const QSt
ManageSavedSettings * savedSettings = new ManageSavedSettings(settings, config, this);
addPage(savedSettings, QObject::tr("Manage Saved Settings"), QStringLiteral("system-run"));
+
+ connect(this, &LXQt::ConfigDialog::clicked, [=] (QDialogButtonBox::StandardButton button) {
+ if(button == QDialogButtonBox::Apply) {
+ savedSettings->onApplyItem();
+ }
+ });
}