summaryrefslogtreecommitdiffstats
path: root/addon/doxywizard
diff options
context:
space:
mode:
authorDimitri van Heesch <dimitri@stack.nl>2008-12-06 16:00:07 (GMT)
committerDimitri van Heesch <dimitri@stack.nl>2008-12-06 16:00:07 (GMT)
commitb2ff175fbaa113d17cc8c0873220580df1887b97 (patch)
tree76ffc77ee3c3548adca2711a1ad2ba2d0595ae70 /addon/doxywizard
parent78a0accf99eacf0a620cfad40c003be3be7bcd97 (diff)
downloadDoxygen-b2ff175fbaa113d17cc8c0873220580df1887b97.zip
Doxygen-b2ff175fbaa113d17cc8c0873220580df1887b97.tar.gz
Doxygen-b2ff175fbaa113d17cc8c0873220580df1887b97.tar.bz2
Release-1.5.7.1-20081206
Diffstat (limited to 'addon/doxywizard')
-rw-r--r--addon/doxywizard/Makefile.in35
-rw-r--r--addon/doxywizard/Makefile.win_nmake.in41
-rw-r--r--addon/doxywizard/README2
-rw-r--r--addon/doxywizard/doxywizard.cpp1626
-rw-r--r--addon/doxywizard/doxywizard.h311
-rw-r--r--addon/doxywizard/doxywizard.pro.in87
-rw-r--r--addon/doxywizard/doxywizard.qrc10
-rwxr-xr-xaddon/doxywizard/doxywizard.resbin13464 -> 0 bytes
-rw-r--r--addon/doxywizard/doxywizard.t45
-rw-r--r--addon/doxywizard/expert.cpp731
-rw-r--r--addon/doxywizard/expert.h114
-rw-r--r--addon/doxywizard/helplabel.h33
-rw-r--r--addon/doxywizard/images/add.pngbin0 -> 4321 bytes
-rw-r--r--addon/doxywizard/images/del.pngbin0 -> 4231 bytes
-rw-r--r--addon/doxywizard/images/file.pngbin0 -> 4380 bytes
-rw-r--r--addon/doxywizard/images/folder.pngbin0 -> 4308 bytes
-rw-r--r--addon/doxywizard/images/refresh.pngbin0 -> 4458 bytes
-rw-r--r--addon/doxywizard/input.h33
-rw-r--r--addon/doxywizard/inputbool.cpp111
-rw-r--r--addon/doxywizard/inputbool.h52
-rw-r--r--addon/doxywizard/inputint.cpp97
-rw-r--r--addon/doxywizard/inputint.h53
-rw-r--r--addon/doxywizard/inputstring.cpp219
-rw-r--r--addon/doxywizard/inputstring.h65
-rw-r--r--addon/doxywizard/inputstrlist.cpp292
-rw-r--r--addon/doxywizard/inputstrlist.h72
-rw-r--r--addon/doxywizard/qtbc.h45
-rw-r--r--addon/doxywizard/version.h2
-rw-r--r--addon/doxywizard/wizard.cpp896
-rw-r--r--addon/doxywizard/wizard.h182
30 files changed, 2772 insertions, 2382 deletions
diff --git a/addon/doxywizard/Makefile.in b/addon/doxywizard/Makefile.in
index 3861d09..fa459c2 100644
--- a/addon/doxywizard/Makefile.in
+++ b/addon/doxywizard/Makefile.in
@@ -10,38 +10,23 @@
# See the GNU General Public License for more details.
#
-all: version.cpp config.h config.l portable.h portable.cpp Makefile.doxywizard
- $(MAKE) -f Makefile.doxywizard QTDIR=$(QTDIR) $@
+QMAKE = qmake
-version.cpp: ../../src/version.cpp
- $(CP) ../../src/version.cpp version.cpp
+all: Makefile.doxywizard
+ $(MAKE) -f Makefile.doxywizard
-portable.cpp: ../../src/portable.cpp
- $(CP) ../../src/portable.cpp portable.cpp
+Makefile.doxywizard: doxywizard.pro
+ $(QTDIR)/bin/qmake doxywizard.pro -o Makefile.doxywizard
-portable.h: ../../src/portable.h
- $(CP) ../../src/portable.h portable.h
-
-config.h: ../../src/config.h
- $(CP) ../../src/config.h config.h
-
-config.l: ../../src/config.l
- $(CP) ../../src/config.l config.l
-
-Makefile.doxywizard: doxywizard.pro
- $(ENV) $(PERL) $(TMAKE) doxywizard.pro >Makefile.doxywizard
-
-tmake:
- $(ENV) $(PERL) $(TMAKE) doxywizard.pro >Makefile.doxywizard
+qmake:
+ $(QTDIR)/bin/qmake doxywizard.pro -o Makefile.doxywizard
clean: Makefile.doxywizard
$(MAKE) -f Makefile.doxywizard clean
- $(RM) config.cpp
-
-distclean: clean
- $(RM) Makefile.doxywizard version.cpp config.l config.h portable.h portable.cpp
-MAN1DIR = man/man1
+distclean: Makefile.doxywizard
+ $(MAKE) -f Makefile.doxywizard distclean
+ $(RM) Makefile.doxywizard
install:
$(INSTTOOL) -d $(INSTALL)/bin
diff --git a/addon/doxywizard/Makefile.win_nmake.in b/addon/doxywizard/Makefile.win_nmake.in
deleted file mode 100644
index e4b6c99..0000000
--- a/addon/doxywizard/Makefile.win_nmake.in
+++ /dev/null
@@ -1,41 +0,0 @@
-#
-#
-#
-# Copyright (C) 1997-2008 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
-# for any purpose. It is provided "as is" without express or implied warranty.
-# See the GNU General Public License for more details.
-#
-
-all: config.h config.l unistd.h Makefile.doxywizard
- $(MAKE) -f Makefile.doxywizard $@
-
-unistd.h: ..\..\src\unistd.h
- $(CP) ..\..\src\unistd.h unistd.h
-
-config.h: ..\..\src\config.l
- $(CP) ..\..\src\config.h config.h
-
-config.l: ..\..\src\config.l
- $(CP) ..\..\src\config.l config.l
-
-version.cpp: ..\..\src\version.cpp
- $(CP) ..\..\src\version.cpp version.cpp
-
-Makefile.doxywizard: doxywizard.pro
- $(ENV) $(PERL) $(TMAKE) doxywizard.pro >Makefile.doxywizard
-
-tmake:
- $(ENV) $(PERL) $(TMAKE) doxywizard.pro >Makefile.doxywizard
-
-clean: Makefile.doxywizard
- $(MAKE) -f Makefile.doxywizard clean
- $(RM) config.cpp
-
-distclean: clean
- $(RM) Makefile.doxywizard config.l config.h
-
-FORCE:
diff --git a/addon/doxywizard/README b/addon/doxywizard/README
index fc9c5aa..57705f0 100644
--- a/addon/doxywizard/README
+++ b/addon/doxywizard/README
@@ -1,3 +1,3 @@
Doxywizard is a graphical front-end to read/edit/write doxygen configuration
-files. It requires Qt version 3.x or higher.
+files and to launch doxygen. It requires Qt version 4.3 or higher.
diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp
index 160ba9c..6d88624 100644
--- a/addon/doxywizard/doxywizard.cpp
+++ b/addon/doxywizard/doxywizard.cpp
@@ -1,1415 +1,595 @@
-#include <qlabel.h>
-#include <qhbox.h>
-#include <qvbox.h>
-#include <qlineedit.h>
-#include <qapplication.h>
-#include <qcheckbox.h>
-#include <qpushbutton.h>
-#include <qbuttongroup.h>
-#include <qradiobutton.h>
-#include <qlayout.h>
-#include <qcombobox.h>
-#include <qfiledialog.h>
-#include <qmessagebox.h>
-#include <qtextedit.h>
-#include <qprocess.h>
-#include <qtimer.h>
-#include <qstatusbar.h>
-#include <qfileinfo.h>
-#include <qpopupmenu.h>
-#include <qmenubar.h>
-#include <qtooltip.h>
-
-#include <stdlib.h>
-
-#if defined(Q_OS_MACX)
-#include <CoreFoundation/CFBundle.h>
-#include <ApplicationServices/ApplicationServices.h>
-#undef check
-#endif
-
+#include <QtGui>
#include "doxywizard.h"
-#include "expert.h"
-#include "config.h"
#include "version.h"
+#include "expert.h"
+#include "wizard.h"
const int messageTimeout = 5000; //!< status bar message timeout in millisec.
-#if defined(Q_OS_MACX)
-QCString getResourcePath()
-{
- // todo: use qApp->applicationDirPath()
- QCString result;
- CFURLRef pluginRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
- CFStringRef macPath = CFURLCopyFileSystemPath(pluginRef, kCFURLPOSIXPathStyle);
- result = CFStringGetCStringPtr(macPath, CFStringGetSystemEncoding());
- result+="/Contents/Resources/";
- return result;
-}
-
-void setDotPath()
-{
- // TODO: enable this if we ship dot with doxygen again...
-// Config_getString("DOT_PATH")=getResourcePath();
-}
-
-bool setMscgenPath()
-{
- if (Config_getString("MSCGEN_PATH")!=getResourcePath())
- {
- Config_getString("MSCGEN_PATH")=getResourcePath();
- return TRUE;
- }
- return FALSE;
-}
+MainWindow &MainWindow::instance()
+{
+ static MainWindow theInstance;
+ return theInstance;
+}
+
+MainWindow::MainWindow()
+ : m_settings(QString::fromAscii("Doxygen.org"), QString::fromAscii("Doxywizard"))
+{
+ QMenu *file = menuBar()->addMenu(tr("File"));
+ file->addAction(tr("Open..."),
+ this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O);
+ m_recentMenu = file->addMenu(tr("Open recent"));
+ file->addAction(tr("Save"),
+ this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S);
+ file->addAction(tr("Save as..."),
+ this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S);
+ 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"),
+ this,SLOT(resetToDefaults()));
+ settings->addAction(tr("Use current settings at startup"),
+ this,SLOT(makeDefaults()));
+
+ QMenu *help = menuBar()->addMenu(tr("Help"));
+ help->addAction(tr("Online manual"),
+ this, SLOT(manual()), Qt::Key_F1);
+ help->addAction(tr("About"),
+ this, SLOT(about()) );
+
+ m_expert = new Expert;
+ m_wizard = new Wizard(m_expert->modelData());
+
+ // ----------- top part ------------------
+ QWidget *topPart = new QWidget;
+ QVBoxLayout *rowLayout = new QVBoxLayout(topPart);
+
+ // select working directory
+ QHBoxLayout *dirLayout = new QHBoxLayout;
+ m_workingDir = new QLineEdit;
+ m_selWorkingDir = new QPushButton(tr("Select..."));
+ dirLayout->addWidget(m_workingDir);
+ dirLayout->addWidget(m_selWorkingDir);
+
+ //------------- bottom part --------------
+ QWidget *runTab = new QWidget;
+ QVBoxLayout *runTabLayout = new QVBoxLayout(runTab);
+
+ // run doxygen
+ QHBoxLayout *runLayout = new QHBoxLayout;
+ m_run = new QPushButton(tr("Run doxygen"));
+ m_run->setEnabled(false);
+ m_runStatus = new QLabel(tr("Status: not running"));
+ 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);
+ runLayout->addStretch(1);
+ runLayout->addWidget(showSettings);
+ runLayout->addWidget(m_saveLog);
+
+ // output produced by doxygen
+ runTabLayout->addLayout(runLayout);
+ runTabLayout->addWidget(new QLabel(tr("Output produced by doxygen")));
+ QGridLayout *grid = new QGridLayout;
+ m_outputLog = new QTextEdit;
+ m_outputLog->setReadOnly(true);
+ m_outputLog->setFontFamily(QString::fromAscii("courier"));
+ m_outputLog->setMinimumWidth(600);
+ 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);
+#if 0
+ m_launchPdf = new QPushButton(tr("Show PDF output"));
+ launchLayout->addWidget(m_launchPdf);
#endif
+ launchLayout->addStretch(1);
+ grid->addLayout(launchLayout,1,0);
+ runTabLayout->addLayout(grid);
+ QTabWidget *tabs = new QTabWidget;
+ tabs->addTab(m_wizard,tr("Wizard"));
+ tabs->addTab(m_expert,tr("Expert"));
+ tabs->addTab(runTab,tr("Run"));
-//==========================================================================
-
-Step1::Step1(QWidget *parent) : QWidget(parent,"Step1")
-{
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setMargin(4);
- layout->setSpacing(8);
- layout->addWidget(new QLabel( "Provide some information "
- "about the project you are documenting",this));
- QWidget *w = new QWidget( this );
- QHBoxLayout *bl = new QHBoxLayout(w,10);
-
- QVBox *col1 = new QVBox( w );
- col1->setSpacing(8);
- (new QLabel("Project name:",col1))->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
- (new QLabel("Project version or id:",col1))->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
-
- QVBox *col2 = new QVBox( w );
- col2->setSpacing(8);
- m_projName = new QLineEdit(col2);
- m_projNumber = new QLineEdit(col2);
+ rowLayout->addWidget(new QLabel(tr("Step 1: 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(tabs);
- bl->addWidget(col1);
- bl->addWidget(col2);
+ setCentralWidget(topPart);
+ statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout);
+ loadSettings();
- layout->addWidget(w);
-
- //---------------------------------------------------
- QFrame *f = new QFrame( this );
- f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- layout->addWidget(f);
-
- layout->addWidget(new QLabel( "Specify the directory to "
- "scan for source code", this));
- QHBox *row = new QHBox( this );
- row->setSpacing(10);
- new QLabel("Source code directory:",row);
- m_sourceDir = new QLineEdit(row);
- m_srcSelectDir = new QPushButton("Select...",row);
- layout->addWidget(row);
-
- m_recursive = new QCheckBox("Scan recursively",this);
- m_recursive->setChecked(TRUE);
- layout->addWidget(m_recursive);
-
- //---------------------------------------------------
- f = new QFrame( this );
- f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- layout->addWidget(f);
-
- layout->addWidget(new QLabel(
- "Specify the directory where doxygen should "
- "put the generated documentation",this
- ));
- row = new QHBox( this );
- row->setSpacing(10);
- new QLabel("Destination directory:",row);
- m_destDir = new QLineEdit(row);
- m_dstSelectDir = new QPushButton("Select...",row);
- layout->addWidget(row);
- layout->addStretch(1);
-
- connect(m_srcSelectDir,SIGNAL(clicked()),
- this,SLOT(selectSourceDir()));
- connect(m_dstSelectDir,SIGNAL(clicked()),
- this,SLOT(selectDestinationDir()));
-}
-
-void Step1::selectSourceDir()
-{
- m_sourceDir->setText(QFileDialog::getExistingDirectory(m_sourceDir->text(),this));
-}
-
-void Step1::selectDestinationDir()
-{
- m_destDir->setText(QFileDialog::getExistingDirectory(m_destDir->text(),this));
-}
-
-QString Step1::getProjectName() const
-{
- return m_projName->text();
-}
-
-QString Step1::getProjectNumber() const
-{
- return m_projNumber->text();
-}
-
-QString Step1::getSourceDir() const
-{
- return m_sourceDir->text();
-}
-
-bool Step1::scanRecursively() const
-{
- return m_recursive->isChecked();
-}
-
-QString Step1::getDestinationDir() const
-{
- return m_destDir->text();
-}
-
-void Step1::setProjectName(const QString &name)
-{
- m_projName->setText(name);
-}
-
-void Step1::setProjectNumber(const QString &num)
-{
- m_projNumber->setText(num);
-}
-
-void Step1::setSourceDir(const QString &dir)
-{
- m_sourceDir->setText(dir);
-}
-
-void Step1::setRecursiveScan(bool enable)
-{
- m_recursive->setChecked(enable);
-}
-
-void Step1::setDestinationDir(const QString &dir)
-{
- m_destDir->setText(dir);
-}
-
-
-//==========================================================================
-
-Step2::Step2(QWidget *parent) : QWidget(parent,"Step2")
-{
- QVBoxLayout *layout = new QVBoxLayout(this);
- layout->setSpacing(8);
-
- m_extractMode = new QButtonGroup("Select the desired extraction mode:",this);
- QGridLayout *gbox = new QGridLayout( m_extractMode, 4, 1, 8, 0 );
- gbox->addRowSpacing( 0, fontMetrics().lineSpacing()+2 );
- gbox->addWidget(new QRadioButton("Documented entities only",m_extractMode),1,0);
- gbox->addWidget(new QRadioButton("All entities",m_extractMode),2,0);
- gbox->addWidget(m_crossRef = new QCheckBox("Include cross-referenced source code in the output",m_extractMode),3,0);
- m_extractMode->setButton(0);
- layout->addWidget(m_extractMode);
-
- //---------------------------------------------------
- QFrame *f = new QFrame( this );
- f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- layout->addWidget(f);
-
- m_optimizeLang = new QButtonGroup("Select programming language to optimize the results for",this);
- gbox = new QGridLayout( m_optimizeLang, 5, 1, 8, 0 );
- gbox->addRowSpacing( 0, fontMetrics().lineSpacing()+2 );
- gbox->addWidget(new QRadioButton("Optimize for C++ output",m_optimizeLang),1,0);
- gbox->addWidget(new QRadioButton("Optimize for Java output",m_optimizeLang),2,0);
- gbox->addWidget(new QRadioButton("Optimize for C output",m_optimizeLang),3,0);
- gbox->addWidget(new QRadioButton("Optimize for C# output",m_optimizeLang),4,0);
- m_optimizeLang->setButton(0);
- layout->addWidget(m_optimizeLang);
-
- layout->addStretch(1);
-}
+ m_runProcess = new QProcess;
+ m_running = false;
+ m_timer = new QTimer;
+ updateLaunchButtonState();
+ m_modified = false;
+ updateTitle();
-bool Step2::crossReferencingEnabled() const
-{
- //printf("Step2::crossReferencingEnabled()=%d\n",m_crossRef->isOn());
- return m_crossRef->isOn();
+ // connect signals and slots
+ connect(tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int)));
+ connect(m_selWorkingDir,SIGNAL(clicked()),SLOT(selectWorkingDir()));
+ connect(m_recentMenu,SIGNAL(triggered(QAction*)),SLOT(openRecent(QAction*)));
+ connect(m_workingDir,SIGNAL(returnPressed()),SLOT(updateWorkingDir()));
+ connect(m_runProcess,SIGNAL(readyReadStandardOutput()),SLOT(readStdout()));
+ connect(m_runProcess,SIGNAL(finished(int, QProcess::ExitStatus)),SLOT(runComplete()));
+ connect(m_timer,SIGNAL(timeout()),SLOT(readStdout()));
+ connect(m_run,SIGNAL(clicked()),SLOT(runDoxygen()));
+ connect(m_launchHtml,SIGNAL(clicked()),SLOT(showHtmlOutput()));
+ connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog()));
+ connect(showSettings,SIGNAL(clicked()),SLOT(showSettings()));
+ connect(m_expert,SIGNAL(changed()),SLOT(configChanged()));
}
-void Step2::enableCrossReferencing()
+void MainWindow::closeEvent(QCloseEvent *event)
{
- //printf("Step2::enableCrossReferencing()\n");
- m_crossRef->setChecked(TRUE);
+ if (discardUnsavedChanges())
+ {
+ saveSettings();
+ event->accept();
+ }
+ else
+ {
+ event->ignore();
+ }
}
-bool Step2::extractAll() const
+void MainWindow::quit()
{
- //printf("Step2::extractAll()=%d\n",m_extractMode->find(1)->isOn());
- return m_extractMode->find(1)->isOn();
+ if (discardUnsavedChanges())
+ {
+ saveSettings();
+ }
+ QApplication::exit(0);
}
-bool Step2::crossReferencing() const
+void MainWindow::setWorkingDir(const QString &dirName)
{
- return m_crossRef->isChecked();
+ QDir::setCurrent(dirName);
+ m_workingDir->setText(dirName);
+ m_run->setEnabled(!dirName.isEmpty());
}
-OptLang Step2::optimizeFor() const
+void MainWindow::selectWorkingDir()
{
- switch (m_optimizeLang->selectedId())
+ QString dirName = QFileDialog::getExistingDirectory(this,
+ tr("Select working directory"),m_workingDir->text());
+ if (!dirName.isEmpty())
{
- case 0: return Lang_Cpp;
- case 1: return Lang_Java;
- case 2: return Lang_C;
- case 3: return Lang_CS;
+ setWorkingDir(dirName);
}
- return Lang_Cpp;
-}
-
-void Step2::setExtractAll(bool enable)
-{
- //printf("Step2::setExtractAll(%d)\n",enable);
- m_extractMode->setButton(enable?1:0);
}
-void Step2::setCrossReferencing(bool enable)
+void MainWindow::updateWorkingDir()
{
- //printf("Step2::setCrossReferencing(%d)\n",enable);
- m_crossRef->setChecked(enable);
+ setWorkingDir(m_workingDir->text());
}
-void Step2::setOptimizeFor(OptLang lang)
+void MainWindow::manual()
{
- switch (lang)
- {
- case Lang_Cpp: m_optimizeLang->setButton(0); break;
- case Lang_Java: m_optimizeLang->setButton(1); break;
- case Lang_C: m_optimizeLang->setButton(2); break;
- case Lang_CS: m_optimizeLang->setButton(3); break;
- }
+ QDesktopServices::openUrl(QUrl(QString::fromAscii("http://www.doxygen.org/manual.html")));
}
-//==========================================================================
-
-Step3::Step3(QWidget *parent) : QWidget(parent,"Step3")
+void MainWindow::about()
{
- QVBoxLayout *layout = new QVBoxLayout(this);
- QButtonGroup *bg = new QButtonGroup("Output format(s) to generate",this);
- QGridLayout *gbox = new QGridLayout( bg, 8, 1, 8, 0 );
- gbox->addRowSpacing( 0, fontMetrics().lineSpacing()+2 );
- gbox->addWidget(m_htmlEnabled=new QCheckBox("HTML",bg),1,0);
- QWidget *w = new QWidget(bg);
- QHBoxLayout *bl = new QHBoxLayout(w);
- m_htmlOptions = new QButtonGroup(w);
- m_htmlOptions->hide();
- m_htmlOptionBox = new QVBox(w);
- m_htmlOptions->insert(new QRadioButton("plain HTML",m_htmlOptionBox));
- m_htmlOptions->insert(new QRadioButton("with frames and a navigation tree",m_htmlOptionBox));
- m_htmlOptions->insert(new QRadioButton("prepare for compressed HTML (.chm)",m_htmlOptionBox));
- m_htmlOptions->insert(m_searchEnabled=new QCheckBox("With search function (requires PHP enabled web server)",m_htmlOptionBox));
- bl->addSpacing(30);
- bl->addWidget(m_htmlOptionBox);
- m_htmlOptions->setButton(0);
- m_htmlOptionBox->setEnabled(TRUE);
- gbox->addWidget(w,2,0);
-
- gbox->addWidget(m_latexEnabled=new QCheckBox("LaTeX",bg),3,0);
- w = new QWidget(bg);
- bl = new QHBoxLayout(w);
- m_texOptions = new QButtonGroup(w);
- m_texOptions->hide();
- m_texOptionBox = new QVBox(w);
- m_texOptions->insert(new QRadioButton("as intermediate format for hyperlinked PDF",m_texOptionBox));
- m_texOptions->insert(new QRadioButton("as intermediate format for PDF",m_texOptionBox));
- m_texOptions->insert(new QRadioButton("as intermediate format for PostScript",m_texOptionBox));
- bl->addSpacing(30);
- bl->addWidget(m_texOptionBox);
- m_texOptions->setButton(0);
- m_texOptionBox->setEnabled(FALSE);
- gbox->addWidget(w,4,0);
-
- gbox->addWidget(m_manEnabled=new QCheckBox("Man pages",bg),5,0);
- gbox->addWidget(m_rtfEnabled=new QCheckBox("Rich Text Format (RTF)",bg),6,0);
- gbox->addWidget(m_xmlEnabled=new QCheckBox("XML",bg),7,0);
- bg->setButton(0);
- layout->addWidget(bg);
-
- layout->addStretch(1);
-
- connect(m_latexEnabled,SIGNAL(stateChanged(int)),
- this,SLOT(latexStateChange(int)));
- connect(m_htmlEnabled,SIGNAL(stateChanged(int)),
- this,SLOT(htmlStateChange(int)));
+ QString msg;
+ QTextStream t(&msg,QIODevice::WriteOnly);
+ t << QString::fromAscii("<qt><center>A tool to configure and run doxygen version ")+
+ QString::fromAscii(versionString)+
+ QString::fromAscii(" on your source files.</center><p><br>"
+ "<center>Written by<br> Dimitri van Heesch<br>&copy; 2000-2008</center><p>"
+ "</qt>");
+ QMessageBox::about(this,tr("Doxygen GUI"),msg);
}
-void Step3::latexStateChange(int state)
+void MainWindow::openConfig()
{
- if (state==QButton::On)
- {
- m_texOptionBox->setEnabled(TRUE);
- }
- else if (state==QButton::Off)
+ if (discardUnsavedChanges(false))
{
- m_texOptionBox->setEnabled(FALSE);
+ QString fn = QFileDialog::getOpenFileName(this,
+ tr("Open configuration file"),
+ m_workingDir->text());
+ if (!fn.isEmpty())
+ {
+ loadConfigFromFile(fn);
+ }
}
}
-void Step3::htmlStateChange(int state)
+void MainWindow::updateConfigFileName(const QString &fileName)
{
- if (state==QButton::On)
- {
- m_htmlOptionBox->setEnabled(TRUE);
- }
- else if (state==QButton::Off)
+ if (m_fileName!=fileName)
{
- m_htmlOptionBox->setEnabled(FALSE);
+ m_fileName = fileName;
+ QString curPath = QFileInfo(fileName).path();
+ setWorkingDir(curPath);
+ addRecentFile(fileName);
+ updateTitle();
}
}
-bool Step3::htmlEnabled() const
-{
- return m_htmlEnabled->isChecked();
-}
-
-bool Step3::latexEnabled() const
+void MainWindow::loadConfigFromFile(const QString & fileName)
{
- return m_latexEnabled->isChecked();
+ m_expert->loadConfig(fileName);
+ m_wizard->refresh();
+ updateConfigFileName(fileName);
+ updateLaunchButtonState();
+ m_modified = false;
+ updateTitle();
}
-bool Step3::manEnabled() const
+void MainWindow::saveConfig(const QString &fileName)
{
- return m_manEnabled->isChecked();
+ if (fileName.isEmpty()) return;
+ QFile f(fileName);
+ if (!f.open(QIODevice::WriteOnly)) return;
+ QTextStream t(&f);
+ m_expert->writeConfig(t,false);
+ updateConfigFileName(fileName);
+ m_modified = false;
+ updateTitle();
}
-bool Step3::rtfEnabled() const
+bool MainWindow::saveConfig()
{
- return m_rtfEnabled->isChecked();
-}
-
-bool Step3::xmlEnabled() const
-{
- return m_xmlEnabled->isChecked();
-}
-
-bool Step3::searchEnabled() const
-{
- return m_searchEnabled->isChecked();
-}
-
-HtmlStyle Step3::htmlStyle() const
-{
- if (m_htmlOptions->find(0)->isOn())
- {
- return HS_Plain;
- }
- else if (m_htmlOptions->find(1)->isOn())
+ if (m_fileName.isEmpty())
{
- return HS_TreeView;
+ return saveConfigAs();
}
- else if (m_htmlOptions->find(2)->isOn())
- {
- return HS_CHM;
- }
- // broken radio button logic
- return HS_Plain;
-}
-
-TexStyle Step3::texStyle() const
-{
- switch (m_texOptions->selectedId())
+ else
{
- case 0: return TS_PDFHyper;
- case 1: return TS_PDF;
- case 2: return TS_PS;
+ saveConfig(m_fileName);
+ return true;
}
- return TS_PDFHyper;
-}
-
-void Step3::setHtmlEnabled(bool enable)
-{
- m_htmlEnabled->setChecked(enable);
-}
-
-void Step3::setLatexEnabled(bool enable)
-{
- m_latexEnabled->setChecked(enable);
}
-void Step3::setManEnabled(bool enable)
+bool MainWindow::saveConfigAs()
{
- m_manEnabled->setChecked(enable);
+ QString fileName = QFileDialog::getSaveFileName(this, QString(),
+ m_workingDir->text()+QString::fromAscii("/Doxyfile"));
+ if (fileName.isEmpty()) return false;
+ saveConfig(fileName);
+ return true;
}
-void Step3::setRtfEnabled(bool enable)
+void MainWindow::makeDefaults()
{
- m_rtfEnabled->setChecked(enable);
-}
-
-void Step3::setXmlEnabled(bool enable)
-{
- m_xmlEnabled->setChecked(enable);
-}
-
-void Step3::setSearchEnabled(bool enable)
-{
- m_searchEnabled->setChecked(enable);
-}
-
-void Step3::setHtmlStyle(HtmlStyle style)
-{
- switch(style)
+ if (QMessageBox::question(this,tr("Use current setting at startup?"),
+ tr("Do you want to save the current settings "
+ "and use them next time Doxywizard starts?"),
+ QMessageBox::Save|
+ QMessageBox::Cancel)==QMessageBox::Save)
{
- case HS_Plain: m_htmlOptions->setButton(0); break;
- case HS_TreeView: m_htmlOptions->setButton(1); break;
- case HS_CHM: m_htmlOptions->setButton(2); break;
+ //printf("MainWindow:makeDefaults()\n");
+ m_expert->saveSettings(&m_settings);
+ m_settings.setValue(QString::fromAscii("wizard/loadsettings"), true);
}
}
-void Step3::setTexStyle(TexStyle style)
+void MainWindow::resetToDefaults()
{
- switch(style)
+ if (QMessageBox::question(this,tr("Reset settings to their default values?"),
+ tr("Do you want to revert all settings back "
+ "to their original values?"),
+ QMessageBox::Reset|
+ QMessageBox::Cancel)==QMessageBox::Reset)
{
- case TS_PDFHyper: m_texOptions->setButton(0); break;
- case TS_PDF: m_texOptions->setButton(1); break;
- case TS_PS: m_texOptions->setButton(2); break;
+ //printf("MainWindow:resetToDefaults()\n");
+ m_expert->resetToDefaults();
+ m_settings.setValue(QString::fromAscii("wizard/loadsettings"), false);
+ m_wizard->refresh();
}
}
-
-//==========================================================================
-
-Step4::Step4(QWidget *parent) : QWidget(parent,"Step4")
+void MainWindow::loadSettings()
{
- QVBoxLayout *layout = new QVBoxLayout(this);
- m_diagramMode = new QButtonGroup("Diagrams to generate",this);
- QGridLayout *gbox = new QGridLayout( m_diagramMode, 5, 1, 8, 0 );
- gbox->addRowSpacing( 0, fontMetrics().lineSpacing()+2 );
- gbox->addWidget(new QRadioButton("No diagrams",m_diagramMode),1,0);
- gbox->addWidget(new QRadioButton("Use built-in class diagram generator",m_diagramMode),2,0);
- gbox->addWidget(new QRadioButton("Use dot tool from the GraphViz package to generate",m_diagramMode),3,0);
- QWidget *w = new QWidget(m_diagramMode);
- QHBoxLayout *bl = new QHBoxLayout(w);
- QButtonGroup *dotGroup = new QButtonGroup(w);
- dotGroup->hide();
- m_dotOptions = new QVBox(w);
- dotGroup->insert(m_dotClass=new QCheckBox("Class diagrams",m_dotOptions));
- dotGroup->insert(m_dotCollaboration=new QCheckBox("Collaboration diagrams",m_dotOptions));
- dotGroup->insert(m_dotInclude=new QCheckBox("Include dependency graphs",m_dotOptions));
- dotGroup->insert(m_dotIncludedBy=new QCheckBox("Included by dependency graphs",m_dotOptions));
- dotGroup->insert(m_dotInheritance=new QCheckBox("Overall Class hierarchy",m_dotOptions));
- dotGroup->insert(m_dotCall=new QCheckBox("Call graphs",m_dotOptions));
- bl->addSpacing(30);
- bl->addWidget(m_dotOptions);
- dotGroup->setButton(0);
- m_dotOptions->setEnabled(FALSE);
- gbox->addWidget(w,4,0);
+ QVariant geometry = m_settings.value(QString::fromAscii("main/geometry"), QVariant::Invalid);
+ QVariant state = m_settings.value(QString::fromAscii("main/state"), QVariant::Invalid);
+ QVariant expState = m_settings.value(QString::fromAscii("expert/state"), QVariant::Invalid);
+ QVariant expState2 = m_settings.value(QString::fromAscii("expert/state2"), QVariant::Invalid);
+ QVariant wizState = m_settings.value(QString::fromAscii("wizard/state"), QVariant::Invalid);
+ QVariant loadSettings = m_settings.value(QString::fromAscii("wizard/loadsettings"), QVariant::Invalid);
+ //QVariant workingDir = m_settings.value(QString::fromAscii("main/defdir"), QVariant::Invalid);
-//#if defined(Q_OS_MACX) // we bundle dot with the mac package
-// m_diagramMode->setButton(2);
-//#else
- m_diagramMode->setButton(1);
-//#endif
- layout->addWidget(m_diagramMode);
- layout->addStretch(1);
-
- connect(m_diagramMode,SIGNAL(clicked(int)),
- this,SLOT(diagramModeChanged(int)));
- //connect(m_dotCall,SIGNAL(stateChanged(int)),
- // parent,SLOT(changeCallGraphState(int)));
-}
-
-void Step4::diagramModeChanged(int buttonId)
-{
- m_dotOptions->setEnabled(buttonId==2);
-}
-
-//void Step4::disableCallGraphs()
-//{
-// m_dotCall->setChecked(FALSE);
-//}
-
-//bool Step4::callGraphEnabled() const
-//{
-// return m_dotCall->isOn();
-//}
-
-DiagramMode Step4::diagramMode() const
-{
- switch(m_diagramMode->selectedId())
+ if (geometry !=QVariant::Invalid) restoreGeometry(geometry.toByteArray());
+ if (state !=QVariant::Invalid) restoreState (state.toByteArray());
+ if (expState !=QVariant::Invalid) m_expert->restoreState(expState.toByteArray());
+ if (expState2 !=QVariant::Invalid) m_expert->restoreInnerState(expState2.toByteArray());
+ if (wizState !=QVariant::Invalid) m_wizard->restoreState(wizState.toByteArray());
+ //if (workingDir!=QVariant::Invalid)
+ //{
+ // QString dir = workingDir.toString();
+ // m_workingDir->setText(dir);
+ // QDir::setCurrent(dir);
+ // m_run->setEnabled(!dir.isEmpty());
+ //}
+ if (loadSettings!=QVariant::Invalid && loadSettings.toBool())
{
- case 0: return DM_None;
- case 1: return DM_Builtin;
- case 2: return DM_Dot;
+ m_expert->loadSettings(&m_settings);
}
- return DM_None;
-}
-bool Step4::classDiagram() const
-{
- return m_dotClass->isChecked();
-}
-
-bool Step4::collaborationDiagram() const
-{
- return m_dotCollaboration->isChecked();
-}
-
-bool Step4::includeGraph() const
-{
- return m_dotInclude->isChecked();
-}
-
-bool Step4::includedByGraph() const
-{
- return m_dotIncludedBy->isChecked();
-}
-
-bool Step4::inheritanceGraph() const
-{
- return m_dotInheritance->isChecked();
-}
-
-bool Step4::callGraph() const
-{
- return m_dotCall->isChecked();
-}
-
-void Step4::setDiagramMode(DiagramMode mode)
-{
- switch(mode)
+ for (int i=0;i<10;i++)
{
- case DM_None: m_diagramMode->setButton(0); diagramModeChanged(0); break;
- case DM_Builtin: m_diagramMode->setButton(1); diagramModeChanged(1); break;
- case DM_Dot: m_diagramMode->setButton(2); diagramModeChanged(2); break;
+ QString entry = m_settings.value(QString().sprintf("recent/config%d",i)).toString();
+ if (!entry.isEmpty()) addRecentFile(entry);
}
-}
-void Step4::setClassDiagram(bool enable)
-{
- m_dotClass->setChecked(enable);
-}
-
-void Step4::setCollaborationDiagram(bool enable)
-{
- m_dotCollaboration->setChecked(enable);
}
-void Step4::setIncludeGraph(bool enable)
+void MainWindow::saveSettings()
{
- m_dotInclude->setChecked(enable);
-}
+ QSettings settings(QString::fromAscii("Doxygen.org"), QString::fromAscii("Doxywizard"));
-void Step4::setIncludedByGraph(bool enable)
-{
- m_dotIncludedBy->setChecked(enable);
+ m_settings.setValue(QString::fromAscii("main/geometry"), saveGeometry());
+ m_settings.setValue(QString::fromAscii("main/state"), saveState());
+ m_settings.setValue(QString::fromAscii("expert/state"), m_expert->saveState());
+ m_settings.setValue(QString::fromAscii("expert/state2"), m_expert->saveInnerState());
+ m_settings.setValue(QString::fromAscii("wizard/state"), m_wizard->saveState());
}
-void Step4::setInheritanceGraph(bool enable)
+void MainWindow::selectTab(int id)
{
- m_dotInheritance->setChecked(enable);
+ if (id==0) m_wizard->refresh();
}
-void Step4::setCallGraph(bool enable)
+void MainWindow::addRecentFile(const QString &fileName)
{
- m_dotCall->setChecked(enable);
-}
-
-
-//==========================================================================
-
-Wizard::Wizard(QWidget *parent=0) : QTabDialog(parent)
-{
- addTab( m_step1 = new Step1(this),"Project");
- addTab( m_step2 = new Step2(this),"Mode");
- addTab( m_step3 = new Step3(this),"Output");
- addTab( m_step4 = new Step4(this),"Diagrams");
- setCancelButton();
-}
-
-//==========================================================================
-
-MainWidget::MainWidget(QWidget *parent)
- : QMainWindow(parent,"MainWidget")
-{
- setCaption("Doxygen GUI frontend");
-
- // initialize config settings
- Config::instance()->init();
- Config::instance()->check();
- Config_getBool("HAVE_DOT")=TRUE;
-#if defined(Q_OS_MACX)
- setDotPath();
- setMscgenPath();
-#endif
+ int i=m_recentFiles.indexOf(fileName);
+ if (i!=-1) m_recentFiles.removeAt(i);
- QWidget *w = new QWidget(this);
- setCentralWidget(w);
- QVBoxLayout *layout = new QVBoxLayout(w);
- layout->setMargin(10);
-
- QPopupMenu *file = new QPopupMenu(this);
- file->insertItem("Open...", this, SLOT(loadConfigFile()), CTRL+Key_O);
- file->insertItem("Save As...", this, SLOT(saveConfigFile()), CTRL+Key_S);
- m_recentMenu = new QPopupMenu;
- file->insertItem( "&Recent configurations", m_recentMenu );
- connect(m_recentMenu,SIGNAL(activated(int)),this,SLOT(openRecent(int)));
- file->insertItem("Set as default...",this,SLOT(saveDefaults()) );
- file->insertItem("Reset...",this,SLOT(resetConfig()) );
- file->insertItem("Quit", this, SLOT(quit()), CTRL+Key_Q);
- QPopupMenu *help = new QPopupMenu(this);
-#if defined(Q_OS_MACX)
- help->insertItem("Online manual", this, SLOT(manual()), Key_F1);
-#endif
- help->insertItem("About", this, SLOT(about()) );
- menuBar()->insertItem("File",file);
- menuBar()->insertItem("Help",help);
-
- //---------------------------------------------------
- QVBox *heading = new QVBox(w);
- QLabel *l = new QLabel("Step 1: Configure doxygen",heading);
- QFrame *f = new QFrame( heading );
- f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- //f->setFixedSize(l->sizeHint().width(),f->sizeHint().height());
- layout->addWidget(heading);
- layout->addSpacing(10);
-
- l = new QLabel("Choose one of the following ways to configure doxygen",w);
- layout->addWidget(l);
- layout->addSpacing(5);
- QHBoxLayout *hbl = new QHBoxLayout(layout);
- hbl->setSpacing(8);
-
- m_wizard = new QPushButton("Wizard...",w);
- QToolTip::add(m_wizard,"Quickly configure the most important settings");
- hbl->addWidget(m_wizard);
-
- m_expert = new QPushButton("Expert...",w);
- QToolTip::add(m_expert,"Determine all configuration settings in detail");
- hbl->addWidget(m_expert);
-
- m_load = new QPushButton("Load...",w);
- QToolTip::add(m_load,"Load the configuration settings from file");
- hbl->addWidget(m_load);
-
- hbl->addStretch(1);
-
- //---------------------------------------------------
- heading = new QVBox(w);
- l = new QLabel("Step 2: Save the configuration file",heading);
- f = new QFrame( heading );
- f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- //f->setFixedSize(l->sizeHint().width(),f->sizeHint().height());
- layout->addSpacing(15);
- layout->addWidget(heading);
- layout->addSpacing(5);
-
- QGridLayout *grid = new QGridLayout(layout,1,2,10);
- m_save = new QPushButton("Save...",w);
- m_save->setFixedSize(m_save->sizeHint());
- grid->addWidget(m_save,0,0);
- grid->addWidget(m_saveStatus=new QLabel(w),0,1);
- m_saveStatus->setTextFormat(Qt::RichText);
-
- //---------------------------------------------------
- heading = new QVBox(w);
- l = new QLabel("Step 3: Specify the directory from which to run doxygen",heading);
- f = new QFrame( heading );
- f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- //f->setFixedSize(l->sizeHint().width(),f->sizeHint().height());
- layout->addSpacing(15);
- layout->addWidget(heading);
- layout->addSpacing(5);
-
- QHBoxLayout *row = new QHBoxLayout( layout );
- row->setSpacing(10);
- row->addWidget(new QLabel("Working directory:",w));
- m_workingDir = new QLineEdit(w);
- m_selWorkingDir = new QPushButton("Select...",w);
- row->addWidget(m_workingDir,1);
- row->addWidget(m_selWorkingDir);
-
- //---------------------------------------------------
- heading = new QVBox(w);
- l = new QLabel("Step 4: Run doxygen",heading);
- f = new QFrame( heading );
- f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
- //f->setFixedSize(l->sizeHint().width(),f->sizeHint().height());
- layout->addSpacing(15);
- layout->addWidget(heading);
- layout->addSpacing(5);
-
- row = new QHBoxLayout( layout );
- row->setSpacing(10);
- m_run = new QPushButton("Start",w);
- row->addWidget(m_run);
- row->addWidget(m_runStatus = new QLabel("Status: not running",w));
- row->addStretch(1);
- m_run->setEnabled(FALSE);
- m_runStatus->setEnabled(FALSE);
-
- m_saveLog = new QPushButton("Save log...",w);
- m_saveLog->setEnabled(FALSE);
- row->addWidget(m_saveLog);
-
- layout->addSpacing(8);
- layout->addWidget(m_outputHeading=new QLabel("Output produced by doxygen",w));
- grid = new QGridLayout(layout,1,1,3);
- m_outputLog = new QTextEdit(w);
- m_outputLog->setReadOnly(TRUE);
- m_outputLog->setMinimumWidth(600);
- grid->addWidget(m_outputLog,0,0);
- grid->setColStretch(0,1);
- grid->setRowStretch(0,1);
- m_outputLog->setEnabled(FALSE);
- m_outputHeading->setEnabled(FALSE);
-
- // make connections
- connect(m_wizard,SIGNAL(clicked()),
- this,SLOT(launchWizard()));
- connect(m_expert,SIGNAL(clicked()),
- this,SLOT(launchExpert()));
- connect(m_load,SIGNAL(clicked()),
- this,SLOT(loadConfigFile()));
- connect(m_save,SIGNAL(clicked()),
- this,SLOT(saveConfigFile()));
- connect(m_selWorkingDir,SIGNAL(clicked()),
- this,SLOT(selectWorkingDir()));
- connect(m_workingDir,SIGNAL(textChanged(const QString&)),
- this,SLOT(updateRunnable(const QString&)));
- connect(m_run,SIGNAL(clicked()),
- this,SLOT(runDoxygen()));
- connect(m_saveLog,SIGNAL(clicked()),
- this,SLOT(saveLog()));
-
- // load default settings
- m_settings.setPath("www.doxygen.org","Doxygen GUI");
- bool ok;
- QString config = m_settings.readEntry("/doxywizard/config/default",QString::null,&ok);
- if (ok && !config.isEmpty())
+ // not found
+ if (m_recentFiles.count() < 10) // append
{
- Config::instance()->parseString("default settings",config);
+ m_recentFiles.prepend(fileName);
}
- QString workingDir = m_settings.readEntry("/doxywizard/config/workingdir",QString::null,&ok);
- if (ok && !workingDir.isEmpty())
+ else // add + drop last item
{
- m_workingDir->setText(workingDir);
+ m_recentFiles.removeLast();
+ m_recentFiles.prepend(fileName);
}
- setConfigSaved(FALSE);
- for (int i=0;i<10;i++)
+ m_recentMenu->clear();
+ i=0;
+ foreach( QString str, m_recentFiles )
{
- QString entry = m_settings.readEntry(QString().sprintf("/doxywizard/recent/config%d",i));
- if (!entry.isEmpty())
- {
- addRecentFile(entry);
- }
+ m_recentMenu->addAction(str);
+ m_settings.setValue(QString().sprintf("recent/config%d",i++),str);
}
-
- m_runProcess = new QProcess;
- connect(m_runProcess,SIGNAL(readyReadStdout()),this,SLOT(readStdout()));
- connect(m_runProcess,SIGNAL(processExited()),this,SLOT(runComplete()));
- m_running = FALSE;
- m_timer = new QTimer;
- connect(m_timer,SIGNAL(timeout()),this,SLOT(readStdout()));
-
- statusBar()->message("Welcome to Doxygen",messageTimeout);
-}
-
-MainWidget::~MainWidget()
-{
- delete m_runProcess;
}
-void MainWidget::selectWorkingDir()
+void MainWindow::openRecent(QAction *action)
{
- QString selectedDir = QFileDialog::getExistingDirectory(m_workingDir->text());
- if (!selectedDir.isEmpty())
+ if (discardUnsavedChanges(false))
{
- m_workingDir->setText(selectedDir);
+ loadConfigFromFile(action->text());
}
}
-void MainWidget::updateRunnable(const QString &newDirName)
-{
- if (m_running) return;
- QFileInfo fi(newDirName);
- bool isRunnable = fi.exists() && fi.isDir() && m_configSaved;
- m_run->setEnabled(isRunnable);
- m_runStatus->setEnabled(isRunnable);
- m_outputHeading->setEnabled(isRunnable);
- m_outputLog->setEnabled(isRunnable);
- m_saveLog->setEnabled(isRunnable && !m_outputLog->text().isEmpty());
-}
-
-void MainWidget::launchWizard()
+void MainWindow::runDoxygen()
{
- Wizard wizard(this);
-
- // -------- Initialize the dialog ----------------
-
- // step1
- wizard.setProjectName(QString::fromLocal8Bit(Config_getString("PROJECT_NAME")));
- wizard.setProjectNumber(QString::fromLocal8Bit(Config_getString("PROJECT_NUMBER")));
- if (Config_getList("INPUT").count()>0)
- {
- QString dirName=Config_getList("INPUT").getFirst();
- QFileInfo fi(dirName);
- if (fi.exists() && fi.isDir())
- {
- wizard.setSourceDir(dirName);
- }
- }
- wizard.setRecursiveScan(Config_getBool("RECURSIVE"));
- wizard.setDestinationDir(QString::fromLocal8Bit(Config_getString("OUTPUT_DIRECTORY")));
-
- // step2
- wizard.setExtractAll(Config_getBool("EXTRACT_ALL"));
- wizard.setCrossReferencing(Config_getBool("SOURCE_BROWSER"));
- if (Config_getBool("OPTIMIZE_OUTPUT_JAVA"))
- {
- wizard.setOptimizeFor(Lang_Java);
- }
- else if (Config_getBool("OPTIMIZE_OUTPUT_FOR_C"))
- {
- wizard.setOptimizeFor(Lang_C);
- }
- else
- {
- wizard.setOptimizeFor(Lang_Cpp);
- }
-
- // step3
- wizard.setHtmlEnabled(Config_getBool("GENERATE_HTML"));
- wizard.setLatexEnabled(Config_getBool("GENERATE_LATEX"));
- wizard.setManEnabled(Config_getBool("GENERATE_MAN"));
- wizard.setRtfEnabled(Config_getBool("GENERATE_RTF"));
- wizard.setXmlEnabled(Config_getBool("GENERATE_XML"));
- wizard.setSearchEnabled(Config_getBool("SEARCHENGINE"));
- if (Config_getBool("GENERATE_HTMLHELP"))
- {
- wizard.setHtmlStyle(HS_CHM);
- }
- else if (Config_getEnum("GENERATE_TREEVIEW")!="NONE")
- {
- wizard.setHtmlStyle(HS_TreeView);
- }
- else
- {
- wizard.setHtmlStyle(HS_Plain);
- }
- if (Config_getBool("USE_PDFLATEX"))
- {
- if (Config_getBool("PDF_HYPERLINKS"))
- {
- wizard.setTexStyle(TS_PDFHyper);
- }
- else
- {
- wizard.setTexStyle(TS_PDF);
- }
- }
- else
+ if (!m_running)
{
- wizard.setTexStyle(TS_PS);
- }
+ QString doxygenPath;
+#if defined(Q_OS_MACX)
+ doxygenPath = qApp->applicationDirPath()+QString::fromAscii("/../Resources/");
+ qDebug() << tr("Doxygen path: ") << doxygenPath;
+ if ( !QFile(doxygenPath + QString::fromAscii("doxygen")).exists() ) {
+ // No doygen binary in the resources, if there is a system doxygen binary, use that instead
+ if ( QFile(QString::fromAscii("/usr/local/bin/doxygen")).exists() )
+ doxygenPath = QString::fromAscii("/usr/local/bin/");
+ else {
+ qDebug() << tr("Can't find the doxygen command, make sure it's in your $$PATH");
+ doxygenPath = QString::fromAscii("");
+ }
+ }
+ qDebug() << tr("Getting doxygen from: ") << doxygenPath;
+#endif
- // step4
- if (Config_getBool("HAVE_DOT"))
- {
- wizard.setDiagramMode(DM_Dot);
- }
- else if (Config_getBool("CLASS_DIAGRAMS"))
- {
- wizard.setDiagramMode(DM_Builtin);
- }
- else
- {
- wizard.setDiagramMode(DM_None);
- }
- wizard.setClassDiagram(Config_getBool("CLASS_GRAPH"));
- wizard.setCollaborationDiagram(Config_getBool("COLLABORATION_GRAPH"));
- wizard.setIncludeGraph(Config_getBool("INCLUDE_GRAPH"));
- wizard.setIncludedByGraph(Config_getBool("INCLUDED_BY_GRAPH"));
- wizard.setInheritanceGraph(Config_getBool("GRAPHICAL_HIERARCHY"));
- wizard.setCallGraph(Config_getBool("CALL_GRAPH"));
-
- // -------- Run the dialog ----------------
+ m_runProcess->setReadChannel(QProcess::StandardOutput);
+ m_runProcess->setProcessChannelMode(QProcess::MergedChannels);
+ m_runProcess->setWorkingDirectory(m_workingDir->text());
+ QStringList env=QProcess::systemEnvironment();
+ // set PWD environment variable to m_workingDir
+ env.replaceInStrings(QRegExp(QString::fromAscii("^PWD=(.*)"),Qt::CaseInsensitive),
+ QString::fromAscii("PWD=")+m_workingDir->text());
+ m_runProcess->setEnvironment(env);
- if (wizard.exec()==QDialog::Accepted)
- {
- // -------- Store the results ----------------
+ QStringList args;
+ args << QString::fromAscii("-b"); // make stdout unbuffered
+ args << QString::fromAscii("-"); // read config from stdin
- // step1
- Config_getString("PROJECT_NAME")=wizard.getProjectName().local8Bit();
- Config_getString("PROJECT_NUMBER")=wizard.getProjectNumber();
- Config_getList("INPUT").clear();
- Config_getList("INPUT").append(wizard.getSourceDir());
- Config_getBool("RECURSIVE")=wizard.scanRecursively();
- Config_getString("OUTPUT_DIRECTORY")=wizard.getDestinationDir().local8Bit();
+ m_outputLog->clear();
+ m_runProcess->start(doxygenPath + QString::fromAscii("doxygen"), args);
- // step2
- if (wizard.extractAll())
+ if (!m_runProcess->waitForStarted())
{
- Config_getBool("EXTRACT_ALL")=TRUE;
- Config_getBool("EXTRACT_PRIVATE")=TRUE;
- Config_getBool("EXTRACT_STATIC")=TRUE;
- Config_getBool("EXTRACT_LOCAL_CLASSES")=TRUE;
- Config_getBool("HIDE_UNDOC_MEMBERS")=FALSE;
- Config_getBool("HIDE_UNDOC_CLASSES")=FALSE;
- }
- else
- {
- Config_getBool("EXTRACT_ALL")=FALSE;
- Config_getBool("EXTRACT_PRIVATE")=FALSE;
- Config_getBool("EXTRACT_STATIC")=FALSE;
- Config_getBool("EXTRACT_LOCAL_CLASSES")=TRUE;
- Config_getBool("HIDE_UNDOC_MEMBERS")=TRUE;
- Config_getBool("HIDE_UNDOC_CLASSES")=TRUE;
+ m_outputLog->append(QString::fromAscii("*** Failed to run doxygen\n"));
+ return;
}
+ QTextStream t(m_runProcess);
+ m_expert->writeConfig(t,false);
+ m_runProcess->closeWriteChannel();
- if (wizard.crossReferencing())
+ if (m_runProcess->state() == QProcess::NotRunning)
{
- Config_getBool("SOURCE_BROWSER")=TRUE;
- Config_getBool("REFERENCED_BY_RELATION")=TRUE;
- Config_getBool("REFERENCES_RELATION")=TRUE;
- Config_getBool("VERBATIM_HEADERS")=TRUE;
+ m_outputLog->append(QString::fromAscii("*** Failed to run doxygen\n"));
}
else
{
- Config_getBool("SOURCE_BROWSER")=FALSE;
- Config_getBool("REFERENCED_BY_RELATION")=FALSE;
- Config_getBool("REFERENCES_RELATION")=FALSE;
- Config_getBool("VERBATIM_HEADERS")=FALSE;
- }
-
- switch(wizard.optimizeFor())
- {
- case Lang_Cpp:
- Config_getBool("OPTIMIZE_OUTPUT_FOR_C")=FALSE;
- Config_getBool("OPTIMIZE_OUTPUT_JAVA")=FALSE;
- break;
- case Lang_Java:
- Config_getBool("OPTIMIZE_OUTPUT_FOR_C")=FALSE;
- Config_getBool("OPTIMIZE_OUTPUT_JAVA")=TRUE;
- break;
- case Lang_C:
- Config_getBool("OPTIMIZE_OUTPUT_FOR_C")=TRUE;
- Config_getBool("OPTIMIZE_OUTPUT_JAVA")=FALSE;
- break;
- case Lang_CS:
- Config_getBool("OPTIMIZE_OUTPUT_FOR_C")=FALSE;
- Config_getBool("OPTIMIZE_OUTPUT_JAVA")=TRUE;
- Config_getBool("EXTRACT_STATIC")=TRUE;
- Config_getBool("EXTRACT_LOCAL_CLASSES")=TRUE;
- break;
- }
-
- // step3
- Config_getBool("GENERATE_HTML")=wizard.htmlEnabled();
- Config_getBool("GENERATE_LATEX")=wizard.latexEnabled();
- Config_getBool("GENERATE_MAN")=wizard.manEnabled();
- Config_getBool("GENERATE_RTF")=wizard.rtfEnabled();
- Config_getBool("GENERATE_XML")=wizard.xmlEnabled();
- Config_getBool("SEARCHENGINE")=wizard.searchEnabled();
- if (wizard.htmlEnabled())
- {
- switch (wizard.htmlStyle())
- {
- case HS_Plain:
- Config_getBool("GENERATE_HTMLHELP")=FALSE;
- Config_getEnum("GENERATE_TREEVIEW")="NONE";
- break;
- case HS_TreeView:
- Config_getBool("GENERATE_HTMLHELP")=FALSE;
- Config_getEnum("GENERATE_TREEVIEW")="ALL";
- break;
- case HS_CHM:
- Config_getBool("GENERATE_HTMLHELP")=TRUE;
- Config_getEnum("GENERATE_TREEVIEW")="NONE";
- break;
- }
- }
- if (wizard.latexEnabled())
- {
- switch (wizard.texStyle())
- {
- case TS_PDFHyper:
- Config_getBool("USE_PDFLATEX")=TRUE;
- Config_getBool("PDF_HYPERLINKS")=TRUE;
- break;
- case TS_PDF:
- Config_getBool("USE_PDFLATEX")=TRUE;
- Config_getBool("PDF_HYPERLINKS")=FALSE;
- break;
- case TS_PS:
- Config_getBool("USE_PDFLATEX")=FALSE;
- Config_getBool("PDF_HYPERLINKS")=FALSE;
- break;
- }
- }
-
- // step4
- switch (wizard.diagramMode())
- {
- case DM_None:
- Config_getBool("CLASS_DIAGRAMS")=FALSE;
- Config_getBool("HAVE_DOT")=FALSE;
- break;
- case DM_Builtin:
- Config_getBool("CLASS_DIAGRAMS")=TRUE;
- Config_getBool("HAVE_DOT")=FALSE;
- break;
- case DM_Dot:
- Config_getBool("CLASS_DIAGRAMS")=FALSE;
- Config_getBool("HAVE_DOT")=TRUE;
- Config_getBool("CLASS_GRAPH")=wizard.classDiagram();
- Config_getBool("COLLABORATION_GRAPH")=wizard.collaborationDiagram();
- Config_getBool("INCLUDE_GRAPH")=wizard.includeGraph();
- Config_getBool("INCLUDED_BY_GRAPH")=wizard.includedByGraph();
- Config_getBool("GRAPHICAL_HIERARCHY")=wizard.inheritanceGraph();
- Config_getBool("CALL_GRAPH")=wizard.callGraph();
- break;
- }
-#if defined(Q_OS_MACX)
- if (Config_getString("DOT_PATH").isEmpty())
- {
- setDotPath();
- }
- if (Config_getString("MSCGEN_PATH").isEmpty())
- {
- setMscgenPath();
+ m_saveLog->setEnabled(false);
+ m_running=true;
+ m_run->setText(tr("Stop doxygen"));
+ m_runStatus->setText(tr("Status: running"));
+ m_timer->start(1000);
}
-#endif
- setConfigSaved(FALSE);
- }
-}
-
-void MainWidget::loadConfigFromFile(const QString &fn)
-{
- if (!Config::instance()->parse(fn))
- {
- QMessageBox::warning(0,"Warning",
- "Could not open or read config file "+fn+"!",
- "abort"
- );
}
else
{
- Config::instance()->convertStrToVal();
-#if 0 //defined(Q_OS_MACX)
- if (checkIfDotInstalled() &&
- qstricmp(Config_getString("DOT_PATH"),DOT_PATH)!=0
- )
- {
- Config_getString("DOT_PATH")=DOT_PATH;
- setConfigSaved(FALSE);
- }
- else
- {
- setConfigSaved(TRUE);
- }
-#else
- setConfigSaved(TRUE);
-#endif
- addRecentFile(fn);
- m_workingDir->setText(QFileInfo(fn).dirPath(TRUE));
- m_configFileName = fn;
-#if defined(Q_OS_MACX)
- //if (Config_getString("DOT_PATH").isEmpty())
- //{
- // setDotPath();
- // setConfigSaved(FALSE);
- //}
- if (Config_getString("MSCGEN_PATH").isEmpty())
- {
- setMscgenPath();
- setConfigSaved(FALSE);
- }
-#endif
- statusBar()->message("New configuration loaded",messageTimeout);
+ m_running=false;
+ m_run->setText(tr("Run doxygen"));
+ m_runStatus->setText(tr("Status: not running"));
+ m_runProcess->kill();
+ m_timer->stop();
+ //updateRunnable(m_workingDir->text());
}
}
-void MainWidget::loadConfigFile()
+void MainWindow::readStdout()
{
- QString fn = QFileDialog::getOpenFileName(m_workingDir->text(),QString::null,this);
- if (!fn.isEmpty())
+ if (m_running)
{
- loadConfigFromFile(fn);
- // set current dir to where the config file is located
- QDir::setCurrent(QFileInfo(fn).dirPath(TRUE));
+ QByteArray data = m_runProcess->readAllStandardOutput();
+ QString text = QString::fromLocal8Bit(data);
+ if (!text.isEmpty())
+ {
+ m_outputLog->append(text.trimmed());
+ }
}
}
-void MainWidget::launchExpert()
-{
- Expert expert(this);
- expert.init();
- expert.exec();
-//#if defined(Q_OS_MACX)
-// setDotPath();
-//#endif
- if (expert.hasChanged()) setConfigSaved(FALSE);
-}
-
-void MainWidget::saveDefaults()
+void MainWindow::runComplete()
{
- if (QMessageBox::question(this,"Store settings as defaults",
- "Do you wish to use the "
- "current configuration settings as the default settings?",
- QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
+ if (m_running)
{
- QString newConfig;
- QTextStream t(&newConfig,IO_WriteOnly);
- Config::instance()->writeTemplate(t,TRUE,FALSE);
- m_settings.writeEntry("/doxywizard/config/default",newConfig);
- m_settings.writeEntry("/doxywizard/config/workingdir",m_workingDir->text());
- statusBar()->message("Current configuration saved as default",messageTimeout);
+ m_outputLog->append(tr("*** Doxygen has finished\n"));
}
-}
-
-void MainWidget::saveConfigFile()
-{
- QString fn = QFileDialog::getSaveFileName(m_workingDir->text()+"/Doxyfile",QString::null,this);
- if (!fn.isEmpty())
+ else
{
- QFile f(fn);
- if (f.exists() && QMessageBox::question(this,
- "Overwrite file? -- Doxywizard",
- "A file called "+fn+" already exists. Do you want to overwrite it?",
- "&Yes","&no",
- QString::null, 0, 1)
- )
- {
- statusBar()->message("Save request aborted",messageTimeout);
- return;
- }
- if (f.open(IO_WriteOnly))
- {
- QTextStream t(&f);
- Config::instance()->writeTemplate(t,TRUE,FALSE);
- m_configFileName = fn;
- setConfigSaved(TRUE);
- addRecentFile(fn);
- statusBar()->message("Configuration saved",messageTimeout);
- }
- else
- {
- QMessageBox::warning(0,"Warning",
- "Cannot open file "+fn+" for writing. Nothing saved!","ok");
- }
+ m_outputLog->append(tr("*** Cancelled by user\n"));
}
+ m_outputLog->ensureCursorVisible();
+ m_run->setText(tr("Run doxygen"));
+ m_runStatus->setText(tr("Status: not running"));
+ m_running=false;
+ updateLaunchButtonState();
+ //updateRunnable(m_workingDir->text());
+ m_saveLog->setEnabled(true);
}
-void MainWidget::resetConfig()
+void MainWindow::updateLaunchButtonState()
{
- if (QMessageBox::question(this,"Reset settings to their defaults",
- "Do you wish to reset the "
- "current configuration settings to their factory defaults?",
- QMessageBox::Yes, QMessageBox::No)==QMessageBox::Yes)
- {
- // initialize config settings
- Config::instance()->init();
-#if defined(Q_OS_MACX)
- setDotPath();
- setMscgenPath();
+ m_launchHtml->setEnabled(m_expert->htmlOutputPresent(m_workingDir->text()));
+#if 0
+ m_launchPdf->setEnabled(m_expert->pdfOutputPresent(m_workingDir->text()));
#endif
-
- m_configFileName = "";
- setConfigSaved(FALSE);
- statusBar()->message("Configuration settings reset to their defaults",messageTimeout);
- }
}
-void MainWidget::setConfigSaved(bool enable)
+void MainWindow::showHtmlOutput()
{
- m_configSaved=enable;
- if (m_configSaved)
- {
- m_saveStatus->setText("Status: saved");
- }
- else
- {
- m_saveStatus->setText("Status: <font color=\"red\">not saved</font>");
- }
- updateRunnable(m_workingDir->text());
+ QString indexFile = m_expert->getHtmlOutputIndex(m_workingDir->text());
+ QFileInfo fi(indexFile);
+ QString indexUrl(QString::fromAscii("file://")+fi.absoluteFilePath());
+ QDesktopServices::openUrl(QUrl(indexUrl));
}
-void MainWidget::runDoxygen()
+void MainWindow::saveLog()
{
- if (!m_running)
+ QString fn = QFileDialog::getSaveFileName(this, tr("Save log file"),
+ m_workingDir->text()+
+ QString::fromAscii("/doxygen_log.txt"));
+ if (!fn.isEmpty())
{
- QString doxygenPath;
-#if defined(Q_OS_MACX)
- doxygenPath = getResourcePath();
-#else
- // TODO: get the right value if not in the search path
-#endif
- //printf("Trying to run doxygen from path %s\n",doxygenPath.data());
-
- m_runProcess->setCommunication(QProcess::Stdout|
- QProcess::Stderr|
- QProcess::DupStderr
- );
- m_runProcess->setWorkingDirectory(QDir(m_workingDir->text()));
- m_runProcess->clearArguments();
- m_runProcess->addArgument(doxygenPath+"doxygen");
- m_runProcess->addArgument("-b");
- m_runProcess->addArgument(m_configFileName);
- m_outputLog->clear();
- if (!m_runProcess->start())
+ QFile f(fn);
+ if (f.open(QIODevice::WriteOnly))
{
- m_outputLog->append(QString("*** Failed to run doxygen\n"));
+ QTextStream t(&f);
+ t << m_outputLog->toPlainText();
+ statusBar()->showMessage(tr("Output log saved"),messageTimeout);
}
else
{
- m_running=TRUE;
- m_run->setText("Cancel");
- m_runStatus->setText("Status: running");
- m_timer->start(1000);
+ QMessageBox::warning(0,tr("Warning"),
+ tr("Cannot open file ")+fn+tr(" for writing. Nothing saved!"),tr("ok"));
}
}
- else
- {
- m_running=FALSE;
- m_run->setText("Start");
- m_runStatus->setText("Status: not running");
- m_runProcess->kill();
- m_timer->stop();
- updateRunnable(m_workingDir->text());
- }
}
-void MainWidget::readStdout()
+void MainWindow::showSettings()
{
- m_outputLog->append(QString(m_runProcess->readStdout()));
+ QString text;
+ QTextStream t(&text);
+ m_expert->writeConfig(t,true);
+ m_outputLog->clear();
+ m_outputLog->append(text);
+ m_outputLog->ensureCursorVisible();
+ m_saveLog->setEnabled(true);
}
-void MainWidget::runComplete()
+void MainWindow::configChanged()
{
- if (m_running)
- {
- m_outputLog->append(QString("*** Doxygen has finished\n"));
- }
- else
- {
- m_outputLog->append(QString("*** Cancelled by user\n"));
- }
- m_run->setText("Start");
- m_runStatus->setText("Status: not running");
- m_running=FALSE;
- updateRunnable(m_workingDir->text());
-}
-
-void MainWidget::about()
-{
- QString msg;
- QTextStream t(&msg,IO_WriteOnly);
- t << QString("<qt><center>A tool to configure and run doxygen version ")+versionString+
- " on your source files.</center><p><br>"
- "<center>Written by<br> Dimitri van Heesch<br>&copy; 2000-2008</center><p>"
- "</qt>";
- QMessageBox::about(this,"Doxygen GUI",msg);
+ m_modified = true;
+ updateTitle();
}
-void MainWidget::manual()
+void MainWindow::updateTitle()
{
-#if defined(Q_OS_MACX)
- const char *urlBytes = "http://www.doxygen.org/manual.html";
- CFURLRef url = CFURLCreateWithBytes (
- NULL, // allocator
- (UInt8*)urlBytes, // bytes
- strlen(urlBytes), // length
- kCFStringEncodingASCII, // encoding
- NULL // baseURL
- );
- LSOpenCFURLRef(url,0);
- CFRelease(url);
-#endif
-}
-
-void MainWidget::addRecentFile(const QString &file)
-{
- QStringList::Iterator it = m_recentFiles.find(file);
- if (it!=m_recentFiles.end())
- {
- // already found => move to top
- m_recentFiles.remove(it);
- m_recentFiles.prepend(file);
- }
- else
+ QString title = tr("Doxygen GUI frontend");
+ if (m_modified)
{
- // not found
- if (m_recentFiles.count() < 10) // append
- {
- m_recentFiles.prepend(file);
- }
- else // add + drop last item
- {
- m_recentFiles.remove(m_recentFiles.last());
- m_recentFiles.prepend(file);
- }
+ title+=QString::fromAscii(" +");
}
-
- m_recentMenu->clear();
- int i=0;
- for ( it = m_recentFiles.begin(); it != m_recentFiles.end(); ++it, ++i )
+ if (!m_fileName.isEmpty())
{
- m_recentMenu->insertItem(*it);
- m_settings.writeEntry(QString().sprintf("/doxywizard/recent/config%d",i),*it);
+ title+=QString::fromAscii(" (")+m_fileName+QString::fromAscii(")");
}
+ setWindowTitle(title);
}
-
-void MainWidget::openRecent(int id)
-{
- loadConfigFromFile(m_recentMenu->text(id));
-}
-
-void MainWidget::quit()
-{
- if (!m_configSaved &&
- QMessageBox::warning( this, "DoxyWizard", "Quit and lose changes?",
- QMessageBox::Yes, QMessageBox::No)==QMessageBox::No
- ) return; // Quit cancelled by user
-
- qApp->quit();
-}
-
-void MainWidget::saveLog()
+bool MainWindow::discardUnsavedChanges(bool saveOption)
{
- QString fn = QFileDialog::getSaveFileName(m_workingDir->text()+"/doxygen_log.txt",QString::null,this);
- if (!fn.isEmpty())
+ if (m_modified)
{
- QFile f(fn);
- if (f.open(IO_WriteOnly))
+ QMessageBox::StandardButton button;
+ if (saveOption)
{
- QTextStream t(&f);
- t << m_outputLog->text();
- statusBar()->message("Output log saved",messageTimeout);
+ button = QMessageBox::question(this,
+ tr("Unsaved changes"),
+ tr("Unsaved changes will be lost! Do you want to save the configuration file?"),
+ QMessageBox::Save |
+ QMessageBox::Discard |
+ QMessageBox::Cancel
+ );
+ if (button==QMessageBox::Save)
+ {
+ return saveConfig();
+ }
}
else
{
- QMessageBox::warning(0,"Warning",
- "Cannot open file "+fn+" for writing. Nothing saved!","ok");
+ button = QMessageBox::question(this,
+ tr("Unsaved changes"),
+ tr("Unsaved changes will be lost! Do you want to continue?"),
+ QMessageBox::Discard |
+ QMessageBox::Cancel
+ );
}
+ return button==QMessageBox::Discard;
}
+ return true;
}
-//==========================================================================
+//-----------------------------------------------------------------------
int main(int argc,char **argv)
{
QApplication a(argc,argv);
- MainWidget main;
+ MainWindow &main = MainWindow::instance();
if (argc==2 && argv[1][0]!='-') // name of config file as an argument
{
- main.loadConfigFromFile(argv[1]);
+ main.loadConfigFromFile(QString::fromLocal8Bit(argv[1]));
}
else if (argc>1)
{
printf("Usage: %s [config file]\n",argv[0]);
exit(1);
}
- a.setMainWidget(&main);
main.show();
return a.exec();
}
-
diff --git a/addon/doxywizard/doxywizard.h b/addon/doxywizard/doxywizard.h
index 6e157b1..49e13cc 100644
--- a/addon/doxywizard/doxywizard.h
+++ b/addon/doxywizard/doxywizard.h
@@ -1,288 +1,83 @@
#ifndef DOXYWIZARD_H
#define DOXYWIZARD_H
-#include <qvbox.h>
-#include <qtabdialog.h>
-#include <qmainwindow.h>
-#include <qsettings.h>
-#include <qstringlist.h>
+#include <QMainWindow>
+#include <QSettings>
+#include <QStringList>
+class Expert;
+class Wizard;
+class QLabel;
class QLineEdit;
-class QCheckBox;
class QPushButton;
-class QComboBox;
-class QButtonGroup;
class QTextEdit;
-class QLabel;
+class QMenu;
class QProcess;
class QTimer;
-class QPopupMenu;
-
-enum OptLang { Lang_Cpp, Lang_C, Lang_Java, Lang_CS };
-enum HtmlStyle { HS_Plain, HS_TreeView, HS_CHM };
-enum TexStyle { TS_PDFHyper, TS_PDF, TS_PS };
-enum DiagramMode { DM_None, DM_Builtin, DM_Dot };
-
-class Step1 : public QWidget
-{
- Q_OBJECT
-
- public:
- Step1(QWidget *parent);
-
- QString getProjectName() const;
- QString getProjectNumber() const;
- QString getSourceDir() const;
- bool scanRecursively() const;
- QString getDestinationDir() const;
-
- void setProjectName(const QString &name);
- void setProjectNumber(const QString &num);
- void setSourceDir(const QString &dir);
- void setRecursiveScan(bool enable);
- void setDestinationDir(const QString &dir);
-
- private slots:
- void selectSourceDir();
- void selectDestinationDir();
-
- private:
- QLineEdit *m_projName;
- QLineEdit *m_projNumber;
- QLineEdit *m_sourceDir;
- QLineEdit *m_destDir;
- QCheckBox *m_recursive;
- QPushButton *m_srcSelectDir;
- QPushButton *m_dstSelectDir;
-};
-
-class Step2 : public QWidget
-{
- public:
- Step2(QWidget *parent);
- bool crossReferencingEnabled() const;
- void enableCrossReferencing();
-
- bool extractAll() const;
- bool crossReferencing() const;
- OptLang optimizeFor() const;
-
- void setExtractAll(bool enable);
- void setCrossReferencing(bool enable);
- void setOptimizeFor(OptLang lang);
-
- private:
- QButtonGroup *m_extractMode;
- QButtonGroup *m_optimizeLang;
- QCheckBox *m_crossRef;
-};
-
-class Step3 : public QWidget
-{
- Q_OBJECT
-
- public:
- Step3(QWidget *parent);
-
- bool htmlEnabled() const;
- bool latexEnabled() const;
- bool manEnabled() const;
- bool rtfEnabled() const;
- bool xmlEnabled() const;
- bool searchEnabled() const;
- HtmlStyle htmlStyle() const;
- TexStyle texStyle() const;
-
- void setHtmlEnabled(bool);
- void setLatexEnabled(bool);
- void setManEnabled(bool);
- void setRtfEnabled(bool);
- void setXmlEnabled(bool);
- void setSearchEnabled(bool);
- void setHtmlStyle(HtmlStyle);
- void setTexStyle(TexStyle);
-
-
- private slots:
- void latexStateChange(int state);
- void htmlStateChange(int state);
-
- private:
- QButtonGroup *m_texOptions;
- QVBox *m_texOptionBox;
- QButtonGroup *m_htmlOptions;
- QVBox *m_htmlOptionBox;
- QCheckBox *m_htmlEnabled;
- QCheckBox *m_latexEnabled;
- QCheckBox *m_manEnabled;
- QCheckBox *m_rtfEnabled;
- QCheckBox *m_xmlEnabled;
- QCheckBox *m_searchEnabled;
-};
-
-class Step4 : public QWidget
-{
- Q_OBJECT
-
- public:
- Step4(QWidget *parent);
- //void disableCallGraphs();
- //bool callGraphEnabled() const;
-
- DiagramMode diagramMode() const;
- bool classDiagram() const;
- bool collaborationDiagram() const;
- bool includeGraph() const;
- bool includedByGraph() const;
- bool inheritanceGraph() const;
- bool callGraph() const;
-
- void setDiagramMode(DiagramMode mode);
- void setClassDiagram(bool enable);
- void setCollaborationDiagram(bool enable);
- void setIncludeGraph(bool enable);
- void setIncludedByGraph(bool enable);
- void setInheritanceGraph(bool enable);
- void setCallGraph(bool enable);
-
- private slots:
- void diagramModeChanged(int);
-
- private:
- QButtonGroup *m_diagramMode;
- QVBox *m_dotOptions;
- QCheckBox *m_dotClass;
- QCheckBox *m_dotCollaboration;
- QCheckBox *m_dotInclude;
- QCheckBox *m_dotIncludedBy;
- QCheckBox *m_dotInheritance;
- QCheckBox *m_dotCall;
-};
-class Wizard : public QTabDialog
+class MainWindow : public QMainWindow
{
Q_OBJECT
public:
- Wizard(QWidget *parent);
- //void disableCallGraphs();
-
- // step1
- QString getProjectName() const { return m_step1->getProjectName(); }
- QString getProjectNumber() const { return m_step1->getProjectNumber(); }
- QString getSourceDir() const { return m_step1->getSourceDir(); }
- bool scanRecursively() const { return m_step1->scanRecursively(); }
- QString getDestinationDir() const { return m_step1->getDestinationDir(); }
-
- void setProjectName(const QString &name) { m_step1->setProjectName(name); }
- void setProjectNumber(const QString &num) { m_step1->setProjectNumber(num); }
- void setSourceDir(const QString &dir) { m_step1->setSourceDir(dir); }
- void setRecursiveScan(bool enable) { m_step1->setRecursiveScan(enable); }
- void setDestinationDir(const QString &dir) { m_step1->setDestinationDir(dir); }
-
- // step2
- bool extractAll() const { return m_step2->extractAll(); }
- bool crossReferencing() const { return m_step2->crossReferencing(); }
- OptLang optimizeFor() const { return m_step2->optimizeFor(); }
-
- void setExtractAll(bool enable) { m_step2->setExtractAll(enable); }
- void setCrossReferencing(bool enable) { m_step2->setCrossReferencing(enable); }
- void setOptimizeFor(OptLang lang) { m_step2->setOptimizeFor(lang); }
-
- // step3
- bool htmlEnabled() const { return m_step3->htmlEnabled(); }
- bool latexEnabled() const { return m_step3->latexEnabled(); }
- bool manEnabled() const { return m_step3->manEnabled(); }
- bool rtfEnabled() const { return m_step3->rtfEnabled(); }
- bool xmlEnabled() const { return m_step3->xmlEnabled(); }
- bool searchEnabled() const { return m_step3->searchEnabled(); }
- HtmlStyle htmlStyle() const { return m_step3->htmlStyle(); }
- TexStyle texStyle() const { return m_step3->texStyle(); }
-
- void setHtmlEnabled(bool enable) { m_step3->setHtmlEnabled(enable); }
- void setLatexEnabled(bool enable) { m_step3->setLatexEnabled(enable); }
- void setManEnabled(bool enable) { m_step3->setManEnabled(enable); }
- void setRtfEnabled(bool enable) { m_step3->setRtfEnabled(enable); }
- void setXmlEnabled(bool enable) { m_step3->setXmlEnabled(enable); }
- void setSearchEnabled(bool enable) { m_step3->setSearchEnabled(enable); }
- void setHtmlStyle(HtmlStyle style) { m_step3->setHtmlStyle(style); }
- void setTexStyle(TexStyle style) { m_step3->setTexStyle(style); }
-
- // step4
- DiagramMode diagramMode() const { return m_step4->diagramMode(); }
- bool classDiagram() const { return m_step4->classDiagram(); }
- bool collaborationDiagram() const { return m_step4->collaborationDiagram(); }
- bool includeGraph() const { return m_step4->includeGraph(); }
- bool includedByGraph() const { return m_step4->includedByGraph(); }
- bool inheritanceGraph() const { return m_step4->inheritanceGraph(); }
- bool callGraph() const { return m_step4->callGraph(); }
-
- void setDiagramMode(DiagramMode mode) { m_step4->setDiagramMode(mode); }
- void setClassDiagram(bool enable) { m_step4->setClassDiagram(enable); }
- void setCollaborationDiagram(bool enable) { m_step4->setCollaborationDiagram(enable); }
- void setIncludeGraph(bool enable) { m_step4->setIncludeGraph(enable); }
- void setIncludedByGraph(bool enable) { m_step4->setIncludedByGraph(enable); }
- void setInheritanceGraph(bool enable) { m_step4->setInheritanceGraph(enable); }
- void setCallGraph(bool enable) { m_step4->setCallGraph(enable); }
-
- private:
- Step1 *m_step1;
- Step2 *m_step2;
- Step3 *m_step3;
- Step4 *m_step4;
-};
-
-class MainWidget : public QMainWindow
-{
- Q_OBJECT
- public:
- MainWidget(QWidget *parent=0);
- ~MainWidget();
- void loadConfigFromFile(const QString &);
+ static MainWindow &instance();
+ void loadConfigFromFile(const QString &fileName);
+ void loadSettings();
+ void saveSettings();
+ void closeEvent(QCloseEvent *event);
+ QString configFileName() const { return m_fileName; }
+ void updateTitle();
+
+ public slots:
+ void manual();
+ void about();
+ void openConfig();
+ bool saveConfig();
+ bool saveConfigAs();
+ void makeDefaults();
+ void resetToDefaults();
+ void selectTab(int);
+ void quit();
private slots:
- void launchWizard();
- void launchExpert();
- void loadConfigFile();
+ void openRecent(QAction *action);
void selectWorkingDir();
- void updateRunnable(const QString &newDirName);
- void saveDefaults();
- void saveConfigFile();
+ void updateWorkingDir();
void runDoxygen();
void readStdout();
void runComplete();
- void about();
- void manual();
- void resetConfig();
- void openRecent(int);
- void quit();
+ void showHtmlOutput();
void saveLog();
+ void showSettings();
+ void configChanged();
private:
- void setConfigSaved(bool);
- void addRecentFile(const QString &);
-
- QPushButton *m_wizard;
- QPushButton *m_expert;
- QPushButton *m_load;
- QPushButton *m_save;
- QPushButton *m_defaults;
- QLineEdit *m_workingDir;
+ MainWindow();
+ void saveConfig(const QString &fileName);
+ void addRecentFile(const QString &fileName);
+ void updateConfigFileName(const QString &fileName);
+ void setWorkingDir(const QString &dirName);
+ void updateLaunchButtonState();
+ bool discardUnsavedChanges(bool saveOption=true);
+
+ QLineEdit *m_workingDir;
QPushButton *m_selWorkingDir;
QPushButton *m_run;
QPushButton *m_saveLog;
- QLabel *m_runStatus;
- QProcess *m_runProcess;
- QLabel *m_saveStatus;
- QLabel *m_outputHeading;
- QTextEdit *m_outputLog;
- QTimer *m_timer;
- QSettings m_settings;
- QPopupMenu *m_recentMenu;
- bool m_configSaved;
+ QPushButton *m_launchHtml;
+ QPushButton *m_launchPdf;
+ QTextEdit *m_outputLog;
+ QLabel *m_runStatus;
+ Expert *m_expert;
+ Wizard *m_wizard;
+ QString m_fileName;
+ QSettings m_settings;
+ QMenu *m_recentMenu;
+ QStringList m_recentFiles;
+ QProcess *m_runProcess;
+ QTimer *m_timer;
bool m_running;
- QString m_configFileName;
- QStringList m_recentFiles;
+ bool m_modified;
};
#endif
diff --git a/addon/doxywizard/doxywizard.pro.in b/addon/doxywizard/doxywizard.pro.in
index 5d26a83..2967d29 100644
--- a/addon/doxywizard/doxywizard.pro.in
+++ b/addon/doxywizard/doxywizard.pro.in
@@ -1,64 +1,23 @@
-#
-#
-#
-# Copyright (C) 1997-2008 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
-# for any purpose. It is provided "as is" without express or implied warranty.
-# See the GNU General Public License for more details.
-#
-# project file for the doxywizard project
-
-# special template configuration file because we use flex
-TEMPLATE = doxywizard.t
-
-# executable to generate
-TARGET = ../../bin/doxywizard
-
-# we do not use the debug features in this copy of portable.cpp
-DEFINES = NODEBUG
-
-# configure options
-CONFIG = qt warn_on $extraopts
-
-# header file for the project
-HEADERS = doxywizard.h \
- version.h \
- inputstring.h \
- inputbool.h \
- inputstrlist.h \
- inputint.h \
- expert.h \
- config.h \
- portable.h
-
-# source flle for the project
-SOURCES = doxywizard.cpp \
- version.cpp \
- inputstring.cpp \
- inputbool.cpp \
- inputstrlist.cpp \
- inputint.cpp \
- expert.cpp \
- config.cpp \
- portable.cpp
-
-# where to put the objects
-OBJECTS_DIR = obj
-
-# where to put the intermediate moc stuff
-MOC_DIR = moc
-
-# extra C++ compiler options
-INCLUDEPATH += ../../src
-win32:TMAKE_CXXFLAGS += -DQT_DLL
-win32:INCLUDEPATH += .
-macosx-c++:LIBS+=-framework CoreFoundation -framework ApplicationServices
-
-# extra link options
-win32:TMAKE_LFLAGS = /NODEFAULTLIB:msvcrt.lib doxywizard.res
-win32:TMAKE_LIBS = $(QTDIR)\lib\qtmain.lib $(QTDIR)\lib\qt-mt332.lib user32.lib gdi32.lib comdlg32.lib imm32.lib ole32.lib uuid.lib wsock32.lib
-win32:TMAKE_LIBS_QT =
-
+######################################################################
+# Automatically generated by qmake (2.01a) zo okt 19 12:50:02 2008
+######################################################################
+
+TEMPLATE = app
+DESTDIR = ../../bin
+TARGET =
+DEPENDPATH += .
+INCLUDEPATH += .
+QT += xml
+CONFIG += $extraopts
+OBJECTS_DIR = obj
+MOC_DIR = moc
+RCC_DIR = rcc
+DEFINES += QT_NO_CAST_FROM_ASCII QT_NO_CAST_TO_ASCII
+
+# Input
+HEADERS += doxywizard.h version.h expert.h config.h helplabel.h \
+ inputbool.h inputstring.h inputint.h inputstrlist.h wizard.h
+SOURCES += doxywizard.cpp ../../src/version.cpp expert.cpp wizard.cpp \
+ inputbool.cpp inputstring.cpp inputint.cpp inputstrlist.cpp
+LEXSOURCES += config.l
+RESOURCES += doxywizard.qrc
diff --git a/addon/doxywizard/doxywizard.qrc b/addon/doxywizard/doxywizard.qrc
new file mode 100644
index 0000000..dd23c5d
--- /dev/null
+++ b/addon/doxywizard/doxywizard.qrc
@@ -0,0 +1,10 @@
+<!DOCTYPE RCC><RCC version="1.0">
+<qresource prefix="/">
+ <file alias="config.xml">../../src/config.xml</file>
+ <file>images/add.png</file>
+ <file>images/del.png</file>
+ <file>images/file.png</file>
+ <file>images/folder.png</file>
+ <file>images/refresh.png</file>
+</qresource>
+</RCC>
diff --git a/addon/doxywizard/doxywizard.res b/addon/doxywizard/doxywizard.res
deleted file mode 100755
index 283b8bb..0000000
--- a/addon/doxywizard/doxywizard.res
+++ /dev/null
Binary files differ
diff --git a/addon/doxywizard/doxywizard.t b/addon/doxywizard/doxywizard.t
deleted file mode 100644
index f094b7d..0000000
--- a/addon/doxywizard/doxywizard.t
+++ /dev/null
@@ -1,45 +0,0 @@
-#
-#
-#
-# Copyright (C) 1997-2008 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
-# for any purpose. It is provided "as is" without express or implied warranty.
-# See the GNU General Public License for more details.
-#!
-#! wizard.t: This is a custom template for building doxywizard
-#!
-#$ IncludeTemplate("app.t");
-
-LEX = flex
-YACC = bison
-
-#${
-sub GenerateDep {
- my($obj,$src,$dep) = @_;
- my(@objv,$srcv,$i,$s,$o,$d,$c);
- @objv = split(/\s+/,$obj);
- @srcv = split(/\s+/,$src);
- for $i ( 0..$#objv ) {
- $s = $srcv[$i];
- $o = $objv[$i];
- next if $s eq "";
- $text .= $o . ": " . $s;
- $text .= " ${linebreak}\n\t\t" . $dep if $dep ne "";
- if ( $moc_output{$s} ne "" ) {
- $text .= " ${linebreak}\n\t\t" . $moc_output{$s};
- }
- $d = &make_depend($s);
- $text .= " ${linebreak}\n\t\t" . $d if $d ne "";
- $text .= "\n";
- }
- chop $text;
-}
-#$}
-
-####################
-
-#$ GenerateDep("config.cpp","config.l");
- $(LEX) -PconfigYY -t config.l >config.cpp
diff --git a/addon/doxywizard/expert.cpp b/addon/doxywizard/expert.cpp
index ce0760e..1e0adb1 100644
--- a/addon/doxywizard/expert.cpp
+++ b/addon/doxywizard/expert.cpp
@@ -1,276 +1,553 @@
-/******************************************************************************
- *
- *
- *
- * Copyright (C) 1997-2008 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
- * for any purpose. It is provided "as is" without express or implied warranty.
- * See the GNU General Public License for more details.
- *
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <qmainwindow.h>
-#include <qpopupmenu.h>
-#include <qfileinfo.h>
-#include <qmenubar.h>
-#include <qstatusbar.h>
-#include <qfiledialog.h>
-#include <qmessagebox.h>
-#include <qapplication.h>
-#include <qwhatsthis.h>
-#include <qlayout.h>
-#include <qtabwidget.h>
-#include <qtoolbar.h>
-#include <qtoolbutton.h>
-#include <qscrollview.h>
-#include <qlayout.h>
-#include <qtooltip.h>
-
#include "expert.h"
#include "inputbool.h"
#include "inputstring.h"
-#include "inputstrlist.h"
#include "inputint.h"
+#include "inputstring.h"
+#include "inputstrlist.h"
+#include <QtGui>
+#include <QtXml>
#include "config.h"
#include "version.h"
-//-------------------------------------------------------------------------
+#undef SA
+#define SA(x) QString::fromAscii(x)
+
+static QString convertToComment(const QString &s)
+{
+ if (s.isEmpty())
+ {
+ return QString();
+ }
+ else
+ {
+ return SA("# ")+
+ s.trimmed().replace(SA("\n"),SA("\n# "))+
+ SA("\n");
+ }
+}
+
+//------------------------------------------------------------------------------------
-Expert::Expert( QWidget *parent ) : QTabDialog( parent )
+Expert::Expert()
{
+ m_treeWidget = new QTreeWidget;
+ m_treeWidget->setColumnCount(1);
+ m_topicStack = new QStackedWidget;
- m_dependencies = new QDict< QList<IInput> >(257);
- m_dependencies->setAutoDelete(TRUE);
- m_inputWidgets = new QDict< IInput >;
- m_switches = new QDict< QObject >;
- m_changed = FALSE;
-
- setHelpButton();
-
- QListIterator<ConfigOption> options = Config::instance()->iterator();
- QVBoxLayout *pageLayout = 0;
- QFrame *page = 0;
- ConfigOption *option = 0;
- for (options.toFirst();(option=options.current());++options)
+ QFile file(SA(":/config.xml"));
+ QString err;
+ int errLine,errCol;
+ QDomDocument configXml;
+ if (file.open(QIODevice::ReadOnly))
{
- switch(option->kind())
+ if (!configXml.setContent(&file,false,&err,&errLine,&errCol))
{
- case ConfigOption::O_Info:
- {
- if (pageLayout) pageLayout->addStretch(1);
- QScrollView *view = new QScrollView(this);
- view->setVScrollBarMode(QScrollView::Auto);
- view->setHScrollBarMode(QScrollView::AlwaysOff);
- view->setResizePolicy(QScrollView::AutoOneFit);
- page = new QFrame( view->viewport(), option->name() );
- pageLayout = new QVBoxLayout(page);
- pageLayout->setMargin(10);
- view->addChild(page);
- addTab(view,option->name());
- QWhatsThis::add(page, option->docs().simplifyWhiteSpace() );
- QToolTip::add(page, option->docs() );
- }
- break;
- case ConfigOption::O_String:
- {
- ASSERT(page!=0);
- InputString::StringMode sm=InputString::StringFree;
- switch(((ConfigString *)option)->widgetType())
- {
- case ConfigString::String: sm=InputString::StringFree; break;
- case ConfigString::File: sm=InputString::StringFile; break;
- case ConfigString::Dir: sm=InputString::StringDir; break;
- }
- InputString *inputString = new InputString(
- option->name(), // name
- page, // widget
- *((ConfigString *)option)->valueRef(), // variable
- sm // type
- );
- pageLayout->addWidget(inputString);
- QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
- QToolTip::add(inputString,option->docs());
- connect(inputString,SIGNAL(changed()),SLOT(changed()));
- m_inputWidgets->insert(option->name(),inputString);
- addDependency(m_switches,option->dependsOn(),option->name());
- }
- break;
- case ConfigOption::O_Enum:
- {
- ASSERT(page!=0);
- InputString *inputString = new InputString(
- option->name(), // name
- page, // widget
- *((ConfigEnum *)option)->valueRef(), // variable
- InputString::StringFixed // type
- );
- pageLayout->addWidget(inputString);
- QStrListIterator sli=((ConfigEnum *)option)->iterator();
- for (sli.toFirst();sli.current();++sli)
- {
- inputString->addValue(sli.current());
- }
- inputString->init();
- QWhatsThis::add(inputString, option->docs().simplifyWhiteSpace() );
- QToolTip::add(inputString, option->docs());
- connect(inputString,SIGNAL(changed()),SLOT(changed()));
- m_inputWidgets->insert(option->name(),inputString);
- addDependency(m_switches,option->dependsOn(),option->name());
- }
- break;
- case ConfigOption::O_List:
- {
- ASSERT(page!=0);
- InputStrList::ListMode lm=InputStrList::ListString;
- switch(((ConfigList *)option)->widgetType())
- {
- case ConfigList::String: lm=InputStrList::ListString; break;
- case ConfigList::File: lm=InputStrList::ListFile; break;
- case ConfigList::Dir: lm=InputStrList::ListDir; break;
- case ConfigList::FileAndDir: lm=InputStrList::ListFileDir; break;
- }
- InputStrList *inputStrList = new InputStrList(
- option->name(), // name
- page, // widget
- *((ConfigList *)option)->valueRef(), // variable
- lm // type
- );
- pageLayout->addWidget(inputStrList);
- QWhatsThis::add(inputStrList, option->docs().simplifyWhiteSpace() );
- QToolTip::add(inputStrList, option->docs());
- connect(inputStrList,SIGNAL(changed()),SLOT(changed()));
- m_inputWidgets->insert(option->name(),inputStrList);
- addDependency(m_switches,option->dependsOn(),option->name());
- }
- break;
- break;
- case ConfigOption::O_Bool:
- {
- ASSERT(page!=0);
- InputBool *inputBool = new InputBool(
- option->name(), // name
- page, // widget
- *((ConfigBool *)option)->valueRef() // variable
- );
- pageLayout->addWidget(inputBool);
- QWhatsThis::add(inputBool, option->docs().simplifyWhiteSpace() );
- QToolTip::add(inputBool, option->docs() );
- connect(inputBool,SIGNAL(changed()),SLOT(changed()));
- m_inputWidgets->insert(option->name(),inputBool);
- addDependency(m_switches,option->dependsOn(),option->name());
- }
- break;
- case ConfigOption::O_Int:
- {
- ASSERT(page!=0);
- InputInt *inputInt = new InputInt(
- option->name(), // name
- page, // widget
- *((ConfigInt *)option)->valueRef(), // variable
- ((ConfigInt *)option)->minVal(), // min value
- ((ConfigInt *)option)->maxVal() // max value
- );
- pageLayout->addWidget(inputInt);
- QWhatsThis::add(inputInt, option->docs().simplifyWhiteSpace() );
- QToolTip::add(inputInt, option->docs() );
- connect(inputInt,SIGNAL(changed()),SLOT(changed()));
- m_inputWidgets->insert(option->name(),inputInt);
- addDependency(m_switches,option->dependsOn(),option->name());
- }
- break;
- case ConfigOption::O_Obsolete:
- break;
- }
+ QString msg = tr("Error parsing internal config.xml at line %1 column %2.\n%3").
+ arg(errLine).arg(errCol).arg(err);
+ QMessageBox::warning(this, tr("Error"), msg);
+ exit(1);
+ }
}
- if (pageLayout) pageLayout->addStretch(1);
+ m_rootElement = configXml.documentElement();
+
+ createTopics(m_rootElement);
+ m_helper = new QTextEdit;
+ m_helper->setReadOnly(true);
+ m_splitter = new QSplitter(Qt::Vertical);
+ m_splitter->addWidget(m_treeWidget);
+ m_splitter->addWidget(m_helper);
+
+ QWidget *rightSide = new QWidget;
+ QGridLayout *grid = new QGridLayout(rightSide);
+ m_prev = new QPushButton(tr("Previous"));
+ m_prev->setEnabled(false);
+ m_next = new QPushButton(tr("Next"));
+ grid->addWidget(m_topicStack,0,0,1,2);
+ grid->addWidget(m_prev,1,0,Qt::AlignLeft);
+ grid->addWidget(m_next,1,1,Qt::AlignRight);
+ grid->setColumnStretch(0,1);
+ grid->setRowStretch(0,1);
+
+ addWidget(m_splitter);
+ addWidget(rightSide);
+ connect(m_next,SIGNAL(clicked()),SLOT(nextTopic()));
- QDictIterator<QObject> di(*m_switches);
- QObject *obj = 0;
- for (di.toFirst();(obj=di.current());++di)
+ connect(m_prev,SIGNAL(clicked()),SLOT(prevTopic()));
+}
+
+Expert::~Expert()
+{
+ QHashIterator<QString,Input*> i(m_options);
+ while (i.hasNext())
{
- connect(obj,SIGNAL(toggle(const char *,bool)),SLOT(toggle(const char *,bool)));
- // UGLY HACK: assumes each item depends on a boolean without checking!
- emit toggle(di.currentKey(),((InputBool *)obj)->getState());
+ i.next();
+ delete i.value();
}
+}
- connect(this,SIGNAL(helpButtonPressed()),this,SLOT(handleHelp()));
-
+void Expert::createTopics(const QDomElement &rootElem)
+{
+ QList<QTreeWidgetItem*> items;
+ QDomElement childElem = rootElem.firstChildElement();
+ while (!childElem.isNull())
+ {
+ if (childElem.tagName()==SA("group"))
+ {
+ QString name = childElem.attribute(SA("name"));
+ items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(name)));
+ QWidget *widget = createTopicWidget(childElem);
+ m_topics[name] = widget;
+ m_topicStack->addWidget(widget);
+ }
+ childElem = childElem.nextSiblingElement();
+ }
+ m_treeWidget->setHeaderLabels(QStringList() << SA("Topics"));
+ m_treeWidget->insertTopLevelItems(0,items);
+ connect(m_treeWidget,
+ SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),
+ this,
+ SLOT(activateTopic(QTreeWidgetItem *,QTreeWidgetItem *)));
}
-Expert::~Expert()
+
+QWidget *Expert::createTopicWidget(QDomElement &elem)
+{
+ QScrollArea *area = new QScrollArea;
+ QWidget *topic = new QWidget;
+ QGridLayout *layout = new QGridLayout(topic);
+ QDomElement child = elem.firstChildElement();
+ int row=0;
+ while (!child.isNull())
+ {
+ QString type = child.attribute(SA("type"));
+ if (type==SA("bool"))
+ {
+ InputBool *boolOption =
+ new InputBool(
+ layout,row,
+ child.attribute(SA("id")),
+ child.attribute(SA("defval"))==SA("1"),
+ child.attribute(SA("docs"))
+ );
+ m_options.insert(
+ child.attribute(SA("id")),
+ boolOption
+ );
+ connect(boolOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
+ connect(boolOption,SIGNAL(changed()),SIGNAL(changed()));
+ }
+ else if (type==SA("string"))
+ {
+ InputString::StringMode mode;
+ QString format = child.attribute(SA("format"));
+ if (format==SA("dir"))
+ {
+ mode = InputString::StringDir;
+ }
+ else if (format==SA("file"))
+ {
+ mode = InputString::StringFile;
+ }
+ else // format=="string"
+ {
+ mode = InputString::StringFree;
+ }
+ InputString *stringOption =
+ new InputString(
+ layout,row,
+ child.attribute(SA("id")),
+ child.attribute(SA("defval")),
+ mode,
+ child.attribute(SA("docs"))
+ );
+ m_options.insert(
+ child.attribute(SA("id")),
+ stringOption
+ );
+ connect(stringOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
+ connect(stringOption,SIGNAL(changed()),SIGNAL(changed()));
+ }
+ else if (type==SA("enum"))
+ {
+ InputString *enumList = new InputString(
+ layout,row,
+ child.attribute(SA("id")),
+ child.attribute(SA("defval")),
+ InputString::StringFixed,
+ child.attribute(SA("docs"))
+ );
+ QDomElement enumVal = child.firstChildElement();
+ while (!enumVal.isNull())
+ {
+ enumList->addValue(enumVal.attribute(SA("name")));
+ enumVal = enumVal.nextSiblingElement();
+ }
+ enumList->setDefault();
+
+ m_options.insert(child.attribute(SA("id")),enumList);
+ connect(enumList,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
+ connect(enumList,SIGNAL(changed()),SIGNAL(changed()));
+ }
+ else if (type==SA("int"))
+ {
+ InputInt *intOption =
+ new InputInt(
+ layout,row,
+ child.attribute(SA("id")),
+ child.attribute(SA("defval")).toInt(),
+ child.attribute(SA("minval")).toInt(),
+ child.attribute(SA("maxval")).toInt(),
+ child.attribute(SA("docs"))
+ );
+ m_options.insert(
+ child.attribute(SA("id")),
+ intOption
+ );
+ connect(intOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
+ connect(intOption,SIGNAL(changed()),SIGNAL(changed()));
+ }
+ else if (type==SA("list"))
+ {
+ InputStrList::ListMode mode;
+ QString format = child.attribute(SA("format"));
+ if (format==SA("dir"))
+ {
+ mode = InputStrList::ListDir;
+ }
+ else if (format==SA("file"))
+ {
+ mode = InputStrList::ListFile;
+ }
+ else if (format==SA("filedir"))
+ {
+ mode = InputStrList::ListFileDir;
+ }
+ else // format=="string"
+ {
+ mode = InputStrList::ListString;
+ }
+ QStringList sl;
+ QDomElement listVal = child.firstChildElement();
+ while (!listVal.isNull())
+ {
+ sl.append(listVal.attribute(SA("name")));
+ listVal = listVal.nextSiblingElement();
+ }
+ InputStrList *listOption =
+ new InputStrList(
+ layout,row,
+ child.attribute(SA("id")),
+ sl,
+ mode,
+ child.attribute(SA("docs"))
+ );
+ m_options.insert(
+ child.attribute(SA("id")),
+ listOption
+ );
+ connect(listOption,SIGNAL(showHelp(Input*)),SLOT(showHelp(Input*)));
+ connect(listOption,SIGNAL(changed()),SIGNAL(changed()));
+ }
+ else if (type==SA("obsolete"))
+ {
+ // ignore
+ }
+ else // should not happen
+ {
+ printf("Unsupported type %s\n",qPrintable(child.attribute(SA("type"))));
+ }
+ child = child.nextSiblingElement();
+ }
+
+ // compute dependencies between options
+ child = elem.firstChildElement();
+ while (!child.isNull())
+ {
+ QString dependsOn = child.attribute(SA("depends"));
+ QString id = child.attribute(SA("id"));
+ if (!dependsOn.isEmpty())
+ {
+ Input *parentOption = m_options[dependsOn];
+ Input *thisOption = m_options[id];
+ Q_ASSERT(parentOption);
+ Q_ASSERT(thisOption);
+ if (parentOption && thisOption)
+ {
+ //printf("Adding dependency '%s' (%p)->'%s' (%p)\n",
+ // qPrintable(dependsOn),parentOption,
+ // qPrintable(id),thisOption);
+ parentOption->addDependency(thisOption);
+ }
+ }
+ child = child.nextSiblingElement();
+ }
+
+ // set initial dependencies
+ QHashIterator<QString,Input*> i(m_options);
+ while (i.hasNext())
+ {
+ i.next();
+ if (i.value())
+ {
+ i.value()->updateDependencies();
+ }
+ }
+
+ layout->setRowStretch(row,1);
+ layout->setColumnStretch(1,2);
+ layout->setSpacing(5);
+ topic->setLayout(layout);
+ area->setWidget(topic);
+ area->setWidgetResizable(true);
+ return area;
+}
+
+void Expert::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *)
+{
+ if (item)
+ {
+ QWidget *w = m_topics[item->text(0)];
+ m_topicStack->setCurrentWidget(w);
+ m_prev->setEnabled(m_topicStack->currentIndex()!=0);
+ m_next->setEnabled(m_topicStack->currentIndex()!=m_topicStack->count()-1);
+ }
+}
+
+void Expert::loadSettings(QSettings *s)
+{
+ QHashIterator<QString,Input*> i(m_options);
+ while (i.hasNext())
+ {
+ i.next();
+ QVariant var = s->value(SA("config/")+i.key());
+ //printf("Loading key %s: type=%d\n",qPrintable(i.key()),var.type());
+ if (i.value())
+ {
+ i.value()->value() = var;
+ i.value()->update();
+ }
+ }
+}
+
+void Expert::saveSettings(QSettings *s)
{
- delete m_dependencies;
- delete m_inputWidgets;
- delete m_switches;
+ QHashIterator<QString,Input*> i(m_options);
+ while (i.hasNext())
+ {
+ i.next();
+ if (i.value())
+ {
+ s->value(SA("config/")+i.key(),i.value()->value());
+ }
+ }
}
-void Expert::handleHelp()
+void Expert::loadConfig(const QString &fileName)
{
- QWhatsThis::enterWhatsThisMode();
+ //printf("Expert::loadConfig(%s)\n",qPrintable(fileName));
+ parseConfig(fileName,m_options);
}
-void Expert::addDependency(QDict<QObject> *switches,
- const QCString &dep,const QCString &name)
+void Expert::saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,
+ bool brief)
{
- if (!dep.isEmpty())
+ // write group header
+ t << endl;
+ t << "#---------------------------------------------------------------------------" << endl;
+ t << "# " << elem.attribute(SA("docs")) << endl;
+ t << "#---------------------------------------------------------------------------" << endl;
+
+ // write options...
+ QDomElement childElem = elem.firstChildElement();
+ while (!childElem.isNull())
{
- //printf("Expert::addDependency(%s)\n",name.data());
- IInput *parent = m_inputWidgets->find(dep);
- ASSERT(parent!=0);
- IInput *child = m_inputWidgets->find(name);
- ASSERT(child!=0);
- if (switches->find(dep)==0)
+ QString type = childElem.attribute(SA("type"));
+ QString name = childElem.attribute(SA("id"));
+ QHash<QString,Input*>::const_iterator i = m_options.find(name);
+ if (i!=m_options.end())
{
- switches->insert(dep,parent->qobject());
+ Input *option = i.value();
+ if (!brief)
+ {
+ t << endl;
+ t << convertToComment(childElem.attribute(SA("docs")));
+ t << endl;
+ }
+ t << name.leftJustified(23) << "= ";
+ if (option)
+ {
+ option->writeValue(t,codec);
+ }
+ t << endl;
}
- QList<IInput> *list = m_dependencies->find(dep);
- if (list==0)
+ childElem = childElem.nextSiblingElement();
+ }
+
+}
+
+bool Expert::writeConfig(QTextStream &t,bool brief)
+{
+ if (!brief)
+ {
+ // write global header
+ t << "# Doxyfile " << versionString << endl << endl; // TODO: add version
+ t << "# This file describes the settings to be used by the documentation system\n";
+ t << "# doxygen (www.doxygen.org) for a project\n";
+ t << "#\n";
+ t << "# All text after a hash (#) is considered a comment and will be ignored\n";
+ t << "# The format is:\n";
+ t << "# TAG = value [value, ...]\n";
+ t << "# For lists items can also be appended using:\n";
+ t << "# TAG += value [value, ...]\n";
+ t << "# Values that contain spaces should be placed between quotes (\" \")\n";
+ }
+
+ QTextCodec *codec = 0;
+ Input *option = m_options[QString::fromAscii("DOXYFILE_ENCODING")];
+ if (option)
+ {
+ codec = QTextCodec::codecForName(option->value().toString().toAscii());
+ if (codec==0) // fallback: use UTF-8
{
- list = new QList<IInput>;
- m_dependencies->insert(dep,list);
+ codec = QTextCodec::codecForName("UTF-8");
}
- list->append(child);
}
+ QDomElement childElem = m_rootElement.firstChildElement();
+ while (!childElem.isNull())
+ {
+ saveTopic(t,childElem,codec,brief);
+ childElem = childElem.nextSiblingElement();
+ }
+ return true;
}
-void Expert::toggle(const char *name,bool state)
+QByteArray Expert::saveInnerState () const
{
- QList<IInput> *inputs = m_dependencies->find(name);
- ASSERT(inputs!=0);
- IInput *input = inputs->first();
- while (input)
+ return m_splitter->saveState();
+}
+
+bool Expert::restoreInnerState ( const QByteArray & state )
+{
+ return m_splitter->restoreState(state);
+}
+
+void Expert::showHelp(Input *option)
+{
+ m_helper->setText(
+ QString::fromAscii("<qt><b>")+option->id()+
+ QString::fromAscii("</b><br>")+
+ option->docs().
+ replace(QChar::fromAscii('\n'),QChar::fromAscii(' '))+
+ QString::fromAscii("<qt>")
+ );
+}
+
+void Expert::nextTopic()
+{
+ m_topicStack->setCurrentIndex(m_topicStack->currentIndex()+1);
+ m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);
+ m_prev->setEnabled(m_topicStack->currentIndex()!=0);
+ m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));
+}
+
+void Expert::prevTopic()
+{
+ m_topicStack->setCurrentIndex(m_topicStack->currentIndex()-1);
+ m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);
+ m_prev->setEnabled(m_topicStack->currentIndex()!=0);
+ m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));
+}
+
+void Expert::resetToDefaults()
+{
+ //printf("Expert::makeDefaults()\n");
+ QHashIterator<QString,Input*> i(m_options);
+ while (i.hasNext())
{
- input->setEnabled(state);
- input = inputs->next();
+ i.next();
+ if (i.value())
+ {
+ i.value()->reset();
+ }
}
}
-void Expert::init()
+static bool stringVariantToBool(const QVariant &v)
+{
+ QString s = v.toString().toLower();
+ return s==QString::fromAscii("yes") || s==QString::fromAscii("true") || s==QString::fromAscii("1");
+}
+
+static bool getBoolOption(
+ const QHash<QString,Input*>&model,const QString &name)
+{
+ Input *option = model[name];
+ Q_ASSERT(option!=0);
+ return stringVariantToBool(option->value());
+}
+
+static QString getStringOption(
+ const QHash<QString,Input*>&model,const QString &name)
+{
+ Input *option = model[name];
+ Q_ASSERT(option!=0);
+ return option->value().toString();
+}
+
+
+bool Expert::htmlOutputPresent(const QString &workingDir) const
+{
+ bool generateHtml = getBoolOption(m_options,QString::fromAscii("GENERATE_HTML"));
+ if (!generateHtml) return false;
+ QString indexFile = getHtmlOutputIndex(workingDir);
+ QFileInfo fi(indexFile);
+ return fi.exists() && fi.isFile();
+}
+
+QString Expert::getHtmlOutputIndex(const QString &workingDir) const
{
- QDictIterator<IInput> di(*m_inputWidgets);
- IInput *input = 0;
- for (di.toFirst();(input=di.current());++di)
+ QString outputDir = getStringOption(m_options,QString::fromAscii("OUTPUT_DIRECTORY"));
+ QString htmlOutputDir = getStringOption(m_options,QString::fromAscii("HTML_OUTPUT"));
+ //printf("outputDir=%s\n",qPrintable(outputDir));
+ //printf("htmlOutputDir=%s\n",qPrintable(htmlOutputDir));
+ QString indexFile = workingDir;
+ if (QFileInfo(outputDir).isAbsolute()) // override
{
- input->init();
+ indexFile = outputDir;
}
- QDictIterator<QObject> dio(*m_switches);
- QObject *obj = 0;
- for (dio.toFirst();(obj=dio.current());++dio)
+ else // append
+ {
+ indexFile += QString::fromAscii("/")+outputDir;
+ }
+ if (QFileInfo(htmlOutputDir).isAbsolute()) // override
+ {
+ indexFile = htmlOutputDir;
+ }
+ else // append
{
- connect(obj,SIGNAL(toggle(const char *,bool)),SLOT(toggle(const char *,bool)));
- // UGLY HACK: assumes each item depends on a boolean without checking!
- emit toggle(dio.currentKey(),((InputBool *)obj)->getState());
+ indexFile += QString::fromAscii("/")+htmlOutputDir;
}
-
+ indexFile+=QString::fromAscii("/index.html");
+ return indexFile;
}
-void Expert::changed()
+bool Expert::pdfOutputPresent(const QString &workingDir) const
{
- m_changed=TRUE;
+ bool generateLatex = getBoolOption(m_options,QString::fromAscii("GENERATE_LATEX"));
+ bool pdfLatex = getBoolOption(m_options,QString::fromAscii("USE_PDFLATEX"));
+ if (!generateLatex || !pdfLatex) return false;
+ QString latexOutput = getStringOption(m_options,QString::fromAscii("LATEX_OUTPUT"));
+ QString indexFile;
+ if (QFileInfo(latexOutput).isAbsolute())
+ {
+ indexFile = latexOutput+QString::fromAscii("/refman.pdf");
+ }
+ else
+ {
+ indexFile = workingDir+QString::fromAscii("/")+
+ latexOutput+QString::fromAscii("/refman.pdf");
+ }
+ QFileInfo fi(indexFile);
+ return fi.exists() && fi.isFile();
}
diff --git a/addon/doxywizard/expert.h b/addon/doxywizard/expert.h
index 7c92b4c..3372ae6 100644
--- a/addon/doxywizard/expert.h
+++ b/addon/doxywizard/expert.h
@@ -1,82 +1,64 @@
-/******************************************************************************
- *
- *
- *
- * Copyright (C) 1997-2008 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
- * for any purpose. It is provided "as is" without express or implied warranty.
- * See the GNU General Public License for more details.
- *
- */
-
#ifndef EXPERT_H
#define EXPERT_H
-#include <qtabdialog.h>
-#include <qlist.h>
-#include <qdict.h>
-
-class IInput;
-class QWidget;
-class QObject;
-class InputBool;
-class InputString;
-class InputStrList;
-class InputFile;
-class InputDir;
-class InputInt;
+#include <QSplitter>
+#include <QDomElement>
+#include <QHash>
-class ConfigWidget
-{
- public:
- enum Kind { Int, String, StrList, Bool };
-
- ConfigWidget(QWidget *w,Kind k) : m_widget(w), m_kind(k) {}
-
- Kind kind() const { return m_kind; }
-
- InputString *getString() const
- { return m_kind==String ? (InputString *)m_widget : 0; }
-
- InputBool *getBool() const
- { return m_kind==Bool ? (InputBool *)m_widget : 0; }
-
- InputStrList *getStrList() const
- { return m_kind==StrList ? (InputStrList *)m_widget : 0; }
-
- InputInt *getInt() const
- { return m_kind==Int ? (InputInt *)m_widget : 0; }
-
- private:
- QWidget *m_widget;
- Kind m_kind;
-};
+class QTreeWidget;
+class QTreeWidgetItem;
+class QStackedWidget;
+class QSettings;
+class QTextEdit;
+class QTextCodec;
+class QPushButton;
+class Input;
-class Expert : public QTabDialog
+class Expert : public QSplitter
{
- Q_OBJECT
+ Q_OBJECT
public:
- Expert(QWidget *parent=0);
- ~Expert();
- void init();
- void addDependency(QDict<QObject> *switches,
- const QCString &dep,const QCString &name);
- bool hasChanged() const { return m_changed; }
+ Expert();
+ ~Expert();
+ void loadSettings(QSettings *);
+ void saveSettings(QSettings *);
+ void loadConfig(const QString &fileName);
+ bool writeConfig(QTextStream &t,bool brief);
+ QByteArray saveInnerState () const;
+ bool restoreInnerState ( const QByteArray & state );
+ const QHash<QString,Input*> &modelData() const { return m_options; }
+ void resetToDefaults();
+ bool htmlOutputPresent(const QString &workingDir) const;
+ bool pdfOutputPresent(const QString &workingDir) const;
+ QString getHtmlOutputIndex(const QString &workingDir) const;
+
+ public slots:
+ void activateTopic(QTreeWidgetItem *,QTreeWidgetItem *);
+ QWidget *createTopicWidget(QDomElement &elem);
private slots:
- void toggle(const char *,bool);
- void handleHelp();
+ void showHelp(Input *);
+ void nextTopic();
+ void prevTopic();
+
+ signals:
void changed();
private:
- QDict<IInput> *m_inputWidgets;
- QDict< QList<IInput> > *m_dependencies;
- QDict<QObject> *m_switches;
- bool m_changed;
+ void createTopics(const QDomElement &);
+ void saveTopic(QTextStream &t,QDomElement &elem,QTextCodec *codec,bool brief);
+
+ QSplitter *m_splitter;
+ QTextEdit *m_helper;
+ QTreeWidget *m_treeWidget;
+ QStackedWidget *m_topicStack;
+ QHash<QString,QWidget *> m_topics;
+ QHash<QString,QObject *> m_optionWidgets;
+ QHash<QString,Input *> m_options;
+ QPushButton *m_next;
+ QPushButton *m_prev;
+ QDomElement m_rootElement;
};
#endif
diff --git a/addon/doxywizard/helplabel.h b/addon/doxywizard/helplabel.h
new file mode 100644
index 0000000..07e2932
--- /dev/null
+++ b/addon/doxywizard/helplabel.h
@@ -0,0 +1,33 @@
+#ifndef HELPLABEL_H
+#define HELPLABEL_H
+
+#include <QLabel>
+#include <QMenu>
+
+class HelpLabel : public QLabel
+{
+ Q_OBJECT
+ public:
+ HelpLabel(const QString &text) : QLabel(text)
+ { setContextMenuPolicy(Qt::CustomContextMenu);
+ connect(this,SIGNAL(customContextMenuRequested(const QPoint&)),
+ this,SLOT(showMenu(const QPoint&)));
+ }
+ signals:
+ void enter();
+ void reset();
+ private slots:
+ void showMenu(const QPoint &p)
+ {
+ QMenu menu(this);
+ QAction *a = menu.addAction(tr("Reset to default"));
+ if (menu.exec(mapToGlobal(p))==a)
+ {
+ reset();
+ }
+ }
+ protected:
+ void enterEvent( QEvent * event ) { enter(); QLabel::enterEvent(event); }
+};
+
+#endif
diff --git a/addon/doxywizard/images/add.png b/addon/doxywizard/images/add.png
new file mode 100644
index 0000000..30a7090
--- /dev/null
+++ b/addon/doxywizard/images/add.png
Binary files differ
diff --git a/addon/doxywizard/images/del.png b/addon/doxywizard/images/del.png
new file mode 100644
index 0000000..ceb6a60
--- /dev/null
+++ b/addon/doxywizard/images/del.png
Binary files differ
diff --git a/addon/doxywizard/images/file.png b/addon/doxywizard/images/file.png
new file mode 100644
index 0000000..e204f67
--- /dev/null
+++ b/addon/doxywizard/images/file.png
Binary files differ
diff --git a/addon/doxywizard/images/folder.png b/addon/doxywizard/images/folder.png
new file mode 100644
index 0000000..2e420e0
--- /dev/null
+++ b/addon/doxywizard/images/folder.png
Binary files differ
diff --git a/addon/doxywizard/images/refresh.png b/addon/doxywizard/images/refresh.png
new file mode 100644
index 0000000..fd6d565
--- /dev/null
+++ b/addon/doxywizard/images/refresh.png
Binary files differ
diff --git a/addon/doxywizard/input.h b/addon/doxywizard/input.h
index 9f23e17..dd1773c 100644
--- a/addon/doxywizard/input.h
+++ b/addon/doxywizard/input.h
@@ -1,15 +1,34 @@
-#ifndef _INPUT_H
-#define _INPUT_H
+#ifndef INPUT_H
+#define INPUT_H
-class QObject;
+#include <QVariant>
-class IInput
+class QTextStream;
+class QTextCodec;
+
+class Input
{
public:
- virtual ~IInput() {}
- virtual void init() = 0;
+ enum Kind
+ {
+ Bool,
+ Int,
+ String,
+ StrList,
+ Obsolete
+ };
+ virtual ~Input() {}
+ virtual QVariant &value() = 0;
+ virtual void update() = 0;
+ virtual Kind kind() const = 0;
+ virtual QString docs() const = 0;
+ virtual QString id() const = 0;
+ virtual void addDependency(Input *option) = 0;
virtual void setEnabled(bool) = 0;
- virtual QObject *qobject() = 0;
+ virtual void updateDependencies() = 0;
+ virtual void reset() = 0;
+ virtual void writeValue(QTextStream &t,QTextCodec *codec) = 0;
};
+
#endif
diff --git a/addon/doxywizard/inputbool.cpp b/addon/doxywizard/inputbool.cpp
index fef7b9d..8dbedb1 100644
--- a/addon/doxywizard/inputbool.cpp
+++ b/addon/doxywizard/inputbool.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -13,47 +13,98 @@
*/
#include "inputbool.h"
-//#if QT_VERSION >= 300
-//#include <qstylefactory.h>
-//#else
-//#include <qwindowsstyle.h>
-//#endif
-#include <qlayout.h>
+#include "helplabel.h"
+#include <QtGui>
-InputBool::InputBool( const QString & text, QWidget * parent, bool &flag )
- : QWidget(parent), state(flag)
+InputBool::InputBool( QGridLayout *layout, int &row,
+ const QString &id, bool checked,
+ const QString &docs )
+ : m_default(checked), m_docs(docs), m_id(id)
{
- QBoxLayout *layout = new QHBoxLayout(this);
- cb = new QCheckBox(text,this);
- layout->addWidget(cb);
- layout->addStretch(10);
-
-//#if QT_VERSION >= 300
-// QStyle *winStyle = QStyleFactory::create("windows");
-//#else
-// QWindowsStyle *winStyle = new QWindowsStyle();
-//#endif
- cb->setChecked( flag );
-// if (winStyle) cb->setStyle( winStyle );
- cb->setMinimumSize( sizeHint() );
+ m_lab = new HelpLabel(id);
+ m_cb = new QCheckBox;
+ layout->addWidget(m_lab,row, 0);
+ layout->addWidget(m_cb,row, 1);
+ m_enabled = true;
+ m_state=!checked; // force update
+ setValue(checked);
+ connect( m_cb, SIGNAL(toggled(bool)), SLOT(setValue(bool)) );
+ connect( m_lab, SIGNAL(enter()), SLOT(help()) );
+ connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
+ row++;
+}
- connect( cb, SIGNAL(toggled(bool)), SLOT(setState(bool)) );
+void InputBool::help()
+{
+ showHelp(this);
+}
- layout->activate();
+void InputBool::setEnabled(bool b)
+{
+ m_enabled = b;
+ m_cb->setEnabled(b);
+ updateDependencies();
}
-void InputBool::init()
+void InputBool::updateDependencies()
{
- cb->setChecked(state);
+ for (int i=0;i<m_dependencies.count();i++)
+ {
+ m_dependencies[i]->setEnabled(m_enabled && m_state);
+ }
}
-void InputBool::setState( bool s )
+void InputBool::setValue( bool s )
{
- if (state!=s)
+ if (m_state!=s)
{
+ m_state=s;
+ updateDefault();
+ updateDependencies();
+ m_cb->setChecked( s );
+ m_value = m_state;
emit changed();
- emit toggle(cb->text(),s);
}
- state=s;
+}
+
+void InputBool::updateDefault()
+{
+ if (m_state==m_default)
+ {
+ m_lab->setText(QString::fromAscii("<qt>")+m_id+QString::fromAscii("</qt"));
+ }
+ else
+ {
+ m_lab->setText(QString::fromAscii("<qt><font color='red'>")+m_id+QString::fromAscii("</font></qt>"));
+ }
+}
+
+QVariant &InputBool::value()
+{
+ return m_value;
+}
+
+void InputBool::update()
+{
+ QString v = m_value.toString().toLower();
+ m_state = (v==QString::fromAscii("yes") ||
+ v==QString::fromAscii("true") ||
+ v==QString::fromAscii("1"));
+ m_cb->setChecked( m_state );
+ updateDefault();
+ updateDependencies();
+}
+
+void InputBool::reset()
+{
+ setValue(m_default);
+}
+
+void InputBool::writeValue(QTextStream &t,QTextCodec *codec)
+{
+ if (m_state)
+ t << codec->fromUnicode(QString::fromAscii("YES"));
+ else
+ t << codec->fromUnicode(QString::fromAscii("NO"));
}
diff --git a/addon/doxywizard/inputbool.h b/addon/doxywizard/inputbool.h
index 3101551..5ec8998 100644
--- a/addon/doxywizard/inputbool.h
+++ b/addon/doxywizard/inputbool.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -15,35 +15,55 @@
#ifndef _INPUTBOOL_H
#define _INPUTBOOL_H
-#include <qwidget.h>
-#include <qcheckbox.h>
-
#include "input.h"
+#include <QObject>
-class PageWidget;
+class QCheckBox;
+class QGridLayout;
+class QLabel;
-class InputBool : public QWidget, /*QCheckBox,*/ public IInput
+class InputBool : public QObject, public Input
{
Q_OBJECT
public:
- InputBool( const QString &text, QWidget *parent, bool &flag );
- ~InputBool(){};
- void init();
- void setEnabled(bool b) { cb->setEnabled(b); }
- QObject *qobject() { return this; }
- bool getState() const { return state; }
+ InputBool(QGridLayout *layout,int &row,const QString &id,
+ bool enabled, const QString &docs );
+
+ // Input
+ QVariant &value();
+ void update();
+ Kind kind() const { return Bool; }
+ QString docs() const { return m_docs; }
+ QString id() const { return m_id; }
+ void addDependency(Input *option) { m_dependencies+=option; }
+ void setEnabled(bool);
+ void updateDependencies();
+ void writeValue(QTextStream &t,QTextCodec *codec);
+
+ public slots:
+ void reset();
+ void setValue(bool);
signals:
void changed();
- void toggle(const char *,bool);
+ void toggle(QString,bool);
+ void showHelp(Input *);
private slots:
- void setState(bool);
+ void help();
private:
- bool &state;
- QCheckBox *cb;
+ void updateDefault();
+ bool m_state;
+ bool m_default;
+ bool m_enabled;
+ QVariant m_value;
+ QCheckBox *m_cb;
+ QString m_docs;
+ QList<Input*> m_dependencies;
+ QString m_id;
+ QLabel *m_lab;
};
diff --git a/addon/doxywizard/inputint.cpp b/addon/doxywizard/inputint.cpp
index 69628d8..cb9846b 100644
--- a/addon/doxywizard/inputint.cpp
+++ b/addon/doxywizard/inputint.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -13,53 +13,84 @@
*/
#include "inputint.h"
+#include "helplabel.h"
-#include <stdio.h>
-#include <stdlib.h>
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qwindowsstyle.h>
-#include <qspinbox.h>
+#include <QtGui>
-InputInt::InputInt( const QString & label, QWidget *parent, int &val, int minVal,int maxVal )
- : QWidget( parent), m_val(val), m_minVal(minVal), m_maxVal(maxVal)
+InputInt::InputInt( QGridLayout *layout,int &row,
+ const QString & id,
+ int defVal, int minVal,int maxVal,
+ const QString & docs )
+ : m_default(defVal), m_minVal(minVal), m_maxVal(maxVal), m_docs(docs), m_id(id)
{
- QHBoxLayout *layout = new QHBoxLayout( this, 5 );
+ m_lab = new HelpLabel(id);
+ m_sp = new QSpinBox;
+ m_sp->setMinimum(minVal);
+ m_sp->setMaximum(maxVal);
+ m_sp->setSingleStep(1);
+ m_val=defVal-1; // force update
+ setValue(defVal);
- lab = new QLabel( label, this );
- lab->setMinimumSize( lab->sizeHint() );
+ layout->addWidget( m_lab, row, 0 );
+ layout->addWidget( m_sp, row, 1 );
- sp = new QSpinBox( minVal,maxVal,1,this );
- sp->setMinimumSize( sp->sizeHint() );
+ connect(m_sp, SIGNAL(valueChanged(int)),
+ this, SLOT(setValue(int)) );
+ connect( m_lab, SIGNAL(enter()), SLOT(help()) );
+ connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
+ row++;
+}
- init();
-
- layout->addWidget( lab );
- layout->addWidget( sp );
- layout->addStretch(1);
- layout->activate();
- setMinimumSize( sizeHint() );
+void InputInt::help()
+{
+ showHelp(this);
+}
- connect(sp, SIGNAL(valueChanged(int)),
- this, SLOT(valueChanged(int)) );
+void InputInt::setValue(int val)
+{
+ val = qMax(m_minVal,val);
+ val = qMin(m_maxVal,val);
+ if (val!=m_val)
+ {
+ m_val = val;
+ m_sp->setValue(val);
+ m_value = m_val;
+ if (m_val==m_default)
+ {
+ m_lab->setText(QString::fromAscii("<qt>")+m_id+QString::fromAscii("</qt"));
+ }
+ else
+ {
+ m_lab->setText(QString::fromAscii("<qt><font color='red'>")+m_id+QString::fromAscii("</font></qt>"));
+ }
+ emit changed();
+ }
}
-void InputInt::valueChanged(int val)
+void InputInt::setEnabled(bool state)
{
- if (val!=m_val) emit changed();
- m_val = val;
+ m_lab->setEnabled(state);
+ m_sp->setEnabled(state);
}
-void InputInt::setEnabled(bool state)
+QVariant &InputInt::value()
{
- lab->setEnabled(state);
- sp->setEnabled(state);
+ return m_value;
}
-void InputInt::init()
+void InputInt::update()
{
- m_val = QMAX(m_minVal,m_val);
- m_val = QMIN(m_maxVal,m_val);
- sp->setValue(m_val);
+ setValue(m_value.toInt());
}
+
+void InputInt::reset()
+{
+ setValue(m_default);
+}
+
+void InputInt::writeValue(QTextStream &t,QTextCodec *)
+{
+ t << m_val;
+}
+
diff --git a/addon/doxywizard/inputint.h b/addon/doxywizard/inputint.h
index b5f38ee..73100ae 100644
--- a/addon/doxywizard/inputint.h
+++ b/addon/doxywizard/inputint.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -15,39 +15,56 @@
#ifndef _INPUTINT_H
#define _INPUTINT_H
-#include <qwidget.h>
-#include <qstring.h>
-
#include "input.h"
+#include <QObject>
+class QGridLayout;
class QLabel;
class QSpinBox;
-class InputInt : public QWidget, public IInput
+class InputInt : public QObject, public Input
{
Q_OBJECT
public:
- InputInt( const QString &text, QWidget *parent, int &val,
- int minVal, int maxVal );
+ InputInt( QGridLayout *layout,int &row,
+ const QString &id, int defVal,
+ int minVal, int maxVal,
+ const QString &docs );
~InputInt(){};
+
+ // Input
+ QVariant &value();
+ void update();
+ Kind kind() const { return Int; }
+ QString docs() const { return m_docs; }
+ QString id() const { return m_id; }
+ void addDependency(Input *) { Q_ASSERT(false); }
void setEnabled(bool);
- void init();
- QObject *qobject() { return this; }
+ void updateDependencies() {}
+ void writeValue(QTextStream &t,QTextCodec *codec);
- private:
- QLabel *lab;
- QSpinBox *sp;
- int &m_val;
- int m_minVal;
- int m_maxVal;
+ public slots:
+ void reset();
+ void setValue(int val);
+
+ private slots:
+ void help();
signals:
void changed();
+ void showHelp(Input *);
- private slots:
- void valueChanged(int val);
-
+ private:
+ QLabel *m_lab;
+ QSpinBox *m_sp;
+ int m_val;
+ int m_default;
+ int m_minVal;
+ int m_maxVal;
+ QVariant m_value;
+ QString m_docs;
+ QString m_id;
};
#endif
diff --git a/addon/doxywizard/inputstring.cpp b/addon/doxywizard/inputstring.cpp
index 03f7098..d3441c1 100644
--- a/addon/doxywizard/inputstring.cpp
+++ b/addon/doxywizard/inputstring.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -13,178 +13,179 @@
*/
#include "inputstring.h"
-//#include "pixmaps.h"
-
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qwindowsstyle.h>
-#include <qcstring.h>
-#include <qpushbutton.h>
-#include <qfiledialog.h>
-#include <qcombobox.h>
-#include <qtooltip.h>
-
-
-InputString::InputString( const QString & label,
- QWidget *parent, QCString &s, StringMode m )
- : QWidget( parent ), str(s), sm(m), m_values(0), m_index(0)
+#include "helplabel.h"
+#include "doxywizard.h"
+#include "config.h"
+
+#include <QtGui>
+
+InputString::InputString( QGridLayout *layout,int &row,
+ const QString & id, const QString &s,
+ StringMode m, const QString &docs )
+ : m_default(s), m_sm(m), m_index(0), m_docs(docs), m_id(id)
{
+ m_lab = new HelpLabel(id);
if (m==StringFixed)
{
- QHBoxLayout *layout = new QHBoxLayout( this, 5);
- lab = new QLabel( label, this );
- lab->setMinimumSize( lab->sizeHint() );
- layout->addWidget( lab );
- com = new QComboBox( this );
- com->setMinimumSize(com->sizeHint());
- layout->addWidget( com );
- layout->addStretch( 1 );
- le=0;
- br=0;
- layout->activate();
- setMinimumSize( sizeHint() );
+ layout->addWidget( m_lab, row, 0 );
+ m_com = new QComboBox;
+ layout->addWidget( m_com, row, 1, 1, 3, Qt::AlignLeft );
+ m_le=0;
+ m_br=0;
+ row++;
}
else
{
- QGridLayout *layout = new QGridLayout( this, 1, m==StringFree ? 1 : 3, 5 );
- lab = new QLabel( label, this );
- lab->setMinimumSize( lab->sizeHint() );
- layout->addWidget( lab,0,0 );
- le = new QLineEdit( this );
- le->setMinimumSize( le->sizeHint() );
- le->setText( s );
- layout->addWidget( le,0,1 );
+ layout->addWidget( m_lab, row, 0 );
+ m_le = new QLineEdit;
+ m_le->setText( s );
+ //layout->setColumnMinimumWidth(2,150);
if (m==StringFile || m==StringDir)
{
- //QPixmap pixmap = QPixmap(m==StringFile ?
- // file_xpm :
- // folder_xpm );
- br = new QPushButton( this );
- br->setMinimumSize( br->sizeHint() );
+ layout->addWidget( m_le, row, 1 );
+ m_br = new QToolBar;
+ m_br->setIconSize(QSize(24,24));
if (m==StringFile)
{
- br->setText("File...");
- QToolTip::add(br,"Browse to a file");
+ QAction *file = m_br->addAction(QIcon(QString::fromAscii(":/images/file.png")),QString(),this,SLOT(browse()));
+ file->setToolTip(tr("Browse to a file"));
}
else
{
- br->setText("Folder...");
- QToolTip::add(br,"Browse to a folder");
+ QAction *dir = m_br->addAction(QIcon(QString::fromAscii(":/images/folder.png")),QString(),this,SLOT(browse()));
+ dir->setToolTip(tr("Browse to a folder"));
}
- layout->addWidget( br,0,2 );
+ layout->addWidget( m_br,row,2 );
}
else
{
- br=0;
+ layout->addWidget( m_le, row, 1, 1, 2 );
+ m_br=0;
}
- com=0;
- layout->activate();
- setMinimumSize( sizeHint() );
+ m_com=0;
+ row++;
}
- if (le) connect( le, SIGNAL(textChanged(const QString&)),
- this, SLOT(textChanged(const QString&)) );
- if (br) connect( br, SIGNAL(clicked()), this, SLOT(browse()) );
- if (com) connect( com, SIGNAL(activated(const QString &)),
- this, SLOT(textChanged(const QString &)) );
+ if (m_le) connect( m_le, SIGNAL(textChanged(const QString&)),
+ this, SLOT(setValue(const QString&)) );
+ if (m_com) connect( m_com, SIGNAL(activated(const QString &)),
+ this, SLOT(setValue(const QString &)) );
+ m_str = s+QChar::fromAscii('!'); // force update
+ setValue(s);
+ connect( m_lab, SIGNAL(enter()), SLOT(help()) );
+ connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
+}
+
+void InputString::help()
+{
+ showHelp(this);
}
+
InputString::~InputString()
{
- if (m_values) delete m_values;
}
-void InputString::textChanged(const QString &s)
+void InputString::setValue(const QString &s)
{
- if (str!=(const char *)s)
+ if (m_str!=s)
{
- str = s;
+ m_str = s;
+ m_value = m_str;
+ if (m_str==m_default)
+ {
+ m_lab->setText(QString::fromAscii("<qt>")+m_id+QString::fromAscii("</qt"));
+ }
+ else
+ {
+ m_lab->setText(QString::fromAscii("<qt><font color='red'>")+m_id+QString::fromAscii("</font></qt>"));
+ }
+ if (m_le) m_le->setText( m_str );
emit changed();
}
}
void InputString::setEnabled(bool state)
{
- lab->setEnabled(state);
- if (le) le->setEnabled(state);
- if (br) br->setEnabled(state);
- if (com) com->setEnabled(state);
+ m_lab->setEnabled(state);
+ if (m_le) m_le->setEnabled(state);
+ if (m_br) m_br->setEnabled(state);
+ if (m_com) m_com->setEnabled(state);
}
void InputString::browse()
{
- if (sm==StringFile)
+ QString path = QFileInfo(MainWindow::instance().configFileName()).path();
+ if (m_sm==StringFile)
{
- QString fileName = QFileDialog::getOpenFileName();
-
+ QString fileName = QFileDialog::getOpenFileName(&MainWindow::instance(),
+ tr("Select file"),path);
if (!fileName.isNull())
{
- le->setText( fileName );
- if (str!=(const char *)le->text())
+ QDir dir(path);
+ if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
{
- str = le->text();
- emit changed();
+ fileName = dir.relativeFilePath(fileName);
}
+ setValue(fileName);
}
}
else // sm==StringDir
{
- QString dirName = QFileDialog::getExistingDirectory();
-
+ QString dirName = QFileDialog::getExistingDirectory(&MainWindow::instance(),
+ tr("Select directory"),path);
if (!dirName.isNull())
{
- le->setText( dirName );
- if (str!=(const char *)le->text())
+ QDir dir(path);
+ if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
{
- str = le->text();
- emit changed();
+ dirName = dir.relativeFilePath(dirName);
}
+ setValue(dirName);
}
}
}
void InputString::clear()
{
- le->setText("");
- if (!str.isEmpty())
- {
- emit changed();
- str = "";
- }
+ setValue(QString());
}
-void InputString::addValue(const char *s)
+void InputString::addValue(QString s)
{
- if (sm==StringFixed)
+ if (m_sm==StringFixed)
{
- if (m_values==0) m_values = new QDict<int>;
- m_values->setAutoDelete(TRUE);
- m_values->insert(s,new int(m_index++));
- com->insertItem(s);
+ m_values.append(s);
+ m_com->addItem(s);
}
}
-void InputString::init()
+void InputString::setDefault()
{
- if (sm==StringFixed)
- {
- if (m_values)
- {
- int *itemIndex = m_values->find(str);
- if (itemIndex)
- {
- com->setCurrentItem(*itemIndex);
- }
- else
- {
- com->setCurrentItem(0);
- }
- }
- }
- else
- {
- le->setText(str);
- }
+ int index = m_values.indexOf(m_str);
+ if (index!=-1 && m_com) m_com->setCurrentIndex(index);
}
+
+QVariant &InputString::value()
+{
+ return m_value;
+}
+
+void InputString::update()
+{
+ setValue(m_value.toString().trimmed());
+ setDefault();
+}
+
+void InputString::reset()
+{
+ setValue(m_default);
+ setDefault();
+}
+
+void InputString::writeValue(QTextStream &t,QTextCodec *codec)
+{
+ writeStringValue(t,codec,m_str);
+}
+
diff --git a/addon/doxywizard/inputstring.h b/addon/doxywizard/inputstring.h
index cf00d2d..13efb44 100644
--- a/addon/doxywizard/inputstring.h
+++ b/addon/doxywizard/inputstring.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -15,19 +15,19 @@
#ifndef _INPUTSTRING_H
#define _INPUTSTRING_H
-#include <qwidget.h>
-#include <qstring.h>
-#include <qdict.h>
-
-#include "qtbc.h"
#include "input.h"
+#include <QObject>
+#include <QMap>
+#include <QStringList>
+
class QLabel;
class QLineEdit;
-class QPushButton;
+class QToolBar;
class QComboBox;
+class QGridLayout;
-class InputString : public QWidget, public IInput
+class InputString : public QObject, public Input
{
Q_OBJECT
@@ -38,32 +38,51 @@ class InputString : public QWidget, public IInput
StringFixed=3
};
- InputString( const QString &text, QWidget *parent, QCString &s,
- StringMode m=StringFree );
+ InputString( QGridLayout *layout,int &row,
+ const QString &id, const QString &s,
+ StringMode m,
+ const QString &docs );
~InputString();
+ void addValue(QString s);
+ void setDefault();
+
+ // Input
+ QVariant &value();
+ void update();
+ Kind kind() const { return String; }
+ QString docs() const { return m_docs; }
+ QString id() const { return m_id; }
+ void addDependency(Input *) { Q_ASSERT(false); }
void setEnabled(bool);
- void addValue(const char *s);
- void init();
- QObject *qobject() { return this; }
+ void updateDependencies() {}
+ void writeValue(QTextStream &t,QTextCodec *codec);
- private:
- QLabel *lab;
- QLineEdit *le;
- QPushButton *br;
- QComboBox *com;
- QCString &str;
- StringMode sm;
- QDict<int> *m_values;
- int m_index;
+ public slots:
+ void reset();
+ void setValue(const QString&);
signals:
void changed();
+ void showHelp(Input *);
private slots:
- void textChanged(const QString&);
void browse();
void clear();
+ void help();
+ private:
+ QLabel *m_lab;
+ QLineEdit *m_le;
+ QToolBar *m_br;
+ QComboBox *m_com;
+ QString m_str;
+ QString m_default;
+ StringMode m_sm;
+ QStringList m_values;
+ int m_index;
+ QVariant m_value;
+ QString m_docs;
+ QString m_id;
};
#endif
diff --git a/addon/doxywizard/inputstrlist.cpp b/addon/doxywizard/inputstrlist.cpp
index 9d98f9a..d0ebdc7 100644
--- a/addon/doxywizard/inputstrlist.cpp
+++ b/addon/doxywizard/inputstrlist.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -13,162 +13,139 @@
*/
#include "inputstrlist.h"
-//#include "pixmaps.h"
-
-#include <qlabel.h>
-#include <qlayout.h>
-#include <qlineedit.h>
-#include <qpushbutton.h>
-#include <qlistbox.h>
-#include <qstrlist.h>
-#include <qstringlist.h>
-#include <qfiledialog.h>
-#include <qtooltip.h>
-
-InputStrList::InputStrList( const QString & label,
- QWidget *parent, QStrList &sl, ListMode lm)
- : QWidget(parent), strList(sl)
+#include "helplabel.h"
+#include "doxywizard.h"
+#include "config.h"
+
+#include <QtGui>
+
+InputStrList::InputStrList( QGridLayout *layout,int &row,
+ const QString & id,
+ const QStringList &sl, ListMode lm,
+ const QString & docs)
+ : m_default(sl), m_strList(sl), m_docs(docs), m_id(id)
{
- QGridLayout *layout = new QGridLayout( this, 2, 2, 5 );
- lab = new QLabel( label, this );
- lab->setMinimumSize( lab->sizeHint() );
- layout->addWidget( lab,0,0 );
-
- QWidget *dw = new QWidget(this); /* dummy widget used for layouting */
- QHBoxLayout *boxlayout = new QHBoxLayout( dw, 0, 5 );
- le = new QLineEdit( dw );
- le->setMinimumSize( le->sizeHint() );
- boxlayout->addWidget( le, 1 );
-
- add = new QPushButton( dw );
- //add->setPixmap( QPixmap( add_xpm ));
- add->setText( "+" );
- add->setMinimumSize( add->sizeHint() );
- QToolTip::add(add,"Add item");
- boxlayout->addWidget( add );
-
- del = new QPushButton( dw );
- //del->setPixmap( QPixmap( del_xpm ));
- del->setText( "-" );
- del->setMinimumSize( del->sizeHint() );
- QToolTip::add(del,"Delete selected item");
- boxlayout->addWidget( del );
-
- upd = new QPushButton( dw );
- //upd->setPixmap( QPixmap( update_xpm ));
- upd->setText( "*" );
- upd->setMinimumSize( upd->sizeHint() );
- QToolTip::add(upd,"Update selected item");
- boxlayout->addWidget( upd );
-
- lb = new QListBox( this );
- lb->setMinimumSize(400,100);
- init();
- lb->setVScrollBarMode(QScrollView::Auto);
- lb->setHScrollBarMode(QScrollView::Auto);
-
- brFile=0;
- brDir=0;
+ m_lab = new HelpLabel( id );
+
+ m_le = new QLineEdit;
+ m_le->clear();
+
+ QToolBar *toolBar = new QToolBar;
+ toolBar->setIconSize(QSize(24,24));
+ m_add = toolBar->addAction(QIcon(QString::fromAscii(":/images/add.png")),QString(),
+ this,SLOT(addString()));
+ m_add->setToolTip(tr("Add item"));
+ m_del = toolBar->addAction(QIcon(QString::fromAscii(":/images/del.png")),QString(),
+ this,SLOT(delString()));
+ m_del->setToolTip(tr("Delete selected item"));
+ m_upd = toolBar->addAction(QIcon(QString::fromAscii(":/images/refresh.png")),QString(),
+ this,SLOT(updateString()));
+ m_upd->setToolTip(tr("Update selected item"));
+
+ m_lb = new QListWidget;
+ //m_lb->setMinimumSize(400,100);
+ foreach (QString s, m_strList) m_lb->addItem(s);
+
+ m_brFile=0;
+ m_brDir=0;
if (lm!=ListString)
{
if (lm&ListFile)
{
- brFile = new QPushButton(dw);
- //brFile->setPixmap( QPixmap(file_xpm) );
- brFile->setText("Select...");
- brFile->setMinimumSize(brFile->sizeHint());
- QToolTip::add(brFile,"Browse to a file");
- boxlayout->addWidget( brFile );
+ m_brFile = toolBar->addAction(QIcon(QString::fromAscii(":/images/file.png")),QString(),
+ this,SLOT(browseFiles()));
+ m_brFile->setToolTip(tr("Browse to a file"));
}
if (lm&ListDir)
{
- brDir = new QPushButton(dw);
- //brDir->setPixmap( QPixmap(folder_xpm) );
- brDir->setText("Select...");
- brDir->setMinimumSize(brDir->sizeHint());
- QToolTip::add(brDir,"Browse to a folder");
- boxlayout->addWidget( brDir );
+ m_brDir = toolBar->addAction(QIcon(QString::fromAscii(":/images/folder.png")),QString(),
+ this,SLOT(browseDir()));
+ m_brDir->setToolTip(tr("Browse to a folder"));
}
}
- layout->addWidget( dw, 0,1 );
- layout->addWidget( lb,1,1 );
- layout->activate();
- setMinimumSize( sizeHint() );
+ QHBoxLayout *rowLayout = new QHBoxLayout;
+ rowLayout->addWidget( m_le );
+ rowLayout->addWidget( toolBar );
+ layout->addWidget( m_lab, row,0 );
+ layout->addLayout( rowLayout, row,1,1,2 );
+ layout->addWidget( m_lb, row+1,1,1,2 );
+ row+=2;
- connect(le, SIGNAL(returnPressed()),
- this, SLOT(addString()) );
- connect(add, SIGNAL(clicked()),
+ m_value = m_strList;
+
+ connect(m_le, SIGNAL(returnPressed()),
this, SLOT(addString()) );
- connect(del, SIGNAL(clicked()),
- this, SLOT(delString()) );
- connect(upd, SIGNAL(clicked()),
- this, SLOT(updateString()) );
- if (brFile)
- {
- connect(brFile, SIGNAL(clicked()),
- this, SLOT(browseFiles()));
- }
- if (brDir)
- {
- connect(brDir, SIGNAL(clicked()),
- this, SLOT(browseDir()));
- }
- connect(lb, SIGNAL(selected(const QString &)),
+ connect(m_lb, SIGNAL(currentTextChanged(const QString &)),
this, SLOT(selectText(const QString &)));
+ connect( m_lab, SIGNAL(enter()), SLOT(help()) );
+ connect( m_lab, SIGNAL(reset()), SLOT(reset()) );
+}
+
+void InputStrList::help()
+{
+ showHelp(this);
}
+
void InputStrList::addString()
{
- if (!le->text().isEmpty())
+ if (!m_le->text().isEmpty())
{
- lb->insertItem(le->text());
- strList.append(le->text());
+ m_lb->addItem(m_le->text());
+ m_strList.append(m_le->text());
+ m_value = m_strList;
+ updateDefault();
emit changed();
- le->clear();
+ m_le->clear();
}
}
void InputStrList::delString()
{
- if (lb->currentItem()!=-1)
+ if (m_lb->currentRow()!=-1)
{
- int itemIndex = lb->currentItem();
- lb->removeItem(itemIndex);
- strList.remove(itemIndex);
+ int itemIndex = m_lb->currentRow();
+ delete m_lb->currentItem();
+ m_strList.removeAt(itemIndex);
+ m_value = m_strList;
+ updateDefault();
emit changed();
}
}
void InputStrList::updateString()
{
- if (lb->currentItem()!=-1 && !le->text().isEmpty())
+ if (m_lb->currentRow()!=-1 && !m_le->text().isEmpty())
{
- lb->changeItem(le->text(),lb->currentItem());
- strList.insert(lb->currentItem(),le->text());
- strList.remove(lb->currentItem()+1);
+ m_lb->currentItem()->setText(m_le->text());
+ m_strList.insert(m_lb->currentRow(),m_le->text());
+ m_strList.removeAt(m_lb->currentRow()+1);
+ m_value = m_strList;
+ updateDefault();
emit changed();
}
}
void InputStrList::selectText(const QString &s)
{
- le->setText(s);
+ m_le->setText(s);
}
void InputStrList::setEnabled(bool state)
{
- lab->setEnabled(state);
- le->setEnabled(state);
- add->setEnabled(state);
- del->setEnabled(state);
- upd->setEnabled(state);
- lb->setEnabled(state);
- if (brFile) brFile->setEnabled(state);
- if (brDir) brDir->setEnabled(state);
+ m_lab->setEnabled(state);
+ m_le->setEnabled(state);
+ m_add->setEnabled(state);
+ m_del->setEnabled(state);
+ m_upd->setEnabled(state);
+ m_lb->setEnabled(state);
+ if (m_brFile) m_brFile->setEnabled(state);
+ if (m_brDir) m_brDir->setEnabled(state);
}
void InputStrList::browseFiles()
{
+ QString path = QFileInfo(MainWindow::instance().configFileName()).path();
QStringList fileNames = QFileDialog::getOpenFileNames();
if (!fileNames.isEmpty())
@@ -176,35 +153,102 @@ void InputStrList::browseFiles()
QStringList::Iterator it;
for ( it= fileNames.begin(); it != fileNames.end(); ++it )
{
- lb->insertItem(*it);
- strList.append(*it);
+ QString fileName;
+ QDir dir(path);
+ if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
+ {
+ fileName = dir.relativeFilePath(*it);
+ }
+ if (fileName.isEmpty())
+ {
+ fileName = *it;
+ }
+ m_lb->addItem(fileName);
+ m_strList.append(fileName);
+ m_value = m_strList;
+ updateDefault();
emit changed();
}
- le->setText(*fileNames.begin());
+ m_le->setText(m_strList[0]);
}
}
void InputStrList::browseDir()
{
+ QString path = QFileInfo(MainWindow::instance().configFileName()).path();
QString dirName = QFileDialog::getExistingDirectory();
if (!dirName.isNull())
{
- lb->insertItem(dirName);
- strList.append(dirName);
+ QDir dir(path);
+ if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
+ {
+ dirName = dir.relativeFilePath(dirName);
+ }
+ if (dirName.isEmpty())
+ {
+ dirName=QString::fromAscii(".");
+ }
+ m_lb->addItem(dirName);
+ m_strList.append(dirName);
+ m_value = m_strList;
+ updateDefault();
emit changed();
- le->setText(dirName);
+ m_le->setText(dirName);
+ }
+}
+
+void InputStrList::setValue(const QStringList &sl)
+{
+ m_le->clear();
+ m_lb->clear();
+ m_strList = sl;
+ for (int i=0;i<m_strList.size();i++)
+ {
+ m_lb->addItem(m_strList[i].trimmed());
+ }
+ updateDefault();
+}
+
+QVariant &InputStrList::value()
+{
+ return m_value;
+}
+
+void InputStrList::update()
+{
+ setValue(m_value.toStringList());
+}
+
+void InputStrList::updateDefault()
+{
+ if (m_strList==m_default)
+ {
+ m_lab->setText(QString::fromAscii("<qt>")+m_id+QString::fromAscii("</qt"));
}
+ else
+ {
+ m_lab->setText(QString::fromAscii("<qt><font color='red'>")+m_id+QString::fromAscii("</font></qt>"));
+ }
+}
+
+void InputStrList::reset()
+{
+ setValue(m_default);
}
-void InputStrList::init()
+void InputStrList::writeValue(QTextStream &t,QTextCodec *codec)
{
- le->clear();
- lb->clear();
- char *s = strList.first();
- while (s)
+ bool first=TRUE;
+ foreach (QString s, m_strList)
{
- lb->insertItem(s);
- s = strList.next();
+ if (!first)
+ {
+ t << " \\" << endl;
+ t << " ";
+ }
+ first=FALSE;
+ writeStringValue(t,codec,s);
}
}
+
diff --git a/addon/doxywizard/inputstrlist.h b/addon/doxywizard/inputstrlist.h
index 0ba48c5..912f441 100644
--- a/addon/doxywizard/inputstrlist.h
+++ b/addon/doxywizard/inputstrlist.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
@@ -15,48 +15,51 @@
#ifndef _INPUTSTRLIST_H
#define _INPUTSTRLIST_H
-#include <qwidget.h>
-#include <qstring.h>
-
#include "input.h"
+#include <QObject>
+#include <QStringList>
+
class QLabel;
class QLineEdit;
class QPushButton;
-class QListBox;
-class QStrList;
+class QListWidget;
+class QStringList;
+class QGridLayout;
+class QAction;
-class InputStrList : public QWidget, public IInput
+class InputStrList : public QObject, public Input
{
Q_OBJECT
public:
- enum ListMode { ListString=0,
- ListFile=1,
- ListDir=2,
- ListFileDir=ListFile|ListDir
+ enum ListMode { ListString = 0,
+ ListFile = 1,
+ ListDir = 2,
+ ListFileDir = ListFile | ListDir
};
- InputStrList( const QString &text, QWidget *parent,
- QStrList &sl, ListMode v=ListString );
- ~InputStrList() {};
+ InputStrList( QGridLayout *layout,int &row,
+ const QString &id, const QStringList &sl,
+ ListMode v, const QString &docs);
+ void setValue(const QStringList &sl);
+
+ QVariant &value();
+ void update();
+ Kind kind() const { return StrList; }
+ QString docs() const { return m_docs; }
+ QString id() const { return m_id; }
+ void addDependency(Input *) { Q_ASSERT(false); }
void setEnabled(bool);
- void init();
- QObject *qobject() { return this; }
+ void updateDependencies() {}
+ void writeValue(QTextStream &t,QTextCodec *codec);
- private:
- QLabel *lab;
- QLineEdit *le;
- QPushButton *add;
- QPushButton *del;
- QPushButton *upd;
- QPushButton *brFile;
- QPushButton *brDir;
- QListBox *lb;
- QStrList &strList;
+ public slots:
+ void reset();
signals:
void changed();
+ void showHelp(Input *);
private slots:
void addString();
@@ -65,6 +68,23 @@ class InputStrList : public QWidget, public IInput
void selectText(const QString &s);
void browseFiles();
void browseDir();
+ void help();
+
+ private:
+ void updateDefault();
+ QLabel *m_lab;
+ QLineEdit *m_le;
+ QAction *m_add;
+ QAction *m_del;
+ QAction *m_upd;
+ QAction *m_brFile;
+ QAction *m_brDir;
+ QListWidget *m_lb;
+ QStringList m_default;
+ QStringList m_strList;
+ QVariant m_value;
+ QString m_docs;
+ QString m_id;
};
diff --git a/addon/doxywizard/qtbc.h b/addon/doxywizard/qtbc.h
deleted file mode 100644
index 22ab1d5..0000000
--- a/addon/doxywizard/qtbc.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/******************************************************************************
- *
- *
- *
- * Copyright (C) 1997-2008 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
- * for any purpose. It is provided "as is" without express or implied warranty.
- * See the GNU General Public License for more details.
- *
- * Documents produced by Doxygen are derivative works derived from the
- * input used in their production; they are not affected by this license.
- *
- */
-
-#ifndef QTBC_H
-#define QTBC_H
-
-/*! This file contains some hacks to make Doxygen work with
- * Qt version 2.00 and Qt version 1.xx
- */
-
-#include <qglobal.h>
-
-#if QT_VERSION >= 200
-
-#include <locale.h>
-
-#define GCI QCollection::Item
-
-#include <qcstring.h>
-#include <qstring.h>
-inline QCString convertToQCString(const QString &s) { return s.latin1(); }
-
-#else /* QT_VERSION < 200 */
-
-#include <qstring.h>
-#define QCString QString
-inline QCString convertToQCString(const QCString &s) { return s; }
-
-#endif
-
-#endif
diff --git a/addon/doxywizard/version.h b/addon/doxywizard/version.h
index e336930..a040af7 100644
--- a/addon/doxywizard/version.h
+++ b/addon/doxywizard/version.h
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2008 by Dimitri van Heesch.
+ * Copyright (C) 1997-2007 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
diff --git a/addon/doxywizard/wizard.cpp b/addon/doxywizard/wizard.cpp
new file mode 100644
index 0000000..7346bd2
--- /dev/null
+++ b/addon/doxywizard/wizard.cpp
@@ -0,0 +1,896 @@
+#include "wizard.h"
+#include "input.h"
+#include "doxywizard.h"
+
+#include <QtGui>
+
+// step1 options
+#define STR_PROJECT_NAME QString::fromAscii("PROJECT_NAME")
+#define STR_INPUT QString::fromAscii("INPUT")
+#define STR_OUTPUT_DIRECTORY QString::fromAscii("OUTPUT_DIRECTORY")
+#define STR_PROJECT_NUMBER QString::fromAscii("PROJECT_NUMBER")
+#define STR_RECURSIVE QString::fromAscii("RECURSIVE")
+#define STR_OPTIMIZE_OUTPUT_FOR_C QString::fromAscii("OPTIMIZE_OUTPUT_FOR_C")
+#define STR_OPTIMIZE_OUTPUT_JAVA QString::fromAscii("OPTIMIZE_OUTPUT_JAVA")
+#define STR_OPTIMIZE_FOR_FORTRAN QString::fromAscii("OPTIMIZE_FOR_FORTRAN")
+#define STR_OPTIMIZE_OUTPUT_VHDL QString::fromAscii("OPTIMIZE_OUTPUT_VHDL")
+#define STR_CPP_CLI_SUPPORT QString::fromAscii("CPP_CLI_SUPPORT")
+#define STR_HIDE_SCOPE_NAMES QString::fromAscii("HIDE_SCOPE_NAMES")
+#define STR_EXTRACT_ALL QString::fromAscii("EXTRACT_ALL")
+#define STR_SOURCE_BROWSER QString::fromAscii("SOURCE_BROWSER")
+#define STR_GENERATE_HTML QString::fromAscii("GENERATE_HTML")
+#define STR_GENERATE_LATEX QString::fromAscii("GENERATE_LATEX")
+#define STR_GENERATE_MAN QString::fromAscii("GENERATE_MAN")
+#define STR_GENERATE_RTF QString::fromAscii("GENERATE_RTF")
+#define STR_GENERATE_XML QString::fromAscii("GENERATE_XML")
+#define STR_GENERATE_HTMLHELP QString::fromAscii("GENERATE_HTMLHELP")
+#define STR_GENERATE_TREEVIEW QString::fromAscii("GENERATE_TREEVIEW")
+#define STR_USE_PDFLATEX QString::fromAscii("USE_PDFLATEX")
+#define STR_PDF_HYPERLINKS QString::fromAscii("PDF_HYPERLINKS")
+#define STR_SEARCHENGINE QString::fromAscii("SEARCHENGINE")
+#define STR_HAVE_DOT QString::fromAscii("HAVE_DOT")
+#define STR_CLASS_DIAGRAMS QString::fromAscii("CLASS_DIAGRAMS")
+#define STR_CLASS_GRAPH QString::fromAscii("CLASS_GRAPH")
+#define STR_COLLABORATION_GRAPH QString::fromAscii("COLLABORATION_GRAPH")
+#define STR_GRAPHICAL_HIERARCHY QString::fromAscii("GRAPHICAL_HIERARCHY")
+#define STR_INCLUDE_GRAPH QString::fromAscii("INCLUDE_GRAPH")
+#define STR_INCLUDED_BY_GRAPH QString::fromAscii("INCLUDED_BY_GRAPH")
+#define STR_CALL_GRAPH QString::fromAscii("CALL_GRAPH")
+#define STR_CALLER_GRAPH QString::fromAscii("CALLER_GRAPH")
+
+
+static bool g_optimizeMapping[6][6] =
+{
+ // A: OPTIMIZE_OUTPUT_FOR_C
+ // B: OPTIMIZE_OUTPUT_JAVA
+ // C: OPTIMIZE_FOR_FORTRAN
+ // D: OPTIMIZE_OUTPUT_VHDL
+ // E: CPP_CLI_SUPPORT
+ // F: HIDE_SCOPE_NAMES
+ // A B C D E F
+ { false,false,false,false,false,false }, // 0: C++
+ { false,false,false,false,true, false }, // 1: C++/CLI
+ { false,true, false,false,false,false }, // 2: C#/Java
+ { true, false,false,false,false,true }, // 3: C/PHP
+ { false,false,true, false,false,false }, // 4: Fortran
+ { false,false,false,true, false,false }, // 5: VHDL
+};
+
+static QString g_optimizeOptionNames[6] =
+{
+ STR_OPTIMIZE_OUTPUT_FOR_C,
+ STR_OPTIMIZE_OUTPUT_JAVA,
+ STR_OPTIMIZE_FOR_FORTRAN,
+ STR_OPTIMIZE_OUTPUT_VHDL,
+ STR_CPP_CLI_SUPPORT,
+ STR_HIDE_SCOPE_NAMES
+};
+
+//==========================================================================
+
+static bool stringVariantToBool(const QVariant &v)
+{
+ QString s = v.toString().toLower();
+ return s==QString::fromAscii("yes") || s==QString::fromAscii("true") || s==QString::fromAscii("1");
+}
+
+static bool getBoolOption(
+ const QHash<QString,Input*>&model,const QString &name)
+{
+ Input *option = model[name];
+ Q_ASSERT(option!=0);
+ return stringVariantToBool(option->value());
+}
+
+static QString getStringOption(
+ const QHash<QString,Input*>&model,const QString &name)
+{
+ Input *option = model[name];
+ Q_ASSERT(option!=0);
+ return option->value().toString();
+}
+
+static void updateBoolOption(
+ const QHash<QString,Input*>&model,const QString &name,bool bNew)
+{
+ Input *option = model[name];
+ Q_ASSERT(option!=0);
+ bool bOld = stringVariantToBool(option->value());
+ if (bOld!=bNew)
+ {
+ option->value()=QString::fromAscii(bNew ? "true" : "false");
+ option->update();
+ }
+}
+
+static void updateStringOption(
+ const QHash<QString,Input*>&model,const QString &name,const QString &s)
+{
+ Input *option = model[name];
+ Q_ASSERT(option!=0);
+ if (option->value().toString()!=s)
+ {
+ option->value() = s;
+ option->update();
+ }
+}
+
+//==========================================================================
+
+Step1::Step1(Wizard *wizard,const QHash<QString,Input*> &modelData) : m_wizard(wizard), m_modelData(modelData)
+{
+ QVBoxLayout *layout = new QVBoxLayout(this);
+ layout->setMargin(4);
+ layout->setSpacing(8);
+ QLabel *l = new QLabel(this);
+ l->setText(tr("Provide some information "
+ "about the project you are documenting"));
+ layout->addWidget(l);
+ QWidget *w = new QWidget( this );
+ QHBoxLayout *bl = new QHBoxLayout(w);
+ bl->setSpacing(10);
+
+ QWidget *col1 = new QWidget;
+ QVBoxLayout *col1Layout = new QVBoxLayout(col1);
+ col1Layout->setSpacing(8);
+ QLabel *projName = new QLabel(this);
+ projName->setText(tr("Project name:"));
+ projName->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ QLabel *projVersion = new QLabel(this);
+ projVersion->setText(tr("Project version or id:"));
+ projVersion->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
+ col1Layout->addWidget(projName);
+ col1Layout->addWidget(projVersion);
+
+ QWidget *col2 = new QWidget;
+ QVBoxLayout *col2Layout = new QVBoxLayout(col2);
+ col2Layout->setSpacing(8);
+ m_projName = new QLineEdit;
+ m_projNumber = new QLineEdit;
+ col2Layout->addWidget(m_projName);
+ col2Layout->addWidget(m_projNumber);
+
+ bl->addWidget(col1);
+ bl->addWidget(col2);
+ w->setLayout(bl);
+
+ layout->addWidget(w);
+
+ //---------------------------------------------------
+ QFrame *f = new QFrame( this );
+ f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ layout->addWidget(f);
+
+ l = new QLabel(this);
+ l->setText(tr("Specify the directory to scan for source code"));
+ layout->addWidget(l);
+ QWidget *row = new QWidget;
+ QHBoxLayout *rowLayout = new QHBoxLayout(row);
+ rowLayout->setSpacing(10);
+ l = new QLabel(this);
+ l->setText(tr("Source code directory:"));
+ rowLayout->addWidget(l);
+ m_sourceDir = new QLineEdit;
+ m_srcSelectDir = new QPushButton(this);
+ m_srcSelectDir->setText(tr("Select..."));
+ rowLayout->addWidget(m_sourceDir);
+ rowLayout->addWidget(m_srcSelectDir);
+ layout->addWidget(row);
+
+ m_recursive = new QCheckBox(this);
+ m_recursive->setText(tr("Scan recursively"));
+ m_recursive->setChecked(TRUE);
+ layout->addWidget(m_recursive);
+
+ //---------------------------------------------------
+ f = new QFrame( this );
+ f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ layout->addWidget(f);
+
+ l = new QLabel(this);
+ l->setText(tr("Specify the directory where doxygen should "
+ "put the generated documentation"));
+ layout->addWidget(l);
+ row = new QWidget;
+ rowLayout = new QHBoxLayout(row);
+ rowLayout->setSpacing(10);
+ l = new QLabel(this);
+ l->setText(tr("Destination directory:"));
+ rowLayout->addWidget(l);
+ m_destDir = new QLineEdit;
+ m_dstSelectDir = new QPushButton(this);
+ m_dstSelectDir->setText(tr("Select..."));
+ rowLayout->addWidget(m_destDir);
+ rowLayout->addWidget(m_dstSelectDir);
+ layout->addWidget(row);
+ layout->addStretch(1);
+ setLayout(layout);
+
+ connect(m_srcSelectDir,SIGNAL(clicked()),
+ this,SLOT(selectSourceDir()));
+ connect(m_dstSelectDir,SIGNAL(clicked()),
+ this,SLOT(selectDestinationDir()));
+ connect(m_projName,SIGNAL(textChanged(const QString &)),SLOT(setProjectName(const QString &)));
+ connect(m_projNumber,SIGNAL(textChanged(const QString &)),SLOT(setProjectNumber(const QString &)));
+ connect(m_sourceDir,SIGNAL(textChanged(const QString &)),SLOT(setSourceDir(const QString &)));
+ connect(m_recursive,SIGNAL(stateChanged(int)),SLOT(setRecursiveScan(int)));
+ connect(m_destDir,SIGNAL(textChanged(const QString &)),SLOT(setDestinationDir(const QString &)));
+}
+
+void Step1::selectSourceDir()
+{
+ QString path = QFileInfo(MainWindow::instance().configFileName()).path();
+ QString dirName = QFileDialog::getExistingDirectory(this,
+ tr("Select source directory"),path);
+ QDir dir(path);
+ if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
+ {
+ dirName = dir.relativeFilePath(dirName);
+ }
+ if (dirName.isEmpty())
+ {
+ dirName=QString::fromAscii(".");
+ }
+ m_sourceDir->setText(dirName);
+}
+
+void Step1::selectDestinationDir()
+{
+ QString path = QFileInfo(MainWindow::instance().configFileName()).path();
+ QString dirName = QFileDialog::getExistingDirectory(this,
+ tr("Select destination directory"),path);
+ QDir dir(path);
+ if (!MainWindow::instance().configFileName().isEmpty() && dir.exists())
+ {
+ dirName = dir.relativeFilePath(dirName);
+ }
+ if (dirName.isEmpty())
+ {
+ dirName=QString::fromAscii(".");
+ }
+ m_destDir->setText(dirName);
+}
+
+void Step1::setProjectName(const QString &name)
+{
+ updateStringOption(m_modelData,STR_PROJECT_NAME,name);
+}
+
+void Step1::setProjectNumber(const QString &num)
+{
+ updateStringOption(m_modelData,STR_PROJECT_NUMBER,num);
+}
+
+void Step1::setSourceDir(const QString &dir)
+{
+ Input *option = m_modelData[STR_INPUT];
+ if (option->value().toStringList().count()>0)
+ {
+ QStringList sl = option->value().toStringList();
+ if (sl[0]!=dir)
+ {
+ sl[0] = dir;
+ option->value() = sl;
+ option->update();
+ }
+ }
+ else
+ {
+ option->value() = QStringList() << dir;
+ option->update();
+ }
+}
+
+void Step1::setDestinationDir(const QString &dir)
+{
+ updateStringOption(m_modelData,STR_OUTPUT_DIRECTORY,dir);
+}
+
+void Step1::setRecursiveScan(int s)
+{
+ updateBoolOption(m_modelData,STR_RECURSIVE,s==Qt::Checked);
+}
+
+void Step1::init()
+{
+ Input *option;
+ m_projName->setText(getStringOption(m_modelData,STR_PROJECT_NAME));
+ m_projNumber->setText(getStringOption(m_modelData,STR_PROJECT_NUMBER));
+ option = m_modelData[STR_INPUT];
+ if (option->value().toStringList().count()>0)
+ {
+ m_sourceDir->setText(option->value().toStringList().first());
+ }
+ m_recursive->setChecked(
+ getBoolOption(m_modelData,STR_RECURSIVE) ? Qt::Checked : Qt::Unchecked);
+ m_destDir->setText(getStringOption(m_modelData,STR_OUTPUT_DIRECTORY));
+}
+
+
+//==========================================================================
+
+Step2::Step2(Wizard *wizard,const QHash<QString,Input*> &modelData)
+ : m_wizard(wizard), m_modelData(modelData)
+{
+ QRadioButton *r;
+ QVBoxLayout *layout = new QVBoxLayout(this);
+
+ //---------------------------------------------------
+ m_extractModeGroup = new QButtonGroup(this);
+ m_extractMode = new QGroupBox(this);
+ m_extractMode->setTitle(tr("Select the desired extraction mode:"));
+ QGridLayout *gbox = new QGridLayout( m_extractMode );
+ r = new QRadioButton(tr("Documented entities only"));
+ r->setChecked(true);
+ m_extractModeGroup->addButton(r, 0);
+ gbox->addWidget(r,1,0);
+ // 1 -> EXTRACT_ALL = NO
+ r = new QRadioButton(tr("All Entities"));
+ m_extractModeGroup->addButton(r, 1);
+ gbox->addWidget(r,2,0);
+ // 2 -> EXTRACT_ALL = YES
+ m_crossRef = new QCheckBox(m_extractMode);
+ m_crossRef->setText(tr("Include cross-referenced source code in the output"));
+ // m_crossRef -> SOURCE_BROWSER = YES/NO
+ gbox->addWidget(m_crossRef,3,0);
+ layout->addWidget(m_extractMode);
+
+ //---------------------------------------------------
+ QFrame *f = new QFrame( this );
+ f->setFrameStyle( QFrame::HLine | QFrame::Sunken );
+ layout->addWidget(f);
+
+ m_optimizeLangGroup = new QButtonGroup(this);
+ m_optimizeLang = new QGroupBox(this);
+ m_optimizeLang->setTitle(tr("Select programming language to optimize the results for"));
+ gbox = new QGridLayout( m_optimizeLang );
+
+ r = new QRadioButton(m_optimizeLang);
+ r->setText(tr("Optimize for C++ output"));
+ r->setChecked(true);
+ m_optimizeLangGroup->addButton(r, 0);
+ // 0 -> OPTIMIZE_OUTPUT_FOR_C = NO
+ // OPTIMIZE_OUTPUT_JAVA = NO
+ // OPTIMIZE_FOR_FORTRAN = NO
+ // OPTIMIZE_OUTPUT_VHDL = NO
+ // CPP_CLI_SUPPORT = NO
+ // HIDE_SCOPE_NAMES = NO
+ gbox->addWidget(r,0,0);
+ r = new QRadioButton(tr("Optimize for C++/CLI output"));
+ gbox->addWidget(r,1,0);
+ m_optimizeLangGroup->addButton(r, 1);
+ // 1 -> OPTIMIZE_OUTPUT_FOR_C = NO
+ // OPTIMIZE_OUTPUT_JAVA = NO
+ // OPTIMIZE_FOR_FORTRAN = NO
+ // OPTIMIZE_OUTPUT_VHDL = NO
+ // CPP_CLI_SUPPORT = YES
+ // HIDE_SCOPE_NAMES = NO
+ r = new QRadioButton(tr("Optimize for Java or C# output"));
+ m_optimizeLangGroup->addButton(r, 2);
+ // 2 -> OPTIMIZE_OUTPUT_FOR_C = NO
+ // OPTIMIZE_OUTPUT_JAVA = YES
+ // OPTIMIZE_FOR_FORTRAN = NO
+ // OPTIMIZE_OUTPUT_VHDL = NO
+ // CPP_CLI_SUPPORT = NO
+ // HIDE_SCOPE_NAMES = NO
+ gbox->addWidget(r,2,0);
+ r = new QRadioButton(tr("Optimize for C or PHP output"));
+ m_optimizeLangGroup->addButton(r, 3);
+ // 3 -> OPTIMIZE_OUTPUT_FOR_C = YES
+ // OPTIMIZE_OUTPUT_JAVA = NO
+ // OPTIMIZE_FOR_FORTRAN = NO
+ // OPTIMIZE_OUTPUT_VHDL = NO
+ // CPP_CLI_SUPPORT = NO
+ // HIDE_SCOPE_NAMES = YES
+ gbox->addWidget(r,3,0);
+ r = new QRadioButton(tr("Optimize for Fortran output"));
+ m_optimizeLangGroup->addButton(r, 4);
+ // 4 -> OPTIMIZE_OUTPUT_FOR_C = NO
+ // OPTIMIZE_OUTPUT_JAVA = NO
+ // OPTIMIZE_FOR_FORTRAN = YES
+ // OPTIMIZE_OUTPUT_VHDL = NO
+ // CPP_CLI_SUPPORT = NO
+ // HIDE_SCOPE_NAMES = NO
+ gbox->addWidget(r,4,0);
+ r = new QRadioButton(tr("Optimize for VHDL output"));
+ m_optimizeLangGroup->addButton(r, 5);
+ // 5 -> OPTIMIZE_OUTPUT_FOR_C = NO
+ // OPTIMIZE_OUTPUT_JAVA = NO
+ // OPTIMIZE_FOR_FORTRAN = NO
+ // OPTIMIZE_OUTPUT_VHDL = YES
+ // CPP_CLI_SUPPORT = NO
+ // HIDE_SCOPE_NAMES = NO
+ gbox->addWidget(r,5,0);
+
+ layout->addWidget(m_optimizeLang);
+ layout->addStretch(1);
+
+ connect(m_crossRef,SIGNAL(stateChanged(int)),
+ SLOT(changeCrossRefState(int)));
+ connect(m_optimizeLangGroup,SIGNAL(buttonClicked(int)),
+ SLOT(optimizeFor(int)));
+ connect(m_extractModeGroup,SIGNAL(buttonClicked(int)),
+ SLOT(extractMode(int)));
+}
+
+
+void Step2::optimizeFor(int choice)
+{
+ for (int i=0;i<6;i++)
+ {
+ updateBoolOption(m_modelData,
+ g_optimizeOptionNames[i],
+ g_optimizeMapping[choice][i]);
+ }
+}
+
+void Step2::extractMode(int choice)
+{
+ updateBoolOption(m_modelData,STR_EXTRACT_ALL,choice==1);
+}
+
+void Step2::changeCrossRefState(int choice)
+{
+ updateBoolOption(m_modelData,STR_SOURCE_BROWSER,choice==Qt::Checked);
+}
+
+void Step2::init()
+{
+ m_extractModeGroup->button(
+ getBoolOption(m_modelData,STR_EXTRACT_ALL) ? 1 : 0)->setChecked(true);
+ m_crossRef->setChecked(getBoolOption(m_modelData,STR_SOURCE_BROWSER));
+
+ int x=0;
+ if (getBoolOption(m_modelData,STR_CPP_CLI_SUPPORT)) x=1;
+ else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_JAVA)) x=2;
+ else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_FOR_C)) x=3;
+ else if (getBoolOption(m_modelData,STR_OPTIMIZE_FOR_FORTRAN)) x=4;
+ else if (getBoolOption(m_modelData,STR_OPTIMIZE_OUTPUT_VHDL)) x=5;
+ m_optimizeLangGroup->button(x)->setChecked(true);
+}
+
+//==========================================================================
+
+Step3::Step3(Wizard *wizard,const QHash<QString,Input*> &modelData)
+ : m_wizard(wizard), m_modelData(modelData)
+{
+ QVBoxLayout *vbox = 0;
+ QRadioButton *r = 0;
+
+ QGridLayout *gbox = new QGridLayout( this );
+ gbox->addWidget(new QLabel(tr("Select the output format(s) to generate")),0,0);
+ {
+ m_htmlOptions = new QGroupBox(tr("HTML"));
+ m_htmlOptions->setCheckable(true);
+ // GENERATE_HTML
+ m_htmlOptionsGroup = new QButtonGroup(m_htmlOptions);
+ QRadioButton *r = new QRadioButton(tr("plain HTML"));
+ r->setChecked(true);
+ m_htmlOptionsGroup->addButton(r, 0);
+ vbox = new QVBoxLayout;
+ vbox->addWidget(r);
+ r = new QRadioButton(tr("with frames and a navigation tree"));
+ m_htmlOptionsGroup->addButton(r, 1);
+ // GENERATE_TREEVIEW
+ vbox->addWidget(r);
+ r = new QRadioButton(tr("prepare for compressed HTML (.chm)"));
+ m_htmlOptionsGroup->addButton(r, 2);
+ // GENERATE_HTMLHELP
+ vbox->addWidget(r);
+ m_searchEnabled=new QCheckBox(tr("With search function (requires PHP enabled web server)"));
+ vbox->addWidget(m_searchEnabled);
+ // SEARCH_ENGINE
+ m_htmlOptions->setLayout(vbox);
+ m_htmlOptions->setChecked(true);
+ }
+ gbox->addWidget(m_htmlOptions,1,0);
+
+ {
+ m_texOptions = new QGroupBox(tr("LaTeX"));
+ m_texOptions->setCheckable(true);
+ // GENERATE_LATEX
+ m_texOptionsGroup = new QButtonGroup(m_texOptions);
+ vbox = new QVBoxLayout;
+ r = new QRadioButton(tr("as intermediate format for hyperlinked PDF"));
+ m_texOptionsGroup->addButton(r, 0);
+ // PDF_HYPERLINKS = YES
+ r->setChecked(true);
+ vbox->addWidget(r);
+ r = new QRadioButton(tr("as intermediate format for PDF"));
+ m_texOptionsGroup->addButton(r, 1);
+ // PDF_HYPERLINKS = NO, USE_PDFLATEX = YES
+ vbox->addWidget(r);
+ r = new QRadioButton(tr("as intermediate format for PostScript"));
+ m_texOptionsGroup->addButton(r, 2);
+ // USE_PDFLATEX = NO
+ vbox->addWidget(r);
+ vbox->addStretch(1);
+ m_texOptions->setLayout(vbox);
+ m_texOptions->setChecked(true);
+ }
+ gbox->addWidget(m_texOptions,2,0);
+
+ m_manEnabled=new QCheckBox(tr("Man pages"));
+ // GENERATE_MAN
+ m_rtfEnabled=new QCheckBox(tr("Rich Text Format (RTF)"));
+ // GENERATE_RTF
+ m_xmlEnabled=new QCheckBox(tr("XML"));
+ // GENERATE_XML
+ gbox->addWidget(m_manEnabled,3,0);
+ gbox->addWidget(m_rtfEnabled,4,0);
+ gbox->addWidget(m_xmlEnabled,5,0);
+
+ gbox->setRowStretch(6,1);
+ connect(m_htmlOptions,SIGNAL(toggled(bool)),SLOT(setHtmlEnabled(bool)));
+ connect(m_texOptions,SIGNAL(toggled(bool)),SLOT(setLatexEnabled(bool)));
+ connect(m_manEnabled,SIGNAL(stateChanged(int)),SLOT(setManEnabled(int)));
+ connect(m_rtfEnabled,SIGNAL(stateChanged(int)),SLOT(setRtfEnabled(int)));
+ connect(m_xmlEnabled,SIGNAL(stateChanged(int)),SLOT(setXmlEnabled(int)));
+ connect(m_searchEnabled,SIGNAL(stateChanged(int)),SLOT(setSearchEnabled(int)));
+ connect(m_htmlOptionsGroup,SIGNAL(buttonClicked(int)),
+ SLOT(setHtmlOptions(int)));
+ connect(m_texOptionsGroup,SIGNAL(buttonClicked(int)),
+ SLOT(setLatexOptions(int)));
+}
+
+void Step3::setHtmlEnabled(bool b)
+{
+ updateBoolOption(m_modelData,STR_GENERATE_HTML,b);
+}
+
+void Step3::setLatexEnabled(bool b)
+{
+ updateBoolOption(m_modelData,STR_GENERATE_LATEX,b);
+}
+
+void Step3::setManEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_GENERATE_MAN,state==Qt::Checked);
+}
+
+void Step3::setRtfEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_GENERATE_RTF,state==Qt::Checked);
+}
+
+void Step3::setXmlEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_GENERATE_XML,state==Qt::Checked);
+}
+
+void Step3::setSearchEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_SEARCHENGINE,state==Qt::Checked);
+}
+
+void Step3::setHtmlOptions(int id)
+{
+ if (id==0) // plain HTML
+ {
+ updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false);
+ updateStringOption(m_modelData,STR_GENERATE_TREEVIEW,QString::fromAscii("NONE"));
+ }
+ else if (id==1) // with navigation tree
+ {
+ updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,false);
+ updateStringOption(m_modelData,STR_GENERATE_TREEVIEW,QString::fromAscii("ALL"));
+ }
+ else if (id==2) // with compiled help
+ {
+ updateBoolOption(m_modelData,STR_GENERATE_HTMLHELP,true);
+ updateStringOption(m_modelData,STR_GENERATE_TREEVIEW,QString::fromAscii("NONE"));
+ }
+}
+
+void Step3::setLatexOptions(int id)
+{
+ if (id==0) // hyperlinked PDF
+ {
+ updateBoolOption(m_modelData,STR_USE_PDFLATEX,true);
+ updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,true);
+ }
+ else if (id==1) // PDF
+ {
+ updateBoolOption(m_modelData,STR_USE_PDFLATEX,true);
+ updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false);
+ }
+ else if (id==2) // PostScript
+ {
+ updateBoolOption(m_modelData,STR_USE_PDFLATEX,false);
+ updateBoolOption(m_modelData,STR_PDF_HYPERLINKS,false);
+ }
+}
+
+void Step3::init()
+{
+ m_htmlOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_HTML));
+ m_texOptions->setChecked(getBoolOption(m_modelData,STR_GENERATE_LATEX));
+ m_manEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_MAN));
+ m_rtfEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_RTF));
+ m_xmlEnabled->setChecked(getBoolOption(m_modelData,STR_GENERATE_XML));
+ m_searchEnabled->setChecked(getBoolOption(m_modelData,STR_SEARCHENGINE));
+ if (getBoolOption(m_modelData,STR_GENERATE_HTMLHELP))
+ {
+ m_htmlOptionsGroup->button(2)->setChecked(true); // compiled help
+ }
+ else if (getBoolOption(m_modelData,STR_GENERATE_TREEVIEW))
+ {
+ m_htmlOptionsGroup->button(1)->setChecked(true); // navigation tree
+ }
+ else
+ {
+ m_htmlOptionsGroup->button(0)->setChecked(true); // plain HTML
+ }
+ if (!getBoolOption(m_modelData,STR_USE_PDFLATEX))
+ {
+ m_texOptionsGroup->button(2)->setChecked(true); // PostScript
+ }
+ else if (!getBoolOption(m_modelData,STR_PDF_HYPERLINKS))
+ {
+ m_texOptionsGroup->button(1)->setChecked(true); // Plain PDF
+ }
+ else
+ {
+ m_texOptionsGroup->button(0)->setChecked(true); // PDF with hyperlinks
+ }
+}
+
+//==========================================================================
+
+Step4::Step4(Wizard *wizard,const QHash<QString,Input*> &modelData)
+ : m_wizard(wizard), m_modelData(modelData)
+{
+ m_diagramModeGroup = new QButtonGroup(this);
+ QGridLayout *gbox = new QGridLayout( this );
+ gbox->addWidget(new QLabel(tr("Diagrams to generate")),0,0);
+
+ QRadioButton *rb = new QRadioButton(tr("No diagrams"));
+ m_diagramModeGroup->addButton(rb, 0);
+ gbox->addWidget(rb,1,0);
+ // CLASS_DIAGRAMS = NO, HAVE_DOT = NO
+ rb->setChecked(true);
+ rb = new QRadioButton(tr("Use built-in class diagram generator"));
+ m_diagramModeGroup->addButton(rb, 1);
+ // CLASS_DIAGRAMS = YES, HAVE_DOT = NO
+ gbox->addWidget(rb,2,0);
+ rb = new QRadioButton(tr("Use dot tool from the GraphViz package"));
+ m_diagramModeGroup->addButton(rb, 2);
+ gbox->addWidget(rb,3,0);
+ // CLASS_DIAGRAMS = NO, HAVE_DOT = YES
+
+ m_dotGroup = new QGroupBox(tr("Dot graphs to generate"));
+ QVBoxLayout *vbox = new QVBoxLayout;
+ m_dotClass=new QCheckBox(tr("Class diagrams"));
+ // CLASS_GRAPH
+ m_dotCollaboration=new QCheckBox(tr("Collaboration diagrams"));
+ // COLLABORATION_GRAPH
+ m_dotInheritance=new QCheckBox(tr("Overall Class hierarchy"));
+ // GRAPHICAL_HIERARCHY
+ m_dotInclude=new QCheckBox(tr("Include dependency graphs"));
+ // INCLUDE_GRAPH
+ m_dotIncludedBy=new QCheckBox(tr("Included by dependency graphs"));
+ // INCLUDED_BY_GRAPH
+ m_dotCall=new QCheckBox(tr("Call graphs"));
+ // CALL_GRAPH
+ m_dotCaller=new QCheckBox(tr("Called by graphs"));
+ // CALLER_GRAPH
+ vbox->addWidget(m_dotClass);
+ vbox->addWidget(m_dotCollaboration);
+ vbox->addWidget(m_dotInheritance);
+ vbox->addWidget(m_dotInclude);
+ vbox->addWidget(m_dotIncludedBy);
+ vbox->addWidget(m_dotCall);
+ vbox->addWidget(m_dotCaller);
+ vbox->addStretch(1);
+ m_dotGroup->setLayout(vbox);
+ m_dotClass->setChecked(true);
+ m_dotGroup->setEnabled(false);
+ gbox->addWidget(m_dotGroup,4,0);
+
+ m_dotInclude->setChecked(true);
+ m_dotCollaboration->setChecked(true);
+ gbox->setRowStretch(5,1);
+
+ connect(m_diagramModeGroup,SIGNAL(buttonClicked(int)),
+ this,SLOT(diagramModeChanged(int)));
+ connect(m_dotClass,SIGNAL(stateChanged(int)),
+ this,SLOT(setClassGraphEnabled(int)));
+ connect(m_dotCollaboration,SIGNAL(stateChanged(int)),
+ this,SLOT(setCollaborationGraphEnabled(int)));
+ connect(m_dotInheritance,SIGNAL(stateChanged(int)),
+ this,SLOT(setGraphicalHierarchyEnabled(int)));
+ connect(m_dotInclude,SIGNAL(stateChanged(int)),
+ this,SLOT(setIncludeGraphEnabled(int)));
+ connect(m_dotIncludedBy,SIGNAL(stateChanged(int)),
+ this,SLOT(setIncludedByGraphEnabled(int)));
+ connect(m_dotCall,SIGNAL(stateChanged(int)),
+ this,SLOT(setCallGraphEnabled(int)));
+ connect(m_dotCaller,SIGNAL(stateChanged(int)),
+ this,SLOT(setCallerGraphEnabled(int)));
+}
+
+void Step4::diagramModeChanged(int id)
+{
+ if (id==0) // no diagrams
+ {
+ updateBoolOption(m_modelData,STR_HAVE_DOT,false);
+ updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false);
+ }
+ else if (id==1) // builtin diagrams
+ {
+ updateBoolOption(m_modelData,STR_HAVE_DOT,false);
+ updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,true);
+ }
+ else if (id==2) // dot diagrams
+ {
+ updateBoolOption(m_modelData,STR_HAVE_DOT,true);
+ updateBoolOption(m_modelData,STR_CLASS_DIAGRAMS,false);
+ }
+ m_dotGroup->setEnabled(id==2);
+}
+
+void Step4::setClassGraphEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_CLASS_GRAPH,state==Qt::Checked);
+}
+
+void Step4::setCollaborationGraphEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_COLLABORATION_GRAPH,state==Qt::Checked);
+}
+
+void Step4::setGraphicalHierarchyEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY,state==Qt::Checked);
+}
+
+void Step4::setIncludeGraphEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_INCLUDE_GRAPH,state==Qt::Checked);
+}
+
+void Step4::setIncludedByGraphEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH,state==Qt::Checked);
+}
+
+void Step4::setCallGraphEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_CALL_GRAPH,state==Qt::Checked);
+}
+
+void Step4::setCallerGraphEnabled(int state)
+{
+ updateBoolOption(m_modelData,STR_CALLER_GRAPH,state==Qt::Checked);
+}
+
+void Step4::init()
+{
+ if (getBoolOption(m_modelData,STR_HAVE_DOT))
+ {
+ m_diagramModeGroup->button(2)->setChecked(true); // Dot
+ }
+ else if (getBoolOption(m_modelData,STR_CLASS_DIAGRAMS))
+ {
+ m_diagramModeGroup->button(1)->setChecked(true); // Builtin diagrams
+ }
+ else
+ {
+ m_diagramModeGroup->button(0)->setChecked(true); // no diagrams
+ }
+ m_dotClass->setChecked(getBoolOption(m_modelData,STR_CLASS_GRAPH));
+ m_dotCollaboration->setChecked(getBoolOption(m_modelData,STR_COLLABORATION_GRAPH));
+ m_dotInheritance->setChecked(getBoolOption(m_modelData,STR_GRAPHICAL_HIERARCHY));
+ m_dotInclude->setChecked(getBoolOption(m_modelData,STR_INCLUDE_GRAPH));
+ m_dotIncludedBy->setChecked(getBoolOption(m_modelData,STR_INCLUDED_BY_GRAPH));
+ m_dotCall->setChecked(getBoolOption(m_modelData,STR_CALL_GRAPH));
+ m_dotCaller->setChecked(getBoolOption(m_modelData,STR_CALLER_GRAPH));
+}
+
+//==========================================================================
+
+Wizard::Wizard(const QHash<QString,Input*> &modelData, QWidget *parent) :
+ QSplitter(parent), m_modelData(modelData)
+{
+ m_treeWidget = new QTreeWidget;
+ m_treeWidget->setColumnCount(1);
+ m_treeWidget->setHeaderLabels(QStringList() << QString::fromAscii("Topics"));
+ QList<QTreeWidgetItem*> items;
+ items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Project"))));
+ items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Mode"))));
+ items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Output"))));
+ items.append(new QTreeWidgetItem((QTreeWidget*)0,QStringList(tr("Diagrams"))));
+ m_treeWidget->insertTopLevelItems(0,items);
+
+ m_topicStack = new QStackedWidget;
+ m_step1 = new Step1(this,modelData);
+ m_step2 = new Step2(this,modelData);
+ m_step3 = new Step3(this,modelData);
+ m_step4 = new Step4(this,modelData);
+ m_topicStack->addWidget(m_step1);
+ m_topicStack->addWidget(m_step2);
+ m_topicStack->addWidget(m_step3);
+ m_topicStack->addWidget(m_step4);
+
+ QWidget *rightSide = new QWidget;
+ QGridLayout *grid = new QGridLayout(rightSide);
+ m_prev = new QPushButton(tr("Previous"));
+ m_prev->setEnabled(false);
+ m_next = new QPushButton(tr("Next"));
+ grid->addWidget(m_topicStack,0,0,1,2);
+ grid->addWidget(m_prev,1,0,Qt::AlignLeft);
+ grid->addWidget(m_next,1,1,Qt::AlignRight);
+ grid->setColumnStretch(0,1);
+ grid->setRowStretch(0,1);
+ addWidget(m_treeWidget);
+ addWidget(rightSide);
+
+ connect(m_treeWidget,
+ SIGNAL(currentItemChanged(QTreeWidgetItem *,QTreeWidgetItem *)),
+ SLOT(activateTopic(QTreeWidgetItem *,QTreeWidgetItem *)));
+ connect(m_next,SIGNAL(clicked()),SLOT(nextTopic()));
+ connect(m_prev,SIGNAL(clicked()),SLOT(prevTopic()));
+
+ refresh();
+}
+
+Wizard::~Wizard()
+{
+}
+
+void Wizard::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *)
+{
+ if (item)
+ {
+
+ QString label = item->text(0);
+ if (label==tr("Project"))
+ {
+ m_topicStack->setCurrentWidget(m_step1);
+ m_prev->setEnabled(false);
+ m_next->setEnabled(true);
+ }
+ else if (label==tr("Mode"))
+ {
+ m_topicStack->setCurrentWidget(m_step2);
+ m_prev->setEnabled(true);
+ m_next->setEnabled(true);
+ }
+ else if (label==tr("Output"))
+ {
+ m_topicStack->setCurrentWidget(m_step3);
+ m_prev->setEnabled(true);
+ m_next->setEnabled(true);
+ }
+ else if (label==tr("Diagrams"))
+ {
+ m_topicStack->setCurrentWidget(m_step4);
+ m_prev->setEnabled(true);
+ m_next->setEnabled(false);
+ }
+ }
+}
+
+void Wizard::nextTopic()
+{
+ m_topicStack->setCurrentIndex(m_topicStack->currentIndex()+1);
+ m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);
+ m_prev->setEnabled(m_topicStack->currentIndex()!=0);
+ m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));
+}
+
+void Wizard::prevTopic()
+{
+ m_topicStack->setCurrentIndex(m_topicStack->currentIndex()-1);
+ m_next->setEnabled(m_topicStack->count()!=m_topicStack->currentIndex()+1);
+ m_prev->setEnabled(m_topicStack->currentIndex()!=0);
+ m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(m_topicStack->currentIndex()));
+}
+
+void Wizard::refresh()
+{
+ m_step1->init();
+ m_step2->init();
+ m_step3->init();
+ m_step4->init();
+}
diff --git a/addon/doxywizard/wizard.h b/addon/doxywizard/wizard.h
new file mode 100644
index 0000000..d482db9
--- /dev/null
+++ b/addon/doxywizard/wizard.h
@@ -0,0 +1,182 @@
+/******************************************************************************
+ *
+ *
+ *
+ * Copyright (C) 1997-2007 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
+ * for any purpose. It is provided "as is" without express or implied warranty.
+ * See the GNU General Public License for more details.
+ *
+ */
+
+#ifndef WIZARD_H
+#define WIZARD_H
+
+#include <QSplitter>
+#include <QHash>
+
+class Input;
+class QTreeWidget;
+class QTreeWidgetItem;
+class QStackedWidget;
+class QCheckBox;
+class QLineEdit;
+class QPushButton;
+class QRadioButton;
+class QGroupBox;
+class QButtonGroup;
+class Wizard;
+
+enum OptLang { Lang_Cpp, Lang_C, Lang_Java, Lang_CS };
+enum HtmlStyle { HS_Plain, HS_TreeView, HS_CHM };
+enum TexStyle { TS_PDFHyper, TS_PDF, TS_PS };
+enum DiagramMode { DM_None, DM_Builtin, DM_Dot };
+
+class Step1 : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ Step1(Wizard *parent,const QHash<QString,Input*> &modelData);
+ void init();
+
+ private slots:
+ void selectSourceDir();
+ void selectDestinationDir();
+ void setProjectName(const QString &name);
+ void setProjectNumber(const QString &num);
+ void setSourceDir(const QString &dir);
+ void setDestinationDir(const QString &dir);
+ void setRecursiveScan(int);
+
+ private:
+ QLineEdit *m_projName;
+ QLineEdit *m_projNumber;
+ QLineEdit *m_sourceDir;
+ QLineEdit *m_destDir;
+ QCheckBox *m_recursive;
+ QPushButton *m_srcSelectDir;
+ QPushButton *m_dstSelectDir;
+ Wizard *m_wizard;
+ const QHash<QString,Input *> &m_modelData;
+};
+
+class Step2 : public QWidget
+{
+ Q_OBJECT
+ public:
+ Step2(Wizard *parent,const QHash<QString,Input*> &modelData);
+ void init();
+
+ private slots:
+ void optimizeFor(int choice);
+ void extractMode(int choice);
+ void changeCrossRefState(int choice);
+
+ private:
+ QGroupBox *m_extractMode;
+ QGroupBox *m_optimizeLang;
+ QButtonGroup *m_extractModeGroup;
+ QButtonGroup *m_optimizeLangGroup;
+ QCheckBox *m_crossRef;
+ Wizard *m_wizard;
+ const QHash<QString,Input *> &m_modelData;
+};
+
+class Step3 : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ Step3(Wizard *parent,const QHash<QString,Input*> &modelData);
+ void init();
+
+ private slots:
+ void setHtmlEnabled(bool);
+ void setLatexEnabled(bool);
+ void setManEnabled(int);
+ void setRtfEnabled(int);
+ void setXmlEnabled(int);
+ void setSearchEnabled(int);
+ void setHtmlOptions(int);
+ void setLatexOptions(int);
+
+ private:
+ QGroupBox *m_texOptions;
+ QButtonGroup *m_texOptionsGroup;
+ QGroupBox *m_htmlOptions;
+ QButtonGroup *m_htmlOptionsGroup;
+ QCheckBox *m_htmlEnabled;
+ QCheckBox *m_latexEnabled;
+ QCheckBox *m_manEnabled;
+ QCheckBox *m_rtfEnabled;
+ QCheckBox *m_xmlEnabled;
+ QCheckBox *m_searchEnabled;
+ Wizard *m_wizard;
+ const QHash<QString,Input *> &m_modelData;
+};
+
+class Step4 : public QWidget
+{
+ Q_OBJECT
+
+ public:
+ Step4(Wizard *parent,const QHash<QString,Input*> &modelData);
+ void init();
+
+ private slots:
+ void diagramModeChanged(int);
+ void setClassGraphEnabled(int state);
+ void setCollaborationGraphEnabled(int state);
+ void setGraphicalHierarchyEnabled(int state);
+ void setIncludeGraphEnabled(int state);
+ void setIncludedByGraphEnabled(int state);
+ void setCallGraphEnabled(int state);
+ void setCallerGraphEnabled(int state);
+
+ private:
+ QGroupBox *m_diagramMode;
+ QButtonGroup *m_diagramModeGroup;
+ QGroupBox *m_dotGroup;
+ QCheckBox *m_dotClass;
+ QCheckBox *m_dotCollaboration;
+ QCheckBox *m_dotInclude;
+ QCheckBox *m_dotIncludedBy;
+ QCheckBox *m_dotInheritance;
+ QCheckBox *m_dotCall;
+ QCheckBox *m_dotCaller;
+ Wizard *m_wizard;
+ const QHash<QString,Input *> &m_modelData;
+};
+
+class Wizard : public QSplitter
+{
+ Q_OBJECT
+ public:
+ Wizard(const QHash<QString,Input*> &modelData, QWidget *parent=0);
+ ~Wizard();
+
+ public slots:
+ void refresh();
+
+ private slots:
+ void activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *);
+ void nextTopic();
+ void prevTopic();
+
+ private:
+ const QHash<QString,Input *> &m_modelData;
+ QTreeWidget *m_treeWidget;
+ QStackedWidget *m_topicStack;
+ Step1 *m_step1;
+ Step2 *m_step2;
+ Step3 *m_step3;
+ Step4 *m_step4;
+ QPushButton *m_next;
+ QPushButton *m_prev;
+};
+
+#endif