1
0

chore: about dialog strings, also add a thanks tab

This commit is contained in:
Gary Wang
2020-10-05 20:43:30 +08:00
parent c78eb1a272
commit 5ace4e219c
6 changed files with 295 additions and 108 deletions

View File

@@ -15,19 +15,26 @@ AboutDialog::AboutDialog(QWidget *parent)
, m_buttonBox(new QDialogButtonBox)
, m_helpTextEdit(new QTextBrowser)
, m_aboutTextEdit(new QTextBrowser)
, m_specialThanksTextEdit(new QTextBrowser)
, m_licenseTextEdit(new QTextBrowser)
, m_3rdPartyLibsTextEdit(new QTextBrowser)
{
this->setWindowTitle(tr("About"));
QStringList helpStr {
tr("Launch application with image file path as argument to load the file."),
tr("Drag and drop image file onto the window is also supported."),
"",
tr("Context menu option explanation:"),
("* " + QCoreApplication::translate("MainWindow", "Stay on top") + " : "
+ this->tr("Make window stay on top of all other windows.")),
("* " + QCoreApplication::translate("MainWindow", "Protected mode") + " : "
+ this->tr("Avoid close window accidentally. (eg. by double clicking the window)"))
QStringLiteral("<p>%1</p>").arg(tr("Launch application with image file path as argument to load the file.")),
QStringLiteral("<p>%1</p>").arg(tr("Drag and drop image file onto the window is also supported.")),
QStringLiteral("<p>%1</p>").arg(tr("Context menu option explanation:")),
QStringLiteral("<ul>"),
QStringLiteral("<li><b>%1</b>:<br/>%2</li>").arg(
QCoreApplication::translate("MainWindow", "Stay on top"),
this->tr("Make window stay on top of all other windows.")
),
QStringLiteral("<li><b>%1</b>:<br/>%2</li>").arg(
QCoreApplication::translate("MainWindow", "Protected mode"),
this->tr("Avoid close window accidentally. (eg. by double clicking the window)")
),
QStringLiteral("</ul>")
};
QStringList aboutStr {
@@ -36,27 +43,42 @@ AboutDialog::AboutDialog(QWidget *parent)
#ifdef GIT_DESCRIBE_VERSION_STRING
(QStringLiteral("<br/>") + tr("Version: %1").arg(GIT_DESCRIBE_VERSION_STRING)),
#endif // GIT_DESCRIBE_VERSION_STRING
"<hr/>",
QStringLiteral("<hr/>"),
tr("Copyright (c) 2020 %1").arg(QStringLiteral("<a href='https://github.com/BLumia'>@BLumia</a>")),
QStringLiteral("<br/>"),
tr("Logo designed by %1").arg(QStringLiteral("<a href='https://github.com/Lovelyblack'>@Lovelyblack</a>")),
QStringLiteral("<hr/>"),
tr("Built with Qt %1 (%2)").arg(QT_VERSION_STR, QSysInfo::buildCpuArchitecture()),
QStringLiteral("<br/><a href='%1'>%2</a>").arg("https://github.com/BLumia/pineapple-pictures", tr("Source code")),
"</center>"
QStringLiteral("</center>")
};
QString licenseDescStr(tr(
"<p><i>%1</i> is released under the MIT License.</p>"
"<p>This license grants people a number of freedoms:</p>"
"<ul>"
"<li>You are free to use <i>%1</i>, for any purpose</li>"
"<li>You are free to distribute <i>%1</i></li>"
"<li>You can study how <i>%1</i> works and change it</li>"
"<li>You can distribute changed versions of <i>%1</i></li>"
"</ul>"
"<p>The MIT license guarantees you this freedom. Nobody is ever permitted to take it away.</p>"
));
QStringList specialThanksStr {
QStringLiteral("<h1 align='center'>%1</h1><a href='%2'>%3</a><p>%4</p>").arg(
tr("Contributors"),
QStringLiteral("https://github.com/BLumia/pineapple-pictures/graphs/contributors"),
tr("List of contributors on GitHub"),
tr("Thanks to all people who contributed to this project.")
),
#if 0
QStringLiteral("<h1 align='center'>%1</h1><p>%2</p>").arg(
tr("Translators"),
tr("I would like to thank the following people who volunteered to translate this application.")
),
#endif
};
QStringList licenseStr {
QStringLiteral("<h1 align='center'><b>%1</b></h1>").arg(tr("Your Rights")),
licenseDescStr,
QStringLiteral("<p>%1</p><p>%2</p><ul><li>%3</li><li>%4</li><li>%5</li><li>%6</li></ul>").arg(
tr("%1 is released under the MIT License."), // %1
tr("This license grants people a number of freedoms:"), // %2
tr("You are free to use %1, for any purpose"), // %3
tr("You are free to distribute %1"), // %4
tr("You can study how %1 works and change it"), // %5
tr("You can distribute changed versions of %1") // %6
).arg(QStringLiteral("<i>%1</i>")),
QStringLiteral("<p>%1</p>").arg(tr("The MIT license guarantees you this freedom. Nobody is ever permitted to take it away.")),
QStringLiteral("<hr/><pre>%2</pre>")
};
@@ -83,16 +105,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
)"));
QStringList thirdPartyLibsStr {
QStringLiteral("<h1 align='center'><b>%1</b></h1>").arg(tr("Third-party Libraries used by %1")),
tr("%1 is built on the following free software libraries:"),
QStringLiteral("<ul>"),
QStringLiteral("<li><a href='%1'>%2</a>: %3</li>").arg("https://www.qt.io/", "Qt", "GPLv2 + GPLv3 + LGPLv2.1 + LGPLv3"),
QStringLiteral("</ul>")
};
m_helpTextEdit->setText(helpStr.join('\n'));
m_aboutTextEdit->setText(aboutStr.join('\n'));
m_aboutTextEdit->setOpenExternalLinks(true);
m_specialThanksTextEdit->setText(specialThanksStr.join('\n'));
m_specialThanksTextEdit->setOpenExternalLinks(true);
m_licenseTextEdit->setText(licenseStr.join('\n').arg(qApp->applicationDisplayName(), mitLicense));
m_3rdPartyLibsTextEdit->setText(thirdPartyLibsStr.join('\n').arg(qApp->applicationDisplayName()));
m_3rdPartyLibsTextEdit->setOpenExternalLinks(true);
m_tabWidget->addTab(m_helpTextEdit, tr("&Help"));
m_tabWidget->addTab(m_aboutTextEdit, tr("&About"));
m_tabWidget->addTab(m_specialThanksTextEdit, tr("&Special Thanks"));
m_tabWidget->addTab(m_licenseTextEdit, tr("&License"));
m_tabWidget->addTab(m_3rdPartyLibsTextEdit, tr("&Third-party Libraries"));
m_buttonBox->setStandardButtons(QDialogButtonBox::Close);
connect(m_buttonBox, QOverload<QAbstractButton *>::of(&QDialogButtonBox::clicked), this, [this](){
@@ -106,7 +144,7 @@ SOFTWARE.
this->setLayout(mainLayout);
this->setMinimumSize(361, 161); // not sure why it complain "Unable to set geometry"
this->resize(520, 330);
this->resize(520, 350);
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
}