From 00efaedf4e328604598975a07a497d1ce769bb19 Mon Sep 17 00:00:00 2001 From: Samuel Fadel Date: Mon, 29 Feb 2016 23:45:38 -0300 Subject: Added dialog for saving screenshots with a prefix. --- main_view.qml | 43 ++++++++++++++++++++++++++++++++----------- 1 file changed, 32 insertions(+), 11 deletions(-) (limited to 'main_view.qml') diff --git a/main_view.qml b/main_view.qml index 66fdf44..6cd54ae 100644 --- a/main_view.qml +++ b/main_view.qml @@ -464,22 +464,45 @@ ApplicationWindow { } } - Action { - id: screenshotAction - text: "Save screenshot" - shortcut: "Ctrl+Shift+S" - onTriggered: { + Dialog { + id: prefixDialog + title: "Save screenshot" + standardButtons: StandardButton.Save | StandardButton.Cancel + + TextField { + id: prefixTextField + placeholderText: "Enter prefix" + } + + onAccepted: { + var prefix = prefixTextField.text; + if (prefix.length == 0) { + prefix = "screenshot"; + } + mainView.grabToImage(function(result) { - result.saveToFile("screenshot-main.png"); + result.saveToFile(prefix + "-main.png"); }); bottomViewCP.grabToImage(function(result) { - result.saveToFile("screenshot-bottom-cp.png"); + result.saveToFile(prefix + "-bottom-cp.png"); }); bottomViewRP.grabToImage(function(result) { - result.saveToFile("screenshot-bottom-rp.png"); + result.saveToFile(prefix + "-bottom-rp.png"); }); + + prefixTextField.text = ""; + } + } + + Action { + id: screenshotAction + text: "Save screenshot" + shortcut: "Ctrl+Shift+S" + onTriggered: { + prefixDialog.open(); + prefixTextField.forceActiveFocus(); } } @@ -487,9 +510,7 @@ ApplicationWindow { id: savePlotAction text: "&Save data" shortcut: "Ctrl+S" - onTriggered: { - Main.saveData() - } + onTriggered: Main.saveData() } Action { -- cgit v1.2.3