source: ogBrowser-Git/src/mainwindow.h @ 9c6539c

jenkinsmain
Last change on this file since 9c6539c was 476581b, checked in by Vadim Troshchinskiy Shmelev <vtroshchinskiy@…>, 16 months ago

Add desktop file parser

  • Property mode set to 100644
File size: 3.1 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);
[050d67a]61
62        // Funciones que manejan cada vez que el proceso hace algo
63        void slotProcessStarted();
64        void slotProcessFinished(int code,QProcess::ExitStatus status);
65        void slotProcessError(QProcess::ProcessError error);
66        void slotProcessOutput();
67        void slotProcessErrorOutput();
68
[55d467e]69        // Funcion para crear terminales
70        void slotCreateTerminal();
[2e2ba31]71        void slotDeleteTerminal();
72
73        // Funcion para el webar
74        void slotUrlChanged(const QUrl &url);
[55d467e]75
[07ea3f8]76        void commandQueued(const QString &command, bool confirm, bool returnOutput);
77
78
79    private:
80        bool isAdmin() const { return m_is_admin; }
[cad017d]81        bool isKioskMode() const { return m_kiosk_mode; }
[d9df909]82        void registerScheme(const QString &name);
[476581b]83        void registerHandler(const QString &name, bool confirm, bool output, const QString baseCommand = "");
[07ea3f8]84
85        bool m_is_admin{false};
[cad017d]86        bool m_kiosk_mode{false};
[07ea3f8]87
88
[050d67a]89    //Functions
90    protected:
91        int readEnvironmentValues();
[0b5cc5a]92        void print(QString s);
[1b0403f]93        void write(QString s);
[9d8d163]94        void captureOutputForStatusBar(QString output);
95        void startProgressBar();
96        void finishProgressBar();
[9d6a1e3]97        void executeCommand(QString &string);
[c646cde]98        QString readSpeed();
[75617e0]99        void showErrorMessage(QString string);
[050d67a]100
101    protected:
[dae65b7]102        QWebEngineView *m_web;
[b93c220]103        QTextEdit *m_output;
[c646cde]104        QLabel *m_logo;
[b93c220]105        QProgressBar *m_progressBar;
[c646cde]106        QLabel *m_speedInfo;
[099ac5d]107        DigitalClock *m_clock;
[b93c220]108        QTabWidget *m_tabs;
109        QLineEdit *m_webBar;
[050d67a]110
[07ea3f8]111        //QProcess *m_process;
[050d67a]112
[b93c220]113        QMap<QString,QString> m_env;
114        QFile *m_logfile;
115        QTextStream *m_logstream;
[55d467e]116
[07ea3f8]117        PendingCommand m_command;
118        //QVector<PendingCommand> m_commands;
119
120
[b93c220]121        int m_numberTerminal;
[050d67a]122};
123
124#endif // MAINWINDOW_H
Note: See TracBrowser for help on using the repository browser.