Special contributor mentions on the about screen (#7197)

* Remove obsolete data

* Add section "Key contributors"

* Add "Elite Backers" label

* Add Elite Backers

* Remove borders for Elite backers section

* Add link "Become an Elite Backer"

* Become an Elite Backer as a separate label

* Add link to the credits page

* Fix for macOS

* Fix fonts and spaces for Windows

* Fix window size for Linux

* Loading credits using API

* Update ChangeLog

* Fix code smells

* Requested changes

* Change URL

* Update AboutDialogBase.ui

Co-authored-by: Serhii Hadzhilov <serhii@symless.com>
This commit is contained in:
Serhii Hadzhilov 2022-06-30 14:48:26 +03:00 committed by GitHub
parent bcfeb251a9
commit 268b0f660f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 435 additions and 129 deletions

View file

@ -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
======

View file

@ -17,26 +17,29 @@
*/
#include "AboutDialog.h"
#include "CreditsLoader.h"
#include <QtCore>
#include <QtGui>
#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"(<p>
Keyboard and mouse sharing application. Cross platform and open source.<br /><br />
Copyright © 2012-%%YEAR%% Symless Ltd.<br />
Copyright © 2002-2012 Chris Schoeneman, Nick Bolton, Volker Lanz.<br /><br />
Synergy is released under the GNU General Public License (GPLv2).<br /><br />
Synergy is based on CosmoSynergy by Richard Lee and Adam Feder.<br />
The Synergy GUI is based on QSynergy by Volker Lanz.<br /><br />
Visit our website for help and info (symless.com).
Copyright © %%YEAR%% Symless Ltd.<br /><br />
Synergy is released under the GNU General Public License (GPLv2).</p>
<p style="font-size: 14px">Key contributors<br>
<span style="font-size: 11px">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.</span>
</p>)");
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);
}

View file

@ -22,6 +22,8 @@
#include <QDialog>
#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

View file

@ -13,7 +13,7 @@
<x>0</x>
<y>0</y>
<width>450</width>
<height>300</height>
<height>495</height>
</rect>
</property>
<property name="sizePolicy">
@ -25,13 +25,13 @@
<property name="minimumSize">
<size>
<width>450</width>
<height>300</height>
<height>495</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>450</width>
<height>300</height>
<height>495</height>
</size>
</property>
<property name="windowTitle">
@ -41,7 +41,256 @@
<bool>true</bool>
</property>
<layout class="QGridLayout">
<item row="5" column="1" colspan="2">
<item row="10" column="1">
<widget class="QLabel" name="labelCreditsLink">
<property name="text">
<string notr="true">&lt;a href=&quot;https://symless.com/synergy/credits?source=gui&quot; style=&quot;color: #4285F4;&quot;&gt;View the complete credits&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="9" column="1">
<widget class="QLabel" name="labelEliteBackerLink">
<property name="text">
<string>&lt;a href=&quot;https://symless.com/synergy/account-status?source=gui&quot; style=&quot;color: #4285F4;&quot;&gt;Become an Elite Backer&lt;/a&gt;</string>
</property>
<property name="openExternalLinks">
<bool>true</bool>
</property>
</widget>
</item>
<item row="3" column="1">
<spacer name="verticalSpacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>9</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="6" column="1">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="spacing">
<number>1</number>
</property>
<property name="sizeConstraint">
<enum>QLayout::SetNoConstraint</enum>
</property>
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="labelEliteBackers">
<property name="font">
<font>
<pointsize>-1</pointsize>
<bold>false</bold>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-size: 14px</string>
</property>
<property name="text">
<string>Elite Backers</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollAreaEliteBackers">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>419</width>
<height>83</height>
</rect>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>3</number>
</property>
<property name="rightMargin">
<number>3</number>
</property>
<item>
<widget class="QLabel" name="labelEliteBackersData">
<property name="minimumSize">
<size>
<width>0</width>
<height>10</height>
</size>
</property>
<property name="font">
<font>
<pointsize>-1</pointsize>
</font>
</property>
<property name="styleSheet">
<string notr="true">font-size: 11px;s</string>
</property>
<property name="text">
<string>Loading...</string>
</property>
<property name="alignment">
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_Logo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="pixmap">
<pixmap resource="../res/Synergy.qrc">:/res/image/about.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item row="14" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Build Date: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelBuildDate">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>&amp;Ok</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="11" column="1" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>100</height>
</size>
</property>
</spacer>
</item>
<item row="13" column="1" colspan="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLabel" name="label">
@ -90,120 +339,6 @@
</item>
</layout>
</item>
<item row="6" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QLabel" name="label_5">
<property name="text">
<string>Build Date: </string>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="m_pLabelBuildDate">
<property name="text">
<string>Unknown</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="buttonOk">
<property name="text">
<string>&amp;Ok</string>
</property>
</widget>
</item>
</layout>
</item>
<item row="2" column="1" colspan="2">
<widget class="QLabel" name="label_3">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="text">
<string/>
</property>
<property name="margin">
<number>1</number>
</property>
</widget>
</item>
<item row="3" column="1" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>100</height>
</size>
</property>
</spacer>
</item>
<item row="1" column="1" colspan="2">
<spacer name="spacer">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>5</height>
</size>
</property>
</spacer>
</item>
<item row="0" column="1">
<widget class="QLabel" name="label_Logo">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize">
<size>
<width>200</width>
<height>50</height>
</size>
</property>
<property name="text">
<string notr="true"/>
</property>
<property name="pixmap">
<pixmap resource="../res/Synergy.qrc">:/res/image/about.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
<property name="margin">
<number>0</number>
</property>
</widget>
</item>
</layout>
</widget>
<resources>

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#include "CreditsLoader.h"
#include "MainWindow.h"
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QJsonDocument>
#include <QJsonParseError>
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<QString, QVariant> 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, QVariant>();
}
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.");
}

View file

@ -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 <http://www.gnu.org/licenses/>.
*/
#pragma once
#include <QObject>
#include <QNetworkAccessManager>
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;
};