Public Slots | Public Member Functions | Static Public Member Functions | Private Slots | Private Member Functions | Private Attributes | List of all members
MainWindow Class Reference

#include <doxywizard.h>

Inheritance diagram for MainWindow:

Public Slots

void manual ()
 
void about ()
 
void openConfig ()
 
bool saveConfig ()
 
bool saveConfigAs ()
 
void makeDefaults ()
 
void resetToDefaults ()
 
void selectTab (int)
 
void quit ()
 

Public Member Functions

void loadConfigFromFile (const QString &fileName)
 
void loadSettings ()
 
void saveSettings ()
 
void closeEvent (QCloseEvent *event)
 
QString configFileName () const
 
void updateTitle ()
 

Static Public Member Functions

static MainWindowinstance ()
 

Private Slots

void openRecent (QAction *action)
 
void selectWorkingDir ()
 
void updateWorkingDir ()
 
void runDoxygen ()
 
void readStdout ()
 
void runComplete ()
 
void showHtmlOutput ()
 
void saveLog ()
 
void showSettings ()
 
void configChanged ()
 
void clearRecent ()
 
void selectRunTab ()
 

Private Member Functions

 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)
 

Private Attributes

QLineEdit * m_workingDir
 
QPushButton * m_selWorkingDir
 
QPushButton * m_run
 
QPushButton * m_saveLog
 
QPushButton * m_launchHtml
 
QPushButton * m_launchPdf
 
QTextEdit * m_outputLog
 
QLabel * m_runStatus
 
Expertm_expert
 
Wizardm_wizard
 
QString m_fileName
 
QSettings m_settings
 
QMenu * m_recentMenu
 
QStringList m_recentFiles
 
QProcess * m_runProcess
 
QTimer * m_timer
 
QTabWidget * m_tabs
 
bool m_running
 
bool m_modified
 

Detailed Description

Definition at line 19 of file doxywizard.h.

Constructor & Destructor Documentation

MainWindow::MainWindow ( )
private

Definition at line 40 of file doxywizard.cpp.

