BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
welcomeview.cpp
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file gui2/welcomeview/welcomeview.cpp
6 //! @brief Implements class CLASS?
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2020
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
23 #include <QApplication>
24 #include <QHBoxLayout>
25 #include <QMainWindow>
26 
27 namespace gui2 {
28 
30  : QWidget(parent)
31  , m_models(models)
32  , m_projectHandler(new ProjectHandler(models, this))
33  , m_recentProjectWidget(new RecentProjectWidget)
34  , m_openProjectWidget(new OpenProjectWidget)
35 {
36  QPalette palette;
37  palette.setColor(QPalette::Window, Qt::white);
38  setAutoFillBackground(true);
39  setPalette(palette);
40 
41  auto layout = new QHBoxLayout(this);
42  layout->addSpacing(50);
43  layout->addWidget(m_recentProjectWidget, 38);
44  layout->addWidget(m_openProjectWidget, 62);
45  layout->addSpacing(50);
46 
48 }
49 
50 WelcomeView::~WelcomeView() = default;
51 
52 //! Returns 'true' if current project can be closed.
53 //! Internally will perform check for unsaved data, and proceed via save/discard/cancel dialog.
54 
56 {
58 }
59 
61 {
63 }
64 
66 {
68 }
69 
70 void WelcomeView::onOpenExistingProject(const QString& dirname)
71 {
72  return m_projectHandler->onOpenExistingProject(dirname);
73 }
74 
76 {
78 }
79 
81 {
83 }
84 
86 {
88 }
89 
91 {
92  // connect buttons of OpenProjectWidget with this slots.
93  auto open_existing_project = [this]() { onOpenExistingProject(); };
95  open_existing_project);
98 
99  // connect RecentProjectWidget panels with this slots.
102 
103  // connect ProjectHandler with RecentProjectWidget
110 }
111 
112 } // namespace gui2
Defines class CLASS?
Main class to holds all models of GUI session.
Widget with logo, name of the program and buttons to create new project or open existing one.
Main class to coordinate all activity on user's request to create new project, open existing one,...
void recentProjectsListModified(const QStringList &projects)
void onOpenExistingProject(const QString &dirname={})
bool canCloseProject() const
Returns 'true' if current project can be closed.
void currentProjectModified(const QString &project_dir, bool is_modified)
void updateNames()
Update names (name of the current project, recent project name list, notifies the world).
Widget with the name of current project and collection of recent projects.
void setRecentProjectsList(const QStringList &projects)
Set name of all recent projects to appropriate widgets.
void setCurrentProject(const QString &project_dir, bool is_modified)
Set current project title and label on appropriate widget.
void projectSelected(const QString &project_dir)
bool canCloseProject() const
Returns 'true' if current project can be closed.
Definition: welcomeview.cpp:55
WelcomeView(ApplicationModels *models, QWidget *parent=nullptr)
Definition: welcomeview.cpp:29
OpenProjectWidget * m_openProjectWidget
Definition: welcomeview.h:61
void onCreateNewProject()
Definition: welcomeview.cpp:65
void onClearRecentProjectsList()
Definition: welcomeview.cpp:85
void onSaveCurrentProject()
Definition: welcomeview.cpp:75
RecentProjectWidget * m_recentProjectWidget
Definition: welcomeview.h:60
void recentProjectsListModified(const QStringList &projects)
void setup_connections()
Definition: welcomeview.cpp:90
ProjectHandler * m_projectHandler
Definition: welcomeview.h:59
void onOpenExistingProject(const QString &dirname={})
Definition: welcomeview.cpp:70
Based on Qt example "codeeditor" Copyright (C) 2016 The Qt Company Ltd.
Definition: app_constants.h:20
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?
Defines class CLASS?