From fbc60af2298c2668893e2f7045f66765f8e0c63f Mon Sep 17 00:00:00 2001 From: Dimitri van Heesch Date: Sat, 3 May 2014 16:33:42 +0200 Subject: Doxywizard: make the Next button on the last page of the wizard switch to the run tab --- addon/doxywizard/doxywizard.cpp | 18 ++++++++++++------ addon/doxywizard/doxywizard.h | 3 +++ addon/doxywizard/wizard.cpp | 18 +++++++++++++----- addon/doxywizard/wizard.h | 3 +++ 4 files changed, 31 insertions(+), 11 deletions(-) diff --git a/addon/doxywizard/doxywizard.cpp b/addon/doxywizard/doxywizard.cpp index fb6e115..d69cf73 100644 --- a/addon/doxywizard/doxywizard.cpp +++ b/addon/doxywizard/doxywizard.cpp @@ -97,15 +97,15 @@ MainWindow::MainWindow() 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")); + m_tabs = new QTabWidget; + m_tabs->addTab(m_wizard,tr("Wizard")); + m_tabs->addTab(m_expert,tr("Expert")); + m_tabs->addTab(runTab,tr("Run")); rowLayout->addWidget(new QLabel(tr("Step 1: Specify the working directory from which doxygen will run"))); rowLayout->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); + rowLayout->addWidget(m_tabs); setCentralWidget(topPart); statusBar()->showMessage(tr("Welcome to Doxygen"),messageTimeout); @@ -115,7 +115,7 @@ MainWindow::MainWindow() m_timer = new QTimer; // connect signals and slots - connect(tabs,SIGNAL(currentChanged(int)),SLOT(selectTab(int))); + connect(m_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())); @@ -127,6 +127,7 @@ MainWindow::MainWindow() connect(m_saveLog,SIGNAL(clicked()),SLOT(saveLog())); connect(showSettings,SIGNAL(clicked()),SLOT(showSettings())); connect(m_expert,SIGNAL(changed()),SLOT(configChanged())); + connect(m_wizard,SIGNAL(done()),SLOT(selectRunTab())); loadSettings(); updateLaunchButtonState(); @@ -373,6 +374,11 @@ void MainWindow::selectTab(int id) if (id==0) m_wizard->refresh(); } +void MainWindow::selectRunTab() +{ + m_tabs->setCurrentIndex(2); +} + void MainWindow::addRecentFile(const QString &fileName) { int i=m_recentFiles.indexOf(fileName); diff --git a/addon/doxywizard/doxywizard.h b/addon/doxywizard/doxywizard.h index 46cd748..189972f 100644 --- a/addon/doxywizard/doxywizard.h +++ b/addon/doxywizard/doxywizard.h @@ -14,6 +14,7 @@ class QTextEdit; class QMenu; class QProcess; class QTimer; +class QTabWidget; class MainWindow : public QMainWindow { @@ -51,6 +52,7 @@ class MainWindow : public QMainWindow void showSettings(); void configChanged(); void clearRecent(); + void selectRunTab(); private: MainWindow(); @@ -77,6 +79,7 @@ class MainWindow : public QMainWindow QStringList m_recentFiles; QProcess *m_runProcess; QTimer *m_timer; + QTabWidget *m_tabs; bool m_running; bool m_modified; }; diff --git a/addon/doxywizard/wizard.cpp b/addon/doxywizard/wizard.cpp index 56933e0..a8b7f94 100644 --- a/addon/doxywizard/wizard.cpp +++ b/addon/doxywizard/wizard.cpp @@ -1292,17 +1292,24 @@ void Wizard::activateTopic(QTreeWidgetItem *item,QTreeWidgetItem *) { m_topicStack->setCurrentWidget(m_step4); m_prev->setEnabled(true); - m_next->setEnabled(false); + m_next->setEnabled(true); } } } 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())); + if (m_topicStack->currentIndex()+1==m_topicStack->count()) // last topic + { + done(); + } + else + { + 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() @@ -1315,6 +1322,7 @@ void Wizard::prevTopic() void Wizard::refresh() { + m_treeWidget->setCurrentItem(m_treeWidget->invisibleRootItem()->child(0)); m_step1->init(); m_step2->init(); m_step3->init(); diff --git a/addon/doxywizard/wizard.h b/addon/doxywizard/wizard.h index a18df62..4d5eb9d 100644 --- a/addon/doxywizard/wizard.h +++ b/addon/doxywizard/wizard.h @@ -238,6 +238,9 @@ class Wizard : public QSplitter void nextTopic(); void prevTopic(); + signals: + void done(); + private: const QHash &m_modelData; QTreeWidget *m_treeWidget; -- cgit v0.12