Toolbox Qt
Loading...
Searching...
No Matches
tbq::DialogAbout Class Reference

Allow to easily create an "about" dialog window. More...

Inheritance diagram for tbq::DialogAbout:
Collaboration diagram for tbq::DialogAbout:

Classes

struct  Ressource
 
struct  RessourceGroup
 

Public Types

using ListDeps = QVector<DepInfos>
 
using ListResGroups = QVector<RessourceGroup>
 

Public Member Functions

 DialogAbout (QWidget *parent=nullptr)
 Create a dialog about.
 
void setAppInfos (const QString &name, const QVersionNumber &version)
 Use to set application main informations.
 
void setLogo (const QPixmap &logo)
 Use to set application logo.
 
void addSectionAbout (const QString &aboutApp, const RichLink &linkHome=RichLink(), const RichLink &linkBug=RichLink())
 Add an "about" section.
 
void addSectionDeps (const ListDeps &listDeps, const QString &invalidSemver="/")
 Add section used to list all dependencies.
 
void addSectionRessources (const ListResGroups &listGroups)
 Add section used to list all used ressources (images, fonts, audios, etc...).
 
void addSectionChangelog (const QUrl &sourceUrl, QTextDocument::ResourceType type=QTextDocument::MarkdownResource)
 Add a changelog section.
 
void addSectionLicense (const QUrl &sourceUrl, QTextDocument::ResourceType type=QTextDocument::MarkdownResource)
 Add a license section.
 
void addSectionFromDoc (const QString &name, const QUrl &sourceUrl, QTextDocument::ResourceType type)
 Add a custom section using ressource.
 

Detailed Description

Allow to easily create an "about" dialog window.

For example:

1#include "toolboxqt/widgets/dialogabout.h"
2
3void MenuBar::showHelpAbout()
4{
5 /* Create dialog about */
6 tbq::DialogAbout *dialogAbout = new tbq::DialogAbout(this);
7 dialogAbout->setAttribute(Qt::WA_DeleteOnClose);
8
9 /* Set informations */
10 // Set app main informations
11 dialogAbout->addSectionAbout(
12 "My great application which do many things:\n"
13 "- The first great things\n"
14 "- The second great things\n",
15 tbq::RichLink(QUrl("https://github.com/myuser/myproject")),
16 tbq::RichLink(QUrl("https://github.com/myuser/myproject/issues"))
17 );
18
19 // Set dependency section
20 const QString teaseVer = QString::fromStdString(tease::Semver::getLibraryVersion().toString('.', 1));
21 const tbq::DialogAbout::ListDeps listDeps = {
22 tbq::DepInfos(tbq::RichLink(QUrl("https://www.qt.io/"), "Qt Framework"), QVersionNumber::fromString(QT_VERSION_STR)),
23
24 tbq::DepInfos(tbq::RichLink(QUrl("https://github.com/google/googletest"), "Google Tests"), QVersionNumber()),
25 tbq::DepInfos(tbq::RichLink(QUrl("https://github.com/nlohmann/json"), "JSON for Modern C++"), QVersionNumber()),
26 tbq::DepInfos(tbq::RichLink(QUrl("https://github.com/legerch/QLogger"), "QLogger"), QLogger::QLoggerFactory::getLibraryVersion()),
27 tbq::DepInfos(tbq::RichLink(QUrl("https://github.com/legerch/qtavplayer"), "QtAvPlayer"), QVersionNumber::fromString(QTAVPLAYER_VERSION_STR)),
28 tbq::DepInfos(tbq::RichLink(QUrl("https://github.com/stachenov/quazip"), "Quazip"), QVersionNumber()),
29 tbq::DepInfos(tbq::RichLink(QUrl("https://github.com/legerch/ToolBoxQt"), "Toolbox Qt"), QVersionNumber::fromString(TOOLBOXQT_VERSION_STR)),
30 tbq::DepInfos(tbq::RichLink(QUrl("https://github.com/legerch/TransferEase"), "TransferEase"), QVersionNumber::fromString(teaseVer)),
31 tbq::DepInfos(tbq::RichLink(QUrl("https://zlib.net/"), "ZLib"), QVersionNumber()),
32 };
33 dialogAbout->addSectionDeps(listDeps);
34
35 // Set credit section
36 const tbq::DialogAbout::ListResGroups listRes = {
37 {
38 .name = "Icons",
39 .listRes = {
40 {.source = tbq::RichLink(QUrl("https://www.flaticon.com/free-icon/local-area_2082759?term=computer&related_id=2082759"), "Main logo"), .author = "Eucalyp", .license = "Flaticon License"},
41 {.source = tbq::RichLink(QUrl("https://www.bankoficons/greaticon1"), "Action1 icon"), .author = "David Awesome", .license = "Creative Commons"},
42 {.source = tbq::RichLink(QUrl("https://www.bankoficons/greaticon2"), "Sub menu icon"), .author = "Paul Allesome", .license = "Creative Commons"},
43 }
44 },
45 {
46 .name = "Fonts",
47 .listRes = {
48 {.source = tbq::RichLink(QUrl("https://www.bankoffonts/greatfont1"), "App font"), .author = "Dave Calligraph", .license = "Creative Commons"},
49 {.source = tbq::RichLink(QUrl("https://www.bankoffonts/greatfont2"), "Emoji font"), .author = "Sascha Isaac", .license = "GPL"},
50 }
51 }
52 };
53 dialogAbout->addSectionRessources(listRes);
54
55 // Add useful documents
56 dialogAbout->addSectionChangelog(QUrl("qrc:/docs/changelog"));
57 dialogAbout->addSectionLicense(QUrl("qrc:/docs/license"));
58
59 /* Display dialog about */
60 dialogAbout->show();
61}
Definition depinfos.h:13
Allow to easily create an "about" dialog window.
Definition dialogabout.h:19
void addSectionRessources(const ListResGroups &listGroups)
Add section used to list all used ressources (images, fonts, audios, etc...).
Definition dialogabout.cpp:220
void addSectionDeps(const ListDeps &listDeps, const QString &invalidSemver="/")
Add section used to list all dependencies.
Definition dialogabout.cpp:174
void addSectionAbout(const QString &aboutApp, const RichLink &linkHome=RichLink(), const RichLink &linkBug=RichLink())
Add an "about" section.
Definition dialogabout.cpp:111
void addSectionLicense(const QUrl &sourceUrl, QTextDocument::ResourceType type=QTextDocument::MarkdownResource)
Add a license section.
Definition dialogabout.cpp:273
void addSectionChangelog(const QUrl &sourceUrl, QTextDocument::ResourceType type=QTextDocument::MarkdownResource)
Add a changelog section.
Definition dialogabout.cpp:257

