Skip to content

Commit ecfd9e5

Browse files
committed
Fix autoReload setting not persisting through app relaunch
Fix #380
1 parent 6d92e78 commit ecfd9e5

File tree

2 files changed

+14
-5
lines changed

2 files changed

+14
-5
lines changed

src/documenthandler.cpp

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,13 +111,19 @@
111111
DocumentHandler::DocumentHandler(QObject *parent)
112112
: QObject(parent)
113113
, m_document(nullptr)
114-
, m_autoReload(true)
115114
, m_cursorPosition(-1)
116115
, m_selectionStart(0)
117116
, m_selectionEnd(0)
118117
, _markersModel(nullptr)
119118

120119
{
120+
#if (defined(Q_OS_MACOS))
121+
QSettings settings(QCoreApplication::organizationDomain(), QCoreApplication::applicationName());
122+
#else
123+
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName().toLower());
124+
#endif
125+
m_autoReload = settings.value("editor/autoReload", "true").toBool();
126+
121127
_markersModel = new MarkersModel();
122128
_fileSystemWatcher = new QFileSystemWatcher();
123129
pdf_importer = QString::fromUtf8("TextExtraction");
@@ -582,6 +588,13 @@ bool DocumentHandler::autoReload() const
582588

583589
void DocumentHandler::setAutoReload(bool enable)
584590
{
591+
#if (defined(Q_OS_MACOS))
592+
QSettings settings(QCoreApplication::organizationDomain(), QCoreApplication::applicationName());
593+
#else
594+
QSettings settings(QCoreApplication::organizationName(), QCoreApplication::applicationName().toLower());
595+
#endif
596+
settings.setValue("editor/autoReload", enable);
597+
585598
m_autoReload = enable;
586599
}
587600

src/prompter/Prompter.qml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,10 +188,6 @@ Flickable {
188188
else
189189
__tikTok = 0
190190
}
191-
Settings {
192-
category: "editor"
193-
property alias autoReload: document.autoReload
194-
}
195191
Settings {
196192
id: keys
197193
category: "keys"

0 commit comments

Comments
 (0)