COPASI API
4.16.103
Main Page
Namespaces
Classes
Files
File List
File Members
copasi
CopasiUI
CopasiUI/main.cpp
Go to the documentation of this file.
1
// Copyright (C) 2010 - 2015 by Pedro Mendes, Virginia Tech Intellectual
2
// Properties, Inc., University of Heidelberg, and The University
3
// of Manchester.
4
// All rights reserved.
5
6
// Copyright (C) 2008 - 2009 by Pedro Mendes, Virginia Tech Intellectual
7
// Properties, Inc., EML Research, gGmbH, University of Heidelberg,
8
// and The University of Manchester.
9
// All rights reserved.
10
11
// Copyright (C) 2002 - 2007 by Pedro Mendes, Virginia Tech Intellectual
12
// Properties, Inc. and EML Research, gGmbH.
13
// All rights reserved.
14
15
#include <stdexcept>
16
#include <locale.h>
17
18
#include <QtGui/QApplication>
19
20
#define COPASI_MAIN
21
22
#include "
copasi.h
"
23
24
#include "
UI/CQCopasiApplication.h
"
25
#include "
UI/copasiui3window.h
"
26
#include "
UI/DataModelGUI.h
"
27
#include "
UI/CQMessageBox.h
"
28
29
#include "
CopasiDataModel/CCopasiDataModel.h
"
30
#include "
report/CCopasiRootContainer.h
"
31
#include "
function/CFunctionDB.h
"
32
#include "
function/CFunction.h
"
33
#include "
commandline/COptionParser.h
"
34
#include "
commandline/COptions.h
"
35
36
#ifdef COPASI_SBW_INTEGRATION
37
// SBW includes
38
#include "SBW/SBW.h"
39
#include <sstream>
40
#endif // COPASI_SBW_INTEGRATION
41
42
#ifdef Darwin
43
# include <QtCore/QDir>
44
# include "
UI/qtUtilities.h
"
45
#endif // Darwin
46
47
int
main
(
int
argc,
char
*argv[])
48
{
49
// Fix for Issue 1377, if locale is not set to the default one, some
50
// numbers will be displayed in the systems default locale:
51
setlocale(LC_ALL,
"C"
);
52
53
// Fix of Issue with Text centering on OSX Mavericks
54
#ifdef Q_OS_MACX
55
56
if
(QSysInfo::MacintoshVersion > QSysInfo::MV_10_8)
57
{
58
// fix Mac OS X 10.9 (mavericks) font issue
59
// https://bugreports.qt-project.org/browse/QTBUG-32789
60
QFont::insertSubstitution(
".Lucida Grande UI"
,
"Lucida Grande"
);
61
}
62
63
#endif
64
65
CQCopasiApplication
a(argc, argv);
66
67
a.setAttribute(Qt::AA_DontShowIconsInMenus,
false
);
68
69
Q_INIT_RESOURCE(copasi);
70
71
// Parse the commandline options
72
try
73
{
74
// Create the root container.
75
CCopasiRootContainer::init
(argc, argv,
true
);
76
}
77
catch
(
copasi::option_error
& msg)
78
{
79
CQMessageBox::critical
(NULL,
"Initialization Error"
,
80
msg.what(),
81
QMessageBox::Ok , QMessageBox::Ok);
82
83
return
1;
84
}
85
86
#ifdef Darwin
87
std::string PluginDir;
88
89
COptions::getValue
(
"CopasiDir"
, PluginDir);
90
PluginDir +=
"/Contents/plugins"
;
91
92
QApplication::setLibraryPaths(QStringList(
FROM_UTF8
(PluginDir)));
93
#endif // Darwin
94
95
// Create the global data model.
96
CCopasiRootContainer::addDatamodel
();
97
98
// Create the main application window.
99
CopasiUI3Window
*pWindow =
CopasiUI3Window::create
();
100
101
#ifdef COPASI_SBW_INTEGRATION
102
103
if
(
COptions::compareValue
(
"SBWRegister"
,
true
))
104
goto
finish;
105
106
#endif // COPASI_SBW_INTEGRATION
107
108
if
(pWindow != NULL)
109
{
110
a.
setMainWindow
(pWindow);
111
a.exec();
112
}
113
114
finish:
115
116
try
// To suppress any access violations during destruction works only under Windows
117
{
118
pdelete
(pWindow);
119
CCopasiRootContainer::destroy
();
120
}
121
catch
(...)
122
{}
123
124
return
0;
125
}
pdelete
#define pdelete(p)
Definition:
copasi.h:215
FROM_UTF8
#define FROM_UTF8(__x)
Definition:
qtUtilities.h:73
CFunctionDB.h
CFunction.h
COptionParser.h
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
main
int main(int argc, char *argv[])
Definition:
CopasiUI/main.cpp:47
CCopasiRootContainer::init
static void init(int argc, char *argv[], const bool &withGui=false)
Definition:
CCopasiRootContainer.cpp:78
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