Add a warning when closing the dashboard

This commit is contained in:
Patrick Nicolas
2026-02-02 10:45:45 +01:00
parent 18b00fde24
commit d5e4e3cfce
3 changed files with 28 additions and 1 deletions
+19 -1
View File
@@ -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
+2
View File
@@ -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;
+7
View File
@@ -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);