Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
85 changes: 85 additions & 0 deletions .github/workflows/android-qt6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Build for Android (Qt6)

# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]

jobs:
build:
runs-on: ubuntu-20.04

steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: 17
distribution: temurin

- name: Setup Android SDK
uses: android-actions/setup-android@7c5672355aaa8fde5f97a91aa9a99616d1ace6bc # v2

- uses: nttld/setup-ndk@8c3b609ff4d54576ea420551943fd34b4d03b0dc # v1
id: setup-ndk
with:
ndk-version: r25
add-to-path: false

- name: Install Qt
uses: jurplel/install-qt-action@43ec12788e42f375acfcb2cec059edfb9572fbaa # v3
with:
version: '6.6.1'
host: 'linux'
target: 'android'
# Qt 6 only supports multi-arch builds with CMake
arch: 'android_arm64_v8a'
cache: true

# Qt 6 for Android needs the desktop version for building as well
- name: Install Qt (desktop)
uses: jurplel/install-qt-action@43ec12788e42f375acfcb2cec059edfb9572fbaa # v3
with:
version: '6.6.1'
host: 'linux'
target: 'desktop'
cache: true

- name: Build firebird
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
run: |
mkdir build
cd build
qmake ..
make -j4 apk_install_target

- name: Pack APK
env:
ANDROID_NDK_HOME: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_NDK_ROOT: ${{ steps.setup-ndk.outputs.ndk-path }}
ANDROID_KEYSTORE: ${{ secrets.ANDROID_KEYSTORE }}
ANDROID_KEYSTORE_PWD: ${{ secrets.ANDROID_KEYSTORE_PWD }}
run: |
cd build
if [ -n "$ANDROID_KEYSTORE_PWD" ]; then
echo "$ANDROID_KEYSTORE" | base64 -d > keystore.jks
androiddeployqt --input android-firebird-emu-deployment-settings.json --output android-build --apk firebird-emu.apk --sign keystore.jks firebirdemugh --storepass "$ANDROID_KEYSTORE_PWD"
else
androiddeployqt --input android-firebird-emu-deployment-settings.json --output android-build --apk firebird-emu.apk
fi

- name: Upload zip
uses: actions/upload-artifact@v3
with:
name: firebird-emu-android
path: build/firebird-emu.apk
if-no-files-found: error
13 changes: 7 additions & 6 deletions .github/workflows/macOS.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ name: Build macOS

on:
push:
branches: [ master, ci/macOS ]
branches: [ master ]
pull_request:
branches: [ master, ci/macOS ]
branches: [ master ]
release:
types: [published]

jobs:
build:
name: "Build: ${{ matrix.os }}"
runs-on: ${{ matrix.os }}
name: "Qt ${{ matrix.qt }}"
runs-on: macOS-latest
strategy:
fail-fast: false
matrix:
os: [macOS-latest]
qt: [ "5.15.2", "6.4.1" ]

steps:
- name: Checkout Git Repo
Expand All @@ -26,6 +26,7 @@ jobs:
- name: Install Qt
uses: jurplel/install-qt-action@43ec12788e42f375acfcb2cec059edfb9572fbaa # v3
with:
version: "${{ matrix.qt }}"
target: desktop
setup-python: false

Expand Down Expand Up @@ -86,5 +87,5 @@ jobs:
- name: "Upload DMG"
uses: actions/upload-artifact@v3
with:
name: firebird-emu_macOS
name: "firebird-emu_macOS-Qt${{ matrix.qt }}"
path: firebird-emu_macOS.dmg
44 changes: 32 additions & 12 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,43 +2,63 @@ name: Build for Windows

on:
push:
branches: [ master, ci/windows ]
branches: [ master ]
pull_request:
branches: [ master, ci/windows ]
branches: [ master ]
release:
types: [published]

