File indexing completed on 2024-05-12 17:16:02
0001 /*************************************************************************** 0002 * Copyright (C) 2016 Christian Ehrlicher <ch.ehrlicher@gmx.de> * 0003 * * 0004 * This program is free software; you can redistribute it and/or modify * 0005 * it under the terms of the GNU General Public License as published by * 0006 * the Free Software Foundation; either version 2 of the License, or * 0007 * (at your option) any later version. * 0008 * * 0009 * This program is distributed in the hope that it will be useful, * 0010 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0012 * GNU General Public License for more details. * 0013 * * 0014 * You should have received a copy of the GNU General Public License * 0015 * along with this program; if not, write to the * 0016 * Free Software Foundation, Inc., * 0017 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 0018 ***************************************************************************/ 0019 #pragma once 0020 0021 #include <QDialog> 0022 0023 class QDialogButtonBox; 0024 class QVBoxLayout; 0025 0026 class KSvnDialog : public QDialog 0027 { 0028 Q_OBJECT 0029 public: 0030 explicit KSvnDialog(const QString &configGroupName, QWidget *parent = nullptr); 0031 ~KSvnDialog(); 0032 0033 protected: 0034 void setDefaultButton(QPushButton *defaultButton); 0035 void showEvent(QShowEvent *e) override; 0036 private: 0037 QString m_configGroupName; 0038 }; 0039 0040 class KSvnSimpleOkDialog : public KSvnDialog 0041 { 0042 Q_OBJECT 0043 public: 0044 explicit KSvnSimpleOkDialog(const QString &configGroupName, QWidget *parent = nullptr); 0045 0046 /** 0047 * @brief Add a cancel button to the button box 0048 */ 0049 void setWithCancelButton(); 0050 /** 0051 * @brief Add a new widget to the VBoxLayout 0052 */ 0053 void addWidget(QWidget *widget); 0054 /** 0055 * @brief Add the button box to the vbox layout. 0056 * only needed if exec() is not called 0057 * --> if it is not treated as modal dialog 0058 */ 0059 void addButtonBox(); 0060 /** 0061 * @brief Set the appropriate help context 0062 */ 0063 void setHelp(const QString &context); 0064 int exec() override; 0065 0066 QDialogButtonBox *buttonBox() { return m_bBox; } 0067 0068 private Q_SLOTS: 0069 void onHelpRequested(); 0070 private: 0071 QVBoxLayout *m_layout; 0072 QDialogButtonBox *m_bBox; 0073 bool m_bBoxAdded; 0074 QString m_helpContext; 0075 };