COPASI API  4.16.103
Public Slots | Public Member Functions | Static Public Attributes | Protected Attributes | Static Protected Attributes | List of all members
WizardDialog Class Reference

#include <wizard.h>

Inheritance diagram for WizardDialog:
Inheritance graph
[legend]
Collaboration diagram for WizardDialog:
Collaboration graph
[legend]

Public Slots

virtual void backButton_clicked ()
 
virtual void buttonGroup2_clicked (int)
 
virtual void forwardButton_clicked ()
 
virtual void textBrowser_anchorClicked (const QUrl &url)
 

Public Member Functions

virtual void setCopasiMainWindow (QWidget *copasiMainWindow)
 
 WizardDialog (QWidget *parent=0, const char *name=0, bool modal=false, Qt::WindowFlags fl=0)
 
 ~WizardDialog ()
 

Static Public Attributes

static const char * texts [6] = {"TutWiz-Step1.html", "TutWiz-Step2.html", "TutWiz-Step3.html", "TutWiz-Step4.html", "TutWiz-Step5.html", "TutWiz-Step6.html"}
 

Protected Attributes

QButtonGroup * buttonGroup
 
QWidget * copasiMainWindow
 

Static Protected Attributes

static const char * Error = "<html><head><title>Error</title></head><body><h1>Could not find help files.<br><br>Please set the COPASI_HELP_PATH environment variable to the absolute path that contains the html help files!</h1></body></html>"
 
static QString helpPath = ""
 

Detailed Description

Definition at line 23 of file wizard.h.

Constructor & Destructor Documentation

WizardDialog::WizardDialog ( QWidget *  parent = 0,
const char *  name = 0,
bool  modal = false,
Qt::WindowFlags  fl = 0 
)

Definition at line 35 of file wizard.cpp.

References buttonGroup, buttonGroup2_clicked(), Error, COptions::getValue(), helpPath, textBrowser_anchorClicked(), and texts.

35  :
36  QDialog(parent, fl),
37  copasiMainWindow(NULL),
38  buttonGroup(NULL)
39 {
40  setupUi(this);
41 
42  std::string WizardDir;
43  COptions::getValue("WizardDir", WizardDir);
44 
45  if (!WizardDir.empty())
46  {
47  // the next line will hopefully ensure that this works under windows as well.
48  WizardDialog::helpPath = "file:///" + QDir(WizardDir.c_str()).absolutePath();
49  QString source = WizardDialog::helpPath + "/" + WizardDialog::texts[0];
50  this->textBrowser->setSource(source);
51  }
52  else
53  {
54  this->textBrowser->setText(WizardDialog::Error);;
55  }
56 
57  buttonGroup = new QButtonGroup(this);
58 
59  buttonGroup->addButton(button1, 0);
60  buttonGroup->addButton(button2, 1);
61  buttonGroup->addButton(button3, 2);
62  buttonGroup->addButton(button4, 3);
63  buttonGroup->addButton(button5, 4);
64  buttonGroup->addButton(button6, 5);
65 
66  buttonGroup->button(0)->setChecked(true);
67 
68  connect(buttonGroup, SIGNAL(buttonClicked(int)), this, SLOT(buttonGroup2_clicked(int)));
69  connect(textBrowser, SIGNAL(anchorClicked(const QUrl &)), this, SLOT(textBrowser_anchorClicked(const QUrl &)));
70 }
virtual void textBrowser_anchorClicked(const QUrl &url)
Definition: wizard.cpp:125
static const char * Error
Definition: wizard.h:42
QWidget * copasiMainWindow
Definition: wizard.h:44
static const char * texts[6]
Definition: wizard.h:31
static void getValue(const std::string &name, CType &value)
Definition: COptions.h:124
static QString helpPath
Definition: wizard.h:43
bool fl(const C_FLOAT64 &d1, const C_FLOAT64 &d2)
virtual void buttonGroup2_clicked(int)
Definition: wizard.cpp:86
QButtonGroup * buttonGroup
Definition: wizard.h:45
WizardDialog::~WizardDialog ( )

Definition at line 75 of file wizard.cpp.

76 {
77  // no need to delete child widgets, Qt does it all for us
78 }

Member Function Documentation

void WizardDialog::backButton_clicked ( )
virtualslot

Definition at line 119 of file wizard.cpp.

References buttonGroup, and buttonGroup2_clicked().

120 {
121  buttonGroup->button(buttonGroup->checkedId() - 1)->setChecked(true);
122  buttonGroup2_clicked(this->buttonGroup->checkedId());
123 }
virtual void buttonGroup2_clicked(int)
Definition: wizard.cpp:86
QButtonGroup * buttonGroup
Definition: wizard.h:45
void WizardDialog::buttonGroup2_clicked ( int  )
virtualslot

Definition at line 86 of file wizard.cpp.

References buttonGroup, helpPath, and texts.

Referenced by backButton_clicked(), forwardButton_clicked(), textBrowser_anchorClicked(), and WizardDialog().

