Add a warning when closing the dashboard
This commit is contained in:
+19
-1
@@ -36,7 +36,25 @@ Kirigami.ApplicationWindow {
|
||||
}
|
||||
}
|
||||
|
||||
onClosing: Qt.quit()
|
||||
onClosing: (close) => {
|
||||
if (WivrnServer.ownServer)
|
||||
{
|
||||
close.accepted = false;
|
||||
confirm_close.open();
|
||||
} else {
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
||||
|
||||
Kirigami.PromptDialog {
|
||||
id: confirm_close
|
||||
title: i18n("Quit WiVRn")
|
||||
subtitle: i18n("The WiVRn server is still running.\nClosing the window will terminate it.")
|
||||
iconName: "dialog-warning"
|
||||
popupType: Controls.Popup.Native
|
||||
standardButtons: Kirigami.Dialog.Ok | Kirigami.Dialog.Cancel
|
||||
onAccepted: Qt.quit()
|
||||
}
|
||||
|
||||
width: 900
|
||||
height: 800
|
||||
|
||||
@@ -137,10 +137,12 @@ void wivrn_server::start_server()
|
||||
qDebug() << "Server finished before registering on dbus";
|
||||
serverStatusChanged(m_serverStatus = Status::FailedToStart);
|
||||
}
|
||||
ownServerChanged();
|
||||
}
|
||||
});
|
||||
|
||||
server_process->start(server_path(), QApplication::arguments().mid(1));
|
||||
ownServerChanged();
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
@@ -172,6 +172,7 @@ public:
|
||||
|
||||
// Server information
|
||||
Q_PROPERTY(Status serverStatus READ serverStatus NOTIFY serverStatusChanged)
|
||||
Q_PROPERTY(bool ownServer READ ownServer NOTIFY ownServerChanged)
|
||||
Q_PROPERTY(bool headsetConnected READ isHeadsetConnected NOTIFY headsetConnectedChanged)
|
||||
Q_PROPERTY(bool sessionRunning READ isSessionRunning NOTIFY sessionRunningChanged)
|
||||
Q_PROPERTY(QString jsonConfiguration READ jsonConfiguration WRITE setJsonConfiguration NOTIFY jsonConfigurationChanged)
|
||||
@@ -221,6 +222,11 @@ public:
|
||||
return m_serverStatus;
|
||||
}
|
||||
|
||||
bool ownServer() const
|
||||
{
|
||||
return server_process;
|
||||
}
|
||||
|
||||
bool isHeadsetConnected() const
|
||||
{
|
||||
return m_headsetConnected;
|
||||
@@ -379,6 +385,7 @@ private:
|
||||
|
||||
Q_SIGNALS:
|
||||
void serverStatusChanged(Status);
|
||||
void ownServerChanged();
|
||||
void headsetConnectedChanged(bool);
|
||||
void sessionRunningChanged(bool);
|
||||
void jsonConfigurationChanged(QString);
|
||||
|
||||
Reference in New Issue
Block a user