mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
Fixes
1. PlantUmlWebService override; 2. Shortcut to clear highlights; 3. Save ViewArea session on minimized to system tray; 4. Prompt for restart after Settings
This commit is contained in:
parent
ecce8d13c1
commit
8a1bd930eb
@ -61,6 +61,7 @@ namespace vnotex
|
|||||||
Tag,
|
Tag,
|
||||||
Debug,
|
Debug,
|
||||||
Print,
|
Print,
|
||||||
|
ClearHighlights,
|
||||||
MaxShortcut
|
MaxShortcut
|
||||||
};
|
};
|
||||||
Q_ENUM(Shortcut)
|
Q_ENUM(Shortcut)
|
||||||
|
@ -20,6 +20,7 @@ QString WebGlobalOptions::toJavascriptObject() const
|
|||||||
{
|
{
|
||||||
return QStringLiteral("window.vxOptions = {\n")
|
return QStringLiteral("window.vxOptions = {\n")
|
||||||
+ QString("webPlantUml: %1,\n").arg(Utils::boolToString(m_webPlantUml))
|
+ QString("webPlantUml: %1,\n").arg(Utils::boolToString(m_webPlantUml))
|
||||||
|
+ QString("plantUmlWebService: '%1',\n").arg(m_plantUmlWebService)
|
||||||
+ QString("webGraphviz: %1,\n").arg(Utils::boolToString(m_webGraphviz))
|
+ QString("webGraphviz: %1,\n").arg(Utils::boolToString(m_webGraphviz))
|
||||||
+ QString("mathJaxScript: '%1',\n").arg(m_mathJaxScript)
|
+ QString("mathJaxScript: '%1',\n").arg(m_mathJaxScript)
|
||||||
+ QString("constrainImageWidthEnabled: %1,\n").arg(Utils::boolToString(m_constrainImageWidthEnabled))
|
+ QString("constrainImageWidthEnabled: %1,\n").arg(Utils::boolToString(m_constrainImageWidthEnabled))
|
||||||
@ -213,6 +214,7 @@ QString HtmlTemplateHelper::generateMarkdownViewerTemplate(const MarkdownEditorC
|
|||||||
{
|
{
|
||||||
WebGlobalOptions opts;
|
WebGlobalOptions opts;
|
||||||
opts.m_webPlantUml = p_config.getWebPlantUml();
|
opts.m_webPlantUml = p_config.getWebPlantUml();
|
||||||
|
opts.m_plantUmlWebService = p_config.getPlantUmlWebService();
|
||||||
opts.m_webGraphviz = p_config.getWebGraphviz();
|
opts.m_webGraphviz = p_config.getWebGraphviz();
|
||||||
opts.m_mathJaxScript = p_config.getMathJaxScript();
|
opts.m_mathJaxScript = p_config.getMathJaxScript();
|
||||||
opts.m_sectionNumberEnabled = p_config.getSectionNumberMode() == MarkdownEditorConfig::SectionNumberMode::Read;
|
opts.m_sectionNumberEnabled = p_config.getSectionNumberMode() == MarkdownEditorConfig::SectionNumberMode::Read;
|
||||||
|
@ -13,6 +13,8 @@ namespace vnotex
|
|||||||
{
|
{
|
||||||
bool m_webPlantUml = true;
|
bool m_webPlantUml = true;
|
||||||
|
|
||||||
|
QString m_plantUmlWebService;
|
||||||
|
|
||||||
bool m_webGraphviz = true;
|
bool m_webGraphviz = true;
|
||||||
|
|
||||||
QString m_mathJaxScript;
|
QString m_mathJaxScript;
|
||||||
|
@ -35,6 +35,8 @@ void MarkdownEditorConfig::init(const QJsonObject &p_app, const QJsonObject &p_u
|
|||||||
|
|
||||||
m_plantUmlCommand = READSTR(QStringLiteral("plantuml_command"));
|
m_plantUmlCommand = READSTR(QStringLiteral("plantuml_command"));
|
||||||
|
|
||||||
|
m_plantUmlWebService = READSTR(QStringLiteral("plantuml_web_service"));
|
||||||
|
|
||||||
m_webGraphviz = READBOOL(QStringLiteral("web_graphviz"));
|
m_webGraphviz = READBOOL(QStringLiteral("web_graphviz"));
|
||||||
|
|
||||||
m_graphvizExe = READSTR(QStringLiteral("graphviz_exe"));
|
m_graphvizExe = READSTR(QStringLiteral("graphviz_exe"));
|
||||||
@ -90,6 +92,7 @@ QJsonObject MarkdownEditorConfig::toJson() const
|
|||||||
obj[QStringLiteral("web_plantuml")] = m_webPlantUml;
|
obj[QStringLiteral("web_plantuml")] = m_webPlantUml;
|
||||||
obj[QStringLiteral("plantuml_jar")] = m_plantUmlJar;
|
obj[QStringLiteral("plantuml_jar")] = m_plantUmlJar;
|
||||||
obj[QStringLiteral("plantuml_command")] = m_plantUmlCommand;
|
obj[QStringLiteral("plantuml_command")] = m_plantUmlCommand;
|
||||||
|
obj[QStringLiteral("plantuml_web_service")] = m_plantUmlWebService;
|
||||||
obj[QStringLiteral("web_graphviz")] = m_webGraphviz;
|
obj[QStringLiteral("web_graphviz")] = m_webGraphviz;
|
||||||
obj[QStringLiteral("graphviz_exe")] = m_graphvizExe;
|
obj[QStringLiteral("graphviz_exe")] = m_graphvizExe;
|
||||||
obj[QStringLiteral("mathjax_script")] = m_mathJaxScript;
|
obj[QStringLiteral("mathjax_script")] = m_mathJaxScript;
|
||||||
@ -238,6 +241,16 @@ const QString &MarkdownEditorConfig::getPlantUmlCommand() const
|
|||||||
return m_plantUmlCommand;
|
return m_plantUmlCommand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &MarkdownEditorConfig::getPlantUmlWebService() const
|
||||||
|
{
|
||||||
|
return m_plantUmlWebService;
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarkdownEditorConfig::setPlantUmlWebService(const QString &p_service)
|
||||||
|
{
|
||||||
|
updateConfig(m_plantUmlWebService, p_service, this);
|
||||||
|
}
|
||||||
|
|
||||||
bool MarkdownEditorConfig::getWebGraphviz() const
|
bool MarkdownEditorConfig::getWebGraphviz() const
|
||||||
{
|
{
|
||||||
return m_webGraphviz;
|
return m_webGraphviz;
|
||||||
@ -280,9 +293,7 @@ bool MarkdownEditorConfig::getConfirmBeforeClearObsoleteImages() const
|
|||||||
|
|
||||||
void MarkdownEditorConfig::setConfirmBeforeClearObsoleteImages(bool p_confirm)
|
void MarkdownEditorConfig::setConfirmBeforeClearObsoleteImages(bool p_confirm)
|
||||||
{
|
{
|
||||||
updateConfig(m_confirmBeforeClearObsoleteImages,
|
updateConfig(m_confirmBeforeClearObsoleteImages, p_confirm, this);
|
||||||
p_confirm,
|
|
||||||
this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MarkdownEditorConfig::getInsertFileNameAsTitle() const
|
bool MarkdownEditorConfig::getInsertFileNameAsTitle() const
|
||||||
|
@ -70,6 +70,9 @@ namespace vnotex
|
|||||||
|
|
||||||
const QString &getPlantUmlCommand() const;
|
const QString &getPlantUmlCommand() const;
|
||||||
|
|
||||||
|
const QString &getPlantUmlWebService() const;
|
||||||
|
void setPlantUmlWebService(const QString &p_service);
|
||||||
|
|
||||||
bool getWebGraphviz() const;
|
bool getWebGraphviz() const;
|
||||||
void setWebGraphviz(bool p_enabled);
|
void setWebGraphviz(bool p_enabled);
|
||||||
|
|
||||||
@ -185,6 +188,9 @@ namespace vnotex
|
|||||||
// %1: the format to render in.
|
// %1: the format to render in.
|
||||||
QString m_plantUmlCommand;
|
QString m_plantUmlCommand;
|
||||||
|
|
||||||
|
// PlantUml Web service to override that in plantuml.js file.
|
||||||
|
QString m_plantUmlWebService;
|
||||||
|
|
||||||
bool m_webGraphviz = true;
|
bool m_webGraphviz = true;
|
||||||
|
|
||||||
// Graphviz executable file.
|
// Graphviz executable file.
|
||||||
|
@ -208,7 +208,8 @@
|
|||||||
"ApplySnippet" : "Ctrl+G, I",
|
"ApplySnippet" : "Ctrl+G, I",
|
||||||
"Tag" : "Ctrl+G, B",
|
"Tag" : "Ctrl+G, B",
|
||||||
"Debug" : "F12",
|
"Debug" : "F12",
|
||||||
"Print" : ""
|
"Print" : "",
|
||||||
|
"ClearHighlights" : "Ctrl+G, Space"
|
||||||
},
|
},
|
||||||
"spell_check_auto_detect_language" : false,
|
"spell_check_auto_detect_language" : false,
|
||||||
"spell_check_default_dictionary" : "en_US",
|
"spell_check_default_dictionary" : "en_US",
|
||||||
@ -401,6 +402,8 @@
|
|||||||
"//commnet" : "Command to render PlantUML via stdin and stdout (overrides plantuml_jar)",
|
"//commnet" : "Command to render PlantUML via stdin and stdout (overrides plantuml_jar)",
|
||||||
"//commnet" : "- %1: the format to render in",
|
"//commnet" : "- %1: the format to render in",
|
||||||
"plantuml_command" : "",
|
"plantuml_command" : "",
|
||||||
|
"//commnet" : "PlantUml Web service to use",
|
||||||
|
"plantuml_web_service" : "",
|
||||||
"//comment" : "Whether use javascript or external program to render Graphviz",
|
"//comment" : "Whether use javascript or external program to render Graphviz",
|
||||||
"web_graphviz" : true,
|
"web_graphviz" : true,
|
||||||
"//commnet" : "Local Graphviz executable file to render Graphviz",
|
"//commnet" : "Local Graphviz executable file to render Graphviz",
|
||||||
|
@ -34,6 +34,18 @@ class PlantUml extends GraphRenderer {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
initialize(p_callback) {
|
||||||
|
if (super.initialized) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!!window.vxOptions.plantUmlWebService) {
|
||||||
|
this.serverUrl = window.vxOptions.plantUmlWebService;
|
||||||
|
console.log('override PlantUml Web service', this.serverUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
return super.initialize(p_callback);
|
||||||
|
}
|
||||||
|
|
||||||
// Interface 1.
|
// Interface 1.
|
||||||
render(p_node, p_format) {
|
render(p_node, p_format) {
|
||||||
|
@ -62,7 +62,7 @@ bool FileAssociationPage::saveInternal()
|
|||||||
if (name.isEmpty()) {
|
if (name.isEmpty()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
auto suffixes = lineEdit->text().split(c_suffixSeparator, Qt::SkipEmptyParts);
|
auto suffixes = lineEdit->text().split(c_suffixSeparator, QString::SkipEmptyParts);
|
||||||
fileTypeSuffixes.push_back(CoreConfig::FileTypeSuffix(name, Utils::toLower(suffixes)));
|
fileTypeSuffixes.push_back(CoreConfig::FileTypeSuffix(name, Utils::toLower(suffixes)));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -104,6 +104,8 @@ void MarkdownEditorPage::loadInternal()
|
|||||||
|
|
||||||
m_plantUmlJarFileInput->setText(markdownConfig.getPlantUmlJar());
|
m_plantUmlJarFileInput->setText(markdownConfig.getPlantUmlJar());
|
||||||
|
|
||||||
|
m_plantUmlWebServiceLineEdit->setText(markdownConfig.getPlantUmlWebService());
|
||||||
|
|
||||||
{
|
{
|
||||||
int idx = m_graphvizModeComboBox->findData(markdownConfig.getWebGraphviz() ? 0 : 1);
|
int idx = m_graphvizModeComboBox->findData(markdownConfig.getWebGraphviz() ? 0 : 1);
|
||||||
m_graphvizModeComboBox->setCurrentIndex(idx);
|
m_graphvizModeComboBox->setCurrentIndex(idx);
|
||||||
@ -189,6 +191,8 @@ bool MarkdownEditorPage::saveInternal()
|
|||||||
|
|
||||||
markdownConfig.setPlantUmlJar(m_plantUmlJarFileInput->text());
|
markdownConfig.setPlantUmlJar(m_plantUmlJarFileInput->text());
|
||||||
|
|
||||||
|
markdownConfig.setPlantUmlWebService(m_plantUmlWebServiceLineEdit->text());
|
||||||
|
|
||||||
markdownConfig.setWebGraphviz(m_graphvizModeComboBox->currentData().toInt() == 0);
|
markdownConfig.setWebGraphviz(m_graphvizModeComboBox->currentData().toInt() == 0);
|
||||||
|
|
||||||
markdownConfig.setGraphvizExe(m_graphvizFileInput->text());
|
markdownConfig.setGraphvizExe(m_graphvizFileInput->text());
|
||||||
@ -468,9 +472,9 @@ QGroupBox *MarkdownEditorPage::setupGeneralGroup()
|
|||||||
|
|
||||||
{
|
{
|
||||||
m_plantUmlModeComboBox = WidgetsFactory::createComboBox(box);
|
m_plantUmlModeComboBox = WidgetsFactory::createComboBox(box);
|
||||||
m_plantUmlModeComboBox->setToolTip(tr("Use online service or local JAR file to render PlantUml graphs"));
|
m_plantUmlModeComboBox->setToolTip(tr("Use Web service or local JAR file to render PlantUml graphs"));
|
||||||
|
|
||||||
m_plantUmlModeComboBox->addItem(tr("Online Service"), 0);
|
m_plantUmlModeComboBox->addItem(tr("Web Service"), 0);
|
||||||
m_plantUmlModeComboBox->addItem(tr("Local JAR"), 1);
|
m_plantUmlModeComboBox->addItem(tr("Local JAR"), 1);
|
||||||
|
|
||||||
const QString label(tr("PlantUml:"));
|
const QString label(tr("PlantUml:"));
|
||||||
@ -527,10 +531,21 @@ QGroupBox *MarkdownEditorPage::setupGeneralGroup()
|
|||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
m_graphvizModeComboBox = WidgetsFactory::createComboBox(box);
|
m_plantUmlWebServiceLineEdit = WidgetsFactory::createLineEdit(box);
|
||||||
m_graphvizModeComboBox->setToolTip(tr("Use online service or local executable file to render Graphviz graphs"));
|
m_plantUmlWebServiceLineEdit->setToolTip(tr("Override the Web service used to render PlantUml graphs"));
|
||||||
|
|
||||||
m_graphvizModeComboBox->addItem(tr("Online Service"), 0);
|
const QString label(tr("PlantUml Web service:"));
|
||||||
|
layout->addRow(label, m_plantUmlWebServiceLineEdit);
|
||||||
|
addSearchItem(label, m_plantUmlWebServiceLineEdit->toolTip(), m_plantUmlWebServiceLineEdit);
|
||||||
|
connect(m_plantUmlWebServiceLineEdit, &QLineEdit::textChanged,
|
||||||
|
this, &MarkdownEditorPage::pageIsChanged);
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
m_graphvizModeComboBox = WidgetsFactory::createComboBox(box);
|
||||||
|
m_graphvizModeComboBox->setToolTip(tr("Use Web service or local executable file to render Graphviz graphs"));
|
||||||
|
|
||||||
|
m_graphvizModeComboBox->addItem(tr("Web Service"), 0);
|
||||||
m_graphvizModeComboBox->addItem(tr("Local Executable"), 1);
|
m_graphvizModeComboBox->addItem(tr("Local Executable"), 1);
|
||||||
|
|
||||||
const QString label(tr("Graphviz:"));
|
const QString label(tr("Graphviz:"));
|
||||||
|
@ -79,6 +79,8 @@ namespace vnotex
|
|||||||
|
|
||||||
LocationInputWithBrowseButton *m_plantUmlJarFileInput = nullptr;
|
LocationInputWithBrowseButton *m_plantUmlJarFileInput = nullptr;
|
||||||
|
|
||||||
|
QLineEdit *m_plantUmlWebServiceLineEdit = nullptr;
|
||||||
|
|
||||||
QComboBox *m_graphvizModeComboBox = nullptr;
|
QComboBox *m_graphvizModeComboBox = nullptr;
|
||||||
|
|
||||||
LocationInputWithBrowseButton *m_graphvizFileInput = nullptr;
|
LocationInputWithBrowseButton *m_graphvizFileInput = nullptr;
|
||||||
|
@ -13,6 +13,8 @@
|
|||||||
#include <widgets/lineedit.h>
|
#include <widgets/lineedit.h>
|
||||||
#include <widgets/widgetsfactory.h>
|
#include <widgets/widgetsfactory.h>
|
||||||
#include <widgets/propertydefs.h>
|
#include <widgets/propertydefs.h>
|
||||||
|
#include <widgets/messageboxhelper.h>
|
||||||
|
#include <widgets/mainwindow.h>
|
||||||
#include <utils/widgetutils.h>
|
#include <utils/widgetutils.h>
|
||||||
#include <core/vnotex.h>
|
#include <core/vnotex.h>
|
||||||
|
|
||||||
@ -37,6 +39,9 @@ SettingsDialog::SettingsDialog(QWidget *p_parent)
|
|||||||
setupUI();
|
setupUI();
|
||||||
|
|
||||||
setupPages();
|
setupPages();
|
||||||
|
|
||||||
|
connect(this, &QDialog::finished,
|
||||||
|
this, &SettingsDialog::checkOnFinish);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SettingsDialog::setupUI()
|
void SettingsDialog::setupUI()
|
||||||
@ -315,3 +320,25 @@ void SettingsDialog::search()
|
|||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SettingsDialog::checkOnFinish()
|
||||||
|
{
|
||||||
|
// Check whether need to prompt for restart.
|
||||||
|
forEachPage([this](const SettingsPage *p_page) {
|
||||||
|
if (p_page->isRestartNeeded()) {
|
||||||
|
// Restart VNote.
|
||||||
|
int ret = MessageBoxHelper::questionYesNo(MessageBoxHelper::Type::Information,
|
||||||
|
tr("A restart of VNote may be needed to make changes take effect. Restart VNote now?"),
|
||||||
|
QString(),
|
||||||
|
QString(),
|
||||||
|
this);
|
||||||
|
if (ret == QMessageBox::Yes) {
|
||||||
|
QMetaObject::invokeMethod(VNoteX::getInst().getMainWindow(),
|
||||||
|
&MainWindow::restart,
|
||||||
|
Qt::QueuedConnection);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
@ -53,6 +53,8 @@ namespace vnotex
|
|||||||
|
|
||||||
void search();
|
void search();
|
||||||
|
|
||||||
|
void checkOnFinish();
|
||||||
|
|
||||||
QLineEdit *m_searchEdit = nullptr;
|
QLineEdit *m_searchEdit = nullptr;
|
||||||
|
|
||||||
TreeWidget *m_pageExplorer = nullptr;
|
TreeWidget *m_pageExplorer = nullptr;
|
||||||
|
@ -78,6 +78,8 @@ bool SettingsPage::save()
|
|||||||
|
|
||||||
if (saveInternal()) {
|
if (saveInternal()) {
|
||||||
m_changed = false;
|
m_changed = false;
|
||||||
|
// TODO: may need finer-grain check.
|
||||||
|
m_restartNeeded = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -102,3 +104,8 @@ void SettingsPage::setError(const QString &p_err)
|
|||||||
{
|
{
|
||||||
m_error = p_err;
|
m_error = p_err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool SettingsPage::isRestartNeeded() const
|
||||||
|
{
|
||||||
|
return m_restartNeeded;
|
||||||
|
}
|
||||||
|
@ -25,6 +25,8 @@ namespace vnotex
|
|||||||
|
|
||||||
const QString &error() const;
|
const QString &error() const;
|
||||||
|
|
||||||
|
bool isRestartNeeded() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changed();
|
void changed();
|
||||||
|
|
||||||
@ -64,6 +66,8 @@ namespace vnotex
|
|||||||
|
|
||||||
bool m_changed = false;
|
bool m_changed = false;
|
||||||
|
|
||||||
|
bool m_restartNeeded = false;
|
||||||
|
|
||||||
QString m_error;
|
QString m_error;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -389,6 +389,7 @@ void MainWindow::closeEvent(QCloseEvent *p_event)
|
|||||||
showNormal();
|
showNormal();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
saveStateAndGeometry();
|
saveStateAndGeometry();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -408,6 +409,8 @@ void MainWindow::closeEvent(QCloseEvent *p_event)
|
|||||||
FramelessMainWindowImpl::closeEvent(p_event);
|
FramelessMainWindowImpl::closeEvent(p_event);
|
||||||
qApp->exit(exitCode > -1 ? exitCode : 0);
|
qApp->exit(exitCode > -1 ? exitCode : 0);
|
||||||
} else {
|
} else {
|
||||||
|
emit minimizedToSystemTray();
|
||||||
|
|
||||||
hide();
|
hide();
|
||||||
p_event->ignore();
|
p_event->ignore();
|
||||||
if (needShowMessage) {
|
if (needShowMessage) {
|
||||||
|
@ -85,6 +85,8 @@ namespace vnotex
|
|||||||
// @m_response of @p_event: true to continue the close, false to stop the close.
|
// @m_response of @p_event: true to continue the close, false to stop the close.
|
||||||
void mainWindowClosed(const QSharedPointer<Event> &p_event);
|
void mainWindowClosed(const QSharedPointer<Event> &p_event);
|
||||||
|
|
||||||
|
void minimizedToSystemTray();
|
||||||
|
|
||||||
// No user interaction is available.
|
// No user interaction is available.
|
||||||
void mainWindowClosedOnQuit();
|
void mainWindowClosedOnQuit();
|
||||||
|
|
||||||
|
@ -1025,10 +1025,19 @@ void MarkdownViewWindow::handleReplaceAll(const QString &p_text, FindOptions p_o
|
|||||||
|
|
||||||
void MarkdownViewWindow::handleFindAndReplaceWidgetClosed()
|
void MarkdownViewWindow::handleFindAndReplaceWidgetClosed()
|
||||||
{
|
{
|
||||||
if (m_editor) {
|
if (isReadMode()) {
|
||||||
TextViewWindowHelper::handleFindAndReplaceWidgetClosed(this);
|
|
||||||
} else {
|
|
||||||
adapter()->findText(QStringList(), FindOption::FindNone);
|
adapter()->findText(QStringList(), FindOption::FindNone);
|
||||||
|
} else {
|
||||||
|
TextViewWindowHelper::clearSearchHighlights(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void MarkdownViewWindow::clearHighlights()
|
||||||
|
{
|
||||||
|
if (isReadMode()) {
|
||||||
|
adapter()->findText(QStringList(), FindOption::FindNone);
|
||||||
|
} else {
|
||||||
|
TextViewWindowHelper::clearSearchHighlights(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,6 +86,8 @@ namespace vnotex
|
|||||||
|
|
||||||
void print() Q_DECL_OVERRIDE;
|
void print() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
void clearHighlights() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void syncEditorFromBuffer() Q_DECL_OVERRIDE;
|
void syncEditorFromBuffer() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ void TextViewWindow::handleReplaceAll(const QString &p_text, FindOptions p_optio
|
|||||||
|
|
||||||
void TextViewWindow::handleFindAndReplaceWidgetClosed()
|
void TextViewWindow::handleFindAndReplaceWidgetClosed()
|
||||||
{
|
{
|
||||||
TextViewWindowHelper::handleFindAndReplaceWidgetClosed(this);
|
TextViewWindowHelper::clearSearchHighlights(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextViewWindow::updateEditorFromConfig()
|
void TextViewWindow::updateEditorFromConfig()
|
||||||
@ -317,3 +317,8 @@ void TextViewWindow::print()
|
|||||||
m_editor->getTextEdit()->print(printer.data());
|
m_editor->getTextEdit()->print(printer.data());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TextViewWindow::clearHighlights()
|
||||||
|
{
|
||||||
|
TextViewWindowHelper::clearSearchHighlights(this);
|
||||||
|
}
|
||||||
|
@ -70,6 +70,8 @@ namespace vnotex
|
|||||||
|
|
||||||
QPoint getFloatingWidgetPosition() Q_DECL_OVERRIDE;
|
QPoint getFloatingWidgetPosition() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
|
void clearHighlights() Q_DECL_OVERRIDE;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void setupUI();
|
void setupUI();
|
||||||
|
|
||||||
|
@ -213,7 +213,7 @@ namespace vnotex
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename _ViewWindow>
|
template <typename _ViewWindow>
|
||||||
static void handleFindAndReplaceWidgetClosed(_ViewWindow *p_win)
|
static void clearSearchHighlights(_ViewWindow *p_win)
|
||||||
{
|
{
|
||||||
p_win->m_editor->clearIncrementalSearchHighlight();
|
p_win->m_editor->clearIncrementalSearchHighlight();
|
||||||
p_win->m_editor->clearSearchHighlight();
|
p_win->m_editor->clearSearchHighlight();
|
||||||
|
@ -67,6 +67,13 @@ ViewArea::ViewArea(QWidget *p_parent)
|
|||||||
p_event->m_handled = true;
|
p_event->m_handled = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
connect(mainWindow, &MainWindow::minimizedToSystemTray,
|
||||||
|
this, [this]() {
|
||||||
|
if (ConfigMgr::getInst().getCoreConfig().isRecoverLastSessionOnStartEnabled()) {
|
||||||
|
// Save it here, too. Avoid losing session when VNote is closed unexpectedly.
|
||||||
|
saveSession();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
connect(mainWindow, &MainWindow::mainWindowClosedOnQuit,
|
connect(mainWindow, &MainWindow::mainWindowClosedOnQuit,
|
||||||
this, [this]() {
|
this, [this]() {
|
||||||
|
@ -1001,6 +1001,17 @@ void ViewWindow::setupShortcuts()
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ClearHighlights.
|
||||||
|
{
|
||||||
|
auto shortcut = WidgetUtils::createShortcut(editorConfig.getShortcut(EditorConfig::ClearHighlights), this, Qt::WidgetWithChildrenShortcut);
|
||||||
|
if (shortcut) {
|
||||||
|
connect(shortcut, &QShortcut::activated,
|
||||||
|
this, [this]() {
|
||||||
|
clearHighlights();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewWindow::wheelEvent(QWheelEvent *p_event)
|
void ViewWindow::wheelEvent(QWheelEvent *p_event)
|
||||||
@ -1345,3 +1356,7 @@ void ViewWindow::print()
|
|||||||
{
|
{
|
||||||
qWarning() << "print is not supported";
|
qWarning() << "print is not supported";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ViewWindow::clearHighlights()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
@ -256,6 +256,8 @@ namespace vnotex
|
|||||||
|
|
||||||
virtual void updateViewModeMenu(QMenu *p_menu);
|
virtual void updateViewModeMenu(QMenu *p_menu);
|
||||||
|
|
||||||
|
virtual void clearHighlights();
|
||||||
|
|
||||||
static QToolBar *createToolBar(QWidget *p_parent = nullptr);
|
static QToolBar *createToolBar(QWidget *p_parent = nullptr);
|
||||||
|
|
||||||
// The revision of the buffer of the last sync content.
|
// The revision of the buffer of the last sync content.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user