jobs:
build:
name: "Build: ${{ matrix.arch }}"
name: "Qt ${{ matrix.qt }} ${{ matrix.arch }}"
runs-on: windows-2022
strategy:
fail-fast: false
matrix:
arch:
- win32
- win64
include:
- qt: '5.15.2'
qtmaj: '5'
arch: 'win32'
- qt: '5.15.2'
qtmaj: '5'
arch: 'win64'
- qt: '6.4.1'
qtmaj: '6'
arch: 'win64'

steps:
- name: Checkout Git Repo
uses: actions/checkout@v3
with:
submodules: 'recursive'

- name: Install Qt
- name: "Install Qt ${{ matrix.qt }}"
uses: jurplel/install-qt-action@43ec12788e42f375acfcb2cec059edfb9572fbaa # v3
if: matrix.qtmaj == '5'
with:
version: '5.15.2'
version: '${{ matrix.qt }}'
host: 'windows'
target: 'desktop'
arch: '${{ matrix.arch }}_mingw81'
tools: 'tools_mingw,qt.tools.${{ matrix.arch }}_mingw810'
cache: true

- name: "Install Qt ${{ matrix.qt }}"
uses: jurplel/install-qt-action@43ec12788e42f375acfcb2cec059edfb9572fbaa # v3
if: matrix.qtmaj != '5'
with:
version: '${{ matrix.qt }}'
host: 'windows'
target: 'desktop'
arch: '${{ matrix.arch }}_mingw'
tools: 'tools_mingw90'
cache: true

- name: Fixup PATH
run: |
echo "$env:IQTA_TOOLS/mingw810_32/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "$env:IQTA_TOOLS/mingw810_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
echo "$env:IQTA_TOOLS/mingw1120_64/bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append

