69 lines
1.6 KiB
C++
69 lines
1.6 KiB
C++
#ifndef RKTWEBVIEW_QT_H
|
|
#define RKTWEBVIEW_QT_H
|
|
|
|
#include "rktwebview_qt_global.h"
|
|
#include "rktwebview_internal.h"
|
|
|
|
#include <QApplication>
|
|
#include <QWebEngineView>
|
|
#include <QMutex>
|
|
#include <QThread>
|
|
#include <QHash>
|
|
#include <QQueue>
|
|
#include <QTimer>
|
|
|
|
|
|
class WebViewQt;
|
|
class WebviewWindow;
|
|
class Command;
|
|
|
|
class RKTWEBVIEW_QT_EXPORT Rktwebview_qt : public QObject
|
|
{
|
|
Q_OBJECT
|
|
private:
|
|
QApplication *_app;
|
|
rktwebview_t _current_handle;
|
|
QHash<int, WebviewWindow *> _views;
|
|
|
|
QQueue<Command *> _command_queue;
|
|
QTimer _process_commands;
|
|
QTimer _quit_event_loop;
|
|
|
|
Rktwebview_qt **_handler;
|
|
|
|
int _argc;
|
|
char *_argv[1];
|
|
|
|
public slots:
|
|
void processCommands();
|
|
void interruptEventLoop();
|
|
|
|
public:
|
|
void removeView(int id);
|
|
|
|
public:
|
|
int nextHandle();
|
|
public:
|
|
int rktWebViewCreate(int parent = 0); // threadsafe
|
|
void rktWebViewClose(int wv);
|
|
void rktQuit();
|
|
|
|
void runJs(rktwebview_t wv, const char *js); // threadsafe
|
|
item_t callJs(rktwebview_t wv, const char *js); // threadsafe
|
|
|
|
void setHtml(rktwebview_t wv, const char *html); // threadsafe
|
|
void navigate(rktwebview_t wv, const char *url); // threadsafe
|
|
result_t rktSetUrl(rktwebview_t wv, const char *url);
|
|
|
|
public:
|
|
void doEvents();
|
|
|
|
public:
|
|
void runCommandThread();
|
|
|
|
public:
|
|
Rktwebview_qt(Rktwebview_qt **handler);
|
|
};
|
|
|
|
#endif // RKTWEBVIEW_QT_H
|