Unify code for about dialog image and attribution
It is the same for all components so define it at one place.
This commit is contained in:
parent
f2b1a0fe88
commit
01f722c690
|
@ -99,12 +99,8 @@ void SyncthingFileItemActionStaticData::rescanDir(const QString &dirId, const QS
|
||||||
|
|
||||||
void SyncthingFileItemActionStaticData::showAboutDialog()
|
void SyncthingFileItemActionStaticData::showAboutDialog()
|
||||||
{
|
{
|
||||||
auto *const aboutDialog = new AboutDialog(nullptr, QStringLiteral(APP_NAME),
|
auto *const aboutDialog = new AboutDialog(nullptr, QStringLiteral(APP_NAME), aboutDialogAttribution(), QStringLiteral(APP_VERSION),
|
||||||
QStringLiteral(APP_AUTHOR "<br>Syncthing icons from <a href=\"https://syncthing.net\">Syncthing project</a><br>Using "
|
CppUtilities::applicationInfo.dependencyVersions, QStringLiteral(APP_URL), QStringLiteral(APP_DESCRIPTION), aboutDialogImage());
|
||||||
"icons from <a href=\"https://forkaweso.me\">Fork "
|
|
||||||
"Awesome</a> (see <a href=\"https://forkaweso.me/Fork-Awesome/license\">their license</a>)"),
|
|
||||||
QStringLiteral(APP_VERSION), CppUtilities::applicationInfo.dependencyVersions, QStringLiteral(APP_URL), QStringLiteral(APP_DESCRIPTION),
|
|
||||||
renderSvgImage(makeSyncthingIcon(), QSize(128, 128)).toImage());
|
|
||||||
aboutDialog->setWindowTitle(tr("About") + QStringLiteral(" - " APP_NAME));
|
aboutDialog->setWindowTitle(tr("About") + QStringLiteral(" - " APP_NAME));
|
||||||
aboutDialog->setWindowIcon(QIcon::fromTheme(QStringLiteral("syncthingtray")));
|
aboutDialog->setWindowIcon(QIcon::fromTheme(QStringLiteral("syncthingtray")));
|
||||||
aboutDialog->setAttribute(Qt::WA_DeleteOnClose);
|
aboutDialog->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
|
@ -2,6 +2,9 @@
|
||||||
|
|
||||||
#include "resources/qtconfig.h"
|
#include "resources/qtconfig.h"
|
||||||
|
|
||||||
|
// use meta-data of syncthingtray application here
|
||||||
|
#include "resources/../../tray/resources/config.h"
|
||||||
|
|
||||||
#include <qtutilities/misc/compat.h>
|
#include <qtutilities/misc/compat.h>
|
||||||
|
|
||||||
#include <qtforkawesome/icon.h>
|
#include <qtforkawesome/icon.h>
|
||||||
|
@ -330,4 +333,18 @@ IconManager &IconManager::instance(const QPalette *palette)
|
||||||
return iconManager;
|
return iconManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString aboutDialogAttribution()
|
||||||
|
{
|
||||||
|
return QStringLiteral(
|
||||||
|
"<p>Developed by " APP_AUTHOR
|
||||||
|
"<br>Fallback icons from KDE/Breeze project<br>Syncthing icons from <a href=\"https://syncthing.net\">Syncthing project</a><br>Using "
|
||||||
|
"icons from <a href=\"https://forkaweso.me\">Fork "
|
||||||
|
"Awesome</a> (see <a href=\"https://forkaweso.me/Fork-Awesome/license\">their license</a>)</p>");
|
||||||
|
}
|
||||||
|
|
||||||
|
QImage aboutDialogImage()
|
||||||
|
{
|
||||||
|
return renderSvgImage(makeSyncthingIcon(), QSize(128, 128)).toImage();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
|
|
||||||
QT_FORWARD_DECLARE_CLASS(QColor)
|
QT_FORWARD_DECLARE_CLASS(QColor)
|
||||||
QT_FORWARD_DECLARE_CLASS(QPalette)
|
QT_FORWARD_DECLARE_CLASS(QPalette)
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QImage)
|
||||||
|
QT_FORWARD_DECLARE_CLASS(QString)
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
|
|
||||||
|
@ -215,6 +217,9 @@ inline const ForkAwesomeIcons &commonForkAwesomeIcons()
|
||||||
return IconManager::instance().commonForkAwesomeIcons();
|
return IconManager::instance().commonForkAwesomeIcons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LIB_SYNCTHING_MODEL_EXPORT QString aboutDialogAttribution();
|
||||||
|
LIB_SYNCTHING_MODEL_EXPORT QImage aboutDialogImage();
|
||||||
|
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
|
||||||
#endif // DATA_SYNCTHINGICONS_H
|
#endif // DATA_SYNCTHINGICONS_H
|
||||||
|
|
|
@ -370,12 +370,8 @@ void SyncthingApplet::showOwnDeviceId()
|
||||||
void SyncthingApplet::showAboutDialog()
|
void SyncthingApplet::showAboutDialog()
|
||||||
{
|
{
|
||||||
if (!m_aboutDlg) {
|
if (!m_aboutDlg) {
|
||||||
m_aboutDlg = new AboutDialog(nullptr, QStringLiteral(APP_NAME),
|
m_aboutDlg = new AboutDialog(nullptr, QStringLiteral(APP_NAME), aboutDialogAttribution(), QStringLiteral(APP_VERSION),
|
||||||
QStringLiteral("<p>Developed by " APP_AUTHOR "<br>Syncthing icons from <a href=\"https://syncthing.net\">Syncthing project</a><br>Using "
|
CppUtilities::applicationInfo.dependencyVersions, QStringLiteral(APP_URL), QStringLiteral(APP_DESCRIPTION), aboutDialogImage());
|
||||||
"icons from <a href=\"https://forkaweso.me\">Fork "
|
|
||||||
"Awesome</a> (see <a href=\"https://forkaweso.me/Fork-Awesome/license\">their license</a>)</p>"),
|
|
||||||
QStringLiteral(APP_VERSION), CppUtilities::applicationInfo.dependencyVersions, QStringLiteral(APP_URL), QStringLiteral(APP_DESCRIPTION),
|
|
||||||
renderSvgImage(makeSyncthingIcon(), QSize(128, 128)).toImage());
|
|
||||||
m_aboutDlg->setWindowTitle(tr("About") + QStringLiteral(" - " APP_NAME));
|
m_aboutDlg->setWindowTitle(tr("About") + QStringLiteral(" - " APP_NAME));
|
||||||
m_aboutDlg->setWindowIcon(QIcon::fromTheme(QStringLiteral("syncthingtray")));
|
m_aboutDlg->setWindowIcon(QIcon::fromTheme(QStringLiteral("syncthingtray")));
|
||||||
m_aboutDlg->setAttribute(Qt::WA_DeleteOnClose);
|
m_aboutDlg->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
|
|
|
@ -264,13 +264,8 @@ void TrayWidget::showAboutDialog()
|
||||||
s_dialogParent = new QWidget();
|
s_dialogParent = new QWidget();
|
||||||
}
|
}
|
||||||
if (!s_aboutDlg) {
|
if (!s_aboutDlg) {
|
||||||
s_aboutDlg = new AboutDialog(s_dialogParent, QString(),
|
s_aboutDlg = new AboutDialog(
|
||||||
QStringLiteral(
|
s_dialogParent, QString(), aboutDialogAttribution(), QString(), {}, QStringLiteral(APP_URL), QString(), aboutDialogImage());
|
||||||
"<p>Developed by " APP_AUTHOR
|
|
||||||
"<br>Fallback icons from KDE/Breeze project<br>Syncthing icons from <a href=\"https://syncthing.net\">Syncthing project</a><br>Using "
|
|
||||||
"icons from <a href=\"https://forkaweso.me\">Fork "
|
|
||||||
"Awesome</a> (see <a href=\"https://forkaweso.me/Fork-Awesome/license\">their license</a>)</p>"),
|
|
||||||
QString(), {}, QStringLiteral(APP_URL), QString(), renderSvgImage(makeSyncthingIcon(), QSize(128, 128)).toImage());
|
|
||||||
s_aboutDlg->setWindowTitle(tr("About") + QStringLiteral(" - " APP_NAME));
|
s_aboutDlg->setWindowTitle(tr("About") + QStringLiteral(" - " APP_NAME));
|
||||||
s_aboutDlg->setWindowIcon(QIcon(QStringLiteral(":/icons/hicolor/scalable/app/syncthingtray.svg")));
|
s_aboutDlg->setWindowIcon(QIcon(QStringLiteral(":/icons/hicolor/scalable/app/syncthingtray.svg")));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue