deskflow/src/gui/src/SetupWizard.cpp
Nick Bolton 157fe818d8
Refactor local/global save/load and show dev thanks message (#7423)
* WIP: Show dev thanks message

* Improve error messages and guard license code

* Print core command

* Allow license tests when licensing disabled by default

* Don't check invalid serial key

* Fixed typo

* Add error checking

* Use shared ptr instead of static deps

* Actually save and load the setting

* Add dev thanks vars to CI

* Show thanks message after connected

* Refactor hack-job of local/global save/load to remove coupling and use Qt events system

* Simplify config loading

* Overloads for optionals

* Fixed global config scope not loaded

* Save message state before showing to avoid multiple messages

* Update ChangeLog

* Fixed lint warnings

* Make function const

* Reduce verbosity

* Remove dead code, show version on start, tidy up lint warnings

* Make product name code safer

* Connect on enter press

* Only show server specific wording when on server

* Add emit commands

* Log info and error

* Remove deaad code

* Remove test member

* Disable start context menu action unless usable

* Show more relvant connect message

* Fixed close to tray not applied, and simplified restart core logic

* Remove redundant include
2024-08-03 01:17:29 +01:00

52 lines
1.7 KiB
C++

/*
* synergy -- mouse and keyboard sharing utility
* Copyright (C) 2012 Symless Ltd.
*
* This package is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* found in the file LICENSE that should have accompanied this file.
*
* This package is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SetupWizard.h"
#include "gui/styles.h"
#include "validators/ScreenNameValidator.h"
#include "validators/ValidationError.h"
SetupWizard::SetupWizard(AppConfig &appConfig) : m_appConfig(appConfig) {
setupUi(this);
m_pLabelError->setStyleSheet(kStyleErrorActiveLabel);
m_pLineEditName->setText(appConfig.screenName());
m_pLineEditName->setValidator(new validators::ScreenNameValidator(
m_pLineEditName, new validators::ValidationError(this, m_pLabelError)));
connect(m_pButtonApply, &QPushButton::clicked, this, &SetupWizard::accept);
connect(
m_pLineEditName, &QLineEdit::textChanged, this,
&SetupWizard::onLineEditNameChanged);
}
void SetupWizard::accept() {
m_appConfig.setWizardHasRun();
m_appConfig.setScreenName(m_pLineEditName->text());
QDialog::accept();
}
void SetupWizard::onLineEditNameChanged(const QString &error) {
m_pButtonApply->setEnabled(m_pLineEditName->hasAcceptableInput());
}
void SetupWizard::reject() {
QDialog::reject();
QApplication::exit();
}