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

#include <copasiui3window.h>

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

Public Slots

void autoSave ()
 
void openInitialDocument (const QString &file)
 
void slotFileOpen (QString file=QString::null)
 
void slotObjectBrowserDialogWasClosed ()
 
void slotShowSliders (bool flag)
 

Signals

void signalLoadFile (QString newFile)
 
void signalQuit ()
 

Public Member Functions

void addWindow (QMainWindow *pWindow)
 
void checkPendingMessages ()
 
void disableSliders (bool disable)
 
void exportSBMLToString (std::string &SBML)
 
DataModelGUIgetDataModel ()
 
ListViewsgetMainWidget ()
 
const QList< QPointer
< QMainWindow > > & 
getWindows () const
 
void importSBMLFromString (const std::string &sbmlDocumentText)
 
const bool & messageShown () const
 
void removeWindow (QMainWindow *pWindow)
 
void setMessageShown (const bool &shown)
 
void suspendAutoSave (const bool &suspend)
 
 ~CopasiUI3Window ()
 

Static Public Member Functions

static CopasiUI3Windowcreate ()
 
static CopasiUI3WindowgetMainWindow ()
 
static bool isMainThread ()
 

Protected Slots

void about ()
 
void aboutQt ()
 
void customEvent (QEvent *)
 
void license ()
 
void listViewsFolderChanged (const QModelIndex &index)
 
void newDoc ()
 
void slotActivateWindowTriggered (QAction *action)
 
void slotApplyInitialState ()
 
void slotCapture ()
 
void slotCheckModel ()
 
void slotCloseAllWindows ()
 
void slotConvertToIrreversible ()
 
void slotExpandModel ()
 
void slotExportMathModel ()
 
void slotExportMathModelFinished (bool success)
 
void slotExportSBML ()
 
void slotExportSBMLFinished (bool success)
 
void slotExportSBMLToStringFinished (bool success)
 
void slotFileExamplesCopasiFiles (QString file=QString::null)
 
void slotFileExamplesSBMLFiles (QString file=QString::null)
 
void slotFileOpenFinished (bool success)
 
void slotFilePrint ()
 
void slotFileSave ()
 
void slotFileSaveAs (QString str=QString::null)
 
void slotFileSaveFinished (bool success)
 
void slotFontSelection ()
 
void slotFrameworkChanged (int index)
 
void slotFunctionDBLoad (QString str=QString::null)
 
void slotFunctionDBSave (QString str=QString::null)
 
void slotImportSBML (QString file=QString::null)
 
void slotImportSBMLFinished (bool success)
 
void slotImportSBMLFromStringFinished (bool success)
 
void slotOpenRecentFile (QAction *pAction)
 
void slotOpenRecentSBMLFile (QAction *pAction)
 
void slotPreferences ()
 
void slotQuit ()
 
void slotQuitFinished (bool success)
 
void slotShowObjectBrowserDialog (bool flag)
 
void slotTutorialWizard ()
 
void slotUpdateInitialState ()
 
void slotUpdateMIRIAM ()
 
void slotUpdateMIRIAMFinished (bool)
 

Protected Member Functions

virtual void closeEvent (QCloseEvent *e)
 
void dragEnterEvent (QDragEnterEvent *event)
 
void dropEvent (QDropEvent *event)
 

Private Member Functions

void CleanUp ()
 
 CopasiUI3Window ()
 
void createActions ()
 
void createMenuBar ()
 
void createToolBar ()
 
void refreshRecentFileMenu ()
 
void refreshRecentSBMLFileMenu ()
 
void refreshWindowsMenu ()
 
void setApplicationFont ()
 
void updateTitle ()
 

Private Attributes

QString FixedTitle
 
bool mCommitRequired
 
bool mMessageShown
 
QString mNewFile
 
QAction * mpaApplyInitialState
 
QAction * mpaCapture
 
QAction * mpaCheckModel
 
QAction * mpaCloseAllWindows
 
QAction * mpaExpandModel
 
QAction * mpaExportODE
 
QAction * mpaExportSBML
 
QAction * mpaFontSelectionDialog
 
QAction * mpaFunctionDBLoad
 
QAction * mpaFunctionDBSave
 
QAction * mpaImportSBML
 
QAction * mpaNew
 
QAction * mpaObjectBrowser
 
QAction * mpaOpen
 
QAction * mpaOpenCopasiFiles
 
QAction * mpaOpenSBMLFiles
 
QAction * mpaQuit
 
QAction * mpaSave
 
QAction * mpaSaveAs
 
QAction * mpaSliders
 
QAction * mpaUpdateInitialState
 
QAction * mpaUpdateMIRIAM
 
QTimer * mpAutoSaveTimer
 
QComboBox * mpBoxSelectFramework
 
DataModelGUImpDataModelGUI
 
ListViewsmpListView
 
QThread * mpMainThread
 
QMenu * mpMenuExamples
 
QMenu * mpMenuRecentFiles
 
QMenu * mpMenuRecentSBMLFiles
 
CMIRIAMResourcesmpMIRIAMResources
 
ObjectBrowserDialogmpObjectBrowser
 
QActionGroup * mpRecentFilesActionGroup
 
QActionGroup * mpRecentSBMLFilesActionGroup
 
SliderDialogmpSliders
 
QMenu * mpTools
 
QActionGroup * mpWindowsActionGroup
 
QMenu * mpWindowsMenu
 
bool mQuitApplication
 
QMap< QAction *, int > mRecentFilesActionMap
 
QMap< QAction *, int > mRecentSBMLFilesActionMap
 
bool mSaveAsRequired
 
bool mSliderDialogEnabled
 
bool mSuspendAutoSave
 
QList< QPointer< QMainWindow > > mWindows
 

Static Private Attributes

static CopasiUI3WindowpMainWindow = NULL
 

Detailed Description

Definition at line 54 of file copasiui3window.h.

Constructor & Destructor Documentation

CopasiUI3Window::~CopasiUI3Window ( )

Definition at line 272 of file copasiui3window.cpp.

References DataModelGUI::deregisterListView(), mpDataModelGUI, mpListView, mpSliders, mWindows, and pdelete.

273 {
274 #ifdef COPASI_SBW_INTEGRATION
275  sbwDisconnect();
276 #endif // COPASI_SBW_INTEGRATION
277 
278  QList< QPointer<QMainWindow> >::iterator it = mWindows.begin();
279  QList< QPointer<QMainWindow> >::iterator end = mWindows.end();
280 
281  for (; it != end; ++it)
282  {
283  QPointer<QMainWindow> current = *it;
284 
285  if (current == NULL) continue;
286 
287  if (current != this)
288  current->close();
289  }
290 
295 }
ListViews * mpListView
#define pdelete(p)
Definition: copasi.h:215
SliderDialog * mpSliders
void deregisterListView(ListViews *pListView)
DataModelGUI * mpDataModelGUI
QList< QPointer< QMainWindow > > mWindows
CopasiUI3Window::CopasiUI3Window ( )
private

Constructs a CopasiUI window which is a child of 'parent', with the name 'name' and widget flags set to 'f'.

Parameters
parentThe widget which this window is a child of.
nameThe object name is a text that can be used to identify this QObject. It's particularly useful in conjunction with the Qt Designer. You can find an object by name (and type) using child(), and more than one using queryList().
flagsFlags for this widget. Refer Qt::WidgetFlags of Qt documentation for more information about these flags.

Definition at line 150 of file copasiui3window.cpp.

References AutoSaveInterval, CQIconResource::copasi, createActions(), createMenuBar(), createToolBar(), FixedTitle, FROM_UTF8, ListViews::getCurrentItemId(), CCopasiRootContainer::getDatamodelList(), CQIconResource::icon(), listViewsFolderChanged(), mpaExportODE, mpaExportSBML, mpaSave, mpaSaveAs, mpAutoSaveTimer, mpDataModelGUI, mpListView, mpSliders, mSliderDialogEnabled, mWindows, DataModelGUI::registerListView(), setApplicationFont(), SliderDialog::setChanged(), SliderDialog::setCurrentFolderId(), SliderDialog::setParentWindow(), ListViews::switchToOtherWidget(), updateTitle(), and CVersion::VERSION.

Referenced by create().

150  :
151  QMainWindow(),
152  mpDataModelGUI(NULL),
153  mpListView(NULL),
154  mpBoxSelectFramework(NULL),
155  mpSliders(NULL),
156  mpObjectBrowser(NULL),
157  mSaveAsRequired(true),
158  mpAutoSaveTimer(NULL),
159  mSuspendAutoSave(false),
160  mpMenuExamples(NULL),
161  mpMenuRecentFiles(NULL),
164  mpMenuRecentSBMLFiles(NULL),
167  mpWindowsActionGroup(NULL),
168  mpMIRIAMResources(NULL),
169  mpMainThread(QThread::currentThread()),
170  mNewFile(),
171  mCommitRequired(true),
172  mQuitApplication(false),
173  mSliderDialogEnabled(false),
174  mMessageShown(false),
175  mWindows()
176 
177 #ifdef COPASI_SBW_INTEGRATION
178  , mpSBWModule(NULL)
179  , mSBWAnalyzerModules()
180  , mSBWAnalyzerServices()
181  , mSBWActionMap()
182  , mpSBWActionGroup(NULL)
183  , mpSBWMenu(NULL)
184  , mpSBWAction(NULL)
185  , mSBWIgnoreShutdownEvent(true)
186 #endif // COPASI_SBW_INTEGRATION
187 
188 #ifdef COPASI_SEDML
189  , mpMenuSEDMLSupport(NULL)
190  , mpMenuRecentSEDMLFiles(NULL)
191  , mRecentSEDMLFilesActionMap()
192  , mpRecentSEDMLFilesActionGroup(NULL)
193 #endif //COPASI_SEDML support
194 
195 {
196  // set destructive close
197  this->setAttribute(Qt::WA_DeleteOnClose);
198 
199  // Add this window to the list of windows
200  mWindows.append(this);
201 
202 #ifndef Darwin
204 #endif // not Darwin
205 
206  // Set the window caption/title
207  FixedTitle = "COPASI ";
208  FixedTitle += FROM_UTF8(CVersion::VERSION.getVersion());
209  updateTitle();
210 
211  createActions();
212  createToolBar(); // creates a tool bar
213  createMenuBar(); // creates a menu bar
214 
215  setIconSize(QSize(18, 20));
216 
217  mpaSave->setEnabled(false);
218  mpaSaveAs->setEnabled(false);
219  mpaExportSBML->setEnabled(false);
220  mpaExportODE->setEnabled(false);
221 
222  //TODO SEDML
223 #ifdef COPASI_SEDML
224  mpaExportSEDML->setEnabled(false);
225 #endif
226 
227  if (!mpDataModelGUI)
228  {
229  // create the data model
230  mpDataModelGUI = new DataModelGUI(this);
231  }
232 
233  mpListView = new ListViews(this);
234 
235  connect(mpListView, SIGNAL(signalFolderChanged(const QModelIndex &)), this, SLOT(listViewsFolderChanged(const QModelIndex &)));
236 
238  mpListView->show();
239  this->setCentralWidget(mpListView);
240 
241  //create sliders window
242  this->mpSliders = new SliderDialog(NULL);
243  this->mpSliders->setParentWindow(this);
244  size_t id = mpListView->getCurrentItemId();
245  this->mpSliders->setCurrentFolderId(id);
246  this->mpSliders->resize(320, 350);
247  this->mSliderDialogEnabled = this->mpSliders->isEnabled();
248 
249  resize(800, 600);
250  show();
251 
253 
254  // Assure that the changed flag is still false;
255  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
256  (*CCopasiRootContainer::getDatamodelList())[0]->changed(false);
257  this->mpSliders->setChanged(false);
258 
259  mpAutoSaveTimer = new QTimer(this);
260  mpAutoSaveTimer->start(AutoSaveInterval); // every 10 minutes
261 
262  // TODO CRITICAL We need to disable autosave to avoid race conditions.
263  // connect(mpAutoSaveTimer, SIGNAL(timeout()), this, SLOT(autoSave()));
264  // mpDataModelGUI->notify(ListViews::FUNCTION, ListViews::ADD, "");
265 
267 
268  // drop acceptance
269  setAcceptDrops(true);
270 }
ListViews * mpListView
ObjectBrowserDialog * mpObjectBrowser
QActionGroup * mpWindowsActionGroup
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void listViewsFolderChanged(const QModelIndex &index)
QMenu * mpMenuRecentFiles
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
QActionGroup * mpRecentSBMLFilesActionGroup
SliderDialog * mpSliders
QComboBox * mpBoxSelectFramework
QTimer * mpAutoSaveTimer
QMenu * mpMenuRecentSBMLFiles
QActionGroup * mpRecentFilesActionGroup
void setCurrentFolderId(size_t id)
#define AutoSaveInterval
static const QIcon & icon(const IconID &id)
void setChanged(bool changed)
void setParentWindow(CopasiUI3Window *pPW)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
QAction * mpaExportODE
QMap< QAction *, int > mRecentFilesActionMap
QAction * mpaExportSBML
CMIRIAMResources * mpMIRIAMResources
void registerListView(ListViews *pListView)
DataModelGUI * mpDataModelGUI
QMap< QAction *, int > mRecentSBMLFilesActionMap
QThread * mpMainThread
size_t getCurrentItemId()
Definition: listviews.cpp:938
QList< QPointer< QMainWindow > > mWindows
static const CVersion VERSION
Definition: CVersion.h:164

Member Function Documentation

void CopasiUI3Window::about ( )
protectedslot

Definition at line 1240 of file copasiui3window.cpp.

References FixedTitle, FROM_UTF8, AboutDialog::text, and CVersion::VERSION.

Referenced by createMenuBar().

