2016-08-25 00:45:32 +02:00
|
|
|
#ifndef WEBVIEW_DIALOG_H
|
|
|
|
#define WEBVIEW_DIALOG_H
|
|
|
|
|
2023-03-27 20:13:49 +02:00
|
|
|
#include "../global.h"
|
|
|
|
|
|
|
|
#include <syncthingconnector/syncthingconnectionsettings.h>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QString)
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QWidget)
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2023-03-27 20:13:49 +02:00
|
|
|
#ifndef SYNCTHINGWIDGETS_NO_WEBVIEW
|
|
|
|
#include "./webviewdefs.h"
|
2016-09-03 20:14:52 +02:00
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
#include <QMainWindow>
|
|
|
|
|
|
|
|
QT_FORWARD_DECLARE_CLASS(WEB_VIEW_PROVIDER)
|
2017-12-30 02:26:55 +01:00
|
|
|
QT_FORWARD_DECLARE_CLASS(QWebEngineProfile)
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
|
2017-05-01 03:34:43 +02:00
|
|
|
class SYNCTHINGWIDGETS_EXPORT WebViewDialog : public QMainWindow {
|
2016-08-25 00:45:32 +02:00
|
|
|
Q_OBJECT
|
|
|
|
public:
|
|
|
|
WebViewDialog(QWidget *parent = nullptr);
|
2018-10-10 21:26:46 +02:00
|
|
|
~WebViewDialog() override;
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2020-03-08 13:50:32 +01:00
|
|
|
public Q_SLOTS:
|
2018-10-28 14:27:25 +01:00
|
|
|
void applySettings(const Data::SyncthingConnectionSettings &connectionSettings, bool aboutToShow);
|
|
|
|
const Data::SyncthingConnectionSettings &connectionSettings() const;
|
2017-04-23 18:27:31 +02:00
|
|
|
#if defined(SYNCTHINGWIDGETS_USE_WEBKIT)
|
2016-11-16 20:40:54 +01:00
|
|
|
bool isModalVisible() const;
|
|
|
|
#endif
|
|
|
|
void closeUnlessModalVisible();
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
protected:
|
2018-10-10 21:26:46 +02:00
|
|
|
void closeEvent(QCloseEvent *event) override;
|
|
|
|
void keyPressEvent(QKeyEvent *event) override;
|
2017-04-23 18:27:31 +02:00
|
|
|
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE)
|
2018-10-10 21:26:46 +02:00
|
|
|
bool eventFilter(QObject *watched, QEvent *event) override;
|
2016-11-16 21:10:04 +01:00
|
|
|
#endif
|
2016-08-25 00:45:32 +02:00
|
|
|
|
|
|
|
private:
|
2017-04-23 18:27:31 +02:00
|
|
|
SYNCTHINGWIDGETS_WEB_VIEW *m_view;
|
2018-10-28 14:27:25 +01:00
|
|
|
Data::SyncthingConnectionSettings m_connectionSettings;
|
2017-12-30 02:26:55 +01:00
|
|
|
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE)
|
|
|
|
QWebEngineProfile *m_profile;
|
|
|
|
#endif
|
2016-08-25 00:45:32 +02:00
|
|
|
};
|
|
|
|
|
2018-10-28 14:27:25 +01:00
|
|
|
inline const Data::SyncthingConnectionSettings &WebViewDialog::connectionSettings() const
|
2016-09-03 20:14:52 +02:00
|
|
|
{
|
2018-10-28 14:27:25 +01:00
|
|
|
return m_connectionSettings;
|
2016-09-03 20:14:52 +02:00
|
|
|
}
|
2017-12-30 02:26:55 +01:00
|
|
|
|
2017-09-17 21:48:15 +02:00
|
|
|
} // namespace QtGui
|
2016-08-25 00:45:32 +02:00
|
|
|
|
2023-03-27 20:13:49 +02:00
|
|
|
#else // SYNCTHINGWIDGETS_NO_WEBVIEW
|
|
|
|
namespace QtGui {
|
|
|
|
using WebViewDialog = void;
|
|
|
|
}
|
|
|
|
|
2017-04-23 18:27:31 +02:00
|
|
|
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW
|
2023-03-27 20:13:49 +02:00
|
|
|
|
|
|
|
namespace QtGui {
|
|
|
|
SYNCTHINGWIDGETS_EXPORT WebViewDialog *showWebUI(
|
|
|
|
const QString &url, const Data::SyncthingConnectionSettings *settings, WebViewDialog *dlg = nullptr, QWidget *parent = nullptr);
|
|
|
|
}
|
|
|
|
|
2016-08-25 00:45:32 +02:00
|
|
|
#endif // WEBVIEW_DIALOG_H
|