From 8649f4f66fb57e854ff40fe937dfaa1f5c90e17d Mon Sep 17 00:00:00 2001 From: Le Tan Date: Sat, 6 May 2017 12:27:09 +0800 Subject: [PATCH] add menu item to enable the image preview Not visible because we now could not handle the undo history very well. --- src/vmainwindow.cpp | 14 ++++++++++++++ src/vmainwindow.h | 1 + 2 files changed, 15 insertions(+) diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp index ca4d1292..50b87689 100644 --- a/src/vmainwindow.cpp +++ b/src/vmainwindow.cpp @@ -381,6 +381,15 @@ void VMainWindow::initMarkdownMenu() this, &VMainWindow::enableCodeBlockHighlight); markdownMenu->addAction(codeBlockAct); codeBlockAct->setChecked(vconfig.getEnableCodeBlockHighlight()); + + QAction *previewImageAct = new QAction(tr("Preview Images In Edit Mode"), this); + previewImageAct->setToolTip(tr("Enable image preview in edit mode")); + previewImageAct->setCheckable(true); + connect(previewImageAct, &QAction::triggered, + this, &VMainWindow::enableImagePreview); + // TODO: add the action to the menu after handling the UNDO history well. + // markdownMenu->addAction(previewImageAct); + previewImageAct->setChecked(vconfig.getEnablePreviewImages()); } void VMainWindow::initViewMenu() @@ -1274,6 +1283,11 @@ void VMainWindow::enableCodeBlockHighlight(bool p_checked) vconfig.setEnableCodeBlockHighlight(p_checked); } +void VMainWindow::enableImagePreview(bool p_checked) +{ + vconfig.setEnablePreviewImages(p_checked); +} + void VMainWindow::shortcutHelp() { QString locale = VUtils::getLocale(); diff --git a/src/vmainwindow.h b/src/vmainwindow.h index e4298749..9f4a555b 100644 --- a/src/vmainwindow.h +++ b/src/vmainwindow.h @@ -76,6 +76,7 @@ private slots: void changeAutoIndent(bool p_checked); void changeAutoList(bool p_checked); void enableCodeBlockHighlight(bool p_checked); + void enableImagePreview(bool p_checked); protected: void closeEvent(QCloseEvent *event) Q_DECL_OVERRIDE;