File indexing completed on 2024-04-21 05:41:03
0001 /* 0002 SPDX-FileCopyrightText: 2011 Vishesh Yadav <vishesh3y@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef HGSYNCDIALOGBASE_H 0008 #define HGSYNCDIALOGBASE_H 0009 0010 #include "hgwrapper.h" 0011 0012 #include <QString> 0013 #include <QProcess> 0014 #include <QSize> 0015 #include <QMap> 0016 #include "dialogbase.h" 0017 0018 class QLabel; 0019 class QCheckBox; 0020 class QGroupBox; 0021 class QProgressBar; 0022 class QTextEdit; 0023 class QComboBox; 0024 class HgPathSelector; 0025 0026 //TODO: Save/Load dialog geometry 0027 //TODO: HTTPS login 0028 // 0029 0030 /** 0031 * Abstract class which implements common features of Push and Pull dialog. 0032 * Inherited by HgPushDialog and HgPullDialog. 0033 */ 0034 class HgSyncBaseDialog : public DialogBase 0035 { 0036 Q_OBJECT 0037 0038 public: 0039 enum DialogType {PushDialog, PullDialog}; 0040 0041 explicit HgSyncBaseDialog(DialogType dialogType, QWidget *parent = nullptr); 0042 0043 Q_SIGNALS: 0044 void changeListAvailable(); 0045 0046 protected: 0047 void done(int r) override; 0048 void setupUI(); 0049 void createOptionGroup(); 0050 void setup(); 0051 void loadSmallSize(); 0052 void loadBigSize(); 0053 /** Changes text of @p m_optionsButton to 'Options >>' (true) or 'Options <<' (false) */ 0054 void switchOptionsButton(bool switchOn); 0055 0056 virtual void setOptions() = 0; 0057 virtual void createChangesGroup() = 0; 0058 virtual void parseUpdateChanges(const QString &input) = 0; 0059 virtual void appendOptionArguments(QStringList &args) = 0; 0060 virtual void getHgChangesArguments(QStringList &args) = 0; 0061 virtual void noChangesMessage() = 0; 0062 0063 protected Q_SLOTS: 0064 void slotGetChanges(); 0065 void slotChangesProcessComplete(int exitCode, QProcess::ExitStatus status); 0066 void slotChangesProcessError(); 0067 void slotOperationComplete(int exitCode, QProcess::ExitStatus status); 0068 void slotOperationError(); 0069 void slotUpdateBusy(QProcess::ProcessState state); 0070 void slotWriteBigSize(); 0071 void slotOptionsButtonClick(); 0072 virtual void writeBigSize() = 0; 0073 virtual void readBigSize() = 0; 0074 0075 protected: 0076 HgPathSelector *m_pathSelector; 0077 QProgressBar *m_statusProg; 0078 bool m_haveChanges; 0079 bool m_terminated; 0080 HgWrapper *m_hgw; 0081 DialogType m_dialogType; 0082 0083 // Options 0084 QList<QCheckBox*> m_options; 0085 QGroupBox *m_optionGroup; 0086 0087 // geometry 0088 QSize m_smallSize; 0089 QSize m_bigSize; 0090 0091 // changes 0092 QPushButton *m_changesButton; 0093 QPushButton *m_optionsButton; 0094 QGroupBox *m_changesGroup; 0095 QProcess m_process; 0096 QProcess m_main_process; //should I use another process? 0097 0098 }; 0099 0100 #endif // HGSYNCDIALOGBASE_H 0101