From 6f97f1d186b55b3d851e83a7c1a58612d26b7a85 Mon Sep 17 00:00:00 2001 From: Nick Bolton Date: Fri, 5 Jul 2013 12:05:08 +0000 Subject: [PATCH] gui: premium reminder feature --- src/gui/res/MainWindowBase.ui | 51 ++++++++++++++++++++++++++++++ src/gui/res/Synergy.qrc | 1 + src/gui/res/icons/16x16/money.png | Bin 0 -> 738 bytes src/gui/src/MainWindow.cpp | 18 +++++++++++ src/gui/src/MainWindow.h | 1 + src/gui/src/SetupWizard.cpp | 5 +-- 6 files changed, 74 insertions(+), 2 deletions(-) create mode 100644 src/gui/res/icons/16x16/money.png diff --git a/src/gui/res/MainWindowBase.ui b/src/gui/res/MainWindowBase.ui index ba434b76..05680364 100644 --- a/src/gui/res/MainWindowBase.ui +++ b/src/gui/res/MainWindowBase.ui @@ -78,6 +78,57 @@ + + + + + 2 + + + 0 + + + 0 + + + 7 + + + + + + + + :/res/icons/16x16/money.png + + + + + + + Please help us <a href="https://synergy-foss.org/premium/register/?source=gui-notice">fund this project</a> if you like Synergy. + + + true + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + diff --git a/src/gui/res/Synergy.qrc b/src/gui/res/Synergy.qrc index 99a4443c..2b078107 100644 --- a/src/gui/res/Synergy.qrc +++ b/src/gui/res/Synergy.qrc @@ -50,5 +50,6 @@ lang/gui_zh-CN.qm lang/gui_zh-TW.qm lang/Languages.xml + icons/16x16/money.png diff --git a/src/gui/res/icons/16x16/money.png b/src/gui/res/icons/16x16/money.png new file mode 100644 index 0000000000000000000000000000000000000000..42c52d05f6f8242e4de6fd953d9fcfcfcde81f3e GIT binary patch literal 738 zcmV<80v-K{P)kKmx=vV@a|w4d?1G z{A&|1yzGF~TZ8KHTl_r*T3@s<=A;pUk6t|eFbv0%74?%+OlCdki0e@06yy3x1%Foo zZA8IP3kLWJ+!ohD8&$%-Xu;s38IP9-L1$fP3CnTSerf$50rgDty6Lr^*!3d)Z5bO| z-!b-f1e)3AZ8+nCGAzU8!LrRAB^VQ3$5hYdKYA07xLVs{S`MaSy~ut|Ll;xQn;C~< zTE=EZ#ZWme+JuKV0b`<5t|FFt=DRug$%=#6R&beFSRGVu!=XktGv>d{p(*$PrItbs zC%{@V&UayoG-zyPh^uwrJq0zft&6HKksgOU)PPF&4Gy0B97SX;1Yuth&KvTM@H8_D zI|j&k17#5C^Q5`mXHM}n5yer~ z1v@0vf}XSMShQ`!KZ;`Qm@#H#oe^ U8%xtYa{vGU07*qoM6N<$f()ing#Z8m literal 0 HcmV?d00001 diff --git a/src/gui/src/MainWindow.cpp b/src/gui/src/MainWindow.cpp index 5822ea89..6016a86a 100644 --- a/src/gui/src/MainWindow.cpp +++ b/src/gui/src/MainWindow.cpp @@ -84,6 +84,8 @@ MainWindow::MainWindow(QSettings& settings, AppConfig& appConfig) : m_pLabelScreenName->setText(getScreenName()); m_pLabelIpAddresses->setText(getIPAddresses()); + updatePremiumInfo(); + #if defined(Q_OS_WIN) // ipc must always be enabled, so that we can disable command when switching to desktop mode. connect(&m_IpcClient, SIGNAL(readLogLine(const QString&)), this, SLOT(appendLogRaw(const QString&))); @@ -749,6 +751,7 @@ void MainWindow::changeEvent(QEvent* event) case QEvent::LanguageChange: retranslateUi(this); retranslateMenuBar(); + updatePremiumInfo(); break; default: @@ -757,6 +760,20 @@ void MainWindow::changeEvent(QEvent* event) } } +void MainWindow::updatePremiumInfo() +{ + if (m_AppConfig.isPremium()) + { + m_pWidgetPremium->hide(); + setWindowTitle(tr("Synergy Premium")); + } + else + { + m_pWidgetPremium->show(); + setWindowTitle(tr("Synergy")); + } +} + bool MainWindow::on_m_pButtonBrowseConfigFile_clicked() { QString fileName = QFileDialog::getOpenFileName(this, tr("Browse for a synergys config file"), QString(), synergyConfigFilter); @@ -812,6 +829,7 @@ void MainWindow::on_m_pActionWizard_triggered() { SetupWizard wizard(*this, false); wizard.exec(); + updatePremiumInfo(); } void MainWindow::on_m_pElevateCheckBox_toggled(bool checked) diff --git a/src/gui/src/MainWindow.h b/src/gui/src/MainWindow.h index 25827705..e5dd78d8 100644 --- a/src/gui/src/MainWindow.h +++ b/src/gui/src/MainWindow.h @@ -144,6 +144,7 @@ class MainWindow : public QMainWindow, public Ui::MainWindowBase void setFormEnabled(bool enabled); void changeEvent(QEvent* event); void retranslateMenuBar(); + void updatePremiumInfo(); private: QSettings& m_Settings; diff --git a/src/gui/src/SetupWizard.cpp b/src/gui/src/SetupWizard.cpp index 68c69a10..f2a438b9 100644 --- a/src/gui/src/SetupWizard.cpp +++ b/src/gui/src/SetupWizard.cpp @@ -26,8 +26,9 @@ #include #include -#define PREMIUM_AUTH_URL "https://synergy-foss.org/premium/json/auth/" //#define PREMIUM_AUTH_URL "http://localhost/synergy/premium/json/auth/" +#define PREMIUM_AUTH_URL "https://synergy-foss.org/premium/json/auth/" +#define PREMIUM_REGISTER_URL "https://synergy-foss.org/premium/register/?source=gui-wizard" SetupWizard::SetupWizard(MainWindow& mainWindow, bool startMain) : m_MainWindow(mainWindow), @@ -112,7 +113,7 @@ bool SetupWizard::validateCurrentPage() } else if (m_pRadioButtonPremiumRegister->isChecked()) { - const QUrl url(QString("https://synergy-foss.org/premium/register/?source=gui")); + const QUrl url(QString(PREMIUM_REGISTER_URL)); QDesktopServices::openUrl(url); m_pRadioButtonPremiumLogin->setChecked(true); return false;