start daemon automatically and detached

This commit is contained in:
Jaquee
2017-02-23 19:47:58 +01:00
parent c6688dc876
commit faacd3d6a1
11 changed files with 104 additions and 115 deletions

View File

@@ -39,12 +39,14 @@ Window {
id: root
modality: Qt.ApplicationModal
flags: Qt.Window | Qt.FramelessWindowHint
property int countDown: 5;
signal rejected()
signal started();
function open() {
show()
countDown = 5;
timer.start();
}
// TODO: implement without hardcoding sizes
@@ -61,15 +63,29 @@ Window {
//anchors {fill: parent; margins: 16 }
Layout.alignment: Qt.AlignHCenter
Label {
text: qsTr("Daemon doesn't appear to be running")
Timer {
id: timer
interval: 1000;
running: false;
repeat: true
onTriggered: {
countDown--;
if(countDown < 0){
running = false;
// Start daemon
root.close()
appWindow.startDaemon(persistentSettings.daemonFlags);
root.started();
}
}
}
Text {
text: qsTr("Starting Monero daemon in %1 seconds").arg(countDown);
font.pixelSize: 18
Layout.alignment: Qt.AlignHCenter
Layout.columnSpan: 2
Layout.fillWidth: true
horizontalAlignment: Text.AlignHCenter
font.pixelSize: 24
font.family: "Arial"
color: "#555555"
}
}
@@ -81,57 +97,39 @@ Window {
MoneroComponents.StandardButton {
id: okButton
width: 120
visible:false
fontSize: 14
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
text: qsTr("Start daemon")
text: qsTr("Start daemon (%1)").arg(countDown)
KeyNavigation.tab: cancelButton
onClicked: {
timer.stop();
root.close()
appWindow.startDaemon(daemonFlags.text);
appWindow.startDaemon(persistentSettings.daemonFlags);
root.started()
}
}
MoneroComponents.StandardButton {
id: cancelButton
width: 120
fontSize: 14
shadowReleasedColor: "#FF4304"
shadowPressedColor: "#B32D00"
releasedColor: "#FF6C3C"
pressedColor: "#FF4304"
text: qsTr("Cancel")
text: qsTr("Use custom settings")
onClicked: {
timer.stop();
root.close()
root.rejected()
}
}
}
RowLayout {
id: advancedRow
MoneroComponents.Label {
id: daemonFlagsLabel
color: "#4A4949"
text: qsTr("Daemon startup flags") + translationManager.emptyString
fontSize: 16
}
MoneroComponents.LineEdit {
id: daemonFlags
Layout.preferredWidth: 200
Layout.fillWidth: true
text: appWindow.persistentSettings.daemonFlags;
placeholderText: qsTr("(optional)")
}
}
}
}

View File

@@ -61,7 +61,7 @@ Window {
id: messageTitle
text: "Please wait..."
font {
pointSize: 22
pixelSize: 22
}
horizontalAlignment: Text.AlignHCenter
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter
@@ -72,7 +72,7 @@ Window {
Text {
id: heightProgress
font {
pointSize: 18
pixelSize: 18
}
horizontalAlignment: Text.AlignHCenter
Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter