mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 13:59:52 +08:00
add hint for re-opening tabs
This commit is contained in:
parent
2298338094
commit
efd3740198
@ -444,6 +444,17 @@ int VUtils::showMessage(QMessageBox::Icon p_icon,
|
|||||||
return msgBox.exec();
|
return msgBox.exec();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void VUtils::promptForReopen(QWidget *p_parent)
|
||||||
|
{
|
||||||
|
VUtils::showMessage(QMessageBox::Information,
|
||||||
|
QObject::tr("Information"),
|
||||||
|
QObject::tr("Please re-open current opened tabs to make it work."),
|
||||||
|
"",
|
||||||
|
QMessageBox::Ok,
|
||||||
|
QMessageBox::Ok,
|
||||||
|
p_parent);
|
||||||
|
}
|
||||||
|
|
||||||
QString VUtils::generateCopiedFileName(const QString &p_dirPath,
|
QString VUtils::generateCopiedFileName(const QString &p_dirPath,
|
||||||
const QString &p_fileName,
|
const QString &p_fileName,
|
||||||
bool p_completeBaseName)
|
bool p_completeBaseName)
|
||||||
|
@ -161,6 +161,9 @@ public:
|
|||||||
const QString &p_infoText, QMessageBox::StandardButtons p_buttons,
|
const QString &p_infoText, QMessageBox::StandardButtons p_buttons,
|
||||||
QMessageBox::StandardButton p_defaultBtn, QWidget *p_parent,
|
QMessageBox::StandardButton p_defaultBtn, QWidget *p_parent,
|
||||||
MessageBoxType p_type = MessageBoxType::Normal);
|
MessageBoxType p_type = MessageBoxType::Normal);
|
||||||
|
|
||||||
|
static void promptForReopen(QWidget *p_parent);
|
||||||
|
|
||||||
static const QVector<QPair<QString, QString> > &getAvailableLanguages();
|
static const QVector<QPair<QString, QString> > &getAvailableLanguages();
|
||||||
static bool isValidLanguage(const QString &p_lang);
|
static bool isValidLanguage(const QString &p_lang);
|
||||||
static bool isImageURL(const QUrl &p_url);
|
static bool isImageURL(const QUrl &p_url);
|
||||||
|
@ -901,7 +901,7 @@ void VMainWindow::initMarkdownMenu()
|
|||||||
markdownMenu->addSeparator();
|
markdownMenu->addSeparator();
|
||||||
|
|
||||||
QAction *mermaidAct = new QAction(tr("&Mermaid Diagram"), this);
|
QAction *mermaidAct = new QAction(tr("&Mermaid Diagram"), this);
|
||||||
mermaidAct->setToolTip(tr("Enable Mermaid for graph and diagram"));
|
mermaidAct->setToolTip(tr("Enable Mermaid for graph and diagram (re-open current tabs to make it work)"));
|
||||||
mermaidAct->setCheckable(true);
|
mermaidAct->setCheckable(true);
|
||||||
connect(mermaidAct, &QAction::triggered,
|
connect(mermaidAct, &QAction::triggered,
|
||||||
this, &VMainWindow::enableMermaid);
|
this, &VMainWindow::enableMermaid);
|
||||||
@ -910,17 +910,18 @@ void VMainWindow::initMarkdownMenu()
|
|||||||
mermaidAct->setChecked(g_config->getEnableMermaid());
|
mermaidAct->setChecked(g_config->getEnableMermaid());
|
||||||
|
|
||||||
QAction *flowchartAct = new QAction(tr("&Flowchart.js"), this);
|
QAction *flowchartAct = new QAction(tr("&Flowchart.js"), this);
|
||||||
flowchartAct->setToolTip(tr("Enable Flowchart.js for flowchart diagram"));
|
flowchartAct->setToolTip(tr("Enable Flowchart.js for flowchart diagram (re-open current tabs to make it work)"));
|
||||||
flowchartAct->setCheckable(true);
|
flowchartAct->setCheckable(true);
|
||||||
connect(flowchartAct, &QAction::triggered,
|
connect(flowchartAct, &QAction::triggered,
|
||||||
this, [this](bool p_enabled){
|
this, [this](bool p_enabled){
|
||||||
g_config->setEnableFlowchart(p_enabled);
|
g_config->setEnableFlowchart(p_enabled);
|
||||||
|
VUtils::promptForReopen(this);
|
||||||
});
|
});
|
||||||
markdownMenu->addAction(flowchartAct);
|
markdownMenu->addAction(flowchartAct);
|
||||||
flowchartAct->setChecked(g_config->getEnableFlowchart());
|
flowchartAct->setChecked(g_config->getEnableFlowchart());
|
||||||
|
|
||||||
QAction *mathjaxAct = new QAction(tr("Math&Jax"), this);
|
QAction *mathjaxAct = new QAction(tr("Math&Jax"), this);
|
||||||
mathjaxAct->setToolTip(tr("Enable MathJax for math support in Markdown"));
|
mathjaxAct->setToolTip(tr("Enable MathJax for math support in Markdown (re-open current tabs to make it work)"));
|
||||||
mathjaxAct->setCheckable(true);
|
mathjaxAct->setCheckable(true);
|
||||||
connect(mathjaxAct, &QAction::triggered,
|
connect(mathjaxAct, &QAction::triggered,
|
||||||
this, &VMainWindow::enableMathjax);
|
this, &VMainWindow::enableMathjax);
|
||||||
@ -1452,11 +1453,13 @@ void VMainWindow::changeExpandTab(bool checked)
|
|||||||
void VMainWindow::enableMermaid(bool p_checked)
|
void VMainWindow::enableMermaid(bool p_checked)
|
||||||
{
|
{
|
||||||
g_config->setEnableMermaid(p_checked);
|
g_config->setEnableMermaid(p_checked);
|
||||||
|
VUtils::promptForReopen(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMainWindow::enableMathjax(bool p_checked)
|
void VMainWindow::enableMathjax(bool p_checked)
|
||||||
{
|
{
|
||||||
g_config->setEnableMathjax(p_checked);
|
g_config->setEnableMathjax(p_checked);
|
||||||
|
VUtils::promptForReopen(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMainWindow::changeHighlightCursorLine(bool p_checked)
|
void VMainWindow::changeHighlightCursorLine(bool p_checked)
|
||||||
@ -1560,7 +1563,7 @@ void VMainWindow::initMarkdownitOptionMenu(QMenu *p_menu)
|
|||||||
const MarkdownitOption &opt = g_config->getMarkdownitOption();
|
const MarkdownitOption &opt = g_config->getMarkdownitOption();
|
||||||
|
|
||||||
QAction *htmlAct = new QAction(tr("HTML"), this);
|
QAction *htmlAct = new QAction(tr("HTML"), this);
|
||||||
htmlAct->setToolTip(tr("Enable HTML tags in source"));
|
htmlAct->setToolTip(tr("Enable HTML tags in source (re-open current tabs to make it work)"));
|
||||||
htmlAct->setCheckable(true);
|
htmlAct->setCheckable(true);
|
||||||
htmlAct->setChecked(opt.m_html);
|
htmlAct->setChecked(opt.m_html);
|
||||||
connect(htmlAct, &QAction::triggered,
|
connect(htmlAct, &QAction::triggered,
|
||||||
@ -1571,7 +1574,7 @@ void VMainWindow::initMarkdownitOptionMenu(QMenu *p_menu)
|
|||||||
});
|
});
|
||||||
|
|
||||||
QAction *breaksAct = new QAction(tr("Line Break"), this);
|
QAction *breaksAct = new QAction(tr("Line Break"), this);
|
||||||
breaksAct->setToolTip(tr("Convert '\\n' in paragraphs into line break"));
|
breaksAct->setToolTip(tr("Convert '\\n' in paragraphs into line break (re-open current tabs to make it work)"));
|
||||||
breaksAct->setCheckable(true);
|
breaksAct->setCheckable(true);
|
||||||
breaksAct->setChecked(opt.m_breaks);
|
breaksAct->setChecked(opt.m_breaks);
|
||||||
connect(breaksAct, &QAction::triggered,
|
connect(breaksAct, &QAction::triggered,
|
||||||
@ -1582,7 +1585,7 @@ void VMainWindow::initMarkdownitOptionMenu(QMenu *p_menu)
|
|||||||
});
|
});
|
||||||
|
|
||||||
QAction *linkifyAct = new QAction(tr("Linkify"), this);
|
QAction *linkifyAct = new QAction(tr("Linkify"), this);
|
||||||
linkifyAct->setToolTip(tr("Convert URL-like text into links"));
|
linkifyAct->setToolTip(tr("Convert URL-like text into links (re-open current tabs to make it work)"));
|
||||||
linkifyAct->setCheckable(true);
|
linkifyAct->setCheckable(true);
|
||||||
linkifyAct->setChecked(opt.m_linkify);
|
linkifyAct->setChecked(opt.m_linkify);
|
||||||
connect(linkifyAct, &QAction::triggered,
|
connect(linkifyAct, &QAction::triggered,
|
||||||
@ -1593,7 +1596,7 @@ void VMainWindow::initMarkdownitOptionMenu(QMenu *p_menu)
|
|||||||
});
|
});
|
||||||
|
|
||||||
QAction *supAct = new QAction(tr("Superscript"), this);
|
QAction *supAct = new QAction(tr("Superscript"), this);
|
||||||
supAct->setToolTip(tr("Enable superscript via ^^"));
|
supAct->setToolTip(tr("Enable superscript like ^vnote^ (re-open current tabs to make it work)"));
|
||||||
supAct->setCheckable(true);
|
supAct->setCheckable(true);
|
||||||
supAct->setChecked(opt.m_sup);
|
supAct->setChecked(opt.m_sup);
|
||||||
connect(supAct, &QAction::triggered,
|
connect(supAct, &QAction::triggered,
|
||||||
@ -1604,7 +1607,7 @@ void VMainWindow::initMarkdownitOptionMenu(QMenu *p_menu)
|
|||||||
});
|
});
|
||||||
|
|
||||||
QAction *subAct = new QAction(tr("Subscript"), this);
|
QAction *subAct = new QAction(tr("Subscript"), this);
|
||||||
subAct->setToolTip(tr("Enable subscript via ~~"));
|
subAct->setToolTip(tr("Enable subscript like ~vnote~ (re-open current tabs to make it work)"));
|
||||||
subAct->setCheckable(true);
|
subAct->setCheckable(true);
|
||||||
subAct->setChecked(opt.m_sub);
|
subAct->setChecked(opt.m_sub);
|
||||||
connect(subAct, &QAction::triggered,
|
connect(subAct, &QAction::triggered,
|
||||||
@ -1615,7 +1618,7 @@ void VMainWindow::initMarkdownitOptionMenu(QMenu *p_menu)
|
|||||||
});
|
});
|
||||||
|
|
||||||
QAction *metadataAct = new QAction(tr("Metadata Aware"), this);
|
QAction *metadataAct = new QAction(tr("Metadata Aware"), this);
|
||||||
metadataAct->setToolTip(tr("Be aware of metadata in YAML format"));
|
metadataAct->setToolTip(tr("Be aware of metadata in YAML format (re-open current tabs to make it work)"));
|
||||||
metadataAct->setCheckable(true);
|
metadataAct->setCheckable(true);
|
||||||
metadataAct->setChecked(opt.m_metadata);
|
metadataAct->setChecked(opt.m_metadata);
|
||||||
connect(metadataAct, &QAction::triggered,
|
connect(metadataAct, &QAction::triggered,
|
||||||
@ -1626,7 +1629,7 @@ void VMainWindow::initMarkdownitOptionMenu(QMenu *p_menu)
|
|||||||
});
|
});
|
||||||
|
|
||||||
QAction *emojiAct = new QAction(tr("Emoji"), this);
|
QAction *emojiAct = new QAction(tr("Emoji"), this);
|
||||||
emojiAct->setToolTip(tr("Enable emoji and emoticon"));
|
emojiAct->setToolTip(tr("Enable emoji and emoticon (re-open current tabs to make it work)"));
|
||||||
emojiAct->setCheckable(true);
|
emojiAct->setCheckable(true);
|
||||||
emojiAct->setChecked(opt.m_emoji);
|
emojiAct->setChecked(opt.m_emoji);
|
||||||
connect(emojiAct, &QAction::triggered,
|
connect(emojiAct, &QAction::triggered,
|
||||||
@ -1677,7 +1680,8 @@ void VMainWindow::initRenderBackgroundMenu(QMenu *menu)
|
|||||||
const QVector<VColor> &bgColors = g_config->getCustomColors();
|
const QVector<VColor> &bgColors = g_config->getCustomColors();
|
||||||
for (int i = 0; i < bgColors.size(); ++i) {
|
for (int i = 0; i < bgColors.size(); ++i) {
|
||||||
tmpAct = new QAction(bgColors[i].m_name, renderBackgroundAct);
|
tmpAct = new QAction(bgColors[i].m_name, renderBackgroundAct);
|
||||||
tmpAct->setToolTip(tr("Set as the background color for Markdown rendering"));
|
tmpAct->setToolTip(tr("Set as the background color for Markdown rendering "
|
||||||
|
"(re-open current tabs to make it work)"));
|
||||||
tmpAct->setCheckable(true);
|
tmpAct->setCheckable(true);
|
||||||
tmpAct->setData(bgColors[i].m_name);
|
tmpAct->setData(bgColors[i].m_name);
|
||||||
|
|
||||||
@ -1824,7 +1828,7 @@ void VMainWindow::initEditorBackgroundMenu(QMenu *menu)
|
|||||||
const QVector<VColor> &bgColors = g_config->getCustomColors();
|
const QVector<VColor> &bgColors = g_config->getCustomColors();
|
||||||
for (int i = 0; i < bgColors.size(); ++i) {
|
for (int i = 0; i < bgColors.size(); ++i) {
|
||||||
tmpAct = new QAction(bgColors[i].m_name, backgroundColorAct);
|
tmpAct = new QAction(bgColors[i].m_name, backgroundColorAct);
|
||||||
tmpAct->setToolTip(tr("Set as the background color for editor"));
|
tmpAct->setToolTip(tr("Set as the background color for editor (re-open current tabs to make it work)"));
|
||||||
tmpAct->setCheckable(true);
|
tmpAct->setCheckable(true);
|
||||||
tmpAct->setData(bgColors[i].m_name);
|
tmpAct->setData(bgColors[i].m_name);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user