BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
main.cpp File Reference

Description

Main function of the whole GUI.

Homepage:\n http://www.bornagainproject.org
License:\n GNU General Public License v3 or higher (see COPYING)
Authors
Scientific Computing Group at MLZ (see CITATION, AUTHORS)

Definition in file main.cpp.

Include dependency graph for main.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 
void messageHandler (QtMsgType, const QMessageLogContext &, const QString &)
 

Function Documentation

◆ main()

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

Definition at line 32 of file main.cpp.

33 {
34  ApplicationOptions options(argc, argv);
35 
36  QLocale::setDefault(QLocale(QLocale::English, QLocale::UnitedStates));
37  qRegisterMetaType<QVector<double>>("QVector<double>");
38 
39  if (!options.disableHighDPISupport())
40  QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
41 
42  QApplication app(argc, argv);
43  QApplication::setApplicationName("BornAgain");
44  QApplication::setApplicationVersion(GUI::Util::Path::getBornAgainVersionString());
45  QApplication::setOrganizationName("BornAgain");
46 #ifndef Q_OS_MAC
47  QApplication::setWindowIcon(QIcon(":/images/BornAgain.ico"));
48 #endif
49 
50  ApplicationSettings applicationSettings;
51  SessionData GSession;
52 
53  qInstallMessageHandler(MessageHandler);
54 
56 
57  auto style = applicationSettings.styleToUse();
58  applicationSettings.loadStyle(style);
59 
60  QString dir = GUI::Util::Path::appDataFolder();
61  if (!QDir().exists(dir))
62  QDir().mkpath(dir);
63 
64  GSession.instrumentLibrary.load();
65 
66  MainWindow win;
68  if (options.find("geometry"))
69  win.resize(options.mainWindowSize());
70 
71  win.show();
72 
73  int result = QApplication::exec();
74 
76 
77  return result;
78 }
void register1DDataLoaders()
register the concrete data loaders with the registration facility
void MessageHandler(QtMsgType type, const QMessageLogContext &, const QString &msg)
This is set by main to be the message handler of our GUI.
Handles command line and config file program options.
Definition: AppOptions.h:31
Application wide settings.
void loadStyle(ApplicationSettings::Style style)
static QMainWindow * mainWindow
Definition: Globals.h:22
QString appDataFolder()
The folder where persistent application data shall be stored. Under Windows this is the AppData/Roami...
Definition: Path.cpp:139
QString getBornAgainVersionString()
Definition: Path.cpp:60
InstrumentLibrary instrumentLibrary
Definition: SessionData.h:26

References GUI::Util::Path::appDataFolder(), ApplicationOptions::disableHighDPISupport(), ApplicationOptions::find(), GUI::Util::Path::getBornAgainVersionString(), SessionData::instrumentLibrary, InstrumentLibrary::load(), ApplicationSettings::loadStyle(), GUI::Global::mainWindow, ApplicationOptions::mainWindowSize(), MessageHandler(), register1DDataLoaders(), InstrumentLibrary::saveIfModified(), and ApplicationSettings::styleToUse().

Here is the call graph for this function:

◆ messageHandler()

void messageHandler ( QtMsgType  ,
const QMessageLogContext &  ,
const QString &   
)

Definition at line 30 of file main.cpp.

30 {}