Resolved #4242 keep auto config name consistent

This commit is contained in:
Xinyu Hou 2014-11-28 10:51:52 +00:00
parent 1730258311
commit 216f0f160d
11 changed files with 89 additions and 91 deletions

View File

@ -241,9 +241,9 @@
<widget class="QLineEdit" name="m_pLineEditHostname"/>
</item>
<item row="3" column="0">
<widget class="QCheckBox" name="m_pCheckBoxAutoConnect">
<widget class="QCheckBox" name="m_pCheckBoxAutoConfig">
<property name="text">
<string>Auto connect</string>
<string>Auto config</string>
</property>
</widget>
</item>

View File

@ -44,7 +44,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="Synergy.qrc">:/res/icons/64x64/user-trash.png</pixmap>
<pixmap>:/res/icons/64x64/user-trash.png</pixmap>
</property>
</widget>
</item>
@ -82,7 +82,7 @@
<string/>
</property>
<property name="pixmap">
<pixmap resource="Synergy.qrc">:/res/icons/64x64/video-display.png</pixmap>
<pixmap>:/res/icons/64x64/video-display.png</pixmap>
</property>
</widget>
</item>
@ -505,9 +505,9 @@ Double click on a screen to edit its settings.</string>
</spacer>
</item>
<item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConnectClient">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConfigClient">
<property name="text">
<string>Ignore auto connect clients</string>
<string>Ignore auto config clients</string>
</property>
</widget>
</item>
@ -644,9 +644,7 @@ Double click on a screen to edit its settings.</string>
<header>TrashScreenWidget.h</header>
</customwidget>
</customwidgets>
<resources>
<include location="Synergy.qrc"/>
</resources>
<resources/>
<connections>
<connection>
<sender>m_pButtonBox</sender>

View File

@ -25,7 +25,7 @@ AddClientDialog::AddClientDialog(const QString& clientName, QWidget* parent) :
QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint),
Ui::AddClientDialog(),
m_AddResult(kAddClientIgnore),
m_IgnoreAutoConnectClient(false)
m_IgnoreAutoConfigClient(false)
{
setupUi(this);
@ -125,5 +125,5 @@ void AddClientDialog::handleButtonAdvanced()
void AddClientDialog::on_m_pCheckBoxIgnoreClient_toggled(bool checked)
{
m_IgnoreAutoConnectClient = checked;
m_IgnoreAutoConfigClient = checked;
}

View File

@ -42,7 +42,7 @@ public:
~AddClientDialog();
int addResult() { return m_AddResult; }
bool ignoreAutoConnectClient() { return m_IgnoreAutoConnectClient; }
bool ignoreAutoConfigClient() { return m_IgnoreAutoConfigClient; }
protected:
void changeEvent(QEvent *e);
@ -62,7 +62,7 @@ private:
QPushButton* m_pButtonDown;
QLabel* m_pLabelCenter;
int m_AddResult;
bool m_IgnoreAutoConnectClient;
bool m_IgnoreAutoConfigClient;
};
#endif // ADDCLIENTDIALOG_H

View File

@ -54,9 +54,9 @@ AppConfig::AppConfig(QSettings* settings) :
m_WizardLastRun(0),
m_CryptoPass(),
m_ProcessMode(DEFAULT_PROCESS_MODE),
m_AutoConnect(false),
m_AutoConfig(false),
m_ElevateMode(false),
m_AutoConnectPrompted(false)
m_AutoConfigPrompted(false)
{
Q_ASSERT(m_pSettings);
@ -124,9 +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", false).toBool();
m_AutoConfig = settings().value("autoConfig", false).toBool();
m_ElevateMode = settings().value("elevateMode", false).toBool();
m_AutoConnectPrompted = settings().value("autoConnectPrompted", false).toBool();
m_AutoConfigPrompted = settings().value("autoConfigPrompted", false).toBool();
}
void AppConfig::saveSettings()
@ -142,9 +142,9 @@ void AppConfig::saveSettings()
settings().setValue("cryptoEnabled", m_CryptoEnabled);
settings().setValue("language", m_Language);
settings().setValue("startedBefore", m_StartedBefore);
settings().setValue("autoConnect", m_AutoConnect);
settings().setValue("autoConfig", m_AutoConfig);
settings().setValue("elevateMode", m_ElevateMode);
settings().setValue("autoConnectPrompted", m_AutoConnectPrompted);
settings().setValue("autoConfigPrompted", m_AutoConfigPrompted);
}
void AppConfig::setCryptoPass(const QString &s)
@ -163,14 +163,14 @@ void AppConfig::setCryptoPass(const QString &s)
}
}
void AppConfig::setAutoConnect(bool autoConnect)
void AppConfig::setAutoConfig(bool autoConfig)
{
m_AutoConnect = autoConnect;
m_AutoConfig = autoConfig;
}
void AppConfig::setAutoConnectPrompted(bool prompted)
void AppConfig::setAutoConfigPrompted(bool prompted)
{
m_AutoConnectPrompted = prompted;
m_AutoConfigPrompted = prompted;
}
bool AppConfig::elevateMode()

