mirror of
https://gitee.com/vnotex/vnote.git
synced 2025-07-05 22:09:52 +08:00
minor-fix
- Move Insert Image to tool bar; - Fix Captain mode MagicWrod;
This commit is contained in:
parent
92bc044cac
commit
da027e9fd9
@ -942,7 +942,7 @@ void VEditArea::evaluateMagicWordsByCaptain(void *p_target, void *p_data)
|
|||||||
Q_UNUSED(p_data);
|
Q_UNUSED(p_data);
|
||||||
VEditArea *obj = static_cast<VEditArea *>(p_target);
|
VEditArea *obj = static_cast<VEditArea *>(p_target);
|
||||||
VEditTab *tab = obj->getCurrentTab();
|
VEditTab *tab = obj->getCurrentTab();
|
||||||
if (tab) {
|
if (tab && tab->tabHasFocus()) {
|
||||||
tab->evaluateMagicWords();
|
tab->evaluateMagicWords();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -114,3 +114,9 @@ void VEditTab::updateStatus()
|
|||||||
void VEditTab::evaluateMagicWords()
|
void VEditTab::evaluateMagicWords()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool VEditTab::tabHasFocus() const
|
||||||
|
{
|
||||||
|
QWidget *wid = QApplication::focusWidget();
|
||||||
|
return wid == this || isAncestorOf(wid);
|
||||||
|
}
|
||||||
|
@ -37,6 +37,9 @@ public:
|
|||||||
|
|
||||||
void focusTab();
|
void focusTab();
|
||||||
|
|
||||||
|
// Whether this tab has focus.
|
||||||
|
bool tabHasFocus() const;
|
||||||
|
|
||||||
// Scroll to @p_header.
|
// Scroll to @p_header.
|
||||||
// Will emit currentHeaderChanged() if @p_header is valid.
|
// Will emit currentHeaderChanged() if @p_header is valid.
|
||||||
virtual void scrollToHeader(const VHeaderPointer &p_header) { Q_UNUSED(p_header) }
|
virtual void scrollToHeader(const VHeaderPointer &p_header) { Q_UNUSED(p_header) }
|
||||||
|
@ -463,6 +463,20 @@ void VMainWindow::initEditToolBar(QSize p_iconSize)
|
|||||||
|
|
||||||
m_editToolBar->addAction(inlineCodeAct);
|
m_editToolBar->addAction(inlineCodeAct);
|
||||||
|
|
||||||
|
// Insert image.
|
||||||
|
QAction *insertImageAct = new QAction(QIcon(":/resources/icons/insert_image.svg"),
|
||||||
|
tr("Insert Image"),
|
||||||
|
this);
|
||||||
|
insertImageAct->setStatusTip(tr("Insert an image from file or URL"));
|
||||||
|
connect(insertImageAct, &QAction::triggered,
|
||||||
|
this, [this]() {
|
||||||
|
if (m_curTab) {
|
||||||
|
m_curTab->insertImage();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
m_editToolBar->addAction(insertImageAct);
|
||||||
|
|
||||||
QAction *toggleAct = m_editToolBar->toggleViewAction();
|
QAction *toggleAct = m_editToolBar->toggleViewAction();
|
||||||
toggleAct->setToolTip(tr("Toggle the edit toolbar"));
|
toggleAct->setToolTip(tr("Toggle the edit toolbar"));
|
||||||
viewMenu->addAction(toggleAct);
|
viewMenu->addAction(toggleAct);
|
||||||
@ -873,20 +887,15 @@ void VMainWindow::initFileMenu()
|
|||||||
|
|
||||||
fileMenu->addAction(settingsAct);
|
fileMenu->addAction(settingsAct);
|
||||||
|
|
||||||
QAction *editConfigAct = new QAction(tr("Edit Configuration File"), this);
|
QAction *openConfigAct = new QAction(tr("Open Configuration Folder"), this);
|
||||||
editConfigAct->setToolTip(tr("View and edit configuration file of VNote (vnote.ini)"));
|
openConfigAct->setToolTip(tr("Open configuration folder of VNote"));
|
||||||
connect(editConfigAct, &QAction::triggered,
|
connect(openConfigAct, &QAction::triggered,
|
||||||
this, [this](){
|
this, [this](){
|
||||||
#if defined(Q_OS_MACOS) || defined(Q_OS_MAC)
|
|
||||||
// On macOS, it seems that we could not open that ini file directly.
|
|
||||||
QUrl url = QUrl::fromLocalFile(g_config->getConfigFolder());
|
QUrl url = QUrl::fromLocalFile(g_config->getConfigFolder());
|
||||||
#else
|
|
||||||
QUrl url = QUrl::fromLocalFile(g_config->getConfigFilePath());
|
|
||||||
#endif
|
|
||||||
QDesktopServices::openUrl(url);
|
QDesktopServices::openUrl(url);
|
||||||
});
|
});
|
||||||
|
|
||||||
fileMenu->addAction(editConfigAct);
|
fileMenu->addAction(openConfigAct);
|
||||||
|
|
||||||
QAction *customShortcutAct = new QAction(tr("Custom Shortcuts"), this);
|
QAction *customShortcutAct = new QAction(tr("Custom Shortcuts"), this);
|
||||||
customShortcutAct->setToolTip(tr("Custom some standard shortcuts"));
|
customShortcutAct->setToolTip(tr("Custom some standard shortcuts"));
|
||||||
@ -940,13 +949,6 @@ void VMainWindow::initEditMenu()
|
|||||||
QMenu *editMenu = menuBar()->addMenu(tr("&Edit"));
|
QMenu *editMenu = menuBar()->addMenu(tr("&Edit"));
|
||||||
editMenu->setToolTipsVisible(true);
|
editMenu->setToolTipsVisible(true);
|
||||||
|
|
||||||
// Insert image.
|
|
||||||
m_insertImageAct = newAction(QIcon(":/resources/icons/insert_image.svg"),
|
|
||||||
tr("Insert &Image"), this);
|
|
||||||
m_insertImageAct->setToolTip(tr("Insert an image from file into current note"));
|
|
||||||
connect(m_insertImageAct, &QAction::triggered,
|
|
||||||
this, &VMainWindow::insertImage);
|
|
||||||
|
|
||||||
// Find/Replace.
|
// Find/Replace.
|
||||||
m_findReplaceAct = newAction(QIcon(":/resources/icons/find_replace.svg"),
|
m_findReplaceAct = newAction(QIcon(":/resources/icons/find_replace.svg"),
|
||||||
tr("Find/Replace"), this);
|
tr("Find/Replace"), this);
|
||||||
@ -1069,10 +1071,6 @@ void VMainWindow::initEditMenu()
|
|||||||
connect(trailingSapceAct, &QAction::triggered,
|
connect(trailingSapceAct, &QAction::triggered,
|
||||||
this, &VMainWindow::changeHighlightTrailingSapce);
|
this, &VMainWindow::changeHighlightTrailingSapce);
|
||||||
|
|
||||||
editMenu->addAction(m_insertImageAct);
|
|
||||||
editMenu->addSeparator();
|
|
||||||
m_insertImageAct->setEnabled(false);
|
|
||||||
|
|
||||||
QMenu *findReplaceMenu = editMenu->addMenu(tr("Find/Replace"));
|
QMenu *findReplaceMenu = editMenu->addMenu(tr("Find/Replace"));
|
||||||
findReplaceMenu->setToolTipsVisible(true);
|
findReplaceMenu->setToolTipsVisible(true);
|
||||||
findReplaceMenu->addAction(m_findReplaceAct);
|
findReplaceMenu->addAction(m_findReplaceAct);
|
||||||
@ -1775,8 +1773,6 @@ void VMainWindow::updateActionsStateFromTab(const VEditTab *p_tab)
|
|||||||
|
|
||||||
m_attachmentBtn->setEnabled(file && file->getType() == FileType::Note);
|
m_attachmentBtn->setEnabled(file && file->getType() == FileType::Note);
|
||||||
|
|
||||||
m_insertImageAct->setEnabled(file && editMode);
|
|
||||||
|
|
||||||
setActionsEnabled(m_editToolBar, file && editMode);
|
setActionsEnabled(m_editToolBar, file && editMode);
|
||||||
|
|
||||||
// Handle heading sequence act independently.
|
// Handle heading sequence act independently.
|
||||||
@ -2145,15 +2141,6 @@ void VMainWindow::repositionAvatar()
|
|||||||
m_avatar->show();
|
m_avatar->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
void VMainWindow::insertImage()
|
|
||||||
{
|
|
||||||
if (!m_curTab) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Q_ASSERT(m_curTab == editArea->getCurrentTab());
|
|
||||||
m_curTab->insertImage();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool VMainWindow::locateFile(VFile *p_file)
|
bool VMainWindow::locateFile(VFile *p_file)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
@ -123,7 +123,6 @@ private slots:
|
|||||||
void deleteCurNote();
|
void deleteCurNote();
|
||||||
void handleCurrentDirectoryChanged(const VDirectory *p_dir);
|
void handleCurrentDirectoryChanged(const VDirectory *p_dir);
|
||||||
void handleCurrentNotebookChanged(const VNotebook *p_notebook);
|
void handleCurrentNotebookChanged(const VNotebook *p_notebook);
|
||||||
void insertImage();
|
|
||||||
void handleFindDialogTextChanged(const QString &p_text, uint p_options);
|
void handleFindDialogTextChanged(const QString &p_text, uint p_options);
|
||||||
void openFindDialog();
|
void openFindDialog();
|
||||||
void enableMermaid(bool p_checked);
|
void enableMermaid(bool p_checked);
|
||||||
@ -311,7 +310,6 @@ private:
|
|||||||
QAction *m_printAct;
|
QAction *m_printAct;
|
||||||
QAction *m_exportAsPDFAct;
|
QAction *m_exportAsPDFAct;
|
||||||
|
|
||||||
QAction *m_insertImageAct;
|
|
||||||
QAction *m_findReplaceAct;
|
QAction *m_findReplaceAct;
|
||||||
QAction *m_findNextAct;
|
QAction *m_findNextAct;
|
||||||
QAction *m_findPreviousAct;
|
QAction *m_findPreviousAct;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user