1241 {
1242  QString text =
1243  QString(AboutDialog::text)
1244  .arg(FROM_UTF8(CVersion::VERSION.getVersion()))
1245  .arg(LIBSBML_DOTTED_VERSION);
1246 
1247  AboutDialog* aboutDialog = new AboutDialog(this, text, 76, 30);
1248  aboutDialog->setWindowTitle(FixedTitle);
1249  aboutDialog->exec();
1250 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static const char * text
Definition: AboutDialog.h:41
static const CVersion VERSION
Definition: CVersion.h:164
void CopasiUI3Window::aboutQt ( )
protectedslot

Definition at line 1259 of file copasiui3window.cpp.

Referenced by createMenuBar().

1260 {
1261  QMessageBox::aboutQt(this, "Qt");
1262 }
void CopasiUI3Window::addWindow ( QMainWindow *  pWindow)

Definition at line 1966 of file copasiui3window.cpp.

References mWindows, and refreshWindowsMenu().

Referenced by CWindowInterface::addToMainWindow(), and slotShowSliders().

1967 {
1968  mWindows.append(pWindow);
1970 }
QList< QPointer< QMainWindow > > mWindows
void CopasiUI3Window::autoSave ( )
slot

Definition at line 1823 of file copasiui3window.cpp.

References AutoSaveInterval, CCopasiRootContainer::getDatamodelList(), mpAutoSaveTimer, and mSuspendAutoSave.

Referenced by TaskWidget::commonBeforeRunTask().

1824 {
1825  // TODO CRITICAL This needs to be moved into a sub thread so
1826  // that a progress dialog can be displayed and the user can interrupt.
1827  if (!mSuspendAutoSave)
1828  {
1829  mSuspendAutoSave = true;
1830  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1832  mSuspendAutoSave = false;
1833  }
1834 
1835  mpAutoSaveTimer->setInterval(AutoSaveInterval); // restart the timer
1836 }
QTimer * mpAutoSaveTimer
#define AutoSaveInterval
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void CopasiUI3Window::checkPendingMessages ( )

Definition at line 1744 of file copasiui3window.cpp.

References FROM_UTF8, CCopasiMessage::getLastMessage(), CCopasiMessage::getNumber(), CCopasiMessage::getText(), CCopasiMessage::getType(), CQMessageBox::information(), MCCopasiMessage, and CQMessageBox::setFilteredText().

Referenced by slotExportSBMLFinished(), slotImportSBMLFinished(), slotImportSBMLFromStringFinished(), and slotUpdateMIRIAMFinished().

1745 {
1747 
1748  if (msg_pending.getNumber() != MCCopasiMessage + 1)
1749  {
1750  QString text;
1751  QString filteredText;
1752  unsigned int numMessages = 0;
1753  unsigned int numFilteredMessages = 0;
1754 
1755  while (msg_pending.getNumber() != MCCopasiMessage + 1)
1756  {
1757  if (msg_pending.getType() & 128)
1758  {
1759  ++numFilteredMessages;
1760  filteredText += "\n";
1761  filteredText += FROM_UTF8(msg_pending.getText());
1762  }
1763  else
1764  {
1765  ++numMessages;
1766  text += "\n";
1767  text += FROM_UTF8(msg_pending.getText());
1768  }
1769 
1770  msg_pending = CCopasiMessage::getLastMessage();
1771  }
1772 
1773  if (numFilteredMessages != 0)
1774  {
1775  if (text.isEmpty())
1776  text = "There were no serious issues encountered during the import of SBML. "
1777  "However some minor issues have occurred, which can be viewed in the Minor "
1778  "Issues tab.";
1779 
1780  CQMessageBox box(QMessageBox::Information,
1781  QString("COPASI Message"), text, QMessageBox::Ok, this);
1782  box.setDefaultButton(QMessageBox::Ok);
1783  box.setFilteredText(filteredText);
1784  box.exec();
1785  }
1786  else
1787  {
1788  CQMessageBox::information(this, QString("COPASI Message"), text,
1789  QMessageBox::Ok, QMessageBox::Ok);
1790  }
1791  }
1792 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const std::string & getText() const
const size_t & getNumber() const
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
#define MCCopasiMessage
const CCopasiMessage::Type & getType() const
static CCopasiMessage getLastMessage()
void CopasiUI3Window::CleanUp ( )
private

Definition at line 1227 of file copasiui3window.cpp.

References COptions::getValue(), CDirEntry::remove(), CDirEntry::removeFiles(), and signalQuit().

Referenced by slotQuitFinished().

1228 {
1229  emit signalQuit();
1230  std::string tempDir;
1231  COptions::getValue("Tmp", tempDir);
1232 
1233  CDirEntry::removeFiles("*.cps", tempDir);
1234  CDirEntry::remove(tempDir);
1235 }
static bool remove(const std::string &path)
Definition: CDirEntry.cpp:275
static bool removeFiles(const std::string &pattern, const std::string &dir)
Definition: CDirEntry.cpp:290
static void getValue(const std::string &name, CType &value)
Definition: COptions.h:124
void CopasiUI3Window::closeEvent ( QCloseEvent *  e)
protectedvirtual

Definition at line 1216 of file copasiui3window.cpp.

References slotQuit().

1217 {
1218  // We handle this internally.
1219  ce->ignore();
1220 
1221  slotQuit();
1222 
1223  return;
1224 }
CopasiUI3Window * CopasiUI3Window::create ( )
static

Definition at line 117 of file copasiui3window.cpp.

References COptions::compareValue(), CopasiUI3Window(), and pMainWindow.

Referenced by main().

118 {
119  CopasiUI3Window * pWindow = NULL;
120 
121  pWindow = new CopasiUI3Window;
122 
123 #ifdef COPASI_SBW_INTEGRATION
124 
125  if (pWindow != NULL &&
126  COptions::compareValue("SBWRegister", true))
127  {
128  pWindow->sbwConnect();
129  pWindow->sbwRegister();
130  }
131 
132 #endif // COPASI_SBW_INTEGRATION
133 
134  pMainWindow = pWindow;
135 
136  return pWindow;
137 }
static CopasiUI3Window * pMainWindow
static bool compareValue(const std::string &name, const CType &value)
Definition: COptions.h:128
void CopasiUI3Window::createActions ( )
private

Definition at line 297 of file copasiui3window.cpp.

References CQIconResource::captureImage, CQIconResource::checkMark, CQIconResource::fileAdd, CQIconResource::fileExport, CQIconResource::fileNew, CQIconResource::fileOpen, CQIconResource::fileSave, CQIconResource::fileSaveas, CQIconResource::icon(), CQIconResource::isToS, CQIconResource::miriam, mpaApplyInitialState, mpaCapture, mpaCheckModel, mpaCloseAllWindows, mpaExpandModel, mpaExportODE, mpaExportSBML, mpaFontSelectionDialog, mpaFunctionDBLoad, mpaFunctionDBSave, mpaImportSBML, mpaNew, mpaObjectBrowser, mpaOpen, mpaOpenCopasiFiles, mpaOpenSBMLFiles, mpaQuit, mpaSave, mpaSaveAs, mpaSliders, mpaUpdateInitialState, mpaUpdateMIRIAM, newDoc(), CQIconResource::slider, slotApplyInitialState(), slotCapture(), slotCheckModel(), slotCloseAllWindows(), slotExpandModel(), slotExportMathModel(), slotExportSBML(), slotFileExamplesCopasiFiles(), slotFileExamplesSBMLFiles(), slotFileOpen(), slotFileSave(), slotFileSaveAs(), slotFontSelection(), slotFunctionDBLoad(), slotFunctionDBSave(), slotImportSBML(), slotQuit(), slotShowObjectBrowserDialog(), slotShowSliders(), slotUpdateInitialState(), slotUpdateMIRIAM(), and CQIconResource::sToIs.

Referenced by CopasiUI3Window().

298 {
299  //TODO: use the QKeySequence standard shortcuts
300  //TODO: add tool tips, status tips etc.
301 
302  mpaNew = new QAction(CQIconResource::icon(CQIconResource::fileNew), "&New", this);
303  connect(mpaNew, SIGNAL(activated()), this, SLOT(newDoc()));
304  mpaNew->setShortcut(Qt::CTRL + Qt::Key_N);
305 
306  mpaOpen = new QAction(CQIconResource::icon(CQIconResource::fileOpen), "&Open...", this);
307  connect(mpaOpen, SIGNAL(activated()), this, SLOT(slotFileOpen()));
308  mpaOpen->setShortcut(Qt::CTRL + Qt::Key_O);
309 
310  mpaOpenCopasiFiles = new QAction(CQIconResource::icon(CQIconResource::fileOpen), "COP&ASI Files...", this);
311  connect(mpaOpenCopasiFiles, SIGNAL(activated()), this, SLOT(slotFileExamplesCopasiFiles()));
312  // mpaOpenCopasiFiles->setShortcut(Qt::CTRL + Qt::Key_1);
313 
314  mpaOpenSBMLFiles = new QAction(CQIconResource::icon(CQIconResource::fileOpen), "S&BML Files...", this);
315  connect(mpaOpenSBMLFiles, SIGNAL(activated()), this, SLOT(slotFileExamplesSBMLFiles()));
316  // mpaOpenSBMLFiles->setShortcut(Qt::CTRL + Qt::Key_2);
317 
318  mpaSave = new QAction(CQIconResource::icon(CQIconResource::fileSave), "&Save", this);
319  connect(mpaSave, SIGNAL(activated()), this, SLOT(slotFileSave()));
320  mpaSave->setShortcut(Qt::CTRL + Qt::Key_S);
321 
322  mpaSaveAs = new QAction(CQIconResource::icon(CQIconResource::fileSaveas), "Save &As...", this);
323  connect(mpaSaveAs, SIGNAL(activated()), this, SLOT(slotFileSaveAs()));
324  mpaSaveAs->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_S);
325 
326  mpaImportSBML = new QAction(CQIconResource::icon(CQIconResource::fileOpen), "&Import SBML...", this);
327  connect(mpaImportSBML, SIGNAL(activated()), this, SLOT(slotImportSBML()));
328  mpaImportSBML->setShortcut(Qt::CTRL + Qt::Key_I);
329 
330  mpaExportSBML = new QAction(CQIconResource::icon(CQIconResource::fileExport), "&Export SBML...", this);
331  connect(mpaExportSBML, SIGNAL(activated()), this, SLOT(slotExportSBML()));
332  mpaExportSBML->setShortcut(Qt::CTRL + Qt::Key_E);
333 
334  mpaExportODE = new QAction(CQIconResource::icon(CQIconResource::fileExport), "Export ODEs...", this);
335  connect(mpaExportODE, SIGNAL(activated()), this, SLOT(slotExportMathModel()));
336  mpaExportODE->setShortcut(Qt::CTRL + Qt::Key_M);
337 
338  mpaQuit = new QAction("&Quit", this);
339  connect(mpaQuit, SIGNAL(activated()), this, SLOT(slotQuit()));
340  mpaQuit->setShortcut(Qt::CTRL + Qt::Key_Q);
341 
342  mpaSliders = new QAction(CQIconResource::icon(CQIconResource::slider), "Show sliders", this);
343  mpaSliders->setCheckable(true);
344  connect(mpaSliders, SIGNAL(toggled(bool)), this, SLOT(slotShowSliders(bool)));
345 
346  mpaObjectBrowser = new QAction("Object &Browser", this);
347  mpaObjectBrowser->setCheckable(true);
348  connect(mpaObjectBrowser, SIGNAL(toggled(bool)), this, SLOT(slotShowObjectBrowserDialog(bool)));
349 
350  mpaCheckModel = new QAction(CQIconResource::icon(CQIconResource::checkMark), "Check model", this);
351  connect(mpaCheckModel, SIGNAL(activated()), this, SLOT(slotCheckModel()));
352 
353  mpaUpdateMIRIAM = new QAction(CQIconResource::icon(CQIconResource::miriam), "Update MIRIAM", this);
354  connect(mpaUpdateMIRIAM, SIGNAL(activated()), this, SLOT(slotUpdateMIRIAM()));
355 
356  mpaApplyInitialState = new QAction(CQIconResource::icon(CQIconResource::isToS), "Apply initial state", this);
357  connect(mpaApplyInitialState, SIGNAL(activated()), this, SLOT(slotApplyInitialState()));
358 
359  mpaUpdateInitialState = new QAction(CQIconResource::icon(CQIconResource::sToIs), "Update initial state from current state", this);
360  connect(mpaUpdateInitialState, SIGNAL(activated()), this, SLOT(slotUpdateInitialState()));
361 
362  mpaCapture = new QAction(CQIconResource::icon(CQIconResource::captureImage), "Capture the main window", this);
363  connect(mpaCapture, SIGNAL(activated()), this, SLOT(slotCapture()));
364 
365  mpaExpandModel = new QAction("Create array of compartments (debug version)", this);
366  connect(mpaExpandModel, SIGNAL(activated()), this, SLOT(slotExpandModel()));
367 
368  mpaFontSelectionDialog = new QAction("Select the Application Font", this);
369  connect(mpaFontSelectionDialog, SIGNAL(activated()), this, SLOT(slotFontSelection()));
370 
371  //TODO SEDML
372 #ifdef COPASI_SEDML
373  mpaOpenSEDMLFiles = new QAction(CQIconResource::icon(CQIconResource::fileOpen), "S&ED-ML Files...", this);
374  connect(mpaOpenSEDMLFiles, SIGNAL(activated()), this, SLOT(slotFileExamplesSEDMLFiles()));
375  // mpaOpenSEDMLFiles->setShortcut(Qt::CTRL + Qt::Key_3);
376 
377  mpaImportSEDML = new QAction(CQIconResource::icon(CQIconResource::fileOpen), "&Import SED-ML...", this);
378  connect(mpaImportSEDML, SIGNAL(activated()), this, SLOT(slotImportSEDML()));
379  // mpaImportSEDML->setShortcut(Qt::CTRL + Qt::Key_X);
380 
381  mpaExportSEDML = new QAction(CQIconResource::icon(CQIconResource::fileExport), "&Export SED-ML...", this);
382  connect(mpaExportSEDML, SIGNAL(activated()), this, SLOT(slotExportSEDML()));
383  // mpaExportSEDML->setShortcut(Qt::CTRL + Qt::Key_Z);
384 #endif
385  // QAction* mpaObjectBrowser;
386 
387 #ifdef WITH_MERGEMODEL
388  mpaAddModel = new QAction(CQIconResource::icon(CQIconResource::fileAdd), "&Add ...", this);
389  mpaAddModel->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_A);
390  connect(mpaAddModel, SIGNAL(activated()), this, SLOT(slotAddFileOpen()));
391 
392  mpaMergeModels = new QAction("&Merge ...", this);
393  mpaMergeModels->setShortcut(Qt::SHIFT + Qt::CTRL + Qt::Key_M);
394  connect(mpaMergeModels, SIGNAL(activated()), this, SLOT(slotMergeModels()));
395 #endif
396 
397  mpaCloseAllWindows = new QAction("Close all windows below:", this);
398  connect(mpaCloseAllWindows, SIGNAL(activated()), this, SLOT(slotCloseAllWindows()));
399 
400  mpaFunctionDBLoad = new QAction(CQIconResource::icon(CQIconResource::fileOpen), "Load Function DB...", this);
401  connect(mpaFunctionDBLoad, SIGNAL(activated()), this, SLOT(slotFunctionDBLoad()));
402  mpaFunctionDBSave = new QAction(CQIconResource::icon(CQIconResource::fileSaveas), "Save Function DB...", this);
403  connect(mpaFunctionDBSave, SIGNAL(activated()), this, SLOT(slotFunctionDBSave()));
404 }
QAction * mpaUpdateInitialState
void slotFileOpen(QString file=QString::null)
QAction * mpaFontSelectionDialog
QAction * mpaFunctionDBLoad
QAction * mpaOpenSBMLFiles
QAction * mpaCapture
void slotFunctionDBSave(QString str=QString::null)
void slotShowSliders(bool flag)
QAction * mpaObjectBrowser
QAction * mpaCloseAllWindows
QAction * mpaImportSBML
QAction * mpaFunctionDBSave
QAction * mpaSliders
void slotFunctionDBLoad(QString str=QString::null)
void slotFileSaveAs(QString str=QString::null)
static const QIcon & icon(const IconID &id)
QAction * mpaExportODE
QAction * mpaCheckModel
QAction * mpaExpandModel
QAction * mpaOpenCopasiFiles
QAction * mpaApplyInitialState
void slotFileExamplesCopasiFiles(QString file=QString::null)
QAction * mpaExportSBML
QAction * mpaUpdateMIRIAM
void slotFileExamplesSBMLFiles(QString file=QString::null)
void slotImportSBML(QString file=QString::null)
void slotShowObjectBrowserDialog(bool flag)
void CopasiUI3Window::createMenuBar ( )
private

Definition at line 489 of file copasiui3window.cpp.