View File

@ -68,10 +68,10 @@ class AppConfig
bool wizardShouldRun() const { return m_WizardLastRun < kWizardVersion; }
const QString& language() const { return m_Language; }
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);
bool autoConfig() const { return m_AutoConfig; }
void setAutoConfig(bool autoConfig);
bool autoConfigPrompted() { return m_AutoConfigPrompted; }
void setAutoConfigPrompted(bool prompted);
QString synergysName() const { return m_SynergysName; }
QString synergycName() const { return m_SynergycName; }
@ -115,9 +115,9 @@ class AppConfig
ProcessMode m_ProcessMode;
QString m_Language;
bool m_StartedBefore;
bool m_AutoConnect;
bool m_AutoConfig;
bool m_ElevateMode;
bool m_AutoConnectPrompted;
bool m_AutoConfigPrompted;
static const char m_SynergysName[];
static const char m_SynergycName[];

View File

@ -87,7 +87,7 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
m_pDataDownloader(NULL),
m_DownloadMessageBox(NULL),
m_pCancelButton(NULL),
m_SuppressAutoConnectWarning(false)
m_SuppressAutoConfigWarning(false)
{
setupUi(this);
@ -117,9 +117,9 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) :
setMinimumSize(size());
#endif
m_SuppressAutoConnectWarning = true;
m_pCheckBoxAutoConnect->setChecked(appConfig.autoConnect());
m_SuppressAutoConnectWarning = false;
m_SuppressAutoConfigWarning = true;
m_pCheckBoxAutoConfig->setChecked(appConfig.autoConfig());
m_SuppressAutoConfigWarning = false;
m_pComboServerList->hide();
}
@ -147,8 +147,8 @@ void MainWindow::open()
m_VersionChecker.checkLatest();
if (!appConfig().autoConnectPrompted()) {
promptAutoConnect();
if (!appConfig().autoConfigPrompted()) {
promptAutoConfig();
}
// only start if user has previously started. this stops the gui from
@ -524,9 +524,9 @@ bool MainWindow::clientArgs(QStringList& args, QString& app)
args << "--log" << appConfig().logFilenameCmd();
}
// check auto connect first, if it is disabled or no server detected,
// check auto config first, if it is disabled or no server detected,
// use line edit host name if it is not empty
if (m_pCheckBoxAutoConnect->isChecked()) {
if (m_pCheckBoxAutoConfig->isChecked()) {
if (m_pComboServerList->count() != 0) {
QString serverIp = m_pComboServerList->currentText();
args << serverIp + ":" + QString::number(appConfig().port());
@ -823,7 +823,7 @@ void MainWindow::updateZeroconfService()
m_pZeroconfService = NULL;
}
if (m_AppConfig.autoConnect() || synergyType() == synergyServer) {
if (m_AppConfig.autoConfig() || synergyType() == synergyServer) {
m_pZeroconfService = new ZeroconfService(this);
}
}
@ -925,7 +925,7 @@ void MainWindow::on_m_pActionSettings_triggered()
void MainWindow::autoAddScreen(const QString name)
{
if (!m_ServerConfig.ignoreAutoConnectClient()) {
if (!m_ServerConfig.ignoreAutoConfigClient()) {
int r = m_ServerConfig.autoAddScreen(name);
if (r != kAutoAddScreenOk) {
switch (r) {
@ -972,35 +972,6 @@ void MainWindow::on_m_pButtonApply_clicked()
startSynergy();
}
void MainWindow::on_m_pCheckBoxAutoConnect_toggled(bool checked)
{
if (!isBonjourRunning() && checked) {
if (!m_SuppressAutoConnectWarning) {
int r = QMessageBox::information(
this, tr("Synergy"),
tr("Auto connect feature requires Bonjour.\n\n"
"Do you want to install Bonjour?"),
QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) {
downloadBonjour();
}
}
m_pCheckBoxAutoConnect->setChecked(false);
return;
}
m_pLineEditHostname->setDisabled(checked);
appConfig().setAutoConnect(checked);
updateZeroconfService();
if (!checked) {
m_pComboServerList->clear();
m_pComboServerList->hide();
}
}
bool MainWindow::isServiceRunning(QString name)
{
#if defined(Q_OS_WIN)
@ -1137,42 +1108,42 @@ void MainWindow::installBonjour()
#endif
}
void MainWindow::promptAutoConnect()
void MainWindow::promptAutoConfig()
{
if (isBonjourRunning()) {
int r = QMessageBox::question(
this, tr("Synergy"),
tr("Do you want to enable auto connect?\n\n"
tr("Do you want to enable auto config?\n\n"
"This feature helps you establish the connection."),
QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) {
m_AppConfig.setAutoConnect(true);
m_pCheckBoxAutoConnect->setChecked(true);
m_AppConfig.setAutoConfig(true);
m_pCheckBoxAutoConfig->setChecked(true);
}
else {
m_AppConfig.setAutoConnect(false);
m_pCheckBoxAutoConnect->setChecked(false);
m_AppConfig.setAutoConfig(false);
m_pCheckBoxAutoConfig->setChecked(false);
}
}
else {
int r = QMessageBox::question(
this, tr("Synergy"),
tr("Do you want to enable auto connect and install Bonjour?\n\n"
tr("Do you want to enable auto config and install Bonjour?\n\n"
"This feature helps you establish the connection."),
QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) {
m_AppConfig.setAutoConnect(true);
m_AppConfig.setAutoConfig(true);
downloadBonjour();
}
else {
m_AppConfig.setAutoConnect(false);
m_pCheckBoxAutoConnect->setChecked(false);
m_AppConfig.setAutoConfig(false);
m_pCheckBoxAutoConfig->setChecked(false);
}
}
m_AppConfig.setAutoConnectPrompted(true);
m_AppConfig.setAutoConfigPrompted(true);
}
void MainWindow::on_m_pComboServerList_currentIndexChanged(QString )
@ -1181,3 +1152,32 @@ void MainWindow::on_m_pComboServerList_currentIndexChanged(QString )
startSynergy();
}
}
void MainWindow::on_m_pCheckBoxAutoConfig_toggled(bool checked)
{
if (!isBonjourRunning() && checked) {
if (!m_SuppressAutoConfigWarning) {
int r = QMessageBox::information(
this, tr("Synergy"),
tr("Auto config feature requires Bonjour.\n\n"
"Do you want to install Bonjour?"),
QMessageBox::Yes | QMessageBox::No);
if (r == QMessageBox::Yes) {
downloadBonjour();
}
}
m_pCheckBoxAutoConfig->setChecked(false);
return;
}
m_pLineEditHostname->setDisabled(checked);
appConfig().setAutoConfig(checked);
updateZeroconfService();
if (!checked) {
m_pComboServerList->clear();
m_pComboServerList->hide();
}
}

View File

@ -163,7 +163,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
bool isServiceRunning(QString name);
bool isBonjourRunning();
void downloadBonjour();
void promptAutoConnect();
void promptAutoConfig();
private:
QSettings& m_Settings;
@ -187,11 +187,11 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase
QMessageBox* m_DownloadMessageBox;
QAbstractButton* m_pCancelButton;
QMutex m_Mutex;
bool m_SuppressAutoConnectWarning;
bool m_SuppressAutoConfigWarning;
private slots:
void on_m_pCheckBoxAutoConfig_toggled(bool checked);
void on_m_pComboServerList_currentIndexChanged(QString );
void on_m_pCheckBoxAutoConnect_toggled(bool checked);
void on_m_pButtonApply_clicked();
void installBonjour();
};

View File

@ -49,7 +49,7 @@ ServerConfig::ServerConfig(QSettings* settings, int numColumns, int numRows ,
m_NumColumns(numColumns),
m_NumRows(numRows),
m_ServerName(serverName),
m_IgnoreAutoConnectClient(false),
m_IgnoreAutoConfigClient(false),
m_pMainWindow(mainWindow)
{
Q_ASSERT(m_pSettings);
@ -113,7 +113,7 @@ void ServerConfig::saveSettings()
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
settings().setValue("switchDoubleTap", switchDoubleTap());
settings().setValue("switchCornerSize", switchCornerSize());
settings().setValue("ignoreAutoConnectClient", ignoreAutoConnectClient());
settings().setValue("ignoreAutoConfigClient", ignoreAutoConfigClient());
writeSettings(settings(), switchCorners(), "switchCorner");
@ -156,7 +156,7 @@ void ServerConfig::loadSettings()
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
setSwitchCornerSize(settings().value("switchCornerSize").toInt());
setIgnoreAutoConnectClient(settings().value("ignoreAutoConnectClient").toBool());
setIgnoreAutoConfigClient(settings().value("ignoreAutoConfigClient").toBool());
readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners);
@ -375,7 +375,7 @@ int ServerConfig::showAddClientDialog(const QString& clientName)
AddClientDialog addClientDialog(clientName, m_pMainWindow);
addClientDialog.exec();
int result = addClientDialog.addResult();
m_IgnoreAutoConnectClient = addClientDialog.ignoreAutoConnectClient();
m_IgnoreAutoConfigClient = addClientDialog.ignoreAutoConfigClient();
return result;
}

View File

@ -60,7 +60,7 @@ class ServerConfig : public BaseConfig
int switchCornerSize() const { return m_SwitchCornerSize; }
const QList<bool>& switchCorners() const { return m_SwitchCorners; }
const HotkeyList& hotkeys() const { return m_Hotkeys; }
bool ignoreAutoConnectClient() const { return m_IgnoreAutoConnectClient; }
bool ignoreAutoConfigClient() const { return m_IgnoreAutoConfigClient; }
void saveSettings();
void loadSettings();
@ -87,7 +87,7 @@ class ServerConfig : public BaseConfig
void setSwitchDoubleTap(int val) { m_SwitchDoubleTap = val; }
void setSwitchCorner(int c, bool on) { m_SwitchCorners[c] = on; }
void setSwitchCornerSize(int val) { m_SwitchCornerSize = val; }
void setIgnoreAutoConnectClient(bool on) { m_IgnoreAutoConnectClient = on; }
void setIgnoreAutoConfigClient(bool on) { m_IgnoreAutoConfigClient = on; }
QList<bool>& switchCorners() { return m_SwitchCorners; }
HotkeyList& hotkeys() { return m_Hotkeys; }
@ -118,7 +118,7 @@ class ServerConfig : public BaseConfig
QList<bool> m_SwitchCorners;
HotkeyList m_Hotkeys;
QString m_ServerName;
bool m_IgnoreAutoConnectClient;
bool m_IgnoreAutoConfigClient;
MainWindow* m_pMainWindow;
};

View File

@ -54,7 +54,7 @@ ServerConfigDialog::ServerConfigDialog(QWidget* parent, ServerConfig& config, co
m_pCheckBoxCornerBottomRight->setChecked(serverConfig().switchCorner(BaseConfig::BottomRight));
m_pSpinBoxSwitchCornerSize->setValue(serverConfig().switchCornerSize());
m_pCheckBoxIgnoreAutoConnectClient->setChecked(serverConfig().ignoreAutoConnectClient());
m_pCheckBoxIgnoreAutoConfigClient->setChecked(serverConfig().ignoreAutoConfigClient());
foreach(const Hotkey& hotkey, serverConfig().hotkeys())
m_pListHotkeys->addItem(hotkey.text());
@ -96,7 +96,7 @@ void ServerConfigDialog::accept()
serverConfig().setSwitchCorner(BaseConfig::BottomLeft, m_pCheckBoxCornerBottomLeft->isChecked());
serverConfig().setSwitchCorner(BaseConfig::BottomRight, m_pCheckBoxCornerBottomRight->isChecked());
serverConfig().setSwitchCornerSize(m_pSpinBoxSwitchCornerSize->value());
serverConfig().setIgnoreAutoConnectClient(m_pCheckBoxIgnoreAutoConnectClient->isChecked());
serverConfig().setIgnoreAutoConfigClient(m_pCheckBoxIgnoreAutoConfigClient->isChecked());
// now that the dialog has been accepted, copy the new server config to the original one,
// which is a reference to the one in MainWindow.