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
1 change: 1 addition & 0 deletions src/NotepadNext/ApplicationSettings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ CREATE_SETTING(Gui, ShowMenuBar, showMenuBar, bool, true)
CREATE_SETTING(Gui, ShowToolBar, showToolBar, bool, true)
CREATE_SETTING(Gui, ShowTabBar, showTabBar, bool, true)
CREATE_SETTING(Gui, ShowStatusBar, showStatusBar, bool, true)
CREATE_SETTING(Gui, CenterSearchDialog, centerSearchDialog, bool, true)

CREATE_SETTING(Gui, TabsClosable, tabsClosable, bool, true)
CREATE_SETTING(Gui, ExitOnLastTabClosed, exitOnLastTabClosed, bool, false)
Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext/ApplicationSettings.h
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ class ApplicationSettings : public QSettings
DEFINE_SETTING(ShowToolBar, showToolBar, bool)
DEFINE_SETTING(ShowTabBar, showTabBar, bool)
DEFINE_SETTING(ShowStatusBar, showStatusBar, bool)
DEFINE_SETTING(CenterSearchDialog, centerSearchDialog, bool)

DEFINE_SETTING(TabsClosable, tabsClosable, bool)
DEFINE_SETTING(ExitOnLastTabClosed, exitOnLastTabClosed, bool)
Expand Down
18 changes: 13 additions & 5 deletions src/NotepadNext/dialogs/FindReplaceDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW

// Turn off the help button on the dialog
setWindowFlag(Qt::WindowContextHelpButtonHint, false);

ui->setupUi(this);

// Get the current editor, and keep up the reference
Expand Down Expand Up @@ -151,6 +150,7 @@ FindReplaceDialog::FindReplaceDialog(ISearchResultsHandler *searchResults, MainW
connect(qApp, &QApplication::aboutToQuit, this, &FindReplaceDialog::saveSettings);

changeTab(tabBar->currentIndex());

}

FindReplaceDialog::~FindReplaceDialog()
Expand Down Expand Up @@ -367,8 +367,8 @@ void FindReplaceDialog::transparencyToggled(bool on)

if (on) {
if (ui->radioOnLosingFocus->isChecked()) {
adjustOpacityWhenLosingFocus(true);
adjustOpacityAlways(false);
adjustOpacityWhenLosingFocus(true);
adjustOpacityAlways(false);
}
else {
adjustOpacityWhenLosingFocus(false);
Expand Down Expand Up @@ -576,14 +576,22 @@ void FindReplaceDialog::savePosition()
{
qInfo(Q_FUNC_INFO);

position = pos();
lastClosedPosition = pos();
}

void FindReplaceDialog::restorePosition()
{
qInfo(Q_FUNC_INFO);

move(position);
ApplicationSettings settings;

if (settings.centerSearchDialog()) {
const QPoint centerPoint = parentWidget()->geometry().center();
move(centerPoint - rect().center());
}
else {
move(lastClosedPosition);
}
}

int FindReplaceDialog::computeSearchFlags()
Expand Down
3 changes: 1 addition & 2 deletions src/NotepadNext/dialogs/FindReplaceDialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,12 @@ private slots:
void updateReplaceList(const QString &text);

bool isFirstTime = true;
QPoint position;
QPoint lastClosedPosition;
Ui::FindReplaceDialog *ui;

ScintillaNext *editor;
QStatusBar *statusBar;
QTabBar *tabBar;

ISearchResultsHandler *searchResultsHandler;
Finder *finder;
};
Expand Down
1 change: 1 addition & 0 deletions src/NotepadNext/dialogs/PreferencesDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ PreferencesDialog::PreferencesDialog(ApplicationSettings *settings, QWidget *par
MapSettingToCheckBox(ui->checkBoxMenuBar, &ApplicationSettings::showMenuBar, &ApplicationSettings::setShowMenuBar, &ApplicationSettings::showMenuBarChanged);
MapSettingToCheckBox(ui->checkBoxToolBar, &ApplicationSettings::showToolBar, &ApplicationSettings::setShowToolBar, &ApplicationSettings::showToolBarChanged);
MapSettingToCheckBox(ui->checkBoxStatusBar, &ApplicationSettings::showStatusBar, &ApplicationSettings::setShowStatusBar, &ApplicationSettings::showStatusBarChanged);
MapSettingToCheckBox(ui->checkBoxRecenterSearchDialog, &ApplicationSettings::centerSearchDialog, &ApplicationSettings::setCenterSearchDialog, &ApplicationSettings::centerSearchDialogChanged);

MapSettingToGroupBox(ui->gbxRestorePreviousSession, &ApplicationSettings::restorePreviousSession, &ApplicationSettings::setRestorePreviousSession, &ApplicationSettings::restorePreviousSessionChanged);
connect(ui->gbxRestorePreviousSession, &QGroupBox::toggled, this, [=](bool checked) {
Expand Down
9 changes: 8 additions & 1 deletion src/NotepadNext/dialogs/PreferencesDialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>838</width>
<height>450</height>
<height>469</height>
</rect>
</property>
<property name="windowTitle">
Expand Down Expand Up @@ -68,6 +68,13 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkBoxRecenterSearchDialog">
<property name="text">
<string>Recenter find/replace dialog when opened</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxCombineSearchResults">
<property name="text">
Expand Down