issue #65 - Auto config feature using Zeroconf/Bonjour
gave user an option to toggle auto connect
This commit is contained in:
parent
828f7c02b1
commit
a2d3b5c7e2
|
@ -271,7 +271,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="m_pLabelServerName">
|
||||
<property name="text">
|
||||
<string>&Server IP:</string>
|
||||
|
@ -281,7 +281,7 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="m_pLineEditHostname"/>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
|
@ -291,6 +291,13 @@
|
|||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QCheckBox" name="m_pAutoConnectCheckBox">
|
||||
<property name="text">
|
||||
<string>Auto connect</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
|
|
|
@ -53,7 +53,8 @@ AppConfig::AppConfig(QSettings* settings) :
|
|||
m_LogLevel(0),
|
||||
m_WizardLastRun(0),
|
||||
m_CryptoPass(),
|
||||
m_ProcessMode(DEFAULT_PROCESS_MODE)
|
||||
m_ProcessMode(DEFAULT_PROCESS_MODE),
|
||||
m_AutoConnect(true)
|
||||
{
|
||||
Q_ASSERT(m_pSettings);
|
||||
|
||||
|
@ -123,6 +124,7 @@ void AppConfig::loadSettings()
|
|||
m_PremiumEmail = settings().value("premiumEmail", "").toString();
|
||||
m_PremiumToken = settings().value("premiumToken", "").toString();
|
||||
m_StartedBefore = settings().value("startedBefore", false).toBool();
|
||||
m_AutoConnect = settings().value("autoConnect", true).toBool();
|
||||
}
|
||||
|
||||
void AppConfig::saveSettings()
|
||||
|
@ -140,6 +142,7 @@ void AppConfig::saveSettings()
|
|||
settings().setValue("premiumEmail", m_PremiumEmail);
|
||||
settings().setValue("premiumToken", m_PremiumToken);
|
||||
settings().setValue("startedBefore", m_StartedBefore);
|
||||
settings().setValue("autoConnect", m_AutoConnect);
|
||||
}
|
||||
|
||||
void AppConfig::setCryptoPass(const QString &s)
|
||||
|
@ -164,3 +167,8 @@ bool AppConfig::isPremium()
|
|||
QString hashResult = hash(hashSrc);
|
||||
return hashResult == m_PremiumToken;
|
||||
}
|
||||
|
||||
void AppConfig::setAutoConnect(bool autoConnect)
|
||||
{
|
||||
m_AutoConnect = autoConnect;
|
||||
}
|
||||
|
|
|
@ -70,6 +70,8 @@ class AppConfig
|
|||
const QString& premiumEmail() const { return m_PremiumEmail; }
|
||||
const QString& premiumToken() const { return m_PremiumToken; }
|
||||
bool startedBefore() const { return m_StartedBefore; }
|
||||
bool autoConnect() const { return m_AutoConnect; }
|
||||
void setAutoConnect(bool autoConnect);
|
||||
|
||||
QString synergysName() const { return m_SynergysName; }
|
||||
QString synergycName() const { return m_SynergycName; }
|
||||
|
@ -116,6 +118,7 @@ class AppConfig
|
|||
QString m_PremiumEmail;
|
||||
QString m_PremiumToken;
|
||||
bool m_StartedBefore;
|
||||
bool m_AutoConnect;
|
||||
|
||||
static const char m_SynergysName[];
|
||||
static const char m_SynergycName[];
|
||||
|
|
|
@ -112,6 +112,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
|
|||
|
||||
updateZeroconfService();
|
||||
|
||||
m_pAutoConnectCheckBox->setChecked(appConfig.autoConnect());
|
||||
}
|
||||
|
||||
MainWindow::~MainWindow()
|
||||
|
@ -808,10 +809,13 @@ void MainWindow::updateZeroconfService()
|
|||
if (!m_AppConfig.wizardShouldRun()) {
|
||||
if (m_pZeroconfService) {
|
||||
delete m_pZeroconfService;
|
||||
m_pZeroconfService = NULL;
|
||||
}
|
||||
|
||||
if (m_AppConfig.autoConnect() || synergyType() == synergyServer) {
|
||||
m_pZeroconfService = new ZeroconfService(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pGroupClient_toggled(bool on)
|
||||
|
@ -935,3 +939,10 @@ void MainWindow::on_m_pButtonApply_clicked()
|
|||
{
|
||||
startSynergy();
|
||||
}
|
||||
|
||||
void MainWindow::on_m_pAutoConnectCheckBox_toggled(bool checked)
|
||||
{
|
||||
m_pLineEditHostname->setDisabled(checked);
|
||||
appConfig().setAutoConnect(checked);
|
||||
updateZeroconfService();
|
||||
}
|
||||
|
|
|
@ -171,6 +171,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
|
|||
ZeroconfService* m_pZeroconfService;
|
||||
|
||||
private slots:
|
||||
void on_m_pAutoConnectCheckBox_toggled(bool checked);
|
||||
void on_m_pButtonApply_clicked();
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue