16 #include "Base/Util/Assert.h"
17 #include "Base/Util/SysUtils.h"
27 #include <QDesktopServices>
36 , m_mainWindow(parent)
37 , m_newAction(nullptr)
38 , m_openAction(nullptr)
39 , m_saveAction(nullptr)
40 , m_saveAsAction(nullptr)
41 , m_exitAction(nullptr)
42 , m_aboutAction(nullptr)
45 , m_settingsMenu(nullptr)
47 , m_recentProjectsMenu(nullptr)
49 , m_simulateShortcut(nullptr)
75 ASSERT(projectManager);
87 connect(
m_openAction, &QAction::triggered, projectManager,
88 [projectManager]() { projectManager->
openProject(); });
94 m_saveAction->setShortcutContext(Qt::ApplicationShortcut);
95 connect(
m_saveAction, &QAction::triggered, projectManager,
96 [projectManager]() { projectManager->
saveProject(); });
101 m_saveAsAction->setStatusTip(
"Save project under different name");
118 m_webdocAction->setStatusTip(
"Open BornAgain documentation in default browser");
120 []() { QDesktopServices::openUrl(QUrl(
"https://www.bornagainproject.org/latest")); });
186 bool hasRecentProjects =
false;
189 hasRecentProjects =
true;
192 actionText = QString(
"&%1 ").arg(orderNr) + actionText;
194 action->setData(QVariant::fromValue(file));
200 if (hasRecentProjects) {
217 action->setToolTip(
"Additional developer's view will appear in left control tab bar");
218 action->setCheckable(
true);
224 action->setToolTip(
"Project will be saved periodically in project's autosave directory.\n"
225 "When opening project, recover option will be suggested, if possible.");
226 action->setCheckable(
true);
232 action->setCheckable(
true);
234 connect(action, &QAction::toggled,
239 auto* unitActions =
new QActionGroup(
this);
240 const auto addUnitAction = [=](
const QString& text,
bool isAngstrom) {
243 action->setCheckable(
true);
245 unitActions->addAction(action);
248 addUnitAction(
"Lengths in nanometer",
false);
249 addUnitAction(u8
"Lengths in \u00c5ngstrom",
true);
253 auto* styleActions =
new QActionGroup(
this);
259 action->setCheckable(
true);
261 styleActions->addAction(action);
278 if (
auto* sampleView =
dynamic_cast<SampleView*
>(view); sampleView !=
nullptr)
280 if (
auto* jobView =
dynamic_cast<JobView*
>(view); jobView !=
nullptr)
Defines class AboutDialog.
Defines class ActionManager.
ApplicationSettings * appSettings
global pointer to the instance
Defines class ApplicationSettings.
Defines class MainWindow.
Defines class Helpers functions.
Defines class ProjectManager.
Defines class SampleView.
SessionData * gSessionData
global pointer to the single instance
Defines struct SessionData.
ActionManager(MainWindow *parent)
MainWindow * m_mainWindow
void onCurrentViewChanged()
void createGlobalShortcuts()
void onAboutToShowViewMenu()
void onAboutToShowFileMenu()
void onAboutToShowSettingsMenu()
void onAboutApplication()
QAction * m_closeProjectAction
QMenu * m_recentProjectsMenu
QShortcut * m_simulateShortcut
void setSessionModelViewActive(bool status)
void updateActionEnabling()
void setStyleToUse(Style style)
void setDefaultUnitIsAngstrom(bool b) const
ApplicationSettings::Style currentStyle()
bool createNewProjectOnStartup() const
bool defaultUnitIsAngstrom() const
void loadStyle(ApplicationSettings::Style style)
void setCreateNewProjectOnStartup(bool b)
The JobView class is a main view to show list of jobs, job results and widgets for real time and fitt...
QWidget * currentView() const
void onSessionModelViewActive(bool isActive)
Inserts/removes developers SessionModelView on the left tabbar.
void onRunSimulationShortcut()
void currentViewChanged(ViewId newView)
ProjectManager * projectManager()
Handles activity related to opening/save projects.
bool saveProject(QString projectFileName="")
Processes save project request.
static ProjectManager * instance()
void clearRecentProjects()
Clears list of recent projects.
void setAutosaveEnabled(bool value)
bool closeCurrentProject()
Processes close current project request. Call save/discard/cancel dialog, if necessary....
void openProject(QString fileName="")
Opens existing project. If fileName is empty, will popup file selection dialog.
bool isAutosaveEnabled() const
void newProject()
Processes new project request (close old project, rise dialog for project name, create project).
bool saveProjectAs()
Processes 'save project as' request.
QStringList recentProjects()
Returns list of recent projects, validates if projects still exists on disk.
void documentOpenedOrClosed(bool opened)
Defines namespace GUI::Constants.
const char S_VIEWISACTIVE[]
const char S_SESSIONMODELVIEW[]
QString withTildeHomePath(const QString &path)
std::optional< ProjectDocument * > projectDocument