Skip to content
Snippets Groups Projects
Commit 656b1116 authored by Matthias Puchner's avatar Matthias Puchner
Browse files

add classes for application wide stuff

parent 2a7d3ea6
No related branches found
No related tags found
1 merge request!101On Windows: use native file dialog
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Application/Application.cpp
//! @brief Implements class Application
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2021
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "GUI/Application/Application.h"
Application::Application(int& argc, char** argv) : QApplication(argc, argv) {}
const ApplicationSettings& Application::settings() const
{
return m_settings;
}
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Application/Application.h
//! @brief Defines class Application
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2021
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#ifndef BORNAGAIN_GUI_APPLICATION_APPLICATION_H
#define BORNAGAIN_GUI_APPLICATION_APPLICATION_H
#include "ApplicationSettings.h"
#include <QApplication>
//! Provides access to application wide stuff like settings.
class Application : public QApplication {
public:
Application(int& argc, char** argv);
const ApplicationSettings& settings() const;
private:
ApplicationSettings m_settings;
};
#define baApp (static_cast<Application*>(qApp))
#endif // BORNAGAIN_GUI_APPLICATION_APPLICATION_H
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/mainwindow/projectmanager.cpp
//! @brief Implements class ProjectManager
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2018
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#include "GUI/Application/ApplicationSettings.h"
bool ApplicationSettings::useNativeFileDialog() const
{
#ifdef _WIN32
return true;
#else
return false;
#endif
}
// ************************************************************************************************
//
// BornAgain: simulate and fit reflection and scattering
//
//! @file GUI/Application/ApplicationSettings.h
//! @brief Defines class ApplicationSettings
//!
//! @homepage http://www.bornagainproject.org
//! @license GNU General Public License v3 or higher (see COPYING)
//! @copyright Forschungszentrum Jülich GmbH 2021
//! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
//
// ************************************************************************************************
#ifndef BORNAGAIN_GUI_APPLICATION_APPLICATIONSETTINGS_H
#define BORNAGAIN_GUI_APPLICATION_APPLICATIONSETTINGS_H
//! Application wide settings
class ApplicationSettings {
public:
bool useNativeFileDialog() const;
};
#endif // BORNAGAIN_GUI_APPLICATION_APPLICATIONSETTINGS_H
......@@ -13,6 +13,7 @@ set(library_name BornAgainGUI)
# --- source and include files ---
set(include_dirs
${CMAKE_CURRENT_SOURCE_DIR}/Application
${CMAKE_CURRENT_SOURCE_DIR}/mainwindow
${CMAKE_CURRENT_SOURCE_DIR}/utils
${CMAKE_CURRENT_SOURCE_DIR}/Models
......
......@@ -12,11 +12,12 @@
//
// ************************************************************************************************
#include "GUI/Application/Application.h"
#include "GUI/Views/FitWidgets/FitProgressInfo.h"
#include "GUI/mainwindow/mainwindow.h"
#include "GUI/utils/hostosinfo.h"
#include "GUI/main/MessageHandler.h"
#include "GUI/main/appoptions.h"
#include "GUI/mainwindow/mainwindow.h"
#include "GUI/utils/hostosinfo.h"
#include <QLocale>
#include <QMetaType>
......@@ -34,7 +35,7 @@ int main(int argc, char* argv[])
if (!options.disableHighDPISupport())
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QApplication app(argc, argv);
Application app(argc, argv);
qInstallMessageHandler(MessageHandler);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment