This commit is contained in:
ts-korhonen
2022-01-01 18:54:51 +02:00
11 changed files with 55 additions and 20 deletions

View File

@@ -130,6 +130,11 @@ cmake_dependent_option(VGAWONDER "ATI VGA Wonder (ATI-18800)"
cmake_dependent_option(VNC "VNC renderer" OFF "DEV_BRANCH" OFF) cmake_dependent_option(VNC "VNC renderer" OFF "DEV_BRANCH" OFF)
cmake_dependent_option(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF) cmake_dependent_option(XL24 "ATI VGA Wonder XL24 (ATI-28800-6)" ON "DEV_BRANCH" OFF)
# Ditto but for Qt
if (QT)
option(USE_QT6 "Use Qt6 instead of Qt5" OFF)
endif()
# Determine the build type # Determine the build type
set(RELEASE_BUILD OFF) set(RELEASE_BUILD OFF)
set(BETA_BUILD OFF) set(BETA_BUILD OFF)

View File

@@ -75,22 +75,31 @@ if(APPLE)
# Force using the newest library if it's installed by homebrew # Force using the newest library if it's installed by homebrew
set(CMAKE_FIND_FRAMEWORK LAST) set(CMAKE_FIND_FRAMEWORK LAST)
# setting our compilation target to macOS 10.13 High Sierra # setting our compilation target to macOS 10.15 Catalina if targetting Qt6, macOS 10.13 High Sierra otherwise
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13") if (USE_QT6)
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15")
else()
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.13")
endif()
endif() endif()
if(QT) if(QT)
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
if (USE_QT6)
set(QT_MAJOR 6)
else()
set(QT_MAJOR 5)
endif()
# if we want to use qt5-static to eliminate need for bundling qt dlls (windows) # if we want to use qt5-static to eliminate need for bundling qt dlls (windows)
#set(QT_STATIC ON) #set(QT_STATIC ON)
# needed to build with qt5-static if both qt5 and qt5-static are installed # needed to build with qt5-static if both qt5 and qt5-static are installed
#set(CMAKE_PREFIX_PATH "path/to/qt5-static") #set(CMAKE_PREFIX_PATH "path/to/qt5-static")
find_package(Qt5 COMPONENTS Core Widgets REQUIRED) find_package(Qt${QT_MAJOR} COMPONENTS Core Widgets OpenGL REQUIRED)
find_package(Qt5LinguistTools REQUIRED) find_package(Qt${QT_MAJOR}LinguistTools REQUIRED)
endif() endif()
find_package(Freetype REQUIRED) find_package(Freetype REQUIRED)
@@ -178,7 +187,7 @@ if(APPLE)
if (QT) if (QT)
# needed for Qt packaging # needed for Qt packaging
# get the macdeployqt path # get the macdeployqt path
get_target_property(_qmake_executable Qt5::qmake IMPORTED_LOCATION) get_target_property(_qmake_executable Qt${QT_MAJOR}::qmake IMPORTED_LOCATION)
get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY) get_filename_component(_qt_bin_dir "${_qmake_executable}" DIRECTORY)
find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}") find_program(MACDEPLOYQT_EXECUTABLE macdeployqt HINTS "${_qt_bin_dir}")

View File

