mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-06 06:19:52 +08:00
fix shortcuts in key sequence with input method
This commit is contained in:
parent
36d4248a32
commit
5da6a81d4b
@ -1 +1 @@
|
|||||||
Subproject commit 43ed95437369d48ff0428661db9ebae711d725e9
|
Subproject commit 6a1f34580067158f75f88643f5dd66197f34196d
|
@ -43,6 +43,8 @@ void CoreConfig::init(const QJsonObject &p_app,
|
|||||||
|
|
||||||
loadShortcuts(appObj, userObj);
|
loadShortcuts(appObj, userObj);
|
||||||
|
|
||||||
|
m_shortcutLeaderKey = READSTR(QStringLiteral("shortcut_leader_key"));
|
||||||
|
|
||||||
m_toolBarIconSize = READINT(QStringLiteral("toolbar_icon_size"));
|
m_toolBarIconSize = READINT(QStringLiteral("toolbar_icon_size"));
|
||||||
if (m_toolBarIconSize <= 0) {
|
if (m_toolBarIconSize <= 0) {
|
||||||
m_toolBarIconSize = 18;
|
m_toolBarIconSize = 18;
|
||||||
@ -73,6 +75,7 @@ QJsonObject CoreConfig::toJson() const
|
|||||||
obj[QStringLiteral("theme")] = m_theme;
|
obj[QStringLiteral("theme")] = m_theme;
|
||||||
obj[QStringLiteral("locale")] = m_locale;
|
obj[QStringLiteral("locale")] = m_locale;
|
||||||
obj[QStringLiteral("shortcuts")] = saveShortcuts();
|
obj[QStringLiteral("shortcuts")] = saveShortcuts();
|
||||||
|
obj[QStringLiteral("shortcut_leader_key")] = m_shortcutLeaderKey;
|
||||||
obj[QStringLiteral("toolbar_icon_size")] = m_toolBarIconSize;
|
obj[QStringLiteral("toolbar_icon_size")] = m_toolBarIconSize;
|
||||||
obj[QStringLiteral("docks_tabbar_icon_size")] = m_docksTabBarIconSize;
|
obj[QStringLiteral("docks_tabbar_icon_size")] = m_docksTabBarIconSize;
|
||||||
obj[QStringLiteral("recover_last_session_on_start")] = m_recoverLastSessionOnStartEnabled;
|
obj[QStringLiteral("recover_last_session_on_start")] = m_recoverLastSessionOnStartEnabled;
|
||||||
@ -216,3 +219,8 @@ void CoreConfig::setPerNotebookHistoryEnabled(bool p_enabled)
|
|||||||
{
|
{
|
||||||
updateConfig(m_perNotebookHistoryEnabled, p_enabled, this);
|
updateConfig(m_perNotebookHistoryEnabled, p_enabled, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const QString &CoreConfig::getShortcutLeaderKey() const
|
||||||
|
{
|
||||||
|
return m_shortcutLeaderKey;
|
||||||
|
}
|
||||||
|
@ -108,6 +108,8 @@ namespace vnotex
|
|||||||
bool isPerNotebookHistoryEnabled() const;
|
bool isPerNotebookHistoryEnabled() const;
|
||||||
void setPerNotebookHistoryEnabled(bool p_enabled);
|
void setPerNotebookHistoryEnabled(bool p_enabled);
|
||||||
|
|
||||||
|
const QString &getShortcutLeaderKey() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
friend class MainConfig;
|
friend class MainConfig;
|
||||||
|
|
||||||
@ -126,6 +128,9 @@ namespace vnotex
|
|||||||
|
|
||||||
QString m_shortcuts[Shortcut::MaxShortcut];
|
QString m_shortcuts[Shortcut::MaxShortcut];
|
||||||
|
|
||||||
|
// Leader key of shortcuts defined in m_shortctus.
|
||||||
|
QString m_shortcutLeaderKey;
|
||||||
|
|
||||||
// Icon size of MainWindow tool bar.
|
// Icon size of MainWindow tool bar.
|
||||||
int m_toolBarIconSize = 18;
|
int m_toolBarIconSize = 18;
|
||||||
|
|
||||||
|
@ -61,6 +61,7 @@
|
|||||||
"MoveOneSplitRight" : "Ctrl+G, Shift+L",
|
"MoveOneSplitRight" : "Ctrl+G, Shift+L",
|
||||||
"OpenLastClosedFile" : "Ctrl+Shift+T"
|
"OpenLastClosedFile" : "Ctrl+Shift+T"
|
||||||
},
|
},
|
||||||
|
"shortcut_leader_key" : "Ctrl+G",
|
||||||
"toolbar_icon_size" : 18,
|
"toolbar_icon_size" : 18,
|
||||||
"docks_tabbar_icon_size" : 24,
|
"docks_tabbar_icon_size" : 24,
|
||||||
"note_management" : {
|
"note_management" : {
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
#include <core/fileopenparameters.h>
|
#include <core/fileopenparameters.h>
|
||||||
#include <core/editorconfig.h>
|
#include <core/editorconfig.h>
|
||||||
|
#include <core/coreconfig.h>
|
||||||
#include <core/htmltemplatehelper.h>
|
#include <core/htmltemplatehelper.h>
|
||||||
#include <core/exception.h>
|
#include <core/exception.h>
|
||||||
#include <vtextedit/vtextedit.h>
|
#include <vtextedit/vtextedit.h>
|
||||||
@ -205,9 +206,11 @@ void MarkdownViewWindow::handleEditorConfigChange()
|
|||||||
m_editor->setConfig(config);
|
m_editor->setConfig(config);
|
||||||
|
|
||||||
m_editor->updateFromConfig();
|
m_editor->updateFromConfig();
|
||||||
|
|
||||||
|
updateEditorFromConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateWebViewerConfig(markdownEditorConfig);
|
updateWebViewerConfig();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -354,6 +357,8 @@ void MarkdownViewWindow::setupTextEditor()
|
|||||||
|
|
||||||
m_editor->setImageHost(m_imageHost);
|
m_editor->setImageHost(m_imageHost);
|
||||||
|
|
||||||
|
updateEditorFromConfig();
|
||||||
|
|
||||||
// Connect viewer and editor.
|
// Connect viewer and editor.
|
||||||
connect(adapter(), &MarkdownViewerAdapter::viewerReady,
|
connect(adapter(), &MarkdownViewerAdapter::viewerReady,
|
||||||
m_editor->getHighlighter(), &vte::PegMarkdownHighlighter::updateHighlight);
|
m_editor->getHighlighter(), &vte::PegMarkdownHighlighter::updateHighlight);
|
||||||
@ -958,13 +963,16 @@ void MarkdownViewWindow::scrollDown()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkdownViewWindow::updateWebViewerConfig(const MarkdownEditorConfig &p_config)
|
void MarkdownViewWindow::updateWebViewerConfig()
|
||||||
{
|
{
|
||||||
if (!m_viewer) {
|
if (!m_viewer) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_viewer->setZoomFactor(p_config.getZoomFactorInReadMode());
|
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
|
||||||
|
const auto &markdownEditorConfig = editorConfig.getMarkdownEditorConfig();
|
||||||
|
|
||||||
|
m_viewer->setZoomFactor(markdownEditorConfig.getZoomFactorInReadMode());
|
||||||
}
|
}
|
||||||
|
|
||||||
void MarkdownViewWindow::zoom(bool p_zoomIn)
|
void MarkdownViewWindow::zoom(bool p_zoomIn)
|
||||||
@ -1438,3 +1446,13 @@ void MarkdownViewWindow::handleExternalCodeBlockHighlightRequest(int p_idx, quin
|
|||||||
|
|
||||||
adapter()->highlightCodeBlock(p_idx, p_timeStamp, p_text);
|
adapter()->highlightCodeBlock(p_idx, p_timeStamp, p_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MarkdownViewWindow::updateEditorFromConfig()
|
||||||
|
{
|
||||||
|
const auto &coreConfig = ConfigMgr::getInst().getCoreConfig();
|
||||||
|
|
||||||
|
{
|
||||||
|
vte::Key leaderKey(coreConfig.getShortcutLeaderKey());
|
||||||
|
m_editor->setLeaderKeyToSkip(leaderKey.m_key, leaderKey.m_modifiers);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -151,7 +151,9 @@ namespace vnotex
|
|||||||
|
|
||||||
void setupOutlineProvider();
|
void setupOutlineProvider();
|
||||||
|
|
||||||
void updateWebViewerConfig(const MarkdownEditorConfig &p_config);
|
void updateEditorFromConfig();
|
||||||
|
|
||||||
|
void updateWebViewerConfig();
|
||||||
|
|
||||||
void setModeInternal(ViewWindowMode p_mode, bool p_syncBuffer);
|
void setModeInternal(ViewWindowMode p_mode, bool p_syncBuffer);
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
|
|
||||||
#include <vtextedit/vtextedit.h>
|
#include <vtextedit/vtextedit.h>
|
||||||
#include <core/editorconfig.h>
|
#include <core/editorconfig.h>
|
||||||
|
#include <core/coreconfig.h>
|
||||||
|
|
||||||
#include "textviewwindowhelper.h"
|
#include "textviewwindowhelper.h"
|
||||||
#include "toolbarhelper.h"
|
#include "toolbarhelper.h"
|
||||||
@ -245,11 +246,18 @@ void TextViewWindow::handleFindAndReplaceWidgetClosed()
|
|||||||
|
|
||||||
void TextViewWindow::updateEditorFromConfig()
|
void TextViewWindow::updateEditorFromConfig()
|
||||||
{
|
{
|
||||||
|
const auto &coreConfig = ConfigMgr::getInst().getCoreConfig();
|
||||||
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
|
const auto &editorConfig = ConfigMgr::getInst().getEditorConfig();
|
||||||
const auto &textEditorConfig = editorConfig.getTextEditorConfig();
|
const auto &textEditorConfig = editorConfig.getTextEditorConfig();
|
||||||
|
|
||||||
if (textEditorConfig.getZoomDelta() != 0) {
|
if (textEditorConfig.getZoomDelta() != 0) {
|
||||||
m_editor->zoom(textEditorConfig.getZoomDelta());
|
m_editor->zoom(textEditorConfig.getZoomDelta());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
vte::Key leaderKey(coreConfig.getShortcutLeaderKey());
|
||||||
|
m_editor->setLeaderKeyToSkip(leaderKey.m_key, leaderKey.m_modifiers);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TextViewWindow::openTwice(const QSharedPointer<FileOpenParameters> &p_paras)
|
void TextViewWindow::openTwice(const QSharedPointer<FileOpenParameters> &p_paras)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user