Skip to content

Commit b902ea3

Browse files
committed
Working on wizard
1 parent 8b0b33c commit b902ea3

File tree

4 files changed

+51
-35
lines changed

4 files changed

+51
-35
lines changed

src/Interface/Application/MainWindowCollaborators.cc

Lines changed: 27 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@
2626
DEALINGS IN THE SOFTWARE.
2727
*/
2828

29-
#include <iostream>
3029
#include <QtGui>
3130
#include <Interface/Application/MainWindowCollaborators.h>
31+
#include <Interface/Application/SCIRunMainWindow.h>
3232
#include <Core/Logging/Log.h>
3333

3434
using namespace SCIRun::Gui;
@@ -159,64 +159,61 @@ void WidgetDisablingService::temporarilyEnableService()
159159
serviceEnabled_ = true;
160160
}
161161

162-
namespace {
162+
NewUserWizard::NewUserWizard(QWidget* parent) : QWizard(parent)
163+
{
164+
addPage(createIntroPage());
165+
addPage(createPathSettingPage());
166+
167+
setWindowTitle("SCIRun Tutorial Wizard");
168+
}
163169

164-
QWizardPage *createIntroPage()
170+
QWizardPage* NewUserWizard::createIntroPage()
165171
{
166-
QWizardPage *page = new QWizardPage;
172+
auto page = new QWizardPage;
167173
page->setTitle("Introduction");
168174

169-
QLabel *label = new QLabel("This wizard will help you set up SCIRun for the first time and learn the basic SCIRun operations and hotkeys.");
175+
auto label = new QLabel("This wizard will help you set up SCIRun for the first time and learn the basic SCIRun operations and hotkeys. All of these settings are available at any time in the Preferences window.");
170176
label->setWordWrap(true);
171177

172-
QVBoxLayout *layout = new QVBoxLayout;
178+
auto layout = new QVBoxLayout;
173179
layout->addWidget(label);
174180
page->setLayout(layout);
175181

176182
return page;
177183
}
178184

179-
QWizardPage *createPathSettingPage()
185+
QWizardPage* NewUserWizard::createPathSettingPage()
180186
{
181-
QWizardPage *page = new QWizardPage;
182-
page->setTitle("Set Data Path");
187+
auto page = new QWizardPage;
188+
page->setTitle("Configuring Paths");
183189

184-
QLabel *label = new QLabel("Specify the location of SCIRun's data folder. This path is referenced in modules using the code %SCIRUNDATADIR%.");
190+
auto label = new QLabel("Specify the location of SCIRun's data folder. This path is referenced in network files and modules using the code %SCIRUNDATADIR%.");
185191
label->setWordWrap(true);
186192

187-
auto classNameLabel = new QLabel("Data path:");
188-
auto classNameLineEdit = new QLineEdit;
189-
193+
pathLabel_ = new QLabel("Data path:");
194+
190195
//page->registerField("className*", classNameLineEdit);
191196

192-
QVBoxLayout *layout = new QVBoxLayout;
197+
auto layout = new QVBoxLayout;
193198
layout->addWidget(label);
194199

195-
auto hbox = new QHBoxLayout;
196-
hbox->addWidget(classNameLabel);
197-
hbox->addWidget(classNameLineEdit);
198-
hbox->addWidget(new QPushButton("Set Path..."));
199-
layout->addLayout(hbox);
200+
layout->addWidget(pathLabel_);
201+
auto button = new QPushButton("Set Path...");
202+
layout->addWidget(button);
203+
connect(button, SIGNAL(clicked()), SCIRunMainWindow::Instance(), SLOT(setDataDirectoryFromGUI()));
204+
connect(SCIRunMainWindow::Instance(), SIGNAL(dataDirectorySet(const QString&)), this, SLOT(updatePathLabel(const QString&)));
200205

201206
page->setLayout(layout);
202207

203208
return page;
204209
}
205210

206-
QWizardPage *createConclusionPage()
211+
QWizardPage* NewUserWizard::createConclusionPage()
207212
{
208213
return nullptr;
209214
}
210215

211-
}
212-
213-
void SCIRun::Gui::newUserWizard(QWidget* parent)
216+
void NewUserWizard::updatePathLabel(const QString& dir)
214217
{
215-
auto wizard = new QWizard(parent);
216-
wizard->addPage(createIntroPage());
217-
wizard->addPage(createPathSettingPage());
218-
//wizard.addPage(createConclusionPage());
219-
220-
wizard->setWindowTitle("SCIRun Tutorial Wizard");
221-
wizard->exec();
218+
pathLabel_->setText("Data path: " + dir);
222219
}

