source: ogBrowser-Git/src/mainwindow.h @ 6a08e91

jenkins
Last change on this file since 6a08e91 was 068539c, checked in by Vadim Troshchinskiy Shmelev <vtroshchinskiy@…>, 2 months ago

Add ability to ignore SSL errors

  • Property mode set to 100644
File size: 3.2 KB
RevLine 
[050d67a]1#ifndef MAINWINDOW_H
2#define MAINWINDOW_H
3
[1b0403f]4#define COMMAND "command"
5#define COMMAND_CONFIRM "command+confirm"
6#define COMMAND_WITH_CONFIRMATION "commandwithconfirmation"  // Backwards compatibility
7#define COMMAND_OUTPUT "command+output"
8#define COMMAND_CONFIRM_OUTPUT "command+confirm+output"
9#define COMMAND_OUTPUT_CONFIRM "command+output+confirm"
[e9b8eab]10#define ENVIRONMENT "OGLOGFILE,ogactiveadmin,DEFAULTSPEED"
[050d67a]11
[dae65b7]12
[050d67a]13#include <QWidget>
14#include <QProcess>
15#include <QMap>
16#include <QMainWindow>
[2518513]17#include <QNetworkReply>
18#include <QSslError>
[07ea3f8]19#include <QProgressBar>
20#include <QLabel>
21#include <QLineEdit>
22#include <QTextEdit>
23#include <QFile>
24#include <QWebEngineView>
25#include <QVector>
26
27
[099ac5d]28#include "digitalclock.h"
[050d67a]29
[07ea3f8]30
31
32struct PendingCommand {
33    QString command = "";
34    bool confirm = false;
35    bool returnOutput = false;
36
37    QProcess *process = nullptr;
38
39    bool operator==(const PendingCommand &other) {
40        return other.process == process;
41    }
42};
43
[050d67a]44
45class MainWindow : public QMainWindow
46{
47    Q_OBJECT
48
49    public:
50        MainWindow(QWidget *parent = 0);
[cad017d]51        void closeEvent(QCloseEvent *event) override;
52
[050d67a]53        ~MainWindow();
54
55    public slots:
56        // Funcion que maneja los links
57        void slotWebLoadStarted();
58        void slotWebLoadFinished(bool ok);
59        void slotWebLoadProgress(int progress);
[59c8a0f]60        void slotSslErrors(QNetworkReply* reply);
[068539c]61        void slotCertificateErrors(const QWebEngineCertificateError &certificateError);
62
[050d67a]63
64        // Funciones que manejan cada vez que el proceso hace algo
65        void slotProcessStarted();
66        void slotProcessFinished(int code,QProcess::ExitStatus status);
67        void slotProcessError(QProcess::ProcessError error);
68        void slotProcessOutput();
69        void slotProcessErrorOutput();
70
[55d467e]71        // Funcion para crear terminales
72        void slotCreateTerminal();
[2e2ba31]73        void slotDeleteTerminal();
74
75        // Funcion para el webar
76        void slotUrlChanged(const QUrl &url);
[55d467e]77
[07ea3f8]78        void commandQueued(const QString &command, bool confirm, bool returnOutput);
79
80
81    private:
82        bool isAdmin() const { return m_is_admin; }
[cad017d]83        bool isKioskMode() const { return m_kiosk_mode; }
[d9df909]84        void registerScheme(const QString &name);
[476581b]85        void registerHandler(const QString &name, bool confirm, bool output, const QString baseCommand = "");
[07ea3f8]86
87        bool m_is_admin{false};
[cad017d]88        bool m_kiosk_mode{false};
[07ea3f8]89
90
[050d67a]91    //Functions
92    protected:
93        int readEnvironmentValues();
[0b5cc5a]94        void print(QString s);
[1b0403f]95        void write(QString s);
[9d8d163]96        void captureOutputForStatusBar(QString output);
97        void startProgressBar();
98        void finishProgressBar();
[9d6a1e3]99        void executeCommand(QString &string);
[c646cde]100        QString readSpeed();
[75617e0]101        void showErrorMessage(QString string);
[050d67a]102
103    protected:
[dae65b7]104        QWebEngineView *m_web;
[b93c220]105        QTextEdit *m_output;
[c646cde]106        QLabel *m_logo;
[b93c220]107        QProgressBar *m_progressBar;
[c646cde]108        QLabel *m_speedInfo;
[099ac5d]109        DigitalClock *m_clock;
[b93c220]110        QTabWidget *m_tabs;
111        QLineEdit *m_webBar;
[050d67a]112
[07ea3f8]113        //QProcess *m_process;
[050d67a]114
[b93c220]115        QMap<QString,QString> m_env;
116        QFile *m_logfile;
117        QTextStream *m_logstream;
[55d467e]118
[07ea3f8]119        PendingCommand m_command;
120        //QVector<PendingCommand> m_commands;
121
122
[b93c220]123        int m_numberTerminal;
[050d67a]124};
125
126#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.