~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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
////////////////////////////////////////////////////////////////////////////////
/*! @file AdminWindow.h   RANet administrator window.
- 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 AdminWindow_H
#define AdminWindow_H
#include "RAGUI_global.h"
#include "ExecutionConsole.h"
#include "Navigator.h"
#include "DB_SQL_Net.h"
#include "EditScriptDialog.h"
#include <QMainWindow>
#include <QString>
#include <QLabel>
#include <QAction>
#include <QMenuBar>
#include <QTimer>
#include <QFrame>
#include <QTextEdit>
#include <QProgressBar>
namespace RA {
//------------------------------------------------------------------------------
//------------------------------------------------------------- sAdminWindow ---

class  sAdminWindow : public QMainWindow
{
  Q_OBJECT
  public:
    enum                      eOpenMode {cNothingIsOpen
                                        ,cJobScript
                                        ,cPartition
                                        ,cPartitionAndRelated
                                        };
  public://static const
    static const sString      Title;
    static const sString      WorkstationAttrName;

  public:
    virtual                   ~sAdminWindow ();
    explicit                  sAdminWindow (psNet  net);

  signals:
    void                      GotJob (QString);
    void                      GotJobFile (QString);

  protected slots:
    void                      ShowHelpContents ();
  private slots:
    void                      OpenRANet ();
    void                      OpenRANet (sString  textual_URL);
    void                      OpenPartition ();
    void                      OpenPartition (sString  textual_URL);
    void                      Close ();
    void                      Reopen (bool   on_success);
    void                      UpdateMenu ();
    void                      UpdateMenuFile ();
    void                      UpdateMenuInstall ();
    void                      FormMenuDatabases ();
    void                      ShowPartitionProperties ();
    void                      ShowPartitionProperties (QString  part_id);
    void                      DeleteDatabase (QString  part_id);
    void                      EditDatabase (QString  part_id);
    void                      AddDatabase ();

    void                      DoDummyJobs ();
    void                      ShowSQLDrivers ();
    void                      OpenNew ();
    void                      RunJobScript ();
    void                      RunJobScript (QString  script);
    void                      RunJobScriptFromFile (QString  file_path);
    void                      CureRelatedPartitionsTable ();
    void                      ReplicatePartition ();
    void                      AbsorbAllRelatedPartitions ();
    void                      InstallSimple ();
    void                      Autocomplete ();
    void                      CreateStyles ();
//    void                      Upgrade_1_1_to_1_2 ();

  private:
    void                      ShowRA ();
    void                      CreateNavigator ();
    void                      DeleteNavigator ();
    void                      ExecuteInConsole (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*/
                                  );
    void                      DeleteConsole ();

  private: //fields
    eOpenMode                 OpenMode;
    sString                   RootURL;
    sString                   PartURL;
    eOpenMode                 ReopenMode;
    sString                   ReopenURL;
    eOpenMode                 ReopenModeOnSuccess;
    sString                   ReopenURLOnSuccess;
    psNet                     Net;
    psNet2TreeEvolution       Evolution;
    psNavigator               Navigator;
    QLabel *                  NameInfo;
    QLabel *                  ErrorStatus;
    QTimer *                  UpdatingTimer;
    sExecutionConsole *       Console;

    QAction *                 ActnNew;
    QAction *                 ActnOpen;
    QAction *                 ActnOpenPartition;
    QAction *                 ActnProperties;
    QAction *                 ActnClose;
    QAction *                 ActnExit;
    QAction *                 ActnShowHelpContents;
    QAction *                 ActnAddDatabaseLink;
    QAction *                 ActnDoDummyJobs;
    QAction *                 ActnShowSQLDrivers;
    QAction *                 ActnRunJobScript;
    QAction *                 ActnCureRelatedPartitionsTable;
    QAction *                 ActnReplicatePartition;
    QAction *                 ActnAbsorbAllRelatedPartitions;
    QAction *                 ActnInstallSimple;
    QAction *                 ActnAutocomplete;
    QAction *                 ActnCreateStyles;
//    QAction *                 ActnUpgrade_1_1_to_1_2;
    QMenu *                   MenuFile;
    QMenu *                   MenuDatabases;
    sEditScriptDialog *       JobScriptEditor;
};

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