From 8c9a261ed5097769173527693dbc199d1046dd31 Mon Sep 17 00:00:00 2001 From: Serhii Hadzhilov Date: Thu, 15 Apr 2021 18:54:01 +0300 Subject: [PATCH] SYNERGY-799 Fix code smell. Removed unused autoconfig function. --- ChangeLog | 1 + src/gui/src/MainWindow.cpp | 42 -------------------------------------- src/gui/src/MainWindow.h | 1 - 3 files changed, 1 insertion(+), 43 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6e9ba7ce0..61dfc0b18 100644 --- a/ChangeLog +++ b/ChangeLog @@ -16,6 +16,7 @@ Enhancements: - #6969 Update synergy UI. Validation for aliases. - #6973 Update synergy UI. Main window - #6977 Update synergy UI. Configure server +- #6978 Update synergy UI. Settings window - #6962 | #6965 Add macOS 10.13 builder =========== diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index b3b8ad2ce..8ea7374e5 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -130,7 +130,6 @@ MainWindow::MainWindow (AppConfig& appConfig, m_pLabelScreenName->setText(appConfig.screenName()); connect(m_AppConfig, SIGNAL(screenNameChanged()), this, SLOT(updateScreenName())); - m_pLabelIpAddresses->setText(getIPAddresses()); #if defined(Q_OS_WIN) // ipc must always be enabled, so that we can disable command when switching to desktop mode. @@ -1039,42 +1038,6 @@ void MainWindow::setVisible(bool visible) #endif } -QString MainWindow::getIPAddresses() -{ - QList addresses = QNetworkInterface::allAddresses(); - - bool hinted = false; - QString result; - for (int i = 0; i < addresses.size(); i++) { - if (addresses[i].protocol() == QAbstractSocket::IPv4Protocol && - addresses[i] != QHostAddress(QHostAddress::LocalHost)) { - - QString address = addresses[i].toString(); - QString format = "%1, "; - - // usually 192.168.x.x is a useful ip for the user, so indicate - // this by making it bold. - if (!hinted && address.startsWith("192.168")) { - hinted = true; - format = "%1, "; - } - //Prevent self assigned IPs being displayed - if (!address.startsWith("169.254")) { - result += format.arg(address); - } - } - } - - if (result == "") { - return tr("Unknown"); - } - - // remove trailing comma. - result.chop(2); - - return result; -} - void MainWindow::changeEvent(QEvent* event) { if (event != 0) @@ -1103,11 +1066,6 @@ void MainWindow::changeEvent(QEvent* event) void MainWindow::addZeroconfServer(const QString name) { - // don't add yourself to the server list. - if (getIPAddresses().contains(name)) { - return; - } - if (m_pComboServerList->findText(name) == -1) { m_pComboServerList->addItem(name); } diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 55397f0b7..2b5bc0aac 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -182,7 +182,6 @@ public slots: void setStatus(const QString& status); void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors); void updateFromLogLine(const QString& line); - QString getIPAddresses(); void stopService(); void stopDesktop(); void changeEvent(QEvent* event);