Added ignore auto connect clients check box

This commit is contained in:
Xinyu Hou 2014-11-18 14:16:29 +00:00
parent aa9990fba9
commit 66a1ffa5f5
5 changed files with 26 additions and 15 deletions

View File

@ -507,7 +507,7 @@ Double click on a screen to edit its settings.</string>
<item row="4" column="0"> <item row="4" column="0">
<widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConnectClient"> <widget class="QCheckBox" name="m_pCheckBoxIgnoreAutoConnectClient">
<property name="text"> <property name="text">
<string>Ingore all clients from auto connect</string> <string>Ignore auto connect clients</string>
</property> </property>
</widget> </widget>
</item> </item>

View File

@ -884,6 +884,7 @@ void MainWindow::on_m_pActionSettings_triggered()
void MainWindow::autoAddScreen(const QString name) void MainWindow::autoAddScreen(const QString name)
{ {
if (!m_ServerConfig.ignoreAutoConnectClient()) {
int r = m_ServerConfig.autoAddScreen(name); int r = m_ServerConfig.autoAddScreen(name);
if (r != kAutoAddScreenOk) { if (r != kAutoAddScreenOk) {
switch (r) { switch (r) {
@ -901,6 +902,7 @@ void MainWindow::autoAddScreen(const QString name)
break; break;
} }
} }
}
} }
void MainWindow::showConfigureServer(const QString& message) void MainWindow::showConfigureServer(const QString& message)

View File

@ -49,6 +49,7 @@ ServerConfig::ServerConfig(QSettings* settings, int numColumns, int numRows ,
m_NumColumns(numColumns), m_NumColumns(numColumns),
m_NumRows(numRows), m_NumRows(numRows),
m_ServerName(serverName), m_ServerName(serverName),
m_IgnoreAutoConnectClient(false),
m_pMainWindow(mainWindow) m_pMainWindow(mainWindow)
{ {
Q_ASSERT(m_pSettings); Q_ASSERT(m_pSettings);
@ -112,6 +113,7 @@ void ServerConfig::saveSettings()
settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap()); settings().setValue("hasSwitchDoubleTap", hasSwitchDoubleTap());
settings().setValue("switchDoubleTap", switchDoubleTap()); settings().setValue("switchDoubleTap", switchDoubleTap());
settings().setValue("switchCornerSize", switchCornerSize()); settings().setValue("switchCornerSize", switchCornerSize());
settings().setValue("ignoreAutoConnectClient", ignoreAutoConnectClient());
writeSettings(settings(), switchCorners(), "switchCorner"); writeSettings(settings(), switchCorners(), "switchCorner");
@ -154,6 +156,7 @@ void ServerConfig::loadSettings()
haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool()); haveSwitchDoubleTap(settings().value("hasSwitchDoubleTap", false).toBool());
setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt()); setSwitchDoubleTap(settings().value("switchDoubleTap", 250).toInt());
setSwitchCornerSize(settings().value("switchCornerSize").toInt()); setSwitchCornerSize(settings().value("switchCornerSize").toInt());
setIgnoreAutoConnectClient(settings().value("ignoreAutoConnectClient").toBool());
readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners); readSettings(settings(), switchCorners(), "switchCorner", false, NumSwitchCorners);

View File

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

View File

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