COPASI API
4.16.103
Main Page
Namespaces
Classes
Files
File List
File Members
copasi
ViewCurrentUI
ViewCurrentUI/main.cpp
Go to the documentation of this file.
1
// Copyright (C) 2012 - 2013 by Pedro Mendes, Virginia Tech Intellectual
2
// Properties, Inc., University of Heidelberg, and The University
3
// of Manchester.
4
// All rights reserved.
5
6
#include <stdexcept>
7
8
#include <QtGui/QApplication>
9
#include <QtCore/QString>
10
11
#define COPASI_MAIN
12
13
#include "
copasi.h
"
14
15
#include "
UI/CQCopasiApplication.h
"
16
#include "
UI/copasiui3window.h
"
17
#include "
UI/DataModelGUI.h
"
18
#include "
UI/CQMessageBox.h
"
19
20
#include "
CopasiDataModel/CCopasiDataModel.h
"
21
#include "
report/CCopasiRootContainer.h
"
22
#include "
function/CFunctionDB.h
"
23
#include "
function/CFunction.h
"
24
#include "
commandline/COptionParser.h
"
25
#include "
commandline/COptions.h
"
26
27
#ifdef COPASI_SBW_INTEGRATION
28
// SBW includes
29
#include "SBW/SBW.h"
30
#include <sstream>
31
#endif // COPASI_SBW_INTEGRATION
32
33
#ifdef Darwin
34
# include <QtCore/QDir>
35
# include "
UI/qtUtilities.h
"
36
#endif // Darwin
37
38
#include <
worker.h
>
39
#include <
arguments.h
>
40
41
int
main
(
int
argc,
char
*argv[])
42
{
43
CQCopasiApplication
a(argc, argv);
44
45
// parse args
46
Arguments
args(argc, argv);
47
48
if
(args.
handleCommandLine
())
49
{
50
return
0;
51
}
52
53
a.setAttribute(Qt::AA_DontShowIconsInMenus,
false
);
54
55
Q_INIT_RESOURCE(copasi);
56
57
// Parse the commandline options
58
try
59
{
60
// Create the root container but don't pass in any args past the executable name
61
CCopasiRootContainer::init
(1, argv,
true
);
62
}
63
catch
(
copasi::option_error
& msg)
64
{
65
CQMessageBox::critical
(NULL,
"Initialization Error"
,
66
msg.what(),
67
QMessageBox::Ok , QMessageBox::Ok);
68
69
return
1;
70
}
71
72
#ifdef Darwin
73
std::string PluginDir;
74
75
COptions::getValue
(
"CopasiDir"
, PluginDir);
76
PluginDir +=
"/Contents/plugins"
;
77
78
QApplication::setLibraryPaths(QStringList(
FROM_UTF8
(PluginDir)));
79
#endif // Darwin
80
81
// Create the global data model.
82
CCopasiRootContainer::addDatamodel
();
83
84
// instantiate model and apply all changes
85
args.
prepareModel
();
86
87
// Create the main application window.
88
CopasiUI3Window
*pWindow =
CopasiUI3Window::create
();
89
Worker
* pWorker = NULL;
90
#ifdef COPASI_SBW_INTEGRATION
91
92
if
(
COptions::compareValue
(
"SBWRegister"
,
true
))
93
goto
finish;
94
95
#endif // COPASI_SBW_INTEGRATION
96
97
if
(pWindow != NULL)
98
{
99
a.
setMainWindow
(pWindow);
100
101
// pass control to the worker
102
if
(args.
isValid
())
103
pWorker =
new
Worker
(pWindow, &args);
104
105
a.exec();
106
}
107
108
finish:
109
110
try
// To suppress any access violations during destruction works only under Windows
111
{
112
if
(pWorker != NULL)
113
{
114
delete
pWorker;
115
pWorker = NULL;
116
}
117
118
CCopasiRootContainer::destroy
();
119
}
120
catch
(...)
121
{}
122
123
return
0;
124
}
worker.h
Worker
Definition:
worker.h:18
Arguments
Definition:
arguments.h:13
FROM_UTF8
#define FROM_UTF8(__x)
Definition:
qtUtilities.h:73
main
int main(int argc, char *argv[])
Definition:
ViewCurrentUI/main.cpp:41
CFunctionDB.h
CFunction.h
COptionParser.h
Arguments::handleCommandLine
bool handleCommandLine() const
Definition:
arguments.cpp:116
copasiui3window.h
CQCopasiApplication::setMainWindow
void setMainWindow(CopasiUI3Window *pMainWindow)
Definition:
CQCopasiApplication.cpp:98
CCopasiRootContainer.h
COptions::compareValue
static bool compareValue(const std::string &name, const CType &value)
Definition:
COptions.h:128
CopasiUI3Window::create
static CopasiUI3Window * create()
Definition:
copasiui3window.cpp:117
copasi.h
CQCopasiApplication
Definition:
CQCopasiApplication.h:14
CopasiUI3Window
Definition:
copasiui3window.h:54
CQCopasiApplication.h
COptions.h
CQMessageBox.h
COptions::getValue
static void getValue(const std::string &name, CType &value)
Definition:
COptions.h:124
CCopasiRootContainer::addDatamodel
static CCopasiDataModel * addDatamodel()
Definition:
CCopasiRootContainer.cpp:149
DataModelGUI.h
CCopasiRootContainer::destroy
static void destroy()
Definition:
CCopasiRootContainer.cpp:92
CQMessageBox::critical
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
Definition:
CQMessageBox.cpp:135
qtUtilities.h
Arguments::isValid
bool isValid() const
Definition:
arguments.cpp:315
CCopasiRootContainer::init
static void init(int argc, char *argv[], const bool &withGui=false)
Definition:
CCopasiRootContainer.cpp:78
Arguments::prepareModel
std::string prepareModel() const
Definition:
arguments.cpp:324
arguments.h
CCopasiDataModel.h
copasi::option_error
Definition:
COptionParser.h:130
Generated on Thu Jul 2 2015 14:50:44 for COPASI API by
1.8.6