References about(), aboutQt(), license(), mpaApplyInitialState, mpaCapture, mpaCheckModel, mpaExpandModel, mpaExportODE, mpaExportSBML, mpaFontSelectionDialog, mpaFunctionDBLoad, mpaFunctionDBSave, mpaImportSBML, mpaNew, mpaObjectBrowser, mpaOpen, mpaOpenCopasiFiles, mpaOpenSBMLFiles, mpaQuit, mpaSave, mpaSaveAs, mpaSliders, mpaUpdateInitialState, mpaUpdateMIRIAM, mpMenuExamples, mpMenuRecentFiles, mpMenuRecentSBMLFiles, mpTools, mpWindowsMenu, refreshRecentFileMenu(), refreshRecentSBMLFileMenu(), refreshWindowsMenu(), slotConvertToIrreversible(), slotPreferences(), and slotTutorialWizard().

Referenced by CopasiUI3Window().

490 {
491 
492  QMenu * pFileMenu = menuBar()->addMenu("&File");
493 
494  pFileMenu->addAction(mpaNew);
495  pFileMenu->addAction(mpaOpen);
496 
497  mpMenuExamples = pFileMenu->addMenu("Examples");
499  mpMenuExamples->addAction(mpaOpenSBMLFiles);
500 
501 #ifdef COPASI_SEDML
502  mpMenuExamples->addAction(mpaOpenSEDMLFiles);
503 #endif
504 
505  pFileMenu->addAction(mpaSave);
506  pFileMenu->addAction(mpaSaveAs);
507 
508  pFileMenu->addSeparator();
509 
510  pFileMenu->addAction(mpaImportSBML);
511  pFileMenu->addAction(mpaExportSBML);
512  pFileMenu->addAction(mpaExportODE);
513 
514  //TODO SEDML
515 #ifdef COPASI_SEDML
516  pFileMenu->addSeparator();
517  mpMenuSEDMLSupport = pFileMenu->addMenu("SED-ML Support");
518  mpMenuSEDMLSupport->addAction(mpaImportSEDML);
519  mpMenuSEDMLSupport->addAction(mpaExportSEDML);
520 
521  mpMenuRecentSEDMLFiles = mpMenuSEDMLSupport->addMenu("Recent SED-ML Files");
522  refreshRecentSEDMLFileMenu();
523 #endif
524 
525 #ifdef WITH_MERGEMODEL
526  pFileMenu->addAction(mpaAddModel);
527  //pFileMenu->addAction(mpaMergeModels);
528 #endif
529 
530  pFileMenu->addSeparator();
531  pFileMenu->addAction(mpaFunctionDBLoad);
532  pFileMenu->addAction(mpaFunctionDBSave);
533 
534  pFileMenu->addSeparator();
535 
536  mpMenuRecentFiles = pFileMenu->addMenu("Recent Files");
538 
539  mpMenuRecentSBMLFiles = pFileMenu->addMenu("Recent SBML Files");
541 
542  pFileMenu->addSeparator();
543 
544  pFileMenu->addAction(mpaQuit);
545 
546  //****** tools menu **************
547 
548  mpTools = menuBar()->addMenu("&Tools");
549 
550  mpTools->addAction(mpaApplyInitialState);
551  mpTools->addAction(mpaUpdateInitialState);
552  mpTools->addAction(mpaSliders);
553  mpTools->addAction(mpaCapture);
554 #ifdef WITH_MERGEMODEL
555  mpTools->addAction(mpaMergeModels);
556 #endif
557 
558  mpTools->addSeparator();
559  mpTools->addAction(mpaExpandModel);
560 #ifdef COPASI_DEBUG
561  mpTools->addAction(mpaObjectBrowser);
562  mpTools->addSeparator();
563 #endif // COPASI_DEBUG
564 
565  mpTools->addAction(mpaCheckModel);
566  mpTools->addAction("&Convert to irreversible", this, SLOT(slotConvertToIrreversible()));
567 
568 #ifdef WITH_PE_EVENT_CREATION
569  mpTools->addAction("&Create Events For Timeseries Experiment", this, SLOT(slotCreateEventsForTimeseries()));
570 #endif
571 
572 #ifdef COPASI_SBW_INTEGRATION
573  // create and populate SBW menu
574  mpSBWMenu = new QMenu("&SBW", this);
575  mpSBWAction = mpTools->addMenu(mpSBWMenu);
576 #endif // COPASI_SBW_INTEGRATION
577 
578  mpTools->addSeparator();
579  mpTools->addAction(mpaUpdateMIRIAM);
580  mpTools->addAction("&Preferences", this, SLOT(slotPreferences()));
581  mpTools->addAction(mpaFontSelectionDialog);
582 
583  //****** windows menu **************
584  mpWindowsMenu = menuBar()->addMenu("&Window");
586 
587  //******* help menu *****************
588 
589  menuBar()->addSeparator();
590 
591  QMenu * help = menuBar()->addMenu("&Help");
592 
593  help->addAction("Simple &Wizard", this, SLOT(slotTutorialWizard()));
594  help->addSeparator();
595  help->addAction("&About", this, SLOT(about()), Qt::Key_F1);
596  help->addAction("&License", this, SLOT(license()));
597  help->addAction("About &Qt", this, SLOT(aboutQt()));
598  help->addSeparator();
599  // help->addAction("What's &This", this, SLOT(whatsThis()), Qt::SHIFT + Qt::Key_F1);
600 }
QAction * mpaUpdateInitialState
QAction * mpaFontSelectionDialog
QMenu * mpMenuRecentFiles
QAction * mpaFunctionDBLoad
QAction * mpaOpenSBMLFiles
QAction * mpaCapture
QMenu * mpMenuRecentSBMLFiles
QAction * mpaObjectBrowser
QAction * mpaImportSBML
QAction * mpaFunctionDBSave
QAction * mpaSliders
void refreshRecentSBMLFileMenu()
QAction * mpaExportODE
QAction * mpaCheckModel
QAction * mpaExpandModel
QAction * mpaOpenCopasiFiles
void slotConvertToIrreversible()
QAction * mpaApplyInitialState
QAction * mpaExportSBML
QAction * mpaUpdateMIRIAM
void CopasiUI3Window::createToolBar ( )
private

Definition at line 457 of file copasiui3window.cpp.

References mpaApplyInitialState, mpaCapture, mpaCheckModel, mpaNew, mpaOpen, mpaSave, mpaSliders, mpaUpdateInitialState, mpaUpdateMIRIAM, mpBoxSelectFramework, and slotFrameworkChanged().

Referenced by CopasiUI3Window().

458 {
459  QToolBar * tb = addToolBar("MainToolBar");
460 
461  tb->addAction(mpaNew);
462  tb->addAction(mpaOpen);
463  tb->addAction(mpaSave);
464  tb->addAction(mpaCapture);
465  tb->addAction(mpaSliders);
466  tb->addAction(mpaCheckModel);
467  tb->addAction(mpaApplyInitialState);
468  tb->addAction(mpaUpdateInitialState);
469  tb->addAction(mpaUpdateMIRIAM);
470 
471 #ifdef WITH_MERGEMODEL
472  tb->addAction(mpaAddModel);
473  //tb->addAction(mpaMergeModels);
474 #endif
475 
476  tb->addSeparator();
477 
478  mpBoxSelectFramework = new QComboBox(tb);
479  QStringList items;
480  items << "Concentrations" << "Particle Numbers";
481  mpBoxSelectFramework->addItems(items);
482  tb->addWidget(mpBoxSelectFramework);
483 
484  connect(mpBoxSelectFramework, SIGNAL(activated(int)), this, SLOT(slotFrameworkChanged(int)));
485 
486  setUnifiedTitleAndToolBarOnMac(true);
487 }
QAction * mpaUpdateInitialState
QAction * mpaCapture
QComboBox * mpBoxSelectFramework
QAction * mpaSliders
QAction * mpaCheckModel
QAction * mpaApplyInitialState
QAction * mpaUpdateMIRIAM
void slotFrameworkChanged(int index)
void CopasiUI3Window::customEvent ( QEvent *  )
protectedslot

Definition at line 2727 of file copasiui3window.cpp.

2727 {}
void CopasiUI3Window::disableSliders ( bool  disable)

The slider dialog has to be disabled before a task is run and reenabled afterwards. Actually the methods stores the state when the value true is passed and restores that state when the value false is passed.

Definition at line 2792 of file copasiui3window.cpp.

References mpSliders, mSliderDialogEnabled, and SliderDialog::updateAllSliders().

Referenced by CProgressBar::CProgressBar(), and CProgressBar::finish().

2793 {
2794  if (disable)
2795  {
2796  this->mSliderDialogEnabled = this->mpSliders->isEnabled();
2797  this->mpSliders->setEnabled(false);
2798  }
2799  else
2800  {
2801  this->mpSliders->setEnabled(this->mSliderDialogEnabled);
2802  this->mpSliders->updateAllSliders();
2803  }
2804 }
SliderDialog * mpSliders
virtual void updateAllSliders()
void CopasiUI3Window::dragEnterEvent ( QDragEnterEvent *  event)
protected

Definition at line 2731 of file copasiui3window.cpp.

2732 {
2733  if (event->mimeData()->hasFormat("text/uri-list"))
2734  event->acceptProposedAction();
2735 }
void CopasiUI3Window::dropEvent ( QDropEvent *  event)
protected

Definition at line 2762 of file copasiui3window.cpp.

References isProabablySBML(), slotFileOpen(), and slotImportSBML().

2763 {
2764  QList<QUrl> urls = event->mimeData()->urls();
2765 
2766  if (urls.isEmpty())
2767  return;
2768 
2769  QString fileName = urls.first().toLocalFile();
2770 
2771  if (fileName.isEmpty())
2772  return;
2773 
2774  if (isProabablySBML(fileName))
2775  slotImportSBML(fileName);
2776 
2777 #ifdef COPASI_SEDML
2778  else if (isProabablySBML(fileName))
2779  slotImportSEDML(fileName);
2780 
2781 #endif
2782  else
2783  slotFileOpen(fileName);
2784 }
void slotFileOpen(QString file=QString::null)
bool isProabablySBML(QString &fileName)
void slotImportSBML(QString file=QString::null)
void CopasiUI3Window::exportSBMLToString ( std::string &  SBML)

Definition at line 1932 of file copasiui3window.cpp.

References DataModelGUI::commit(), DataModelGUI::exportSBMLToString(), mpDataModelGUI, and slotExportSBMLToStringFinished().

1933 {
1935 
1936  if (mpDataModelGUI)
1937  {
1938  setCursor(Qt::WaitCursor);
1939  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotExportSBMLToStringFinished(bool)));
1940 
1942  }
1943 }
void exportSBMLToString(std::string &sbmlDocumentText)
DataModelGUI * mpDataModelGUI
void slotExportSBMLToStringFinished(bool success)
DataModelGUI * CopasiUI3Window::getDataModel ( )
ListViews * CopasiUI3Window::getMainWidget ( )
CopasiUI3Window * CopasiUI3Window::getMainWindow ( )
static
const QList< QPointer< QMainWindow > > & CopasiUI3Window::getWindows ( ) const

Returns the list of current windows

Definition at line 1961 of file copasiui3window.cpp.

References mWindows.

Referenced by Worker::slotNotify().

1962 {
1963  return mWindows;
1964 }
QList< QPointer< QMainWindow > > mWindows
void CopasiUI3Window::importSBMLFromString ( const std::string &  sbmlDocumentText)

This is used to import an SBML file from a std::string in the GUI it does all the necessary GUI stuff like asking to save the old document, displaying messages, etc.

Definition at line 1305 of file copasiui3window.cpp.

References DataModelGUI::commit(), ListViews::DELETE, CCopasiRootContainer::getDatamodelList(), DataModelGUI::importSBMLFromString(), SliderDialog::isChanged(), mCommitRequired, ListViews::MODEL, mpDataModelGUI, mpListView, mpSliders, DataModelGUI::notify(), CQMessageBox::question(), slotFileSave(), slotImportSBMLFromStringFinished(), and ListViews::switchToOtherWidget().

1306 {
1307  if (mCommitRequired)
1308  {
1310  }
1311 
1312  if (!sbmlDocumentText.empty())
1313  {
1314  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1315 
1316  if (mpDataModelGUI && ((*CCopasiRootContainer::getDatamodelList())[0]->isChanged() || this->mpSliders->isChanged()))
1317  {
1318  switch (CQMessageBox::question(this, "COPASI",
1319  "The document contains unsaved changes\n"
1320  "Do you want to save the changes before exiting?",
1321  QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
1322  QMessageBox::Save))
1323  {
1324  case QMessageBox::Save:
1325  mCommitRequired = false;
1326  slotFileSave();
1327  break;
1328 
1329  case QMessageBox::Discard:
1330  break;
1331 
1332  case QMessageBox::Cancel:
1333  default:
1334  return;
1335  break;
1336  }
1337  }
1338 
1340  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
1341 
1343 
1344  if (!mpDataModelGUI)
1345  {
1346  mpDataModelGUI = new DataModelGUI(this); // create a new data model
1347  }
1348 
1349  setCursor(Qt::WaitCursor);
1350  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotImportSBMLFromStringFinished(bool)));
1351 
1352  mpDataModelGUI->importSBMLFromString(sbmlDocumentText);
1353  }
1354 }
ListViews * mpListView
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
SliderDialog * mpSliders
void slotImportSBMLFromStringFinished(bool success)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
bool isChanged() const
DataModelGUI * mpDataModelGUI
void importSBMLFromString(const std::string &sbmlDocumentText)
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
bool CopasiUI3Window::isMainThread ( )
static
void CopasiUI3Window::license ( )
protectedslot

Definition at line 1252 of file copasiui3window.cpp.

References FixedTitle, and CCopasiRootContainer::getLicenseHTML().

Referenced by createMenuBar().

1253 {
1254  AboutDialog* aboutDialog = new AboutDialog(this, CCopasiRootContainer::getLicenseHTML(), 76, 30);
1255  aboutDialog->setWindowTitle(FixedTitle);
1256  aboutDialog->exec();
1257 }
static const char * getLicenseHTML()
void CopasiUI3Window::listViewsFolderChanged ( const QModelIndex &  index)
protectedslot

Definition at line 1732 of file copasiui3window.cpp.

References ListViews::getCurrentItemId(), mpListView, mpSliders, refreshWindowsMenu(), and SliderDialog::setCurrentFolderId().

Referenced by CopasiUI3Window().

1733 {
1734  size_t id = mpListView->getCurrentItemId();
1735  this->mpSliders->setCurrentFolderId(id);
1737 }
ListViews * mpListView
SliderDialog * mpSliders
void setCurrentFolderId(size_t id)
size_t getCurrentItemId()
Definition: listviews.cpp:938
const bool & CopasiUI3Window::messageShown ( ) const

Definition at line 2076 of file copasiui3window.cpp.

References mMessageShown.

2077 {
2078  return mMessageShown;
2079 }
void CopasiUI3Window::newDoc ( )
protectedslot

Definition at line 700 of file copasiui3window.cpp.

References ListViews::ADD, DataModelGUI::commit(), DataModelGUI::createModel(), ListViews::DELETE, ListViews::getCurrentWidget(), CCopasiRootContainer::getDatamodelList(), SliderDialog::isChanged(), mCommitRequired, mNewFile, ListViews::MODEL, mpaExportODE, mpaExportSBML, mpaSave, mpaSaveAs, mpDataModelGUI, mpListView, mpSliders, mSaveAsRequired, DataModelGUI::notify(), CQMessageBox::question(), SliderDialog::reset(), CQTabWidget::selectTab(), SliderDialog::setChanged(), signalLoadFile(), slotFileSave(), ListViews::switchToOtherWidget(), and updateTitle().

Referenced by createActions(), openInitialDocument(), and slotFileOpenFinished().

