Skip to content

Commit

Permalink
Add button to leave Press-to-Test mode
Browse files Browse the repository at this point in the history
One click to send the "Press-to-Test/Exit Test Mode.tns" file.
Also creates the directory if necessary.
  • Loading branch information
Vogtinator committed Oct 13, 2024
1 parent d51aac5 commit 8e160eb
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 5 deletions.
2 changes: 2 additions & 0 deletions mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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);
Expand Down
6 changes: 6 additions & 0 deletions mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,7 @@
<addaction name="actionDebugger"/>
<addaction name="separator"/>
<addaction name="actionXModem"/>
<addaction name="actionLeavePTT"/>
<addaction name="actionSwitch_to_Mobile_UI"/>
<addaction name="separator"/>
<addaction name="menuLanguage"/>
Expand Down Expand Up @@ -662,6 +663,11 @@
<string>Switch to Mobile UI</string>
</property>
</action>
<action name="actionLeavePTT">
<property name="text">
<string>Leave &amp;PTT</string>
</property>
</action>
</widget>
<customwidgets>
<customwidget>
Expand Down
19 changes: 14 additions & 5 deletions qml/ConfigPageFileTransfer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
}

Expand Down Expand Up @@ -99,6 +101,13 @@ ColumnLayout {
}
}

ProgressBar {
id: transferProgress
Layout.fillWidth: true
minimumValue: 0
maximumValue: 100
}

FBLabel {
text: qsTr("Target Directory")
font.pixelSize: TextMetrics.title2Size
Expand Down
6 changes: 6 additions & 0 deletions qmlbridge.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand Down
1 change: 1 addition & 0 deletions qmlbridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 8e160eb

Please sign in to comment.