syncthingtray/syncthingwidgets/webview/webviewdialog.h

70 lines
1.8 KiB
C
Raw Normal View History

2016-08-25 00:45:32 +02:00
#ifndef WEBVIEW_DIALOG_H
#define WEBVIEW_DIALOG_H
#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
#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)
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:
void applySettings(const Data::SyncthingConnectionSettings &connectionSettings, bool aboutToShow);
const Data::SyncthingConnectionSettings &connectionSettings() const;
#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;
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE)
2018-10-10 21:26:46 +02:00
bool eventFilter(QObject *watched, QEvent *event) override;
#endif
2016-08-25 00:45:32 +02:00
private:
SYNCTHINGWIDGETS_WEB_VIEW *m_view;
Data::SyncthingConnectionSettings m_connectionSettings;
#if defined(SYNCTHINGWIDGETS_USE_WEBENGINE)
QWebEngineProfile *m_profile;
#endif
2016-08-25 00:45:32 +02:00
};
inline const Data::SyncthingConnectionSettings &WebViewDialog::connectionSettings() const
2016-09-03 20:14:52 +02:00
{
return m_connectionSettings;
2016-09-03 20:14:52 +02:00
}
} // namespace QtGui
2016-08-25 00:45:32 +02:00
#else // SYNCTHINGWIDGETS_NO_WEBVIEW
namespace QtGui {
using WebViewDialog = void;
}
#endif // SYNCTHINGWIDGETS_NO_WEBVIEW
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