41  : m_settings(QString::fromLatin1("Doxygen.org"), QString::fromLatin1("Doxywizard"))
42 {
43  QMenu *file = menuBar()->addMenu(tr("File"));
44  file->addAction(tr("Open..."),
45  this, SLOT(openConfig()), Qt::CTRL+Qt::Key_O);
46  m_recentMenu = file->addMenu(tr("Open recent"));
47  file->addAction(tr("Save"),
48  this, SLOT(saveConfig()), Qt::CTRL+Qt::Key_S);
49  file->addAction(tr("Save as..."),
50  this, SLOT(saveConfigAs()), Qt::SHIFT+Qt::CTRL+Qt::Key_S);
51  file->addAction(tr("Quit"),
52  this, SLOT(quit()), Qt::CTRL+Qt::Key_Q);
53 
54  QMenu *settings = menuBar()->addMenu(tr("Settings"));
55  settings->addAction(tr("Reset to factory defaults"),
56  this,SLOT(resetToDefaults()));
57  settings->addAction(tr("Use current settings at startup"),
58  this,SLOT(makeDefaults()));
59  settings->addAction(tr("Clear recent list"),
60  this,SLOT(clearRecent()));
61 
62  QMenu *help = menuBar()->addMenu(tr("Help"));
63  help->addAction(tr("Online manual"),
64  this, SLOT(manual()), Qt::Key_F1);
65  help->addAction(tr("About"),
66  this, SLOT(about()) );
67 
68  m_expert = new Expert;
70 
71  // ----------- top part ------------------
72  QWidget *topPart = new QWidget;
73  QVBoxLayout *rowLayout = new QVBoxLayout(topPart);
74 
75  // select working directory
76  QHBoxLayout *dirLayout = new QHBoxLayout;
77  m_workingDir = new QLineEdit;
78  m_selWorkingDir = new QPushButton(tr("Select..."));
79  dirLayout->addWidget(m_workingDir);
80  dirLayout->addWidget(m_selWorkingDir);
81 
82  //------------- bottom part --------------
83  QWidget *runTab = new QWidget;
84  QVBoxLayout *runTabLayout = new QVBoxLayout(runTab);
85 
86  // run doxygen
87  QHBoxLayout *runLayout = new QHBoxLayout;
88  m_run = new QPushButton(tr("Run doxygen"));
89  m_run->setEnabled(false);
90  m_runStatus = new QLabel(tr("Status: not running"));
91  m_saveLog = new QPushButton(tr("Save log..."));
92  m_saveLog->setEnabled(false);
93  QPushButton *showSettings = new QPushButton(tr("Show configuration"));
94  runLayout->addWidget(m_run);
95  runLayout->addWidget(m_runStatus);
96  runLayout->addStretch(1);
97  runLayout->addWidget(showSettings);
98  runLayout->addWidget(m_saveLog);
99 
100  // output produced by Doxygen
101  runTabLayout->addLayout(runLayout);
102  runTabLayout->addWidget(new QLabel(tr("Output produced by doxygen")));
103  QGridLayout *grid = new QGridLayout;
104  m_outputLog = new QTextEdit;
105  m_outputLog->setReadOnly(true);
106  m_outputLog->setFontFamily(QString::fromLatin1("courier"));
107  m_outputLog->setMinimumWidth(600);
108  grid->addWidget(m_outputLog,0,0);
109  grid->setColumnStretch(0,1);
110  grid->setRowStretch(0,1);
111  QHBoxLayout *launchLayout = new QHBoxLayout;
112  m_launchHtml = new QPushButton(tr("Show HTML output"));
113  launchLayout->addWidget(m_launchHtml);
114 
115  launchLayout->addStretch(1);
116  grid->addLayout(launchLayout,1,0);
117  runTabLayout->addLayout(grid);
118 
119  m_tabs = new QTabWidget;
120  m_tabs->addTab(m_wizard,tr("Wizard"));
121  m_tabs->addTab(m_expert,tr("Expert"));
122  m_tabs->addTab(runTab,tr("Run"));
123 
124  rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run")));
125  rowLayout->addLayout(dirLayout);
126  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")));
127  rowLayout->addWidget(m_tabs);
128 
129  setCentralWidget(topPart);
130  statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout);
131 
132  m_runProcess = new QProcess;
133  m_running = false;
134  m_timer = new QTimer;
135 
136  // connect signals and slots
137  connect(m_tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int)));
138  connect(m_selWorkingDir,SIGNAL(clicked()),SLOT(selectWorkingDir()));
139  connect(m_recentMenu,SIGNAL(triggered(QAction*)),SLOT(openRecent(QAction*)));
140  connect(m_workingDir,SIGNAL(returnPressed()),SLOT(updateWorkingDir()));
141  connect(m_runProcess,SIGNAL(readyReadStandardOutput()),SLOT(readStdout()));
142  connect(m_runProcess,SIGNAL(finished(int, QProcess::ExitStatus)),SLOT(runComplete()));
143  connect(m_timer,SIGNAL(timeout()),SLOT(readStdout()));
144  connect(m_run,SIGNAL(clicked()),SLOT(runDoxygen()));
145  connect(m_launchHtml,SIGNAL(clicked()),SLOT(showHtmlOutput()));
146  connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog()));
147  connect(showSettings,SIGNAL(clicked()),SLOT(showSettings()));
148  connect(m_expert,SIGNAL(changed()),SLOT(configChanged()));
149  connect(m_wizard,SIGNAL(done()),SLOT(selectRunTab()));
150  connect(m_expert,SIGNAL(done()),SLOT(selectRunTab()));
151 
152  loadSettings();
154  m_modified = false;
155  updateTitle();
156  m_wizard->refresh();
157 }
void loadSettings()
Definition: doxywizard.cpp:351
bool saveConfig()
Definition: doxywizard.cpp:279
QSettings m_settings
Definition: doxywizard.h:77
QPushButton * m_selWorkingDir
Definition: doxywizard.h:67
Definition: expert.h:19
void updateTitle()
Definition: doxywizard.cpp:606
void refresh()
Definition: wizard.cpp:1341
QPushButton * m_launchHtml
Definition: doxywizard.h:70
void about()
Definition: doxywizard.cpp:208
void updateLaunchButtonState()
Definition: doxywizard.cpp:544
void openConfig()
Definition: doxywizard.cpp:220
const int messageTimeout
status bar message timeout in milliseconds.
Definition: doxywizard.cpp:32
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
void clearRecent()
Definition: doxywizard.cpp:316
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
Definition: graph.py:30
const QHash< QString, Input * > & modelData() const
Definition: expert.h:32
void manual()
Definition: doxywizard.cpp:203
QPushButton * m_run
Definition: doxywizard.h:68
QTabWidget * m_tabs
Definition: doxywizard.h:82
Definition: wizard.h:226
void selectTab(int)
Definition: doxywizard.cpp:392
Wizard * m_wizard
Definition: doxywizard.h:75
void makeDefaults()
Definition: doxywizard.cpp:301
void saveLog()
Definition: doxywizard.cpp:567
void showSettings()
Definition: doxywizard.cpp:589
QMenu * m_recentMenu
Definition: doxywizard.h:78
QPushButton * m_saveLog
Definition: doxywizard.h:69
void resetToDefaults()
Definition: doxywizard.cpp:335
QTextEdit * m_outputLog
Definition: doxywizard.h:72
void openRecent(QAction *action)
Definition: doxywizard.cpp:431
void runDoxygen()
Definition: doxywizard.cpp:439
void selectRunTab()
Definition: doxywizard.cpp:398
void readStdout()
Definition: doxywizard.cpp:512
void updateWorkingDir()
Definition: doxywizard.cpp:198
void runComplete()
Definition: doxywizard.cpp:525
QLineEdit * m_workingDir
Definition: doxywizard.h:66
void showHtmlOutput()
Definition: doxywizard.cpp:552
void configChanged()
Definition: doxywizard.cpp:600
void quit()
Definition: doxywizard.cpp:172
bool m_modified
Definition: doxywizard.h:84
QProcess * m_runProcess
Definition: doxywizard.h:80
QLabel * m_runStatus
Definition: doxywizard.h:73
bool m_running
Definition: doxywizard.h:83
bool saveConfigAs()
Definition: doxywizard.cpp:292
QTimer * m_timer
Definition: doxywizard.h:81
void selectWorkingDir()
Definition: doxywizard.cpp:188
Expert * m_expert
Definition: doxywizard.h:74

