File indexing completed on 2024-04-14 05:34:11
0001 /* 0002 SPDX-FileCopyrightText: 2010 Sebastian Doerner <sebastian@sebastian-doerner.de> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef CHECKOUTDIALOG_H 0008 #define CHECKOUTDIALOG_H 0009 0010 #include <QDialog> 0011 #include <QSet> 0012 #include <QString> 0013 0014 class QCheckBox; 0015 class QComboBox; 0016 class QDialogButtonBox; 0017 class QGroupBox; 0018 class QLineEdit; 0019 class QRadioButton; 0020 0021 /** 0022 * @brief The dialog for checking out Branches or Tags in Git. 0023 */ 0024 class CheckoutDialog : public QDialog 0025 { 0026 Q_OBJECT 0027 0028 public: 0029 explicit CheckoutDialog(QWidget* parent = nullptr); 0030 /** 0031 * Returns the name of the selected tag or branch to be checkout out 0032 * @returns The name of the selected tag or branch 0033 */ 0034 QString checkoutIdentifier() const; 0035 /** 0036 * @returns True if the user selected a forced checkout, false otherwise. 0037 */ 0038 bool force() const; 0039 /** 0040 * @returns The user selected name of the new branch, if a new branch is to be 0041 * created, empty String otherwise. 0042 */ 0043 QString newBranchName() const; 0044 0045 private Q_SLOTS: 0046 void branchRadioButtonToggled(bool checked); 0047 void newBranchCheckBoxStateToggled(int state); 0048 /** 0049 * Checks whether the values of all relevant widgets are valid. 0050 * Enables or disables the OK button and sets tooltips accordingly. 0051 */ 0052 void setOkButtonState(); 0053 void noteUserEditedNewBranchName(); 0054 /** 0055 * Inserts a default name for the new branch into m_newBranchName unless the user 0056 * has already edited the content. 0057 * @param baseBranchName The base name to derive the new name of. 0058 */ 0059 void setDefaultNewBranchName(const QString & baseBranchName); 0060 private: 0061 inline void setLineEditErrorModeActive(bool active); 0062 private: 0063 ///@brief true if the user has manually edited the branchName, false otherwise 0064 bool m_userEditedNewBranchName; 0065 QSet<QString> m_branchNames; 0066 QPalette m_errorColors; 0067 QDialogButtonBox *m_buttonBox; 0068 QGroupBox * m_branchSelectGroupBox; 0069 QRadioButton * m_branchRadioButton; 0070 QComboBox * m_branchComboBox; 0071 QComboBox * m_tagComboBox; 0072 QCheckBox * m_newBranchCheckBox; 0073 QLineEdit * m_newBranchName; 0074 QCheckBox * m_forceCheckBox; 0075 }; 0076 0077 #endif // CHECKOUTDIALOG_H