701 {
702  disconnect(this, SIGNAL(signalLoadFile(QString)), this, SLOT(newDoc()));
703 
704  if (mCommitRequired)
705  {
707  }
708 
709  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
710 
711  if (mpDataModelGUI && ((*CCopasiRootContainer::getDatamodelList())[0]->isChanged() || this->mpSliders->isChanged()))
712  {
713  switch (CQMessageBox::question(this, "COPASI",
714  "The document contains unsaved changes\n"
715  "Do you want to save the changes before exiting?",
716  QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
717  QMessageBox::Save))
718  {
719  case QMessageBox::Save:
720  connect(this, SIGNAL(signalLoadFile(QString)), this, SLOT(newDoc()));
721 
722  mNewFile = "newDoc()";
723  mCommitRequired = false;
724  slotFileSave();
725  return;
726 
727  break;
728 
729  case QMessageBox::Discard:
730  break;
731 
732  case QMessageBox::Cancel:
733  default:
734  return;
735  break;
736  }
737  }
738 
740  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
741 
743 
744  // delete the old sliders
745  if (this->mpSliders) this->mpSliders->reset();
746 
748  this->mpSliders->setChanged(false);
750  //if (!mbObject_browser_open)
751  //mpFileMenu->setItemEnabled(nobject_browser, true);
752 
753  mpaSave->setEnabled(true);
754  mpaSaveAs->setEnabled(true);
755  mpaExportSBML->setEnabled(true);
756  mpaExportODE->setEnabled(true);
757 
758 #ifdef COPASI_SEDML
759  mpaExportSEDML->setEnabled(true);
760 #endif
761 
762  updateTitle();
764  CQTabWidget *widget = dynamic_cast<CQTabWidget *>(mpListView->getCurrentWidget());
765 
766  if (widget != NULL)
767  widget->selectTab(0);
768 
769  mSaveAsRequired = true;
770  mCommitRequired = true;
771 }
ListViews * mpListView
CopasiWidget * getCurrentWidget()
Definition: listviews.cpp:995
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
SliderDialog * mpSliders
void selectTab(int index) const
void setChanged(bool changed)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
QAction * mpaExportODE
bool isChanged() const
bool createModel()
QAction * mpaExportSBML
void signalLoadFile(QString newFile)
DataModelGUI * mpDataModelGUI
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CopasiUI3Window::openInitialDocument ( const QString &  file)
slot

Definition at line 773 of file copasiui3window.cpp.

References COptions::compareValue(), FROM_UTF8, COptions::getNonOptions(), COptions::getValue(), newDoc(), slotFileOpen(), and slotImportSBML().

Referenced by CQCopasiApplication::setMainWindow(), and Worker::Worker().

774 {
775  if (file != "")
776  {
777  slotFileOpen(file);
778  }
779  else if (!COptions::compareValue("ImportSBML", std::string("")))
780  {
781  // Import the SBML File
782  std::string ImportSBML;
783  COptions::getValue("ImportSBML", ImportSBML);
784  slotImportSBML(FROM_UTF8(ImportSBML));
785  }
786 
787 #ifdef COPASI_SEDML
788  else if (!COptions::compareValue("ImportSEDML", std::string("")))
789  {
790  // Import the SEDML File
791  std::string ImportSEDML;
792  COptions::getValue("ImportSEDML", ImportSEDML);
793  slotImportSEDML(FROM_UTF8(ImportSEDML));
794  }
795 
796 #endif
797  else if (COptions::getNonOptions().size())
798  {
799  // Look at commandline
801  }
802  else
803  {
804  newDoc();
805  }
806 
807 #ifdef COPASI_SBW_INTEGRATION
808  sbwConnect();
809 #endif // COPASI_SBW_INTEGRATION
810 }
void slotFileOpen(QString file=QString::null)
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static const nonOptionType & getNonOptions()
Definition: COptions.cpp:251
static bool compareValue(const std::string &name, const CType &value)
Definition: COptions.h:128
static void getValue(const std::string &name, CType &value)
Definition: COptions.h:124
void slotImportSBML(QString file=QString::null)
void CopasiUI3Window::refreshRecentFileMenu ( )
private

Definition at line 1866 of file copasiui3window.cpp.

References CCopasiParameterGroup::beginIndex(), C_INT, CCopasiParameterGroup::endIndex(), FROM_UTF8, CCopasiRootContainer::getConfiguration(), CCopasiParameterGroup::getGroup(), CConfigurationFile::getRecentFiles(), mpMenuRecentFiles, mpRecentFilesActionGroup, mRecentFilesActionMap, and slotOpenRecentFile().

Referenced by createMenuBar(), slotFileOpenFinished(), and slotFileSaveFinished().

1867 {
1868  mpMenuRecentFiles->clear();
1869 
1870  mRecentFilesActionMap.clear();
1871 
1872  if (mpRecentFilesActionGroup != NULL)
1873  {
1874  disconnect(mpRecentFilesActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenRecentFile(QAction *)));
1875  mpRecentFilesActionGroup->deleteLater();
1876  mpRecentFilesActionGroup = NULL;
1877  }
1878 
1879  mpRecentFilesActionGroup = new QActionGroup(this);
1880  connect(mpRecentFilesActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenRecentFile(QAction *)));
1881 
1882  QAction * pAction;
1883 
1888 
1889  C_INT Index = 0;
1890 
1891  for (; it != end; ++it, ++Index)
1892  {
1893  pAction = new QAction(FROM_UTF8(*(*it)->getValue().pSTRING), mpRecentFilesActionGroup);
1894  mpMenuRecentFiles->addAction(pAction);
1895  mRecentFilesActionMap[pAction] = Index;
1896  }
1897 }
#define C_INT
Definition: copasi.h:115
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
QMenu * mpMenuRecentFiles
index_iterator endIndex() const
CRecentFiles & getRecentFiles()
QActionGroup * mpRecentFilesActionGroup
static CConfigurationFile * getConfiguration()
void slotOpenRecentFile(QAction *pAction)
index_iterator beginIndex() const
QMap< QAction *, int > mRecentFilesActionMap
CCopasiParameterGroup * getGroup(const std::string &name)
parameterGroup::iterator index_iterator
void CopasiUI3Window::refreshRecentSBMLFileMenu ( )
private

Definition at line 1899 of file copasiui3window.cpp.

References CCopasiParameterGroup::beginIndex(), C_INT, CCopasiParameterGroup::endIndex(), FROM_UTF8, CCopasiRootContainer::getConfiguration(), CCopasiParameterGroup::getGroup(), CConfigurationFile::getRecentSBMLFiles(), mpMenuRecentSBMLFiles, mpRecentSBMLFilesActionGroup, mRecentSBMLFilesActionMap, and slotOpenRecentSBMLFile().

Referenced by createMenuBar(), slotExportSBMLFinished(), and slotImportSBMLFinished().

1900 {
1901  mpMenuRecentSBMLFiles->clear();
1902 
1903  mRecentSBMLFilesActionMap.clear();
1904 
1905  if (mpRecentSBMLFilesActionGroup != NULL)
1906  {
1907  disconnect(mpRecentSBMLFilesActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenRecentSBMLFile(QAction *)));
1908  mpRecentSBMLFilesActionGroup->deleteLater();
1910  }
1911 
1912  mpRecentSBMLFilesActionGroup = new QActionGroup(this);
1913  connect(mpRecentSBMLFilesActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotOpenRecentSBMLFile(QAction *)));
1914 
1915  QAction * pAction;
1916 
1921 
1922  C_INT Index = 0;
1923 
1924  for (; it != end; ++it, ++Index)
1925  {
1926  pAction = new QAction(FROM_UTF8(*(*it)->getValue().pSTRING), mpRecentSBMLFilesActionGroup);
1927  mpMenuRecentSBMLFiles->addAction(pAction);
1928  mRecentSBMLFilesActionMap[pAction] = Index;
1929  }
1930 }
#define C_INT
Definition: copasi.h:115
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
QActionGroup * mpRecentSBMLFilesActionGroup
QMenu * mpMenuRecentSBMLFiles
index_iterator endIndex() const
void slotOpenRecentSBMLFile(QAction *pAction)
static CConfigurationFile * getConfiguration()
index_iterator beginIndex() const
CRecentFiles & getRecentSBMLFiles()
QMap< QAction *, int > mRecentSBMLFilesActionMap
CCopasiParameterGroup * getGroup(const std::string &name)
parameterGroup::iterator index_iterator
void CopasiUI3Window::refreshWindowsMenu ( )
private

Definition at line 1984 of file copasiui3window.cpp.

References CWindowInterface::getWindowMenu(), mpaCloseAllWindows, mpWindowsActionGroup, mpWindowsMenu, mWindows, and slotActivateWindowTriggered().

Referenced by addWindow(), createMenuBar(), listViewsFolderChanged(), removeWindow(), and slotCloseAllWindows().

1985 {
1986  // (I assume a QActionGroup was used, so only one window will be activated at a time)
1987  if (mpWindowsActionGroup != NULL)
1988  {
1989  disconnect(mpWindowsActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotActivateWindowTriggered(QAction *)));
1990  mpWindowsActionGroup->deleteLater();
1991  mpWindowsActionGroup = NULL;
1992  }
1993 
1994  mpWindowsActionGroup = new QActionGroup(this);
1995  connect(mpWindowsActionGroup, SIGNAL(triggered(QAction *)), this, SLOT(slotActivateWindowTriggered(QAction *)));
1996 
1997  // Re-initialize items the menus will always have
1998  mpWindowsMenu->clear();
1999  // COPASI main window
2000  QAction * pAction = new QAction(mWindows[0]->windowTitle(), mpWindowsActionGroup);
2001  mpWindowsMenu->addAction(pAction);
2002 
2003  if (mWindows.count() > 1)
2004  {
2005  mpWindowsMenu->addSeparator();
2006  mpWindowsMenu->addAction(mpaCloseAllWindows);
2007  mpWindowsMenu->addSeparator();
2008  }
2009 
2010  // . . . for the secondary windows, also . . .
2011  for (int index = 1; index < mWindows.count(); ++index)
2012  {
2013  QMainWindow* mainWindow = mWindows[index];
2014 
2015  if (mainWindow == NULL) continue;
2016 
2017  CWindowInterface* window = dynamic_cast<CWindowInterface*>(mainWindow);
2018  QMenu* menu = window->getWindowMenu();
2019  menu->clear();
2020  menu->addAction(pAction);
2021  menu->addSeparator();
2022  menu->addAction(mpaCloseAllWindows);
2023  menu->addSeparator();
2024  }
2025 
2026  // Add secondary windows to the Window menus
2027  for (int index = 1; index < mWindows.count(); ++index)
2028  {
2029  QMainWindow* mActionWindow = mWindows[index];
2030 
2031  if (mActionWindow == NULL) continue;
2032 
2033  pAction = new QAction(mWindows[index]->windowTitle(), mpWindowsActionGroup);
2034  mpWindowsMenu->addAction(pAction);
2035 
2036  for (int index1 = 1; index1 < mWindows.count(); ++index1)
2037  {
2038  QMainWindow* mainWindow = mWindows[index1];
2039 
2040  if (mainWindow == NULL) continue;
2041 
2042  CWindowInterface* window = dynamic_cast<CWindowInterface*>(mainWindow);
2043  QMenu* menu = window->getWindowMenu();
2044  menu->addAction(pAction);
2045  }
2046  }
2047 }
QActionGroup * mpWindowsActionGroup
virtual QMenu * getWindowMenu() const =0
QAction * mpaCloseAllWindows
void slotActivateWindowTriggered(QAction *action)
QList< QPointer< QMainWindow > > mWindows
void CopasiUI3Window::removeWindow ( QMainWindow *  pWindow)

Definition at line 1972 of file copasiui3window.cpp.

References mWindows, and refreshWindowsMenu().

Referenced by PlotWindow::closeEvent(), CWindowInterface::removeFromMainWindow(), and slotShowSliders().

1973 {
1974  int index = mWindows.indexOf(pWindow);
1975 
1976  if (index == -1)
1977  return;
1978 
1979  // only delete when there is such a window
1980  mWindows.removeAt(index);
1982 }
QList< QPointer< QMainWindow > > mWindows
void CopasiUI3Window::setApplicationFont ( )
private

Definition at line 2250 of file copasiui3window.cpp.

References FROM_UTF8, CConfigurationFile::getApplicationFont(), CCopasiRootContainer::getConfiguration(), CConfigurationFile::setApplicationFont(), and TO_UTF8.

Referenced by CopasiUI3Window().