87 {
88  int checkedId = this->buttonGroup->checkedId();
89 
90  if (checkedId == 0)
91  {
92  this->backButton->setEnabled(false);
93  this->forwardButton->setEnabled(true);
94  }
95  else if (checkedId == 5)
96  {
97  this->forwardButton->setEnabled(false);
98  this->backButton->setEnabled(true);
99  }
100  else
101  {
102  this->forwardButton->setEnabled(true);
103  this->backButton->setEnabled(true);
104  }
105 
106  if (WizardDialog::helpPath != "")
107  {
108  QString source = WizardDialog::helpPath + "/" + WizardDialog::texts[checkedId];
109  this->textBrowser->setSource(source);
110  }
111 }
static const char * texts[6]
Definition: wizard.h:31
static QString helpPath
Definition: wizard.h:43
QButtonGroup * buttonGroup
Definition: wizard.h:45
void WizardDialog::forwardButton_clicked ( )
virtualslot

Definition at line 113 of file wizard.cpp.

References buttonGroup, and buttonGroup2_clicked().

114 {
115  buttonGroup->button(buttonGroup->checkedId() + 1)->setChecked(true);
116  buttonGroup2_clicked(this->buttonGroup->checkedId());
117 }
virtual void buttonGroup2_clicked(int)
Definition: wizard.cpp:86
QButtonGroup * buttonGroup
Definition: wizard.h:45
void WizardDialog::setCopasiMainWindow ( QWidget *  copasiMainWindow)
virtual

Definition at line 170 of file wizard.cpp.

References copasiMainWindow.

Referenced by CopasiUI3Window::slotTutorialWizard().

171 {
173 }
QWidget * copasiMainWindow
Definition: wizard.h:44
void WizardDialog::textBrowser_anchorClicked ( const QUrl &  url)
virtualslot

Definition at line 125 of file wizard.cpp.

References buttonGroup, buttonGroup2_clicked(), copasiMainWindow, CopasiUI3Window::getMainWidget(), CQMessageBox::information(), and ListViews::switchToOtherWidget().

Referenced by WizardDialog().

126 {
127  QString name = url.fragment();
128 
129  std::cout << name.toUtf8().data() << std::endl;
130 
131  CopasiUI3Window * pMainWindow = dynamic_cast<CopasiUI3Window *>(copasiMainWindow);
132 
133  if (name == "Model Settings")
134  {
135  if (pMainWindow)
136  pMainWindow->getMainWidget()->switchToOtherWidget(1, "");
137  }
138  else if (name == "Reaction Overview")
139  {
140  if (pMainWindow)
141  pMainWindow->getMainWidget()->switchToOtherWidget(114, "");
142  }
143  else if (name == "Report Definition")
144  {
145  if (pMainWindow)
146  pMainWindow->getMainWidget()->switchToOtherWidget(43, "");
147  }
148  else if (name == "Step 1")
149  {
150  buttonGroup->button(0)->setChecked(true);
151  buttonGroup2_clicked(this->buttonGroup->checkedId());
152  }
153  else if (name == "Time Course")
154  {
155  if (pMainWindow)
156  pMainWindow->getMainWidget()->switchToOtherWidget(23, "");
157  }
158  else if (name == "Plot Definition Overview")
159  {
160  if (pMainWindow)
161  pMainWindow->getMainWidget()->switchToOtherWidget(42, "");
162  }
163  else
164  {
165  CQMessageBox::information(this, "Error", "Link not found",
166  QMessageBox::Ok, QMessageBox::Ok);
167  }
168 }
QWidget * copasiMainWindow
Definition: wizard.h:44
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
ListViews * getMainWidget()
virtual void buttonGroup2_clicked(int)
Definition: wizard.cpp:86
QButtonGroup * buttonGroup
Definition: wizard.h:45

Member Data Documentation

QButtonGroup* WizardDialog::buttonGroup
protected
QWidget* WizardDialog::copasiMainWindow
protected

Definition at line 44 of file wizard.h.

Referenced by setCopasiMainWindow(), and textBrowser_anchorClicked().

const char * WizardDialog::Error = "<html><head><title>Error</title></head><body><h1>Could not find help files.<br><br>Please set the COPASI_HELP_PATH environment variable to the absolute path that contains the html help files!</h1></body></html>"
staticprotected

Definition at line 42 of file wizard.h.

Referenced by WizardDialog().

QString WizardDialog::helpPath = ""
staticprotected

Definition at line 43 of file wizard.h.

Referenced by buttonGroup2_clicked(), and WizardDialog().

const char * WizardDialog::texts = {"TutWiz-Step1.html", "TutWiz-Step2.html", "TutWiz-Step3.html", "TutWiz-Step4.html", "TutWiz-Step5.html", "TutWiz-Step6.html"}
static

Definition at line 31 of file wizard.h.

Referenced by buttonGroup2_clicked(), and WizardDialog().


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