- name: Build firebird-emu
run: |
Expand All @@ -53,7 +73,7 @@ jobs:
- name: Upload zip
uses: actions/upload-artifact@v3
with:
name: firebird-emu-${{ matrix.arch }}
# Use a wildcard to force a subfolder
path: "build/*-emu/"
if-no-files-found: error
name: firebird-emu-Qt${{ matrix.qtmaj }}-${{ matrix.arch }}
# Use a wildcard to force a subfolder
path: "build/*-emu/"
if-no-files-found: error
2 changes: 1 addition & 1 deletion firebird.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ isEmpty(SUPPORT_LINUX) | equals(SUPPORT_LINUX, auto) {
# Localization
TRANSLATIONS += i18n/de_DE.ts i18n/fr_FR.ts i18n/pl_PL.ts

QT += core gui widgets quickwidgets
QT += core gui widgets quick
android: QT += androidextras
CONFIG += c++11

Expand Down
6 changes: 4 additions & 2 deletions lcdwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ LCDWidget::LCDWidget(QWidget *parent, Qt::WindowFlags f)

void LCDWidget::mousePressEvent(QMouseEvent *event)
{
the_qml_bridge->setTouchpadState((qreal)event->x() / width(), (qreal)event->y() / height(), true, event->button() == Qt::RightButton);
const auto pos = event->pos();
the_qml_bridge->setTouchpadState((qreal)pos.x() / width(), (qreal)pos.y() / height(), true, event->button() == Qt::RightButton);
}

void LCDWidget::mouseReleaseEvent(QMouseEvent *event)
Expand All @@ -33,7 +34,8 @@ void LCDWidget::mouseReleaseEvent(QMouseEvent *event)

void LCDWidget::mouseMoveEvent(QMouseEvent *event)
{
the_qml_bridge->setTouchpadState((qreal)event->x() / width(), (qreal)event->y() / height(), keypad.touchpad_contact, keypad.touchpad_down);
const auto pos = event->pos();
the_qml_bridge->setTouchpadState((qreal)pos.x() / width(), (qreal)pos.y() / height(), keypad.touchpad_contact, keypad.touchpad_down);
}

void LCDWidget::showEvent(QShowEvent *e)
Expand Down
16 changes: 10 additions & 6 deletions main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ static void migrateSettings()

int main(int argc, char **argv)
{
#ifdef Q_OS_ANDROID
QGuiApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
#else
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#ifdef Q_OS_ANDROID
QGuiApplication::setAttribute(Qt::AA_DisableHighDpiScaling);
#else
QGuiApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
#endif
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);

#ifdef MOBILE_UI
QGuiApplication app(argc, argv);
Expand All @@ -104,7 +106,9 @@ int main(int argc, char **argv)
QCoreApplication::setApplicationName(QStringLiteral("firebird-emu"));

// Needed for settings migration
qRegisterMetaTypeStreamOperators<KitModel>();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
qRegisterMetaTypeStreamOperators<KitModel>();
#endif
qRegisterMetaType<KitModel>();

migrateSettings();
Expand Down
27 changes: 11 additions & 16 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <QDockWidget>
#include <QShortcut>
#include <QQmlComponent>
#include <QQuickView>

#include "core/debug.h"
#include "core/emu.h"
Expand All @@ -34,14 +35,19 @@ MainWindow::MainWindow(QWidget *parent) :
ui->setupUi(this);
ui->statusBar->addWidget(&status_label);

// Create Keypad view
auto *keypadView = new QQuickView;
keypadView->setSource(QStringLiteral("qrc:/qml/qml/ScrollingKeypad.qml"));
keypadView->setResizeMode(QQuickView::SizeRootObjectToView);
auto *keypadWidget = QWidget::createWindowContainer(keypadView);
ui->keypadLayout->addWidget(keypadWidget);

// Register QtKeypadBridge for the virtual keyboard functionality
ui->keypadWidget->installEventFilter(&qt_keypad_bridge);
keypadView->installEventFilter(&qt_keypad_bridge);
ui->lcdView->installEventFilter(&qt_keypad_bridge);
lcd.installEventFilter(&qt_keypad_bridge);

ui->keypadWidget->setAttribute(Qt::WA_AcceptTouchEvents);

qml_engine = ui->keypadWidget->engine();
qml_engine = keypadView->engine();
qml_engine->addImportPath(QStringLiteral("qrc:/qml/qml"));

// Create config dialog component
Expand Down Expand Up @@ -123,7 +129,7 @@ MainWindow::MainWindow(QWidget *parent) :
languageCode.chop(3); // Chop off file extension
QLocale locale(languageCode);
QAction *action = new QAction(locale.nativeLanguageName(), ui->menuLanguage);
connect(action, &QAction::triggered, this, [this,languageCode] { this->switchTranslator(languageCode); });
connect(action, &QAction::triggered, this, [this,locale] { this->switchTranslator(locale); });
ui->menuLanguage->addAction(action);
}

Expand Down Expand Up @@ -950,14 +956,3 @@ void MainWindow::switchToMobileUI()
{
switchUIMode(true);
}

bool QQuickWidgetLessBroken::event(QEvent *event)
{
if(event->type() == QEvent::Leave)
{
QMouseEvent ev(QMouseEvent::MouseMove, QPointF(0, 0), Qt::NoButton, Qt::NoButton, Qt::NoModifier);
QQuickWidget::event(&ev);
}

return QQuickWidget::event(event);
}
19 changes: 0 additions & 19 deletions mainwindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include <QMainWindow>
#include <QSettings>
#include <QLabel>
#include <QQuickWidget>

#include "emuthread.h"
#include "fbaboutdialog.h"
Expand All @@ -15,24 +14,6 @@ namespace Ui {
class MainWindow;
}

/* QQuickWidget does not care about QEvent::Leave,
* which results in MouseArea::containsMouse to get stuck when
* the mouse leaves the widget without triggering a move outside
* the MouseArea. Work around it by translating QEvent::Leave
* to a MouseMove to (0/0). */

class QQuickWidgetLessBroken : public QQuickWidget
{
Q_OBJECT

public:
explicit QQuickWidgetLessBroken(QWidget *parent) : QQuickWidget(parent) {}
virtual ~QQuickWidgetLessBroken() {}

protected:
bool event(QEvent *event) override;
};

class MainWindow : public QMainWindow
{
Q_OBJECT
Expand Down
Loading