diff --git a/qml/ConfigPageDebug.qml b/qml/ConfigPageDebug.qml index a55e8ee4..62d8aa0a 100644 --- a/qml/ConfigPageDebug.qml +++ b/qml/ConfigPageDebug.qml @@ -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 } @@ -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 { @@ -41,7 +47,7 @@ ColumnLayout { SpinBox { id: gdbPort - Layout.maximumWidth: TextMetrics.normalSize * 8 + Layout.maximumWidth: TextSize.normalSize * 8 minimumValue: 1 maximumValue: 65535 @@ -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 } @@ -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 { @@ -89,7 +95,7 @@ ColumnLayout { SpinBox { id: rdbPort - Layout.maximumWidth: TextMetrics.normalSize * 8 + Layout.maximumWidth: TextSize.normalSize * 8 minimumValue: 1 maximumValue: 65535 @@ -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 } @@ -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 { @@ -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); + } + } } } +} diff --git a/qml/DrawerButton.qml b/qml/DrawerButton.qml index 7dc64c35..ff405f69 100644 --- a/qml/DrawerButton.qml +++ b/qml/DrawerButton.qml @@ -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 @@ -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 !== "" + } } } diff --git a/qml/Firebird/Emu/Emu.qml b/qml/Firebird/Emu/Emu.qml index ef3d397e..3136fd87 100644 --- a/qml/Firebird/Emu/Emu.qml +++ b/qml/Firebird/Emu/Emu.qml @@ -25,4 +25,5 @@ QtObject { function setButtonState(keymap_id, down) {} function toLocalFile(url) { return url; } function basename(path) { return path; } + signal debugStr } diff --git a/qml/Firebird/UIComponents/FileSelect.qml b/qml/Firebird/UIComponents/FileSelect.qml index 9692a728..a24a6926 100644 --- a/qml/Firebird/UIComponents/FileSelect.qml +++ b/qml/Firebird/UIComponents/FileSelect.qml @@ -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++; } } diff --git a/qml/Firebird/UIComponents/Global.qml b/qml/Firebird/UIComponents/Global.qml new file mode 100644 index 00000000..77d27d71 --- /dev/null +++ b/qml/Firebird/UIComponents/Global.qml @@ -0,0 +1,6 @@ +pragma Singleton +import QtQuick 2.0 + +QtObject { + property string lastFileDialogDir: "" +} diff --git a/qml/Firebird/UIComponents/qmldir b/qml/Firebird/UIComponents/qmldir index d3353c64..e6c1d0e9 100644 --- a/qml/Firebird/UIComponents/qmldir +++ b/qml/Firebird/UIComponents/qmldir @@ -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 diff --git a/qml/MobileUIDrawer.qml b/qml/MobileUIDrawer.qml index bde2437c..85ad7982 100644 --- a/qml/MobileUIDrawer.qml +++ b/qml/MobileUIDrawer.qml @@ -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: { diff --git a/qmlbridge.cpp b/qmlbridge.cpp index 2b916c31..a7bea147 100644 --- a/qmlbridge.cpp +++ b/qmlbridge.cpp @@ -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(); @@ -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; diff --git a/qmlbridge.h b/qmlbridge.h index 606a2ada..aafccff4 100644 --- a/qmlbridge.h +++ b/qmlbridge.h @@ -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(); diff --git a/resources.qrc b/resources.qrc index 7008cea3..5ba3d243 100644 --- a/resources.qrc +++ b/resources.qrc @@ -58,6 +58,7 @@ qml/MobileUIDrawer.qml qml/DrawerButton.qml qml/Firebird/UIComponents/VerticalSwipeBar.qml + qml/Firebird/UIComponents/Global.qml qml/FlashDialog.qml qml/Firebird/UIComponents/IconButton.qml