From b33564726c3c8e7e0055a22c604e4fb2d37a3571 Mon Sep 17 00:00:00 2001 From: Le Tan Date: Fri, 5 Apr 2019 10:30:09 +0800 Subject: [PATCH] prompt for restart after changing theme --- .gitignore | 2 +- src/vmainwindow.cpp | 17 ++++++++++++++++- src/vmainwindow.h | 2 ++ 3 files changed, 19 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index b19c9da3..494e6bb4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,2 @@ -VNote.pro.user +VNote.pro.user* CMakeLists.txt.user diff --git a/src/vmainwindow.cpp b/src/vmainwindow.cpp index 56cda038..36333e5f 100644 --- a/src/vmainwindow.cpp +++ b/src/vmainwindow.cpp @@ -3127,9 +3127,11 @@ void VMainWindow::initThemeMenu(QMenu *p_menu) QActionGroup *ag = new QActionGroup(this); connect(ag, &QActionGroup::triggered, - this, [](QAction *p_action) { + this, [this](QAction *p_action) { QString data = p_action->data().toString(); g_config->setTheme(data); + + promptForVNoteRestart(); }); QList themes = g_config->getThemes(); @@ -3585,3 +3587,16 @@ void VMainWindow::collectUserStat() const }); } +void VMainWindow::promptForVNoteRestart() +{ + int ret = VUtils::showMessage(QMessageBox::Information, + tr("Restart Needed"), + tr("Do you want to restart VNote now?"), + tr("VNote needs to restart to apply new configurations."), + QMessageBox::Ok | QMessageBox::No, + QMessageBox::Ok, + this); + if (ret == QMessageBox::Ok) { + restartVNote(); + } +} diff --git a/src/vmainwindow.h b/src/vmainwindow.h index 149b3e98..220cde1b 100644 --- a/src/vmainwindow.h +++ b/src/vmainwindow.h @@ -331,6 +331,8 @@ private: void updateFontOfAllTabs(); + void promptForVNoteRestart(); + // Captain mode functions. // Popup the attachment list if it is enabled.