refactor: Gui control if the server first shown message is shown with its own setting

This commit is contained in:
sithlord48 2025-11-30 14:20:32 -05:00 committed by Chris Rizzitello
parent 8e8ab25fd0
commit df78f0757e
3 changed files with 9 additions and 3 deletions

View file

@ -105,6 +105,7 @@ This section contains options used by the GUI it will begin with `[gui]`
| windowGeometry | QRect | Geometry of the window used to restore the window geometry after exiting the app |
| showGenericClientFailureDialog | `true` or `false` | When `true` client connection errors will not show popup error messages [default: true] |
| shownFirstConnectedMessage | `true` or `false` | When `true` GUI has shown the user the message for connecting the first time [default: false] |
| shownServerFirstStartMessage | `true` or `false` | When `true` GUI has shown the user the Deskflow server is now running message [default: false] |
### Log

View file

@ -74,6 +74,7 @@ public:
inline static const auto WindowGeometry = QStringLiteral("gui/windowGeometry");
inline static const auto ShowGenericClientFailureDialog = QStringLiteral("gui/showGenericClientFailureDialog");
inline static const auto ShownFirstConnectedMessage = QStringLiteral("gui/shownFirstConnectedMessage");
inline static const auto ShownServerFirstStartMessage = QStringLiteral("gui/shownServerFirstStartMessage");
};
struct Log
{
@ -213,6 +214,7 @@ private:
, Settings::Gui::WindowGeometry
, Settings::Gui::ShowGenericClientFailureDialog
, Settings::Gui::ShownFirstConnectedMessage
, Settings::Gui::ShownServerFirstStartMessage
, Settings::Security::Certificate
, Settings::Security::CheckPeers
, Settings::Security::KeySize
@ -225,6 +227,7 @@ private:
inline static const QStringList m_defaultFalseValues = {
Settings::Gui::Autohide
, Settings::Gui::ShownFirstConnectedMessage
, Settings::Gui::ShownServerFirstStartMessage
, Settings::Core::StartedBefore
, Settings::Core::PreventSleep
, Settings::Core::UseWlClipboard

View file

@ -532,7 +532,6 @@ void MainWindow::updateModeControls(bool serverMode)
// unrecognized client tries to connect.
const auto startedBefore = Settings::value(Settings::Core::StartedBefore).toBool();
if (!startedBefore && !m_coreProcess.isStarted()) {
qDebug() << "auto-starting core server for first time";
m_coreProcess.start();
}
}
@ -957,11 +956,14 @@ void MainWindow::coreProcessStateChanged(CoreProcessState state)
{
updateStatus();
if (state == CoreProcessState::Started && !Settings::value(Settings::Core::StartedBefore).toBool()) {
if (state == CoreProcessState::Started) {
qDebug() << "recording that core has started";
Settings::setValue(Settings::Core::StartedBefore, true);
if (m_coreProcess.mode() == CoreMode::Server) {
if (m_coreProcess.mode() == CoreMode::Server &&
!Settings::value(Settings::Gui::ShownServerFirstStartMessage).toBool()) {
qDebug() << "starting core server for first time";
messages::showFirstServerStartMessage(this);
Settings::setValue(Settings::Gui::ShownServerFirstStartMessage, true);
}
}