summaryrefslogtreecommitdiffstats
path: root/addon
diff options
context:
space:
mode:
authoralbert-github <albert.tests@gmail.com>2020-11-03 13:41:18 (GMT)
committeralbert-github <albert.tests@gmail.com>2020-11-03 13:41:18 (GMT)
commit6deb25ba0cb0286f879071d0aaa069c1776fe06f (patch)
tree41a0bf9135a7b949f562be7b20ce846ae8c8fda9 /addon
parent67132b86a0d24cafab0fa400b1433f908efd4113 (diff)
downloadDoxygen-6deb25ba0cb0286f879071d0aaa069c1776fe06f.zip
Doxygen-6deb25ba0cb0286f879071d0aaa069c1776fe06f.tar.gz
Doxygen-6deb25ba0cb0286f879071d0aaa069c1776fe06f.tar.bz2
Handling Enable / Disable menu items (doxywizard)
Only enable menu item "Reset to factory defaults" in case the current settings are different from the default settings. Only enable "Clear recent list" and "Open recent" in case there are recent files.
Diffstat (limited to 'addon')
-rwxr-xr-xaddon/doxywizard/doxywizard.cpp15
-rwxr-xr-xaddon/doxywizard/doxywizard.h2
2 files changed, 15 insertions, 2 deletions
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp
index fe8e60c..dc54d09 100755
--- a/addon/doxywizard/doxywizard.cpp
+++ b/addon/doxywizard/doxywizard.cpp
@@ -69,11 +69,11 @@ MainWindow::MainWindow()
this, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
QMenu *settings = menuBar()->addMenu(tr("Settings"));
- settings->addAction(tr("Reset to factory defaults"),
+ m_resetDefault = settings->addAction(tr("Reset to factory defaults"),
this,SLOT(resetToDefaults()));
settings->addAction(tr("Use current settings at startup"),
this,SLOT(makeDefaults()));
- settings->addAction(tr("Clear recent list"),
+ m_clearRecent = settings->addAction(tr("Clear recent list"),
this,SLOT(clearRecent()));
QMenu *help = menuBar()->addMenu(tr("Help"));
@@ -379,6 +379,8 @@ void MainWindow::clearRecent()
{
m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i++),QString::fromLatin1(""));
}
+ m_clearRecent->setEnabled(false);
+ m_recentMenu->setEnabled(false);
m_settings.sync();
}
@@ -396,6 +398,8 @@ void MainWindow::resetToDefaults()
m_expert->resetToDefaults();
m_settings.setValue(QString::fromLatin1("wizard/loadsettings"), false);
m_settings.sync();
+ m_modified = false;
+ updateTitle();
m_wizard->refresh();
}
}
@@ -474,6 +478,9 @@ void MainWindow::addRecentFileList(const QString &fileName)
m_recentFiles.removeLast();
m_recentFiles.prepend(fileName);
}
+ m_clearRecent->setEnabled(m_recentFiles.count()>0);
+ m_recentMenu->setEnabled(m_recentFiles.count()>0);
+ m_settings.sync();
}
void MainWindow::updateRecentFile(void)
{
@@ -488,6 +495,9 @@ void MainWindow::updateRecentFile(void)
{
m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i),QString::fromLatin1(""));
}
+ m_clearRecent->setEnabled(m_recentFiles.count()>0);
+ m_recentMenu->setEnabled(m_recentFiles.count()>0);
+ m_settings.sync();
}
void MainWindow::openRecent(QAction *action)
@@ -685,6 +695,7 @@ void MainWindow::configChanged()
void MainWindow::updateTitle()
{
QString title = tr("Doxygen GUI frontend");
+ m_resetDefault->setEnabled(m_modified);
if (m_modified)
{
title+=QString::fromLatin1(" +");
diff --git a/addon/doxywizard/doxywizard.h b/addon/doxywizard/doxywizard.h
index 3fc2b65..48dc5d3 100755
--- a/addon/doxywizard/doxywizard.h
+++ b/addon/doxywizard/doxywizard.h
@@ -94,6 +94,8 @@ class MainWindow : public QMainWindow
QSettings m_settings;
QMenu *m_recentMenu;
QStringList m_recentFiles;
+ QAction *m_resetDefault;
+ QAction *m_clearRecent;
QProcess *m_runProcess;
QTimer *m_timer;
QTabWidget *m_tabs;