diff --git a/ChangeLog b/ChangeLog index af6d7c0f6..cd47436ed 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,7 @@ Enhancements: - #7183 Refactoring for Synergy 3 licenses - #7190 Maintenance license serial key support - #7193 Support for maintenance licenses in China +- #7197 Special contributor mentions on the about screen 1.14.4 ====== diff --git a/src/gui/src/AboutDialog.cpp b/src/gui/src/AboutDialog.cpp index 7c62c5098..bcb5c3d9a 100644 --- a/src/gui/src/AboutDialog.cpp +++ b/src/gui/src/AboutDialog.cpp @@ -17,26 +17,29 @@ */ #include "AboutDialog.h" +#include "CreditsLoader.h" #include #include #include "OSXHelpers.h" -AboutDialog::AboutDialog(QWidget* parent, const QString& synergyApp) : +AboutDialog::AboutDialog(MainWindow* parent, const QString& synergyApp) : QDialog(parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint), - Ui::AboutDialogBase() + Ui::AboutDialogBase(), + credits(*parent) { setupUi(this); + setupCreditsLoader(); QString aboutText(R"(

Keyboard and mouse sharing application. Cross platform and open source.

-Copyright © 2012-%%YEAR%% Symless Ltd.
-Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.

-Synergy is released under the GNU General Public License (GPLv2).

-Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.
-The Synergy GUI is based on QSynergy by Volker Lanz.

-Visit our website for help and info (symless.com). +Copyright © %%YEAR%% Symless Ltd.

+Synergy is released under the GNU General Public License (GPLv2).

+

