From 5ace4e219c851ed7070a03d6dc4de354255ede9b Mon Sep 17 00:00:00 2001 From: Gary Wang Date: Mon, 5 Oct 2020 20:43:30 +0800 Subject: [PATCH] chore: about dialog strings, also add a thanks tab --- aboutdialog.cpp | 84 +++++++++---- aboutdialog.h | 2 + languages/PineapplePictures.ts | 134 +++++++++++++++++---- languages/PineapplePictures_zh_CN.ts | 169 ++++++++++++++++++--------- mainwindow.cpp | 2 +- settingsdialog.cpp | 2 + 6 files changed, 290 insertions(+), 103 deletions(-) diff --git a/aboutdialog.cpp b/aboutdialog.cpp index 119ba00a..419c3ae4 100644 --- a/aboutdialog.cpp +++ b/aboutdialog.cpp @@ -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("

%1

").arg(tr("Launch application with image file path as argument to load the file.")), + QStringLiteral("

%1

").arg(tr("Drag and drop image file onto the window is also supported.")), + QStringLiteral("

%1

").arg(tr("Context menu option explanation:")), + QStringLiteral("") }; QStringList aboutStr { @@ -36,27 +43,42 @@ AboutDialog::AboutDialog(QWidget *parent) #ifdef GIT_DESCRIBE_VERSION_STRING (QStringLiteral("
") + tr("Version: %1").arg(GIT_DESCRIBE_VERSION_STRING)), #endif // GIT_DESCRIBE_VERSION_STRING - "
", + QStringLiteral("
"), + tr("Copyright (c) 2020 %1").arg(QStringLiteral("@BLumia")), + QStringLiteral("
"), + tr("Logo designed by %1").arg(QStringLiteral("@Lovelyblack")), + QStringLiteral("
"), tr("Built with Qt %1 (%2)").arg(QT_VERSION_STR, QSysInfo::buildCpuArchitecture()), QStringLiteral("
%2").arg("https://github.com/BLumia/pineapple-pictures", tr("Source code")), - "" + QStringLiteral("") }; - QString licenseDescStr(tr( - "

%1 is released under the MIT License.

" - "

This license grants people a number of freedoms:

" - "" - "

The MIT license guarantees you this freedom. Nobody is ever permitted to take it away.

" - )); + QStringList specialThanksStr { + QStringLiteral("

%1

%3

%4

").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("

%1

%2

").arg( + tr("Translators"), + tr("I would like to thank the following people who volunteered to translate this application.") + ), +#endif + }; QStringList licenseStr { QStringLiteral("

%1

").arg(tr("Your Rights")), - licenseDescStr, + QStringLiteral("

%1

%2

").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("%1")), + QStringLiteral("

%1

").arg(tr("The MIT license guarantees you this freedom. Nobody is ever permitted to take it away.")), QStringLiteral("
%2
") }; @@ -83,16 +105,32 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. )")); + QStringList thirdPartyLibsStr { + QStringLiteral("

%1

").arg(tr("Third-party Libraries used by %1")), + tr("%1 is built on the following free software libraries:"), + QStringLiteral("") + }; + 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::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); } diff --git a/aboutdialog.h b/aboutdialog.h index 447bef8e..d4845620 100644 --- a/aboutdialog.h +++ b/aboutdialog.h @@ -22,7 +22,9 @@ class AboutDialog : public QDialog QTextBrowser * m_helpTextEdit = nullptr; QTextBrowser * m_aboutTextEdit = nullptr; + QTextBrowser * m_specialThanksTextEdit = nullptr; QTextBrowser * m_licenseTextEdit = nullptr; + QTextBrowser * m_3rdPartyLibsTextEdit = nullptr; }; #endif // ABOUTDIALOG_H diff --git a/languages/PineapplePictures.ts b/languages/PineapplePictures.ts index af8bb9d4..9935ee1d 100644 --- a/languages/PineapplePictures.ts +++ b/languages/PineapplePictures.ts @@ -4,72 +4,157 @@ AboutDialog - + About - + Launch application with image file path as argument to load the file. - + Drag and drop image file onto the window is also supported. - + Context menu option explanation: - + Make window stay on top of all other windows. - + Avoid close window accidentally. (eg. by double clicking the window) - + Version: %1 - + + Copyright (c) 2020 %1 + + + + + Logo designed by %1 + + + + Built with Qt %1 (%2) - + Source code - - <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> + + Contributors - + + List of contributors on GitHub + + + + + Thanks to all people who contributed to this project. + + + + + Translators + + + + + I would like to thank the following people who volunteered to translate this application. + + + + + &Special Thanks + + + + + &Third-party Libraries + + + + Your Rights - + + %1 is released under the MIT License. + + + + + This license grants people a number of freedoms: + + + + + You are free to use %1, for any purpose + + + + + You are free to distribute %1 + + + + + You can study how %1 works and change it + + + + + You can distribute changed versions of %1 + + + + + The MIT license guarantees you this freedom. Nobody is ever permitted to take it away. + + + + + Third-party Libraries used by %1 + + + + + %1 is built on the following free software libraries: + + + + &Help - + &About - + &License @@ -138,13 +223,13 @@ - + Stay on top - + Protected mode @@ -163,27 +248,32 @@ SettingsDialog - + + Settings + + + + Do nothing - + Close the window - + Toggle maximize - + Stay on top when start-up - + Double-click behavior diff --git a/languages/PineapplePictures_zh_CN.ts b/languages/PineapplePictures_zh_CN.ts index b5a246d5..cc1d8664 100644 --- a/languages/PineapplePictures_zh_CN.ts +++ b/languages/PineapplePictures_zh_CN.ts @@ -4,72 +4,157 @@ AboutDialog - + About 关于 - + Launch application with image file path as argument to load the file. 以图片文件的路径作为参数运行程序即可直接打开图片文件。 - + Drag and drop image file onto the window is also supported. 也支持拖放图片文件到窗口内来加载图片。 - + Context menu option explanation: 菜单项说明: - + Make window stay on top of all other windows. 使窗口始终至于其它非置顶窗口上方。 - + Avoid close window accidentally. (eg. by double clicking the window) 避免窗口意外关闭。(如:不小心双击了窗口触发了关闭窗口行为) - + Version: %1 版本: %1 - + + Copyright (c) 2020 %1 + 版权所有 (c) 2020 %1 + + + + Logo designed by %1 + Logo 由 %1 设计 + + + Built with Qt %1 (%2) 使用 Qt %1 (%2) 进行构建 - + Source code 源代码 - - <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> - <p><i>%1</i> 是在 MIT 许可协议下发布的。</p><p>此许可证赋予人们以下自由的权利:</p><ul><li>任何人都可以为了任何目的自由地使用 <i>%1</i></li><li>任何人都可以自由地分发 <i>%1</i></li><li>任何人都可以自由地研究 <i>%1</i> 的工作原理并对其进行修改</li><li>任何人都可以自由地分发修改过的 <i>%1</i> 版本</li></ul><p>此软件通过 MIT 许可证赋予用户上述自由,任何人无权剥夺。</p> + + Contributors + 贡献者 + + + + List of contributors on GitHub + GitHub 上的贡献者列表 - + + Thanks to all people who contributed to this project. + 感谢所有参与此项目的朋友。 + + + + Translators + 翻译者 + + + + I would like to thank the following people who volunteered to translate this application. + 我想要感谢下列自愿参与翻译此应用程序的朋友。 + + + + &Special Thanks + 致谢(&S) + + + + &Third-party Libraries + 第三方程序库(&T) + + + Your Rights 用户的权利 - + + %1 is released under the MIT License. + %1 是在 MIT 许可协议下发布的。 + + + + This license grants people a number of freedoms: + 此许可证赋予人们以下自由的权利: + + + + You are free to use %1, for any purpose + 任何人都可以为了任何目的自由地使用 %1 + + + + You are free to distribute %1 + 任何人都可以自由地分发 %1 + + + + You can study how %1 works and change it + 任何人都可以自由地研究 %1 的工作原理并对其进行修改 + + + + You can distribute changed versions of %1 + 任何人都可以自由地分发修改过的 %1 版本 + + + + The MIT license guarantees you this freedom. Nobody is ever permitted to take it away. + 此软件通过 MIT 许可证赋予用户上述自由,任何人无权剥夺。 + + + + Third-party Libraries used by %1 + %1 使用的第三方程序库 + + + + %1 is built on the following free software libraries: + %1 采用了下列自由软件程序库进行构建: + + + &Help 帮助(&H) - + &About 关于(&A) - + &License 软件许可证(&L) @@ -117,10 +202,6 @@ &Copy 复制(&C) - - Copy &Pixmap - 复制位图(&P) - Copy P&ixmap @@ -142,13 +223,13 @@ 粘贴图像文件(&P) - + Stay on top 总在最前 - + Protected mode 保护模式 @@ -163,62 +244,36 @@ Help 帮助 - - Launch application with image file path as argument to load the file. - 以图片文件的路径作为参数运行程序即可直接打开图片文件。 - - - Drag and drop image file onto the window is also supported. - 也支持拖放图片文件到窗口内来加载图片。 - - - Context menu option explanation: - 菜单项说明: - - - Make window stay on top of all other windows. - 使窗口始终至于其它非置顶窗口上方。 - - - Avoid close window accidentally. (eg. by double clicking the window) - 避免窗口意外关闭。(如:不小心双击了窗口触发了关闭窗口行为) - - QCoreApplication - - Make window stay on top of all other windows. - 使窗口始终至于其它非置顶窗口上方。 - + SettingsDialog - Avoid close window accidentally. (eg. by double clicking the window) - 避免窗口意外关闭。(如:不小心双击了窗口触发了关闭窗口行为) + + Settings + 设定 - - - SettingsDialog - + Do nothing 什么也不做 - + Close the window 关闭窗口 - + Toggle maximize 最大化窗口 - + Stay on top when start-up 启动时保持窗口总在最前 - + Double-click behavior 双击时的行为 diff --git a/mainwindow.cpp b/mainwindow.cpp index 1c203d2b..8479c1c9 100644 --- a/mainwindow.cpp +++ b/mainwindow.cpp @@ -37,7 +37,7 @@ MainWindow::MainWindow(QWidget *parent) : } this->setAttribute(Qt::WA_TranslucentBackground, true); - this->setMinimumSize(350, 350); + this->setMinimumSize(350, 330); this->setWindowIcon(QIcon(":/icons/app-icon.svg")); this->setMouseTracking(true); diff --git a/settingsdialog.cpp b/settingsdialog.cpp index 02db35d0..6a097db1 100644 --- a/settingsdialog.cpp +++ b/settingsdialog.cpp @@ -12,6 +12,8 @@ SettingsDialog::SettingsDialog(QWidget *parent) , m_stayOnTop(new QCheckBox) , m_doubleClickBehavior(new QComboBox) { + this->setWindowTitle(tr("Settings")); + QFormLayout * settingsForm = new QFormLayout(this); static QMap _map {