BornAgain  1.19.79
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/View/Project/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_VIEW_PROJECT_NEWPROJECTDIALOG_H
16 #define BORNAGAIN_GUI_VIEW_PROJECT_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  NewProjectDialog(QWidget* parent, const QString& workingDirectory = "",
28  const QString& projectName = "");
29 
30  QString getWorkingDirectory() const;
31  void setWorkingDirectory(const QString& text);
32 
33  QString getProjectFileName() const;
34 
35 private slots:
36  void onBrowseDirectory();
37  void checkIfProjectPathIsValid(const QString& dirname);
38  void checkIfProjectNameIsValid(const QString& projectName);
39  void createProjectDir();
40 
41 private:
42  QString getProjectName() const { return m_projectNameEdit->text(); }
43 
44  void setValidProjectName(bool status);
45  void setValidProjectPath(bool status);
46  void updateWarningStatus();
47 
48  QLineEdit* m_projectNameEdit;
49  QLineEdit* m_workDirEdit;
50  QPushButton* m_browseButton;
51  QLabel* m_warningLabel;
52  QPushButton* m_cancelButton;
53  QPushButton* m_createButton;
54 
57 };
58 
59 #endif // BORNAGAIN_GUI_VIEW_PROJECT_NEWPROJECTDIALOG_H
new project dialog window
void checkIfProjectPathIsValid(const QString &dirname)
Checks whether ProjectPath is valid and sets warning state accordingly. Corresponding directory shoul...
QLineEdit * m_workDirEdit
void checkIfProjectNameIsValid(const QString &projectName)
Checks whether project name is valid and sets warning state accordingly. There should not be the dire...
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
QString getProjectFileName() const
void onBrowseDirectory()
calls directory selection dialog
QString getProjectName() const
NewProjectDialog(QWidget *parent, const QString &workingDirectory="", const QString &projectName="")
QString projectName(const QString &projectFileName)
Returns project name deduced from project file name.