From bda688a542878a8ec43f4d597d8d7174cff06728 Mon Sep 17 00:00:00 2001 From: dail8859 Date: Fri, 3 Jan 2025 07:19:45 -0500 Subject: [PATCH] Make Find/Replace Dialog resize-able (#695) Closes #624 --- src/NotepadNext/dialogs/FindReplaceDialog.cpp | 14 +++- src/NotepadNext/dialogs/FindReplaceDialog.h | 1 + src/NotepadNext/dialogs/FindReplaceDialog.ui | 80 ++++++++----------- 3 files changed, 46 insertions(+), 49 deletions(-) diff --git a/src/NotepadNext/dialogs/FindReplaceDialog.cpp b/src/NotepadNext/dialogs/FindReplaceDialog.cpp index 6f5ea611f..a8d8d5ad6 100644 --- a/src/NotepadNext/dialogs/FindReplaceDialog.cpp +++ b/src/NotepadNext/dialogs/FindReplaceDialog.cpp @@ -147,10 +147,7 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW loadSettings(); - connect(qApp, &QApplication::aboutToQuit, this, &FindReplaceDialog::saveSettings); - changeTab(tabBar->currentIndex()); - } FindReplaceDialog::~FindReplaceDialog() @@ -194,6 +191,13 @@ void FindReplaceDialog::showEvent(QShowEvent *event) QDialog::showEvent(event); } +void FindReplaceDialog::closeEvent(QCloseEvent *event) +{ + saveSettings(); + + QDialog::closeEvent(event); +} + static void updateComboList(QComboBox *comboBox, const QString &text) { // Block the signals while it is manipulated @@ -501,6 +505,8 @@ void FindReplaceDialog::loadSettings() settings.beginGroup("FindReplaceDialog"); + restoreGeometry(settings.value("geometry").toByteArray()); + ui->comboFind->addItems(settings.value("RecentSearchList").toStringList()); ui->comboReplace->addItems(settings.value("RecentReplaceList").toStringList()); @@ -544,6 +550,8 @@ void FindReplaceDialog::saveSettings() settings.beginGroup("FindReplaceDialog"); settings.remove(""); // clear out any previous keys + settings.setValue("geometry", saveGeometry()); + QStringList recentSearches; for (int i = 0; i < ui->comboFind->count(); ++i) { recentSearches << ui->comboFind->itemText(i); diff --git a/src/NotepadNext/dialogs/FindReplaceDialog.h b/src/NotepadNext/dialogs/FindReplaceDialog.h index 4ae5505ec..a85b3ea0a 100644 --- a/src/NotepadNext/dialogs/FindReplaceDialog.h +++ b/src/NotepadNext/dialogs/FindReplaceDialog.h @@ -61,6 +61,7 @@ class FindReplaceDialog : public QDialog protected: bool event(QEvent *event) override; void showEvent(QShowEvent *event) override; + void closeEvent(QCloseEvent *event) override; signals: void windowActivated(); diff --git a/src/NotepadNext/dialogs/FindReplaceDialog.ui b/src/NotepadNext/dialogs/FindReplaceDialog.ui index fd09b5547..cdcddd654 100644 --- a/src/NotepadNext/dialogs/FindReplaceDialog.ui +++ b/src/NotepadNext/dialogs/FindReplaceDialog.ui @@ -10,18 +10,6 @@ 325 - - - 475 - 325 - - - - - 16777215 - 325 - - Find @@ -79,14 +67,11 @@ - 4 + 0 4 - - 4 - @@ -343,7 +328,7 @@ - + 11 @@ -447,32 +432,39 @@ - - - Backward direction + + + 0 - - - - - - Match &whole word only - - - - - - - Match &case - - - - - - - Wra&p Around - - + + + + Backward direction + + + + + + + Match &whole word only + + + + + + + Match &case + + + + + + + Wra&p Around + + + + @@ -483,10 +475,6 @@ comboFind comboReplace - checkBoxBackwardsDirection - checkBoxMatchWholeWord - checkBoxMatchCase - checkBoxWrapAround radioNormalSearch radioExtendedSearch radioRegexSearch