6464#include " widgets/settings/debugoptionsettingswidget.h"
6565#include " widgets/settings/debugsettingswidget.h"
6666#include " widgets/settings/editorfontcolorsettingswidget.h"
67+ #include " widgets/settings/editorsettingswidget.h"
6768#include " widgets/settings/languagetoolsettingswidget.h"
6869#include " widgets/settings/networksettingswidget.h"
6970#include " widgets/settings/todosettingswidget.h"
@@ -164,17 +165,18 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent)
164165 connect (ui->allowOnlyOneAppInstanceCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
165166 connect (ui->showSystemTrayCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
166167 connect (ui->startHiddenCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
167- connect (ui->fullyHighlightedBlockquotesCheckBox , SIGNAL (toggled (bool )), this ,
168- SLOT (needRestart ()));
169168 connect (ui->noteFolderButtonsCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
170169 connect (ui->noteListPreviewCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
171170 connect (ui->maxNoteFileSizeSpinBox , SIGNAL (valueChanged (int )), this , SLOT (needRestart ()));
172- connect (ui->vimModeCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
173- connect (ui->disableCursorBlinkingCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
174171 connect (ui->ignoreNoteSubFoldersLineEdit , SIGNAL (textChanged (QString)), this ,
175172 SLOT (needRestart ()));
176173 connect (ui->webCompanionSettingsWidget , &WebCompanionSettingsWidget::needRestart, this ,
177174 &SettingsDialog::needRestart);
175+ connect (ui->editorSettingsWidget , &EditorSettingsWidget::needRestart, this ,
176+ &SettingsDialog::needRestart);
177+ connect (ui->editorSettingsWidget , &EditorSettingsWidget::wikiLinkSupportToggled,
178+ ui->editorFontColorSettingsWidget ,
179+ &EditorFontColorSettingsWidget::setWikiLinkItemsVisible);
178180 connect (ui->mcpServerEnabledCheckBox , SIGNAL (toggled (bool )), this , SLOT (needRestart ()));
179181 connect (ui->mcpServerTokenLineEdit , SIGNAL (textChanged (QString)), this , SLOT (needRestart ()));
180182 connect (ui->webApplicationSettingsWidget , &WebApplicationSettingsWidget::needRestart, this ,
@@ -466,7 +468,6 @@ void SettingsDialog::storeSettings() {
466468 settings.setValue (QStringLiteral (" ownCloud/supportEnabled" ),
467469 ui->ownCloudSupportCheckBox ->isChecked ());
468470 ui->todoSettingsWidget ->storeSettings ();
469- settings.setValue (QStringLiteral (" insertTimeFormat" ), ui->timeFormatLineEdit ->text ());
470471 settings.setValue (QStringLiteral (" disableAutomaticUpdateDialog" ),
471472 ui->disableAutomaticUpdateDialogCheckBox ->isChecked ());
472473 settings.setValue (QStringLiteral (" notifyAllExternalModifications" ),
@@ -513,10 +514,6 @@ void SettingsDialog::storeSettings() {
513514 ui->allowOnlyOneAppInstanceCheckBox ->isChecked ());
514515 settings.setValue (QStringLiteral (" interfaceLanguage" ),
515516 getSelectedListWidgetValue (ui->languageListWidget ));
516- settings.setValue (QStringLiteral (" markdownHighlightingEnabled" ),
517- ui->markdownHighlightingCheckBox ->isChecked ());
518- settings.setValue (QStringLiteral (" fullyHighlightedBlockquotes" ),
519- ui->fullyHighlightedBlockquotesCheckBox ->isChecked ());
520517 settings.setValue (QStringLiteral (" noteEditIsCentralWidget" ),
521518 ui->noteEditCentralWidgetCheckBox ->isChecked ());
522519 settings.setValue (QStringLiteral (" restoreNoteTabs" ), ui->restoreNoteTabsCheckBox ->isChecked ());
@@ -526,47 +523,7 @@ void SettingsDialog::storeSettings() {
526523 ui->noteFolderButtonsCheckBox ->isChecked ());
527524 ui->previewFontSettingsWidget ->storeSettings ();
528525 ui->debugOptionSettingsWidget ->storeSettings ();
529- settings.setValue (QStringLiteral (" Editor/autoBracketClosing" ),
530- ui->autoBracketClosingCheckBox ->isChecked ());
531- settings.setValue (QStringLiteral (" Editor/autoBracketRemoval" ),
532- ui->autoBracketRemovalCheckBox ->isChecked ());
533- settings.setValue (QStringLiteral (" Editor/removeTrailingSpaces" ),
534- ui->removeTrailingSpacesCheckBox ->isChecked ());
535- settings.setValue (QStringLiteral (" Editor/showLineNumbers" ),
536- ui->showLineNumbersInEditorCheckBox ->isChecked ());
537- settings.setValue (QStringLiteral (" Editor/highlightCurrentLine" ),
538- ui->highlightCurrentLineCheckBox ->isChecked ());
539- settings.setValue (QStringLiteral (" Editor/headingFolding" ),
540- ui->headingFoldingCheckBox ->isChecked ());
541- settings.setValue (QStringLiteral (" Editor/hideFormattingSyntax" ),
542- ui->hideFormattingSyntaxCheckBox ->isChecked ());
543- settings.setValue (QStringLiteral (" Editor/wikiLinkSupport" ),
544- ui->enableWikiLinkSupportCheckBox ->isChecked ());
545- settings.setValue (QStringLiteral (" Editor/wikiLinkFileNameAutoSelect" ),
546- ui->wikiLinkFileNameAutoSelectCheckBox ->isChecked ());
547- settings.setValue (QStringLiteral (" Editor/hangingIndent" ),
548- ui->hangingIndentCheckBox ->isChecked ());
549- settings.setValue (QStringLiteral (" Editor/showMarkdownImagePreviews" ),
550- ui->showMarkdownImagePreviewsCheckBox ->isChecked ());
551- settings.setValue (QStringLiteral (" Editor/editorWidthInDFMOnly" ),
552- ui->editorWidthInDFMOnlyCheckBox ->isChecked ());
553- settings.setValue (QStringLiteral (" Editor/vimMode" ), ui->vimModeCheckBox ->isChecked ());
554- settings.setValue (QStringLiteral (" Editor/disableCursorBlinking" ),
555- ui->disableCursorBlinkingCheckBox ->isChecked ());
556- settings.setValue (QStringLiteral (" Editor/useTabIndent" ), ui->useTabIndentCheckBox ->isChecked ());
557- settings.setValue (QStringLiteral (" Editor/indentSize" ), ui->indentSizeSpinBox ->value ());
558- settings.setValue (QStringLiteral (" Editor/markdownLspEnabled" ),
559- ui->markdownLspEnabledCheckBox ->isChecked ());
560- settings.setValue (QStringLiteral (" Editor/markdownLspCommand" ),
561- ui->markdownLspCommandLineEdit ->text ().trimmed ());
562- settings.setValue (QStringLiteral (" Editor/markdownLspArguments" ),
563- ui->markdownLspArgumentsLineEdit ->text ().split (
564- #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
565- QRegularExpression (QStringLiteral (" \\ s+" )), QString::SkipEmptyParts));
566- #else
567- QRegularExpression (QStringLiteral (" \\ s+" )), Qt::SkipEmptyParts));
568- #endif
569-
526+ ui->editorSettingsWidget ->storeSettings ();
570527 ui->languageToolSettingsWidget ->storeSettings ();
571528
572529 ui->networkSettingsWidget ->storeSettings ();
@@ -630,8 +587,7 @@ void SettingsDialog::storeSettings() {
630587 settings.remove (QStringLiteral (" interfaceStyle" ));
631588 }
632589
633- // store the cursor width
634- settings.setValue (QStringLiteral (" cursorWidth" ), ui->cursorWidthSpinBox ->value ());
590+ // store the cursor width - now handled by editorSettingsWidget->storeSettings()
635591
636592 settings.setValue (QStringLiteral (" SearchEngineId" ),
637593 ui->searchEngineSelectionComboBox ->currentData ().toInt ());
@@ -778,7 +734,6 @@ void SettingsDialog::readSettings() {
778734 ui->passwordEdit ->setText (_selectedCloudConnection.getPassword ());
779735 ui->appQOwnNotesAPICheckBox ->setChecked (_selectedCloudConnection.getAppQOwnNotesAPIEnabled ());
780736 ui->appNextcloudDeckCheckBox ->setChecked (_selectedCloudConnection.getNextcloudDeckEnabled ());
781- ui->timeFormatLineEdit ->setText (settings.value (QStringLiteral (" insertTimeFormat" )).toString ());
782737
783738 // prepend the portable data path if we are in portable mode
784739 ui->externalEditorPathLineEdit ->setText (Utils::Misc::prependPortableDataPathIfNeeded (
@@ -819,52 +774,8 @@ void SettingsDialog::readSettings() {
819774 settings.value (QStringLiteral (" noteSaveIntervalTime" ), 10 ).toInt ());
820775 ui->previewFontSettingsWidget ->readSettings ();
821776 ui->debugOptionSettingsWidget ->readSettings ();
822- ui->autoBracketClosingCheckBox ->setChecked (
823- settings.value (QStringLiteral (" Editor/autoBracketClosing" ), true ).toBool ());
824- ui->autoBracketRemovalCheckBox ->setChecked (
825- settings.value (QStringLiteral (" Editor/autoBracketRemoval" ), true ).toBool ());
826- ui->removeTrailingSpacesCheckBox ->setChecked (
827- settings.value (QStringLiteral (" Editor/removeTrailingSpaces" )).toBool ());
828- ui->showLineNumbersInEditorCheckBox ->setChecked (
829- settings.value (QStringLiteral (" Editor/showLineNumbers" )).toBool ());
830- ui->highlightCurrentLineCheckBox ->setChecked (
831- settings.value (QStringLiteral (" Editor/highlightCurrentLine" ), true ).toBool ());
832- ui->headingFoldingCheckBox ->setChecked (
833- settings.value (QStringLiteral (" Editor/headingFolding" ), false ).toBool ());
834- ui->hideFormattingSyntaxCheckBox ->setChecked (
835- settings.value (QStringLiteral (" Editor/hideFormattingSyntax" ), false ).toBool ());
836- ui->enableWikiLinkSupportCheckBox ->setChecked (
837- settings.value (QStringLiteral (" Editor/wikiLinkSupport" ), false ).toBool ());
838- on_enableWikiLinkSupportCheckBox_toggled (ui->enableWikiLinkSupportCheckBox ->isChecked ());
839- ui->wikiLinkFileNameAutoSelectCheckBox ->setChecked (
840- settings.value (QStringLiteral (" Editor/wikiLinkFileNameAutoSelect" ), false ).toBool ());
841- ui->hangingIndentCheckBox ->setChecked (
842- settings.value (QStringLiteral (" Editor/hangingIndent" ), false ).toBool ());
843- ui->showMarkdownImagePreviewsCheckBox ->setChecked (
844- settings.value (QStringLiteral (" Editor/showMarkdownImagePreviews" ), true ).toBool ());
845- ui->editorWidthInDFMOnlyCheckBox ->setChecked (
846- settings.value (QStringLiteral (" Editor/editorWidthInDFMOnly" ), true ).toBool ());
847- ui->vimModeCheckBox ->setChecked (settings.value (QStringLiteral (" Editor/vimMode" )).toBool ());
848- ui->disableCursorBlinkingCheckBox ->setChecked (
849- settings.value (QStringLiteral (" Editor/disableCursorBlinking" )).toBool ());
850- ui->useTabIndentCheckBox ->setChecked (
851- settings.value (QStringLiteral (" Editor/useTabIndent" )).toBool ());
852- ui->indentSizeSpinBox ->setValue (Utils::Misc::indentSize ());
853- ui->markdownLspEnabledCheckBox ->setChecked (
854- settings.value (QStringLiteral (" Editor/markdownLspEnabled" ), false ).toBool ());
855- ui->markdownLspCommandLineEdit ->setText (
856- settings.value (QStringLiteral (" Editor/markdownLspCommand" ), QStringLiteral (" marksman" ))
857- .toString ());
858- ui->markdownLspArgumentsLineEdit ->setText (
859- settings.value (QStringLiteral (" Editor/markdownLspArguments" ))
860- .toStringList ()
861- .join (QLatin1Char (' ' )));
777+ ui->editorSettingsWidget ->readSettings ();
862778 ui->languageToolSettingsWidget ->readSettings ();
863- ui->markdownHighlightingCheckBox ->setChecked (
864- settings.value (QStringLiteral (" markdownHighlightingEnabled" ), true ).toBool ());
865- ui->fullyHighlightedBlockquotesCheckBox ->setChecked (
866- settings.value (QStringLiteral (" fullyHighlightedBlockquotes" )).toBool ());
867- on_markdownLspEnabledCheckBox_toggled (ui->markdownLspEnabledCheckBox ->isChecked ());
868779 ui->noteEditCentralWidgetCheckBox ->setChecked (
869780 settings.value (QStringLiteral (" noteEditIsCentralWidget" ), true ).toBool ());
870781 ui->restoreNoteTabsCheckBox ->setChecked (
@@ -964,9 +875,6 @@ void SettingsDialog::readSettings() {
964875
965876 initCloudConnectionComboBox ();
966877
967- // set the cursor width spinbox value
968- ui->cursorWidthSpinBox ->setValue (settings.value (QStringLiteral (" cursorWidth" ), 1 ).toInt ());
969-
970878 const QSignalBlocker blocker8 (this ->ui ->showSystemTrayCheckBox );
971879 Q_UNUSED (blocker8)
972880 bool showSystemTray = settings.value (QStringLiteral (" ShowSystemTray" )).toBool ();
@@ -2939,6 +2847,9 @@ bool SettingsDialog::initializePage(int index) {
29392847 case SettingsPages::NetworkPage: {
29402848 ui->networkSettingsWidget ->initialize ();
29412849 } break ;
2850+ case SettingsPages::EditorPage: {
2851+ ui->editorSettingsWidget ->initialize ();
2852+ } break ;
29422853 case SettingsPages::WebApplicationPage: {
29432854 ui->webApplicationSettingsWidget ->initialize ();
29442855 } break ;
@@ -3652,9 +3563,8 @@ void SettingsDialog::on_interfaceStyleComboBox_currentTextChanged(const QString
36523563}
36533564
36543565/* *
3655- * Reset the cursor width spin box value
3566+ * Reset the cursor width spin box value - now handled by EditorSettingsWidget
36563567 */
3657- void SettingsDialog::on_cursorWidthResetButton_clicked () { ui->cursorWidthSpinBox ->setValue (1 ); }
36583568
36593569/* *
36603570 * Also enable the single instance feature if the system tray icon is turned on
@@ -3690,22 +3600,6 @@ void SettingsDialog::on_resetMessageBoxesButton_clicked() {
36903600 }
36913601}
36923602
3693- void SettingsDialog::on_markdownHighlightingCheckBox_toggled (bool checked) {
3694- ui->fullyHighlightedBlockquotesCheckBox ->setEnabled (checked);
3695- }
3696-
3697- void SettingsDialog::on_markdownLspEnabledCheckBox_toggled (bool checked) {
3698- ui->markdownLspCommandLineEdit ->setEnabled (checked);
3699- ui->markdownLspArgumentsLineEdit ->setEnabled (checked);
3700- ui->markdownLspCommandLabel ->setEnabled (checked);
3701- ui->markdownLspArgumentsLabel ->setEnabled (checked);
3702- }
3703-
3704- void SettingsDialog::on_enableWikiLinkSupportCheckBox_toggled (bool checked) {
3705- ui->editorFontColorSettingsWidget ->setWikiLinkItemsVisible (checked);
3706- ui->wikiLinkFileNameAutoSelectCheckBox ->setEnabled (checked);
3707- }
3708-
37093603/* *
37103604 * Export settings
37113605 */
@@ -3962,20 +3856,6 @@ void SettingsDialog::on_databaseIntegrityCheckButton_clicked() {
39623856 }
39633857}
39643858
3965- void SettingsDialog::on_showLineNumbersInEditorCheckBox_toggled (bool checked) {
3966- if (checked && !ui->editorWidthInDFMOnlyCheckBox ->isChecked ()) {
3967- const QSignalBlocker blocker (ui->editorWidthInDFMOnlyCheckBox );
3968- ui->editorWidthInDFMOnlyCheckBox ->setChecked (true );
3969- }
3970- }
3971-
3972- void SettingsDialog::on_editorWidthInDFMOnlyCheckBox_toggled (bool checked) {
3973- if (!checked && ui->showLineNumbersInEditorCheckBox ->isChecked ()) {
3974- const QSignalBlocker blocker (ui->showLineNumbersInEditorCheckBox );
3975- ui->showLineNumbersInEditorCheckBox ->setChecked (false );
3976- }
3977- }
3978-
39793859void SettingsDialog::on_scriptReloadEngineButton2_clicked () {
39803860 on_scriptReloadEngineButton_clicked ();
39813861}
0 commit comments