summaryrefslogtreecommitdiffstats
path: root/addon/doxywizard/doxywizard.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'addon/doxywizard/doxywizard.cpp')
-rwxr-xr-xaddon/doxywizard/doxywizard.cpp180
1 files changed, 137 insertions, 43 deletions
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp
index ce22367..7b6aeb0 100755
--- a/addon/doxywizard/doxywizard.cpp
+++ b/addon/doxywizard/doxywizard.cpp
@@ -3,8 +3,8 @@
* Copyright (C) 1997-2019 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
- * documentation under the terms of the GNU General Public License is hereby
- * granted. No representations are made about the suitability of this software
+ * documentation under the terms of the GNU General Public License is hereby
+ * granted. No representations are made about the suitability of this software
* for any purpose. It is provided "as is" without express or implied warranty.
* See the GNU General Public License for more details.
*
@@ -22,6 +22,7 @@
#include <QVBoxLayout>
#include <QLineEdit>
#include <QLabel>
+#include <QCheckBox>
#include <QTextBrowser>
#include <QStatusBar>
#include <QProcess>
@@ -41,6 +42,9 @@
#define MAX_RECENT_FILES 10
+// globally accessible variables
+bool DoxygenWizard::debugFlag = false;
+
const int messageTimeout = 5000; //!< status bar message timeout in milliseconds.
#define APPQT(x) QString::fromLatin1("<qt><pre>") + x + QString::fromLatin1("</pre></qt>")
@@ -57,36 +61,39 @@ MainWindow::MainWindow()
: m_settings(QString::fromLatin1("Doxygen.org"), QString::fromLatin1("Doxywizard"))
{
QMenu *file = menuBar()->addMenu(tr("File"));
- file->addAction(tr("Open..."),
+ file->addAction(tr("Open..."),
this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O);
m_recentMenu = file->addMenu(tr("Open recent"));
- file->addAction(tr("Save"),
+ file->addAction(tr("Save"),
this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S);
- file->addAction(tr("Save as..."),
+ file->addAction(tr("Save as..."),
this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S);
- file->addAction(tr("Quit"),
+ file->addAction(tr("Quit"),
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"));
- help->addAction(tr("Online manual"),
+ help->addAction(tr("Online manual"),
this, SLOT(manual()), Qt::Key_F1);
- help->addAction(tr("About"),
+ help->addAction(tr("About"),
this, SLOT(about()) );
m_expert = new Expert;
m_wizard = new Wizard(m_expert->modelData());
// ----------- top part ------------------
+ QWidget *mainPart = new QWidget;
+ QVBoxLayout *mainLayout = new QVBoxLayout(mainPart);
QWidget *topPart = new QWidget;
QVBoxLayout *rowLayout = new QVBoxLayout(topPart);
+ mainLayout->addWidget(topPart);
// select working directory
QHBoxLayout *dirLayout = new QHBoxLayout;
@@ -107,11 +114,43 @@ MainWindow::MainWindow()
m_saveLog = new QPushButton(tr("Save log..."));
m_saveLog->setEnabled(false);
QPushButton *showSettings = new QPushButton(tr("Show configuration"));
- runLayout->addWidget(m_run);
- runLayout->addWidget(m_runStatus);
+
+ m_showCondensedSettings = new QCheckBox(this);
+ m_showCondensedSettings->setText(tr("Condensed"));
+ m_showCondensedSettings->setChecked(false);
+ m_showCondensedSettings->setToolTip(tr("Show only configuration settings different from default settings"));
+
+ // select extra run options
+ m_runOptions = new QLineEdit;
+
+ runTabLayout->addWidget(new QLabel(tr("Specify additional command line options for running doxygen")));
+ runTabLayout->addWidget(m_runOptions);
+
+ QVBoxLayout *runVLayout = new QVBoxLayout;
+ runLayout->addLayout(runVLayout);
+ QHBoxLayout *runVHLayout = new QHBoxLayout;
+ runVLayout->addLayout(runVHLayout);
+ runVHLayout->addWidget(m_run);
+ runVHLayout->addWidget(m_runStatus);
+
+ QHBoxLayout *runVH2Layout = new QHBoxLayout;
+ runVLayout->addLayout(runVH2Layout);
+ m_launchHtml = new QPushButton(tr("Show HTML output"));
+ runVH2Layout->addWidget(m_launchHtml);
+ runVH2Layout->addStretch(1); // to have launch button not being stretched
+
runLayout->addStretch(1);
- runLayout->addWidget(showSettings);
- runLayout->addWidget(m_saveLog);
+
+ QVBoxLayout *settingsLayout = new QVBoxLayout;
+ runLayout->addLayout(settingsLayout);
+ settingsLayout->addWidget(m_showCondensedSettings);
+ settingsLayout->addWidget(showSettings);
+
+ QVBoxLayout *saveLayout = new QVBoxLayout;
+ runLayout->addLayout(saveLayout);
+ saveLayout->addWidget(m_saveLog);
+ saveLayout->setAlignment(Qt::AlignTop);
+ // saveLayout->addWidget(new QWidget); // to have the save button at the top
// output produced by Doxygen
runTabLayout->addLayout(runLayout);
@@ -126,12 +165,6 @@ MainWindow::MainWindow()
grid->addWidget(m_outputLog,0,0);
grid->setColumnStretch(0,1);
grid->setRowStretch(0,1);
- QHBoxLayout *launchLayout = new QHBoxLayout;
- m_launchHtml = new QPushButton(tr("Show HTML output"));
- launchLayout->addWidget(m_launchHtml);
-
- launchLayout->addStretch(1);
- grid->addLayout(launchLayout,1,0);
runTabLayout->addLayout(grid);
m_tabs = new QTabWidget;
@@ -139,12 +172,12 @@ MainWindow::MainWindow()
m_tabs->addTab(m_expert,tr("Expert"));
m_tabs->addTab(runTab,tr("Run"));
- rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run")));
+ rowLayout->addWidget(new QLabel(tr("Specify the working directory from which doxygen will run")));
rowLayout->addLayout(dirLayout);
- rowLayout->addWidget(new QLabel(tr("Step 2: Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation")));
- rowLayout->addWidget(m_tabs);
+ rowLayout->addWidget(new QLabel(tr("Configure doxygen using the Wizard and/or Expert tab, then switch to the Run tab to generate the documentation")));
+ mainLayout->addWidget(m_tabs);
- setCentralWidget(topPart);
+ setCentralWidget(mainPart);
statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout);
m_runProcess = new QProcess;
@@ -193,6 +226,10 @@ void MainWindow::quit()
{
saveSettings();
}
+ else
+ {
+ return;
+ }
QApplication::exit(0);
}
@@ -220,7 +257,7 @@ void MainWindow::updateWorkingDir()
void MainWindow::manual()
{
- QDesktopServices::openUrl(QUrl(QString::fromLatin1("http://www.doxygen.org/manual/index.html")));
+ QDesktopServices::openUrl(QUrl(QString::fromLatin1("https://www.doxygen.org/manual/index.html")));
}
void MainWindow::about()
@@ -229,7 +266,15 @@ void MainWindow::about()
QTextStream t(&msg,QIODevice::WriteOnly);
t << QString::fromLatin1("<qt><center>A tool to configure and run doxygen version ")+
QString::fromLatin1(getDoxygenVersion())+
- QString::fromLatin1(" on your source files.</center><p><br>"
+ QString::fromLatin1(" on your source files.</center>")+
+ QString::fromLatin1("<center>(Created with Qt version ")+
+ QString::fromLatin1(QT_VERSION_STR);
+ if (qstrcmp(qVersion(),QT_VERSION_STR))
+ {
+ t << QString::fromLatin1(", running with ")+
+ QString::fromLatin1(qVersion());
+ }
+ t << QString::fromLatin1(")</center><p><br>"
"<center>Written by<br> Dimitri van Heesch<br>&copy; 2000-2019</center><p>"
"</qt>");
QMessageBox::about(this,tr("Doxygen GUI"),msg);
@@ -288,7 +333,7 @@ void MainWindow::saveConfig(const QString &fileName)
return;
}
QTextStream t(&f);
- m_expert->writeConfig(t,false);
+ m_expert->writeConfig(t,false,false);
updateConfigFileName(fileName);
m_modified = false;
updateTitle();
@@ -309,7 +354,7 @@ bool MainWindow::saveConfig()
bool MainWindow::saveConfigAs()
{
- QString fileName = QFileDialog::getSaveFileName(this, QString(),
+ QString fileName = QFileDialog::getSaveFileName(this, QString(),
m_workingDir->text()+QString::fromLatin1("/Doxyfile"));
if (fileName.isEmpty()) return false;
saveConfig(fileName);
@@ -345,9 +390,11 @@ 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();
}
-
+
}
void MainWindow::resetToDefaults()
@@ -362,6 +409,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();
}
}
@@ -429,7 +478,7 @@ void MainWindow::addRecentFileList(const QString &fileName)
{
int i=m_recentFiles.indexOf(fileName);
if (i!=-1) m_recentFiles.removeAt(i);
-
+
// not found
if (m_recentFiles.count() < MAX_RECENT_FILES) // append
{
@@ -440,12 +489,15 @@ 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)
{
m_recentMenu->clear();
int i=0;
- foreach( QString str, m_recentFiles )
+ foreach( QString str, m_recentFiles )
{
m_recentMenu->addAction(str);
m_settings.setValue(QString::fromLatin1("recent/config%1").arg(i++),str);
@@ -454,6 +506,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)
@@ -468,18 +523,18 @@ void MainWindow::runDoxygen()
{
if (!m_running)
{
- QString doxygenPath;
+ QString doxygenPath;
#if defined(Q_OS_MACX)
doxygenPath = qApp->applicationDirPath()+QString::fromLatin1("/../Resources/");
qDebug() << tr("Doxygen path: ") << doxygenPath;
- if ( !QFile(doxygenPath + QString::fromLatin1("doxygen")).exists() )
+ if ( !QFile(doxygenPath + QString::fromLatin1("doxygen")).exists() )
{
// No Doxygen binary in the resources, if there is a system Doxygen binary, use that instead
if ( QFile(QString::fromLatin1("/usr/local/bin/doxygen")).exists() )
{
doxygenPath = QString::fromLatin1("/usr/local/bin/");
}
- else
+ else
{
qDebug() << tr("Can't find the doxygen command, make sure it's in your $$PATH");
doxygenPath = QString::fromLatin1("");
@@ -493,11 +548,14 @@ void MainWindow::runDoxygen()
m_runProcess->setWorkingDirectory(m_workingDir->text());
QStringList env=QProcess::systemEnvironment();
// set PWD environment variable to m_workingDir
- env.replaceInStrings(QRegExp(QString::fromLatin1("^PWD=(.*)"),Qt::CaseInsensitive),
+ env.replaceInStrings(QRegExp(QString::fromLatin1("^PWD=(.*)"),Qt::CaseInsensitive),
QString::fromLatin1("PWD=")+m_workingDir->text());
m_runProcess->setEnvironment(env);
QStringList args;
+ QStringList runOptions = m_runOptions->text().split(QLatin1Char(' '),QString::SkipEmptyParts);
+
+ args << runOptions;
args << QString::fromLatin1("-b"); // make stdout unbuffered
args << QString::fromLatin1("-"); // read config from stdin
@@ -511,7 +569,7 @@ void MainWindow::runDoxygen()
return;
}
QTextStream t(m_runProcess);
- m_expert->writeConfig(t,false);
+ m_expert->writeConfig(t,false,false);
m_runProcess->closeWriteChannel();
if (m_runProcess->state() == QProcess::NotRunning)
@@ -601,7 +659,7 @@ void MainWindow::showHtmlOutput()
void MainWindow::saveLog()
{
- QString fn = QFileDialog::getSaveFileName(this, tr("Save log file"),
+ QString fn = QFileDialog::getSaveFileName(this, tr("Save log file"),
m_workingDir->text()+
QString::fromLatin1("/doxygen_log.txt"));
if (!fn.isEmpty())
@@ -625,7 +683,14 @@ void MainWindow::showSettings()
{
QString text;
QTextStream t(&text);
- m_expert->writeConfig(t,true);
+ if (m_showCondensedSettings->isChecked())
+ {
+ m_expert->writeConfig(t,true,true);
+ }
+ else
+ {
+ m_expert->writeConfig(t,true,false);
+ }
m_outputLog->clear();
m_outputLog->append(APPQT(text));
m_outputLog->ensureCursorVisible();
@@ -641,6 +706,7 @@ void MainWindow::configChanged()
void MainWindow::updateTitle()
{
QString title = tr("Doxygen GUI frontend");
+ m_resetDefault->setEnabled(m_modified);
if (m_modified)
{
title+=QString::fromLatin1(" +");
@@ -685,11 +751,26 @@ bool MainWindow::discardUnsavedChanges(bool saveOption)
return true;
}
+void MainWindow::outputLogStart()
+{
+ m_outputLog->clear();
+}
+void MainWindow::outputLogText(QString text)
+{
+ m_outputLog->append(APPQT(text));
+}
+void MainWindow::outputLogFinish()
+{
+ m_outputLog->ensureCursorVisible();
+ m_saveLog->setEnabled(true);
+}
//-----------------------------------------------------------------------
int main(int argc,char **argv)
{
QApplication a(argc,argv);
- if (argc == 2)
+ int locArgc = argc;
+
+ if (locArgc == 2)
{
if (!qstrcmp(argv[1],"--help"))
{
@@ -701,12 +782,25 @@ int main(int argc,char **argv)
else if (!qstrcmp(argv[1],"--version"))
{
QMessageBox msgBox;
- msgBox.setText(QString::fromLatin1("Doxywizard version: %1").arg(QString::fromLatin1(getFullVersion())));
+ if (!qstrcmp(qVersion(),QT_VERSION_STR))
+ {
+ msgBox.setText(QString::fromLatin1("Doxywizard version: %1, Qt version: %2").arg(QString::fromLatin1(getFullVersion()),QString::fromLatin1(QT_VERSION_STR)));
+ }
+ else
+ {
+ msgBox.setText(QString::fromLatin1("Doxywizard version: %1, Qt version: created with %2, running with %3").arg(QString::fromLatin1(getFullVersion()),QString::fromLatin1(QT_VERSION_STR),QString::fromLatin1(qVersion())));
+ }
msgBox.exec();
exit(0);
}
}
- if (argc > 2)
+ if (!qstrcmp(argv[1],"--debug") && ((locArgc == 2) || (locArgc == 3)))
+ {
+ DoxygenWizard::debugFlag = true;
+ locArgc--;
+ }
+
+ if (locArgc > 2)
{
QMessageBox msgBox;
msgBox.setText(QString::fromLatin1("Too many arguments specified\n\nUsage: %1 [config file]").arg(QString::fromLatin1(argv[0])));
@@ -716,9 +810,9 @@ int main(int argc,char **argv)
else
{
MainWindow &main = MainWindow::instance();
- if (argc==2 && argv[1][0]!='-') // name of config file as an argument
+ if (locArgc==2 && argv[argc-1][0]!='-') // name of config file as an argument
{
- main.loadConfigFromFile(QString::fromLocal8Bit(argv[1]));
+ main.loadConfigFromFile(QString::fromLocal8Bit(argv[argc-1]));
}
main.show();
return a.exec();