BornAgain  1.19.0
Simulate and fit neutron and x-ray scattering at grazing incidence
newprojectdialog.h
Go to the documentation of this file.
1 // ************************************************************************************************
2 //
3 // BornAgain: simulate and fit reflection and scattering
4 //
5 //! @file GUI/coregui/mainwindow/newprojectdialog.h
6 //! @brief Defines class NewProjectDialog
7 //!
8 //! @homepage http://www.bornagainproject.org
9 //! @license GNU General Public License v3 or higher (see COPYING)
10 //! @copyright Forschungszentrum Jülich GmbH 2018
11 //! @authors Scientific Computing Group at MLZ (see CITATION, AUTHORS)
12 //
13 // ************************************************************************************************
14 
15 #ifndef BORNAGAIN_GUI_COREGUI_MAINWINDOW_NEWPROJECTDIALOG_H
16 #define BORNAGAIN_GUI_COREGUI_MAINWINDOW_NEWPROJECTDIALOG_H
17 
18 #include <QDialog>
19 #include <QLineEdit>
20 
21 class QLabel;
22 
23 //! new project dialog window
24 class NewProjectDialog : public QDialog {
25  Q_OBJECT
26 public:
27  enum Mode { CREATE, SAVE };
28 
29  NewProjectDialog(QWidget* parent, Mode mode, const QString& workingDirectory = "",
30  const QString& projectName = "");
31 
32  QString getWorkingDirectory() const;
33  void setWorkingDirectory(const QString& text);
34 
35  void setProjectName(const QString& text);
36 
37  QString getProjectFileName() const;
38 
39 private slots:
40  void onBrowseDirectory();
41  void checkIfProjectPathIsValid(const QString& dirname);
42  void checkIfProjectNameIsValid(const QString& projectName);
43  void createProjectDir();
44 
45 private:
46  QString getProjectName() const { return m_projectNameEdit->text(); }
47 
48  void setValidProjectName(bool status);
49  void setValidProjectPath(bool status);
50  void updateWarningStatus();
51 
52  QLineEdit* m_projectNameEdit;
53  QLineEdit* m_workDirEdit;
54  QPushButton* m_browseButton;
55  QLabel* m_warningLabel;
56  QPushButton* m_cancelButton;
57  QPushButton* m_createButton;
58 
61 };
62 
63 #endif // BORNAGAIN_GUI_COREGUI_MAINWINDOW_NEWPROJECTDIALOG_H
new project dialog window
void checkIfProjectPathIsValid(const QString &dirname)
Checks whether ProjectPath is valid and sets warning state accordingly.
NewProjectDialog(QWidget *parent, Mode mode, const QString &workingDirectory="", const QString &projectName="")
QLineEdit * m_workDirEdit
void checkIfProjectNameIsValid(const QString &projectName)
Checks whether project name is valid and sets warning state accordingly.
QLineEdit * m_projectNameEdit
void setValidProjectName(bool status)
sets flags whether project name is valid and then updates color of LineEdit and warning message
QPushButton * m_cancelButton
void updateWarningStatus()
updates warning label depending on validity of project name and path
QPushButton * m_createButton
QString getWorkingDirectory() const
QPushButton * m_browseButton
void createProjectDir()
creates directory with selected ProjectName in selected ProjectPath
void setWorkingDirectory(const QString &text)
void setValidProjectPath(bool status)
sets flags wether project path is valid and then updates color of LineEdit and warning message
void setProjectName(const QString &text)
QString getProjectFileName() const
void onBrowseDirectory()
calls directory selection dialog
QString getProjectName() const
QString projectName(const QString &projectFileName)
Returns project name deduced from project file name.