2251 {
2252  std::string ApplicationFont = CCopasiRootContainer::getConfiguration()->getApplicationFont();
2253 
2254  if (ApplicationFont == "")
2255  {
2256  return;
2257  }
2258 
2259  QFont Font = qApp->font();
2260 
2261  if (ApplicationFont == TO_UTF8(Font.toString()))
2262  {
2263  // We are using the default
2265  return;
2266  }
2267 
2268  // The user has chosen another font
2269  Font.fromString(FROM_UTF8(ApplicationFont));
2270  qApp->setFont(Font);
2271 
2272  // This appears to load the fonts, etc. from the previous configuration.
2273  // Two calls so that the tabwidget labels are correct
2274  qApp->setStyleSheet(" * {font : }");
2275  qApp->setStyleSheet(" * {font : }");
2276 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
const std::string getApplicationFont() const
static CConfigurationFile * getConfiguration()
void setApplicationFont(const std::string &applicationFont)
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
void CopasiUI3Window::setMessageShown ( const bool &  shown)

Definition at line 2071 of file copasiui3window.cpp.

References mMessageShown.

Referenced by CQMessageBox::CQMessageBox(), and CQMessageBox::~CQMessageBox().

2072 {
2073  mMessageShown = shown;
2074 }
void CopasiUI3Window::signalLoadFile ( QString  newFile)
signal
void CopasiUI3Window::signalQuit ( )
signal

Referenced by CleanUp().

void CopasiUI3Window::slotActivateWindowTriggered ( QAction *  action)
protectedslot

Definition at line 2063 of file copasiui3window.cpp.

References getWindowByTitle(), and mWindows.

Referenced by refreshWindowsMenu().

2064 {
2065  QMainWindow *window = getWindowByTitle(mWindows, action->text());
2066 
2067  if (window != NULL)
2068  window ->activateWindow();
2069 }
QMainWindow * getWindowByTitle(const QList< QPointer< QMainWindow > > &list, const QString &title)
QList< QPointer< QMainWindow > > mWindows
void CopasiUI3Window::slotApplyInitialState ( )
protectedslot

Definition at line 2155 of file copasiui3window.cpp.

References CModel::applyInitialValues(), ListViews::CHANGE, DataModelGUI::commit(), CModel::compileIfNecessary(), CCopasiRootContainer::getDatamodelList(), mpDataModelGUI, DataModelGUI::notify(), ListViews::STATE, and CModel::updateNonSimulatedValues().

Referenced by createActions().

2156 {
2158 
2159  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
2160  CModel *pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
2161 
2162  if (pModel != NULL)
2163  {
2164  pModel->compileIfNecessary(NULL);
2165  pModel->applyInitialValues();
2166  pModel->updateNonSimulatedValues();
2167 
2169  }
2170 }
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
void updateNonSimulatedValues(void)
Definition: CModel.cpp:1892
void applyInitialValues()
Definition: CModel.cpp:1236
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
bool compileIfNecessary(CProcessReport *pProcessReport)
Definition: CModel.cpp:612
DataModelGUI * mpDataModelGUI
Definition: CModel.h:50
void CopasiUI3Window::slotCapture ( )
protectedslot

Definition at line 2197 of file copasiui3window.cpp.

References C_INT32, checkSelection(), ListViews::getCurrentWidget(), CopasiFileDialog::getSaveFileName(), and mpListView.

Referenced by createActions().

2198 {
2199  QPixmap pixmap = QPixmap::grabWidget(mpListView->getCurrentWidget());
2200 
2201  C_INT32 Answer = QMessageBox::No;
2202  QString fileName;
2203 
2204  while (Answer == QMessageBox::No)
2205  {
2206  fileName = CopasiFileDialog::getSaveFileName(this,
2207  "Save File Dialog", "untitled.png", "PNG Files (*.png)", "Save Capture as PNG file");
2208 
2209  if (fileName.isEmpty()) return;
2210 
2211  // Checks whether the file exists
2212  Answer = checkSelection(fileName);
2213 
2214  if (Answer == QMessageBox::Cancel) return;
2215  }
2216 
2217  pixmap.save(fileName, "PNG");
2218 }
ListViews * mpListView
CopasiWidget * getCurrentWidget()
Definition: listviews.cpp:995
#define C_INT32
Definition: copasi.h:90
C_INT32 checkSelection(const QString &file)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CopasiUI3Window::slotCheckModel ( )
protectedslot

Definition at line 2082 of file copasiui3window.cpp.

References FROM_UTF8, CCopasiRootContainer::getDatamodelList(), and CModelAnalyzer::writeReport().

Referenced by createActions().

2083 {
2084  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
2086 
2087  std::ostringstream ss;
2088  // MA.writeReport(ss, true, false);
2089  MA.writeReport(ss, true, true);
2090 
2091  CQCheckModelWindow * checkModelWindow = new CQCheckModelWindow(this);
2092 
2093  checkModelWindow->setWindowTitle("Check Model");
2094  checkModelWindow->textEdit->setText(FROM_UTF8(ss.str()));
2095 
2096  checkModelWindow->show();
2097 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void CopasiUI3Window::slotCloseAllWindows ( )
protectedslot

Definition at line 2049 of file copasiui3window.cpp.

References mWindows, and refreshWindowsMenu().

Referenced by createActions().

2050 {
2051  // all except main window (index == 0)
2052  for (int index = mWindows.count() - 1; index >= 1 ; --index)
2053  {
2054  QMainWindow* window = mWindows[index];
2055 
2056  if (window != NULL)
2057  window->close();
2058  }
2059 
2061 }
QList< QPointer< QMainWindow > > mWindows
void CopasiUI3Window::slotConvertToIrreversible ( )
protectedslot

Definition at line 1691 of file copasiui3window.cpp.

References ListViews::CHANGE, CCopasiMessage::clearDeque(), DataModelGUI::commit(), CModel::convert2NonReversible(), CCopasiMessage::getAllMessageText(), CCopasiRootContainer::getDatamodelList(), CQMessageBox::information(), ListViews::MODEL, mpDataModelGUI, mpListView, DataModelGUI::notify(), and ListViews::switchToOtherWidget().

Referenced by createMenuBar().

1692 {
1693  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1694  CModel* model = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
1695 
1696  if (!model) return;
1697 
1699  mpListView->switchToOtherWidget(114, "");
1700 
1702 
1703  if (!model->convert2NonReversible())
1704  {
1705  // Display error messages.
1706  CQMessageBox::information(this, "Conversion Failed",
1708  QMessageBox::Ok | QMessageBox::Default,
1709  QMessageBox::NoButton);
1711  }
1712 
1713  (*CCopasiRootContainer::getDatamodelList())[0]->changed();
1714 
1716 }
ListViews * mpListView
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
static std::string getAllMessageText(const bool &chronological=true)
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static void clearDeque()
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
DataModelGUI * mpDataModelGUI
Definition: CModel.h:50
bool convert2NonReversible()
Definition: CModel.cpp:3205
void CopasiUI3Window::slotExpandModel ( )
protectedslot

Definition at line 2279 of file copasiui3window.cpp.

References ListViews::CHANGE, ListViews::MODEL, mpDataModelGUI, and DataModelGUI::notify().

Referenced by createActions().

2280 {
2281 
2282  CQExpandModelData *widget = new CQExpandModelData;
2283  widget->exec();
2284 
2286 }
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotExportMathModel ( )
protectedslot

Definition at line 1585 of file copasiui3window.cpp.

References CDirEntry::baseName(), C_INT32, checkSelection(), DataModelGUI::commit(), CDirEntry::dirName(), DataModelGUI::exportMathModel(), FROM_UTF8, CCopasiRootContainer::getDatamodelList(), CCopasiDataModel::getFileName(), CopasiFileDialog::getSaveFileName(), mpDataModelGUI, CDirEntry::Separator, slotExportMathModelFinished(), and TO_UTF8.

Referenced by createActions().

1586 {
1588 
1589  C_INT32 Answer = QMessageBox::No;
1590  QString tmp;
1591  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1593  assert(pDataModel != NULL);
1594 
1595  QString *userFilter = new QString;
1596 
1597  while (Answer == QMessageBox::No)
1598  {
1599  QString Default = QString::null;
1600 
1601  if (pDataModel->getFileName() != "")
1602  Default
1603  = FROM_UTF8(CDirEntry::dirName(pDataModel->getFileName())
1605  + CDirEntry::baseName(pDataModel->getFileName()));
1606  else
1607  Default = "untitled.c";
1608 
1609  tmp =
1610  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
1611  Default,
1612  "C Files (*.c);;Berkeley Madonna Files (*.mmd);;XPPAUT (*.ode)",
1613  "Choose an export format", userFilter);
1614 
1615  if (tmp.isEmpty()) return;
1616 
1617 #ifdef DEBUG_UI
1618  qDebug() << "user's filter pointer = " << *userFilter;
1619 #endif
1620 
1621  // Checks whether the file exists
1622  Answer = checkSelection(tmp);
1623 
1624  if (Answer == QMessageBox::Cancel) return;
1625  }
1626 
1627  if (mpDataModelGUI && !tmp.isNull())
1628  {
1629  setCursor(Qt::WaitCursor);
1630  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotExportMathModelFinished(bool)));
1631  mpDataModelGUI->exportMathModel(TO_UTF8(tmp), TO_UTF8(*userFilter), true);
1632  }
1633 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void slotExportMathModelFinished(bool success)
#define C_INT32
Definition: copasi.h:90
static std::string baseName(const std::string &path)
Definition: CDirEntry.cpp:98
static std::string dirName(const std::string &path)
Definition: CDirEntry.cpp:135
const std::string & getFileName() const
static const std::string Separator
Definition: CDirEntry.h:34
C_INT32 checkSelection(const QString &file)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
DataModelGUI * mpDataModelGUI
void exportMathModel(const std::string &fileName, const std::string &filter, bool overwriteFile=false)
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CopasiUI3Window::slotExportMathModelFinished ( bool  success)
protectedslot

Definition at line 1635 of file copasiui3window.cpp.

References CCopasiMessage::clearDeque(), CQMessageBox::critical(), CCopasiMessage::getAllMessageText(), MCCopasiMessage, mpDataModelGUI, and CCopasiMessage::peekLastMessage().

Referenced by slotExportMathModel().

1636 {
1637  unsetCursor();
1638  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotExportMathModelFinished(bool)));
1639 
1640  if (!success &&
1641  CCopasiMessage::peekLastMessage().getNumber() != MCCopasiMessage + 1)
1642  {
1643  CQMessageBox::critical(this, "Export Error",
1645  QMessageBox::Ok | QMessageBox::Default,
1646  QMessageBox::NoButton);
1648  }
1649 }
static const CCopasiMessage & peekLastMessage()
void slotExportMathModelFinished(bool success)
static std::string getAllMessageText(const bool &chronological=true)
static void clearDeque()
#define MCCopasiMessage
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotExportSBML ( )
protectedslot

Definition at line 1516 of file copasiui3window.cpp.

References CDirEntry::baseName(), C_INT32, checkSelection(), DataModelGUI::commit(), CDirEntry::dirName(), DataModelGUI::exportSBML(), FROM_UTF8, CCopasiRootContainer::getDatamodelList(), CQSBMLFileDialog::getSaveFileName(), mpDataModelGUI, CDirEntry::Separator, slotExportSBMLFinished(), and TO_UTF8.

Referenced by createActions().

1517 {
1519 
1520  C_INT32 Answer = QMessageBox::No;
1521  QString tmp;
1522  bool exportIncomplete = false;
1523  int sbmlLevel = 2;
1524  int sbmlVersion = 4;
1525 
1526  while (Answer == QMessageBox::No)
1527  {
1528  QString Default = QString::null;
1529  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1530 
1531  if ((*CCopasiRootContainer::getDatamodelList())[0]->getFileName() != "")
1532  Default
1536  + ".xml");
1537  else
1538  {
1539  Default = "untitled.xml";
1540  }
1541 
1542  // if there already is an SBML model, we present the user with the Level
1543  // and Version of that document as the selected Level and Version to
1544  // export to.
1545  if ((*CCopasiRootContainer::getDatamodelList())[0]->getCurrentSBMLDocument() != NULL)
1546  {
1547  sbmlLevel = (*CCopasiRootContainer::getDatamodelList())[0]->getCurrentSBMLDocument()->getLevel();
1548  sbmlVersion = (*CCopasiRootContainer::getDatamodelList())[0]->getCurrentSBMLDocument()->getVersion();
1549  }
1550 
1551  std::pair<QString, std::pair<unsigned C_INT32, unsigned C_INT32> > nameAndVersion =
1552  CQSBMLFileDialog::getSaveFileName(this, "Export SBML Dialog", Default,
1553  "Choose a filename and SBML version for SBML export.",
1554  sbmlLevel,
1555  sbmlVersion);
1556  tmp = nameAndVersion.first;
1557  sbmlLevel = nameAndVersion.second.first;
1558  sbmlVersion = nameAndVersion.second.second;
1559 
1560  if (tmp.isEmpty()) return;
1561 
1562  // Checks whether the file exists
1563  Answer = checkSelection(tmp);
1564 
1565  if (Answer == QMessageBox::Cancel) return;
1566  }
1567 
1568  if (mpDataModelGUI && !tmp.isNull())
1569  {
1570  setCursor(Qt::WaitCursor);
1571  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotExportSBMLFinished(bool)));
1572  mpDataModelGUI->exportSBML(TO_UTF8(tmp), true, sbmlLevel, sbmlVersion, exportIncomplete);
1573  }
1574 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void exportSBML(const std::string &fileName, bool overwriteFile, int sbmlLevel, int sbmlVersion, bool exportIncomplete, bool exportCOPASIMIRIAM=true)
#define C_INT32
Definition: copasi.h:90
static std::string baseName(const std::string &path)
Definition: CDirEntry.cpp:98
static std::string dirName(const std::string &path)
Definition: CDirEntry.cpp:135
void slotExportSBMLFinished(bool success)
static const std::string Separator
Definition: CDirEntry.h:34
C_INT32 checkSelection(const QString &file)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
DataModelGUI * mpDataModelGUI
static std::pair< QString, std::pair< unsigned C_INT32, unsigned C_INT32 > > getSaveFileName(QWidget *parent, const char *name, const QString &startWith, const QString &caption, unsigned int sbmlLevel=2, unsigned int sbmlVersion=4)
void CopasiUI3Window::slotExportSBMLFinished ( bool  success)
protectedslot

Definition at line 1576 of file copasiui3window.cpp.

References checkPendingMessages(), mpDataModelGUI, and refreshRecentSBMLFileMenu().

Referenced by slotExportSBML().

1577 {
1578  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotExportSBMLFinished(bool)));
1579  unsetCursor();
1580 
1583 }
void refreshRecentSBMLFileMenu()
void slotExportSBMLFinished(bool success)
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotExportSBMLToStringFinished ( bool  success)
protectedslot

Definition at line 1945 of file copasiui3window.cpp.

References CCopasiMessage::clearDeque(), CQMessageBox::critical(), FROM_UTF8, CCopasiMessage::getLastMessage(), and mpDataModelGUI.

Referenced by exportSBMLToString().

1946 {
1947  unsetCursor();
1948  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotExportSBMLToStringFinished(bool)));
1949 
1950  if (!success)
1951  {
1952  QString Message = "Error while exporting SBML model!\n\n";
1953  Message += FROM_UTF8(CCopasiMessage::getLastMessage().getText());
1954 
1955  CQMessageBox::critical(this, QString("File Error"), Message,
1956  QMessageBox::Ok, QMessageBox::Ok);
1958  }
1959 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static void clearDeque()
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static CCopasiMessage getLastMessage()
DataModelGUI * mpDataModelGUI
void slotExportSBMLToStringFinished(bool success)
void CopasiUI3Window::slotFileExamplesCopasiFiles ( QString  file = QString::null)
protectedslot

Definition at line 994 of file copasiui3window.cpp.

References CopasiFileDialog::openExampleDir(), and slotFileOpen().

Referenced by createActions().

995 {
996  CopasiFileDialog::openExampleDir(); //Sets CopasiFileDialog::LastDir
997  slotFileOpen(file);
998 }
void slotFileOpen(QString file=QString::null)
static void openExampleDir()
void CopasiUI3Window::slotFileExamplesSBMLFiles ( QString  file = QString::null)
protectedslot

Definition at line 1000 of file copasiui3window.cpp.

References CopasiFileDialog::openExampleDir(), and slotImportSBML().

Referenced by createActions().

1001 {
1002  CopasiFileDialog::openExampleDir(); //Sets CopasiFileDialog::LastDir
1003  slotImportSBML(file);
1004 }
static void openExampleDir()
void slotImportSBML(QString file=QString::null)
void CopasiUI3Window::slotFileOpen ( QString  file = QString::null)
slot

Definition at line 812 of file copasiui3window.cpp.

References CCopasiMessage::clearDeque(), DataModelGUI::commit(), ListViews::DELETE, CCopasiRootContainer::getDatamodelList(), CopasiFileDialog::getOpenFileName(), SliderDialog::isChanged(), DataModelGUI::loadModel(), mCommitRequired, mNewFile, ListViews::MODEL, mpDataModelGUI, mpListView, mpSliders, DataModelGUI::notify(), CQMessageBox::question(), SliderDialog::reset(), signalLoadFile(), slotFileOpenFinished(), slotFileSave(), ListViews::switchToOtherWidget(), and TO_UTF8.

Referenced by createActions(), dropEvent(), CQCopasiApplication::event(), openInitialDocument(), slotFileExamplesCopasiFiles(), and slotOpenRecentFile().

