Browse Source

prompt for restart after changing theme

Le Tan 6 years ago
parent
commit
b33564726c
3 changed files with 19 additions and 2 deletions
  1. 1 1
      .gitignore
  2. 16 1
      src/vmainwindow.cpp
  3. 2 0
      src/vmainwindow.h

+ 1 - 1
.gitignore

@@ -1,2 +1,2 @@
-VNote.pro.user
+VNote.pro.user*
 CMakeLists.txt.user

+ 16 - 1
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<QString> 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();
+    }
+}

+ 2 - 0
src/vmainwindow.h

@@ -331,6 +331,8 @@ private:
 
     void updateFontOfAllTabs();
 
+    void promptForVNoteRestart();
+
     // Captain mode functions.
 
     // Popup the attachment list if it is enabled.