[graphics/krita/krita/5.2] plugins/dockers/recorder: [string freeze exception] Recover "Clean Up" button in the Krita's Recordings Manager

Dmitry Kazakov null at kde.org
Fri Nov 8 11:43:28 GMT 2024


Git commit 337b9a77af66e536d11aadf2bbe3f734ec1a13d1 by Dmitry Kazakov.
Committed on 08/11/2024 at 11:43.
Pushed by dkazakov into branch 'krita/5.2'.

[string freeze exception] Recover "Clean Up" button in the Krita's Recordings Manager

When the manager was refactored into supporting QDialogButtonBox, then clean-up
button was replaced with a "Discard" button. Even though it sounds sensible in
English, it has a different meaning in QDialogButtonBox and, therefore, in translations.

In translations, the button is usually translated as "Close without saving", which is
not what the button actually does in Krita.

BUG:455207
CC:kde-i18n-doc at kde.org
CC:kimageshop at kde.org

M  +5    -3    plugins/dockers/recorder/recorder_snapshots_manager.cpp
M  +1    -0    plugins/dockers/recorder/recorder_snapshots_manager.h
M  +1    -1    plugins/dockers/recorder/recorder_snapshots_manager.ui

https://invent.kde.org/graphics/krita/-/commit/337b9a77af66e536d11aadf2bbe3f734ec1a13d1

diff --git a/plugins/dockers/recorder/recorder_snapshots_manager.cpp b/plugins/dockers/recorder/recorder_snapshots_manager.cpp
index 382cf404716..f538735f534 100644
--- a/plugins/dockers/recorder/recorder_snapshots_manager.cpp
+++ b/plugins/dockers/recorder/recorder_snapshots_manager.cpp
@@ -98,13 +98,15 @@ RecorderSnapshotsManager::RecorderSnapshotsManager(QWidget *parent)
     , cleaner(nullptr)
 {
     ui->setupUi(this);
+    cleanUpButton = new QPushButton(i18n("Clean Up"), ui->buttonBox);
+    ui->buttonBox->addButton(cleanUpButton, QDialogButtonBox::ActionRole);
 
     ui->stackedWidget->setCurrentIndex(PageProgress);
 
     connect(scanner, SIGNAL(scanningFinished(SnapshotDirInfoList)),
             this, SLOT(onScanningFinished(SnapshotDirInfoList)));
     connect(ui->buttonSelectAll, SIGNAL(clicked()), this, SLOT(onButtonSelectAllClicked()));
-    connect(ui->buttonBox->button(QDialogButtonBox::Discard), SIGNAL(clicked()), this, SLOT(onButtonCleanUpClicked()));
+    connect(cleanUpButton, SIGNAL(clicked()), this, SLOT(onButtonCleanUpClicked()));
     connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
 }
 
@@ -172,7 +174,7 @@ void RecorderSnapshotsManager::onScanningFinished(SnapshotDirInfoList snapshots)
     if (oldSelectionModel != nullptr)
         oldSelectionModel->deleteLater();
 
-    ui->buttonBox->button(QDialogButtonBox::Discard)->setEnabled(false);
+    cleanUpButton->setEnabled(false);
     ui->stackedWidget->setCurrentIndex(PageSelection);
 
      for(int col = 0; col < (ColumnCount - 1); ++col) {
@@ -193,7 +195,7 @@ void RecorderSnapshotsManager::onSelectionChanged(const QItemSelection &selected
     for (const QModelIndex &index : deselected.indexes())
         model->setData(index.sibling(index.row(), ColumnCheck), Qt::Unchecked, Qt::CheckStateRole);
 
-    ui->buttonBox->button(QDialogButtonBox::Discard)->setEnabled(!ui->treeDirectories->selectionModel()->selectedIndexes().isEmpty());
+    cleanUpButton->setEnabled(!ui->treeDirectories->selectionModel()->selectedIndexes().isEmpty());
 
     updateSpaceToBeFreed();
 }
diff --git a/plugins/dockers/recorder/recorder_snapshots_manager.h b/plugins/dockers/recorder/recorder_snapshots_manager.h
index 0a8c8e0d852..14333adbf37 100644
--- a/plugins/dockers/recorder/recorder_snapshots_manager.h
+++ b/plugins/dockers/recorder/recorder_snapshots_manager.h
@@ -50,6 +50,7 @@ private:
     Ui::RecorderSnapshotsManager *ui;
     RecorderSnapshotsScanner *scanner;
     RecorderDirectoryCleaner* cleaner;
+    QPushButton* cleanUpButton;
 };
 
 #endif // WIDGET_H
diff --git a/plugins/dockers/recorder/recorder_snapshots_manager.ui b/plugins/dockers/recorder/recorder_snapshots_manager.ui
index ed399830ae1..1c6d9d53864 100644
--- a/plugins/dockers/recorder/recorder_snapshots_manager.ui
+++ b/plugins/dockers/recorder/recorder_snapshots_manager.ui
@@ -276,7 +276,7 @@
          <item>
           <widget class="QDialogButtonBox" name="buttonBox">
            <property name="standardButtons">
-            <set>QDialogButtonBox::Close|QDialogButtonBox::Discard</set>
+            <set>QDialogButtonBox::Close</set>
            </property>
           </widget>
          </item>


More information about the kimageshop mailing list