Key contributors
+Chris Schoeneman, Nick Bolton, Richard Lee, Adam Feder, Volker Lanz, +Ryan Breen, Guido Poschta, Bertrand Landry Hetu, Tom Chadwick, Brent Priddy, Kyle Bloom, +Daun Chung, Serhii Hadzhylov, Oleksandr Lysytsia, Olena Kutytska, Francisco Magalhães.

)"); m_versionChecker.setApp(synergyApp); @@ -56,7 +59,7 @@ Visit our website for help and info (symless.com). // change default size based on os #if defined(Q_OS_MAC) - QSize size(600, 380); + QSize size(600, 490); setMaximumSize(size); setMinimumSize(size); resize(size); @@ -69,9 +72,20 @@ Visit our website for help and info (symless.com). } #elif defined(Q_OS_LINUX) - QSize size(600, 330); + QSize size(600, 420); setMaximumSize(size); setMinimumSize(size); resize(size); #endif } + +void AboutDialog::setupCreditsLoader() +{ + connect(&credits, SIGNAL(loaded(const QString&)), this, SLOT(updateEliteBackers(const QString&))); + credits.loadEliteBackers(); +} + +void AboutDialog::updateEliteBackers(const QString& eliteBackers) const +{ + this->labelEliteBackersData->setText(eliteBackers); +} diff --git a/src/gui/src/AboutDialog.h b/src/gui/src/AboutDialog.h index bb53125bf..08ddc2fc7 100644 --- a/src/gui/src/AboutDialog.h +++ b/src/gui/src/AboutDialog.h @@ -22,6 +22,8 @@ #include #include "VersionChecker.h" +#include "CreditsLoader.h" +#include "MainWindow.h" #include "ui_AboutDialogBase.h" @@ -33,10 +35,15 @@ class AboutDialog : public QDialog, public Ui::AboutDialogBase Q_OBJECT public: - AboutDialog(QWidget* parent, const QString& synergyApp = QString()); + AboutDialog(MainWindow* parent, const QString& synergyApp = QString()); + public slots: + void updateEliteBackers(const QString& eliteBackers) const; private: + CreditsLoader credits; VersionChecker m_versionChecker; + + void setupCreditsLoader(); }; #endif diff --git a/src/gui/src/AboutDialogBase.ui b/src/gui/src/AboutDialogBase.ui index b616bab58..a12d73b1f 100644 --- a/src/gui/src/AboutDialogBase.ui +++ b/src/gui/src/AboutDialogBase.ui @@ -13,7 +13,7 @@ 0 0 450 - 300 + 495 @@ -25,13 +25,13 @@ 450 - 300 + 495 450 - 300 + 495 @@ -41,7 +41,256 @@ true - + + + + <a href="https://symless.com/synergy/credits?source=gui" style="color: #4285F4;">View the complete credits</a> + + + true + + + + + + + <a href="https://symless.com/synergy/account-status?source=gui" style="color: #4285F4;">Become an Elite Backer</a> + + + true + + + + + + + Qt::Vertical + + + + 20 + 9 + + + + + + + + Qt::Vertical + + + QSizePolicy::Fixed + + + + 20 + 5 + + + + + + + + 1 + + + QLayout::SetNoConstraint + + + 0 + + + 0 + + + + + + -1 + false + + + + font-size: 14px + + + Elite Backers + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + QFrame::NoFrame + + + true + + + + + 0 + 0 + 419 + 83 + + + + + 0 + + + 3 + + + 3 + + + + + + 0 + 10 + + + + + -1 + + + + font-size: 11px;s + + + Loading... + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop + + + + + + + + + + + + + + 0 + 0 + + + + + 200 + 50 + + + + + + + :/res/image/about.png + + + true + + + 0 + + + + + + + + 0 + 0 + + + + + + + true + + + 1 + + + + + + + + + Build Date: + + + + + + + Unknown + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + &Ok + + + + + + + + + Qt::Vertical + + + QSizePolicy::Preferred + + + + 20 + 100 + + + + + @@ -90,120 +339,6 @@ - - - - - - Build Date: - - - - - - - Unknown - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - &Ok - - - - - - - - - - 0 - 0 - - - - - - - 1 - - - - - - - Qt::Vertical - - - QSizePolicy::Preferred - - - - 20 - 100 - - - - - - - - Qt::Vertical - - - QSizePolicy::Fixed - - - - 20 - 5 - - - - - - - - - 0 - 0 - - - - - 200 - 50 - - - - - - - :/res/image/about.png - - - true - - - 0 - - - diff --git a/src/gui/src/CreditsLoader.cpp b/src/gui/src/CreditsLoader.cpp new file mode 100644 index 000000000..d518382e8 --- /dev/null +++ b/src/gui/src/CreditsLoader.cpp @@ -0,0 +1,106 @@ +/* + * synergy -- mouse and keyboard sharing utility + * Copyright (C) 2015-2022 Symless Ltd. + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * found in the file LICENSE that should have accompanied this file. + * + * This package is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "CreditsLoader.h" +#include "MainWindow.h" + +#include +#include +#include +#include + +namespace { + +class CreditsResponse { +public: + explicit CreditsResponse(const QByteArray& response) { + auto data = parseJson(response); + m_status = data["status"].toString(); + + if (isSuccess()) { + m_data = data["data"].toString(); + } + else if (isFailed()) { + m_data = data["message"].toString(); + } + else { + m_data = "Unknown response from the server"; + } + } + + bool isSuccess() const { + return (m_status == "success"); + } + + bool isFailed() const { + return (m_status == "failed"); + } + + const QString& getData() const { + return m_data; + } + +private: + QMap parseJson(const QByteArray& json) const { + QJsonParseError jsonError; + auto data = QJsonDocument::fromJson(json, &jsonError); + if (jsonError.error == QJsonParseError::NoError) { + return data.toVariant().toMap(); + } + return QMap(); + } + + QString m_data; + QString m_status; +}; + +} + +CreditsLoader::CreditsLoader(MainWindow& mainWindow) : + m_mainWindow(mainWindow) +{ + connect(&m_manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(replyFinished(QNetworkReply*))); +} + +void CreditsLoader::loadEliteBackers() +{ + const auto ELITE_BACKERS_URL = "https://api2.prod.symless.com/credits/elite-backers"; + m_mainWindow.appendLogDebug(QString("Send request: %1").arg(ELITE_BACKERS_URL)); + const auto url = QUrl(ELITE_BACKERS_URL); + const auto request = QNetworkRequest(url); + m_manager.get(request); +} + +void CreditsLoader::replyFinished(QNetworkReply* reply) const +{ + auto response = reply->readAll(); + m_mainWindow.appendLogDebug(QString("Received response: %1").arg(response.toStdString().c_str())); + + CreditsResponse creditsResponse(response); + if (creditsResponse.isSuccess()) { + emit loaded(creditsResponse.getData()); + } + else { + error(QString("Server error: %1").arg(creditsResponse.getData())); + } +} + +void CreditsLoader::error(const QString& error) const +{ + m_mainWindow.appendLogError(error); + emit loaded("Something went wrong when retrieving the list of Elite Backers. Check the logs for more info."); +} diff --git a/src/gui/src/CreditsLoader.h b/src/gui/src/CreditsLoader.h new file mode 100644 index 000000000..e59a2c85d --- /dev/null +++ b/src/gui/src/CreditsLoader.h @@ -0,0 +1,43 @@ +/* + * synergy -- mouse and keyboard sharing utility + * Copyright (C) 2015-2022 Symless Ltd. + * + * This package is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * found in the file LICENSE that should have accompanied this file. + * + * This package is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#pragma once + +#include +#include + +class QNetworkReply; +class MainWindow; + +class CreditsLoader : public QObject +{ + Q_OBJECT +public: + explicit CreditsLoader(MainWindow& mainWindow); + void loadEliteBackers(); + +signals: + void loaded(const QString& eliteBakers) const; + +public slots: + void replyFinished(QNetworkReply* reply) const; + +private: + MainWindow& m_mainWindow; + QNetworkAccessManager m_manager; + + void error(const QString& error) const; +};