Member Function Documentation

void MainWindow::about ( )
slot

Definition at line 208 of file doxywizard.cpp.

209 {
210  QString msg;
211  QTextStream t(&msg,QIODevice::WriteOnly);
212  t << QString::fromLatin1("<qt><center>A tool to configure and run doxygen version ")+
214  QString::fromLatin1(" on your source files.</center><p><br>"
215  "<center>Written by<br> Dimitri van Heesch<br>&copy; 2000-2015</center><p>"
216  "</qt>");
217  QMessageBox::about(this,tr("Doxygen GUI"),msg);
218 }
void msg(const char *fmt,...)
Definition: message.cpp:107
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
char versionString[]
Definition: version.cpp:1
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
void MainWindow::addRecentFile ( const QString fileName)
private

Definition at line 403 of file doxywizard.cpp.

404 {
405  int i=m_recentFiles.indexOf(fileName);
406  if (i!=-1) m_recentFiles.removeAt(i);
407 
408  // not found
409  if (m_recentFiles.count() < MAX_RECENT_FILES) // append
410  {
411  m_recentFiles.prepend(fileName);
412  }
413  else // add + drop last item
414  {
415  m_recentFiles.removeLast();
416  m_recentFiles.prepend(fileName);
417  }
418  m_recentMenu->clear();
419  i=0;
420  foreach( QString str, m_recentFiles )
421  {
422  m_recentMenu->addAction(str);
423  m_settings.setValue(QString().sprintf("recent/config%d",i++),str);
424  }
425  for (;i<MAX_RECENT_FILES;i++)
426  {
427  m_settings.setValue(QString().sprintf("recent/config%d",i++),QString::fromLatin1(""));
428  }
429 }
QSettings m_settings
Definition: doxywizard.h:77
Iterator prepend(const T &x)
Definition: qvaluelist.h:373
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
uint count() const
Definition: qvaluelist.h:394
QMenu * m_recentMenu
Definition: doxywizard.h:78
#define MAX_RECENT_FILES
Definition: doxywizard.cpp:30
QStringList m_recentFiles
Definition: doxywizard.h:79
static QCString str
void MainWindow::clearRecent ( )
privateslot

Definition at line 316 of file doxywizard.cpp.

317 {
318  if (QMessageBox::question(this,tr("Clear the list of recent files?"),
319  tr("Do you want to clear the list of recently "
320  "loaded configuration files?"),
321  QMessageBox::Yes|
322  QMessageBox::Cancel)==QMessageBox::Yes)
323  {
324  m_recentMenu->clear();
326  for (int i=0;i<MAX_RECENT_FILES;i++)
327  {
328  m_settings.setValue(QString().sprintf("recent/config%d",i++),QString::fromLatin1(""));
329  }
330  m_settings.sync();
331  }
332 
333 }
QSettings m_settings
Definition: doxywizard.h:77
void clear()
Definition: qvaluelist.h:396
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
QMenu * m_recentMenu
Definition: doxywizard.h:78
#define MAX_RECENT_FILES
Definition: doxywizard.cpp:30
QStringList m_recentFiles
Definition: doxywizard.h:79
void MainWindow::closeEvent ( QCloseEvent *  event)

Definition at line 159 of file doxywizard.cpp.

160 {
161  if (discardUnsavedChanges())
162  {
163  saveSettings();
164  event->accept();
165  }
166  else
167  {
168  event->ignore();
169  }
170 }
void saveSettings()
Definition: doxywizard.cpp:382
bool discardUnsavedChanges(bool saveOption=true)
Definition: doxywizard.cpp:620
void MainWindow::configChanged ( )
privateslot

Definition at line 600 of file doxywizard.cpp.

601 {
602  m_modified = true;
603  updateTitle();
604 }
void updateTitle()
Definition: doxywizard.cpp:606
bool m_modified
Definition: doxywizard.h:84
QString MainWindow::configFileName ( ) const
inline

Definition at line 29 of file doxywizard.h.

29 { return m_fileName; }
QString m_fileName
Definition: doxywizard.h:76
bool MainWindow::discardUnsavedChanges ( bool  saveOption = true)
private

Definition at line 620 of file doxywizard.cpp.

621 {
622  if (m_modified)
623  {
624  QMessageBox::StandardButton button;
625  if (saveOption)
626  {
627  button = QMessageBox::question(this,
628  tr("Unsaved changes"),
629  tr("Unsaved changes will be lost! Do you want to save the configuration file?"),
630  QMessageBox::Save |
631  QMessageBox::Discard |
632  QMessageBox::Cancel
633  );
634  if (button==QMessageBox::Save)
635  {
636  return saveConfig();
637  }
638  }
639  else
640  {
641  button = QMessageBox::question(this,
642  tr("Unsaved changes"),
643  tr("Unsaved changes will be lost! Do you want to continue?"),
644  QMessageBox::Discard |
645  QMessageBox::Cancel
646  );
647  }
648  return button==QMessageBox::Discard;
649  }
650  return true;
651 }
bool saveConfig()
Definition: doxywizard.cpp:279
bool m_modified
Definition: doxywizard.h:84
MainWindow & MainWindow::instance ( )
static

Definition at line 34 of file doxywizard.cpp.

35 {
36  static MainWindow *theInstance = new MainWindow;
37  return *theInstance;
38 }
void MainWindow::loadConfigFromFile ( const QString fileName)

Definition at line 246 of file doxywizard.cpp.

247 {
248  // save full path info of original file
249  QString absFileName = QFileInfo(fileName).absoluteFilePath();
250  // updates the current directory
251  updateConfigFileName(fileName);
252  // open the specified configuration file
253  m_expert->loadConfig(absFileName);
254  m_wizard->refresh();
256  m_modified = false;
257  updateTitle();
258 }
void updateTitle()
Definition: doxywizard.cpp:606
void refresh()
Definition: wizard.cpp:1341
void updateLaunchButtonState()
Definition: doxywizard.cpp:544
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
void updateConfigFileName(const QString &fileName)
Definition: doxywizard.cpp:234
Wizard * m_wizard
Definition: doxywizard.h:75
void loadConfig(const QString &fileName)
Definition: expert.cpp:733
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
bool m_modified
Definition: doxywizard.h:84
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::loadSettings ( )

Definition at line 351 of file doxywizard.cpp.

352 {
353  QVariant geometry = m_settings.value(QString::fromLatin1("main/geometry"), QVariant::Invalid);
354  QVariant state = m_settings.value(QString::fromLatin1("main/state"), QVariant::Invalid);
355  QVariant wizState = m_settings.value(QString::fromLatin1("wizard/state"), QVariant::Invalid);
356  QVariant loadSettings = m_settings.value(QString::fromLatin1("wizard/loadsettings"), QVariant::Invalid);
357  QVariant workingDir = m_settings.value(QString::fromLatin1("wizard/workingdir"), QVariant::Invalid);
358 
359  if (geometry !=QVariant::Invalid) restoreGeometry(geometry.toByteArray());
360  if (state !=QVariant::Invalid) restoreState (state.toByteArray());
361  if (wizState !=QVariant::Invalid) m_wizard->restoreState(wizState.toByteArray());
362  if (loadSettings!=QVariant::Invalid && loadSettings.toBool())
363  {
365  if (workingDir!=QVariant::Invalid && QDir(workingDir.toString()).exists())
366  {
367  setWorkingDir(workingDir.toString());
368  }
369  }
370 
371  for (int i=0;i<MAX_RECENT_FILES;i++)
372  {
373  QString entry = m_settings.value(QString().sprintf("recent/config%d",i)).toString();
374  if (!entry.isEmpty() && QFileInfo(entry).exists())
375  {
376  addRecentFile(entry);
377  }
378  }
379 
380 }
Traverses directory structures and contents in a platform-independent way.
Definition: qdir.h:52
void loadSettings()
Definition: doxywizard.cpp:351
QSettings m_settings
Definition: doxywizard.h:77
bool isEmpty() const
Definition: qstring.h:682
QList< Entry > entry
void setWorkingDir(const QString &dirName)
Definition: doxywizard.cpp:181
void addRecentFile(const QString &fileName)
Definition: doxywizard.cpp:403
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
bool exists(std::string path)
Wizard * m_wizard
Definition: doxywizard.h:75
void loadSettings(QSettings *)
Definition: expert.cpp:703
#define MAX_RECENT_FILES
Definition: doxywizard.cpp:30
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
bool exists() const
Definition: qfileinfo.cpp:265
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::makeDefaults ( )
slot

Definition at line 301 of file doxywizard.cpp.

302 {
303  if (QMessageBox::question(this,tr("Use current setting at startup?"),
304  tr("Do you want to save the current settings "
305  "and use them next time Doxywizard starts?"),
306  QMessageBox::Save|
307  QMessageBox::Cancel)==QMessageBox::Save)
308  {
309  //printf("MainWindow:makeDefaults()\n");
311  m_settings.setValue(QString::fromLatin1("wizard/loadsettings"), true);
312  m_settings.sync();
313  }
314 }
QSettings m_settings
Definition: doxywizard.h:77
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
void saveSettings(QSettings *)
Definition: expert.cpp:719
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::manual ( )
slot

Definition at line 203 of file doxywizard.cpp.

204 {
205  QDesktopServices::openUrl(QUrl(QString::fromLatin1("http://www.doxygen.org/manual.html")));
206 }
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
void MainWindow::openConfig ( )
slot

Definition at line 220 of file doxywizard.cpp.

221 {
222  if (discardUnsavedChanges(false))
223  {
224  QString fn = QFileDialog::getOpenFileName(this,
225  tr("Open configuration file"),
226  m_workingDir->text());
227  if (!fn.isEmpty())
228  {
229  loadConfigFromFile(fn);
230  }
231  }
232 }
bool isEmpty() const
Definition: qstring.h:682
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QAsciiDict< Entry > fn
void loadConfigFromFile(const QString &fileName)
Definition: doxywizard.cpp:246
QLineEdit * m_workingDir
Definition: doxywizard.h:66
bool discardUnsavedChanges(bool saveOption=true)
Definition: doxywizard.cpp:620
void MainWindow::openRecent ( QAction *  action)
privateslot

Definition at line 431 of file doxywizard.cpp.

432 {
433  if (discardUnsavedChanges(false))
434  {
435  loadConfigFromFile(action->text());
436  }
437 }
void loadConfigFromFile(const QString &fileName)
Definition: doxywizard.cpp:246
bool discardUnsavedChanges(bool saveOption=true)
Definition: doxywizard.cpp:620
void MainWindow::quit ( )
slot

Definition at line 172 of file doxywizard.cpp.

173 {
174  if (discardUnsavedChanges())
175  {
176  saveSettings();
177  }
178  QApplication::exit(0);
179 }
void saveSettings()
Definition: doxywizard.cpp:382
bool discardUnsavedChanges(bool saveOption=true)
Definition: doxywizard.cpp:620
void MainWindow::readStdout ( )
privateslot

Definition at line 512 of file doxywizard.cpp.

513 {
514  if (m_running)
515  {
516  QByteArray data = m_runProcess->readAllStandardOutput();
517  QString text = QString::fromUtf8(data);
518  if (!text.isEmpty())
519  {
520  m_outputLog->append(text.trimmed());
521  }
522  }
523 }
bool isEmpty() const
Definition: qstring.h:682
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromUtf8(const char *, int len=-1)
Definition: qstring.cpp:14523
QTextEdit * m_outputLog
Definition: doxywizard.h:72
QProcess * m_runProcess
Definition: doxywizard.h:80
bool m_running
Definition: doxywizard.h:83
void MainWindow::resetToDefaults ( )
slot

Definition at line 335 of file doxywizard.cpp.

336 {
337  if (QMessageBox::question(this,tr("Reset settings to their default values?"),
338  tr("Do you want to revert all settings back "
339  "to their original values?"),
340  QMessageBox::Reset|
341  QMessageBox::Cancel)==QMessageBox::Reset)
342  {
343  //printf("MainWindow:resetToDefaults()\n");
345  m_settings.setValue(QString::fromLatin1("wizard/loadsettings"), false);
346  m_settings.sync();
347  m_wizard->refresh();
348  }
349 }
QSettings m_settings
Definition: doxywizard.h:77
void refresh()
Definition: wizard.cpp:1341
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
Wizard * m_wizard
Definition: doxywizard.h:75
void resetToDefaults()
Definition: expert.cpp:861
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::runComplete ( )
privateslot

Definition at line 525 of file doxywizard.cpp.

526 {
527  if (m_running)
528  {
529  m_outputLog->append(tr("*** Doxygen has finished\n"));
530  }
531  else
532  {
533  m_outputLog->append(tr("*** Cancelled by user\n"));
534  }
535  m_outputLog->ensureCursorVisible();
536  m_run->setText(tr("Run doxygen"));
537  m_runStatus->setText(tr("Status: not running"));
538  m_running=false;
540  //updateRunnable(m_workingDir->text());
541  m_saveLog->setEnabled(true);
542 }
void updateLaunchButtonState()
Definition: doxywizard.cpp:544
QPushButton * m_run
Definition: doxywizard.h:68
QPushButton * m_saveLog
Definition: doxywizard.h:69
QTextEdit * m_outputLog
Definition: doxywizard.h:72
QLabel * m_runStatus
Definition: doxywizard.h:73
bool m_running
Definition: doxywizard.h:83
void MainWindow::runDoxygen ( )
privateslot

Definition at line 439 of file doxywizard.cpp.

440 {
441  if (!m_running)
442  {
443  QString doxygenPath;
444 #if defined(Q_OS_MACX)
445  doxygenPath = qApp->applicationDirPath()+QString::fromLatin1("/../Resources/");
446  qDebug() << tr("Doxygen path: ") << doxygenPath;
447  if ( !QFile(doxygenPath + QString::fromLatin1("doxygen")).exists() )
448  {
449  // No Doxygen binary in the resources, if there is a system Doxygen binary, use that instead
450  if ( QFile(QString::fromLatin1("/usr/local/bin/doxygen")).exists() )
451  {
452  doxygenPath = QString::fromLatin1("/usr/local/bin/");
453  }
454  else
455  {
456  qDebug() << tr("Can't find the doxygen command, make sure it's in your $$PATH");
457  doxygenPath = QString::fromLatin1("");
458  }
459  }
460  qDebug() << tr("Getting doxygen from: ") << doxygenPath;
461 #endif
462 
463  m_runProcess->setReadChannel(QProcess::StandardOutput);
464  m_runProcess->setProcessChannelMode(QProcess::MergedChannels);
465  m_runProcess->setWorkingDirectory(m_workingDir->text());
466  QStringList env=QProcess::systemEnvironment();
467  // set PWD environment variable to m_workingDir
468  env.replaceInStrings(QRegExp(QString::fromLatin1("^PWD=(.*)"),Qt::CaseInsensitive),
469  QString::fromLatin1("PWD=")+m_workingDir->text());
470  m_runProcess->setEnvironment(env);
471 
473  args << QString::fromLatin1("-b"); // make stdout unbuffered
474  args << QString::fromLatin1("-"); // read config from stdin
475 
476  m_outputLog->clear();
477  m_runProcess->start(doxygenPath + QString::fromLatin1("doxygen"), args);
478 
479  if (!m_runProcess->waitForStarted())
480  {
481  m_outputLog->append(QString::fromLatin1("*** Failed to run doxygen\n"));
482  return;
483  }
485  m_expert->writeConfig(t,false);
486  m_runProcess->closeWriteChannel();
487 
488  if (m_runProcess->state() == QProcess::NotRunning)
489  {
490  m_outputLog->append(QString::fromLatin1("*** Failed to run doxygen\n"));
491  }
492  else
493  {
494  m_saveLog->setEnabled(false);
495  m_running=true;
496  m_run->setText(tr("Stop doxygen"));
497  m_runStatus->setText(tr("Status: running"));
498  m_timer->start(1000);
499  }
500  }
501  else
502  {
503  m_running=false;
504  m_run->setText(tr("Run doxygen"));
505  m_runStatus->setText(tr("Status: not running"));
506  m_runProcess->kill();
507  m_timer->stop();
508  //updateRunnable(m_workingDir->text());
509  }
510 }
void qDebug(const char *msg,...)
Definition: qglobal.cpp:376
bool writeConfig(QTextStream &t, bool brief)
Definition: expert.cpp:780
The QRegExp class provides pattern matching using regular expressions or wildcards.
Definition: qregexp.h:46
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
static QCString args
Definition: declinfo.cpp:674
bool exists(std::string path)
QPushButton * m_run
Definition: doxywizard.h:68
A list of strings.
Definition: qstringlist.h:51
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
QPushButton * m_saveLog
Definition: doxywizard.h:69
QTextEdit * m_outputLog
Definition: doxywizard.h:72
QLineEdit * m_workingDir
Definition: doxywizard.h:66
QProcess * m_runProcess
Definition: doxywizard.h:80
QLabel * m_runStatus
Definition: doxywizard.h:73
bool m_running
Definition: doxywizard.h:83
QTimer * m_timer
Definition: doxywizard.h:81
Expert * m_expert
Definition: doxywizard.h:74
bool MainWindow::saveConfig ( )
slot

Definition at line 279 of file doxywizard.cpp.

280 {
281  if (m_fileName.isEmpty())
282  {
283  return saveConfigAs();
284  }
285  else
286  {
288  return true;
289  }
290 }
bool saveConfig()
Definition: doxywizard.cpp:279
bool isEmpty() const
Definition: qstring.h:682
QString m_fileName
Definition: doxywizard.h:76
bool saveConfigAs()
Definition: doxywizard.cpp:292
void MainWindow::saveConfig ( const QString fileName)
private

Definition at line 260 of file doxywizard.cpp.

261 {
262  if (fileName.isEmpty()) return;
263  QFile f(fileName);
264  if (!f.open(QIODevice::WriteOnly))
265  {
267  tr("Error saving"),
268  tr("Error: cannot open the file ")+fileName+tr(" for writing!\n")+
269  tr("Reason given: ")+f.error());
270  return;
271  }
272  QTextStream t(&f);
273  m_expert->writeConfig(t,false);
274  updateConfigFileName(fileName);
275  m_modified = false;
276  updateTitle();
277 }
bool isEmpty() const
Definition: qstring.h:682
bool writeConfig(QTextStream &t, bool brief)
Definition: expert.cpp:780
void updateTitle()
Definition: doxywizard.cpp:606
void updateConfigFileName(const QString &fileName)
Definition: doxywizard.cpp:234
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
bool m_modified
Definition: doxywizard.h:84
Expert * m_expert
Definition: doxywizard.h:74
bool MainWindow::saveConfigAs ( )
slot

Definition at line 292 of file doxywizard.cpp.

293 {
294  QString fileName = QFileDialog::getSaveFileName(this, QString(),
295  m_workingDir->text()+QString::fromLatin1("/Doxyfile"));
296  if (fileName.isEmpty()) return false;
297  saveConfig(fileName);
298  return true;
299 }
bool saveConfig()
Definition: doxywizard.cpp:279
bool isEmpty() const
Definition: qstring.h:682
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
fileName
Definition: dumpTree.py:9
QLineEdit * m_workingDir
Definition: doxywizard.h:66
void MainWindow::saveLog ( )
privateslot

Definition at line 567 of file doxywizard.cpp.

568 {
569  QString fn = QFileDialog::getSaveFileName(this, tr("Save log file"),
570  m_workingDir->text()+
571  QString::fromLatin1("/doxygen_log.txt"));
572  if (!fn.isEmpty())
573  {
574  QFile f(fn);
575  if (f.open(QIODevice::WriteOnly))
576  {
577  QTextStream t(&f);
578  t << m_outputLog->toPlainText();
579  statusBar()->showMessage(tr("Output log saved"),messageTimeout);
580  }
581  else
582  {
583  QMessageBox::warning(0,tr("Warning"),
584  tr("Cannot open file ")+fn+tr(" for writing. Nothing saved!"),tr("ok"));
585  }
586  }
587 }
bool isEmpty() const
Definition: qstring.h:682
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
const int messageTimeout
status bar message timeout in milliseconds.
Definition: doxywizard.cpp:32
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
QAsciiDict< Entry > fn
The QFile class is an I/O device that operates on files.
Definition: qfile.h:50
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
QTextEdit * m_outputLog
Definition: doxywizard.h:72
QLineEdit * m_workingDir
Definition: doxywizard.h:66
void MainWindow::saveSettings ( )

Definition at line 382 of file doxywizard.cpp.

383 {
384  QSettings settings(QString::fromLatin1("Doxygen.org"), QString::fromLatin1("Doxywizard"));
385 
386  m_settings.setValue(QString::fromLatin1("main/geometry"), saveGeometry());
387  m_settings.setValue(QString::fromLatin1("main/state"), saveState());
388  m_settings.setValue(QString::fromLatin1("wizard/state"), m_wizard->saveState());
389  m_settings.setValue(QString::fromLatin1("wizard/workingdir"), m_workingDir->text());
390 }
QSettings m_settings
Definition: doxywizard.h:77
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
Wizard * m_wizard
Definition: doxywizard.h:75
QLineEdit * m_workingDir
Definition: doxywizard.h:66
void MainWindow::selectRunTab ( )
privateslot

Definition at line 398 of file doxywizard.cpp.

399 {
400  m_tabs->setCurrentIndex(2);
401 }
QTabWidget * m_tabs
Definition: doxywizard.h:82
void MainWindow::selectTab ( int  id)
slot

Definition at line 392 of file doxywizard.cpp.

393 {
394  if (id==0) m_wizard->refresh();
395  else if (id==1) m_expert->refresh();
396 }
void refresh()
Definition: expert.cpp:954
void refresh()
Definition: wizard.cpp:1341
Wizard * m_wizard
Definition: doxywizard.h:75
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::selectWorkingDir ( )
privateslot

Definition at line 188 of file doxywizard.cpp.

189 {
190  QString dirName = QFileDialog::getExistingDirectory(this,
191  tr("Select working directory"),m_workingDir->text());
192  if (!dirName.isEmpty())
193  {
194  setWorkingDir(dirName);
195  }
196 }
bool isEmpty() const
Definition: qstring.h:682
void setWorkingDir(const QString &dirName)
Definition: doxywizard.cpp:181
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QLineEdit * m_workingDir
Definition: doxywizard.h:66
void MainWindow::setWorkingDir ( const QString dirName)
private

Definition at line 181 of file doxywizard.cpp.

182 {
183  QDir::setCurrent(dirName);
184  m_workingDir->setText(dirName);
185  m_run->setEnabled(!dirName.isEmpty());
186 }
bool isEmpty() const
Definition: qstring.h:682
QPushButton * m_run
Definition: doxywizard.h:68
QLineEdit * m_workingDir
Definition: doxywizard.h:66
static bool setCurrent(const QString &path)
Definition: qdir_unix.cpp:134
void MainWindow::showHtmlOutput ( )
privateslot

Definition at line 552 of file doxywizard.cpp.

553 {
554  QString indexFile = m_expert->getHtmlOutputIndex(m_workingDir->text());
555  QFileInfo fi(indexFile);
556  // TODO: the following doesn't seem to work with IE
557 #ifdef WIN32
558  //QString indexUrl(QString::fromLatin1("file:///"));
559  ShellExecute(NULL, L"open", (LPCWSTR)fi.absoluteFilePath().utf16(), NULL, NULL, SW_SHOWNORMAL);
560 #else
561  QString indexUrl(QString::fromLatin1("file://"));
562  indexUrl+=fi.absoluteFilePath();
563  QDesktopServices::openUrl(QUrl(indexUrl));
564 #endif
565 }
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QString getHtmlOutputIndex(const QString &workingDir) const
Definition: expert.cpp:907
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
QLineEdit * m_workingDir
Definition: doxywizard.h:66
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::showSettings ( )
privateslot

Definition at line 589 of file doxywizard.cpp.

590 {
591  QString text;
592  QTextStream t(&text);
593  m_expert->writeConfig(t,true);
594  m_outputLog->clear();
595  m_outputLog->append(text);
596  m_outputLog->ensureCursorVisible();
597  m_saveLog->setEnabled(true);
598 }
bool writeConfig(QTextStream &t, bool brief)
Definition: expert.cpp:780
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
Definition: qtextstream.h:53
QPushButton * m_saveLog
Definition: doxywizard.h:69
QTextEdit * m_outputLog
Definition: doxywizard.h:72
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::updateConfigFileName ( const QString fileName)
private

Definition at line 234 of file doxywizard.cpp.

235 {
236  if (m_fileName!=fileName)
237  {
239  QString curPath = QFileInfo(fileName).path();
240  setWorkingDir(curPath);
241  addRecentFile(fileName);
242  updateTitle();
243  }
244 }
void setWorkingDir(const QString &dirName)
Definition: doxywizard.cpp:181
void addRecentFile(const QString &fileName)
Definition: doxywizard.cpp:403
void updateTitle()
Definition: doxywizard.cpp:606
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
QString m_fileName
Definition: doxywizard.h:76
fileName
Definition: dumpTree.py:9
The QFileInfo class provides system-independent file information.
Definition: qfileinfo.h:51
void MainWindow::updateLaunchButtonState ( )
private

Definition at line 544 of file doxywizard.cpp.

545 {
546  m_launchHtml->setEnabled(m_expert->htmlOutputPresent(m_workingDir->text()));
547 #if 0
548  m_launchPdf->setEnabled(m_expert->pdfOutputPresent(m_workingDir->text()));
549 #endif
550 }
bool htmlOutputPresent(const QString &workingDir) const
Definition: expert.cpp:898
QPushButton * m_launchHtml
Definition: doxywizard.h:70
QPushButton * m_launchPdf
Definition: doxywizard.h:71
QLineEdit * m_workingDir
Definition: doxywizard.h:66
bool pdfOutputPresent(const QString &workingDir) const
Definition: expert.cpp:934
Expert * m_expert
Definition: doxywizard.h:74
void MainWindow::updateTitle ( )

Definition at line 606 of file doxywizard.cpp.

607 {
608  QString title = tr("Doxygen GUI frontend");
609  if (m_modified)
610  {
611  title+=QString::fromLatin1(" +");
612  }
613  if (!m_fileName.isEmpty())
614  {
616  }
617  setWindowTitle(title);
618 }
bool isEmpty() const
Definition: qstring.h:682
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
Definition: qstring.h:350
static QString fromLatin1(const char *, int len=-1)
Definition: qstring.cpp:14539
QString m_fileName
Definition: doxywizard.h:76
bool m_modified
Definition: doxywizard.h:84
void MainWindow::updateWorkingDir ( )
privateslot

Definition at line 198 of file doxywizard.cpp.

199 {
200  setWorkingDir(m_workingDir->text());
201 }
void setWorkingDir(const QString &dirName)
Definition: doxywizard.cpp:181
QLineEdit * m_workingDir
Definition: doxywizard.h:66

Member Data Documentation

Expert* MainWindow::m_expert
private

Definition at line 74 of file doxywizard.h.

QString MainWindow::m_fileName
private

Definition at line 76 of file doxywizard.h.

QPushButton* MainWindow::m_launchHtml
private

Definition at line 70 of file doxywizard.h.

QPushButton* MainWindow::m_launchPdf
private

Definition at line 71 of file doxywizard.h.

bool MainWindow::m_modified
private

Definition at line 84 of file doxywizard.h.

QTextEdit* MainWindow::m_outputLog
private

Definition at line 72 of file doxywizard.h.

QStringList MainWindow::m_recentFiles
private

Definition at line 79 of file doxywizard.h.

QMenu* MainWindow::m_recentMenu
private

Definition at line 78 of file doxywizard.h.

QPushButton* MainWindow::m_run
private

Definition at line 68 of file doxywizard.h.

bool MainWindow::m_running
private

Definition at line 83 of file doxywizard.h.

QProcess* MainWindow::m_runProcess
private

Definition at line 80 of file doxywizard.h.

QLabel* MainWindow::m_runStatus
private

Definition at line 73 of file doxywizard.h.

QPushButton* MainWindow::m_saveLog
private

Definition at line 69 of file doxywizard.h.

QPushButton* MainWindow::m_selWorkingDir
private

Definition at line 67 of file doxywizard.h.

QSettings MainWindow::m_settings
private

Definition at line 77 of file doxywizard.h.

QTabWidget* MainWindow::m_tabs
private

Definition at line 82 of file doxywizard.h.

QTimer* MainWindow::m_timer
private

Definition at line 81 of file doxywizard.h.

Wizard* MainWindow::m_wizard
private

Definition at line 75 of file doxywizard.h.

QLineEdit* MainWindow::m_workingDir
private

Definition at line 66 of file doxywizard.h.


The documentation for this class was generated from the following files: