From dbfb00b21c95e01348ad80babab4a4b7d85468c5 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Sat, 28 Jul 2012 20:41:40 +0000 Subject: [PATCH] moved ips and screen name to main screen, and cleaned up the about screen. --- src/gui/res/AboutDialogBase.ui | 375 +++++++++++++++------------------ src/gui/res/MainWindowBase.ui | 230 +++++++++++--------- src/gui/src/AboutDialog.cpp | 14 -- src/gui/src/MainWindow.cpp | 46 ++++ src/gui/src/MainWindow.h | 2 + 5 files changed, 347 insertions(+), 320 deletions(-) diff --git a/src/gui/res/AboutDialogBase.ui b/src/gui/res/AboutDialogBase.ui index b057bc61..875e1bba 100644 --- a/src/gui/res/AboutDialogBase.ui +++ b/src/gui/res/AboutDialogBase.ui @@ -1,210 +1,165 @@ - - - AboutDialogBase - - - Qt::ApplicationModal - - - true - - - - 0 - 0 - 450 - 255 - - - - - 0 - 0 - - - - - 450 - 250 - - - - - 450 - 255 - - - - About Synergy - - - true - - - - - - <html><head><meta name="qrichtext" content="1" /><style type="text/css"> -p, li { white-space: pre-wrap; } -</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> -<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;"><span style=" font-size:x-large;">Synergy</span></p></body></html> - - - true - - - true - - - Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse - - - - - - - Qt::Horizontal - - - - - - - - - - 1 - 0 - - - - Version: - - - - - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 1 - 0 - - - - Hostname: - - - - - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 1 - 0 - - - - IP-Address: - - - - - - - - - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - Qt::Vertical - - - - 20 - 78 - - - - - - - - Qt::Horizontal - - - - 131 - 20 - - - - - - - - &Ok - - - - - - - <p>The Synergy GUI is based on QSynergy by Volker Lanz<br/> -<br/> -Copyright © 2008 Volker Lanz (vl@fidra.de)<br/> -Copyright © 2010 Chris Schoeneman, Nick Bolton, Sorin Sbarnea</p> - - - true - - - - - - - - - buttonOk - clicked() - AboutDialogBase - accept() - - - 315 - 374 - - - 301 - 3 - - - - - + + + AboutDialogBase + + + Qt::ApplicationModal + + + true + + + + 0 + 0 + 450 + 200 + + + + + 0 + 0 + + + + + 450 + 200 + + + + + 502 + 200 + + + + About Synergy + + + true + + + + + + <html><head><meta name="qrichtext" content="1" /><style type="text/css"> +p, li { white-space: pre-wrap; } +</style></head><body style=" font-family:'Sans Serif'; font-size:9pt; font-weight:400; font-style:normal;"> +<p style=" margin-top:16px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-size:x-large; font-weight:600;"><span style=" font-size:x-large;">Synergy</span></p></body></html> + + + true + + + true + + + Qt::LinksAccessibleByMouse|Qt::TextSelectableByMouse + + + + + + + + 0 + 0 + + + + <p> +Keyboard and mouse sharing sharing application.<br /><br /> +Copyright © 2001-2012 Chris Schoeneman, Nick Bolton, Volker Lanz, Sorin Sbarnea.<br /><br /> +Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.<br /> +The Synergy GUI is based on QSynergy by Volker Lanz. +</p> + + + + + + + Qt::Horizontal + + + + 131 + 20 + + + + + + + + &Ok + + + + + + + + + + 0 + 0 + + + + Version: + + + + + + + + 0 + 0 + + + + Unknown + + + + + + + + + Qt::Vertical + + + + 20 + 78 + + + + + + + + + + buttonOk + clicked() + AboutDialogBase + accept() + + + 315 + 374 + + + 301 + 3 + + + + + diff --git a/src/gui/res/MainWindowBase.ui b/src/gui/res/MainWindowBase.ui index 9b49920e..f40be5fd 100644 --- a/src/gui/res/MainWindowBase.ui +++ b/src/gui/res/MainWindowBase.ui @@ -27,99 +27,6 @@ - - - - - 0 - 0 - - - - &Server (share this computer's mouse and keyboard): - - - true - - - true - - - - - - Use existing configuration: - - - - - - - - - &Configuration file: - - - m_pLineEditConfigFile - - - - - - - false - - - - - - - false - - - &Browse... - - - - - - - - - Configure interactively: - - - true - - - - - - - - - &Configure Server... - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - - @@ -137,18 +44,35 @@ true - + + + QFormLayout::AllNonFixedFieldsGrow + + + + Screen name: + + + + + + + Unknown + + + + - &Server IP or hostname: + &Server IP: m_pLineEditHostname - + @@ -251,6 +175,120 @@ + + + + + 0 + 0 + + + + &Server (share this computer's mouse and keyboard): + + + true + + + true + + + + + + QFormLayout::AllNonFixedFieldsGrow + + + + + IP addresses: + + + + + + + Unknown + + + + + + + + + Configure interactively: + + + true + + + + + + + + + &Configure Server... + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + Use existing configuration: + + + + + + + + + &Configuration file: + + + m_pLineEditConfigFile + + + + + + + false + + + + + + + false + + + &Browse... + + + + + + + + diff --git a/src/gui/src/AboutDialog.cpp b/src/gui/src/AboutDialog.cpp index d40bd4d1..3ef25b15 100644 --- a/src/gui/src/AboutDialog.cpp +++ b/src/gui/src/AboutDialog.cpp @@ -21,17 +21,6 @@ #include #include -static QString getIPAddress() -{ - QList addresses = QNetworkInterface::allAddresses(); - - for (int i = 0; i < addresses.size(); i++) - if (addresses[i].protocol() == QAbstractSocket::IPv4Protocol && addresses[i] != QHostAddress(QHostAddress::LocalHost)) - return addresses[i].toString(); - - return "Unknown"; -} - AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), Ui::AboutDialogBase() @@ -40,7 +29,4 @@ AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) : m_versionChecker.setApp(synergyApp); m_pLabelSynergyVersion->setText(m_versionChecker.getVersion()); - m_pLabelHostname->setText(QHostInfo::localHostName()); - m_pLabelIPAddress->setText(getIPAddress()); } - diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 872c1c8e..46e82af4 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -77,6 +77,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pUpdateIcon->hide(); m_pUpdateLabel->hide(); m_versionChecker.setApp(appPath(appConfig.synergycName())); + m_pLabelScreenName->setText(getScreenName()); + m_pLabelIpAddresses->setText(getIPAddresses()); m_SetupWizard = new SetupWizard(*this, false); connect(m_SetupWizard, SIGNAL(finished(int)), this, SLOT(wizardFinished())); @@ -667,6 +669,50 @@ 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, "; + } + + result += format.arg(address); + } + } + + if (result == "") { + return "Unknown"; + } + + // remove trailing comma. + result.chop(2); + + return result; +} + +QString MainWindow::getScreenName() +{ + if (appConfig().screenName() == "") { + return QHostInfo::localHostName(); + } + else { + return appConfig().screenName(); + } +} + bool MainWindow::on_m_pButtonBrowseConfigFile_clicked() { QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter); diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index daf73a23..b747114c 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -136,6 +136,8 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void sendIpcMessage(qIpcMessageType type, const char* buffer, bool showErrors); void onModeChanged(bool firstRun, bool forceServiceApply); void updateStateFromLogLine(const QString& line); + QString getIPAddresses(); + QString getScreenName(); private: QSettings& m_Settings;