@@ -125,22 +125,23 @@ endif()
target_link_libraries( target_link_libraries(
plat plat
PRIVATE PRIVATE
Qt5::Widgets Qt${QT_MAJOR}::Widgets
Qt5::Gui Qt${QT_MAJOR}::Gui
Threads::Threads Threads::Threads
) )
target_link_libraries( target_link_libraries(
ui ui
PRIVATE PRIVATE
Qt5::Widgets Qt${QT_MAJOR}::Widgets
Qt5::Gui Qt${QT_MAJOR}::Gui
Qt${QT_MAJOR}::OpenGL
Threads::Threads Threads::Threads
) )
# needed for static builds # needed for static builds
if (WIN32) if (WIN32)
qt_import_plugins(plat INCLUDE Qt5::QWindowsIntegrationPlugin Qt5::QICOPlugin QWindowsVistaStylePlugin) qt_import_plugins(plat INCLUDE Qt${QT_MAJOR}::QWindowsIntegrationPlugin Qt${QT_MAJOR}::QICOPlugin QWindowsVistaStylePlugin)
endif() endif()
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
@@ -165,13 +166,13 @@ if (UNIX AND NOT APPLE)
set(WL_SOURCE_VAR) set(WL_SOURCE_VAR)
ecm_add_wayland_client_protocol(WL_SOURCE_VAR PROTOCOL ${CMAKE_SOURCE_DIR}/wl_protocols/relative-pointer-unstable-v1.xml BASENAME relative-pointer-unstable-v1) ecm_add_wayland_client_protocol(WL_SOURCE_VAR PROTOCOL ${CMAKE_SOURCE_DIR}/wl_protocols/relative-pointer-unstable-v1.xml BASENAME relative-pointer-unstable-v1)
ecm_add_wayland_client_protocol(WL_SOURCE_VAR PROTOCOL ${CMAKE_SOURCE_DIR}/wl_protocols/pointer-constraints-unstable-v1.xml BASENAME pointer-constraints-unstable-v1) ecm_add_wayland_client_protocol(WL_SOURCE_VAR PROTOCOL ${CMAKE_SOURCE_DIR}/wl_protocols/pointer-constraints-unstable-v1.xml BASENAME pointer-constraints-unstable-v1)
target_include_directories(ui PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${Qt5Gui_PRIVATE_INCLUDE_DIRS}) target_include_directories(ui PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${Qt${QT_MAJOR}Gui_PRIVATE_INCLUDE_DIRS})
target_sources(ui PRIVATE ${WL_SOURCE_VAR} wl_mouse.cpp) target_sources(ui PRIVATE ${WL_SOURCE_VAR} wl_mouse.cpp)
target_compile_definitions(ui PRIVATE WAYLAND) target_compile_definitions(ui PRIVATE WAYLAND)
endif() endif()
endif() endif()
endif() endif()
endif() endif()
qt5_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} 86box_en.ts 86box_en-GB.ts 86box_de.ts 86box_es.ts 86box_fi.ts 86box_fr.ts 86box_hr.ts 86box_hu.ts 86box_it.ts 86box_ja.ts 86box_ko.ts 86box_pt-BR.ts 86box_pt-PT.ts 86box_ru.ts 86box_sl.ts 86box_tr.ts 86box_zh.ts) qt_create_translation(QM_FILES ${CMAKE_CURRENT_SOURCE_DIR} 86box_en.ts 86box_en-GB.ts 86box_de.ts 86box_es.ts 86box_fi.ts 86box_fr.ts 86box_hr.ts 86box_hu.ts 86box_it.ts 86box_ja.ts 86box_ko.ts 86box_pt-BR.ts 86box_pt-PT.ts 86box_ru.ts 86box_sl.ts 86box_tr.ts 86box_zh.ts)
configure_file(qt_translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY) configure_file(qt_translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
target_sources(ui PRIVATE ${QM_FILES} ${CMAKE_CURRENT_BINARY_DIR}/qt_translations.qrc) target_sources(ui PRIVATE ${QM_FILES} ${CMAKE_CURRENT_BINARY_DIR}/qt_translations.qrc)

View File

@@ -1,10 +1,16 @@
#include <QAbstractNativeEventFilter> #include <QAbstractNativeEventFilter>
#include <QByteArray> #include <QByteArray>
#if QT_VERSION_MAJOR >= 6
#define result_t qintptr
#else
#define result_t long
#endif
class CocoaEventFilter : public QAbstractNativeEventFilter class CocoaEventFilter : public QAbstractNativeEventFilter
{ {
public: public:
CocoaEventFilter() {}; CocoaEventFilter() {};
~CocoaEventFilter(); ~CocoaEventFilter();
virtual bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; virtual bool nativeEventFilter(const QByteArray &eventType, void *message, result_t *result) override;
}; };

View File

@@ -31,7 +31,7 @@ CocoaEventFilter::~CocoaEventFilter()
} }
bool CocoaEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, long *result) bool CocoaEventFilter::nativeEventFilter(const QByteArray &eventType, void *message, result_t *result)
{ {
if (mouse_capture) if (mouse_capture)
{ {

View File

@@ -2,7 +2,6 @@
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <QOpenGLBuffer> #include <QOpenGLBuffer>
#include <QOpenGLWidget>
#include <QOpenGLWindow> #include <QOpenGLWindow>
#include <QOpenGLVertexArrayObject> #include <QOpenGLVertexArrayObject>
#include <QOpenGLTexture> #include <QOpenGLTexture>
@@ -12,6 +11,7 @@
#include <QPainter> #include <QPainter>
#include <QEvent> #include <QEvent>
#include <QKeyEvent> #include <QKeyEvent>
#include <QWidget>
#include <atomic> #include <atomic>
#include <mutex> #include <mutex>

View File

@@ -337,6 +337,7 @@ void MainWindow::showEvent(QShowEvent *event) {
scrnsz_x = window_w; scrnsz_x = window_w;
scrnsz_y = window_h; scrnsz_y = window_h;
} }
if (settings_only) QTimer::singleShot(0, this, [this] () { ui->actionSettings->trigger(); });
} }
void MainWindow::on_actionKeyboard_requires_capture_triggered() { void MainWindow::on_actionKeyboard_requires_capture_triggered() {
@@ -1060,8 +1061,7 @@ void MainWindow::on_actionHardware_Renderer_OpenGL_ES_triggered() {
void MainWindow::focusInEvent(QFocusEvent* event) void MainWindow::focusInEvent(QFocusEvent* event)
{ {
if (settings_only) ui->actionSettings->trigger(); this->grabKeyboard();
else this->grabKeyboard();
} }
void MainWindow::focusOutEvent(QFocusEvent* event) void MainWindow::focusOutEvent(QFocusEvent* event)

View File

@@ -108,7 +108,7 @@ void plat_get_exe_name(char *s, int size)
{ {
QByteArray exepath_temp = QCoreApplication::applicationDirPath().toLocal8Bit(); QByteArray exepath_temp = QCoreApplication::applicationDirPath().toLocal8Bit();
memcpy(s, exepath_temp.data(), std::min(exepath_temp.size(),size)); memcpy(s, exepath_temp.data(), std::min((qsizetype)exepath_temp.size(),(qsizetype)size));
plat_path_slash(s); plat_path_slash(s);
} }

View File

@@ -2,6 +2,7 @@
#include <QRect> #include <QRect>
#include <QImage> #include <QImage>
#include <QEvent>
class QWidget; class QWidget;

View File

@@ -30,6 +30,12 @@ void SettingsOtherPeripherals::onCurrentMachineChanged(int machineId)
ui->comboBoxRTC->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA)); ui->comboBoxRTC->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->pushButtonConfigureRTC->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA)); ui->pushButtonConfigureRTC->setEnabled(machine_has_bus(machineId, MACHINE_BUS_ISA));
ui->comboBoxCard1->clear();
ui->comboBoxCard2->clear();
ui->comboBoxCard3->clear();
ui->comboBoxCard4->clear();
ui->comboBoxRTC->clear();
auto* model = ui->comboBoxRTC->model(); auto* model = ui->comboBoxRTC->model();
int d = 0; int d = 0;
int selectedRow = 0; int selectedRow = 0;

View File

@@ -40,6 +40,13 @@
#include <memory> #include <memory>
#if QT_VERSION_MAJOR >= 6
#define result_t qintptr
#else
#define result_t long
#endif
class WindowsRawInputFilter : public QObject, public QAbstractNativeEventFilter class WindowsRawInputFilter : public QObject, public QAbstractNativeEventFilter
{ {
Q_OBJECT Q_OBJECT
@@ -47,7 +54,7 @@ class WindowsRawInputFilter : public QObject, public QAbstractNativeEventFilter
public: public:
static std::unique_ptr<WindowsRawInputFilter> Register(QMainWindow *window); static std::unique_ptr<WindowsRawInputFilter> Register(QMainWindow *window);
bool nativeEventFilter(const QByteArray &eventType, void *message, long *result) override; bool nativeEventFilter(const QByteArray &eventType, void *message, result_t *result) override;
~WindowsRawInputFilter(); ~WindowsRawInputFilter();
@@ -72,4 +79,4 @@ private:
void keyboard_getkeymap(); void keyboard_getkeymap();
}; };
#endif #endif