VPTissue Reference Manual
parex_client.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  */
20 #include "parex_client_mode.h"
21 
22 #include "parex_client/Client.h"
23 
24 #include <cstdlib>
25 #include <iostream>
26 #include <stdexcept>
27 #include <QApplication>
28 #include <QMessageBox>
29 
30 namespace Modes {
31 
32 using namespace std;
33 using namespace SimPT_Parex;
34 
35 int ParexClientMode::operator()(int argc, char** argv)
36 {
37  int exit_status = EXIT_SUCCESS;
38 
39  // qApp: closing last window quits app and exits app process.
40  QApplication app(argc, argv, true);
41  qRegisterMetaType<std::string>("std::string");
42  QObject::connect(qApp, SIGNAL(lastWindowClosed()), qApp, SLOT(quit()));
43 
44  try {
45  Client clientView;
46  clientView.setVisible(true);
47  exit_status = app.exec();
48  }
49  catch (exception& e) {
50  cerr << e.what() << endl;
51  QString qmess = QString("Exception: %1").arg(e.what());
52  QMessageBox::critical(0, "Critical Error", qmess,
53  QMessageBox::Abort, QMessageBox::NoButton, QMessageBox::NoButton);
54  exit_status = EXIT_FAILURE;
55  }
56  catch (...) {
57  cerr << "Unknown exception." << endl;
58  QString qmess = QString("Unknown exception.");
59  QMessageBox::critical(0, "Critical Error", qmess);
60  exit_status = EXIT_FAILURE;
61  }
62 
63  return exit_status;
64 }
65 
66 } //namespace
Interface for Client.
STL namespace.
Interface/Implementation for the exec modes.
Namespace for startup modes for simPT tools.
Definition: mode_manager.h:36
Client for Parameter Exploration.
Definition: Client.h:45
Namespace for SimPT parameter explorer package.
Definition: Client.cpp:52