[07ea3f8] | 1 | #pragma once |
---|
| 2 | |
---|
| 3 | #include <QWebEngineUrlSchemeHandler> |
---|
| 4 | #include <QObject> |
---|
| 5 | |
---|
| 6 | #define COMMAND "command" |
---|
| 7 | #define COMMAND_CONFIRM "command+confirm" |
---|
| 8 | #define COMMAND_WITH_CONFIRMATION "commandwithconfirmation" // Backwards compatibility |
---|
| 9 | #define COMMAND_OUTPUT "command+output" |
---|
| 10 | #define COMMAND_CONFIRM_OUTPUT "command+confirm+output" |
---|
| 11 | #define COMMAND_OUTPUT_CONFIRM "command+output+confirm" |
---|
| 12 | #define ENVIRONMENT "OGLOGFILE,ogactiveadmin,DEFAULTSPEED" |
---|
| 13 | |
---|
| 14 | class OGBrowserUrlHandlerCommand : public QWebEngineUrlSchemeHandler { |
---|
| 15 | Q_OBJECT |
---|
| 16 | public: |
---|
| 17 | |
---|
| 18 | OGBrowserUrlHandlerCommand(QObject *parent = nullptr) : QWebEngineUrlSchemeHandler(parent) { |
---|
| 19 | |
---|
| 20 | }; |
---|
| 21 | |
---|
| 22 | virtual ~OGBrowserUrlHandlerCommand() { |
---|
| 23 | |
---|
| 24 | }; |
---|
| 25 | |
---|
| 26 | virtual void requestStarted(QWebEngineUrlRequestJob *job); |
---|
| 27 | |
---|
[476581b] | 28 | bool askConfirmation() const { return m_ask_confirmation; } |
---|
[07ea3f8] | 29 | void setAskConfirmation(const bool ask) { m_ask_confirmation = ask; } |
---|
[476581b] | 30 | |
---|
| 31 | bool returnOuput() const { return m_return_output; } |
---|
[07ea3f8] | 32 | void setReturnOutput(const bool retOutput) { m_return_output = retOutput; } |
---|
| 33 | |
---|
[476581b] | 34 | QString baseCommand() const { return m_base_command; } |
---|
| 35 | void setBaseCommand(const QString &cmd) { m_base_command = cmd; } |
---|
| 36 | |
---|
| 37 | void setScheme(const QString &scheme) { m_scheme = scheme; } |
---|
| 38 | const QString getScheme() const { return m_scheme; } |
---|
| 39 | |
---|
[07ea3f8] | 40 | signals: |
---|
| 41 | void command(const QString &command, bool confirm, bool returnOutput); |
---|
| 42 | |
---|
| 43 | |
---|
| 44 | private: |
---|
| 45 | |
---|
| 46 | bool m_ask_confirmation = false; |
---|
| 47 | bool m_return_output = false; |
---|
[476581b] | 48 | QString m_scheme = ""; |
---|
| 49 | QString m_base_command = ""; |
---|
[07ea3f8] | 50 | |
---|
| 51 | }; |
---|
| 52 | |
---|
| 53 | |
---|