813 {
814  disconnect(this, SIGNAL(signalLoadFile(QString)), this, SLOT(slotFileOpen(QString)));
815 
816  if (mCommitRequired)
817  {
819  }
820 
821  QString newFile = "";
822 
823  if (file == "")
824  newFile =
825  CopasiFileDialog::getOpenFileName(this, "Open File Dialog", QString::null,
826  "COPASI Files (*.gps *.cps);;All Files (*)",
827  "Choose a file");
828  else
829  newFile = file;
830 
831  // gives the file information to the datamodel to handle it
832 
833  if (!newFile.isNull())
834  {
835  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
836 
837  if (mpDataModelGUI && ((*CCopasiRootContainer::getDatamodelList())[0]->isChanged() || this->mpSliders->isChanged()))
838  {
839  switch (CQMessageBox::question(this, "COPASI",
840  "The document contains unsaved changes\n"
841  "Do you want to save the changes before exiting?",
842  QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
843  QMessageBox::Save))
844  {
845  case QMessageBox::Save:
846  connect(this, SIGNAL(signalLoadFile(QString)), this, SLOT(slotFileOpen(QString)));
847 
848  mNewFile = newFile;
849  mCommitRequired = false;
850  slotFileSave();
851  return;
852 
853  break;
854 
855  case QMessageBox::Discard:
856  break;
857 
858  case QMessageBox::Cancel:
859  default:
860  return;
861  break;
862  }
863  }
864 
866  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
867 
869 
870  if (this->mpSliders) this->mpSliders->reset();
871 
872  this->setCursor(Qt::WaitCursor);
873 
875 
876  mNewFile = newFile;
877  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotFileOpenFinished(bool)));
878  mpDataModelGUI->loadModel(TO_UTF8(newFile));
879  }
880 }
ListViews * mpListView
void slotFileOpen(QString file=QString::null)
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
SliderDialog * mpSliders
void loadModel(const std::string &fileName)
static void clearDeque()
void slotFileOpenFinished(bool success)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
static QString getOpenFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
bool isChanged() const
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
void signalLoadFile(QString newFile)
DataModelGUI * mpDataModelGUI
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CopasiUI3Window::slotFileOpenFinished ( bool  success)
protectedslot

Definition at line 882 of file copasiui3window.cpp.

References ListViews::ADD, DataModelGUI::createModel(), CQMessageBox::critical(), FROM_UTF8, CCopasiMessage::getAllMessageText(), ListViews::getCurrentWidget(), CCopasiRootContainer::getDatamodelList(), CCopasiMessage::getLastMessage(), CCopasiMessage::getNumber(), CCopasiMessage::getText(), CDirEntry::isWritable(), MCCopasiMessage, mCommitRequired, mNewFile, ListViews::MODEL, mpaExportODE, mpaExportSBML, mpaSave, mpaSaveAs, mpDataModelGUI, mpListView, mSaveAsRequired, newDoc(), DataModelGUI::notify(), CQMessageBox::question(), refreshRecentFileMenu(), CQTabWidget::selectTab(), slotImportSBML(), CDirEntry::suffix(), ListViews::switchToOtherWidget(), TO_UTF8, updateTitle(), and CQMessageBox::warning().

Referenced by slotFileOpen().

883 {
884  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotFileOpenFinished(bool)));
885  unsetCursor();
886  mCommitRequired = true;
887 
888  if (!success)
889  {
890  QString Message = "Error while loading file " + mNewFile + QString("!\n\n");
892 
893  CQMessageBox::critical(this, QString("File Error"), Message,
894  QMessageBox::Ok, QMessageBox::Ok);
896  }
897 
899 
900  if (msg.getNumber() == 6303 &&
901  (msg.getText().find("'sbml'") != std::string::npos || msg.getText().find(":sbml'") != std::string::npos))
902  {
903 
904  // someone attempted to open an SBML file but failed, instead of displaying the message
905  // XML (3): Unknown element 'sbml' encountered at line '3'.
906  // we just open the SBML file!
907  if (CQMessageBox::question(this, QString("Import SBML?"), QString("You tried to open an SBML file. COPASI is not able to open SBML files but is able to import it. Would you like to import it?"),
908  QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
909  {
910  emit slotImportSBML(mNewFile);
911  return;
912  }
913 
914  newDoc();
915  return;
916  }
917 
918 #ifdef COPASI_SEDML
919 
920  if (msg.getNumber() == 6303 &&
921  (msg.getText().find("'sedML'") != std::string::npos || msg.getText().find(":sedML'") != std::string::npos))
922  {
923 
924  // someone attempted to open an SEDML file but failed, instead of displaying the message
925  // XML (3): Unknown element 'sedml' encountered at line '3'.
926  // we just open the SEDML file!
927  if (CQMessageBox::question(this, QString("Import SED-ML?"), QString("You tried to open an SED-ML file. COPASI is not able to open SED-ML files but is able to import it. Would you like to import it?"),
928  QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes) == QMessageBox::Yes)
929  {
930  emit slotImportSEDML(mNewFile);
931  return;
932  }
933 
934  newDoc();
935  return;
936  }
937 
938 #endif
939 
940  if (msg.getNumber() != MCCopasiMessage + 1)
941  {
942  QString Message = "Problem while loading file " + mNewFile + QString("!\n\n");
943  Message += FROM_UTF8(msg.getText());
944 
946 
947  while (msg.getNumber() != MCCopasiMessage + 1)
948  {
949  Message += "\n";
950  Message += FROM_UTF8(msg.getText());
952  }
953 
954  CQMessageBox::warning(this, QString("File Warning"), Message,
955  QMessageBox::Ok, QMessageBox::Ok);
956  }
957 
958  if (strcasecmp(CDirEntry::suffix(TO_UTF8(mNewFile)).c_str(), ".cps") == 0 &&
960  mSaveAsRequired = false;
961  else
962  mSaveAsRequired = true;
963 
964  if (!(*CCopasiRootContainer::getDatamodelList())[0]->getModel())
965  {
966  newDoc();
967  mSaveAsRequired = true;
968  }
969 
971  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
972 
973  mpaSave->setEnabled(true);
974  mpaSaveAs->setEnabled(true);
975  mpaExportSBML->setEnabled(true);
976  mpaExportODE->setEnabled(true);
977 
978 #ifdef COPASI_SEDML
979  mpaExportSEDML->setEnabled(true);
980 #endif
981 
982  updateTitle();
984  CQTabWidget *widget = dynamic_cast<CQTabWidget *>(mpListView->getCurrentWidget());
985 
986  if (widget != NULL)
987  widget->selectTab(0);
988 
990 
991  mNewFile = "";
992 }
ListViews * mpListView
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CopasiWidget * getCurrentWidget()
Definition: listviews.cpp:995
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
const std::string & getText() const
static std::string getAllMessageText(const bool &chronological=true)
const size_t & getNumber() const
void selectTab(int index) const
#define MCCopasiMessage
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void slotFileOpenFinished(bool success)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
QAction * mpaExportODE
static bool isWritable(const std::string &path)
Definition: CDirEntry.cpp:95
bool createModel()
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
QAction * mpaExportSBML
static CCopasiMessage getLastMessage()
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
DataModelGUI * mpDataModelGUI
void slotImportSBML(QString file=QString::null)
static std::string suffix(const std::string &path)
Definition: CDirEntry.cpp:159
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CopasiUI3Window::slotFilePrint ( )
protectedslot

Definition at line 1237 of file copasiui3window.cpp.

1238 {}
void CopasiUI3Window::slotFileSave ( )
protectedslot

Definition at line 1098 of file copasiui3window.cpp.

References DataModelGUI::commit(), FROM_UTF8, CLocaleString::fromUtf8(), CCopasiRootContainer::getDatamodelList(), mpDataModelGUI, mSaveAsRequired, DataModelGUI::saveModel(), CQMessageBox::setText(), slotFileSaveAs(), and slotFileSaveFinished().

Referenced by createActions(), importSBMLFromString(), newDoc(), slotFileOpen(), slotImportSBML(), and slotQuit().

1099 {
1100  // mpDataModelGUI->commit(); --> remove to the line after checking the following condition (07.04.08)
1101 
1102  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1103  std::string FileName = (*CCopasiRootContainer::getDatamodelList())[0]->getFileName();
1104 
1105  if (mSaveAsRequired || FileName == "")
1106  {
1107  return slotFileSaveAs(FROM_UTF8(FileName));
1108  }
1109 
1111 
1112  std::ifstream File(CLocaleString::fromUtf8(FileName).c_str());
1113  std::string Line;
1114  File >> Line;
1115  File.close();
1116 
1117  if (!Line.compare(0, 8, "Version=") ||
1118  strcasecmp(FileName.c_str(), ".gps") == 0)
1119  {
1120  /* Ask for permission to overwrite write? */
1121  /* If no call slotFileSaveAs */
1122  CQMessageBox MessageBox(QMessageBox::Question,
1123  "Confirm File Version Update",
1124  "You are to overwrite an existing Gepasi File.\n"
1125  "This will render the file unreadable for Gepasi",
1126  QMessageBox::Save | QMessageBox::Ok | QMessageBox::Cancel, this);
1127 
1128  MessageBox.setDefaultButton(QMessageBox::Save);
1129  MessageBox.button(QMessageBox::Save)->setText("Save As");
1130  MessageBox.button(QMessageBox::Save)->setText("Overwrite");
1131 
1132  int choice = MessageBox.exec();
1133 
1134  switch (choice)
1135  {
1136  case QMessageBox::Save:
1137  return slotFileSaveAs(FROM_UTF8(FileName));
1138  break;
1139 
1140  case QMessageBox::Ok:
1141  break;
1142 
1143  case QMessageBox::Cancel:
1144  return;
1145  break;
1146  }
1147  }
1148 
1149  if (mpDataModelGUI)
1150  {
1151  setCursor(Qt::WaitCursor);
1152 
1153  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotFileSaveFinished(bool)));
1154  mpDataModelGUI->saveModel(FileName, true);
1155  }
1156 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void slotFileSaveAs(QString str=QString::null)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void slotFileSaveFinished(bool success)
void saveModel(const std::string &fileName, bool overwriteFile=false)
DataModelGUI * mpDataModelGUI
static CLocaleString fromUtf8(const std::string &utf8)
void CopasiUI3Window::slotFileSaveAs ( QString  str = QString::null)
protectedslot

Definition at line 604 of file copasiui3window.cpp.

References C_INT32, checkSelection(), DataModelGUI::commit(), CopasiFileDialog::getSaveFileName(), mpDataModelGUI, DataModelGUI::saveModel(), slotFileSaveFinished(), and TO_UTF8.

Referenced by createActions(), and slotFileSave().

605 {
607 
608  C_INT32 Answer = QMessageBox::No;
609  QString tmp;
610 
611  if (str.isEmpty()) str = "untitled.cps";
612 
613 #ifdef DEBUG_UI
614  qDebug() << "Filename on slotFileSaveAs = " << str;
615 #endif
616 
617  while (Answer == QMessageBox::No)
618  {
619  tmp =
620  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
621  str, "COPASI Files (*.cps)",
622  "Choose a filename to save under");
623 
624  if (tmp.isEmpty()) return;
625 
626 #ifdef DEBUG_UI
627  qDebug() << "tmp = " << tmp;
628 #endif
629 
630  // Checks whether the file exists
631  Answer = checkSelection(tmp);
632 
633  if (Answer == QMessageBox::Cancel) return;
634  }
635 
636  if (mpDataModelGUI && !tmp.isNull())
637  {
638  setCursor(Qt::WaitCursor);
639 
640  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotFileSaveFinished(bool)));
641  mpDataModelGUI->saveModel(TO_UTF8(tmp), true);
642  }
643 }
#define C_INT32
Definition: copasi.h:90
C_INT32 checkSelection(const QString &file)
void slotFileSaveFinished(bool success)
void saveModel(const std::string &fileName, bool overwriteFile=false)
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
DataModelGUI * mpDataModelGUI
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CopasiUI3Window::slotFileSaveFinished ( bool  success)
protectedslot

Definition at line 645 of file copasiui3window.cpp.

References CCopasiMessage::clearDeque(), CQMessageBox::critical(), FROM_UTF8, CCopasiMessage::getAllMessageText(), CCopasiRootContainer::getDatamodelList(), CCopasiMessage::getLastMessage(), CCopasiMessage::getNumber(), CCopasiMessage::getText(), MCCopasiMessage, mNewFile, mpDataModelGUI, mpSliders, mSaveAsRequired, CCopasiMessage::peekLastMessage(), refreshRecentFileMenu(), SliderDialog::setChanged(), signalLoadFile(), updateTitle(), and CQMessageBox::warning().

Referenced by slotFileSave(), slotFileSaveAs(), and slotUpdateMIRIAMFinished().

