BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
main.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/main/main.cpp
6 //! @brief Main function of the whole GUI
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
20 #include "GUI/main/appoptions.h"
21 #include <QLocale>
22 #include <QMetaType>
23 
24 void messageHandler(QtMsgType, const QMessageLogContext&, const QString&) {}
25 
26 int main(int argc, char* argv[])
27 {
28  ApplicationOptions options(argc, argv);
29  if (!options.isConsistent())
30  return 0;
31 
32  QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
33  qRegisterMetaType<QVector<double>>("QVector<double>");
34 
35  if (!options.disableHighDPISupport())
36  QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
37 
38  QApplication app(argc, argv);
39 
40  qInstallMessageHandler(MessageHandler);
41 
42  std::unique_ptr<SplashScreen> splash;
43  if (!options.find("no-splash")) {
44  splash.reset(new SplashScreen);
45  splash->start(/*show_during*/ 1200);
46  }
47 
48  MainWindow win;
49  if (options.find("geometry"))
50  win.resize(options.mainWindowSize());
51 
52  win.show();
53 
54  if (splash)
55  splash->finish(&win);
56 
57  return QApplication::exec();
58 }
Defines class FitProgressInfo.
Defines class MainWindow.
int main(int argc, char *argv[])
Definition: main.cpp:26
void messageHandler(QtMsgType, const QMessageLogContext &, const QString &)
Definition: main.cpp:24
void MessageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
This is set by main to be the message handler of our GUI.
Declares function MessageHandler.
Defines class SplashScreen.
Collection of utilities to parse command line options.
Handles command line and config file program options.
Definition: appoptions.h:32
bool find(std::string name) const
Returns true if option with given name has been set.
Definition: appoptions.cpp:70
bool disableHighDPISupport()
Definition: appoptions.cpp:151
bool isConsistent() const
Returns true if options are consistent (no conflicts, no –help request)
Definition: appoptions.cpp:75
QSize mainWindowSize() const
Definition: appoptions.cpp:145
Defines Utils namespace.