Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various WIP improvements for Mobile #258

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
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
52 changes: 41 additions & 11 deletions qml/ConfigPageDebug.qml
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
import QtQuick 2.0
import QtQuick 2.7
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0
import Firebird.Emu 1.0
import Firebird.UIComponents 1.0

ColumnLayout {
ScrollView {
id: sv
// TODO: Find out why this breaks on desktop
flickableItem.interactive: Emu.isMobile()

ColumnLayout {
spacing: 5
width: sv.viewport.width

FBLabel {
text: qsTr("Remote GDB debugging")
font.pixelSize: TextMetrics.title2Size
font.pixelSize: TextSize.title2Size
Layout.topMargin: 5
Layout.bottomMargin: 5
}
Expand All @@ -18,7 +24,7 @@ ColumnLayout {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: qsTr("If enabled, a remote GDB debugger can be connected to the port and be used for debugging.")
font.pixelSize: TextMetrics.normalSize
font.pixelSize: TextSize.normalSize
}

RowLayout {
Expand All @@ -41,7 +47,7 @@ ColumnLayout {

SpinBox {
id: gdbPort
Layout.maximumWidth: TextMetrics.normalSize * 8
Layout.maximumWidth: TextSize.normalSize * 8

minimumValue: 1
maximumValue: 65535
Expand All @@ -58,7 +64,7 @@ ColumnLayout {
Layout.fillWidth: true
text: qsTr("Remote access to internal debugger")
wrapMode: Text.WordWrap
font.pixelSize: TextMetrics.title2Size
font.pixelSize: TextSize.title2Size
Layout.topMargin: 10
Layout.bottomMargin: 5
}
Expand All @@ -67,7 +73,7 @@ ColumnLayout {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: qsTr("Enable this to access the internal debugger via TCP (telnet/netcat), like for firebird-send.")
font.pixelSize: TextMetrics.normalSize
font.pixelSize: TextSize.normalSize
}

RowLayout {
Expand All @@ -89,7 +95,7 @@ ColumnLayout {

SpinBox {
id: rdbPort
Layout.maximumWidth: TextMetrics.normalSize * 8
Layout.maximumWidth: TextSize.normalSize * 8

minimumValue: 1
maximumValue: 65535
Expand All @@ -104,7 +110,7 @@ ColumnLayout {

FBLabel {
text: qsTr("Enter into Debugger")
font.pixelSize: TextMetrics.title2Size
font.pixelSize: TextSize.title2Size
Layout.topMargin: 5
Layout.bottomMargin: 5
}
Expand All @@ -113,7 +119,7 @@ ColumnLayout {
Layout.fillWidth: true
wrapMode: Text.WordWrap
text: qsTr("Configure which situations cause the emulator to trap into the debugger.")
font.pixelSize: TextMetrics.normalSize
font.pixelSize: TextSize.normalSize
}

CheckBox {
Expand Down Expand Up @@ -151,7 +157,31 @@ ColumnLayout {
}
}

Item {
FBLabel {
text: qsTr("Debug Messages")
font.pixelSize: TextSize.title2Size
Layout.topMargin: 5
Layout.bottomMargin: 5
visible: debugMessages.visible
}

TextArea {
id: debugMessages
Layout.fillHeight: true
Layout.fillWidth: true
Layout.minimumHeight: TextSize.normalSize * 12
font.pixelSize: TextSize.normalSize
font.family: "monospace"
readOnly: true
visible: Emu.isMobile()

Connections {
target: Emu
enabled: debugMessages.visible
function onDebugStr(str) {
debugMessages.insert(debugMessages.length, str);
}
}
}
}
}
34 changes: 25 additions & 9 deletions qml/DrawerButton.qml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Firebird.UIComponents 1.0
Rectangle {
property alias icon: image.source
property alias title: label.text
property alias subtitle: subtitleLabel.text
property alias borderTopVisible: borderTop.visible
property alias borderBottomVisible: borderBottom.visible
property bool disabled: false
Expand Down Expand Up @@ -76,19 +77,34 @@ Rectangle {
fillMode: Image.PreserveAspectFit
}

FBLabel {
id: label

color: "black"

x: image.x + image.width + spacing

ColumnLayout {
anchors {
margins: spacing
left: image.right
top: parent.top
bottom: parent.bottom
right: parent.right
}

font.pixelSize: TextMetrics.title2Size
verticalAlignment: Text.AlignVCenter
FBLabel {
id: label

color: "black"

font.pixelSize: TextMetrics.title2Size
verticalAlignment: Text.AlignVCenter
Layout.fillWidth: true
Layout.fillHeight: true
}

FBLabel {
id: subtitleLabel
elide: "ElideRight"

font.pixelSize: TextMetrics.normalSize * 0.8
Layout.fillWidth: true
Layout.fillHeight: true
visible: text !== ""
}
}
}
1 change: 1 addition & 0 deletions qml/Firebird/Emu/Emu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,5 @@ QtObject {
function setButtonState(keymap_id, down) {}
function toLocalFile(url) { return url; }
function basename(path) { return path; }
signal debugStr
}
3 changes: 2 additions & 1 deletion qml/Firebird/UIComponents/FileSelect.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,12 @@ RowLayout {
id: dialogLoader
active: false
sourceComponent: FileDialog {
folder: Emu.dir(filePath)
folder: filePath ? Emu.dir(filePath) : Global.lastFileDialogDir
// If save dialogs are not supported, force an open dialog
selectExisting: parent.selectExisting || !Emu.saveDialogSupported()
onAccepted: {
filePath = Emu.toLocalFile(fileUrl);
Global.lastFileDialogDir = Emu.dir(filePath);
forceRefresh++;
}
}
Expand Down
6 changes: 6 additions & 0 deletions qml/Firebird/UIComponents/Global.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
pragma Singleton
import QtQuick 2.0

QtObject {
property string lastFileDialogDir: ""
}
2 changes: 2 additions & 0 deletions qml/Firebird/UIComponents/qmldir
Original file line number Diff line number Diff line change
Expand Up @@ -9,3 +9,5 @@ FBLink 1.0 FBLink.qml
Toast 1.0 Toast.qml
VerticalSwipeBar 1.0 VerticalSwipeBar.qml
singleton TextMetrics 1.0 TextMetrics.qml
singleton TextSize 1.0 TextMetrics.qml
singleton Global 1.0 Global.qml
1 change: 1 addition & 0 deletions qml/MobileUIDrawer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Rectangle {
id: restartButton

title: qsTr("Start")
subtitle: qsTr("Kit: ") + Emu.kits.getDataRow(Emu.kitIndexForID(Emu.defaultKit), KitModel.NameRole)
icon: "qrc:/icons/resources/icons/edit-bomb.png"

onClicked: {
Expand Down
2 changes: 2 additions & 0 deletions qmlbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -430,6 +430,7 @@ void QMLBridge::setActive(bool b)
connect(&emu_thread, SIGNAL(started(bool)), this, SLOT(started(bool)), Qt::QueuedConnection);
connect(&emu_thread, SIGNAL(resumed(bool)), this, SLOT(resumed(bool)), Qt::QueuedConnection);
connect(&emu_thread, SIGNAL(suspended(bool)), this, SLOT(suspended(bool)), Qt::QueuedConnection);
connect(&emu_thread, SIGNAL(debugStr(QString)), this, SIGNAL(debugStr(QString)), Qt::QueuedConnection);

// We might have missed some events.
turboModeChanged();
Expand All @@ -447,6 +448,7 @@ void QMLBridge::setActive(bool b)
disconnect(&emu_thread, SIGNAL(started(bool)), this, SLOT(started(bool)));
disconnect(&emu_thread, SIGNAL(resumed(bool)), this, SLOT(resumed(bool)));
disconnect(&emu_thread, SIGNAL(suspended(bool)), this, SLOT(suspended(bool)));
disconnect(&emu_thread, SIGNAL(debugStr(QString)), this, SIGNAL(debugStr(QString)));
}

is_active = b;
Expand Down
2 changes: 2 additions & 0 deletions qmlbridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@ public slots:
void touchpadStateChanged(qreal x, qreal y, bool contact, bool down);
void buttonStateChanged(int id, bool state);

void debugStr(QString str);

/* Never called. Used as NOTIFY value for writable properties
* that aren't used outside of QML. */
void neverEmitted();
Expand Down
1 change: 1 addition & 0 deletions resources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
<file>qml/MobileUIDrawer.qml</file>
<file>qml/DrawerButton.qml</file>
<file>qml/Firebird/UIComponents/VerticalSwipeBar.qml</file>
<file>qml/Firebird/UIComponents/Global.qml</file>
<file>qml/FlashDialog.qml</file>
<file>qml/Firebird/UIComponents/IconButton.qml</file>
</qresource>
Expand Down
Loading