646 {
647  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotFileSaveFinished(bool)));
648 
649  if (success)
650  {
651  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
652  (*CCopasiRootContainer::getDatamodelList())[0]->changed(false);
653  this->mpSliders->setChanged(false);
654  updateTitle();
655 
657 
658  if (msg.getNumber() != MCCopasiMessage + 1)
659  {
660  QString Message("Problem while saving file!\n\n");
661  Message += FROM_UTF8(msg.getText());
662 
664 
665  while (msg.getNumber() != MCCopasiMessage + 1)
666  {
667  Message += "\n";
668  Message += FROM_UTF8(msg.getText());
670  }
671 
672  CQMessageBox::warning(this, QString("File Warning"), Message,
673  QMessageBox::Ok, QMessageBox::Ok);
674  }
675  }
676  else
677  {
678  if (CCopasiMessage::peekLastMessage().getNumber() != MCCopasiMessage + 1)
679  {
680  CQMessageBox::critical(this, "Save File Error",
682  QMessageBox::Ok | QMessageBox::Default,
683  QMessageBox::NoButton);
685  }
686  }
687 
688  unsetCursor();
690 
691  mSaveAsRequired = false;
692 
693  if (mNewFile != "")
694  {
695  emit signalLoadFile(mNewFile);
696  mNewFile = "";
697  }
698 }
static const CCopasiMessage & peekLastMessage()
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
SliderDialog * mpSliders
const std::string & getText() const
static std::string getAllMessageText(const bool &chronological=true)
const size_t & getNumber() const
static void clearDeque()
#define MCCopasiMessage
static StandardButton warning(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
struct MESSAGES Message
void setChanged(bool changed)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
void slotFileSaveFinished(bool success)
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static CCopasiMessage getLastMessage()
void signalLoadFile(QString newFile)
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotFontSelection ( )
protectedslot

Definition at line 2220 of file copasiui3window.cpp.

References TaskWidget::adjustTable(), CCopasiRootContainer::getConfiguration(), ListViews::getCurrentWidget(), getFont(), mpListView, CConfigurationFile::setApplicationFont(), and TO_UTF8.

Referenced by createActions().

2221 {
2222  bool ok;
2223 
2224  QFont Font = QFontDialog::getFont(&ok, qApp->font(), this);
2225 
2226  if (ok)
2227  {
2228  qApp->setFont(Font);
2229 
2230  // The stylesheet (set in CQCopasiApplication.cpp) is apparently overriding
2231  // in newer versions of Qt
2232  // This appears to reload the font from setFont into the style.
2233  // Two calls so that the tabwidget labels are correct
2234  qApp->setStyleSheet(" * {font : }");
2235  qApp->setStyleSheet(" * {font : }");
2236 
2238 
2239  TaskWidget *pTaskWidget = dynamic_cast< TaskWidget * >(mpListView->getCurrentWidget());
2240 
2241  if (pTaskWidget != NULL)
2242  {
2243  pTaskWidget->adjustTable();
2244  }
2245  }
2246 
2247  return;
2248 }
ListViews * mpListView
CopasiWidget * getCurrentWidget()
Definition: listviews.cpp:995
QSharedPointer< QFont > getFont(const CLText *item, const CLGroup *group, const CLRenderResolver *, const CLBoundingBox *pBB)
static CConfigurationFile * getConfiguration()
void setApplicationFont(const std::string &applicationFont)
void adjustTable()
Definition: TaskWidget.cpp:293
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
void CopasiUI3Window::slotFrameworkChanged ( int  index)
protectedslot

Definition at line 2189 of file copasiui3window.cpp.

References DataModelGUI::commit(), mpDataModelGUI, mpSliders, SliderDialog::setFramework(), and DataModelGUI::setFramework().

Referenced by createToolBar().

2190 {
2192 
2193  mpDataModelGUI->setFramework(index);
2194  mpSliders->setFramework(index);
2195 }
void setFramework(int index)
SliderDialog * mpSliders
void setFramework(int framework)
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotFunctionDBLoad ( QString  str = QString::null)
protectedslot

Definition at line 436 of file copasiui3window.cpp.

References DataModelGUI::commit(), CopasiFileDialog::getOpenFileName(), DataModelGUI::loadFunctionDB(), mCommitRequired, mpDataModelGUI, and TO_UTF8.

Referenced by createActions().

437 {
438  if (mCommitRequired)
439  {
441  }
442 
443  if (dbFile.isEmpty())
444  {
445  dbFile =
446  CopasiFileDialog::getOpenFileName(this, "Open File Dialog",
447  QString::null, "COPASI Function DB (*.cpk)",
448  "Choose a file");
449  }
450 
451  if (!dbFile.isEmpty())
452  {
454  }
455 }
void loadFunctionDB(const std::string &fileName)
static QString getOpenFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotFunctionDBSave ( QString  str = QString::null)
protectedslot

Definition at line 406 of file copasiui3window.cpp.

References C_INT32, checkSelection(), DataModelGUI::commit(), CopasiFileDialog::getSaveFileName(), mCommitRequired, mpDataModelGUI, DataModelGUI::saveFunctionDB(), and TO_UTF8.

Referenced by createActions().

407 {
408  if (mCommitRequired)
409  {
411  }
412 
413  if (dbFile.isEmpty())
414  {
415  C_INT32 Answer = QMessageBox::No;
416 
417  while (Answer == QMessageBox::No)
418  {
419  dbFile =
420  CopasiFileDialog::getSaveFileName(this, "Save File Dialog",
421  "untitled.cpk", "COPASI Function DB (*.cpk)",
422  "Choose a file");
423 
424  if (dbFile.isEmpty()) return;
425 
426  // Checks whether the file exists
427  Answer = checkSelection(dbFile);
428 
429  if (Answer == QMessageBox::Cancel) return;
430  }
431  }
432 
434 }
#define C_INT32
Definition: copasi.h:90
void saveFunctionDB(const std::string &fileName)
C_INT32 checkSelection(const QString &file)
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
DataModelGUI * mpDataModelGUI
static QString getSaveFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
void CopasiUI3Window::slotImportSBML ( QString  file = QString::null)
protectedslot

Definition at line 1402 of file copasiui3window.cpp.

References DataModelGUI::commit(), ListViews::DELETE, CCopasiRootContainer::getDatamodelList(), CopasiFileDialog::getOpenFileName(), DataModelGUI::importSBML(), SliderDialog::isChanged(), mCommitRequired, mNewFile, ListViews::MODEL, mpDataModelGUI, mpListView, mpSliders, DataModelGUI::notify(), CQMessageBox::question(), SliderDialog::reset(), signalLoadFile(), slotFileSave(), slotImportSBMLFinished(), ListViews::switchToOtherWidget(), and TO_UTF8.

Referenced by createActions(), dropEvent(), openInitialDocument(), slotFileExamplesSBMLFiles(), slotFileOpenFinished(), and slotOpenRecentSBMLFile().

1403 {
1404  disconnect(this, SIGNAL(signalLoadFile(QString)), this, SLOT(slotImportSBML(QString)));
1405 
1406  if (mCommitRequired)
1407  {
1409  }
1410 
1411  QString SBMLFile;
1412 
1413  if (file == "")
1414  SBMLFile =
1415  CopasiFileDialog::getOpenFileName(this, "Open File Dialog",
1416  QString::null, "XML Files (*.xml);;All Files (*)",
1417  "Choose a file");
1418  else
1419  SBMLFile = file;
1420 
1421  if (!SBMLFile.isNull())
1422  {
1423  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1424 
1425  if (mpDataModelGUI && ((*CCopasiRootContainer::getDatamodelList())[0]->isChanged() || this->mpSliders->isChanged()))
1426  {
1427  switch (CQMessageBox::question(this, "COPASI",
1428  "The document contains unsaved changes\n"
1429  "Do you want to save the changes before exiting?",
1430  QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
1431  QMessageBox::Save))
1432  {
1433  case QMessageBox::Save:
1434  connect(this, SIGNAL(signalLoadFile(QString)), this, SLOT(slotImportSBML(QString)));
1435 
1436  mNewFile = SBMLFile;
1437  mCommitRequired = false;
1438 
1439  slotFileSave();
1440  return;
1441  break;
1442 
1443  case QMessageBox::Discard:
1444  break;
1445 
1446  case QMessageBox::Cancel:
1447  default:
1448  return;
1449  break;
1450  }
1451  }
1452 
1454  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
1455 
1457 
1458  if (this->mpSliders) this->mpSliders->reset();
1459 
1460  if (!mpDataModelGUI)
1461  {
1462  mpDataModelGUI = new DataModelGUI(this); // create a new data model
1463  }
1464 
1465  setCursor(Qt::WaitCursor);
1466  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotImportSBMLFinished(bool)));
1467 
1468  mNewFile = SBMLFile;
1469  mpDataModelGUI->importSBML(TO_UTF8(SBMLFile));
1470  }
1471 }
ListViews * mpListView
void importSBML(const std::string &fileName)
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
SliderDialog * mpSliders
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
static QString getOpenFileName(QWidget *parent=0, const char *name=0, const QString &startWith=QString::null, const QString &filter=QString::null, const QString &caption=QString::null, QString *pSelectedFilter=NULL, QFileDialog::Options options=0)
bool isChanged() const
#define TO_UTF8(__x)
Definition: qtUtilities.h:74
void signalLoadFile(QString newFile)
DataModelGUI * mpDataModelGUI
void slotImportSBML(QString file=QString::null)
void slotImportSBMLFinished(bool success)
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CopasiUI3Window::slotImportSBMLFinished ( bool  success)
protectedslot

Definition at line 1473 of file copasiui3window.cpp.

References ListViews::ADD, checkPendingMessages(), DataModelGUI::createModel(), CQMessageBox::critical(), FROM_UTF8, ListViews::getCurrentWidget(), CCopasiRootContainer::getDatamodelList(), CCopasiMessage::getLastMessage(), mCommitRequired, mNewFile, ListViews::MODEL, mpaExportODE, mpaExportSBML, mpaSave, mpaSaveAs, mpDataModelGUI, mpListView, mSaveAsRequired, DataModelGUI::notify(), refreshRecentSBMLFileMenu(), CQTabWidget::selectTab(), ListViews::switchToOtherWidget(), and updateTitle().

Referenced by slotImportSBML().

1474 {
1475  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotImportSBMLFinished(bool)));
1476  unsetCursor();
1477  mCommitRequired = true;
1478 
1479  if (!success)
1480  {
1481  QString Message = "Error while loading file " + mNewFile + QString("!\n\n");
1482  Message += FROM_UTF8(CCopasiMessage::getLastMessage().getText());
1483 
1484  CQMessageBox::critical(this, QString("File Error"), Message,
1485  QMessageBox::Ok, QMessageBox::Ok);
1486 
1488  }
1489  else
1490  // We check in all case for warnings. This will help also for unsuccessful imports
1491  this->checkPendingMessages();
1492 
1494  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
1495 
1496  mpaSave->setEnabled(true);
1497  mpaSaveAs->setEnabled(true);
1498  mpaExportSBML->setEnabled(true);
1499  mpaExportODE->setEnabled(true);
1500 
1502  CQTabWidget *widget = dynamic_cast<CQTabWidget *>(mpListView->getCurrentWidget());
1503 
1504  if (widget != NULL)
1505  widget->selectTab(0);
1506 
1508 
1509  updateTitle();
1510 
1511  mSaveAsRequired = true;
1512 
1513  mNewFile = "";
1514 }
ListViews * mpListView
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CopasiWidget * getCurrentWidget()
Definition: listviews.cpp:995
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
void selectTab(int index) const
void refreshRecentSBMLFileMenu()
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
QAction * mpaExportODE
bool createModel()
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
QAction * mpaExportSBML
static CCopasiMessage getLastMessage()
DataModelGUI * mpDataModelGUI
void slotImportSBMLFinished(bool success)
void CopasiUI3Window::slotImportSBMLFromStringFinished ( bool  success)
protectedslot

Definition at line 1356 of file copasiui3window.cpp.

References ListViews::ADD, checkPendingMessages(), CCopasiMessage::clearDeque(), DataModelGUI::createModel(), CQMessageBox::critical(), FROM_UTF8, ListViews::getCurrentWidget(), CCopasiRootContainer::getDatamodelList(), CCopasiMessage::getLastMessage(), mCommitRequired, ListViews::MODEL, mpDataModelGUI, mpListView, mSaveAsRequired, DataModelGUI::notify(), CQTabWidget::selectTab(), ListViews::switchToOtherWidget(), and updateTitle().

Referenced by importSBMLFromString().

1357 {
1358  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotImportSBMLFromStringFinished(bool)));
1359  unsetCursor();
1360  mCommitRequired = true;
1361 
1362  if (!success)
1363  {
1364  QString Message = "Error while importing SBML model!\n\n";
1365  Message += FROM_UTF8(CCopasiMessage::getLastMessage().getText());
1366 
1367  CQMessageBox::critical(this, QString("Import Error"), Message,
1368  QMessageBox::Ok, QMessageBox::Ok);
1370 
1372  }
1373 
1374  /* still check for warnings.
1375  * Maybe events or rules were ignored while reading
1376  * the file.
1377  */
1378  if (success)
1379  {
1380  this->checkPendingMessages();
1381  }
1382 
1384  (*CCopasiRootContainer::getDatamodelList())[0]->getModel()->getKey());
1385 
1386  //if (!bobject_browser_open)
1387  // mpFileMenu->setItemEnabled(nsaveas_menu_id, true);
1388  // msave_button->setEnabled(true);
1389  // mpFileMenu->setItemEnabled(nsave_menu_id, true);
1390 
1392  CQTabWidget *widget = dynamic_cast<CQTabWidget *>(mpListView->getCurrentWidget());
1393 
1394  if (widget != NULL)
1395  widget->selectTab(0);
1396 
1397  updateTitle();
1398 
1399  mSaveAsRequired = true;
1400 }
ListViews * mpListView
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CopasiWidget * getCurrentWidget()
Definition: listviews.cpp:995
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
void selectTab(int index) const
static void clearDeque()
void slotImportSBMLFromStringFinished(bool success)
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
bool createModel()
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static CCopasiMessage getLastMessage()
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotObjectBrowserDialogWasClosed ( )
slot

This should only be called by the destructor of the object browser dialog otherwise a memory leak occurs

Definition at line 1284 of file copasiui3window.cpp.

References mpaObjectBrowser, and mpObjectBrowser.

Referenced by slotShowObjectBrowserDialog().

1285 {
1286  mpObjectBrowser = NULL;
1287  mpaObjectBrowser->setChecked(false);
1288 }
ObjectBrowserDialog * mpObjectBrowser
QAction * mpaObjectBrowser
void CopasiUI3Window::slotOpenRecentFile ( QAction *  pAction)
protectedslot

Definition at line 1846 of file copasiui3window.cpp.

References FROM_UTF8, CCopasiRootContainer::getConfiguration(), CCopasiParameterGroup::getGroup(), CConfigurationFile::getRecentFiles(), CCopasiParameterGroup::getValue(), mRecentFilesActionMap, CCopasiParameter::Value::pSTRING, and slotFileOpen().

Referenced by refreshRecentFileMenu().

1847 {
1848  int index = mRecentFilesActionMap[pAction];
1849 
1850  std::string FileName =
1852 
1853  slotFileOpen(FROM_UTF8(FileName));
1854 }
void slotFileOpen(QString file=QString::null)
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
CRecentFiles & getRecentFiles()
static CConfigurationFile * getConfiguration()
QMap< QAction *, int > mRecentFilesActionMap
const CCopasiParameter::Value & getValue(const std::string &name) const
CCopasiParameterGroup * getGroup(const std::string &name)
void CopasiUI3Window::slotOpenRecentSBMLFile ( QAction *  pAction)
protectedslot

Definition at line 1856 of file copasiui3window.cpp.

References FROM_UTF8, CCopasiRootContainer::getConfiguration(), CCopasiParameterGroup::getGroup(), CConfigurationFile::getRecentSBMLFiles(), CCopasiParameterGroup::getValue(), mRecentSBMLFilesActionMap, CCopasiParameter::Value::pSTRING, and slotImportSBML().

Referenced by refreshRecentSBMLFileMenu().

1857 {
1858  int index = mRecentSBMLFilesActionMap[pAction];
1859 
1860  std::string FileName =
1862 
1863  slotImportSBML(FROM_UTF8(FileName));
1864 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static CConfigurationFile * getConfiguration()
CRecentFiles & getRecentSBMLFiles()
const CCopasiParameter::Value & getValue(const std::string &name) const
QMap< QAction *, int > mRecentSBMLFilesActionMap
CCopasiParameterGroup * getGroup(const std::string &name)
void slotImportSBML(QString file=QString::null)
void CopasiUI3Window::slotPreferences ( )
protectedslot

Definition at line 1290 of file copasiui3window.cpp.

Referenced by createMenuBar().

1291 {
1292  CQPreferenceDialog * preferenceDialog = new CQPreferenceDialog(this, 0, false);
1293  preferenceDialog->setAttribute(Qt::WA_DeleteOnClose);
1294  preferenceDialog->setModal(true);
1295  preferenceDialog->show();
1296 }
void CopasiUI3Window::slotQuit ( )
protectedslot

Definition at line 1158 of file copasiui3window.cpp.

References DataModelGUI::commit(), CCopasiRootContainer::getDatamodelList(), getMainWindow(), CQMessageBox::information(), SliderDialog::isChanged(), mpDataModelGUI, mpSliders, mQuitApplication, CQMessageBox::question(), slotFileSave(), and slotQuitFinished().

Referenced by closeEvent(), and createActions().

1159 {
1160  if (!CopasiUI3Window::getMainWindow()->isEnabled())
1161  {
1162  CQMessageBox::information(this, "COPASI", "COPASI is currently executing tasks.\n"
1163  "Please stop them first before closing COPASI.");
1164  return;
1165  }
1166 
1167  mQuitApplication = true;
1168 
1170 
1171  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1172 
1173  if (mpDataModelGUI && ((*CCopasiRootContainer::getDatamodelList())[0]->isChanged() || this->mpSliders->isChanged()))
1174  {
1175  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotQuitFinished(bool)));
1176 
1177  switch (CQMessageBox::question(this, "COPASI",
1178  "The document contains unsaved changes\n"
1179  "Do you want to save the changes before exiting?",
1180  QMessageBox::Save | QMessageBox::Discard | QMessageBox::Cancel,
1181  QMessageBox::Save))
1182  {
1183  case QMessageBox::Save:
1184  slotFileSave();
1185  break;
1186 
1187  case QMessageBox::Discard:
1188  slotQuitFinished(true);
1189  break;
1190 
1191  case QMessageBox::Cancel:
1192  default:
1193  slotQuitFinished(false);
1194  break;
1195  }
1196  }
1197  else
1198  {
1199  slotQuitFinished(true);
1200  }
1201 }
SliderDialog * mpSliders
static StandardButton information(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static CopasiUI3Window * getMainWindow()
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
bool isChanged() const
void slotQuitFinished(bool success)
DataModelGUI * mpDataModelGUI
static StandardButton question(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
void CopasiUI3Window::slotQuitFinished ( bool  success)
protectedslot

Definition at line 1203 of file copasiui3window.cpp.

References CleanUp(), mpDataModelGUI, and mQuitApplication.

Referenced by slotQuit().

1204 {
1205  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotQuitFinished(bool)));
1206 
1207  mQuitApplication &= success;
1208 
1209  if (mQuitApplication)
1210  {
1211  CleanUp();
1212  qApp->quit();
1213  }
1214 }
void slotQuitFinished(bool success)
DataModelGUI * mpDataModelGUI
void CopasiUI3Window::slotShowObjectBrowserDialog ( bool  flag)
protectedslot

