Prompt to enable auto connect #4196
This commit is contained in:
parent
5bd65b5426
commit
f781cce156
|
@ -54,8 +54,9 @@ AppConfig::AppConfig(QSettings* settings) :
|
|||
m_WizardLastRun(0),
|
||||
m_CryptoPass(),
|
||||
m_ProcessMode(DEFAULT_PROCESS_MODE),
|
||||
m_AutoConnect(true),
|
||||
m_ElevateMode(false)
|
||||
m_AutoConnect(false),
|
||||
m_ElevateMode(false),
|
||||
m_AutoConnectPrompted(false)
|
||||
{
|
||||
Q_ASSERT(m_pSettings);
|
||||
|
||||
|
@ -123,8 +124,9 @@ void AppConfig::loadSettings()
|
|||
m_CryptoEnabled = settings().value("cryptoEnabled", false).toBool();
|
||||
m_Language = settings().value("language", QLocale::system().name()).toString();
|
||||
m_StartedBefore = settings().value("startedBefore", false).toBool();
|
||||
m_AutoConnect = settings().value("autoConnect", true).toBool();
|
||||
m_AutoConnect = settings().value("autoConnect", false).toBool();
|
||||
m_ElevateMode = settings().value("elevateMode", false).toBool();
|
||||
m_AutoConnectPrompted = settings().value("autoConnectPrompted", false).toBool();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
|
@ -142,6 +144,7 @@ void AppConfig::saveSettings()
|
|||
settings().setValue("startedBefore", m_StartedBefore);
|
||||
settings().setValue("autoConnect", m_AutoConnect);
|
||||
settings().setValue("elevateMode", m_ElevateMode);
|
||||
settings().setValue("autoConnectPrompted", m_AutoConnectPrompted);
|
||||
}
|
||||
|
||||
void AppConfig::setCryptoPass(const QString &s)
|
||||
|
@ -165,6 +168,11 @@ void AppConfig::setAutoConnect(bool autoConnect)
|
|||
m_AutoConnect = autoConnect;
|
||||
}
|
||||
|
||||
void AppConfig::setAutoConnectPrompted(bool prompted)
|
||||
{
|
||||
m_AutoConnectPrompted = prompted;
|
||||
}
|
||||
|
||||
bool AppConfig::elevateMode()
|
||||
{
|
||||
return m_ElevateMode;
|
||||
|
|
|
@ -70,6 +70,8 @@ class AppConfig
|
|||
bool startedBefore() const { return m_StartedBefore; }
|
||||
bool autoConnect() const { return m_AutoConnect; }
|
||||
void setAutoConnect(bool autoConnect);
|
||||
bool autoConnectPrompted() { return m_AutoConnectPrompted; }
|
||||
void setAutoConnectPrompted(bool prompted);
|
||||
|
||||
QString synergysName() const { return m_SynergysName; }
|
||||
QString synergycName() const { return m_SynergycName; }
|
||||
|
@ -115,6 +117,7 @@ class AppConfig
|
|||
bool m_StartedBefore;
|
||||
bool m_AutoConnect;
|
||||
bool m_ElevateMode;
|
||||
bool m_AutoConnectPrompted;
|
||||
|
||||
static const char m_SynergysName[];
|
||||
static const char m_SynergycName[];
|
||||
|
|
|
@ -77,8 +77,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
|||
m_pMenuEdit(NULL),
|
||||
m_pMenuWindow(NULL),
|
||||
m_pMenuHelp(NULL),
|
||||
m_pZeroconfService(NULL),
|
||||
m_SuppressBonjourWarning(appConfig.autoConnect())
|
||||
m_pZeroconfService(NULL)
|
||||
{
|
||||
setupUi(this);
|
||||
|
||||
|
@ -108,6 +107,10 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
|||
setMinimumSize(size());
|
||||
#endif
|
||||
|
||||
if (!appConfig.autoConnectPrompted()) {
|
||||
promptAutoConnect();
|
||||
}
|
||||
|
||||
m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect());
|
||||
}
|
||||
|
||||
|
@ -896,12 +899,6 @@ void MainWindow::on_m_pButtonApply_clicked()
|
|||
void MainWindow::on_m_pAutoConnectCheckBox_toggled(bool checked)
|
||||
{
|
||||
if (!isBonjourRunning() && checked) {
|
||||
if (m_SuppressBonjourWarning) {
|
||||
m_pAutoConnectCheckBox->setChecked(false);
|
||||
m_SuppressBonjourWarning = false;
|
||||
return;
|
||||
}
|
||||
|
||||
int r = QMessageBox::warning(
|
||||
this, tr("Synergy"),
|
||||
tr("Auto connect feature requires Bonjour installed.\n\n"
|
||||
|
@ -978,3 +975,21 @@ void MainWindow::downloadBonjour()
|
|||
QDesktopServices::openUrl(QUrl(BonjourUrl));
|
||||
#endif
|
||||
}
|
||||
|
||||
void MainWindow::promptAutoConnect()
|
||||
{
|
||||
int r = QMessageBox::warning(
|
||||
this, tr("Synergy"),
|
||||
tr("Do you want to enable auto connect?\n\n"
|
||||
"This feature helps you establish the connection."),
|
||||
QMessageBox::Yes | QMessageBox::No);
|
||||
|
||||
if (r == QMessageBox::Yes) {
|
||||
m_AppConfig.setAutoConnect(true);
|
||||
}
|
||||
else {
|
||||
m_AppConfig.setAutoConnect(false);
|
||||
}
|
||||
|
||||
m_AppConfig.setAutoConnectPrompted(true);
|
||||
}
|
||||
|
|
|
@ -149,6 +149,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
bool isServiceRunning(QString name);
|
||||
bool isBonjourRunning();
|
||||
void downloadBonjour();
|
||||
void promptAutoConnect();
|
||||
|
||||
private:
|
||||
QSettings& m_Settings;
|
||||
|
@ -168,7 +169,6 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
QMenu* m_pMenuWindow;
|
||||
QMenu* m_pMenuHelp;
|
||||
ZeroconfService* m_pZeroconfService;
|
||||
bool m_SuppressBonjourWarning;
|
||||
|
||||
private slots:
|
||||
void on_m_pAutoConnectCheckBox_toggled(bool checked);
|
||||
|
|
Loading…
Reference in New Issue