SYNERGY-694 Prevent client duplication.
This commit is contained in:
parent
7fa08c51e3
commit
4bbe8108a2
3 changed files with 23 additions and 5 deletions
|
|
@ -412,6 +412,23 @@ bool ServerConfig::isFull() const
|
||||||
return isFull;
|
return isFull;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ServerConfig::isScreenExists(const QString& screenName) const
|
||||||
|
{
|
||||||
|
bool isExists = false;
|
||||||
|
|
||||||
|
for (const auto& screen : screens())
|
||||||
|
{
|
||||||
|
if (!screen.isNull() &&
|
||||||
|
screen.name() == screenName)
|
||||||
|
{
|
||||||
|
isExists = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return isExists;
|
||||||
|
}
|
||||||
|
|
||||||
void ServerConfig::setConfigFile(const QString& configFile)
|
void ServerConfig::setConfigFile(const QString& configFile)
|
||||||
{
|
{
|
||||||
m_pAppConfig->setConfigFile(configFile);
|
m_pAppConfig->setConfigFile(configFile);
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,7 @@ class ServerConfig : public BaseConfig, public GUI::Config::ConfigBase
|
||||||
const QString& getConfigFile() const;
|
const QString& getConfigFile() const;
|
||||||
bool getUseExternalConfig() const;
|
bool getUseExternalConfig() const;
|
||||||
bool isFull() const;
|
bool isFull() const;
|
||||||
|
bool isScreenExists(const QString& screenName) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
QSettings& settings();
|
QSettings& settings();
|
||||||
|
|
|
||||||
|
|
@ -59,10 +59,10 @@ bool ServerConnection::checkMainWindow()
|
||||||
|
|
||||||
void ServerConnection::addClient(const QString& clientName)
|
void ServerConnection::addClient(const QString& clientName)
|
||||||
{
|
{
|
||||||
if (!m_parent.serverConfig().isFull() && checkMainWindow())
|
if (!m_parent.serverConfig().isFull() &&
|
||||||
|
!m_parent.serverConfig().isScreenExists(clientName) &&
|
||||||
|
checkMainWindow())
|
||||||
{
|
{
|
||||||
m_parent.stopSynergy();
|
|
||||||
|
|
||||||
QMessageBox message(&m_parent);
|
QMessageBox message(&m_parent);
|
||||||
message.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole);
|
message.addButton(QObject::tr("Ignore"), QMessageBox::RejectRole);
|
||||||
message.addButton(QObject::tr("Accept and configure"), QMessageBox::AcceptRole);
|
message.addButton(QObject::tr("Accept and configure"), QMessageBox::AcceptRole);
|
||||||
|
|
@ -76,8 +76,6 @@ void ServerConnection::addClient(const QString& clientName)
|
||||||
{
|
{
|
||||||
m_ignoredClients.append(clientName);
|
m_ignoredClients.append(clientName);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_parent.startSynergy();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -88,4 +86,6 @@ void ServerConnection::configureClient(const QString& clientName)
|
||||||
|
|
||||||
ServerConfigDialog dlg(&m_parent, config);
|
ServerConfigDialog dlg(&m_parent, config);
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
|
|
||||||
|
m_parent.restartSynergy();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue