~vbursian/research-assistant/intervers

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
////////////////////////////////////////////////////////////////////////////////
/*! @file ExecutionConsole.h   Execution watch frame for sAdminWindow.
- Part of RAdmin project.
- Uses  RAGUI - Research Assistant Graphical User Interface.
- Uses  RANet - Research Assistant Net Library.
- Uses  Qt v.5  - http://qt.io/
- Copyright(C) 2013-2020, Viktor E. Bursian, St.Petersburg, Russia.
                          VBursian AT gmail DOT com
*///////////////////////////////////////////////////////////////////////////////
#ifndef ExecutionConsole_H
#define ExecutionConsole_H
#include "RAGUI_global.h"
#include "AdminJob.h"
#include <QFrame>
#include <QLabel>
#include <QPushButton>
#include <QTimer>
#include <QTextEdit>
#include <QProgressBar>
namespace RA {
//------------------------------------------------------------------------------
//-------------------------------------------------------- sExecutionConsole ---

class  sExecutionConsole : public QFrame
{
  Q_OBJECT
  public://constants
    static const QString      JobDoneSymbols;
    static const QString      JobToDoSymbols;
    static const QString      StageSymbols;
  public:
                              ~sExecutionConsole ();
    explicit                  sExecutionConsole (QWidget * parent = 0);
    void                      Execute (const QString &  script
                                      ,bool  autoclose_on_success = false
                                      ,bool  autoclose_on_abend = false
                                      ,int   autoclose_delay_on_success = 5/*s*/
                                      ,int   autoclose_delay_on_abend = 20/*s*/
                                      );
  signals:
    void                      Done (bool  successfully);
  protected slots:
    void                      Refresh ();
    void                      SetTotalJobs (int num_of_jobs);
    void                      OnNewJob ();
    void                      SetTotalStages (int);
    void                      OnNewStage ();
    void                      Out (QString);
    void                      OutPar (QString);
    void                      CompleteOnAllDone ();
    void                      CompleteOnAbEnd ();
    void                      DelayedComplete ();
    void                      Complete ();
  private: //fields
    bool                      AutocloseOnSuccess;
    bool                      AutocloseOnAbEnd;
    bool                      ExecutedSuccessfully;
    int                       CurrentJobNum;
    int                       TotalJobs;
    int                       CurrentStage;
    int                       TotalStages;
    int                       Blinker;
    QTextEdit *               ReportViewer;
    QLabel *                  JobIndicator;
    QLabel *                  StageIndicator;
    QProgressBar *            ProgressBar;
    QPushButton *             CancelButton;
    QPushButton *             CloseButton;
    QTimer *                  RefreshTimer;
    sAdminJob *               TheJobExecutor;
    QLabel *                  AutoClosingLabel;
    QString                   AutoClosingText;
    int                       CloseDelayOnSuccess;
    int                       CloseDelayOnAbEnd;
    int                       CloseDelayCounter;
};

//------------------------------------------------------------------------------
} //namespace RA
#endif