diff --git a/mainwindow.cpp b/mainwindow.cpp
index 4d82dfaa..1a8a577d 100644
--- a/mainwindow.cpp
+++ b/mainwindow.cpp
@@ -98,6 +98,7 @@ MainWindow::MainWindow(QWidget *parent) :
connect(&lcd, SIGNAL(closed()), ui->actionLCD_Window, SLOT(toggle()));
connect(ui->actionXModem, SIGNAL(triggered()), this, SLOT(xmodemSend()));
connect(ui->actionSwitch_to_Mobile_UI, SIGNAL(triggered()), this, SLOT(switchToMobileUI()));
+ connect(ui->actionLeavePTT, &QAction::triggered, the_qml_bridge, &QMLBridge::sendExitPTT);
ui->actionConnect->setShortcut(QKeySequence(Qt::Key_F10));
ui->actionConnect->setAutoRepeat(false);
@@ -495,6 +496,7 @@ void MainWindow::updateUIActionState(bool emulation_running)
ui->actionConnect->setEnabled(emulation_running);
ui->actionDebugger->setEnabled(emulation_running);
ui->actionXModem->setEnabled(emulation_running);
+ ui->actionLeavePTT->setEnabled(emulation_running);
ui->actionSuspend->setEnabled(emulation_running);
ui->actionSuspend_to_file->setEnabled(emulation_running);
diff --git a/mainwindow.ui b/mainwindow.ui
index 2daea3ba..ddda493c 100644
--- a/mainwindow.ui
+++ b/mainwindow.ui
@@ -451,6 +451,7 @@
+
@@ -662,6 +663,11 @@
Switch to Mobile UI
+
+
+ Leave &PTT
+
+
diff --git a/qml/ConfigPageFileTransfer.qml b/qml/ConfigPageFileTransfer.qml
index e11fb638..0b0b77ea 100644
--- a/qml/ConfigPageFileTransfer.qml
+++ b/qml/ConfigPageFileTransfer.qml
@@ -61,11 +61,13 @@ ColumnLayout {
}
}
- ProgressBar {
- id: transferProgress
- Layout.fillWidth: true
- minimumValue: 0
- maximumValue: 100
+ Button {
+ text: qsTr("Leave Press-to-Test mode")
+ Layout.topMargin: 5
+ Layout.bottomMargin: 5
+ onClicked: {
+ Emu.sendExitPTT();
+ }
}
}
@@ -99,6 +101,13 @@ ColumnLayout {
}
}
+ ProgressBar {
+ id: transferProgress
+ Layout.fillWidth: true
+ minimumValue: 0
+ maximumValue: 100
+ }
+
FBLabel {
text: qsTr("Target Directory")
font.pixelSize: TextMetrics.title2Size
diff --git a/qmlbridge.cpp b/qmlbridge.cpp
index b4812c80..d0c11b1c 100644
--- a/qmlbridge.cpp
+++ b/qmlbridge.cpp
@@ -283,6 +283,12 @@ void QMLBridge::sendFile(QUrl url, QString dir)
usblink_queue_put_file(local.toStdString(), remote.toStdString(), QMLBridge::usblink_progress_changed, this);
}
+void QMLBridge::sendExitPTT()
+{
+ usblink_queue_new_dir("/Press-to-Test", nullptr, nullptr);
+ usblink_queue_put_file(std::string(), "/Press-to-Test/Exit Test Mode.tns", QMLBridge::usblink_progress_changed, this);
+}
+
QString QMLBridge::basename(QString path)
{
if(path.isEmpty())
diff --git a/qmlbridge.h b/qmlbridge.h
index bac8576d..606a2ada 100644
--- a/qmlbridge.h
+++ b/qmlbridge.h
@@ -86,6 +86,7 @@ class QMLBridge : public QObject
Q_INVOKABLE bool isMobile();
Q_INVOKABLE void sendFile(QUrl url, QString dir);
+ Q_INVOKABLE void sendExitPTT();
// Various utility functions
Q_INVOKABLE QString basename(QString path);