Skip to content
Merged
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
10 changes: 7 additions & 3 deletions console_backend/src/cli_options.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,9 @@ pub struct CliOptions {
#[clap(long = "show-file-connection")]
pub show_file_connection: bool,

/// Don't use opengl in plots.
#[clap(long = "no-opengl", parse(from_flag = Not::not))]
pub no_opengl: bool,
/// Use OpenGL, plots will become optimized for efficiency not aesthetics and require less system resources.
#[clap(long = "use-opengl", parse(from_flag = Not::not))]
pub use_opengl: bool,

/// Change the refresh rate of the plots.
#[clap(long = "refresh-rate", validator(is_refresh_rate))]
Expand All @@ -140,6 +140,10 @@ pub struct CliOptions {
#[clap(long = "show-csv-log")]
pub show_csv_log: bool,

/// Don't show prompts about firmware/console updates.
#[clap(long = "no-prompts")]
pub no_prompts: bool,

/// Set the height of the main window.
#[clap(long)]
pub height: Option<u32>,
Expand Down
1 change: 1 addition & 0 deletions resources/Constants/Constants.qml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ QtObject {
readonly property int staticTimerIntervalRate: 5 // 5 Hz
readonly property int staticTableTimerIntervalRate: 10 // 10 Hz
readonly property int staticTimerSlowIntervalRate: 2 // 2 Hz
readonly property int staticTimerNotificationIntervalRate: 1 // 1 Hz
readonly property string monoSpaceFont: "Courier New"
readonly property string fontFamily: "Roboto Condensed"
property FontLoader robotoCondensedLightFont
Expand Down
14 changes: 13 additions & 1 deletion resources/Constants/Globals.qml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ pragma Singleton
QtObject {
property string consoleVersion: "0.0.0"
property int currentRefreshRate: 5 // 5 Hz
property bool useOpenGL: true
property bool useOpenGL: false
property bool showPrompts: true
property int initialMainTabIndex: 0 // Tracking
property int initialSubTabIndex: -1 // Not triggered unless greater than -1. Defaults to first tab.
property bool showCsvLog: false
Expand All @@ -18,11 +19,22 @@ QtObject {
property var tablesWithHighlights: []
property var currentSelectedTable: null
property bool showFileConnection: false
property QtObject updateTabData

function clearHighlightedRows() {
for (var i in tablesWithHighlights) {
tablesWithHighlights[i].selectedRow = -1;
}
}

updateTabData: QtObject {
property bool consoleOutdated: false
property bool fwV2Outdated: false
property bool fwOutdated: false
property string fwVersionCurrent: ""
property string fwVersionLatest: ""
property string consoleVersionCurrent: ""
property string consoleVersionLatest: ""
}

}
222 changes: 222 additions & 0 deletions resources/UpdateNotifications.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
import "Constants"
import QtQuick 2.5
import QtQuick.Controls 2.15
import QtQuick.Layouts 1.15
import SwiftConsole 1.0

Item {
id: updateTab

property bool consoleVersionDialogAlready: false
property bool firmwareVersionDialogAlready: false
property bool v2DownloadDialogAlready: false
property bool popupLock: false
property int dialogWidthDivisor: 3
property int dialogHeightDivisor: 2

function consoleOutdatedDialogText(currentVersion, latestVersion) {
let text = "";
text += "Current Console version:\n";
text += "\t" + currentVersion + "\n";
text += "Latest Console version:\n";
text += "\t" + latestVersion;
return text;
}

function firmwareV2OutdatedDialogText() {
let text = "";
text += "Upgrading to firmware v2.1.0 or later requires that the device be running ";
text += "firmware v2.0.0 or later. Please upgrade to firmware version 2.0.0.\n\n";
text += "Would you like to download firmware version v2.0.0 now?\n";
return text;
}

function firmwareOutdatedDialogText(latestVersion) {
let text = "";
text += "New Piksi firmware available.\n\n";
text += "Please use the Update tab to update.\n\n";
text += "Newest Firmware Version:\n";
text += "\t" + latestVersion + "\n";
return text;
}

Dialog {
id: v2DownloadDialog

anchors.centerIn: parent
width: Globals.width / dialogWidthDivisor
height: Globals.height / dialogHeightDivisor
x: Globals.width / 2 - width / 2
y: Globals.height / 2 - height / 2
modal: true
focus: true
title: "Update to v2.0.0"
standardButtons: Dialog.Ok | Dialog.Cancel
onAccepted: {
let downloadLatestFirmware = true;
let updateFirmware = false;
let sendFileToDevice = false;
let serialPromptConfirm = false;
let updateLocalFilepath = null;
let downloadDirectory = null;
let fileioLocalFilepath = null;
let fileioDestinationFilepath = null;
let updateLocalFilename = null;
data_model.update_tab([downloadLatestFirmware, updateFirmware, sendFileToDevice, serialPromptConfirm], updateLocalFilepath, downloadDirectory, fileioLocalFilepath, fileioDestinationFilepath, updateLocalFilename);
}

contentItem: Label {
text: firmwareV2OutdatedDialogText()
verticalAlignment: Qt.AlignVCenter
elide: Text.ElideRight
clip: true
wrapMode: Text.Wrap
}

}

Dialog {
id: consoleVersionDialog

property alias versionText: versionTextLabel.text

anchors.centerIn: parent
width: Globals.width / dialogWidthDivisor
height: Globals.height / dialogHeightDivisor
x: Globals.width / 2 - width / 2
y: Globals.height / 2 - height / 2
modal: true
focus: true
title: "Swift Console Outdated"
standardButtons: Dialog.Close
onRejected: {
popupLock = false;
}

contentItem: ColumnLayout {
anchors.centerIn: parent
spacing: 0

Label {
Layout.fillWidth: true
wrapMode: Text.Wrap
text: {
let text = ``;
text += `Your console is out of date and may be incompatible with current firmware. `;
text += `We highly recommend upgrading to ensure proper behavior.`;
text;
}
}

Label {
readonly property string website: Constants.logoPopup.aboutMe.supportWebsite
readonly property string websiteDisplay: website.slice(12)

Layout.fillWidth: true
wrapMode: Text.Wrap
text: `Please visit <a href='${website}'>${websiteDisplay}</a> to download the latest version.\n\n`
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had to split this into multiple labels to get this href too work for some reason.

onLinkActivated: {
Qt.openUrlExternally(website);
}
}

Label {
id: versionTextLabel

Layout.fillWidth: true
wrapMode: Text.Wrap
}

}

}

Dialog {
id: fwVersionDialog

anchors.centerIn: parent
width: Globals.width / dialogWidthDivisor
height: Globals.height / dialogHeightDivisor
x: Globals.width / 2 - width / 2
y: Globals.height / 2 - height / 2
modal: true
focus: true
title: "Firmware Update"
standardButtons: Dialog.Close
onRejected: {
popupLock = false;
}

contentItem: Label {
verticalAlignment: Qt.AlignVCenter
elide: Text.ElideRight
clip: true
wrapMode: Text.Wrap
}

}

Timer {
id: timer

property var currentCallback: null

function startTimer(callback) {
currentCallback = callback;
timer.start();
}

interval: Constants.updateTab.popupDelayMilliseconds
repeat: false
onTriggered: {
currentCallback();
}
}

Timer {
interval: Utils.hzToMilliseconds(Constants.staticTimerNotificationIntervalRate)
running: true
repeat: true
onTriggered: {
if (!popupLock && Globals.showPrompts) {
if (Globals.updateTabData.consoleVersionLatest) {
if (!consoleVersionDialogAlready) {
if (Globals.updateTabData.consoleOutdated) {
popupLock = true;
consoleVersionDialog.versionText = consoleOutdatedDialogText(Globals.updateTabData.consoleVersionCurrent, Globals.updateTabData.consoleVersionLatest);
timer.startTimer(consoleVersionDialog.open);
}
consoleVersionDialogAlready = true;
return ;
}
}
if (Globals.updateTabData.fwVersionCurrent) {
if (!v2DownloadDialogAlready) {
if (Globals.updateTabData.fwV2Outdated) {
popupLock = true;
timer.startTimer(v2DownloadDialog.open);
}
v2DownloadDialogAlready = true;
return ;
}
} else {
// This will clear between device connections.
v2DownloadDialogAlready = false;
firmwareVersionDialogAlready = false;
return ;
}
if (Globals.updateTabData.fwVersionCurrent && Globals.updateTabData.fwVersionLatest) {
if (!firmwareVersionDialogAlready && !Globals.updateTabData.fwV2Outdated) {
if (Globals.updateTabData.fwOutdated) {
popupLock = true;
fwVersionDialog.contentItem.text = firmwareOutdatedDialogText(Globals.updateTabData.fwVersionLatest);
timer.startTimer(fwVersionDialog.open);
}
firmwareVersionDialogAlready = true;
}
}
}
}
}

}
Loading