diff --git a/src/core/exception.h b/src/core/exception.h index e293c278..7f5adcf7 100644 --- a/src/core/exception.h +++ b/src/core/exception.h @@ -79,6 +79,12 @@ namespace vnotex case Type::EssentialFileMissing: return QString("EssentialFileMissing"); + case Type::FileExistsOnCreate: + return QString("FileExistsOnCreate"); + + case Type::DirExistsOnCreate: + return QString("DirExistsOnCreate"); + case Type::InvalidArgument: return QString("InvalidArgument"); } diff --git a/src/core/notebook/notebookdatabaseaccess.cpp b/src/core/notebook/notebookdatabaseaccess.cpp index a1e7db51..f291009f 100644 --- a/src/core/notebook/notebookdatabaseaccess.cpp +++ b/src/core/notebook/notebookdatabaseaccess.cpp @@ -188,7 +188,6 @@ bool NotebookDatabaseAccess::addNode(Node *p_node, bool p_ignoreId) } const ID id = query.lastInsertId().toULongLong(); - const ID preId = p_node->getId(); p_node->updateId(id); qDebug() << "added node id" << id << p_node->getName(); diff --git a/src/core/notebookmgr.cpp b/src/core/notebookmgr.cpp index bf301dab..04408ddb 100644 --- a/src/core/notebookmgr.cpp +++ b/src/core/notebookmgr.cpp @@ -377,8 +377,9 @@ void NotebookMgr::addNotebook(const QSharedPointer &p_notebook) { p_notebook->initialize(); m_notebooks.push_back(p_notebook); + auto notebook = p_notebook.data(); connect(p_notebook.data(), &Notebook::updated, - this, [this, notebook = p_notebook.data()]() { + this, [this, notebook]() { emit notebookUpdated(notebook); }); } diff --git a/src/data/extra/web/js/graphpreviewer.js b/src/data/extra/web/js/graphpreviewer.js index 8c168e8b..58c724fd 100644 --- a/src/data/extra/web/js/graphpreviewer.js +++ b/src/data/extra/web/js/graphpreviewer.js @@ -196,7 +196,7 @@ class GraphPreviewer { // Fix SVG with stroke="currentColor" and fill="currentColor". fixSvgCurrentColor(p_svgNode) { let currentColor = this.currentColor; - if (currentColor) { + if (currentColor && p_svgNode) { let nodes = p_svgNode.querySelectorAll("g[fill='currentColor']"); for (let i = 0; i < nodes.length; ++i) { let node = nodes[i]; @@ -212,7 +212,7 @@ class GraphPreviewer { scaleSvg(p_svgNode) { let scaleFactor = window.devicePixelRatio; - if (scaleFactor == 1) { + if (scaleFactor == 1 || !p_svgNode) { return; } diff --git a/src/search/filesearchengine.h b/src/search/filesearchengine.h index e0c81173..0cd9072d 100644 --- a/src/search/filesearchengine.h +++ b/src/search/filesearchengine.h @@ -71,7 +71,7 @@ namespace vnotex void search(const QSharedPointer &p_option, const SearchToken &p_token, - const QVector &p_items); + const QVector &p_items) Q_DECL_OVERRIDE; void stop() Q_DECL_OVERRIDE; diff --git a/src/search/isearchengine.h b/src/search/isearchengine.h index 57cb2a7e..4509e6f7 100644 --- a/src/search/isearchengine.h +++ b/src/search/isearchengine.h @@ -53,5 +53,4 @@ namespace vnotex void logRequested(const QString &p_log); }; } - #endif // ISEARCHENGINE_H diff --git a/src/widgets/dialogs/imageinsertdialog.cpp b/src/widgets/dialogs/imageinsertdialog.cpp index 5cfe43de..8de41ddd 100644 --- a/src/widgets/dialogs/imageinsertdialog.cpp +++ b/src/widgets/dialogs/imageinsertdialog.cpp @@ -136,7 +136,7 @@ void ImageInsertDialog::setupUI(const QString &p_title, auto fixedWidthCheckBox = WidgetsFactory::createCheckBox(tr("Fixed scaling width"), mainWidget); fixedWidthCheckBox->setChecked(s_fixedScaleWidth); connect(fixedWidthCheckBox, &QCheckBox::stateChanged, - this, [this](int p_state) { + this, [](int p_state) { s_fixedScaleWidth = p_state == Qt::Checked; }); gridLayout->addWidget(fixedWidthCheckBox, 4, 1, 1, 1); diff --git a/src/widgets/dialogs/updater.cpp b/src/widgets/dialogs/updater.cpp index 71e1e572..c3cb428f 100644 --- a/src/widgets/dialogs/updater.cpp +++ b/src/widgets/dialogs/updater.cpp @@ -42,7 +42,7 @@ void Updater::setupUI() auto btnBox = getDialogButtonBox(); auto viewBtn = btnBox->addButton(tr("View Releases"), QDialogButtonBox::AcceptRole); connect(viewBtn, &QPushButton::clicked, - this, [this]() { + this, []() { WidgetUtils::openUrlByDesktop(QUrl("https://github.com/vnotex/vnote/releases")); }); } diff --git a/src/widgets/framelessmainwindow/framelessmainwindowlinux.cpp b/src/widgets/framelessmainwindow/framelessmainwindowlinux.cpp index 17a06a6f..c23fed7f 100644 --- a/src/widgets/framelessmainwindow/framelessmainwindowlinux.cpp +++ b/src/widgets/framelessmainwindow/framelessmainwindowlinux.cpp @@ -230,4 +230,10 @@ void FramelessMainWindowLinux::showEvent(QShowEvent *p_event) } } +#else +using namespace vnotex; + +FramelessMainWindowLinuxDummy::FramelessMainWindowLinuxDummy() +{ +} #endif diff --git a/src/widgets/framelessmainwindow/framelessmainwindowlinux.h b/src/widgets/framelessmainwindow/framelessmainwindowlinux.h index 059c8184..c466ed1a 100644 --- a/src/widgets/framelessmainwindow/framelessmainwindowlinux.h +++ b/src/widgets/framelessmainwindow/framelessmainwindowlinux.h @@ -64,6 +64,8 @@ namespace vnotex #else class FramelessMainWindowLinuxDummy { + public: + FramelessMainWindowLinuxDummy(); }; #endif } diff --git a/src/widgets/framelessmainwindow/framelessmainwindowwin.cpp b/src/widgets/framelessmainwindow/framelessmainwindowwin.cpp index 1b2a8299..43b80469 100644 --- a/src/widgets/framelessmainwindow/framelessmainwindowwin.cpp +++ b/src/widgets/framelessmainwindow/framelessmainwindowwin.cpp @@ -221,4 +221,10 @@ void FramelessMainWindowWin::forceRedraw() } } +#else +using namespace vnotex; + +FramelessMainWindowWinDummy::FramelessMainWindowWinDummy() +{ +} #endif diff --git a/src/widgets/framelessmainwindow/framelessmainwindowwin.h b/src/widgets/framelessmainwindow/framelessmainwindowwin.h index 7f5e8c14..dddf06d6 100644 --- a/src/widgets/framelessmainwindow/framelessmainwindowwin.h +++ b/src/widgets/framelessmainwindow/framelessmainwindowwin.h @@ -40,6 +40,8 @@ namespace vnotex #else class FramelessMainWindowWinDummy { + public: + FramelessMainWindowWinDummy(); }; #endif } diff --git a/src/widgets/markdownviewwindow.cpp b/src/widgets/markdownviewwindow.cpp index 9564cc27..7c8922e5 100644 --- a/src/widgets/markdownviewwindow.cpp +++ b/src/widgets/markdownviewwindow.cpp @@ -282,7 +282,7 @@ void MarkdownViewWindow::setupToolBar() { auto act = addAction(toolBar, ViewWindowToolBarHelper::InplacePreview); connect(act, &QAction::triggered, - this, [this, act](bool p_checked) { + this, [this](bool p_checked) { if (!isReadMode()) { m_editor->setInplacePreviewEnabled(p_checked); } diff --git a/src/widgets/searchpanel.cpp b/src/widgets/searchpanel.cpp index ee4d0e12..ca39a546 100644 --- a/src/widgets/searchpanel.cpp +++ b/src/widgets/searchpanel.cpp @@ -142,7 +142,7 @@ TitleBar *SearchPanel::setupTitleBar(const QString &p_title, QWidget *p_parent) auto toggleLocationListBtn = titleBar->addActionButton(QStringLiteral("search_location_list.svg"), tr("Toggle Location List")); connect(toggleLocationListBtn, &QToolButton::triggered, - this, [this]() { + this, []() { VNoteX::getInst().getMainWindow()->toggleLocationListVisible(); }); diff --git a/src/widgets/snippetpanel.cpp b/src/widgets/snippetpanel.cpp index 35081942..aefb5927 100644 --- a/src/widgets/snippetpanel.cpp +++ b/src/widgets/snippetpanel.cpp @@ -69,7 +69,7 @@ void SnippetPanel::setupTitleBar(const QString &p_title, QWidget *p_parent) { auto openFolderBtn = m_titleBar->addActionButton(QStringLiteral("open_folder.svg"), tr("Open Folder")); connect(openFolderBtn, &QToolButton::triggered, - this, [this]() { + this, []() { WidgetUtils::openUrlByDesktop(QUrl::fromLocalFile(SnippetMgr::getInst().getSnippetFolder())); }); } diff --git a/src/widgets/styleditemdelegate.cpp b/src/widgets/styleditemdelegate.cpp index 98197432..f3011515 100644 --- a/src/widgets/styleditemdelegate.cpp +++ b/src/widgets/styleditemdelegate.cpp @@ -16,14 +16,14 @@ using namespace vnotex; StyledItemDelegateListWidget::StyledItemDelegateListWidget(const ListWidget *p_listWidget) - : m_listWidget(p_listWidget) { + Q_UNUSED(p_listWidget); } StyledItemDelegateTreeWidget::StyledItemDelegateTreeWidget(const TreeWidget *p_treeWidget) - : m_treeWidget(p_treeWidget) { + Q_UNUSED(p_treeWidget); } diff --git a/src/widgets/styleditemdelegate.h b/src/widgets/styleditemdelegate.h index e7e8ced8..f0887691 100644 --- a/src/widgets/styleditemdelegate.h +++ b/src/widgets/styleditemdelegate.h @@ -35,9 +35,6 @@ namespace vnotex { public: explicit StyledItemDelegateListWidget(const ListWidget *p_listWidget); - - private: - const ListWidget *m_listWidget = nullptr; }; @@ -45,9 +42,6 @@ namespace vnotex { public: explicit StyledItemDelegateTreeWidget(const TreeWidget *p_treeWidget); - - private: - const TreeWidget *m_treeWidget = nullptr; }; diff --git a/src/widgets/systemtrayhelper.cpp b/src/widgets/systemtrayhelper.cpp index 1b97bc06..19df4bec 100644 --- a/src/widgets/systemtrayhelper.cpp +++ b/src/widgets/systemtrayhelper.cpp @@ -24,6 +24,7 @@ QSystemTrayIcon *SystemTrayHelper::setupSystemTray(MainWindow *p_win) MainWindow::connect(trayIcon, &QSystemTrayIcon::activated, p_win, [p_win](QSystemTrayIcon::ActivationReason p_reason) { + Q_UNUSED(p_reason); #if !defined(Q_OS_MACOS) if (p_reason == QSystemTrayIcon::Trigger) { p_win->showMainWindow(); diff --git a/src/widgets/tagpopup.cpp b/src/widgets/tagpopup.cpp index 065c6898..e20b3f0d 100644 --- a/src/widgets/tagpopup.cpp +++ b/src/widgets/tagpopup.cpp @@ -16,6 +16,12 @@ TagPopup::TagPopup(QToolButton *p_btn, QWidget *p_parent) { setupUI(); +#if defined(Q_OS_MACOS) || defined(Q_OS_MAC) + // Qt::Popup on macOS does not work well with input method. + setWindowFlags(Qt::Tool | Qt::NoDropShadowWindowHint); + setWindowModality(Qt::ApplicationModal); +#endif + connect(this, &QMenu::aboutToShow, this, [this]() { m_tagViewer->setNode(m_buffer ? m_buffer->getNode() : nullptr);