VPTissue Reference Manual
simPT_editor.cpp
Go to the documentation of this file.
1 /*
2  * Copyright 2011-2016 Universiteit Antwerpen
3  *
4  * Licensed under the EUPL, Version 1.1 or as soon they will be approved by
5  * the European Commission - subsequent versions of the EUPL (the "Licence");
6  * You may not use this work except in compliance with the Licence.
7  * You may obtain a copy of the Licence at: http://ec.europa.eu/idabc/eupl5
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the Licence is distributed on an "AS IS" basis,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the Licence for the specific language governing
13  * permissions and limitations under the Licence.
14  */
21 #include "../cpp_simshell/common/InstallDirs.h"
22 #include "editor/TissueEditor.h"
24 
25 #include <QApplication>
26 #include <QMessageBox>
27 
28 #include <iostream>
29 #include <stdexcept>
30 
31 using namespace std;
32 using namespace SimPT_Sim::ClockMan;
33 
34 int main(int argc, char **argv)
35 {
36  int exit_status = EXIT_SUCCESS;
37 
38  // qApp: closing last window quits app and exits app process.
39  QApplication app(argc, argv, true);
40  qRegisterMetaType<std::string>("std::string");
41  qRegisterMetaType<Timeable<>::Stopclock::TClock::duration>("Timeable<>::Stopclock::TClock::duration");
42  QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
43 
44  // Icon search path.
45  QStringList search_paths = QIcon::themeSearchPaths();
46  search_paths.push_back(QString::fromStdString(SimShell::InstallDirs::GetDataDir() + "/icons"));
47  QIcon::setThemeSearchPaths(search_paths);
48  QIcon::setThemeName("Tango");
49 
50  try {
52  editor.show();
53  exit_status = app.exec();
54  }
55  catch (exception& e) {
56  cerr << e.what() << endl;
57  QString qmess = QString("Exception caught: %1").arg(e.what());
58  QMessageBox::critical(0, "Critical Error", qmess,
59  QMessageBox::Abort, QMessageBox::NoButton, QMessageBox::NoButton);
60  exit_status = EXIT_FAILURE;
61  }
62  catch (...) {
63  cerr << "Unknown exception." << endl;
64  QString qmess = QString("Unknown exception.");
65  QMessageBox::critical(0, "Critical Error", qmess);
66  exit_status = EXIT_FAILURE;
67  }
68 
69  return exit_status;
70 }
static std::string GetDataDir()
Utility method: get name of the directory for data files.
STL namespace.
Interface for the TissueEditor.
Main GUI class for cell editor.
Definition: TissueEditor.h:42
Interface for Timeable.
Namespace for clock and timekeeping related classes.
Definition: ClockCLib.h:27