BornAgain  1.19.79
Simulate and fit neutron and x-ray scattering at grazing incidence
WelcomeView Class Reference

Description

Definition at line 27 of file WelcomeView.h.

Inheritance diagram for WelcomeView:
[legend]
Collaboration diagram for WelcomeView:
[legend]

Public Member Functions

 WelcomeView (QWidget *parent)
 

Private Member Functions

ProjectManagerprojectManager ()
 
void updateRecentProjectPanel ()
 

Private Attributes

Ui::WelcomeView * m_ui
 

Constructor & Destructor Documentation

◆ WelcomeView()

WelcomeView::WelcomeView ( QWidget *  parent)

Definition at line 27 of file WelcomeView.cpp.

28  : QWidget(parent)
29  , m_ui(new Ui::WelcomeView)
30 {
31  m_ui->setupUi(this);
32 
33  setAttribute(Qt::WA_StyledBackground, true);
34  setProperty("stylable", true); // for stylesheet addressing
35 
37 
38  QPalette palette = this->palette();
39  palette.setColor(QPalette::Window, Qt::white);
40  setPalette(palette);
41 
42  connect(m_ui->newButton, &QPushButton::clicked, projectManager(), &ProjectManager::newProject);
43  connect(m_ui->openButton, &QPushButton::clicked, [=]() { projectManager()->openProject(); });
44  connect(m_ui->websiteButton, &QPushButton::clicked,
45  []() { QDesktopServices::openUrl(QUrl("https://www.bornagainproject.org")); });
48 
50 }
static GroupBoxCollapser * installIntoGroupBox(QGroupBox *groupBox, bool expanded=true)
void recentListModified()
void newProject()
Processes new project request (close old project, rise dialog for project name, create project).
void updateRecentProjectPanel()
Definition: WelcomeView.cpp:57
ProjectManager * projectManager()
Definition: WelcomeView.cpp:52
Ui::WelcomeView * m_ui
Definition: WelcomeView.h:36

References GroupBoxCollapser::installIntoGroupBox(), m_ui, ProjectManager::newProject(), projectManager(), ProjectManager::recentListModified(), and updateRecentProjectPanel().

Here is the call graph for this function:

Member Function Documentation

◆ projectManager()

ProjectManager * WelcomeView::projectManager ( )
private

Definition at line 52 of file WelcomeView.cpp.

53 {
54  return ProjectManager::instance();
55 }
static ProjectManager * instance()

References ProjectManager::instance().

Referenced by WelcomeView(), and updateRecentProjectPanel().

Here is the call graph for this function:

◆ updateRecentProjectPanel()

void WelcomeView::updateRecentProjectPanel ( )
private

Definition at line 57 of file WelcomeView.cpp.

58 {
59  GUI::Util::Layout::clearLayout(m_ui->recentProjectsLayout);
60 
61  for (const auto& file : projectManager()->recentProjects()) {
62  auto* button = new QCommandLinkButton;
63  button->setText(QFileInfo(file).baseName());
64  button->setDescription(GUI::Util::Path::withTildeHomePath(QDir::toNativeSeparators(file)));
65  button->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Minimum);
66  connect(button, &QCommandLinkButton::clicked, [=] { projectManager()->openProject(file); });
67 
68  m_ui->recentProjectsLayout->addWidget(button);
69  }
70  m_ui->recentProjectsLayout->addStretch(1);
71 }
void openProject(QString fileName="")
Opens existing project. If fileName is empty, will popup file selection dialog.
void clearLayout(QLayout *layout, bool deleteWidgets=true)
Removes content from box layout.
Definition: LayoutUtils.cpp:68
QString baseName(const QString &fileName)
Returns base name of file.
Definition: Path.cpp:133
QString withTildeHomePath(const QString &path)
Definition: Path.cpp:45

References GUI::Util::Path::baseName(), GUI::Util::Layout::clearLayout(), m_ui, ProjectManager::openProject(), projectManager(), and GUI::Util::Path::withTildeHomePath().

Referenced by WelcomeView().

Here is the call graph for this function:

Member Data Documentation

◆ m_ui

Ui::WelcomeView* WelcomeView::m_ui
private

Definition at line 36 of file WelcomeView.h.

Referenced by WelcomeView(), and updateRecentProjectPanel().


The documentation for this class was generated from the following files: