COPASI API  4.16.103
Macros | Functions
CopasiUI/main.cpp File Reference
#include <stdexcept>
#include <locale.h>
#include <QtGui/QApplication>
#include "copasi.h"
#include "UI/CQCopasiApplication.h"
#include "UI/copasiui3window.h"
#include "UI/DataModelGUI.h"
#include "UI/CQMessageBox.h"
#include "CopasiDataModel/CCopasiDataModel.h"
#include "report/CCopasiRootContainer.h"
#include "function/CFunctionDB.h"
#include "function/CFunction.h"
#include "commandline/COptionParser.h"
#include "commandline/COptions.h"
Include dependency graph for CopasiUI/main.cpp:

Go to the source code of this file.

Macros

#define COPASI_MAIN
 

Functions

int main (int argc, char *argv[])
 

Macro Definition Documentation

#define COPASI_MAIN

Definition at line 20 of file CopasiUI/main.cpp.

Function Documentation

int main ( int  argc,
char *  argv[] 
)

Definition at line 47 of file CopasiUI/main.cpp.

References CCopasiRootContainer::addDatamodel(), COptions::compareValue(), CopasiUI3Window::create(), CQMessageBox::critical(), CCopasiRootContainer::destroy(), FROM_UTF8, COptions::getValue(), CCopasiRootContainer::init(), pdelete, and CQCopasiApplication::setMainWindow().

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.
97 
98  // Create the main application window.
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);
120  }
121  catch (...)
122  {}
123 
124  return 0;
125 }
#define pdelete(p)
Definition: copasi.h:215
#define FROM_UTF8(__x)
Definition: qtUtilities.h:73
static bool compareValue(const std::string &name, const CType &value)
Definition: COptions.h:128
static CopasiUI3Window * create()
static void getValue(const std::string &name, CType &value)
Definition: COptions.h:124
static CCopasiDataModel * addDatamodel()
static StandardButton critical(QWidget *parent, const QString &title, const QString &text, StandardButtons buttons=Ok, StandardButton defaultButton=NoButton)
static void init(int argc, char *argv[], const bool &withGui=false)