File indexing completed on 2024-04-21 05:41:05
0001 /* 0002 SPDX-FileCopyrightText: 2019-2020 Nikolai Krasheninnikov <nkrasheninnikov@yandex.ru> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef SVNPROGRESSDIALOG_H 0008 #define SVNPROGRESSDIALOG_H 0009 0010 #include <QDialog> 0011 0012 #include "ui_svnprogressdialog.h" 0013 0014 class QProcess; 0015 0016 /** 0017 * \brief Dialog for showing SVN operation process. 0018 * 0019 * This dialog connects to the Subversion process (by \p connectToProcess()) and shows its output. 0020 * User has possibility to terminate the process by pressing cancel button. Normally do not need to 0021 * call \p disconnectFromProcess() as it calls automaticaly on connected process finished() signal. 0022 * 0023 * \note This class can call 'svn cleanup' on a Subversion process dir in case of terminating it if 0024 * a working directory were passed to the constructor. 0025 */ 0026 class SvnProgressDialog : public QDialog { 0027 Q_OBJECT 0028 public: 0029 /** 0030 * \param[in] title Dialog title. 0031 * \param[in] workingDir Directory to call 'svn cleanup' on. Empty for no cleanup. 0032 * \param[in,out] parent Parent widget. 0033 */ 0034 SvnProgressDialog(const QString& title, const QString& workingDir = QString(), QWidget *parent = nullptr); 0035 virtual ~SvnProgressDialog() override; 0036 0037 /** 0038 * Connects to the process signals, stdout and stderr. 0039 */ 0040 void connectToProcess(QProcess *process); 0041 0042 /** 0043 * Disconnects from previously connected process, nothing happens either. This function is 0044 * automaticaly called on connected process finished() signal. 0045 */ 0046 void disconnectFromProcess(); 0047 0048 public Q_SLOTS: 0049 void appendInfoText(const QString& text); 0050 void appendErrorText(const QString& text); 0051 void operationCompeleted(); 0052 0053 virtual void reject() override; 0054 0055 private: 0056 Ui::SvnProgressDialog m_ui; 0057 0058 QMetaObject::Connection m_conCancel; 0059 QMetaObject::Connection m_conCompeted; 0060 QMetaObject::Connection m_conProcessError; 0061 QMetaObject::Connection m_conStdOut; 0062 QMetaObject::Connection m_conStrErr; 0063 0064 bool m_svnTerminated; 0065 const QString m_workingDir; 0066 }; 0067 0068 #endif // SVNPROGRESSDIALOG_H