Constructor & Destructor Documentation

◆ DialogAbout()

tbq::DialogAbout::DialogAbout ( QWidget * parent = nullptr)
explicit

Create a dialog about.

Methods setAppInfos() and setLogo() are called by this constructor. Informations used are the one provided QApplication global instance

Parameters
[in,out]parentParent of the dialog.
See also
addSectionAbout(), addSectionDeps(), addSectionRessources()
addSectionChangelog(), addSectionLicense()
addSectionFromDoc()

Member Function Documentation

◆ addSectionAbout()

void tbq::DialogAbout::addSectionAbout ( const QString & aboutApp,
const RichLink & linkHome = RichLink(),
const RichLink & linkBug = RichLink() )

Add an "about" section.

Parameters
[in]aboutAppDescription of the application goals.
This field is a rich text.
[in]linkHomeLink to the project homepage.
[in]linkBugLink to the project bug tracker.

◆ addSectionChangelog()

void tbq::DialogAbout::addSectionChangelog ( const QUrl & sourceUrl,
QTextDocument::ResourceType type = QTextDocument::MarkdownResource )

Add a changelog section.

Parameters
[in]sourceUrlPath to changelog ressource to use
[in]typeType of ressource.
See also
addSectionLicense()
addSectionFromDoc()

◆ addSectionDeps()

void tbq::DialogAbout::addSectionDeps ( const ListDeps & listDeps,
const QString & invalidSemver = "/" )

Add section used to list all dependencies.

Parameters
[in]listDepsList of dependencies to display
[in]invalidSemverText to display when version is invalid or unknown.
See also
addSectionRessources()

◆ addSectionFromDoc()

void tbq::DialogAbout::addSectionFromDoc ( const QString & name,
const QUrl & sourceUrl,
QTextDocument::ResourceType type )

Add a custom section using ressource.

Parameters
[in]nameSection name
[in]sourceUrlPath to ressource to use
[in]typeType of ressource.
See also
addSectionChangelog(), addSectionLicense()

◆ addSectionLicense()

void tbq::DialogAbout::addSectionLicense ( const QUrl & sourceUrl,
QTextDocument::ResourceType type = QTextDocument::MarkdownResource )

Add a license section.

Parameters
[in]sourceUrlPath to license ressource to use
[in]typeType of ressource.
See also
addSectionChangelog()
addSectionFromDoc()

◆ addSectionRessources()

void tbq::DialogAbout::addSectionRessources ( const ListResGroups & listGroups)

Add section used to list all used ressources (images, fonts, audios, etc...).

Parameters
[in]listGroupsList of group ressources to display.
See also
addSectionDeps()

◆ setAppInfos()

void tbq::DialogAbout::setAppInfos ( const QString & name,
const QVersionNumber & version )

Use to set application main informations.

Parameters
[in]nameApplication name
[in]versionApplication version
See also
setLogo()

◆ setLogo()

void tbq::DialogAbout::setLogo ( const QPixmap & logo)

Use to set application logo.

Parameters
[in]logoApplication logo to use
See also
setAppInfos()

The documentation for this class was generated from the following files: