10 #include <QVBoxLayout> 17 #include <QCloseEvent> 18 #include <QApplication> 20 #include <QFileDialog> 21 #include <QDesktopServices> 23 #include <QTextStream> 30 #define MAX_RECENT_FILES 10 43 QMenu *
file = menuBar()->addMenu(tr(
"File"));
44 file->addAction(tr(
"Open..."),
47 file->addAction(tr(
"Save"),
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);
54 QMenu *settings = menuBar()->addMenu(tr(
"Settings"));
55 settings->addAction(tr(
"Reset to factory defaults"),
57 settings->addAction(tr(
"Use current settings at startup"),
59 settings->addAction(tr(
"Clear recent list"),
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()) );
72 QWidget *topPart =
new QWidget;
73 QVBoxLayout *rowLayout =
new QVBoxLayout(topPart);
76 QHBoxLayout *dirLayout =
new QHBoxLayout;
83 QWidget *runTab =
new QWidget;
84 QVBoxLayout *runTabLayout =
new QVBoxLayout(runTab);
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..."));
93 QPushButton *
showSettings =
new QPushButton(tr(
"Show configuration"));
94 runLayout->addWidget(
m_run);
96 runLayout->addStretch(1);
97 runLayout->addWidget(showSettings);
101 runTabLayout->addLayout(runLayout);
102 runTabLayout->addWidget(
new QLabel(tr(
"Output produced by doxygen")));
103 QGridLayout *grid =
new QGridLayout;
109 grid->setColumnStretch(0,1);
110 grid->setRowStretch(0,1);
111 QHBoxLayout *launchLayout =
new QHBoxLayout;
115 launchLayout->addStretch(1);
116 grid->addLayout(launchLayout,1,0);
117 runTabLayout->addLayout(grid);
122 m_tabs->addTab(runTab,tr(
"Run"));
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);
129 setCentralWidget(topPart);
130 statusBar()->showMessage(tr(
"Welcome to Doxygen"),
messageTimeout);
178 QApplication::exit(0);
190 QString dirName = QFileDialog::getExistingDirectory(
this,
205 QDesktopServices::openUrl(QUrl(
QString::fromLatin1(
"http://www.doxygen.org/manual.html")));
215 "<center>Written by<br> Dimitri van Heesch<br>© 2000-2015</center><p>" 217 QMessageBox::about(
this,tr(
"Doxygen GUI"),msg);
224 QString fn = QFileDialog::getOpenFileName(
this,
225 tr(
"Open configuration file"),
262 if (fileName.
isEmpty())
return;
264 if (!f.
open(QIODevice::WriteOnly))
268 tr(
"Error: cannot open the file ")+fileName+tr(
" for writing!\n")+
269 tr(
"Reason given: ")+f.error());
296 if (fileName.
isEmpty())
return false;
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?"),
307 QMessageBox::Cancel)==QMessageBox::Save)
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?"),
322 QMessageBox::Cancel)==QMessageBox::Yes)
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?"),
341 QMessageBox::Cancel)==QMessageBox::Reset)
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())
365 if (workingDir!=QVariant::Invalid &&
QDir(workingDir.toString()).
exists())
400 m_tabs->setCurrentIndex(2);
444 #if defined(Q_OS_MACX) 446 qDebug() << tr(
"Doxygen path: ") << doxygenPath;
456 qDebug() << tr(
"Can't find the doxygen command, make sure it's in your $$PATH");
460 qDebug() << tr(
"Getting doxygen from: ") << doxygenPath;
464 m_runProcess->setProcessChannelMode(QProcess::MergedChannels);
477 m_runProcess->start(doxygenPath + QString::fromLatin1(
"doxygen"), args);
481 m_outputLog->append(QString::fromLatin1(
"*** Failed to run doxygen\n"));
490 m_outputLog->append(QString::fromLatin1(
"*** Failed to run doxygen\n"));
496 m_run->setText(tr(
"Stop doxygen"));
504 m_run->setText(tr(
"Run doxygen"));
529 m_outputLog->append(tr(
"*** Doxygen has finished\n"));
533 m_outputLog->append(tr(
"*** Cancelled by user\n"));
536 m_run->setText(tr(
"Run doxygen"));
559 ShellExecute(NULL, L
"open", (LPCWSTR)fi.absoluteFilePath().utf16(), NULL, NULL, SW_SHOWNORMAL);
562 indexUrl+=fi.absoluteFilePath();
563 QDesktopServices::openUrl(QUrl(indexUrl));
569 QString fn = QFileDialog::getSaveFileName(
this, tr(
"Save log file"),
575 if (f.
open(QIODevice::WriteOnly))
584 tr(
"Cannot open file ")+fn+tr(
" for writing. Nothing saved!"),tr(
"ok"));
617 setWindowTitle(title);
624 QMessageBox::StandardButton button;
627 button = QMessageBox::question(
this,
628 tr(
"Unsaved changes"),
629 tr(
"Unsaved changes will be lost! Do you want to save the configuration file?"),
631 QMessageBox::Discard |
634 if (button==QMessageBox::Save)
641 button = QMessageBox::question(
this,
642 tr(
"Unsaved changes"),
643 tr(
"Unsaved changes will be lost! Do you want to continue?"),
644 QMessageBox::Discard |
648 return button==QMessageBox::Discard;
656 QApplication
a(argc,argv);
659 if (!
qstrcmp(argv[1],
"--help"))
662 msgBox.setText(
QString().sprintf(
"Usage: %s [config file]",argv[0]));
670 msgBox.setText(
QString().sprintf(
"Too many arguments specified\n\nUsage: %s [config file]",argv[0]));
677 if (argc==2 && argv[1][0]!=
'-')
Traverses directory structures and contents in a platform-independent way.
void qDebug(const char *msg,...)
static QString fromLocal8Bit(const char *, int len=-1)
QPushButton * m_selWorkingDir
Iterator prepend(const T &x)
bool writeConfig(QTextStream &t, bool brief)
The QRegExp class provides pattern matching using regular expressions or wildcards.
void msg(const char *fmt,...)
bool htmlOutputPresent(const QString &workingDir) const
void setWorkingDir(const QString &dirName)
void closeEvent(QCloseEvent *event)
void addRecentFile(const QString &fileName)
QPushButton * m_launchHtml
void updateLaunchButtonState()
The QString class provides an abstraction of Unicode text and the classic C null-terminated char arra...
void updateConfigFileName(const QString &fileName)
const int messageTimeout
status bar message timeout in milliseconds.
QString getHtmlOutputIndex(const QString &workingDir) const
static QString fromLatin1(const char *, int len=-1)
def connect(nxgraph, k1, k2, p1=0, p2=0, kwds)
const QHash< QString, Input * > & modelData() const
bool exists(std::string path)
void saveSettings(QSettings *)
void loadConfigFromFile(const QString &fileName)
The QFile class is an I/O device that operates on files.
The QTextStream class provides basic functions for reading and writing text using a QIODevice...
static QString fromUtf8(const char *, int len=-1)
void openRecent(QAction *action)
int main(int argc, char **argv)
QPushButton * m_launchPdf
void loadSettings(QSettings *)
void loadConfig(const QString &fileName)
QStringList m_recentFiles
The QFileInfo class provides system-independent file information.
bool discardUnsavedChanges(bool saveOption=true)
Q_EXPORT int qstrcmp(const char *str1, const char *str2)
static MainWindow & instance()
bool pdfOutputPresent(const QString &workingDir) const
static bool setCurrent(const QString &path)
Event finding and building.