summaryrefslogblamecommitdiffstats
path: root/src/gui.h
blob: e6706aeb4e1d1abf9c363f72e3ff7190a689f8a4 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18

















                            
                                                                                                                                  

           


                                                         






                                   


                                                                                 





                                              
                     



                                     
                  

                        


      
#ifndef _COW_GUI_H_
#define _COW_GUI_H_

#include <QDialog>
#include <QHash>

class QVBoxLayout;
class QNetworkAccessManager;
class QPushButton;
class QTimer;
class QLabel;

class Progress;

class Gui : public QDialog
{
    Q_OBJECT
public:
    explicit Gui(const QString &urlbase, const QString &uuid, int dnbd3pid, const QString &statusFile, QWidget *parent = nullptr);
    ~Gui();

protected:
    virtual void closeEvent(QCloseEvent *event) override;

private slots:
    void pushedCancel(bool pushed);
    void pushedOk(bool pushed);

private:
    void setupUi();
    void updateButtons();
    void readDnbd3Status();
    void queryRemoteStatus();
    void setProgressState(const QString &title, int percent, const QString &err);

    QNetworkAccessManager *_nam;
    QVBoxLayout *_itemBox;
    QString _remoteState;
    QString _urlStatus, _urlAbort, _urlFinish;
    bool _denyInteraction;
    bool _allowClose;
    QPushButton *_btnAbort, *_btnOk;
    QTimer *_tmrStatus;
    QHash<QString, Progress*> _items;
    QLabel *_status;
    int _dnbd3pid;
    QString _statusFile;
    int _totalClusters;
};

#endif