28 Commits

Author SHA1 Message Date
hans 85b5a29192 handle tray menu myself instead by tray icon 2026-04-30 13:42:57 +02:00
hans b53597396c trying to clear the context menu, but that does not work 2026-04-30 11:53:08 +02:00
hans be980dbffd tray 2026-04-29 23:35:40 +02:00
hans 8165ee20cc Adding a tray icon. 2026-04-29 14:33:43 +02:00
hans cacffbcc2a synchronization on finalization finally solved. 2026-04-20 19:07:03 +02:00
hans b4a4b2f554 mutex implemented for callback to racket.
Needs to be serialized and protected.
2026-04-20 18:31:21 +02:00
hans 2b107f8f73 Finalization & synchronization. Making sure racket does not get stuck on a mutex. 2026-04-20 18:19:58 +02:00
hans 490b89be38 Ja. 2026-04-20 14:01:20 +02:00
hans 2c57eb2ebf More robust cleanup handling 2026-04-20 09:52:48 +02:00
hans 06d2cdb68f finalizing 2026-04-19 21:19:37 +02:00
hans 431ba3dffa finalizer 2026-04-18 17:03:53 +02:00
hans 0786a8eb0e init with function name 2026-04-18 16:54:32 +02:00
hans debda73068 webview-exit 2026-04-18 16:43:19 +02:00
hans ce72177973 events on quit 2026-04-18 16:31:12 +02:00
hans 5214b9f925 Another attempt on quitting cleanly 2026-04-18 15:50:41 +02:00
hans f37e89d956 racket webview qt finalizer next 2026-04-18 15:32:15 +02:00
hans 89b084a6a7 Making sure no warnings are printed (except for getenv) on windows. 2026-04-17 13:58:28 +02:00
hans ee33c72915 small adjustments, many enhancements to rktplayer 2026-04-16 22:22:25 +02:00
hans 59c316a1f0 alive ack implemented and stopping 2026-04-11 16:27:45 +02:00
hans e9e295c3bc alive_ack_queue implemented 2026-04-11 16:10:39 +02:00
hans 52aa0cac10 Alive thread implemented 2026-04-11 09:50:59 +02:00
hans 8e5381fda2 Added callback for events. 2026-04-10 23:49:29 +02:00
hans 82f58bc24b Events for racket-webview-qt 2026-04-10 22:07:03 +02:00
hans ef3883ed15 threading / event callback 2026-04-10 10:16:13 +02:00
hans 79d18bdd5d - 2026-04-09 10:42:36 +02:00
hans 7468a16d63 icon 2026-04-08 16:39:23 +02:00
hans a5378e32b9 - 2026-04-07 13:42:21 +02:00
hans 8ab8cb5335 - 2026-04-07 11:18:15 +02:00
145 changed files with 1311 additions and 152 deletions
+2
View File
@@ -73,3 +73,5 @@ CMakeLists.txt.user*
*.exe
build
lib/linux-x86_64
lib/*.zip
+5
View File
@@ -23,6 +23,7 @@ add_library(rktwebview SHARED
json.cpp json.h
utils.h
utils.cpp
memqueue.h memqueue.cpp
)
add_executable(rktwebview_prg
@@ -42,6 +43,9 @@ add_executable(rktwebview_prg
rkt_protocol.h
rktwebview_types.h
utils.cpp utils.h
build_menu_from_json.cpp
build_menu_from_json.h
)
add_executable(rktwebview_test
@@ -52,6 +56,7 @@ target_link_libraries(rktwebview_prg PRIVATE Qt${QT_VERSION_MAJOR}::Widgets)
target_link_libraries(rktwebview_prg PRIVATE Qt${QT_VERSION_MAJOR}::WebEngineWidgets)
target_compile_definitions(rktwebview PRIVATE RKTWEBVIEW_LIBRARY)
target_compile_definitions(rktwebview_prg PRIVATE RKTWEBVIEW_PRG_EXE)
target_link_Libraries(rktwebview_test PRIVATE rktwebview)
+99
View File
@@ -0,0 +1,99 @@
#include <QJsonArray>
#include <QJsonParseError>
#include <QJsonObject>
#include <QMenu>
#include "rktwebview_qt.h"
#include "utils.h"
static QAction *addMenuItemFromJson(Rktwebview_qt *owner,
QMenu *menu,
const QJsonObject &item,
int source_handle);
static QMenu *buildMenuObjectFromJson(Rktwebview_qt *owner,
const QJsonArray &items,
int source_handle,
QWidget *parent = nullptr)
{
QMenu *menu = new QMenu(parent);
for (const QJsonValue &v : items) {
if (!v.isObject()) {
continue;
}
QJsonObject item = v.toObject();
if (item.value("separator").toBool(false)) {
menu->addSeparator();
continue;
}
addMenuItemFromJson(owner, menu, item, source_handle);
}
return menu;
}
static QAction *addMenuItemFromJson(Rktwebview_qt *owner,
QMenu *menu,
const QJsonObject &item,
int source_handle)
{
QString id = item.value("id").toString();
QString name = item.value("name").toString();
QString icon_file = item.value("icon").toString();
QAction *action = nullptr;
QJsonValue submenu_value = item.value("submenu");
if (submenu_value.isObject()) {
QJsonObject submenu_obj = submenu_value.toObject();
QJsonArray submenu_items = submenu_obj.value("menu").toArray();
QMenu *submenu = buildMenuObjectFromJson(owner,
submenu_items,
source_handle,
menu);
if (!icon_file.isEmpty()) {
submenu->setIcon(QIcon(icon_file));
}
submenu->setTitle(name);
action = menu->addMenu(submenu);
} else {
if (icon_file.isEmpty()) {
action = menu->addAction(name);
} else {
action = menu->addAction(QIcon(icon_file), name);
}
QObject::connect(action, &QAction::triggered,
owner, [owner, source_handle, id]() {
EventContainer e("tray-menu-item-chosen");
e["id"] = id;
e["menu_item"] = id;
owner->triggerEvent(source_handle, e);
});
}
action->setData(id);
return action;
}
QMenu *buildMenuFromJson(Rktwebview_qt *self, const QString &menu_json, int source_handle)
{
QJsonParseError err;
QJsonDocument doc = QJsonDocument::fromJson(menu_json.toUtf8(), &err);
if (err.error != QJsonParseError::NoError || !doc.isObject()) {
ERROR2("Json parse error for menu: %d, '%s'\n", err.error, err.errorString().toUtf8().constData());
return nullptr;
}
QJsonObject root = doc.object();
QJsonArray items = root.value("menu").toArray();
return buildMenuObjectFromJson(self, items, source_handle);
}
+10
View File
@@ -0,0 +1,10 @@
#ifndef BUILD_MENU_FROM_JSON_H
#define BUILD_MENU_FROM_JSON_H
class QMenu;
class Rktwebview_qt;
class QString;
QMenu *buildMenuFromJson(Rktwebview_qt *self, const QString &menu_json, int source_handle);
#endif // BUILD_MENU_FROM_JSON_H
+6
View File
@@ -28,6 +28,12 @@
#define COMMAND_SET_OU_TOKEN 22
#define COMMAND_NEW_CONTEXT 23
#define COMMAND_MESSAGE 24
#define COMMAND_SET_ICON 25
#define COMMAND_CREATE_TRAY 26
#define COMMAND_TRAY_SET_ICON 27
#define COMMAND_TRAY_SET_TOOLTIP 28
#define COMMAND_TRAY_SHOW_MESSAGE 29
#define COMMAND_TRAY_SET_MENU 30
class Command
{
+10 -5
View File
@@ -2,20 +2,21 @@
#
ARCH=`uname -m`
LIB="lib/linux/$ARCH"
LIB="../lib/linux-$ARCH"
BUILD="../build/Release"
mkdir -p $LIB
rm -f $LIB/*.so*
cp build/Release/*.so $LIB
cp build/Release/rktwebview_prg $LIB
cp $BUILD/*.so $LIB
cp $BUILD/rktwebview_prg $LIB
QT_PATH=`ldd build/Release/rktwebview_prg | grep Qt | awk '{print $3}' | head -1 | sed -e 's%[/]lib[/].*%%'`
QT_PATH=`ldd $BUILD/rktwebview_prg | grep Qt | awk '{print $3}' | head -1 | sed -e 's%[/]lib[/].*%%'`
echo "QT_PATH=$QT_PATH"
QT_PLUGINS="$QT_PATH/plugins"
PLUGINS="platforms position generic iconengines imageformats qmltooling tls xcbglintegrations"
EXTRA_LIBS_SO=`ldd build/Release/rktwebview_prg | grep Qt | awk '{ print $3 }'`
EXTRA_LIBS_SO=`ldd $BUILD/rktwebview_prg | grep Qt | awk '{ print $3 }'`
EXTRA_LIBS_PLATFORM_PLUGIN_XCB=`ldd $QT_PATH/plugins/platforms/libqxcb.so | grep Qt | awk '{print $3}'`
for pl in $PLUGINS
@@ -63,4 +64,8 @@ done
cp $QT_PATH/libexec/QtWebEngineProcess $LIB
(cd $LIB; cd ..; zip -9 -y -r linux-$ARCH.zip linux-$ARCH)
+3 -3
View File
@@ -92,7 +92,7 @@ const JSON &JSON::at(unsigned int index) const {
int JSON::length() const {
if( Type == Class::Array )
return Internal.List->size();
return static_cast<int>(Internal.List->size());
else
return -1;
}
@@ -105,9 +105,9 @@ bool JSON::hasKey(const std::string &key) const {
int JSON::size() const {
if( Type == Class::Object )
return Internal.Map->size();
return static_cast<int>(Internal.Map->size());
else if( Type == Class::Array )
return Internal.List->size();
return static_cast<int>(Internal.List->size());
else
return -1;
}
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,48 +0,0 @@
[
{
"name": "qtbase",
"repositories": ["qtbase", "qtactiveqt", "qtimageformats"]
},
{
"name": "qtdeclarative",
"repositories": ["qtdeclarative"]
},
{
"name": "qtmultimedia",
"repositories": ["qtmultimedia"]
},
{
"name": "qtconnectivity",
"repositories": ["qtconnectivity"]
},
{
"name": "qtlocation",
"repositories": ["qtlocation"]
},
{
"name": "qtwebsockets",
"repositories": ["qtwebsockets"]
},
{
"name": "qtserialport",
"repositories": ["qtserialport"]
},
{
"name": "qtwebengine",
"repositories": ["qtwebengine"]
},
{
"name": "designer",
"modules": ["Designer"]
},
{
"name": "linguist"
},
{
"name": "assistant"
},
{
"name": "qt_help",
"modules": ["Help"]
}
]
Binary file not shown.

Some files were not shown because too many files have changed in this diff Show More