Add server dashboard
This commit is contained in:
@@ -25,7 +25,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: >
|
run: >
|
||||||
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev
|
sudo apt-get update && sudo apt-get install libvulkan-dev libcjson-dev libx264-dev libavcodec-dev libavutil-dev libswscale-dev libavfilter-dev libbsd-dev libavahi-client-dev libavahi-glib-dev libeigen3-dev glslang-tools libudev-dev libwayland-dev libx11-xcb-dev libxrandr-dev libxcb-randr0-dev libgl-dev libglx-dev mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev libsystemd-dev libva-dev nlohmann-json3-dev libpulse-dev xz-utils libpipewire-0.3-dev libcli11-dev qt6-base-dev qt6-tools-dev
|
||||||
- name: Prepare Vulkan SDK
|
- name: Prepare Vulkan SDK
|
||||||
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
uses: humbletim/setup-vulkan-sdk@286ed76c72de45dbf50c515779cf4ca2f6aa3944
|
||||||
with:
|
with:
|
||||||
@@ -41,6 +41,7 @@ jobs:
|
|||||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr
|
-DCMAKE_INSTALL_PREFIX=/usr
|
||||||
-DWIVRN_BUILD_SERVER=ON
|
-DWIVRN_BUILD_SERVER=ON
|
||||||
|
-DWIVRN_BUILD_DASHBOARD=ON
|
||||||
-DWIVRN_BUILD_CLIENT=OFF
|
-DWIVRN_BUILD_CLIENT=OFF
|
||||||
-DWIVRN_BUILD_DISSECTOR=OFF
|
-DWIVRN_BUILD_DISSECTOR=OFF
|
||||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
||||||
@@ -128,6 +129,7 @@ jobs:
|
|||||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr
|
-DCMAKE_INSTALL_PREFIX=/usr
|
||||||
-DWIVRN_BUILD_SERVER=OFF
|
-DWIVRN_BUILD_SERVER=OFF
|
||||||
|
-DWIVRN_BUILD_DASHBOARD=OFF
|
||||||
-DWIVRN_BUILD_CLIENT=ON
|
-DWIVRN_BUILD_CLIENT=ON
|
||||||
-DWIVRN_BUILD_DISSECTOR=OFF
|
-DWIVRN_BUILD_DISSECTOR=OFF
|
||||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
||||||
@@ -163,6 +165,7 @@ jobs:
|
|||||||
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
-DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
|
||||||
-DCMAKE_INSTALL_PREFIX=/usr
|
-DCMAKE_INSTALL_PREFIX=/usr
|
||||||
-DWIVRN_BUILD_SERVER=OFF
|
-DWIVRN_BUILD_SERVER=OFF
|
||||||
|
-DWIVRN_BUILD_DASHBOARD=OFF
|
||||||
-DWIVRN_BUILD_CLIENT=OFF
|
-DWIVRN_BUILD_CLIENT=OFF
|
||||||
-DWIVRN_BUILD_DISSECTOR=ON
|
-DWIVRN_BUILD_DISSECTOR=ON
|
||||||
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION=ON
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ jobs:
|
|||||||
path:
|
path:
|
||||||
- 'client'
|
- 'client'
|
||||||
- 'server'
|
- 'server'
|
||||||
|
- 'dashboard'
|
||||||
- 'common'
|
- 'common'
|
||||||
- 'tools/wireshark'
|
- 'tools/wireshark'
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
+16
-1
@@ -26,6 +26,7 @@ auto_option(WIVRN_USE_SYSTEMD "Use libsystemd" AUTO)
|
|||||||
option(WIVRN_USE_ANDROID_VALIDATION_LAYER "Download the android version of the Vulkan validation layer" OFF)
|
option(WIVRN_USE_ANDROID_VALIDATION_LAYER "Download the android version of the Vulkan validation layer" OFF)
|
||||||
option(WIVRN_BUILD_CLIENT "Build WiVRn client" OFF)
|
option(WIVRN_BUILD_CLIENT "Build WiVRn client" OFF)
|
||||||
option(WIVRN_BUILD_SERVER "Build WiVRn server" ON)
|
option(WIVRN_BUILD_SERVER "Build WiVRn server" ON)
|
||||||
|
option(WIVRN_BUILD_DASHBOARD "Build WiVRn dashboard" ON)
|
||||||
option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF)
|
option(WIVRN_BUILD_DISSECTOR "Build Wireshark dissector" OFF)
|
||||||
option(WIVRN_WERROR "Treat warnings as errors" OFF)
|
option(WIVRN_WERROR "Treat warnings as errors" OFF)
|
||||||
|
|
||||||
@@ -43,6 +44,8 @@ option(WIVRN_OPENXR_INSTALL_ABSOLUTE_RUNTIME_PATH OFF)
|
|||||||
|
|
||||||
option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON)
|
option(ENABLE_COLOURED_OUTPUT "Always produce ANSI-coloured output (GNU/Clang only)." ON)
|
||||||
|
|
||||||
|
set(WIVRN_CLIENT_URL "https://github.com/WiVRn/WiVRn/releases/latest/download/WiVRn-standard-release.apk" CACHE STRING "URL used to download the client in the GUI")
|
||||||
|
|
||||||
if(ENABLE_COLOURED_OUTPUT)
|
if(ENABLE_COLOURED_OUTPUT)
|
||||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||||
add_compile_options(-fdiagnostics-color=always)
|
add_compile_options(-fdiagnostics-color=always)
|
||||||
@@ -144,6 +147,13 @@ if (WIVRN_BUILD_SERVER)
|
|||||||
pkg_check_modules(glib2 REQUIRED IMPORTED_TARGET glib-2.0 gio-2.0 gio-unix-2.0)
|
pkg_check_modules(glib2 REQUIRED IMPORTED_TARGET glib-2.0 gio-2.0 gio-unix-2.0)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WIVRN_BUILD_DASHBOARD)
|
||||||
|
find_package(Qt6 REQUIRED COMPONENTS Core Gui Widgets DBus Network LinguistTools)
|
||||||
|
set(CMAKE_AUTOMOC ON)
|
||||||
|
set(CMAKE_AUTORCC ON)
|
||||||
|
set(CMAKE_AUTOUIC ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
if (WIVRN_BUILD_CLIENT AND NOT ANDROID)
|
if (WIVRN_BUILD_CLIENT AND NOT ANDROID)
|
||||||
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
pkg_check_modules(LIBAV REQUIRED IMPORTED_TARGET libavcodec libavutil libswscale libavfilter)
|
||||||
find_package(Fontconfig REQUIRED)
|
find_package(Fontconfig REQUIRED)
|
||||||
@@ -219,9 +229,14 @@ if (WIVRN_BUILD_SERVER)
|
|||||||
message("\tsystemd: ${WIVRN_USE_SYSTEMD}")
|
message("\tsystemd: ${WIVRN_USE_SYSTEMD}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (WIVRN_BUILD_DASHBOARD)
|
||||||
|
add_subdirectory(dashboard)
|
||||||
|
set_target_properties(wivrn-dashboard PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/server)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_subdirectory(tools)
|
add_subdirectory(tools)
|
||||||
|
|
||||||
foreach(TARGET_NAME wivrn wivrn-server wivrn-common wivrn-dissector)
|
foreach(TARGET_NAME wivrn wivrn-server wivrn-dashboard wivrn-common wivrn-dissector)
|
||||||
if(TARGET ${TARGET_NAME})
|
if(TARGET ${TARGET_NAME})
|
||||||
target_compile_options(${TARGET_NAME} PRIVATE
|
target_compile_options(${TARGET_NAME} PRIVATE
|
||||||
-fdiagnostics-color -Wall -Wextra -pedantic
|
-fdiagnostics-color -Wall -Wextra -pedantic
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ android {
|
|||||||
'-DWIVRN_USE_SYSTEM_FREETYPE=OFF',
|
'-DWIVRN_USE_SYSTEM_FREETYPE=OFF',
|
||||||
'-DWIVRN_BUILD_CLIENT=ON',
|
'-DWIVRN_BUILD_CLIENT=ON',
|
||||||
'-DWIVRN_BUILD_SERVER=OFF',
|
'-DWIVRN_BUILD_SERVER=OFF',
|
||||||
|
'-DWIVRN_BUILD_DASHBOARD=OFF',
|
||||||
'-DWIVRN_WERROR=ON'
|
'-DWIVRN_WERROR=ON'
|
||||||
resValue "string", "app_name", "WiVRn"
|
resValue "string", "app_name", "WiVRn"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
qt_add_executable(wivrn-dashboard
|
||||||
|
main.cpp
|
||||||
|
main_window.cpp
|
||||||
|
main_window.h
|
||||||
|
main_window.ui
|
||||||
|
settings.cpp
|
||||||
|
settings.h
|
||||||
|
settings.ui
|
||||||
|
wivrn_server.cpp
|
||||||
|
wivrn_server.h
|
||||||
|
wizard.cpp
|
||||||
|
wizard.h
|
||||||
|
wizard.ui
|
||||||
|
rectangle_partitionner.cpp
|
||||||
|
rectangle_partitionner.h
|
||||||
|
../wivrn-dashboard.qrc
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/../common/version.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set_source_files_properties(${CMAKE_CURRENT_SOURCE_DIR}/../dbus/io.github.wivrn.Server.xml PROPERTIES INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/wivrn_qdbus_types.h")
|
||||||
|
qt_add_dbus_interface(DBUS_INTERFACE_SRC ${CMAKE_CURRENT_SOURCE_DIR}/../dbus/io.github.wivrn.Server.xml wivrn_server_dbus)
|
||||||
|
target_sources(wivrn-dashboard PRIVATE ${DBUS_INTERFACE_SRC})
|
||||||
|
|
||||||
|
target_compile_features(wivrn-dashboard PRIVATE cxx_std_20)
|
||||||
|
target_include_directories(wivrn-dashboard PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
|
||||||
|
configure_file(gui_config.h.in gui_config.h)
|
||||||
|
|
||||||
|
target_link_libraries(wivrn-dashboard PRIVATE
|
||||||
|
wivrn-common
|
||||||
|
Qt6::Core
|
||||||
|
Qt6::Gui
|
||||||
|
Qt6::Widgets
|
||||||
|
Qt6::DBus
|
||||||
|
Qt6::Network
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB TRANSLATION_FILES ${CMAKE_CURRENT_SOURCE_DIR}/wivrn_*.ts)
|
||||||
|
qt_add_translations(wivrn-dashboard TS_FILES ${TRANSLATION_FILES})
|
||||||
|
|
||||||
|
install(TARGETS wivrn-dashboard)
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
* Copyright (C) 2024 Patrick Nicolas <patricknicolas@laposte.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#define WIVRN_CLIENT_URL "@WIVRN_CLIENT_URL@"
|
||||||
|
|
||||||
|
#define WORKAROUND_QTBUG_90005 // See https://bugreports.qt.io/browse/QTBUG-90005
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <QApplication>
|
||||||
|
#include <QFile>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QTranslator>
|
||||||
|
|
||||||
|
#include "main_window.h"
|
||||||
|
#include "wizard.h"
|
||||||
|
|
||||||
|
namespace xrt::drivers::wivrn
|
||||||
|
{
|
||||||
|
extern const char git_version[];
|
||||||
|
}
|
||||||
|
|
||||||
|
int main(int argc, char * argv[])
|
||||||
|
{
|
||||||
|
QApplication app(argc, argv);
|
||||||
|
|
||||||
|
app.setApplicationName("wivrn-dashboard");
|
||||||
|
app.setOrganizationName("wivrn");
|
||||||
|
app.setApplicationVersion(xrt::drivers::wivrn::git_version);
|
||||||
|
app.setDesktopFileName("io.github.wivrn.wivrn");
|
||||||
|
|
||||||
|
QTranslator translator;
|
||||||
|
|
||||||
|
QLocale locale = QLocale::system();
|
||||||
|
if (translator.load(locale, "wivrn", "_", ":/i18n"))
|
||||||
|
{
|
||||||
|
qDebug() << "Adding translator for " << locale;
|
||||||
|
app.installTranslator(&translator);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
qDebug() << "Cannot add translator for " << locale;
|
||||||
|
}
|
||||||
|
|
||||||
|
app.setApplicationDisplayName(QObject::tr("WiVRn dashboard"));
|
||||||
|
|
||||||
|
std::unique_ptr<wizard> wizard_window;
|
||||||
|
|
||||||
|
// The main window is created before QWizard::finished so that the
|
||||||
|
// server is started in the wizard
|
||||||
|
auto main = std::make_unique<main_window>();
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
if (settings.value("first_run", true).toBool())
|
||||||
|
{
|
||||||
|
wizard_window.reset(new wizard);
|
||||||
|
wizard_window->show();
|
||||||
|
|
||||||
|
QObject::connect(wizard_window.get(), &QWizard::finished, [&](int value) {
|
||||||
|
settings.setValue("first_run", false);
|
||||||
|
|
||||||
|
wizard_window.release()->deleteLater();
|
||||||
|
main->show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
main->show();
|
||||||
|
}
|
||||||
|
|
||||||
|
return app.exec();
|
||||||
|
}
|
||||||
@@ -0,0 +1,539 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "main_window.h"
|
||||||
|
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QCloseEvent>
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDBusConnection>
|
||||||
|
#include <QEvent>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
#include "exit_codes.h"
|
||||||
|
#include "settings.h"
|
||||||
|
#include "ui_main_window.h"
|
||||||
|
#include "wivrn_server.h"
|
||||||
|
#include "wizard.h"
|
||||||
|
|
||||||
|
#include "gui_config.h"
|
||||||
|
|
||||||
|
Q_LOGGING_CATEGORY(wivrn_log_category, "wivrn")
|
||||||
|
|
||||||
|
enum class server_state
|
||||||
|
{
|
||||||
|
stopped = 0,
|
||||||
|
started = 1
|
||||||
|
};
|
||||||
|
|
||||||
|
main_window::main_window()
|
||||||
|
{
|
||||||
|
ui = new Ui::MainWindow;
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
if (QSystemTrayIcon::isSystemTrayAvailable())
|
||||||
|
{
|
||||||
|
action_show.setIcon(QIcon::fromTheme("settings-configure"));
|
||||||
|
action_hide.setIcon(QIcon::fromTheme("settings-configure"));
|
||||||
|
action_exit.setIcon(QIcon::fromTheme("application-exit"));
|
||||||
|
|
||||||
|
systray_menu.addAction(&action_show);
|
||||||
|
systray_menu.addAction(&action_hide);
|
||||||
|
systray_menu.addAction(&action_exit);
|
||||||
|
|
||||||
|
systray.setToolTip("WiVRn");
|
||||||
|
systray.setContextMenu(&systray_menu);
|
||||||
|
systray.show();
|
||||||
|
|
||||||
|
connect(&action_show, &QAction::triggered, this, &QMainWindow::show);
|
||||||
|
connect(&action_hide, &QAction::triggered, this, &QMainWindow::hide);
|
||||||
|
connect(&action_exit, &QAction::triggered, this, [&]() { QApplication::quit(); });
|
||||||
|
|
||||||
|
connect(&systray, &QSystemTrayIcon::activated, this, [&](QSystemTrayIcon::ActivationReason reason) {
|
||||||
|
switch (reason)
|
||||||
|
{
|
||||||
|
case QSystemTrayIcon::ActivationReason::Trigger:
|
||||||
|
setVisible(!isVisible());
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
server_process_timeout = new QTimer;
|
||||||
|
server_process_timeout->setInterval(std::chrono::seconds(1));
|
||||||
|
server_process_timeout->setSingleShot(true);
|
||||||
|
connect(server_process_timeout, &QTimer::timeout, this, &main_window::on_server_start_timeout);
|
||||||
|
|
||||||
|
server_interface = new wivrn_server(this);
|
||||||
|
|
||||||
|
connect(server_interface, &wivrn_server::serverRunningChanged, this, &main_window::on_server_running_changed);
|
||||||
|
connect(server_interface, &wivrn_server::headsetConnectedChanged, this, &main_window::on_headset_connected_changed);
|
||||||
|
|
||||||
|
if (server_interface->isServerRunning())
|
||||||
|
on_server_dbus_registered();
|
||||||
|
else
|
||||||
|
start_server();
|
||||||
|
|
||||||
|
connect(server_interface, &wivrn_server::recommendedEyeSizeChanged, this, &main_window::on_recommended_eye_size_changed);
|
||||||
|
connect(server_interface, &wivrn_server::availableRefreshRatesChanged, this, &main_window::on_available_refresh_rates_changed);
|
||||||
|
connect(server_interface, &wivrn_server::preferredRefreshRateChanged, this, &main_window::on_preferred_refresh_rate_changed);
|
||||||
|
connect(server_interface, &wivrn_server::eyeGazeChanged, this, &main_window::on_eye_gaze_changed);
|
||||||
|
connect(server_interface, &wivrn_server::faceTrackingChanged, this, &main_window::on_face_tracking_changed);
|
||||||
|
connect(server_interface, &wivrn_server::fieldOfViewChanged, this, &main_window::on_field_of_view_changed);
|
||||||
|
connect(server_interface, &wivrn_server::handTrackingChanged, this, &main_window::on_hand_tracking_changed);
|
||||||
|
connect(server_interface, &wivrn_server::micChannelsChanged, this, &main_window::on_mic_changed);
|
||||||
|
connect(server_interface, &wivrn_server::micSampleRateChanged, this, &main_window::on_mic_changed);
|
||||||
|
connect(server_interface, &wivrn_server::speakerChannelsChanged, this, &main_window::on_speaker_changed);
|
||||||
|
connect(server_interface, &wivrn_server::speakerSampleRateChanged, this, &main_window::on_speaker_changed);
|
||||||
|
connect(server_interface, &wivrn_server::supportedCodecsChanged, this, &main_window::on_supported_codecs_changed);
|
||||||
|
connect(server_interface, &wivrn_server::steamCommandChanged, this, &main_window::on_steam_command_changed);
|
||||||
|
|
||||||
|
connect(ui->button_start, &QPushButton::clicked, this, &main_window::start_server);
|
||||||
|
connect(ui->button_stop, &QPushButton::clicked, this, &main_window::stop_server);
|
||||||
|
connect(ui->button_settings, &QPushButton::clicked, this, &main_window::on_action_settings);
|
||||||
|
connect(ui->button_disconnect, &QPushButton::clicked, this, &main_window::disconnect_client);
|
||||||
|
connect(ui->button_wizard, &QPushButton::clicked, this, &main_window::on_action_wizard);
|
||||||
|
connect(ui->button_details, &QPushButton::toggled, this, &main_window::on_button_details_toggled);
|
||||||
|
|
||||||
|
connect(ui->button_about, &QPushButton::clicked, this, []() { QApplication::aboutQt(); });
|
||||||
|
connect(ui->button_exit, &QPushButton::clicked, this, []() { QApplication::quit(); });
|
||||||
|
|
||||||
|
connect(ui->copy_steam_command, &QPushButton::clicked, this, [&]() {
|
||||||
|
QGuiApplication::clipboard()->setText(ui->label_steam_command->text());
|
||||||
|
});
|
||||||
|
|
||||||
|
retranslate();
|
||||||
|
}
|
||||||
|
|
||||||
|
main_window::~main_window()
|
||||||
|
{
|
||||||
|
delete server_process_timeout;
|
||||||
|
server_process_timeout = nullptr;
|
||||||
|
|
||||||
|
if (server_process)
|
||||||
|
{
|
||||||
|
// Disconnect signals to avoid receiving signals about the server crashing
|
||||||
|
disconnect(server_process, &QProcess::finished, this, &main_window::on_server_finished);
|
||||||
|
disconnect(server_process, &QProcess::errorOccurred, this, &main_window::on_server_error_occurred);
|
||||||
|
server_process->terminate();
|
||||||
|
server_process->waitForFinished();
|
||||||
|
delete server_process;
|
||||||
|
server_process = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete ui;
|
||||||
|
ui = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::changeEvent(QEvent * e)
|
||||||
|
{
|
||||||
|
QWidget::changeEvent(e);
|
||||||
|
|
||||||
|
switch (e->type())
|
||||||
|
{
|
||||||
|
case QEvent::LanguageChange:
|
||||||
|
retranslate();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool main_window::event(QEvent * e)
|
||||||
|
{
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
if (wizard_window and e->type() == QEvent::WindowActivate)
|
||||||
|
{
|
||||||
|
wizard_window->activateWindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (settings_window and e->type() == QEvent::WindowActivate)
|
||||||
|
{
|
||||||
|
settings_window->activateWindow();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
#endif
|
||||||
|
return QMainWindow::event(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::retranslate()
|
||||||
|
{
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
ui->label_how_to_connect->setText(tr("Start the WiVRn app on your headset and connect to \"%1\".").arg(server_interface->hostname()) + "\n\n" + tr("If the server is not visible or the connection fails, check that port 5353 (UDP) and 9757 (TCP and UDP) are open in your firewall."));
|
||||||
|
|
||||||
|
action_show.setText(tr("&Show GUI"));
|
||||||
|
action_hide.setText(tr("&Hide GUI"));
|
||||||
|
action_exit.setText(tr("&Exit"));
|
||||||
|
|
||||||
|
if (server_interface->isHeadsetConnected())
|
||||||
|
{
|
||||||
|
on_headset_connected_changed(true);
|
||||||
|
|
||||||
|
on_recommended_eye_size_changed(server_interface->recommendedEyeSize());
|
||||||
|
on_available_refresh_rates_changed(server_interface->availableRefreshRates());
|
||||||
|
on_preferred_refresh_rate_changed(server_interface->preferredRefreshRate());
|
||||||
|
on_eye_gaze_changed(server_interface->eyeGaze());
|
||||||
|
on_face_tracking_changed(server_interface->faceTracking());
|
||||||
|
on_field_of_view_changed(server_interface->fieldOfView());
|
||||||
|
on_hand_tracking_changed(server_interface->handTracking());
|
||||||
|
on_mic_changed();
|
||||||
|
on_speaker_changed();
|
||||||
|
on_supported_codecs_changed(server_interface->supportedCodecs());
|
||||||
|
on_steam_command_changed(server_interface->steamCommand());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
on_headset_connected_changed(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::closeEvent(QCloseEvent * event)
|
||||||
|
{
|
||||||
|
QMainWindow::closeEvent(event);
|
||||||
|
QCoreApplication::quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::setVisible(bool visible)
|
||||||
|
{
|
||||||
|
if (visible)
|
||||||
|
{
|
||||||
|
action_show.setVisible(false);
|
||||||
|
action_hide.setVisible(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
action_show.setVisible(true);
|
||||||
|
action_hide.setVisible(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
QMainWindow::setVisible(visible);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_server_running_changed(bool running)
|
||||||
|
{
|
||||||
|
if (running)
|
||||||
|
{
|
||||||
|
on_server_dbus_registered();
|
||||||
|
|
||||||
|
ui->stacked_widget_server->setCurrentIndex((int)server_state::started);
|
||||||
|
ui->group_client->setEnabled(true);
|
||||||
|
|
||||||
|
ui->button_stop->setEnabled(true);
|
||||||
|
ui->button_settings->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->stacked_widget_server->setCurrentIndex((int)server_state::stopped);
|
||||||
|
ui->group_client->setEnabled(false);
|
||||||
|
|
||||||
|
ui->button_start->setEnabled(true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_headset_connected_changed(bool connected)
|
||||||
|
{
|
||||||
|
if (connected)
|
||||||
|
{
|
||||||
|
ui->label_client_status->setText(tr("Connected"));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->label_client_status->setText(tr("Not connected"));
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->button_disconnect->setVisible(connected);
|
||||||
|
ui->button_wizard->setHidden(connected);
|
||||||
|
ui->button_details->setVisible(connected);
|
||||||
|
ui->headset_properties->setVisible(connected and ui->button_details->isChecked());
|
||||||
|
|
||||||
|
ui->label_how_to_connect->setHidden(connected);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_button_details_toggled(bool checked)
|
||||||
|
{
|
||||||
|
ui->headset_properties->setVisible(server_interface->isHeadsetConnected() and checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_recommended_eye_size_changed(QSize size)
|
||||||
|
{
|
||||||
|
ui->label_eye_size->setText(tr("%1 \u2a2f %2").arg(size.width()).arg(size.height()));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_available_refresh_rates_changed(const std::vector<float> & rates)
|
||||||
|
{
|
||||||
|
QStringList rates_str;
|
||||||
|
for (float size: rates)
|
||||||
|
rates_str.push_back(tr("%1 Hz").arg(size));
|
||||||
|
|
||||||
|
ui->label_refresh_rates->setText(rates_str.join(", "));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_preferred_refresh_rate_changed(float rate)
|
||||||
|
{
|
||||||
|
ui->label_prefered_refresh_rate->setText(tr("%1 Hz").arg(std::round(rate)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_eye_gaze_changed(bool supported)
|
||||||
|
{
|
||||||
|
ui->label_eye_gaze_tracking->setText(supported ? tr("Supported") : tr("Not supported"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_face_tracking_changed(bool supported)
|
||||||
|
{
|
||||||
|
ui->label_face_tracking->setText(supported ? tr("Supported") : tr("Not supported"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_field_of_view_changed(const std::vector<field_of_view> & fovs)
|
||||||
|
{
|
||||||
|
if (fovs.size() >= 2)
|
||||||
|
{
|
||||||
|
ui->label_field_of_view->setText(tr("Left eye: %1° \u2a2f %2°, right eye: %3° \u2a2f %4°")
|
||||||
|
.arg((fovs[0].angleRight - fovs[0].angleLeft) * 180 / M_PI, 0, 'f', 1)
|
||||||
|
.arg((fovs[0].angleUp - fovs[0].angleDown) * 180 / M_PI, 0, 'f', 1)
|
||||||
|
.arg((fovs[1].angleRight - fovs[1].angleLeft) * 180 / M_PI, 0, 'f', 1)
|
||||||
|
.arg((fovs[1].angleUp - fovs[1].angleDown) * 180 / M_PI, 0, 'f', 1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_hand_tracking_changed(bool supported)
|
||||||
|
{
|
||||||
|
ui->label_hand_tracking->setText(supported ? tr("Supported") : tr("Not supported"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_mic_changed()
|
||||||
|
{
|
||||||
|
auto channels = server_interface->micChannels();
|
||||||
|
auto sample_rate = server_interface->micSampleRate();
|
||||||
|
|
||||||
|
if (channels and sample_rate)
|
||||||
|
ui->label_mic->setText(tr("%n channel(s), %1 Hz", nullptr, channels).arg(sample_rate));
|
||||||
|
else
|
||||||
|
ui->label_mic->setText(tr("N/A"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_speaker_changed()
|
||||||
|
{
|
||||||
|
auto channels = server_interface->speakerChannels();
|
||||||
|
auto sample_rate = server_interface->speakerSampleRate();
|
||||||
|
|
||||||
|
if (channels and sample_rate)
|
||||||
|
ui->label_speaker->setText(tr("%n channel(s), %1 Hz", nullptr, channels).arg(sample_rate));
|
||||||
|
else
|
||||||
|
ui->label_speaker->setText(tr("N/A"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_supported_codecs_changed(QStringList value)
|
||||||
|
{
|
||||||
|
ui->label_codecs->setText(value.join(", "));
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_steam_command_changed(QString value)
|
||||||
|
{
|
||||||
|
ui->label_steam_command->setText(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_server_dbus_registered()
|
||||||
|
{
|
||||||
|
server_process_timeout->stop();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_server_finished(int exit_code, QProcess::ExitStatus status)
|
||||||
|
{
|
||||||
|
disconnect(server_process, &QProcess::finished, this, &main_window::on_server_finished);
|
||||||
|
disconnect(server_process, &QProcess::errorOccurred, this, &main_window::on_server_error_occurred);
|
||||||
|
server_process->deleteLater();
|
||||||
|
server_process = nullptr;
|
||||||
|
|
||||||
|
if (exit_code != 0)
|
||||||
|
{
|
||||||
|
QString error_message = tr("Unknown error (%1), check logs").arg(exit_code);
|
||||||
|
switch (exit_code)
|
||||||
|
{
|
||||||
|
case wivrn_exit_code::cannot_connect_to_avahi:
|
||||||
|
error_message = tr("Cannot connect to avahi, make sure avahi-daemon service is started");
|
||||||
|
break;
|
||||||
|
case wivrn_exit_code::cannot_create_pipe:
|
||||||
|
case wivrn_exit_code::cannot_create_socketpair:
|
||||||
|
error_message = tr("Insufficient system resources");
|
||||||
|
break;
|
||||||
|
case wivrn_exit_code::success:
|
||||||
|
case wivrn_exit_code::unknown_error:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox msgbox /*(this)*/;
|
||||||
|
msgbox.setIcon(QMessageBox::Critical);
|
||||||
|
msgbox.setText(tr("Server crashed:\n%1").arg(error_message));
|
||||||
|
msgbox.setStandardButtons(QMessageBox::Close);
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(false);
|
||||||
|
#endif
|
||||||
|
msgbox.exec();
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_server_error_occurred(QProcess::ProcessError error)
|
||||||
|
{
|
||||||
|
qDebug() << "on_server_error_occurred" << error;
|
||||||
|
|
||||||
|
QString error_message;
|
||||||
|
switch (error)
|
||||||
|
{
|
||||||
|
case QProcess::ProcessError::FailedToStart:
|
||||||
|
error_message = tr("Failed to start");
|
||||||
|
break;
|
||||||
|
case QProcess::ProcessError::Crashed:
|
||||||
|
error_message = tr("Crashed");
|
||||||
|
break;
|
||||||
|
case QProcess::ProcessError::Timedout:
|
||||||
|
error_message = tr("Time out");
|
||||||
|
break;
|
||||||
|
case QProcess::ProcessError::ReadError:
|
||||||
|
error_message = tr("Read error");
|
||||||
|
break;
|
||||||
|
case QProcess::ProcessError::WriteError:
|
||||||
|
error_message = tr("Write error");
|
||||||
|
break;
|
||||||
|
case QProcess::ProcessError::UnknownError:
|
||||||
|
error_message = tr("Unknown error");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox msgbox /*(this)*/;
|
||||||
|
msgbox.setIcon(QMessageBox::Critical);
|
||||||
|
msgbox.setText(tr("Failed to start server:\n%1").arg(error_message));
|
||||||
|
msgbox.setStandardButtons(QMessageBox::Close);
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(false);
|
||||||
|
#endif
|
||||||
|
msgbox.exec();
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_server_start_timeout()
|
||||||
|
{
|
||||||
|
qDebug() << "on_server_start_timeout";
|
||||||
|
|
||||||
|
if (server_process)
|
||||||
|
{
|
||||||
|
// Disconnect signals to avoid receiving signals about the server crashing
|
||||||
|
disconnect(server_process, &QProcess::finished, this, &main_window::on_server_finished);
|
||||||
|
disconnect(server_process, &QProcess::errorOccurred, this, &main_window::on_server_error_occurred);
|
||||||
|
server_process->terminate();
|
||||||
|
server_process->deleteLater();
|
||||||
|
server_process = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
QMessageBox msgbox /*(this)*/;
|
||||||
|
msgbox.setIcon(QMessageBox::Critical);
|
||||||
|
msgbox.setText(tr("Timeout starting server"));
|
||||||
|
msgbox.setStandardButtons(QMessageBox::Close);
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(false);
|
||||||
|
#endif
|
||||||
|
msgbox.exec();
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_action_settings()
|
||||||
|
{
|
||||||
|
assert(not settings_window);
|
||||||
|
|
||||||
|
settings_window = new settings(server_interface);
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(false);
|
||||||
|
connect(settings_window, &QDialog::finished, this, [&](int r) {
|
||||||
|
setEnabled(true);
|
||||||
|
settings_window->deleteLater();
|
||||||
|
settings_window = nullptr;
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
|
settings_window->exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::on_action_wizard()
|
||||||
|
{
|
||||||
|
assert(not wizard_window);
|
||||||
|
|
||||||
|
wizard_window = new wizard;
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setDisabled(true);
|
||||||
|
connect(wizard_window, &QWizard::finished, this, [&]() {
|
||||||
|
setEnabled(true);
|
||||||
|
wizard_window->deleteLater();
|
||||||
|
wizard_window = nullptr;
|
||||||
|
});
|
||||||
|
#endif
|
||||||
|
|
||||||
|
wizard_window->exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::start_server()
|
||||||
|
{
|
||||||
|
// TODO activate by dbus?
|
||||||
|
server_process = new QProcess;
|
||||||
|
connect(server_process, &QProcess::finished, this, &main_window::on_server_finished);
|
||||||
|
connect(server_process, &QProcess::errorOccurred, this, &main_window::on_server_error_occurred);
|
||||||
|
|
||||||
|
server_process->setProcessChannelMode(QProcess::ForwardedChannels);
|
||||||
|
|
||||||
|
server_process->start(QCoreApplication::applicationDirPath() + "/wivrn-server");
|
||||||
|
server_process_timeout->start();
|
||||||
|
|
||||||
|
ui->button_start->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::stop_server()
|
||||||
|
{
|
||||||
|
if (server_interface)
|
||||||
|
server_interface->quit() /*.waitForFinished()*/;
|
||||||
|
// server_process.terminate(); // TODO timer and kill
|
||||||
|
ui->button_stop->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void main_window::disconnect_client()
|
||||||
|
{
|
||||||
|
if (server_interface)
|
||||||
|
server_interface->disconnect_headset();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_main_window.cpp"
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QLoggingCategory>
|
||||||
|
#include <QMainWindow>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QProcess>
|
||||||
|
#include <QSystemTrayIcon>
|
||||||
|
#include <QTimer>
|
||||||
|
#include <QVariantMap>
|
||||||
|
|
||||||
|
#include "wivrn_qdbus_types.h"
|
||||||
|
|
||||||
|
Q_DECLARE_LOGGING_CATEGORY(wivrn_log_category)
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class MainWindow;
|
||||||
|
}
|
||||||
|
class IoGithubWivrnServerInterface;
|
||||||
|
class OrgFreedesktopDBusPropertiesInterface;
|
||||||
|
|
||||||
|
class settings;
|
||||||
|
class wivrn_server;
|
||||||
|
class wizard;
|
||||||
|
|
||||||
|
class main_window : public QMainWindow
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Ui::MainWindow * ui = nullptr;
|
||||||
|
wivrn_server * server_interface = nullptr;
|
||||||
|
|
||||||
|
settings * settings_window = nullptr;
|
||||||
|
wizard * wizard_window = nullptr;
|
||||||
|
|
||||||
|
QIcon icon{":/assets/wivrn.png"};
|
||||||
|
QSystemTrayIcon systray{icon};
|
||||||
|
|
||||||
|
QMenu systray_menu;
|
||||||
|
QAction action_show;
|
||||||
|
QAction action_hide;
|
||||||
|
QAction action_exit;
|
||||||
|
|
||||||
|
QProcess * server_process = nullptr;
|
||||||
|
QTimer * server_process_timeout = nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
main_window();
|
||||||
|
~main_window();
|
||||||
|
|
||||||
|
void changeEvent(QEvent * e) override;
|
||||||
|
bool event(QEvent * e) override;
|
||||||
|
void closeEvent(QCloseEvent * event) override;
|
||||||
|
void setVisible(bool visible) override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void on_server_dbus_registered();
|
||||||
|
void on_server_finished(int exit_code, QProcess::ExitStatus status);
|
||||||
|
void on_server_error_occurred(QProcess::ProcessError error);
|
||||||
|
void on_server_start_timeout();
|
||||||
|
|
||||||
|
void on_button_details_toggled(bool);
|
||||||
|
|
||||||
|
void on_server_running_changed(bool running);
|
||||||
|
void on_headset_connected_changed(bool connected);
|
||||||
|
void on_recommended_eye_size_changed(QSize size);
|
||||||
|
void on_available_refresh_rates_changed(const std::vector<float> & rates);
|
||||||
|
void on_preferred_refresh_rate_changed(float rate);
|
||||||
|
void on_eye_gaze_changed(bool supported);
|
||||||
|
void on_face_tracking_changed(bool supported);
|
||||||
|
void on_field_of_view_changed(const std::vector<field_of_view> & fov);
|
||||||
|
void on_hand_tracking_changed(bool supported);
|
||||||
|
void on_mic_changed();
|
||||||
|
void on_speaker_changed();
|
||||||
|
void on_supported_codecs_changed(QStringList value);
|
||||||
|
void on_steam_command_changed(QString value);
|
||||||
|
|
||||||
|
void on_action_settings();
|
||||||
|
void on_action_wizard();
|
||||||
|
void start_server();
|
||||||
|
void stop_server();
|
||||||
|
void disconnect_client();
|
||||||
|
|
||||||
|
void retranslate();
|
||||||
|
};
|
||||||
@@ -0,0 +1,513 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>MainWindow</class>
|
||||||
|
<widget class="QMainWindow" name="MainWindow">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>898</width>
|
||||||
|
<height>701</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>WiVRn dashboard</string>
|
||||||
|
</property>
|
||||||
|
<property name="windowIcon">
|
||||||
|
<iconset resource="../wivrn-dashboard.qrc">
|
||||||
|
<normaloff>:/images/wivrn.svg</normaloff>:/images/wivrn.svg</iconset>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="centralwidget">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2" stretch="0,0,1,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="group_server">
|
||||||
|
<property name="title">
|
||||||
|
<string>Server status</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_13">
|
||||||
|
<item>
|
||||||
|
<widget class="QStackedWidget" name="stacked_widget_server">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWidget" name="server_stopped">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../wivrn-dashboard.qrc">:/images/wivrn.svg</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>18</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Stopped</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_start">
|
||||||
|
<property name="text">
|
||||||
|
<string>Start</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="media-playback-start"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWidget" name="server_running">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="pixmap">
|
||||||
|
<pixmap resource="../wivrn-dashboard.qrc">:/images/wivrn.svg</pixmap>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="1,0,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_15">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>18</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Running</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_settings">
|
||||||
|
<property name="text">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="preferences-system-symbolic"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_stop">
|
||||||
|
<property name="text">
|
||||||
|
<string>Stop</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="media-playback-stop"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>For Steam games, set the command to:</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::TextFormat::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextInteractionFlag::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copy_steam_command">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Copy to clipboard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-copy"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_steam_command">
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">PRESSURE_VESSEL_FILESYSTEMS_RW=$XDG_RUNTIME_DIR/wivrn/comp_ipc %command%</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextInteractionFlag::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QGroupBox" name="group_client">
|
||||||
|
<property name="title">
|
||||||
|
<string>Headset status</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout" stretch="1,0,0,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_client_status">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>18</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">client_status</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_wizard">
|
||||||
|
<property name="text">
|
||||||
|
<string>Wizard</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_disconnect">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disconnect</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="network-disconnect"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_details">
|
||||||
|
<property name="text">
|
||||||
|
<string>Details</string>
|
||||||
|
</property>
|
||||||
|
<property name="checkable">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_how_to_connect">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">connect_to_this_server</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="headset_properties" native="true">
|
||||||
|
<layout class="QGridLayout" name="gridLayout" columnstretch="0,1">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item row="7" column="0">
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>Eye gaze tracking</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Eye resolution</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="text">
|
||||||
|
<string>Speaker</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="0">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>Field of view</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QLabel" name="label_refresh_rates">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">refresh_rates</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QLabel" name="label_eye_size">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">eye_size</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_9">
|
||||||
|
<property name="text">
|
||||||
|
<string>Microphone</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Available refresh rates</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="0">
|
||||||
|
<widget class="QLabel" name="label_14">
|
||||||
|
<property name="text">
|
||||||
|
<string>Supported codecs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="0">
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>Hand tracking</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Preferred refresh rate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="0">
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="text">
|
||||||
|
<string>Face tracking</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="label_prefered_refresh_rate">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">preferrred_refresh_rate</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QLabel" name="label_speaker">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">speaker</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QLabel" name="label_mic">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">mic</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1">
|
||||||
|
<widget class="QLabel" name="label_field_of_view">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">field_of_view</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLabel" name="label_hand_tracking">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">hand_tracking</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="1">
|
||||||
|
<widget class="QLabel" name="label_eye_gaze_tracking">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">eye_gaze_tracking</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="8" column="1">
|
||||||
|
<widget class="QLabel" name="label_face_tracking">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">face_tracking</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1">
|
||||||
|
<widget class="QLabel" name="label_codecs">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">codecs</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>104</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_about">
|
||||||
|
<property name="text">
|
||||||
|
<string>About</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="help-about"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_exit">
|
||||||
|
<property name="text">
|
||||||
|
<string>Exit</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="application-exit"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<action name="action_systray_show">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="settings-configure"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Show</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_systray_hide">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="settings-configure"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Hide</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
<action name="action_systray_exit">
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="application-exit"/>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Exit</string>
|
||||||
|
</property>
|
||||||
|
</action>
|
||||||
|
</widget>
|
||||||
|
<resources>
|
||||||
|
<include location="../wivrn-dashboard.qrc"/>
|
||||||
|
<include location="../wivrn-dashboard.qrc"/>
|
||||||
|
</resources>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,825 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "rectangle_partitionner.h"
|
||||||
|
|
||||||
|
#include <QColor>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QPaintEvent>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPalette>
|
||||||
|
#include <QStyleOptionFocusRect>
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <cmath>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
const double split_edge_threshold = 0.05;
|
||||||
|
const double move_edge_threshold = 0.02;
|
||||||
|
const double magnetism_threshold = 0.05;
|
||||||
|
const int num_subdiv = 20;
|
||||||
|
const double epsilon = 1.0 / (2 * num_subdiv);
|
||||||
|
|
||||||
|
enum class side
|
||||||
|
{
|
||||||
|
top,
|
||||||
|
bottom,
|
||||||
|
left,
|
||||||
|
right
|
||||||
|
};
|
||||||
|
|
||||||
|
struct edge
|
||||||
|
{
|
||||||
|
side edge_side;
|
||||||
|
int rectangle_index;
|
||||||
|
|
||||||
|
bool operator==(const edge & other) const noexcept
|
||||||
|
{
|
||||||
|
return edge_side == other.edge_side and rectangle_index == other.rectangle_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
double position = 0;
|
||||||
|
double min = std::numeric_limits<double>::max();
|
||||||
|
double max = std::numeric_limits<double>::lowest();
|
||||||
|
};
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
struct rectangle_partitionner_private
|
||||||
|
{
|
||||||
|
std::vector<edge> selection;
|
||||||
|
std::vector<edge> hovered;
|
||||||
|
|
||||||
|
double min_drag_position;
|
||||||
|
double max_drag_position;
|
||||||
|
|
||||||
|
QLine split_line;
|
||||||
|
|
||||||
|
enum class mouse_event_type
|
||||||
|
{
|
||||||
|
move,
|
||||||
|
press,
|
||||||
|
release
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
int hovered_rectangle(QPointF position, std::vector<QRectF> rectangles)
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
for (const QRectF & i: rectangles)
|
||||||
|
{
|
||||||
|
if (i.contains(position))
|
||||||
|
return n;
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Qt::CursorShape get_cursor_shape(QPointF position, std::vector<QRectF> rectangles)
|
||||||
|
{
|
||||||
|
for (QRectF & i: rectangles)
|
||||||
|
{
|
||||||
|
if (i.contains(position))
|
||||||
|
{
|
||||||
|
QPointF rel_pos = position - i.topLeft();
|
||||||
|
double dx = std::min(rel_pos.x(), i.width() - rel_pos.x());
|
||||||
|
double dy = std::min(rel_pos.y(), i.height() - rel_pos.y());
|
||||||
|
|
||||||
|
if (dx < move_edge_threshold and position.x() >= epsilon and position.x() <= 1 - epsilon)
|
||||||
|
return Qt::SizeHorCursor;
|
||||||
|
else if (dy < move_edge_threshold and position.y() >= epsilon and position.y() <= 1 - epsilon)
|
||||||
|
return Qt::SizeVerCursor;
|
||||||
|
else if (dx < split_edge_threshold and position.y() >= epsilon and position.y() <= 1 - epsilon)
|
||||||
|
return Qt::SplitVCursor;
|
||||||
|
else if (dy < split_edge_threshold and position.x() >= epsilon and position.x() <= 1 - epsilon)
|
||||||
|
return Qt::SplitHCursor;
|
||||||
|
else
|
||||||
|
return Qt::ArrowCursor;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return Qt::ArrowCursor;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<edge> horizontal_edges(std::vector<QRectF> rectangles)
|
||||||
|
{
|
||||||
|
std::vector<edge> edges;
|
||||||
|
|
||||||
|
for (int i = 0, n = rectangles.size(); i < n; i++)
|
||||||
|
{
|
||||||
|
if (rectangles[i].top() > epsilon)
|
||||||
|
{
|
||||||
|
edges.emplace_back(side::top, i, rectangles[i].top(), rectangles[i].left(), rectangles[i].right());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rectangles[i].bottom() < 1 - epsilon)
|
||||||
|
{
|
||||||
|
edges.emplace_back(side::bottom, i, rectangles[i].bottom(), rectangles[i].left(), rectangles[i].right());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<edge> vertical_edges(std::vector<QRectF> rectangles)
|
||||||
|
{
|
||||||
|
std::vector<edge> edges;
|
||||||
|
|
||||||
|
for (int i = 0, n = rectangles.size(); i < n; i++)
|
||||||
|
{
|
||||||
|
if (rectangles[i].left() > epsilon)
|
||||||
|
{
|
||||||
|
edges.emplace_back(side::left, i, rectangles[i].left(), rectangles[i].top(), rectangles[i].bottom());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rectangles[i].right() < 1 - epsilon)
|
||||||
|
{
|
||||||
|
edges.emplace_back(side::right, i, rectangles[i].right(), rectangles[i].top(), rectangles[i].bottom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return edges;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::vector<edge>> partition_edges(std::vector<edge> edges)
|
||||||
|
{
|
||||||
|
auto comp = [](const edge & a, const edge & b) {
|
||||||
|
if (a.position < b.position)
|
||||||
|
return true;
|
||||||
|
if (a.position > b.position)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (a.min < b.min)
|
||||||
|
return true;
|
||||||
|
if (a.min > b.min)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (a.max < b.max)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::ranges::sort(edges, comp);
|
||||||
|
|
||||||
|
std::vector<std::vector<edge>> partitionned;
|
||||||
|
|
||||||
|
double current_position = std::numeric_limits<double>::lowest();
|
||||||
|
double current_max = 0;
|
||||||
|
|
||||||
|
for (auto & e: edges)
|
||||||
|
{
|
||||||
|
if (e.position != current_position)
|
||||||
|
{
|
||||||
|
current_position = e.position;
|
||||||
|
current_max = e.max;
|
||||||
|
partitionned.push_back({e});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (e.min >= current_max)
|
||||||
|
{
|
||||||
|
// All the following edges will be after the last partition
|
||||||
|
current_max = e.max;
|
||||||
|
partitionned.push_back({e});
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Add the edge to the current partition
|
||||||
|
current_max = std::max(current_max, e.max);
|
||||||
|
partitionned.back().push_back(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return partitionned;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<edge> hovered_edges(QPointF position, const std::vector<std::vector<edge>> & partitionned_edges, bool horizontal)
|
||||||
|
{
|
||||||
|
if (horizontal)
|
||||||
|
position = position.transposed();
|
||||||
|
|
||||||
|
for (const auto & edge_list: partitionned_edges)
|
||||||
|
{
|
||||||
|
for (const auto & edge: edge_list)
|
||||||
|
{
|
||||||
|
if (std::abs(position.x() - edge.position) < move_edge_threshold and position.y() >= edge.min and position.y() <= edge.max)
|
||||||
|
{
|
||||||
|
return edge_list;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool assert_rectangle_list_is_partition(const std::vector<QRectF> & rectangles)
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
|
||||||
|
bool ok = true;
|
||||||
|
|
||||||
|
QRectF bounding_box{0, 0, 1, 1};
|
||||||
|
|
||||||
|
for (const auto & i: rectangles)
|
||||||
|
{
|
||||||
|
if (i.width() < 0 or i.height() < 0)
|
||||||
|
{
|
||||||
|
qDebug() << "Invalid rectangle" << i;
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<double> rectangle_y_boundaries;
|
||||||
|
for (auto & i: rectangles)
|
||||||
|
{
|
||||||
|
rectangle_y_boundaries.push_back(i.top());
|
||||||
|
rectangle_y_boundaries.push_back(i.bottom());
|
||||||
|
}
|
||||||
|
|
||||||
|
// for (int y = bounding_box.top(); y < bounding_box.bottom(); ++y)
|
||||||
|
for (double y: rectangle_y_boundaries)
|
||||||
|
{
|
||||||
|
if (y < bounding_box.top())
|
||||||
|
continue;
|
||||||
|
if (y >= bounding_box.bottom())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
qDebug() << "Checking line" << y;
|
||||||
|
std::vector<std::pair<double, double>> horizontal_segments;
|
||||||
|
for (const auto & i: rectangles)
|
||||||
|
{
|
||||||
|
if (y >= i.top() and y < i.bottom())
|
||||||
|
{
|
||||||
|
horizontal_segments.emplace_back(i.left(), i.right());
|
||||||
|
qDebug() << " Adding segment" << i.left() << "-" << i.right();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::ranges::sort(horizontal_segments);
|
||||||
|
|
||||||
|
if (horizontal_segments.empty())
|
||||||
|
{
|
||||||
|
qDebug() << "Line" << y << "empty";
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (horizontal_segments.front().first != bounding_box.left())
|
||||||
|
{
|
||||||
|
qDebug() << "Line" << y << "does not start at the left of the bounding box" << (horizontal_segments.front().first - bounding_box.left());
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (horizontal_segments.back().second != bounding_box.right())
|
||||||
|
{
|
||||||
|
qDebug() << "Last rectangle of line" << y << "does not end at the right of the bounding box" << (horizontal_segments.back().second - bounding_box.right());
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int i = 1; i < horizontal_segments.size(); ++i)
|
||||||
|
{
|
||||||
|
if (horizontal_segments[i - 1].second < horizontal_segments[i].first)
|
||||||
|
{
|
||||||
|
qDebug() << "Overlap in line" << y << (horizontal_segments[i - 1].second - horizontal_segments[i].first);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
else if (horizontal_segments[i - 1].second > horizontal_segments[i].first)
|
||||||
|
{
|
||||||
|
qDebug() << "Gap in line" << y << (horizontal_segments[i - 1].second - horizontal_segments[i].first);
|
||||||
|
ok = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ok)
|
||||||
|
{
|
||||||
|
qDebug() << "Bounding box:" << bounding_box;
|
||||||
|
int n = 1;
|
||||||
|
for (auto & i: rectangles)
|
||||||
|
{
|
||||||
|
qDebug() << "Rectangle" << (n++) << ":" << i.topLeft() << "-" << i.bottomRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
rectangle_partitionner::rectangle_partitionner(QWidget * parent) :
|
||||||
|
QFrame(parent)
|
||||||
|
{
|
||||||
|
p = new rectangle_partitionner_private;
|
||||||
|
|
||||||
|
setMouseTracking(true);
|
||||||
|
|
||||||
|
std::vector<QRectF> encoders;
|
||||||
|
|
||||||
|
encoders.push_back(QRectF{0, 0, 1, 1});
|
||||||
|
set_rectangles(encoders);
|
||||||
|
|
||||||
|
m_paint = [](QPainter & painter, QRect rect, const QVariant & data, int index, bool selected) {
|
||||||
|
if (selected)
|
||||||
|
{
|
||||||
|
painter.fillRect(rect.adjusted(1, 1, 0, 0), QColorConstants::Cyan);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString text = QString("%1").arg(index + 1);
|
||||||
|
painter.drawText(rect, Qt::AlignCenter, text);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
rectangle_partitionner::~rectangle_partitionner()
|
||||||
|
{
|
||||||
|
delete p;
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::paintEvent(QPaintEvent * event)
|
||||||
|
{
|
||||||
|
QFrame::paintEvent(event);
|
||||||
|
|
||||||
|
QPainter painter(this);
|
||||||
|
|
||||||
|
auto positions = rectangles_position();
|
||||||
|
|
||||||
|
{
|
||||||
|
QList<QLine> lines;
|
||||||
|
for (int i = 1; i < num_subdiv; i++)
|
||||||
|
{
|
||||||
|
QPoint p1 = to_position({0, double(i) / num_subdiv});
|
||||||
|
QPoint p2 = to_position({1, double(i) / num_subdiv});
|
||||||
|
lines.emplace_back(p1, p2);
|
||||||
|
|
||||||
|
QPoint p3 = to_position({double(i) / num_subdiv, 0});
|
||||||
|
QPoint p4 = to_position({double(i) / num_subdiv, 1});
|
||||||
|
lines.emplace_back(p3, p4);
|
||||||
|
}
|
||||||
|
|
||||||
|
QPen pen = painter.pen();
|
||||||
|
painter.setPen(QPen(Qt::lightGray, 1, Qt::SolidLine));
|
||||||
|
painter.drawLines(lines);
|
||||||
|
painter.setPen(pen);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_paint)
|
||||||
|
{
|
||||||
|
int n = 0;
|
||||||
|
for (QRect & i: positions)
|
||||||
|
{
|
||||||
|
painter.drawRect(i);
|
||||||
|
bool is_selected = n == m_selected_index and isEnabled();
|
||||||
|
m_paint(painter, i, m_rectangles_data[n], n, is_selected);
|
||||||
|
|
||||||
|
n++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not p->hovered.empty() and p->selection.empty())
|
||||||
|
{
|
||||||
|
painter.setPen(QPen(Qt::blue, 3, Qt::SolidLine, Qt::RoundCap, Qt::RoundJoin));
|
||||||
|
|
||||||
|
auto r = frameRect();
|
||||||
|
r.adjust(frameWidth(), frameWidth(), -2 * frameWidth(), -2 * frameWidth());
|
||||||
|
|
||||||
|
QList<QLine> lines;
|
||||||
|
lines.reserve(p->hovered.size());
|
||||||
|
for (const edge & i: p->hovered)
|
||||||
|
{
|
||||||
|
QLineF line;
|
||||||
|
switch (i.edge_side)
|
||||||
|
{
|
||||||
|
case side::top:
|
||||||
|
case side::bottom:
|
||||||
|
line = QLineF(i.min, i.position, i.max, i.position);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case side::left:
|
||||||
|
case side::right:
|
||||||
|
line = QLineF(i.position, i.min, i.position, i.max);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
int x1 = std::round(r.x() + line.x1() * (r.width() - 1));
|
||||||
|
int x2 = std::round(r.x() + line.x2() * (r.width() - 1));
|
||||||
|
|
||||||
|
int y1 = std::round(r.y() + line.y1() * (r.height() - 1));
|
||||||
|
int y2 = std::round(r.y() + line.y2() * (r.height() - 1));
|
||||||
|
|
||||||
|
lines.emplace_back(x1, y1, x2, y2);
|
||||||
|
}
|
||||||
|
|
||||||
|
painter.drawLines(lines);
|
||||||
|
|
||||||
|
auto horz_partitionned = partition_edges(horizontal_edges(m_rectangles));
|
||||||
|
auto vert_partitionned = partition_edges(vertical_edges(m_rectangles));
|
||||||
|
}
|
||||||
|
else if ((cursor() == Qt::SplitHCursor or cursor() == Qt::SplitVCursor) and not p->split_line.isNull())
|
||||||
|
{
|
||||||
|
auto now = std::chrono::duration_cast<std::chrono::duration<double>>(std::chrono::steady_clock::now().time_since_epoch()).count();
|
||||||
|
|
||||||
|
QPen pen(Qt::black, 2, Qt::DashLine, Qt::RoundCap, Qt::RoundJoin);
|
||||||
|
pen.setDashPattern({5, 5});
|
||||||
|
pen.setDashOffset(-now * 15);
|
||||||
|
painter.setPen(pen);
|
||||||
|
|
||||||
|
painter.drawLine(p->split_line);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::mouseMoveEvent(QMouseEvent * event)
|
||||||
|
{
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
|
||||||
|
auto r = frameRect();
|
||||||
|
r.adjust(frameWidth(), frameWidth(), -2 * frameWidth(), -2 * frameWidth());
|
||||||
|
|
||||||
|
if (not p->selection.empty())
|
||||||
|
{
|
||||||
|
double position;
|
||||||
|
|
||||||
|
if (p->selection.front().edge_side == side::top or p->selection.front().edge_side == side::bottom)
|
||||||
|
position = from_position(event->pos()).y();
|
||||||
|
else
|
||||||
|
position = from_position(event->pos()).x();
|
||||||
|
|
||||||
|
position = std::clamp(position, p->min_drag_position, p->max_drag_position);
|
||||||
|
position = std::round(position * num_subdiv) / num_subdiv; // magnetism
|
||||||
|
|
||||||
|
for (edge & e: p->selection)
|
||||||
|
{
|
||||||
|
switch (e.edge_side)
|
||||||
|
{
|
||||||
|
case side::top:
|
||||||
|
m_rectangles[e.rectangle_index].setTop(position);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case side::bottom:
|
||||||
|
m_rectangles[e.rectangle_index].setBottom(position);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case side::left:
|
||||||
|
m_rectangles[e.rectangle_index].setLeft(position);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case side::right:
|
||||||
|
m_rectangles[e.rectangle_index].setRight(position);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if (not assert_rectangle_list_is_partition(m_rectangles))
|
||||||
|
// {
|
||||||
|
// abort();
|
||||||
|
// }
|
||||||
|
|
||||||
|
update();
|
||||||
|
rectangles_change(m_rectangles);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->hovered.clear();
|
||||||
|
|
||||||
|
if (auto horz_edges = hovered_edges(from_position(event->pos()), partition_edges(horizontal_edges(m_rectangles)), true); not horz_edges.empty())
|
||||||
|
{
|
||||||
|
p->hovered = std::move(horz_edges);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
else if (auto vert_edges = hovered_edges(from_position(event->pos()), partition_edges(vertical_edges(m_rectangles)), false); not vert_edges.empty())
|
||||||
|
{
|
||||||
|
p->hovered = std::move(vert_edges);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
int n = hovered_rectangle(from_position(event->pos()), m_rectangles);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto new_cursor = get_cursor_shape(from_position(event->pos()), m_rectangles);
|
||||||
|
if (new_cursor != cursor())
|
||||||
|
{
|
||||||
|
update();
|
||||||
|
setCursor(new_cursor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cursor() == Qt::SplitHCursor)
|
||||||
|
{
|
||||||
|
int n = hovered_rectangle(from_position(event->pos()), m_rectangles);
|
||||||
|
|
||||||
|
double x = std::round(from_position(event->pos()).x() * num_subdiv) / num_subdiv; // magnetism
|
||||||
|
int px = to_position({x, 0}).x();
|
||||||
|
|
||||||
|
p->split_line = {px, rectangles_position()[n].top(), px, rectangles_position()[n].bottom()};
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
else if (cursor() == Qt::SplitVCursor)
|
||||||
|
{
|
||||||
|
int n = hovered_rectangle(from_position(event->pos()), m_rectangles);
|
||||||
|
|
||||||
|
double y = std::round(from_position(event->pos()).y() * num_subdiv) / num_subdiv; // magnetism
|
||||||
|
int py = to_position({0, y}).y();
|
||||||
|
|
||||||
|
p->split_line = {rectangles_position()[n].left(), py, rectangles_position()[n].right(), py};
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
p->split_line = {0, 0, 0, 0};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::mousePressEvent(QMouseEvent * event)
|
||||||
|
{
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
|
||||||
|
auto r = frameRect();
|
||||||
|
r.adjust(frameWidth(), frameWidth(), -2 * frameWidth(), -2 * frameWidth());
|
||||||
|
|
||||||
|
p->selection.clear();
|
||||||
|
p->split_line = {0, 0, 0, 0};
|
||||||
|
|
||||||
|
if (auto horz_edges = hovered_edges(from_position(event->pos()), partition_edges(horizontal_edges(m_rectangles)), true); not horz_edges.empty())
|
||||||
|
{
|
||||||
|
p->selection = std::move(horz_edges);
|
||||||
|
}
|
||||||
|
else if (auto vert_edges = hovered_edges(from_position(event->pos()), partition_edges(vertical_edges(m_rectangles)), false); not vert_edges.empty())
|
||||||
|
{
|
||||||
|
p->selection = std::move(vert_edges);
|
||||||
|
}
|
||||||
|
else if (int n = hovered_rectangle(from_position(event->pos()), m_rectangles); n >= 0)
|
||||||
|
{
|
||||||
|
QRectF & hovered = m_rectangles[n];
|
||||||
|
|
||||||
|
// Compute distance to edges
|
||||||
|
auto pos = from_position(event->pos());
|
||||||
|
|
||||||
|
double dx = std::min(pos.x() - hovered.left(), hovered.right() - pos.x());
|
||||||
|
double dy = std::min(pos.y() - hovered.top(), hovered.bottom() - pos.y());
|
||||||
|
|
||||||
|
if (dx < split_edge_threshold)
|
||||||
|
{
|
||||||
|
double y = std::round(pos.y() * num_subdiv) / num_subdiv; // magnetism
|
||||||
|
|
||||||
|
// Split vertically
|
||||||
|
QRectF new_rectangle = hovered;
|
||||||
|
|
||||||
|
hovered.setBottom(y);
|
||||||
|
new_rectangle.setTop(hovered.bottom());
|
||||||
|
|
||||||
|
m_rectangles.push_back(new_rectangle);
|
||||||
|
m_rectangles_data.push_back(m_rectangles_data[n]);
|
||||||
|
update();
|
||||||
|
rectangles_change(m_rectangles);
|
||||||
|
|
||||||
|
if (not assert_rectangle_list_is_partition(m_rectangles))
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
else if (dy < split_edge_threshold)
|
||||||
|
{
|
||||||
|
double x = std::round(pos.x() * num_subdiv) / num_subdiv; // magnetism
|
||||||
|
|
||||||
|
// Split horizontally
|
||||||
|
QRectF new_rectangle = hovered;
|
||||||
|
|
||||||
|
hovered.setRight(x);
|
||||||
|
new_rectangle.setLeft(hovered.right());
|
||||||
|
|
||||||
|
m_rectangles.push_back(new_rectangle);
|
||||||
|
m_rectangles_data.push_back(m_rectangles_data[n]);
|
||||||
|
update();
|
||||||
|
rectangles_change(m_rectangles);
|
||||||
|
|
||||||
|
if (not assert_rectangle_list_is_partition(m_rectangles))
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
set_selected_index(n);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not p->selection.empty())
|
||||||
|
{
|
||||||
|
p->hovered.clear();
|
||||||
|
|
||||||
|
p->min_drag_position = std::numeric_limits<double>::lowest();
|
||||||
|
p->max_drag_position = std::numeric_limits<double>::max();
|
||||||
|
|
||||||
|
for (auto & e: p->selection)
|
||||||
|
{
|
||||||
|
switch (e.edge_side)
|
||||||
|
{
|
||||||
|
case side::top:
|
||||||
|
p->max_drag_position = std::min(p->max_drag_position, m_rectangles[e.rectangle_index].bottom());
|
||||||
|
break;
|
||||||
|
case side::bottom:
|
||||||
|
p->min_drag_position = std::max(p->min_drag_position, m_rectangles[e.rectangle_index].top());
|
||||||
|
break;
|
||||||
|
case side::left:
|
||||||
|
p->max_drag_position = std::min(p->max_drag_position, m_rectangles[e.rectangle_index].right());
|
||||||
|
break;
|
||||||
|
case side::right:
|
||||||
|
p->min_drag_position = std::max(p->min_drag_position, m_rectangles[e.rectangle_index].left());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::mouseReleaseEvent(QMouseEvent * event)
|
||||||
|
{
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
|
||||||
|
p->selection.clear();
|
||||||
|
|
||||||
|
// Delete empty rectangles
|
||||||
|
auto i1 = m_rectangles.begin();
|
||||||
|
auto i3 = m_rectangles_data.begin();
|
||||||
|
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
|
||||||
|
bool changed = false;
|
||||||
|
for (; i1 != m_rectangles.end();)
|
||||||
|
{
|
||||||
|
// if (i2->width() <= 1 or i2->height() <= 1)
|
||||||
|
if (i1->width() <= 0.0001 or i1->height() <= 0.0001) // TODO configurable thresholds
|
||||||
|
{
|
||||||
|
i1 = m_rectangles.erase(i1);
|
||||||
|
i3 = m_rectangles_data.erase(i3);
|
||||||
|
changed = true;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
++i1;
|
||||||
|
++i3;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
|
||||||
|
if (changed)
|
||||||
|
{
|
||||||
|
if (not assert_rectangle_list_is_partition(m_rectangles))
|
||||||
|
abort();
|
||||||
|
|
||||||
|
rectangles_change(m_rectangles);
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::leaveEvent(QEvent * event)
|
||||||
|
{
|
||||||
|
p->split_line = {0, 0, 0, 0};
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::keyPressEvent(QKeyEvent * event)
|
||||||
|
{
|
||||||
|
auto r = frameRect();
|
||||||
|
r.adjust(frameWidth(), frameWidth(), -2 * frameWidth(), -2 * frameWidth());
|
||||||
|
qDebug() << "Bounding box:" << r;
|
||||||
|
int n = 1;
|
||||||
|
for (auto & i: m_rectangles)
|
||||||
|
{
|
||||||
|
qDebug() << "Rectangle" << (n++) << ":" << i.topLeft() << "-" << i.bottomRight();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::set_rectangles(rectangle_list value)
|
||||||
|
{
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
auto old_value = std::move(m_rectangles);
|
||||||
|
|
||||||
|
m_rectangles = std::move(value);
|
||||||
|
|
||||||
|
for (auto & i: m_rectangles)
|
||||||
|
{
|
||||||
|
i.setBottom(std::round(i.bottom() * num_subdiv) / num_subdiv);
|
||||||
|
i.setTop(std::round(i.top() * num_subdiv) / num_subdiv);
|
||||||
|
i.setLeft(std::round(i.left() * num_subdiv) / num_subdiv);
|
||||||
|
i.setRight(std::round(i.right() * num_subdiv) / num_subdiv);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (not assert_rectangle_list_is_partition(m_rectangles))
|
||||||
|
{
|
||||||
|
m_rectangles = std::move(old_value);
|
||||||
|
|
||||||
|
throw std::runtime_error("Invalid partitionning");
|
||||||
|
}
|
||||||
|
|
||||||
|
m_rectangles_data.resize(m_rectangles.size());
|
||||||
|
|
||||||
|
if (m_selected_index >= m_rectangles.size())
|
||||||
|
set_selected_index(m_rectangles.size() - 1);
|
||||||
|
|
||||||
|
update();
|
||||||
|
rectangles_change(m_rectangles);
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::set_selected_index(int new_index)
|
||||||
|
{
|
||||||
|
new_index = std::clamp<int>(new_index, 0, m_rectangles.size());
|
||||||
|
|
||||||
|
if (new_index != m_selected_index)
|
||||||
|
{
|
||||||
|
m_selected_index = new_index;
|
||||||
|
update();
|
||||||
|
|
||||||
|
selected_index_change(new_index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::set_rectangles_data(const data_list & value)
|
||||||
|
{
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
m_rectangles_data = value;
|
||||||
|
m_rectangles_data.resize(m_rectangles.size());
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::set_rectangles_data(int index, QVariant value)
|
||||||
|
{
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
assert(index < m_rectangles_data.size());
|
||||||
|
m_rectangles_data[index] = value;
|
||||||
|
assert(m_rectangles.size() == m_rectangles_data.size());
|
||||||
|
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
void rectangle_partitionner::set_paint(paint_function paint)
|
||||||
|
{
|
||||||
|
m_paint = paint;
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<QRect> rectangle_partitionner::rectangles_position()
|
||||||
|
{
|
||||||
|
std::vector<QRect> positions;
|
||||||
|
positions.reserve(m_rectangles.size());
|
||||||
|
|
||||||
|
auto r = frameRect();
|
||||||
|
r.adjust(frameWidth(), frameWidth(), -2 * frameWidth(), -2 * frameWidth());
|
||||||
|
|
||||||
|
for (QRectF & i: m_rectangles)
|
||||||
|
{
|
||||||
|
int x1 = std::round(r.x() + i.x() * (r.width() - 1));
|
||||||
|
int x2 = std::round(r.x() + (i.x() + i.width()) * (r.width() - 1));
|
||||||
|
|
||||||
|
int y1 = std::round(r.y() + i.y() * (r.height() - 1));
|
||||||
|
int y2 = std::round(r.y() + (i.y() + i.height()) * (r.height() - 1));
|
||||||
|
positions.emplace_back(x1, y1, x2 - x1 + 1, y2 - y1 + 1);
|
||||||
|
}
|
||||||
|
assert(m_rectangles.size() == positions.size());
|
||||||
|
|
||||||
|
return positions;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPointF rectangle_partitionner::from_position(QPoint position)
|
||||||
|
{
|
||||||
|
auto r = frameRect();
|
||||||
|
r.adjust(frameWidth(), frameWidth(), -2 * frameWidth(), -2 * frameWidth());
|
||||||
|
|
||||||
|
return QPointF{
|
||||||
|
std::clamp(double(position.x() - r.x()) / (r.width() - 1), 0., 1.),
|
||||||
|
std::clamp(double(position.y() - r.y()) / (r.height() - 1), 0., 1.),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
QPoint rectangle_partitionner::to_position(QPointF position)
|
||||||
|
{
|
||||||
|
auto r = frameRect();
|
||||||
|
r.adjust(frameWidth(), frameWidth(), -2 * frameWidth(), -2 * frameWidth());
|
||||||
|
|
||||||
|
return QPoint(
|
||||||
|
std::round(r.x() + position.x() * (r.width() - 1)),
|
||||||
|
std::round(r.y() + position.y() * (r.height() - 1)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_rectangle_partitionner.cpp"
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QFrame>
|
||||||
|
#include <QRectF>
|
||||||
|
#include <QVariant>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
struct rectangle_partitionner_private;
|
||||||
|
|
||||||
|
class rectangle_partitionner : public QFrame
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
rectangle_partitionner_private * p;
|
||||||
|
|
||||||
|
public:
|
||||||
|
explicit rectangle_partitionner(QWidget * parent = nullptr);
|
||||||
|
rectangle_partitionner(const rectangle_partitionner &) = delete;
|
||||||
|
rectangle_partitionner & operator=(const rectangle_partitionner &) = delete;
|
||||||
|
~rectangle_partitionner();
|
||||||
|
|
||||||
|
using rectangle_list = std::vector<QRectF>;
|
||||||
|
using data_list = std::vector<QVariant>;
|
||||||
|
using paint_function = std::function<void(QPainter & painter, QRect rect, const QVariant & data, int index, bool selected)>;
|
||||||
|
|
||||||
|
Q_PROPERTY(rectangle_list rectangles READ rectangles WRITE set_rectangles NOTIFY rectangles_change)
|
||||||
|
Q_PROPERTY(data_list rectangles_data READ rectangles_data WRITE set_rectangles_data)
|
||||||
|
Q_PROPERTY(int selected_index READ selected_index WRITE set_selected_index NOTIFY selected_index_change)
|
||||||
|
Q_PROPERTY(paint_function paint READ paint WRITE set_paint)
|
||||||
|
|
||||||
|
const rectangle_list & rectangles() const
|
||||||
|
{
|
||||||
|
return m_rectangles;
|
||||||
|
}
|
||||||
|
|
||||||
|
int selected_index() const
|
||||||
|
{
|
||||||
|
return m_selected_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data_list & rectangles_data() const
|
||||||
|
{
|
||||||
|
return m_rectangles_data;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QVariant & rectangles_data(int index) const
|
||||||
|
{
|
||||||
|
return m_rectangles_data.at(index);
|
||||||
|
}
|
||||||
|
|
||||||
|
const paint_function & paint() const
|
||||||
|
{
|
||||||
|
return m_paint;
|
||||||
|
}
|
||||||
|
|
||||||
|
void set_rectangles(rectangle_list);
|
||||||
|
void set_rectangles_data(const data_list &);
|
||||||
|
void set_rectangles_data(int, QVariant);
|
||||||
|
void set_selected_index(int);
|
||||||
|
void set_paint(paint_function paint);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void selected_index_change(int);
|
||||||
|
void rectangles_change(const rectangle_list &);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
rectangle_list m_rectangles;
|
||||||
|
int m_selected_index = 0;
|
||||||
|
data_list m_rectangles_data;
|
||||||
|
paint_function m_paint;
|
||||||
|
|
||||||
|
std::vector<QRect> rectangles_position();
|
||||||
|
QPointF from_position(QPoint position);
|
||||||
|
QPoint to_position(QPointF position);
|
||||||
|
|
||||||
|
void paintEvent(QPaintEvent * event) override;
|
||||||
|
void mouseMoveEvent(QMouseEvent * event) override;
|
||||||
|
void mousePressEvent(QMouseEvent * event) override;
|
||||||
|
void mouseReleaseEvent(QMouseEvent * event) override;
|
||||||
|
void leaveEvent(QEvent * event) override;
|
||||||
|
|
||||||
|
void keyPressEvent(QKeyEvent * event) override;
|
||||||
|
};
|
||||||
@@ -0,0 +1,432 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "settings.h"
|
||||||
|
|
||||||
|
#include "rectangle_partitionner.h"
|
||||||
|
#include "ui_settings.h"
|
||||||
|
#include "wivrn_server.h"
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
#include <QJsonObject>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QPainter>
|
||||||
|
#include <QPushButton>
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QToolTip>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <utility>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
namespace
|
||||||
|
{
|
||||||
|
// The index must match the order in the combo boxes
|
||||||
|
const std::vector<std::pair<int, std::string>> encoder_ids{
|
||||||
|
{0, "auto"},
|
||||||
|
{1, "nvenc"},
|
||||||
|
{2, "vaapi"},
|
||||||
|
{3, "x264"},
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::vector<std::pair<int, std::string>> codec_ids{
|
||||||
|
{0, "auto"},
|
||||||
|
{1, "h264"},
|
||||||
|
{1, "avc"},
|
||||||
|
{2, "h265"},
|
||||||
|
{3, "av1"},
|
||||||
|
};
|
||||||
|
|
||||||
|
const std::vector<std::pair<int, int>> compatible_combos{
|
||||||
|
// Automatically chosen encoder
|
||||||
|
{0, 0},
|
||||||
|
// nvenc
|
||||||
|
{1, 0},
|
||||||
|
{1, 1},
|
||||||
|
{1, 2},
|
||||||
|
// {1, 3},
|
||||||
|
// vaapi
|
||||||
|
{2, 0},
|
||||||
|
{2, 1},
|
||||||
|
{2, 2},
|
||||||
|
{2, 3},
|
||||||
|
// x264
|
||||||
|
{3, 1},
|
||||||
|
};
|
||||||
|
|
||||||
|
int encoder_id_from_string(std::string_view s)
|
||||||
|
{
|
||||||
|
for (auto & [i, j]: encoder_ids)
|
||||||
|
{
|
||||||
|
if (j == s)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string & encoder_from_id(int id)
|
||||||
|
{
|
||||||
|
for (auto & [i, j]: encoder_ids)
|
||||||
|
{
|
||||||
|
if (i == id)
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string default_value = "auto";
|
||||||
|
return default_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
int codec_id_from_string(std::string_view s)
|
||||||
|
{
|
||||||
|
for (auto & [i, j]: codec_ids)
|
||||||
|
{
|
||||||
|
if (j == s)
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::string & codec_from_id(int id)
|
||||||
|
{
|
||||||
|
for (auto & [i, j]: codec_ids)
|
||||||
|
{
|
||||||
|
if (i == id)
|
||||||
|
return j;
|
||||||
|
}
|
||||||
|
|
||||||
|
static const std::string default_value = "auto";
|
||||||
|
return default_value;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace
|
||||||
|
|
||||||
|
settings::settings(wivrn_server * server_interface) :
|
||||||
|
server_interface(server_interface)
|
||||||
|
{
|
||||||
|
ui = new Ui::Settings;
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
QJsonParseError error;
|
||||||
|
json_doc = QJsonDocument::fromJson(server_interface->jsonConfiguration().toUtf8(), &error);
|
||||||
|
|
||||||
|
std::vector<QRectF> rectangles;
|
||||||
|
std::vector<QVariant> encoder_config;
|
||||||
|
|
||||||
|
if (error.error)
|
||||||
|
{
|
||||||
|
std::cout << "Cannot read configuration: " << error.errorString().toStdString() << ", offset " << error.offset << std::endl;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
auto encoders = json_doc.object().find("encoders");
|
||||||
|
|
||||||
|
if (encoders->isArray())
|
||||||
|
{
|
||||||
|
ui->radio_auto_encoder->setChecked(false);
|
||||||
|
ui->radio_manual_encoder->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->radio_auto_encoder->setChecked(true);
|
||||||
|
ui->radio_manual_encoder->setChecked(false);
|
||||||
|
|
||||||
|
encoders = json_doc.object().find("encoders.disabled");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (encoders->isArray())
|
||||||
|
{
|
||||||
|
for (QJsonValue i: encoders->toArray())
|
||||||
|
{
|
||||||
|
int encoder = encoder_id_from_string(i["encoder"].toString("auto").toLower().toStdString());
|
||||||
|
int codec = codec_id_from_string(i["codec"].toString("auto").toLower().toStdString());
|
||||||
|
double width = i["width"].toDouble(1);
|
||||||
|
double height = i["height"].toDouble(1);
|
||||||
|
double offset_x = i["offset_x"].toDouble(0);
|
||||||
|
double offset_y = i["offset_y"].toDouble(0);
|
||||||
|
int group = i["group"].toInt(0); // TODO: handle groups
|
||||||
|
|
||||||
|
rectangles.push_back(QRectF(offset_x, offset_y, width, height));
|
||||||
|
encoder_config.push_back(QVariant::fromValue(std::pair(encoder, codec)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (rectangles.empty())
|
||||||
|
{
|
||||||
|
rectangles.push_back(QRectF(0, 0, 1, 1));
|
||||||
|
std::pair<int, int> config{0, 0};
|
||||||
|
encoder_config.push_back(QVariant::fromValue(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
ui->partitionner->set_rectangles(rectangles);
|
||||||
|
}
|
||||||
|
catch (...)
|
||||||
|
{
|
||||||
|
QMessageBox msgbox{QMessageBox::Information, tr("Invalid settings"), tr("The encoder configuration is invalid, the default values will be restored."), QMessageBox::Close, this};
|
||||||
|
msgbox.exec();
|
||||||
|
|
||||||
|
ui->radio_auto_encoder->setChecked(true);
|
||||||
|
ui->radio_manual_encoder->setChecked(false);
|
||||||
|
|
||||||
|
rectangles.clear();
|
||||||
|
encoder_config.clear();
|
||||||
|
|
||||||
|
rectangles.push_back(QRectF(0, 0, 1, 1));
|
||||||
|
ui->partitionner->set_rectangles(rectangles);
|
||||||
|
|
||||||
|
std::pair<int, int> config{0, 0};
|
||||||
|
encoder_config.push_back(QVariant::fromValue(config));
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->partitionner->set_rectangles_data(encoder_config);
|
||||||
|
ui->partitionner->set_selected_index(0);
|
||||||
|
|
||||||
|
if (json_doc["scale"].isDouble())
|
||||||
|
{
|
||||||
|
ui->slider_foveation->setValue(std::round((1 - json_doc["scale"].toDouble(1)) * 100));
|
||||||
|
ui->spin_foveation->setValue(std::round((1 - json_doc["scale"].toDouble(1)) * 100));
|
||||||
|
ui->radio_auto_foveation->setChecked(false);
|
||||||
|
ui->radio_manual_foveation->setChecked(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->radio_auto_foveation->setChecked(true);
|
||||||
|
ui->radio_manual_foveation->setChecked(false);
|
||||||
|
}
|
||||||
|
ui->bitrate->setValue(json_doc["bitrate"].toDouble(50'000'000) / 1'000'000);
|
||||||
|
|
||||||
|
selected_rectangle_changed(0);
|
||||||
|
|
||||||
|
connect(ui->partitionner, &rectangle_partitionner::selected_index_change, this, &settings::selected_rectangle_changed);
|
||||||
|
// connect(ui->partitionner, &rectangle_partitionner::rectangles_change, this, [](){});
|
||||||
|
|
||||||
|
connect(ui->encoder, &QComboBox::currentIndexChanged, this, &settings::on_encoder_changed);
|
||||||
|
connect(ui->encoder, &QComboBox::currentIndexChanged, this, &settings::on_settings_changed);
|
||||||
|
connect(ui->codec, &QComboBox::currentIndexChanged, this, &settings::on_settings_changed);
|
||||||
|
connect(ui->bitrate, &QDoubleSpinBox::valueChanged, this, &settings::on_settings_changed);
|
||||||
|
connect(ui->slider_foveation, &QSlider::valueChanged, this, &settings::on_settings_changed);
|
||||||
|
connect(ui->spin_foveation, &QSpinBox::valueChanged, this, &settings::on_settings_changed);
|
||||||
|
|
||||||
|
// connect(ui->foveation_info, &QPushButton::clicked, this, [&]() { QToolTip::showText(ui->radio_manual_foveation->pos(), ui->radio_manual_foveation->toolTip(), ui->radio_manual_foveation); });
|
||||||
|
|
||||||
|
connect(this, &QDialog::accepted, this, &settings::save_settings);
|
||||||
|
connect(ui->buttonBox->button(QDialogButtonBox::RestoreDefaults), &QPushButton::clicked, this, &settings::restore_defaults);
|
||||||
|
|
||||||
|
ui->partitionner->set_paint([&](QPainter & painter, QRect rect, const QVariant & data, int index, bool selected) {
|
||||||
|
if (selected)
|
||||||
|
{
|
||||||
|
painter.fillRect(rect.adjusted(1, 1, 0, 0), QColorConstants::Cyan);
|
||||||
|
}
|
||||||
|
|
||||||
|
auto [encoder_id, codec_id] = data.value<std::pair<int, int>>();
|
||||||
|
|
||||||
|
QString codec = ui->codec->itemText(codec_id);
|
||||||
|
QString encoder = ui->encoder->itemText(encoder_id);
|
||||||
|
|
||||||
|
QFont font = painter.font();
|
||||||
|
QFont font2 = font;
|
||||||
|
|
||||||
|
font2.setPixelSize(24);
|
||||||
|
|
||||||
|
QString text = QString("%1\n%2").arg(encoder, codec);
|
||||||
|
|
||||||
|
QFontMetrics metrics{font2};
|
||||||
|
QSize size = metrics.size(0, text);
|
||||||
|
|
||||||
|
if (double ratio = std::max((double)size.width() / rect.width(), (double)size.height() / rect.height()); ratio > 1)
|
||||||
|
{
|
||||||
|
int pixel_size = font2.pixelSize() / ratio;
|
||||||
|
if (pixel_size > 0)
|
||||||
|
font2.setPixelSize(pixel_size);
|
||||||
|
}
|
||||||
|
|
||||||
|
painter.setFont(font2);
|
||||||
|
painter.drawText(rect, Qt::AlignCenter, text);
|
||||||
|
painter.setFont(font);
|
||||||
|
});
|
||||||
|
|
||||||
|
// Update the compatible codecs
|
||||||
|
on_encoder_changed();
|
||||||
|
|
||||||
|
// Update the status text
|
||||||
|
on_settings_changed();
|
||||||
|
|
||||||
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
}
|
||||||
|
|
||||||
|
settings::~settings()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
ui = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings::on_encoder_changed()
|
||||||
|
{
|
||||||
|
int encoder = ui->encoder->currentIndex();
|
||||||
|
|
||||||
|
QStandardItemModel * model = qobject_cast<QStandardItemModel *>(ui->codec->model());
|
||||||
|
assert(model);
|
||||||
|
|
||||||
|
for (int i = 0, n = model->rowCount(); i < n; i++)
|
||||||
|
{
|
||||||
|
auto * item = model->item(i);
|
||||||
|
item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (auto [i, j]: compatible_combos)
|
||||||
|
{
|
||||||
|
if (encoder == i)
|
||||||
|
{
|
||||||
|
auto * item = model->item(j);
|
||||||
|
item->setFlags(item->flags() | Qt::ItemIsEnabled);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings::on_settings_changed()
|
||||||
|
{
|
||||||
|
QString status;
|
||||||
|
|
||||||
|
int encoder = ui->encoder->currentIndex();
|
||||||
|
int codec = ui->codec->currentIndex();
|
||||||
|
|
||||||
|
bool compatible = false;
|
||||||
|
|
||||||
|
for (auto [i, j]: compatible_combos)
|
||||||
|
{
|
||||||
|
if (encoder == i and codec == j)
|
||||||
|
{
|
||||||
|
compatible = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!compatible)
|
||||||
|
{
|
||||||
|
// Find a compatible codec for this encoder
|
||||||
|
for (auto [i, j]: compatible_combos)
|
||||||
|
{
|
||||||
|
if (encoder == i)
|
||||||
|
{
|
||||||
|
codec = j;
|
||||||
|
ui->codec->setCurrentIndex(j);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (codec == 3 /* av1 */)
|
||||||
|
{
|
||||||
|
status += tr("Not all headsets and GPUs support AV1\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->partitionner->set_rectangles_data(ui->partitionner->selected_index(), QVariant::fromValue(std::pair(encoder, codec)));
|
||||||
|
|
||||||
|
ui->message->setText(status);
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings::selected_rectangle_changed(int index)
|
||||||
|
{
|
||||||
|
auto [encoder, codec] = ui->partitionner->rectangles_data(index).value<std::pair<int, int>>();
|
||||||
|
|
||||||
|
ui->encoder->setCurrentIndex(encoder);
|
||||||
|
ui->codec->setCurrentIndex(codec);
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings::restore_defaults()
|
||||||
|
{
|
||||||
|
ui->bitrate->setValue(50);
|
||||||
|
ui->radio_auto_foveation->setChecked(true);
|
||||||
|
ui->radio_auto_encoder->setChecked(true);
|
||||||
|
|
||||||
|
std::vector<QRectF> rectangles;
|
||||||
|
std::vector<QVariant> encoder_config;
|
||||||
|
|
||||||
|
rectangles.push_back(QRectF(0, 0, 1, 1));
|
||||||
|
std::pair<int, int> config{0, 0};
|
||||||
|
encoder_config.push_back(QVariant::fromValue(config));
|
||||||
|
|
||||||
|
ui->partitionner->set_rectangles(rectangles);
|
||||||
|
ui->partitionner->set_rectangles_data(encoder_config);
|
||||||
|
ui->partitionner->set_selected_index(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void settings::save_settings()
|
||||||
|
{
|
||||||
|
QJsonObject json = json_doc.object();
|
||||||
|
|
||||||
|
// Remove all optional keys that might not be overwritten
|
||||||
|
auto it = json.find("scale");
|
||||||
|
if (it != json.end())
|
||||||
|
json.erase(it);
|
||||||
|
|
||||||
|
it = json.find("encoders.disabled");
|
||||||
|
if (it != json.end())
|
||||||
|
json.erase(it);
|
||||||
|
|
||||||
|
it = json.find("encoders");
|
||||||
|
if (it != json.end())
|
||||||
|
json.erase(it);
|
||||||
|
|
||||||
|
if (not ui->radio_auto_foveation->isChecked())
|
||||||
|
json["scale"] = 1 - ui->slider_foveation->value() / 100.0;
|
||||||
|
|
||||||
|
json["bitrate"] = ui->bitrate->value() * 1'000'000;
|
||||||
|
|
||||||
|
QJsonArray encoders;
|
||||||
|
|
||||||
|
const auto & rect = ui->partitionner->rectangles();
|
||||||
|
const auto & data = ui->partitionner->rectangles_data();
|
||||||
|
|
||||||
|
for (int i = 0, n = rect.size(); i < n; i++)
|
||||||
|
{
|
||||||
|
QJsonObject encoder;
|
||||||
|
auto [encoder_id, codec_id] = data[i].value<std::pair<int, int>>();
|
||||||
|
|
||||||
|
if (auto value = QString::fromLatin1(encoder_from_id(encoder_id)); value != "auto")
|
||||||
|
encoder["encoder"] = value;
|
||||||
|
|
||||||
|
if (auto value = QString::fromLatin1(codec_from_id(codec_id)); value != "auto")
|
||||||
|
encoder["codec"] = value;
|
||||||
|
|
||||||
|
encoder["width"] = rect[i].width();
|
||||||
|
encoder["height"] = rect[i].height();
|
||||||
|
encoder["offset_x"] = rect[i].x();
|
||||||
|
encoder["offset_y"] = rect[i].y();
|
||||||
|
|
||||||
|
// TODO encoder groups
|
||||||
|
|
||||||
|
encoders.push_back(encoder);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is only one automatic encoder, don't save it'
|
||||||
|
if (encoders.size() != 1 or encoders[0].toObject().contains("codec") or encoders[0].toObject().contains("encoder"))
|
||||||
|
{
|
||||||
|
if (ui->radio_manual_encoder->isChecked())
|
||||||
|
json["encoders"] = encoders;
|
||||||
|
else
|
||||||
|
json["encoders.disabled"] = encoders;
|
||||||
|
}
|
||||||
|
|
||||||
|
server_interface->setJsonConfiguration(QString::fromUtf8(QJsonDocument(json).toJson()));
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_settings.cpp"
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDialog>
|
||||||
|
#include <QJsonArray>
|
||||||
|
#include <QJsonDocument>
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class Settings;
|
||||||
|
}
|
||||||
|
class wivrn_server;
|
||||||
|
|
||||||
|
class settings : public QDialog
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Ui::Settings * ui;
|
||||||
|
wivrn_server * server_interface;
|
||||||
|
|
||||||
|
QJsonDocument json_doc;
|
||||||
|
|
||||||
|
void selected_rectangle_changed(int);
|
||||||
|
|
||||||
|
public:
|
||||||
|
settings(wivrn_server * server_interface = nullptr);
|
||||||
|
~settings();
|
||||||
|
|
||||||
|
void on_settings_changed();
|
||||||
|
void on_encoder_changed();
|
||||||
|
void save_settings();
|
||||||
|
void restore_defaults();
|
||||||
|
};
|
||||||
@@ -0,0 +1,786 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Settings</class>
|
||||||
|
<widget class="QDialog" name="Settings">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>1018</width>
|
||||||
|
<height>805</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Settings</string>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QLabel" name="label_4">
|
||||||
|
<property name="text">
|
||||||
|
<string>Foveation strength:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QLabel" name="bitrate_label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Bitrate:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>bitrate</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="10" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="text">
|
||||||
|
<string>Weaker</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>Stronger</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="2">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4">
|
||||||
|
<item>
|
||||||
|
<widget class="QDoubleSpinBox" name="bitrate">
|
||||||
|
<property name="suffix">
|
||||||
|
<string> Mbit/s</string>
|
||||||
|
</property>
|
||||||
|
<property name="decimals">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<double>1.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<double>200.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<double>100.000000000000000</double>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="12" column="1" colspan="2">
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>You can use several encoders in order to split the workload between your CPU and your GPU and reduce the latency.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="15" column="1" colspan="2">
|
||||||
|
<layout class="QHBoxLayout" name="layout_encoder_config">
|
||||||
|
<item>
|
||||||
|
<widget class="rectangle_partitionner" name="partitionner">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Expanding" vsizetype="Preferred">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="autoFillBackground">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::Shape::Panel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Shadow::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<property name="lineWidth">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<property name="midLineWidth">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="encoder_label">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Encoder</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>encoder</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="encoder">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>nvenc (NVIDIA GPUs)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>vaapi (AMD and Intel GPUs)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>x264 (software encoding)</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="codec">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Auto</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">H.264</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">H.265</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">AV1</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0" colspan="2">
|
||||||
|
<widget class="QLabel" name="message">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>220</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>220</width>
|
||||||
|
<height>16777215</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignLeading|Qt::AlignmentFlag::AlignLeft|Qt::AlignmentFlag::AlignTop</set>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0">
|
||||||
|
<widget class="QLabel" name="codec_label">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>100</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Codec</string>
|
||||||
|
</property>
|
||||||
|
<property name="buddy">
|
||||||
|
<cstring>codec</cstring>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="1">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Encoder configuration:</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignmentFlag::AlignRight|Qt::AlignmentFlag::AlignTrailing|Qt::AlignmentFlag::AlignVCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1" colspan="3">
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="3">
|
||||||
|
<widget class="QSpinBox" name="spin_foveation">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="suffix">
|
||||||
|
<string> %</string>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>80</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="11" column="1" colspan="3">
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="4">
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="2">
|
||||||
|
<widget class="QSlider" name="slider_foveation">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="minimum">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="maximum">
|
||||||
|
<number>80</number>
|
||||||
|
</property>
|
||||||
|
<property name="value">
|
||||||
|
<number>20</number>
|
||||||
|
</property>
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="tickPosition">
|
||||||
|
<enum>QSlider::TickPosition::TicksBelow</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="13" column="2">
|
||||||
|
<widget class="QRadioButton" name="radio_auto_encoder">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="Encoder">Automatic</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">group_encoder</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="5" column="1" colspan="2">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>A stronger foveation makes the image sharper in the center than in the periphery and makes the decoding faster. This is better for fast paced games.
|
||||||
|
|
||||||
|
A weaker foveation gives a uniform sharpness in the whole image.
|
||||||
|
|
||||||
|
The recommended values are between 20% and 50% for headsets without eye tracking and between 50% and 70% for headsets with eye tracking.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="14" column="2">
|
||||||
|
<widget class="QRadioButton" name="radio_manual_encoder">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="Encoder">Manual</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">group_encoder</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="6" column="2">
|
||||||
|
<widget class="QRadioButton" name="radio_auto_foveation">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="Foveation">Automatic</string>
|
||||||
|
</property>
|
||||||
|
<property name="checked">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">group_foveation</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="9" column="1">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="7" column="2">
|
||||||
|
<widget class="QRadioButton" name="radio_manual_foveation">
|
||||||
|
<property name="text">
|
||||||
|
<string comment="Foveation">Manual</string>
|
||||||
|
</property>
|
||||||
|
<attribute name="buttonGroup">
|
||||||
|
<string notr="true">group_foveation</string>
|
||||||
|
</attribute>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="0" colspan="5">
|
||||||
|
<widget class="Line" name="line_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0" colspan="5">
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>12</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>WiVRn settings</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_9">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>12</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_6">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>6</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QDialogButtonBox" name="buttonBox">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="standardButtons">
|
||||||
|
<set>QDialogButtonBox::StandardButton::Cancel|QDialogButtonBox::StandardButton::Ok|QDialogButtonBox::StandardButton::RestoreDefaults</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_7">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>6</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<customwidgets>
|
||||||
|
<customwidget>
|
||||||
|
<class>rectangle_partitionner</class>
|
||||||
|
<extends>QFrame</extends>
|
||||||
|
<header>rectangle_partitionner.h</header>
|
||||||
|
<container>1</container>
|
||||||
|
</customwidget>
|
||||||
|
</customwidgets>
|
||||||
|
<tabstops>
|
||||||
|
<tabstop>encoder</tabstop>
|
||||||
|
<tabstop>codec</tabstop>
|
||||||
|
</tabstops>
|
||||||
|
<resources/>
|
||||||
|
<connections>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>accepted()</signal>
|
||||||
|
<receiver>Settings</receiver>
|
||||||
|
<slot>accept()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>260</x>
|
||||||
|
<y>778</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>157</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>buttonBox</sender>
|
||||||
|
<signal>rejected()</signal>
|
||||||
|
<receiver>Settings</receiver>
|
||||||
|
<slot>reject()</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>328</x>
|
||||||
|
<y>778</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>286</x>
|
||||||
|
<y>274</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>slider_foveation</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>spin_foveation</receiver>
|
||||||
|
<slot>setValue(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>777</x>
|
||||||
|
<y>213</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>849</x>
|
||||||
|
<y>218</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>spin_foveation</sender>
|
||||||
|
<signal>valueChanged(int)</signal>
|
||||||
|
<receiver>slider_foveation</receiver>
|
||||||
|
<slot>setValue(int)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>849</x>
|
||||||
|
<y>218</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>777</x>
|
||||||
|
<y>213</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_foveation</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>slider_foveation</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>487</x>
|
||||||
|
<y>180</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>777</x>
|
||||||
|
<y>213</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_foveation</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>spin_foveation</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>836</x>
|
||||||
|
<y>183</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>849</x>
|
||||||
|
<y>218</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_encoder</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>partitionner</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>836</x>
|
||||||
|
<y>338</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>388</x>
|
||||||
|
<y>508</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_encoder</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>encoder</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>836</x>
|
||||||
|
<y>338</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>834</x>
|
||||||
|
<y>378</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_encoder</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>codec</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>494</x>
|
||||||
|
<y>323</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>834</x>
|
||||||
|
<y>416</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_encoder</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>encoder_label</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>542</x>
|
||||||
|
<y>323</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>721</x>
|
||||||
|
<y>378</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_encoder</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>codec_label</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>560</x>
|
||||||
|
<y>322</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>721</x>
|
||||||
|
<y>416</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
<connection>
|
||||||
|
<sender>radio_manual_encoder</sender>
|
||||||
|
<signal>toggled(bool)</signal>
|
||||||
|
<receiver>message</receiver>
|
||||||
|
<slot>setEnabled(bool)</slot>
|
||||||
|
<hints>
|
||||||
|
<hint type="sourcelabel">
|
||||||
|
<x>627</x>
|
||||||
|
<y>333</y>
|
||||||
|
</hint>
|
||||||
|
<hint type="destinationlabel">
|
||||||
|
<x>675</x>
|
||||||
|
<y>465</y>
|
||||||
|
</hint>
|
||||||
|
</hints>
|
||||||
|
</connection>
|
||||||
|
</connections>
|
||||||
|
<buttongroups>
|
||||||
|
<buttongroup name="group_encoder"/>
|
||||||
|
<buttongroup name="group_foveation"/>
|
||||||
|
</buttongroups>
|
||||||
|
</ui>
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// Same as XrFovf
|
||||||
|
struct field_of_view
|
||||||
|
{
|
||||||
|
float angleLeft;
|
||||||
|
float angleRight;
|
||||||
|
float angleUp;
|
||||||
|
float angleDown;
|
||||||
|
};
|
||||||
@@ -0,0 +1,240 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "wivrn_server.h"
|
||||||
|
#include "wivrn_server_dbus.h"
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(field_of_view)
|
||||||
|
|
||||||
|
wivrn_server::wivrn_server(QObject * parent) :
|
||||||
|
QObject(parent)
|
||||||
|
{
|
||||||
|
dbus_watcher.setConnection(QDBusConnection::sessionBus());
|
||||||
|
dbus_watcher.addWatchedService("io.github.wivrn.Server");
|
||||||
|
|
||||||
|
connect(&dbus_watcher, &QDBusServiceWatcher::serviceRegistered, this, &wivrn_server::on_server_dbus_registered);
|
||||||
|
connect(&dbus_watcher, &QDBusServiceWatcher::serviceUnregistered, this, &wivrn_server::on_server_dbus_unregistered);
|
||||||
|
|
||||||
|
const QStringList services = QDBusConnection::sessionBus().interface()->registeredServiceNames();
|
||||||
|
if (services.contains("io.github.wivrn.Server"))
|
||||||
|
on_server_dbus_registered();
|
||||||
|
}
|
||||||
|
|
||||||
|
wivrn_server::~wivrn_server()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void wivrn_server::on_server_dbus_registered()
|
||||||
|
{
|
||||||
|
if (server_interface)
|
||||||
|
server_interface->deleteLater();
|
||||||
|
if (server_properties_interface)
|
||||||
|
server_properties_interface->deleteLater();
|
||||||
|
|
||||||
|
server_interface = new IoGithubWivrnServerInterface("io.github.wivrn.Server", "/io/github/wivrn/Server", QDBusConnection::sessionBus(), this);
|
||||||
|
server_properties_interface = new OrgFreedesktopDBusPropertiesInterface("io.github.wivrn.Server", "/io/github/wivrn/Server", QDBusConnection::sessionBus(), this);
|
||||||
|
|
||||||
|
connect(server_properties_interface, &OrgFreedesktopDBusPropertiesInterface::PropertiesChanged, this, &wivrn_server::on_server_properties_changed);
|
||||||
|
|
||||||
|
serverRunningChanged(m_serverRunning = true);
|
||||||
|
refresh_server_properties();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wivrn_server::on_server_dbus_unregistered()
|
||||||
|
{
|
||||||
|
if (server_interface)
|
||||||
|
server_interface->deleteLater();
|
||||||
|
server_interface = nullptr;
|
||||||
|
|
||||||
|
if (server_properties_interface)
|
||||||
|
server_properties_interface->deleteLater();
|
||||||
|
server_properties_interface = nullptr;
|
||||||
|
|
||||||
|
serverRunningChanged(m_serverRunning = false);
|
||||||
|
|
||||||
|
if (isHeadsetConnected())
|
||||||
|
headsetConnectedChanged(m_headsetConnected = false);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wivrn_server::refresh_server_properties()
|
||||||
|
{
|
||||||
|
if (!server_properties_interface)
|
||||||
|
return;
|
||||||
|
|
||||||
|
QDBusPendingReply<QVariantMap> props_pending = server_properties_interface->GetAll("io.github.wivrn.Server");
|
||||||
|
|
||||||
|
if (get_all_properties_call_watcher)
|
||||||
|
get_all_properties_call_watcher->deleteLater();
|
||||||
|
get_all_properties_call_watcher = new QDBusPendingCallWatcher{props_pending, this};
|
||||||
|
|
||||||
|
connect(get_all_properties_call_watcher, &QDBusPendingCallWatcher::finished, [this, props_pending]() {
|
||||||
|
on_server_properties_changed("io.github.wivrn.Server", props_pending.value(), {});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
void wivrn_server::on_server_properties_changed(const QString & interface_name, const QVariantMap & changed_properties, const QStringList & invalidated_properties)
|
||||||
|
{
|
||||||
|
if (interface_name != IoGithubWivrnServerInterface::staticInterfaceName())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (changed_properties.contains("HeadsetConnected"))
|
||||||
|
{
|
||||||
|
headsetConnectedChanged(m_headsetConnected = changed_properties["HeadsetConnected"].toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("RecommendedEyeSize"))
|
||||||
|
{
|
||||||
|
const auto arg = qvariant_cast<QDBusArgument>(changed_properties["RecommendedEyeSize"]);
|
||||||
|
|
||||||
|
arg.beginStructure();
|
||||||
|
arg >> m_recommendedEyeSize.rwidth() >> m_recommendedEyeSize.rheight();
|
||||||
|
arg.endStructure();
|
||||||
|
recommendedEyeSizeChanged(m_recommendedEyeSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("AvailableRefreshRates"))
|
||||||
|
{
|
||||||
|
const auto rates = qvariant_cast<QDBusArgument>(changed_properties["AvailableRefreshRates"]);
|
||||||
|
|
||||||
|
m_availableRefreshRates.clear();
|
||||||
|
rates.beginArray();
|
||||||
|
while (!rates.atEnd())
|
||||||
|
{
|
||||||
|
double element;
|
||||||
|
rates >> element;
|
||||||
|
m_availableRefreshRates.push_back(element);
|
||||||
|
}
|
||||||
|
rates.endArray();
|
||||||
|
|
||||||
|
availableRefreshRatesChanged(m_availableRefreshRates);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("PreferredRefreshRate"))
|
||||||
|
{
|
||||||
|
preferredRefreshRateChanged(m_preferredRefreshRate = changed_properties["PreferredRefreshRate"].toFloat());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("EyeGaze"))
|
||||||
|
{
|
||||||
|
eyeGazeChanged(m_eyeGaze = changed_properties["EyeGaze"].toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("FaceTracking"))
|
||||||
|
{
|
||||||
|
faceTrackingChanged(m_faceTracking = changed_properties["FaceTracking"].toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("FieldOfView"))
|
||||||
|
{
|
||||||
|
const auto fovs = qvariant_cast<QDBusArgument>(changed_properties["FieldOfView"]);
|
||||||
|
fovs.beginArray();
|
||||||
|
|
||||||
|
QStringList fov_str;
|
||||||
|
m_fieldOfView.clear();
|
||||||
|
while (!fovs.atEnd())
|
||||||
|
{
|
||||||
|
fovs.beginStructure();
|
||||||
|
double left, right, up, down;
|
||||||
|
fovs >> left >> right >> up >> down;
|
||||||
|
fovs.endStructure();
|
||||||
|
m_fieldOfView.push_back(field_of_view(left, right, up, down));
|
||||||
|
}
|
||||||
|
fovs.endArray();
|
||||||
|
|
||||||
|
fieldOfViewChanged(m_fieldOfView);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("HandTracking"))
|
||||||
|
{
|
||||||
|
handTrackingChanged(m_handTracking = changed_properties["HandTracking"].toBool());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("MicChannels"))
|
||||||
|
{
|
||||||
|
micChannelsChanged(m_micChannels = changed_properties["MicChannels"].toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("MicSampleRate"))
|
||||||
|
{
|
||||||
|
micSampleRateChanged(m_micSampleRate = changed_properties["MicSampleRate"].toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("SpeakerChannels"))
|
||||||
|
{
|
||||||
|
speakerChannelsChanged(m_speakerChannels = changed_properties["SpeakerChannels"].toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("SpeakerSampleRate"))
|
||||||
|
{
|
||||||
|
speakerSampleRateChanged(m_speakerSampleRate = changed_properties["SpeakerSampleRate"].toInt());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("SupportedCodecs"))
|
||||||
|
{
|
||||||
|
supportedCodecsChanged(m_supportedCodecs = changed_properties["SupportedCodecs"].toStringList());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (changed_properties.contains("SteamCommand"))
|
||||||
|
{
|
||||||
|
steamCommandChanged(m_steamCommand = changed_properties["SteamCommand"].toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wivrn_server::setJsonConfiguration(QString new_configuration)
|
||||||
|
{
|
||||||
|
server_interface->setJsonConfiguration(m_jsonConfiguration = new_configuration);
|
||||||
|
}
|
||||||
|
|
||||||
|
QString wivrn_server::hostname()
|
||||||
|
{
|
||||||
|
static auto _hostname = []() -> QString {
|
||||||
|
OrgFreedesktopDBusPropertiesInterface hostname1("org.freedesktop.hostname1", "/org/freedesktop/hostname1", QDBusConnection::systemBus());
|
||||||
|
|
||||||
|
for (auto property: {"PrettyHostname", "StaticHostname", "Hostname"})
|
||||||
|
{
|
||||||
|
QString name = hostname1.Get("org.freedesktop.hostname1", property).value().variant().toString();
|
||||||
|
|
||||||
|
if (name != "")
|
||||||
|
return name;
|
||||||
|
};
|
||||||
|
|
||||||
|
char buf[HOST_NAME_MAX];
|
||||||
|
int code = gethostname(buf, sizeof(buf));
|
||||||
|
if (code == 0)
|
||||||
|
return buf;
|
||||||
|
|
||||||
|
qDebug() << "Failed to get hostname";
|
||||||
|
return "no-hostname";
|
||||||
|
}();
|
||||||
|
|
||||||
|
return _hostname;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wivrn_server::disconnect_headset()
|
||||||
|
{
|
||||||
|
if (server_interface)
|
||||||
|
server_interface->Disconnect();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wivrn_server::quit()
|
||||||
|
{
|
||||||
|
if (server_interface)
|
||||||
|
server_interface->Quit();
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_wivrn_server.cpp"
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QDBusPendingCallWatcher>
|
||||||
|
#include <QDBusServiceWatcher>
|
||||||
|
#include <QObject>
|
||||||
|
#include <QSize>
|
||||||
|
|
||||||
|
#include "wivrn_qdbus_types.h"
|
||||||
|
|
||||||
|
class IoGithubWivrnServerInterface;
|
||||||
|
class OrgFreedesktopDBusPropertiesInterface;
|
||||||
|
|
||||||
|
class wivrn_server : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
IoGithubWivrnServerInterface * server_interface = nullptr;
|
||||||
|
OrgFreedesktopDBusPropertiesInterface * server_properties_interface = nullptr;
|
||||||
|
QDBusServiceWatcher dbus_watcher;
|
||||||
|
QDBusPendingCallWatcher * get_all_properties_call_watcher = nullptr;
|
||||||
|
|
||||||
|
public:
|
||||||
|
wivrn_server(QObject * parent = nullptr);
|
||||||
|
wivrn_server(const wivrn_server &) = delete;
|
||||||
|
wivrn_server & operator=(const wivrn_server &) = delete;
|
||||||
|
~wivrn_server();
|
||||||
|
|
||||||
|
// Server information
|
||||||
|
Q_PROPERTY(bool serverRunning READ isServerRunning NOTIFY serverRunningChanged)
|
||||||
|
Q_PROPERTY(bool headsetConnected READ isHeadsetConnected NOTIFY headsetConnectedChanged)
|
||||||
|
Q_PROPERTY(QString jsonConfiguration READ jsonConfiguration WRITE setJsonConfiguration)
|
||||||
|
|
||||||
|
// Headset information, valid only if HeadsetConnected is true
|
||||||
|
Q_PROPERTY(QSize recommendedEyeSize READ recommendedEyeSize NOTIFY recommendedEyeSizeChanged)
|
||||||
|
Q_PROPERTY(std::vector<float> availableRefreshRates READ availableRefreshRates NOTIFY availableRefreshRatesChanged)
|
||||||
|
Q_PROPERTY(float preferredRefreshRate READ preferredRefreshRate NOTIFY preferredRefreshRateChanged)
|
||||||
|
Q_PROPERTY(bool eyeGaze READ eyeGaze NOTIFY eyeGazeChanged)
|
||||||
|
Q_PROPERTY(bool faceTracking READ faceTracking NOTIFY faceTrackingChanged)
|
||||||
|
Q_PROPERTY(std::vector<field_of_view> fieldOfView READ fieldOfView NOTIFY fieldOfViewChanged)
|
||||||
|
Q_PROPERTY(bool handTracking READ handTracking NOTIFY handTrackingChanged)
|
||||||
|
Q_PROPERTY(int micChannels READ micChannels NOTIFY micChannelsChanged)
|
||||||
|
Q_PROPERTY(int micSampleRate READ micSampleRate NOTIFY micSampleRateChanged)
|
||||||
|
Q_PROPERTY(int speakerChannels READ speakerChannels NOTIFY speakerChannelsChanged)
|
||||||
|
Q_PROPERTY(int speakerSampleRate READ speakerSampleRate NOTIFY speakerSampleRateChanged)
|
||||||
|
Q_PROPERTY(QStringList supportedCodecs READ supportedCodecs NOTIFY supportedCodecsChanged)
|
||||||
|
Q_PROPERTY(QString steamCommand READ steamCommand NOTIFY steamCommandChanged)
|
||||||
|
|
||||||
|
// hostnamed
|
||||||
|
Q_PROPERTY(QString hostname READ hostname())
|
||||||
|
|
||||||
|
bool isServerRunning() const
|
||||||
|
{
|
||||||
|
return m_serverRunning;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isHeadsetConnected() const
|
||||||
|
{
|
||||||
|
return m_headsetConnected;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString jsonConfiguration() const
|
||||||
|
{
|
||||||
|
return m_jsonConfiguration;
|
||||||
|
}
|
||||||
|
|
||||||
|
void setJsonConfiguration(QString);
|
||||||
|
|
||||||
|
QSize recommendedEyeSize() const
|
||||||
|
{
|
||||||
|
return m_recommendedEyeSize;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<float> & availableRefreshRates() const
|
||||||
|
{
|
||||||
|
return m_availableRefreshRates;
|
||||||
|
}
|
||||||
|
|
||||||
|
float preferredRefreshRate() const
|
||||||
|
{
|
||||||
|
return m_preferredRefreshRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool eyeGaze() const
|
||||||
|
{
|
||||||
|
return m_eyeGaze;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool faceTracking() const
|
||||||
|
{
|
||||||
|
return m_faceTracking;
|
||||||
|
}
|
||||||
|
|
||||||
|
const std::vector<field_of_view> & fieldOfView() const
|
||||||
|
{
|
||||||
|
return m_fieldOfView;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool handTracking() const
|
||||||
|
{
|
||||||
|
return m_handTracking;
|
||||||
|
}
|
||||||
|
|
||||||
|
int micChannels() const
|
||||||
|
{
|
||||||
|
return m_micChannels;
|
||||||
|
}
|
||||||
|
|
||||||
|
int micSampleRate() const
|
||||||
|
{
|
||||||
|
return m_micSampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
int speakerChannels() const
|
||||||
|
{
|
||||||
|
return m_speakerChannels;
|
||||||
|
}
|
||||||
|
|
||||||
|
int speakerSampleRate() const
|
||||||
|
{
|
||||||
|
return m_speakerSampleRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
QStringList supportedCodecs() const
|
||||||
|
{
|
||||||
|
return m_supportedCodecs;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString steamCommand() const
|
||||||
|
{
|
||||||
|
return m_steamCommand;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString hostname();
|
||||||
|
|
||||||
|
void disconnect_headset();
|
||||||
|
void quit();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void on_server_dbus_registered();
|
||||||
|
void on_server_dbus_unregistered();
|
||||||
|
void on_server_properties_changed(const QString & interface_name, const QVariantMap & changed_properties, const QStringList & invalidated_properties);
|
||||||
|
|
||||||
|
void refresh_server_properties();
|
||||||
|
|
||||||
|
bool m_serverRunning{};
|
||||||
|
bool m_headsetConnected{};
|
||||||
|
QString m_jsonConfiguration{};
|
||||||
|
QSize m_recommendedEyeSize{};
|
||||||
|
std::vector<float> m_availableRefreshRates{};
|
||||||
|
float m_preferredRefreshRate{};
|
||||||
|
bool m_eyeGaze{};
|
||||||
|
bool m_faceTracking{};
|
||||||
|
std::vector<field_of_view> m_fieldOfView{};
|
||||||
|
bool m_handTracking{};
|
||||||
|
int m_micChannels{};
|
||||||
|
int m_micSampleRate{};
|
||||||
|
int m_speakerChannels{};
|
||||||
|
int m_speakerSampleRate{};
|
||||||
|
QStringList m_supportedCodecs{};
|
||||||
|
QString m_steamCommand{};
|
||||||
|
|
||||||
|
Q_SIGNALS:
|
||||||
|
void serverRunningChanged(bool);
|
||||||
|
void headsetConnectedChanged(bool);
|
||||||
|
|
||||||
|
void recommendedEyeSizeChanged(QSize);
|
||||||
|
void availableRefreshRatesChanged(const std::vector<float> &);
|
||||||
|
void preferredRefreshRateChanged(float);
|
||||||
|
void eyeGazeChanged(bool);
|
||||||
|
void faceTrackingChanged(bool);
|
||||||
|
void fieldOfViewChanged(const std::vector<field_of_view> &);
|
||||||
|
void handTrackingChanged(bool);
|
||||||
|
void micChannelsChanged(int);
|
||||||
|
void micSampleRateChanged(int);
|
||||||
|
void speakerChannelsChanged(int);
|
||||||
|
void speakerSampleRateChanged(int);
|
||||||
|
void supportedCodecsChanged(QStringList);
|
||||||
|
void steamCommandChanged(QString);
|
||||||
|
};
|
||||||
@@ -0,0 +1,406 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "wizard.h"
|
||||||
|
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QDesktopServices>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QMessageBox>
|
||||||
|
#include <QMetaEnum>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QNetworkRequest>
|
||||||
|
#include <QSaveFile>
|
||||||
|
#include <QStandardPaths>
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QWizard>
|
||||||
|
|
||||||
|
#include "ui_wizard.h"
|
||||||
|
|
||||||
|
#include "wivrn_server.h"
|
||||||
|
|
||||||
|
#include "gui_config.h"
|
||||||
|
#include <filesystem>
|
||||||
|
|
||||||
|
enum class wizard_page
|
||||||
|
{
|
||||||
|
select_headset_model,
|
||||||
|
sideload_download,
|
||||||
|
sideload_install,
|
||||||
|
connect_hmd,
|
||||||
|
start_game
|
||||||
|
};
|
||||||
|
|
||||||
|
struct headset
|
||||||
|
{
|
||||||
|
QString name;
|
||||||
|
QString devmode_url;
|
||||||
|
QString store_name;
|
||||||
|
QString store_url;
|
||||||
|
};
|
||||||
|
|
||||||
|
static const std::vector<headset> headsets_info = {
|
||||||
|
// clang-format off
|
||||||
|
{"HTC Vive Focus 3", "https://developer.vive.com/resources/hardware-guides/vive-focus-specs-user-guide/how-do-i-put-focus-developer-mode/"},
|
||||||
|
{"HTC Vive XR Elite", "https://developer.vive.com/resources/hardware-guides/vive-focus-specs-user-guide/how-do-i-put-focus-developer-mode/"},
|
||||||
|
{"Meta Quest 1", "https://developers.meta.com/horizon/documentation/native/android/mobile-device-setup/#enable-developer-mode"},
|
||||||
|
{"Meta Quest 2", "https://developers.meta.com/horizon/documentation/native/android/mobile-device-setup/#enable-developer-mode", "Meta Store", "https://www.meta.com/experiences/7959676140827574/"},
|
||||||
|
{"Meta Quest 3", "https://developers.meta.com/horizon/documentation/native/android/mobile-device-setup/#enable-developer-mode", "Meta Store", "https://www.meta.com/experiences/7959676140827574/"},
|
||||||
|
{"Meta Quest Pro", "https://developers.meta.com/horizon/documentation/native/android/mobile-device-setup/#enable-developer-mode", "Meta Store", "https://www.meta.com/experiences/7959676140827574/"},
|
||||||
|
{"Pico Neo 4", "https://developer.picoxr.com/document/unreal/test-and-build/#Enable%20developer%20mode"},
|
||||||
|
// clang-format on
|
||||||
|
};
|
||||||
|
|
||||||
|
static constexpr int role_devmode_url = Qt::UserRole + 1;
|
||||||
|
static constexpr int role_store_name = Qt::UserRole + 2;
|
||||||
|
static constexpr int role_store_url = Qt::UserRole + 3;
|
||||||
|
|
||||||
|
wizard::wizard() :
|
||||||
|
server(new wivrn_server(this)),
|
||||||
|
apk_file(QStandardPaths::writableLocation(QStandardPaths::CacheLocation) + "/wivrn.apk")
|
||||||
|
{
|
||||||
|
ui = new Ui::Wizard;
|
||||||
|
ui->setupUi(this);
|
||||||
|
|
||||||
|
retranslate();
|
||||||
|
|
||||||
|
connect(this, &QWizard::currentIdChanged, this, &wizard::on_page_changed);
|
||||||
|
connect(this, &QWizard::customButtonClicked, this, &wizard::on_custom_button_clicked);
|
||||||
|
|
||||||
|
connect(ui->copy_steam_command, &QPushButton::clicked, this, [&]() {
|
||||||
|
QGuiApplication::clipboard()->setText(ui->label_steam_command->text());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(ui->copy_adb_command, &QPushButton::clicked, this, [&]() {
|
||||||
|
QGuiApplication::clipboard()->setText(ui->label_adb_install->text());
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(server, &wivrn_server::headsetConnectedChanged, this, &wizard::on_headset_connected_changed);
|
||||||
|
|
||||||
|
connect(ui->button_cancel_download, &QPushButton::clicked, this, &wizard::cancel_download);
|
||||||
|
|
||||||
|
connect(server, &wivrn_server::steamCommandChanged, this, [this](QString value) {
|
||||||
|
ui->label_steam_command->setText(value);
|
||||||
|
});
|
||||||
|
ui->label_steam_command->setText(server->steamCommand());
|
||||||
|
|
||||||
|
setPixmap(WatermarkPixmap, QPixmap(":/images/wivrn.svg"));
|
||||||
|
|
||||||
|
ui->label_adb_install->setText("adb install -r " + apk_file.fileName());
|
||||||
|
apk_downloaded = QFileInfo(apk_file).exists() and (settings.value("client_apk_url").toString() == WIVRN_CLIENT_URL);
|
||||||
|
|
||||||
|
for (const headset & i: headsets_info)
|
||||||
|
{
|
||||||
|
auto item = new QStandardItem(i.name);
|
||||||
|
|
||||||
|
item->setData(i.devmode_url, role_devmode_url);
|
||||||
|
item->setData(i.store_name, role_store_name);
|
||||||
|
item->setData(i.store_url, role_store_url);
|
||||||
|
|
||||||
|
headsets.appendRow(item);
|
||||||
|
}
|
||||||
|
headsets.appendRow(new QStandardItem(tr("Other"))); // TODO retranslatable
|
||||||
|
|
||||||
|
ui->combo_hmd_model->setModel(&headsets);
|
||||||
|
ui->combo_hmd_model->setCurrentIndex(-1);
|
||||||
|
connect(ui->combo_hmd_model, &QComboBox::currentIndexChanged, this, &wizard::on_headset_model_changed);
|
||||||
|
connect(ui->check_sideload, &QCheckBox::clicked, this, &wizard::on_headset_model_changed);
|
||||||
|
|
||||||
|
setWindowModality(Qt::WindowModality::ApplicationModal);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::on_headset_model_changed()
|
||||||
|
{
|
||||||
|
auto devmode_url = ui->combo_hmd_model->currentData(role_devmode_url).toString();
|
||||||
|
auto store_name = ui->combo_hmd_model->currentData(role_store_name).toString();
|
||||||
|
auto store_url = ui->combo_hmd_model->currentData(role_store_url).toString();
|
||||||
|
|
||||||
|
ui->label_store_url->setText(QString(R"(<html><head/><body><p><a href="%1"><span style="text-decoration: underline; color:#2980b9;">%2</span></a></p></body></html>)").arg(store_url).arg(store_name));
|
||||||
|
ui->label_devmode_url->setText(QString(R"(<html><head/><body><p><a href="%1"><span style="text-decoration: underline; color:#2980b9;">%2</span></a></p></body></html>)").arg(devmode_url).arg(tr("How?")));
|
||||||
|
|
||||||
|
if (ui->combo_hmd_model->currentIndex() < 0)
|
||||||
|
{
|
||||||
|
ui->widget_store->setVisible(false);
|
||||||
|
ui->check_sideload->setVisible(false);
|
||||||
|
button(NextButton)->setEnabled(false);
|
||||||
|
}
|
||||||
|
else if (store_name != "")
|
||||||
|
{
|
||||||
|
ui->widget_store->setVisible(not ui->check_sideload->isChecked());
|
||||||
|
ui->check_sideload->setVisible(true);
|
||||||
|
button(NextButton)->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->widget_store->setVisible(false);
|
||||||
|
ui->check_sideload->setVisible(false);
|
||||||
|
button(NextButton)->setEnabled(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->label_devmode_url->setVisible(devmode_url != "");
|
||||||
|
|
||||||
|
if (nextId() == (int)wizard_page::sideload_download and ui->combo_hmd_model->currentIndex() >= 0)
|
||||||
|
button(NextButton)->setText(tr("Download"));
|
||||||
|
else
|
||||||
|
button(NextButton)->setText(QWizard::tr("&Next >", "do not translate, the QWizard translation will be used"));
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::on_custom_button_clicked(int which)
|
||||||
|
{
|
||||||
|
switch ((wizard_page)currentId())
|
||||||
|
{
|
||||||
|
case wizard_page::select_headset_model:
|
||||||
|
if (which == QWizard::CustomButton1) // Download
|
||||||
|
next();
|
||||||
|
else if (which == QWizard::CustomButton2) // Skip
|
||||||
|
setCurrentId((int)wizard_page::connect_hmd);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::sideload_download:
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::sideload_install:
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::connect_hmd:
|
||||||
|
if (which == QWizard::CustomButton1) // Skip
|
||||||
|
next();
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::start_game:
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::on_page_changed(int id)
|
||||||
|
{
|
||||||
|
switch ((wizard_page)id)
|
||||||
|
{
|
||||||
|
case wizard_page::select_headset_model:
|
||||||
|
button(WizardButton::CustomButton1)->setText(tr("Download"));
|
||||||
|
button(WizardButton::CustomButton2)->setText(tr("Skip"));
|
||||||
|
|
||||||
|
setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::CustomButton2, QWizard::CancelButton});
|
||||||
|
on_headset_model_changed();
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::sideload_download:
|
||||||
|
assert(not apk_downloaded);
|
||||||
|
start_download();
|
||||||
|
|
||||||
|
setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::CancelButton});
|
||||||
|
button(BackButton)->setEnabled(false);
|
||||||
|
button(NextButton)->setEnabled(false);
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::sideload_install:
|
||||||
|
setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::CancelButton});
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::connect_hmd:
|
||||||
|
button(WizardButton::CustomButton1)->setText(tr("Skip"));
|
||||||
|
setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::NextButton, QWizard::CustomButton1, QWizard::CancelButton});
|
||||||
|
on_headset_connected_changed(server->isHeadsetConnected());
|
||||||
|
return;
|
||||||
|
|
||||||
|
case wizard_page::start_game:
|
||||||
|
setButtonLayout({QWizard::Stretch, QWizard::BackButton, QWizard::FinishButton, QWizard::CancelButton});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::changeEvent(QEvent * e)
|
||||||
|
{
|
||||||
|
QWidget::changeEvent(e);
|
||||||
|
|
||||||
|
switch (e->type())
|
||||||
|
{
|
||||||
|
case QEvent::LanguageChange:
|
||||||
|
retranslate();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int wizard::nextId() const
|
||||||
|
{
|
||||||
|
switch ((wizard_page)currentId())
|
||||||
|
{
|
||||||
|
case wizard_page::select_headset_model:
|
||||||
|
if (ui->combo_hmd_model->currentData(role_store_name).toString() != "" and not ui->check_sideload->isChecked())
|
||||||
|
return (int)wizard_page::connect_hmd;
|
||||||
|
else if (apk_downloaded)
|
||||||
|
return (int)wizard_page::sideload_install;
|
||||||
|
else
|
||||||
|
return (int)wizard_page::sideload_download;
|
||||||
|
|
||||||
|
case wizard_page::sideload_install:
|
||||||
|
return (int)wizard_page::connect_hmd;
|
||||||
|
|
||||||
|
default:
|
||||||
|
return QWizard::nextId();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::retranslate()
|
||||||
|
{
|
||||||
|
ui->retranslateUi(this);
|
||||||
|
ui->label_how_to_connect->setText(tr("Start the WiVRn app on your headset and connect to \"%1\".").arg(server->hostname()));
|
||||||
|
on_headset_connected_changed(server->isHeadsetConnected());
|
||||||
|
}
|
||||||
|
|
||||||
|
wizard::~wizard()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
ui = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::start_download()
|
||||||
|
{
|
||||||
|
ui->button_cancel_download->setEnabled(true);
|
||||||
|
|
||||||
|
QUrl url(WIVRN_CLIENT_URL);
|
||||||
|
|
||||||
|
qDebug() << "Downloading from " << url.toString();
|
||||||
|
|
||||||
|
auto apk_dir = std::filesystem::path(apk_file.fileName().toStdString()).parent_path();
|
||||||
|
std::filesystem::create_directories(apk_dir);
|
||||||
|
|
||||||
|
apk_file.open(QIODeviceBase::WriteOnly | QIODeviceBase::Truncate);
|
||||||
|
|
||||||
|
QNetworkRequest request(url);
|
||||||
|
|
||||||
|
if (reply)
|
||||||
|
{
|
||||||
|
disconnect(reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress);
|
||||||
|
disconnect(reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error);
|
||||||
|
disconnect(reply, &QNetworkReply::finished, this, &wizard::on_download_finished);
|
||||||
|
reply->abort();
|
||||||
|
reply->deleteLater();
|
||||||
|
}
|
||||||
|
|
||||||
|
reply = manager.get(request);
|
||||||
|
|
||||||
|
connect(reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress);
|
||||||
|
connect(reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error);
|
||||||
|
connect(reply, &QNetworkReply::finished, this, &wizard::on_download_finished);
|
||||||
|
|
||||||
|
ui->progress_download->setValue(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::cancel_download()
|
||||||
|
{
|
||||||
|
assert(reply);
|
||||||
|
|
||||||
|
disconnect(reply, &QNetworkReply::downloadProgress, this, &wizard::on_download_progress);
|
||||||
|
disconnect(reply, &QNetworkReply::errorOccurred, this, &wizard::on_download_error);
|
||||||
|
disconnect(reply, &QNetworkReply::finished, this, &wizard::on_download_finished);
|
||||||
|
reply->abort();
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
|
||||||
|
// Cancel and commit to close without saving the already written data, so that it can be reopened
|
||||||
|
apk_file.cancelWriting();
|
||||||
|
apk_file.commit();
|
||||||
|
|
||||||
|
back();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::on_download_progress(qint64 bytesReceived, qint64 bytesTotal)
|
||||||
|
{
|
||||||
|
assert(reply);
|
||||||
|
|
||||||
|
if (not reply->error())
|
||||||
|
{
|
||||||
|
if (bytesTotal > 0)
|
||||||
|
ui->progress_download->setValue(bytesReceived * 100 / bytesTotal);
|
||||||
|
|
||||||
|
apk_file.write(reply->readAll());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::on_download_error(QNetworkReply::NetworkError code)
|
||||||
|
{
|
||||||
|
qDebug() << "Download error" << code;
|
||||||
|
|
||||||
|
// Cancel and commit to close without saving the already written data, so that it can be reopened
|
||||||
|
apk_file.cancelWriting();
|
||||||
|
apk_file.commit();
|
||||||
|
|
||||||
|
QMessageBox msgbox /*(this)*/;
|
||||||
|
msgbox.setIcon(QMessageBox::Critical);
|
||||||
|
msgbox.setText(tr("Error downloading the client:\n%1").arg(QMetaEnum::fromType<QNetworkReply::NetworkError>().valueToKey(code)));
|
||||||
|
msgbox.setStandardButtons(QMessageBox::Retry | QMessageBox::Cancel);
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(false);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
switch (msgbox.exec())
|
||||||
|
{
|
||||||
|
case QMessageBox::Retry:
|
||||||
|
start_download();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case QMessageBox::Cancel:
|
||||||
|
back();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef WORKAROUND_QTBUG_90005
|
||||||
|
setEnabled(true);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::on_download_finished()
|
||||||
|
{
|
||||||
|
assert(reply);
|
||||||
|
|
||||||
|
if (not reply->error())
|
||||||
|
{
|
||||||
|
reply->deleteLater();
|
||||||
|
reply = nullptr;
|
||||||
|
|
||||||
|
ui->button_cancel_download->setEnabled(false);
|
||||||
|
apk_file.commit();
|
||||||
|
apk_downloaded = true;
|
||||||
|
settings.setValue("client_apk_url", WIVRN_CLIENT_URL);
|
||||||
|
|
||||||
|
back(); // Remove current page from history before going to the install page
|
||||||
|
setCurrentId((int)wizard_page::sideload_install);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void wizard::on_headset_connected_changed(bool connected)
|
||||||
|
{
|
||||||
|
if (currentId() == (int)wizard_page::connect_hmd)
|
||||||
|
{
|
||||||
|
if (connected)
|
||||||
|
ui->label_client_status->setText(tr("The headset is connected."));
|
||||||
|
else
|
||||||
|
ui->label_client_status->setText(tr("The headset is not connected."));
|
||||||
|
|
||||||
|
button(NextButton)->setEnabled(connected);
|
||||||
|
ui->widget_troubleshoot->setHidden(connected);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include "moc_wizard.cpp"
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
/*
|
||||||
|
* WiVRn VR streaming
|
||||||
|
* Copyright (C) 2024 Guillaume Meunier <guillaume.meunier@centraliens.net>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QSaveFile>
|
||||||
|
#include <QSettings>
|
||||||
|
#include <QStandardItemModel>
|
||||||
|
#include <QWizard>
|
||||||
|
|
||||||
|
namespace Ui
|
||||||
|
{
|
||||||
|
class Wizard;
|
||||||
|
}
|
||||||
|
|
||||||
|
class wivrn_server;
|
||||||
|
|
||||||
|
class wizard : public QWizard
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
Ui::Wizard * ui = nullptr;
|
||||||
|
QStandardItemModel headsets;
|
||||||
|
|
||||||
|
wivrn_server * server;
|
||||||
|
|
||||||
|
QSettings settings;
|
||||||
|
QNetworkAccessManager manager;
|
||||||
|
QNetworkReply * reply = nullptr;
|
||||||
|
QSaveFile apk_file;
|
||||||
|
bool apk_downloaded = false;
|
||||||
|
|
||||||
|
public:
|
||||||
|
wizard();
|
||||||
|
~wizard();
|
||||||
|
|
||||||
|
void changeEvent(QEvent * e) override;
|
||||||
|
void retranslate();
|
||||||
|
|
||||||
|
int nextId() const override;
|
||||||
|
|
||||||
|
void on_page_changed(int id);
|
||||||
|
|
||||||
|
void start_download();
|
||||||
|
void cancel_download();
|
||||||
|
void on_download_progress(qint64 bytesReceived, qint64 bytesTotal);
|
||||||
|
void on_download_error(QNetworkReply::NetworkError code);
|
||||||
|
void on_download_finished();
|
||||||
|
|
||||||
|
void on_headset_model_changed();
|
||||||
|
void on_headset_connected_changed(bool);
|
||||||
|
void on_custom_button_clicked(int which);
|
||||||
|
};
|
||||||
@@ -0,0 +1,526 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<ui version="4.0">
|
||||||
|
<class>Wizard</class>
|
||||||
|
<widget class="QWizard" name="Wizard">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>0</x>
|
||||||
|
<y>0</y>
|
||||||
|
<width>846</width>
|
||||||
|
<height>586</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="windowTitle">
|
||||||
|
<string>Connection wizard</string>
|
||||||
|
</property>
|
||||||
|
<property name="modal">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="currentId">
|
||||||
|
<number>1</number>
|
||||||
|
</property>
|
||||||
|
<widget class="QWizardPage" name="page_1_select_install_method">
|
||||||
|
<property name="title">
|
||||||
|
<string>Welcome</string>
|
||||||
|
</property>
|
||||||
|
<property name="subTitle">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<attribute name="pageId">
|
||||||
|
<string notr="true">0</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>You will need to have the WiVRn client installed on your headset. If the client is already installed, click "Skip".</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QComboBox" name="combo_hmd_model">
|
||||||
|
<property name="currentIndex">
|
||||||
|
<number>-1</number>
|
||||||
|
</property>
|
||||||
|
<property name="placeholderText">
|
||||||
|
<string>Select your headset</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="check_sideload">
|
||||||
|
<property name="text">
|
||||||
|
<string>I want to sideload the client instead</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget_store" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_6" stretch="1,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_store">
|
||||||
|
<property name="text">
|
||||||
|
<string>Go to the store to install the client app on your headset.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_store_url">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">store_url</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::TextFormat::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWizardPage" name="page_2_sideload_download">
|
||||||
|
<property name="title">
|
||||||
|
<string>Downloading the WiVRn app</string>
|
||||||
|
</property>
|
||||||
|
<property name="subTitle">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<attribute name="pageId">
|
||||||
|
<string notr="true">1</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_4">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_8">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||||
|
<item>
|
||||||
|
<widget class="QProgressBar" name="progress_download">
|
||||||
|
<property name="value">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="button_cancel_download">
|
||||||
|
<property name="text">
|
||||||
|
<string>Cancel</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_download_status">
|
||||||
|
<property name="text">
|
||||||
|
<string>Downloading</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_9">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWizardPage" name="page_3_sideload_install">
|
||||||
|
<property name="title">
|
||||||
|
<string>Install the WiVRn app on your headset</string>
|
||||||
|
</property>
|
||||||
|
<property name="subTitle">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<attribute name="pageId">
|
||||||
|
<string notr="true">2</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_10">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_5" stretch="1,0">
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_7">
|
||||||
|
<property name="text">
|
||||||
|
<string>Make sure your headset is in developer mode to continue.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_devmode_url">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">devmode_url</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::TextFormat::RichText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="openExternalLinks">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_6">
|
||||||
|
<property name="text">
|
||||||
|
<string>Run the following command to install the client:</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_2" stretch="0,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copy_adb_command">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Copy to clipboard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-copy"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_adb_install">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<family>Noto Sans Mono</family>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">adb install wivrn.apk</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextInteractionFlag::TextSelectableByKeyboard|Qt::TextInteractionFlag::TextSelectableByMouse</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_11">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWizardPage" name="page_4_connect_hmd">
|
||||||
|
<property name="title">
|
||||||
|
<string>Start the WiVRn app and connect to this computer</string>
|
||||||
|
</property>
|
||||||
|
<property name="subTitle">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<attribute name="pageId">
|
||||||
|
<string notr="true">3</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_9">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_14">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_client_status">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">client_status</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_18">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QWidget" name="widget_troubleshoot" native="true">
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_how_to_connect">
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">connect_to_this_server</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="text">
|
||||||
|
<string>If the server is not visible or the connection fails, check that port 5353 (UDP) and 9757 (TCP and UDP) are open in your firewall.</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_15">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
<widget class="QWizardPage" name="page_5_start_game">
|
||||||
|
<property name="title">
|
||||||
|
<string>Finished</string>
|
||||||
|
</property>
|
||||||
|
<property name="subTitle">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<attribute name="pageId">
|
||||||
|
<string notr="true">4</string>
|
||||||
|
</attribute>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_6">
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_16">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeType">
|
||||||
|
<enum>QSizePolicy::Policy::Fixed</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_11">
|
||||||
|
<property name="text">
|
||||||
|
<string>You can now start an OpenXR application on this computer.</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="text">
|
||||||
|
<string>For Steam games, set the command to:</string>
|
||||||
|
</property>
|
||||||
|
<property name="textFormat">
|
||||||
|
<enum>Qt::TextFormat::PlainText</enum>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextInteractionFlag::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_4" stretch="0,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="copy_steam_command">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Copy to clipboard</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset theme="edit-copy"/>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="label_steam_command">
|
||||||
|
<property name="cursor">
|
||||||
|
<cursorShape>IBeamCursor</cursorShape>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string notr="true">steam_command</string>
|
||||||
|
</property>
|
||||||
|
<property name="textInteractionFlags">
|
||||||
|
<set>Qt::TextInteractionFlag::NoTextInteraction</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_17">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Orientation::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</widget>
|
||||||
|
<resources/>
|
||||||
|
<connections/>
|
||||||
|
</ui>
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<method name="GetAll">
|
<method name="GetAll">
|
||||||
<arg name="interface_name" direction="in" type="s"/>
|
<arg name="interface_name" direction="in" type="s"/>
|
||||||
<arg name="props" direction="out" type="a{sv}"/>
|
<arg name="props" direction="out" type="a{sv}"/>
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName.Out0" value="QVariantMap"/>
|
||||||
</method>
|
</method>
|
||||||
<method name="Set">
|
<method name="Set">
|
||||||
<arg name="interface_name" direction="in" type="s"/>
|
<arg name="interface_name" direction="in" type="s"/>
|
||||||
@@ -19,6 +20,7 @@
|
|||||||
<signal name="PropertiesChanged">
|
<signal name="PropertiesChanged">
|
||||||
<arg type="s" name="interface_name"/>
|
<arg type="s" name="interface_name"/>
|
||||||
<arg type="a{sv}" name="changed_properties"/>
|
<arg type="a{sv}" name="changed_properties"/>
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName.Out1" value="QVariantMap"/>
|
||||||
<arg type="as" name="invalidated_properties"/>
|
<arg type="as" name="invalidated_properties"/>
|
||||||
</signal>
|
</signal>
|
||||||
</interface>
|
</interface>
|
||||||
@@ -32,14 +34,20 @@
|
|||||||
<property name="JsonConfiguration" type="s" access="readwrite"/>
|
<property name="JsonConfiguration" type="s" access="readwrite"/>
|
||||||
|
|
||||||
<!-- Data from the headset info packet -->
|
<!-- Data from the headset info packet -->
|
||||||
<property name="RecommendedEyeSize" type="(uu)" access="read"/>
|
<property name="RecommendedEyeSize" type="(uu)" access="read">
|
||||||
<property name="AvailableRefreshRates" type="ad" access="read"/>
|
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QSize"/>
|
||||||
|
</property>
|
||||||
|
<property name="AvailableRefreshRates" type="ad" access="read">
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QList<double>"/>
|
||||||
|
</property>
|
||||||
<property name="PreferredRefreshRate" type="d" access="read"/>
|
<property name="PreferredRefreshRate" type="d" access="read"/>
|
||||||
<property name="SpeakerChannels" type="u" access="read"/>
|
<property name="SpeakerChannels" type="u" access="read"/>
|
||||||
<property name="SpeakerSampleRate" type="u" access="read"/>
|
<property name="SpeakerSampleRate" type="u" access="read"/>
|
||||||
<property name="MicChannels" type="u" access="read"/>
|
<property name="MicChannels" type="u" access="read"/>
|
||||||
<property name="MicSampleRate" type="u" access="read"/>
|
<property name="MicSampleRate" type="u" access="read"/>
|
||||||
<property name="FieldOfView" type="a(dddd)" access="read"/>
|
<property name="FieldOfView" type="a(dddd)" access="read">
|
||||||
|
<annotation name="org.qtproject.QtDBus.QtTypeName" value="QList<field_of_view>"/>
|
||||||
|
</property>
|
||||||
<property name="HandTracking" type="b" access="read"/>
|
<property name="HandTracking" type="b" access="read"/>
|
||||||
<property name="EyeGaze" type="b" access="read"/>
|
<property name="EyeGaze" type="b" access="read"/>
|
||||||
<property name="FaceTracking" type="b" access="read"/>
|
<property name="FaceTracking" type="b" access="read"/>
|
||||||
|
|||||||
@@ -5,5 +5,4 @@ GenericName=WiVRn server
|
|||||||
Exec=launch-wivrn-server
|
Exec=launch-wivrn-server
|
||||||
Icon=io.github.wivrn.wivrn
|
Icon=io.github.wivrn.wivrn
|
||||||
Type=Application
|
Type=Application
|
||||||
Categories=ConsoleOnly
|
Categories=Network;Game
|
||||||
Terminal=true
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<component type="console-application">
|
<component type="desktop-application">
|
||||||
<id>io.github.wivrn.wivrn</id>
|
<id>io.github.wivrn.wivrn</id>
|
||||||
<name>WiVRn server</name>
|
<name>WiVRn server</name>
|
||||||
<metadata_license>FSFAP</metadata_license>
|
<metadata_license>FSFAP</metadata_license>
|
||||||
@@ -41,6 +41,18 @@
|
|||||||
|
|
||||||
<launchable type="desktop-id">io.github.wivrn.wivrn.desktop</launchable>
|
<launchable type="desktop-id">io.github.wivrn.wivrn.desktop</launchable>
|
||||||
|
|
||||||
|
<categories>
|
||||||
|
<category>Game</category>
|
||||||
|
<category>Network</category>
|
||||||
|
</categories>
|
||||||
|
|
||||||
|
<screenshots>
|
||||||
|
<screenshot type="default">
|
||||||
|
<image type="source">https://wivrn.github.io/assets/img/mountains.jpeg</image>
|
||||||
|
<caption>A caption</caption>
|
||||||
|
</screenshot>
|
||||||
|
</screenshots>
|
||||||
|
|
||||||
<url type="homepage">https://wivrn.github.io</url>
|
<url type="homepage">https://wivrn.github.io</url>
|
||||||
<url type="vcs-browser">https://www.github.com/WiVRn/WiVRn</url>
|
<url type="vcs-browser">https://www.github.com/WiVRn/WiVRn</url>
|
||||||
<url type="bugtracker">https://github.com/WiVRn/WiVRn/issues</url>
|
<url type="bugtracker">https://github.com/WiVRn/WiVRn/issues</url>
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
id: io.github.wivrn.wivrn
|
id: io.github.wivrn.wivrn
|
||||||
runtime: org.freedesktop.Platform
|
runtime: org.kde.Platform
|
||||||
runtime-version: '23.08'
|
runtime-version: '6.7'
|
||||||
sdk: org.freedesktop.Sdk
|
sdk: org.kde.Sdk
|
||||||
command: launch-wivrn-server
|
command: launch-wivrn-server
|
||||||
|
|
||||||
finish-args:
|
finish-args:
|
||||||
@@ -26,6 +26,8 @@ finish-args:
|
|||||||
# Let outside application access the WiVRn socket
|
# Let outside application access the WiVRn socket
|
||||||
- --filesystem=xdg-run/wivrn:create
|
- --filesystem=xdg-run/wivrn:create
|
||||||
- --own-name=io.github.wivrn.Server
|
- --own-name=io.github.wivrn.Server
|
||||||
|
# QSystemTrayIcon
|
||||||
|
- --talk-name=org.kde.StatusNotifierWatcher
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
- /lib/pkgconfig
|
- /lib/pkgconfig
|
||||||
@@ -144,6 +146,8 @@ modules:
|
|||||||
config-opts:
|
config-opts:
|
||||||
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
|
||||||
- -DWIVRN_BUILD_CLIENT=OFF
|
- -DWIVRN_BUILD_CLIENT=OFF
|
||||||
|
- -DWIVRN_BUILD_SERVER=ON
|
||||||
|
- -DWIVRN_BUILD_DASHBOARD=ON
|
||||||
- -DWIVRN_USE_VAAPI=ON
|
- -DWIVRN_USE_VAAPI=ON
|
||||||
- -DWIVRN_USE_X264=ON
|
- -DWIVRN_USE_X264=ON
|
||||||
- -DWIVRN_USE_NVENC=ON
|
- -DWIVRN_USE_NVENC=ON
|
||||||
@@ -198,7 +202,7 @@ modules:
|
|||||||
- sed -ne 's#app-path=\(.*\)#{"runtime":["\1/OpenComposite"],"version":1}#p' /.flatpak-info > $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath
|
- sed -ne 's#app-path=\(.*\)#{"runtime":["\1/OpenComposite"],"version":1}#p' /.flatpak-info > $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath
|
||||||
- chmod -w $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath
|
- chmod -w $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath
|
||||||
-
|
-
|
||||||
- wivrn-server
|
- wivrn-dashboard
|
||||||
-
|
-
|
||||||
- rm -f $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath
|
- rm -f $XDG_CONFIG_HOME/openvr/openvrpaths.vrpath
|
||||||
- if [ -f $XDG_CONFIG_HOME/openvrpaths.vrpath-backup ]
|
- if [ -f $XDG_CONFIG_HOME/openvrpaths.vrpath-backup ]
|
||||||
|
|||||||
@@ -0,0 +1,6 @@
|
|||||||
|
<RCC>
|
||||||
|
<qresource prefix="/">
|
||||||
|
<file>images/wivrn.svg</file>
|
||||||
|
<file>assets/wivrn.png</file>
|
||||||
|
</qresource>
|
||||||
|
</RCC>
|
||||||
Reference in New Issue
Block a user