This should only be called via signal by the corresponding QAction mpaObjectBrowser. Otherwise the QAction will not be up to date.

Definition at line 1264 of file copasiui3window.cpp.

References mpObjectBrowser, and slotObjectBrowserDialogWasClosed().

Referenced by createActions().

1265 {
1266 
1267  if (flag /*tools->isItemEnabled(2)*/)
1268  {
1269  if (mpObjectBrowser)
1270  delete mpObjectBrowser;
1271 
1272  mpObjectBrowser = new ObjectBrowserDialog(this, 0, false, 1);
1273  connect(mpObjectBrowser, SIGNAL(destroyed(QObject *)), this, SLOT(slotObjectBrowserDialogWasClosed()));
1274 
1275  mpObjectBrowser->show();
1276  }
1277  else
1278  {
1279  if (mpObjectBrowser)
1280  mpObjectBrowser->hide();
1281  }
1282 }
ObjectBrowserDialog * mpObjectBrowser
void slotObjectBrowserDialogWasClosed()
long int flag
Definition: f2c.h:52
void CopasiUI3Window::slotShowSliders ( bool  flag)
slot

Definition at line 1718 of file copasiui3window.cpp.

References addWindow(), mpaSliders, mpSliders, and removeWindow().

Referenced by SliderDialog::closeEvent(), and createActions().

1719 {
1720  mpaSliders->setChecked(flag);
1721  this->mpSliders->setHidden(!flag);
1722 
1723  if (flag)
1724  addWindow(this->mpSliders);
1725  else
1726  removeWindow(this->mpSliders);
1727 }
SliderDialog * mpSliders
QAction * mpaSliders
void addWindow(QMainWindow *pWindow)
long int flag
Definition: f2c.h:52
void removeWindow(QMainWindow *pWindow)
void CopasiUI3Window::slotTutorialWizard ( )
protectedslot

Definition at line 1298 of file copasiui3window.cpp.

References WizardDialog::setCopasiMainWindow().

Referenced by createMenuBar().

1299 {
1300  WizardDialog* tutorialWizard = new WizardDialog();
1301  tutorialWizard->setCopasiMainWindow(this);
1302  tutorialWizard->show();
1303 }
virtual void setCopasiMainWindow(QWidget *copasiMainWindow)
Definition: wizard.cpp:170
void CopasiUI3Window::slotUpdateInitialState ( )
protectedslot

Definition at line 2172 of file copasiui3window.cpp.

References ListViews::CHANGE, DataModelGUI::commit(), CModel::compileIfNecessary(), CCopasiRootContainer::getDatamodelList(), CModel::getState(), mpDataModelGUI, DataModelGUI::notify(), CModel::setInitialState(), ListViews::STATE, and CModel::updateInitialValues().

Referenced by createActions().

2173 {
2175 
2176  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
2177  CModel *pModel = (*CCopasiRootContainer::getDatamodelList())[0]->getModel();
2178 
2179  if (pModel != NULL)
2180  {
2181  pModel->compileIfNecessary(NULL);
2182  pModel->setInitialState(pModel->getState());
2183  pModel->updateInitialValues();
2184 
2186  }
2187 }
bool notify(ListViews::ObjectType objectType, ListViews::Action action, const std::string &key="")
void setInitialState(const CState &state)
Definition: CModel.cpp:1774
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
bool compileIfNecessary(CProcessReport *pProcessReport)
Definition: CModel.cpp:612
DataModelGUI * mpDataModelGUI
bool updateInitialValues()
Definition: CModel.cpp:1461
Definition: CModel.h:50
const CState & getState() const
Definition: CModel.cpp:1771
void CopasiUI3Window::slotUpdateMIRIAM ( )
protectedslot

Definition at line 2133 of file copasiui3window.cpp.

References CCopasiMessage::clearDeque(), CCopasiRootContainer::getConfiguration(), mpDataModelGUI, slotUpdateMIRIAMFinished(), and DataModelGUI::updateMIRIAM().

Referenced by createActions().

2134 {
2135  bool success = true;
2136 
2138 
2139  if (!mpDataModelGUI)
2140  mpDataModelGUI = new DataModelGUI(this); // create a new data model
2141 
2142  connect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotUpdateMIRIAMFinished(bool)));
2143 
2144  try
2145  {
2146  success = mpDataModelGUI->updateMIRIAM(
2147  CCopasiRootContainer::getConfiguration()->getRecentMIRIAMResources());
2148  }
2149  catch (...)
2150  {
2151  success = false;
2152  }
2153 }
bool updateMIRIAM(CMIRIAMResources &miriamResources)
static void clearDeque()
static CConfigurationFile * getConfiguration()
DataModelGUI * mpDataModelGUI
void slotUpdateMIRIAMFinished(bool)
void CopasiUI3Window::slotUpdateMIRIAMFinished ( bool  success)
protectedslot

Definition at line 2099 of file copasiui3window.cpp.

References checkPendingMessages(), CCopasiMessage::clearDeque(), CQMessageBox::critical(), FROM_UTF8, CCopasiRootContainer::getConfiguration(), CCopasiMessage::getLastMessage(), mpDataModelGUI, mpListView, CConfigurationFile::save(), CMIRIAMResourceObject::setMIRIAMResources(), slotFileSaveFinished(), ListViews::switchToOtherWidget(), and DataModelGUI::updateMIRIAMResourceContents().

Referenced by slotUpdateMIRIAM().

2100 {
2101  disconnect(mpDataModelGUI, SIGNAL(finished(bool)), this, SLOT(slotFileSaveFinished(bool)));
2102  QCursor oldCursor = cursor();
2103  setCursor(Qt::WaitCursor);
2104 
2105  if (!success)
2106  {
2107  setCursor(oldCursor);
2108  QString Message = "Error while updating MIRIAM" + QString("!\n\n");
2109  Message += FROM_UTF8(CCopasiMessage::getLastMessage().getText());
2110  CQMessageBox::critical(this, QString("MIRIAM Error"), Message,
2111  QMessageBox::Ok, QMessageBox::Ok);
2113  }
2114 
2115  /* still check for warnings.
2116  * Maybe events or rules were ignored while reading
2117  * the file.
2118  */
2119  if (success)
2120  {
2123  &CCopasiRootContainer::getConfiguration()->getRecentMIRIAMResources());
2125  this->checkPendingMessages();
2126  }
2127 
2130  setCursor(oldCursor);
2131 }
ListViews * mpListView
static void setMIRIAMResources(const CMIRIAMResources *pResources)
Definition: CConstants.cpp:81
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
void switchToOtherWidget(const size_t &id, const std::string &key)
Definition: listviews.cpp:926
static void clearDeque()
static CConfigurationFile * getConfiguration()
void slotFileSaveFinished(bool success)
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static CCopasiMessage getLastMessage()
DataModelGUI * mpDataModelGUI
void updateMIRIAMResourceContents()
void CopasiUI3Window::suspendAutoSave ( const bool &  suspend)

Definition at line 1838 of file copasiui3window.cpp.

References AutoSaveInterval, mpAutoSaveTimer, and mSuspendAutoSave.

Referenced by TaskWidget::commonAfterRunTask(), and TaskWidget::commonBeforeRunTask().

1839 {
1840  mSuspendAutoSave = suspend;
1841 
1842  if (!mSuspendAutoSave)
1843  mpAutoSaveTimer->setInterval(AutoSaveInterval); // restart the timer
1844 }
QTimer * mpAutoSaveTimer
#define AutoSaveInterval
void CopasiUI3Window::updateTitle ( )
private

Definition at line 1794 of file copasiui3window.cpp.

References CDirEntry::baseName(), FixedTitle, FROM_UTF8, CCopasiRootContainer::getDatamodelList(), and TO_UTF8.

Referenced by CopasiUI3Window(), newDoc(), slotFileOpenFinished(), slotFileSaveFinished(), slotImportSBMLFinished(), and slotImportSBMLFromStringFinished().

1795 {
1796  assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
1797  QString FileName = FROM_UTF8((*CCopasiRootContainer::getDatamodelList())[0]->getFileName());
1798 
1799 #ifdef WIN32 // Windows allows mixing of '/' and '\' as separator.
1800  FileName.replace("\\", "/");
1801 #endif
1802 
1803  if (FileName.length() > 40)
1804  {
1805 #ifdef WIN32
1806  QRegExp mask("^(([A-Z]:/)?[^/]+/).*(/[^/]+/[^/]+$)");
1807 #else
1808  QRegExp mask("^((/*)[^/]+/).*(/[^/]+/[^/]+$)");
1809 #endif
1810 
1811  mask.indexIn(FileName);
1812  FileName = mask.cap(1) + "..." + mask.cap(3);
1813  }
1814 
1815  std::string BaseName;
1816 
1817  if (!FileName.isEmpty())
1818  BaseName = CDirEntry::baseName(TO_UTF8(FileName)) + " - ";
1819 
1820  setWindowTitle(FROM_UTF8(BaseName) + FixedTitle + " " + FileName);
1821 }
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static std::string baseName(const std::string &path)
Definition: CDirEntry.cpp:98
static CCopasiVector< CCopasiDataModel > * getDatamodelList()
#define TO_UTF8(__x)
Definition: qtUtilities.h:74

Member Data Documentation

QString CopasiUI3Window::FixedTitle
private

Definition at line 239 of file copasiui3window.h.

Referenced by about(), CopasiUI3Window(), license(), and updateTitle().

bool CopasiUI3Window::mCommitRequired
private
bool CopasiUI3Window::mMessageShown
private

Definition at line 300 of file copasiui3window.h.

Referenced by messageShown(), and setMessageShown().

QString CopasiUI3Window::mNewFile
private
QAction* CopasiUI3Window::mpaApplyInitialState
private

Definition at line 256 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), and createToolBar().

QAction* CopasiUI3Window::mpaCapture
private

Definition at line 258 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), and createToolBar().

QAction* CopasiUI3Window::mpaCheckModel
private

Definition at line 255 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), and createToolBar().

QAction* CopasiUI3Window::mpaCloseAllWindows
private

Definition at line 263 of file copasiui3window.h.

Referenced by createActions(), and refreshWindowsMenu().

QAction* CopasiUI3Window::mpaExpandModel
private

Definition at line 260 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaExportODE
private
QAction* CopasiUI3Window::mpaExportSBML
private
QAction* CopasiUI3Window::mpaFontSelectionDialog
private

Definition at line 261 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaFunctionDBLoad
private

Definition at line 248 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaFunctionDBSave
private

Definition at line 247 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaImportSBML
private

Definition at line 249 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaNew
private

Definition at line 241 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), and createToolBar().

QAction* CopasiUI3Window::mpaObjectBrowser
private
QAction* CopasiUI3Window::mpaOpen
private

Definition at line 242 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), and createToolBar().

QAction* CopasiUI3Window::mpaOpenCopasiFiles
private

Definition at line 243 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaOpenSBMLFiles
private

Definition at line 244 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaQuit
private

Definition at line 252 of file copasiui3window.h.

Referenced by createActions(), and createMenuBar().

QAction* CopasiUI3Window::mpaSave
private
QAction* CopasiUI3Window::mpaSaveAs
private
QAction* CopasiUI3Window::mpaSliders
private

Definition at line 254 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), createToolBar(), and slotShowSliders().

QAction* CopasiUI3Window::mpaUpdateInitialState
private

Definition at line 257 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), and createToolBar().

QAction* CopasiUI3Window::mpaUpdateMIRIAM
private

Definition at line 259 of file copasiui3window.h.

Referenced by createActions(), createMenuBar(), and createToolBar().

QTimer* CopasiUI3Window::mpAutoSaveTimer
private

Definition at line 273 of file copasiui3window.h.

Referenced by autoSave(), CopasiUI3Window(), and suspendAutoSave().

QComboBox* CopasiUI3Window::mpBoxSelectFramework
private

Definition at line 237 of file copasiui3window.h.

Referenced by createToolBar().

DataModelGUI* CopasiUI3Window::mpDataModelGUI
private
ListViews* CopasiUI3Window::mpListView
private
QThread* CopasiUI3Window::mpMainThread
private

Definition at line 295 of file copasiui3window.h.

Referenced by isMainThread().

QMenu* CopasiUI3Window::mpMenuExamples
private

Definition at line 277 of file copasiui3window.h.

Referenced by createMenuBar().

QMenu* CopasiUI3Window::mpMenuRecentFiles
private

Definition at line 278 of file copasiui3window.h.

Referenced by createMenuBar(), and refreshRecentFileMenu().

QMenu* CopasiUI3Window::mpMenuRecentSBMLFiles
private

Definition at line 285 of file copasiui3window.h.

Referenced by createMenuBar(), and refreshRecentSBMLFileMenu().

CMIRIAMResources* CopasiUI3Window::mpMIRIAMResources
private

Definition at line 293 of file copasiui3window.h.

ObjectBrowserDialog* CopasiUI3Window::mpObjectBrowser
private
QActionGroup* CopasiUI3Window::mpRecentFilesActionGroup
private

Definition at line 281 of file copasiui3window.h.

Referenced by refreshRecentFileMenu().

QActionGroup* CopasiUI3Window::mpRecentSBMLFilesActionGroup
private

Definition at line 287 of file copasiui3window.h.

Referenced by refreshRecentSBMLFileMenu().

SliderDialog* CopasiUI3Window::mpSliders
private
QMenu* CopasiUI3Window::mpTools
private

Definition at line 291 of file copasiui3window.h.

Referenced by createMenuBar().

QActionGroup* CopasiUI3Window::mpWindowsActionGroup
private

Definition at line 288 of file copasiui3window.h.

Referenced by refreshWindowsMenu().

QMenu* CopasiUI3Window::mpWindowsMenu
private

Definition at line 279 of file copasiui3window.h.

Referenced by createMenuBar(), and refreshWindowsMenu().

bool CopasiUI3Window::mQuitApplication
private

Definition at line 298 of file copasiui3window.h.

Referenced by slotQuit(), and slotQuitFinished().

QMap< QAction *, int > CopasiUI3Window::mRecentFilesActionMap
private

Definition at line 280 of file copasiui3window.h.

Referenced by refreshRecentFileMenu(), and slotOpenRecentFile().

QMap< QAction *, int > CopasiUI3Window::mRecentSBMLFilesActionMap
private

Definition at line 286 of file copasiui3window.h.

Referenced by refreshRecentSBMLFileMenu(), and slotOpenRecentSBMLFile().

bool CopasiUI3Window::mSaveAsRequired
private
bool CopasiUI3Window::mSliderDialogEnabled
private

Definition at line 299 of file copasiui3window.h.

Referenced by CopasiUI3Window(), and disableSliders().

bool CopasiUI3Window::mSuspendAutoSave
private

Definition at line 274 of file copasiui3window.h.

Referenced by autoSave(), and suspendAutoSave().

QList< QPointer<QMainWindow> > CopasiUI3Window::mWindows
private
CopasiUI3Window * CopasiUI3Window::pMainWindow = NULL
staticprivate

Definition at line 304 of file copasiui3window.h.

Referenced by create(), getMainWindow(), and isMainThread().


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