Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions src/NotepadNext/dialogs/FindReplaceDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,10 +147,7 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW

loadSettings();

connect(qApp, &QApplication::aboutToQuit, this, &FindReplaceDialog::saveSettings);

changeTab(tabBar->currentIndex());

}

FindReplaceDialog::~FindReplaceDialog()
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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());

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext/dialogs/FindReplaceDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
80 changes: 34 additions & 46 deletions src/NotepadNext/dialogs/FindReplaceDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,6 @@
<height>325</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>475</width>
<height>325</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>16777215</width>
<height>325</height>
</size>
</property>
<property name="windowTitle">
<string>Find</string>
</property>
Expand Down Expand Up @@ -79,14 +67,11 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing">
<number>4</number>
<number>0</number>
</property>
<property name="topMargin">
<number>4</number>
</property>
<property name="bottomMargin">
<number>4</number>
</property>
<item>
<widget class="QRadioButton" name="radioNormalSearch">
<property name="enabled">
Expand Down Expand Up @@ -343,7 +328,7 @@
</layout>
</item>
<item row="2" column="0">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0,0,0,0">
<layout class="QVBoxLayout" name="verticalLayout_5" stretch="0,0,0">
<property name="leftMargin">
<number>11</number>
</property>
Expand Down Expand Up @@ -447,32 +432,39 @@
</spacer>
</item>
<item>
<widget class="QCheckBox" name="checkBoxBackwardsDirection">
<property name="text">
<string>Backward direction</string>
<layout class="QVBoxLayout" name="verticalLayout_6">
<property name="spacing">
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxMatchWholeWord">
<property name="text">
<string>Match &amp;whole word only</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxMatchCase">
<property name="text">
<string>Match &amp;case</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxWrapAround">
<property name="text">
<string>Wra&amp;p Around</string>
</property>
</widget>
<item>
<widget class="QCheckBox" name="checkBoxBackwardsDirection">
<property name="text">
<string>Backward direction</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxMatchWholeWord">
<property name="text">
<string>Match &amp;whole word only</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxMatchCase">
<property name="text">
<string>Match &amp;case</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxWrapAround">
<property name="text">
<string>Wra&amp;p Around</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</item>
Expand All @@ -483,10 +475,6 @@
<tabstops>
<tabstop>comboFind</tabstop>
<tabstop>comboReplace</tabstop>
<tabstop>checkBoxBackwardsDirection</tabstop>
<tabstop>checkBoxMatchWholeWord</tabstop>
<tabstop>checkBoxMatchCase</tabstop>
<tabstop>checkBoxWrapAround</tabstop>
<tabstop>radioNormalSearch</tabstop>
<tabstop>radioExtendedSearch</tabstop>
<tabstop>radioRegexSearch</tabstop>
Expand Down
Loading