|
|
@@ -2,6 +2,7 @@
|
|
|
|
|
|
#include <QCheckBox>
|
|
|
#include <QFormLayout>
|
|
|
+#include <QComboBox>
|
|
|
|
|
|
#include <widgets/widgetsfactory.h>
|
|
|
#include <core/coreconfig.h>
|
|
|
@@ -30,6 +31,22 @@ void NoteManagementPage::setupUI()
|
|
|
connect(m_perNotebookHistoryCheckBox, &QCheckBox::stateChanged,
|
|
|
this, &NoteManagementPage::pageIsChanged);
|
|
|
}
|
|
|
+
|
|
|
+ {
|
|
|
+ m_lineEndingComboBox = WidgetsFactory::createComboBox(this);
|
|
|
+ m_lineEndingComboBox->setToolTip(tr("Line ending used to write configuration files"));
|
|
|
+
|
|
|
+ m_lineEndingComboBox->addItem(tr("Follow Platform"), (int)LineEndingPolicy::Platform);
|
|
|
+ m_lineEndingComboBox->addItem(tr("LF (Linux/macOS)"), (int)LineEndingPolicy::LF);
|
|
|
+ m_lineEndingComboBox->addItem(tr("CR LF (Windows)"), (int)LineEndingPolicy::CRLF);
|
|
|
+ m_lineEndingComboBox->addItem(tr("CR"), (int)LineEndingPolicy::CR);
|
|
|
+
|
|
|
+ const QString label(tr("Line ending:"));
|
|
|
+ mainLayout->addRow(label, m_lineEndingComboBox);
|
|
|
+ addSearchItem(label, m_lineEndingComboBox->toolTip(), m_lineEndingComboBox);
|
|
|
+ connect(m_lineEndingComboBox, QOverload<int>::of(&QComboBox::currentIndexChanged),
|
|
|
+ this, &NoteManagementPage::pageIsChanged);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
void NoteManagementPage::loadInternal()
|
|
|
@@ -37,6 +54,14 @@ void NoteManagementPage::loadInternal()
|
|
|
const auto &coreConfig = ConfigMgr::getInst().getCoreConfig();
|
|
|
|
|
|
m_perNotebookHistoryCheckBox->setChecked(coreConfig.isPerNotebookHistoryEnabled());
|
|
|
+
|
|
|
+ {
|
|
|
+ int idx = m_lineEndingComboBox->findData(static_cast<int>(coreConfig.getLineEndingPolicy()));
|
|
|
+ if (idx == -1) {
|
|
|
+ idx = 0;
|
|
|
+ }
|
|
|
+ m_lineEndingComboBox->setCurrentIndex(idx);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
bool NoteManagementPage::saveInternal()
|
|
|
@@ -45,6 +70,11 @@ bool NoteManagementPage::saveInternal()
|
|
|
|
|
|
coreConfig.setPerNotebookHistoryEnabled(m_perNotebookHistoryCheckBox->isChecked());
|
|
|
|
|
|
+ {
|
|
|
+ auto ending = m_lineEndingComboBox->currentData().toInt();
|
|
|
+ coreConfig.setLineEndingPolicy(static_cast<LineEndingPolicy>(ending));
|
|
|
+ }
|
|
|
+
|
|
|
return true;
|
|
|
}
|
|
|
|