src/Interface/Application/MainWindowCollaborators.h

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,9 @@
4040
#include <QNetworkRequest>
4141
#include <QNetworkReply>
4242
#include <QDir>
43+
#include <QLabel>
4344
#include <QMutex>
45+
#include <QWizard>
4446

4547
class QTextEdit;
4648
class QTreeWidget;
@@ -172,7 +174,20 @@ namespace Gui {
172174
QStatusBar* statusBar_;
173175
};
174176

175-
void newUserWizard(QWidget* parent);
177+
class NewUserWizard : public QWizard
178+
{
179+
Q_OBJECT
180+
public:
181+
explicit NewUserWizard(QWidget* parent);
182+
183+
private Q_SLOTS:
184+
void updatePathLabel(const QString& dir);
185+
private:
186+
QLabel* pathLabel_;
187+
QWizardPage* createIntroPage();
188+
QWizardPage* createPathSettingPage();
189+
QWizardPage *createConclusionPage();
190+
};
176191
}
177192
}
178193
#endif

src/Interface/Application/SCIRunMainWindow.cc

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,7 @@ namespace {
11691169
addSnippet("[ReadField*->ShowField->ViewScene]", snips);
11701170
addSnippet("[CreateLatVol->ShowField->ViewScene]", snips);
11711171
addSnippet("[ReadField*->ReportFieldInfo]", snips);
1172+
addSnippet("[ReadMatrix*->ReportMatrixInfo]", snips);
11721173
addSnippet("[CreateStandardColorMap->RescaleColorMap->ShowField->ViewScene]", snips);
11731174
addSnippet("[GetFieldBoundary->FairMesh->ShowField]", snips);
11741175

@@ -1448,6 +1449,7 @@ void SCIRunMainWindow::setDataDirectory(const QString& dir)
14481449

14491450
RemembersFileDialogDirectory::setStartingDir(dir);
14501451
Preferences::Instance().setDataDirectory(dir.toStdString());
1452+
Q_EMIT dataDirectorySet(dir);
14511453
}
14521454
}
14531455

@@ -1480,13 +1482,13 @@ void SCIRunMainWindow::addToDataDirectory(const QString& dir)
14801482

14811483
void SCIRunMainWindow::setDataDirectoryFromGUI()
14821484
{
1483-
QString dir = QFileDialog::getExistingDirectory(this, tr("Choose Data Directory"), ".");
1485+
auto dir = QFileDialog::getExistingDirectory(this, tr("Choose Data Directory"), ".");
14841486
setDataDirectory(dir);
14851487
}
14861488

14871489
void SCIRunMainWindow::addToPathFromGUI()
14881490
{
1489-
QString dir = QFileDialog::getExistingDirectory(this, tr("Add Directory to Data Path"), ".");
1491+
auto dir = QFileDialog::getExistingDirectory(this, tr("Add Directory to Data Path"), ".");
14901492
addToDataDirectory(dir);
14911493
}
14921494

@@ -1586,7 +1588,8 @@ void SCIRunMainWindow::hideNonfunctioningWidgets()
15861588

15871589
void SCIRunMainWindow::launchNewUserWizard()
15881590
{
1589-
newUserWizard(this);
1591+
NewUserWizard wiz(this);
1592+
wiz.exec();
15901593
}
15911594

15921595
void SCIRunMainWindow::adjustModuleDock(int state)

src/Interface/Application/SCIRunMainWindow.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ class SCIRunMainWindow : public QMainWindow, public Ui::SCIRunMainWindow
9797
public Q_SLOTS:
9898
void executeAll();
9999
void showZoomStatusMessage(int zoomLevel);
100+
void setDataDirectoryFromGUI();
100101
protected:
101102
virtual void closeEvent(QCloseEvent* event) override;
102103
virtual void keyPressEvent(QKeyEvent *event) override;
@@ -167,6 +168,7 @@ public Q_SLOTS:
167168
Q_SIGNALS:
168169
void moduleItemDoubleClicked();
169170
void defaultNotePositionChanged(NotePosition position);
171+
void dataDirectorySet(const QString& dir);
170172
private Q_SLOTS:
171173
void saveNetworkAs();
172174
void saveNetwork();
@@ -192,7 +194,6 @@ private Q_SLOTS:
192194
void updateMiniView();
193195
void alertForNetworkCycles(int code);
194196
void updateDockWidgetProperties(bool isFloating);
195-
void setDataDirectoryFromGUI();
196197
void toolkitDownload();
197198
void addToPathFromGUI();
198199
void removeSavedSubnetwork();

0 commit comments

Comments
 (0)