chore: adjust dir structure, add translator name list

This commit is contained in:
Gary Wang 2020-12-25 13:36:34 +08:00
parent b50b69e9b8
commit 7782ed0e23
18 changed files with 31 additions and 18 deletions

View File

@ -60,7 +60,7 @@ set (PPIC_HEADER_FILES
) )
set (PPIC_QRC_FILES set (PPIC_QRC_FILES
resources.qrc assets/resources.qrc
) )
set (PPIC_RC_FILES set (PPIC_RC_FILES
@ -76,7 +76,7 @@ set (PPIC_CPP_FILES_FOR_I18N ${PPIC_CPP_FILES})
qt5_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES}) qt5_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
if (WIN32) if (WIN32)
list(APPEND PPIC_RC_FILES pineapple-pictures.rc) list(APPEND PPIC_RC_FILES assets/pineapple-pictures.rc)
endif () endif ()
add_executable (${EXE_NAME} add_executable (${EXE_NAME}

View File

@ -8,6 +8,7 @@
#include <QApplication> #include <QApplication>
#include <QLabel> #include <QLabel>
#include <QPushButton> #include <QPushButton>
#include <QFile>
AboutDialog::AboutDialog(QWidget *parent) AboutDialog::AboutDialog(QWidget *parent)
: QDialog(parent) : QDialog(parent)
@ -21,7 +22,7 @@ AboutDialog::AboutDialog(QWidget *parent)
{ {
this->setWindowTitle(tr("About")); this->setWindowTitle(tr("About"));
QStringList helpStr { const QStringList helpStr {
QStringLiteral("<p>%1</p>").arg(tr("Launch application with image file path as argument to load the file.")), 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("Drag and drop image file onto the window is also supported.")),
QStringLiteral("<p>%1</p>").arg(tr("Context menu option explanation:")), QStringLiteral("<p>%1</p>").arg(tr("Context menu option explanation:")),
@ -37,7 +38,7 @@ AboutDialog::AboutDialog(QWidget *parent)
QStringLiteral("</ul>") QStringLiteral("</ul>")
}; };
QStringList aboutStr { const QStringList aboutStr {
QStringLiteral("<center><img width='128' height='128' src=':/icons/app-icon.svg'/><br/>"), QStringLiteral("<center><img width='128' height='128' src=':/icons/app-icon.svg'/><br/>"),
qApp->applicationDisplayName(), qApp->applicationDisplayName(),
#ifdef GIT_DESCRIBE_VERSION_STRING #ifdef GIT_DESCRIBE_VERSION_STRING
@ -53,22 +54,26 @@ AboutDialog::AboutDialog(QWidget *parent)
QStringLiteral("</center>") QStringLiteral("</center>")
}; };
QStringList specialThanksStr { QFile translaterHtml(":/plain/translators.html");
bool canOpenFile = translaterHtml.open(QIODevice::ReadOnly);
const QByteArray & translatorList = canOpenFile ? translaterHtml.readAll() : "";
const QStringList specialThanksStr {
QStringLiteral("<h1 align='center'>%1</h1><a href='%2'>%3</a><p>%4</p>").arg( QStringLiteral("<h1 align='center'>%1</h1><a href='%2'>%3</a><p>%4</p>").arg(
tr("Contributors"), tr("Contributors"),
QStringLiteral("https://github.com/BLumia/pineapple-pictures/graphs/contributors"), QStringLiteral("https://github.com/BLumia/pineapple-pictures/graphs/contributors"),
tr("List of contributors on GitHub"), tr("List of contributors on GitHub"),
tr("Thanks to all people who contributed to this project.") tr("Thanks to all people who contributed to this project.")
), ),
#if 0
QStringLiteral("<h1 align='center'>%1</h1><p>%2</p>").arg( QStringLiteral("<h1 align='center'>%1</h1><p>%2</p>%3").arg(
tr("Translators"), tr("Translators"),
tr("I would like to thank the following people who volunteered to translate this application.") tr("I would like to thank the following people who volunteered to translate this application."),
), translatorList
#endif )
}; };
QStringList licenseStr { const QStringList licenseStr {
QStringLiteral("<h1 align='center'><b>%1</b></h1>").arg(tr("Your Rights")), QStringLiteral("<h1 align='center'><b>%1</b></h1>").arg(tr("Your Rights")),
QStringLiteral("<p>%1</p><p>%2</p><ul><li>%3</li><li>%4</li><li>%5</li><li>%6</li></ul>").arg( 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("%1 is released under the MIT License."), // %1
@ -82,7 +87,7 @@ AboutDialog::AboutDialog(QWidget *parent)
QStringLiteral("<hr/><pre>%2</pre>") QStringLiteral("<hr/><pre>%2</pre>")
}; };
QString mitLicense(QStringLiteral(R"(Expat/MIT License const QString mitLicense(QStringLiteral(R"(Expat/MIT License
Copyright (c) 2020 BLumia Copyright (c) 2020 BLumia
@ -105,9 +110,9 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
)")); )"));
QStringList thirdPartyLibsStr { const QStringList thirdPartyLibsStr {
QStringLiteral("<h1 align='center'><b>%1</b></h1>").arg(tr("Third-party Libraries used by %1")), 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:"), tr("%1 is built on the following free software libraries:", "Free as in freedom"),
QStringLiteral("<ul>"), QStringLiteral("<ul>"),
#ifdef HAVE_EXIV2_VERSION #ifdef HAVE_EXIV2_VERSION
QStringLiteral("<li><a href='%1'>%2</a>: %3</li>").arg("https://www.exiv2.org/", "Exiv2", "GPLv2"), QStringLiteral("<li><a href='%1'>%2</a>: %3</li>").arg("https://www.exiv2.org/", "Exiv2", "GPLv2"),

View File

@ -21,8 +21,9 @@ int main(int argc, char *argv[])
#else #else
qmDir = QT_STRINGIFY(QM_FILE_INSTALL_DIR); qmDir = QT_STRINGIFY(QM_FILE_INSTALL_DIR);
#endif #endif
translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), qmDir); if (translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), qmDir)) {
a.installTranslator(&translator); a.installTranslator(&translator);
}
a.setApplicationName("Pineapple Pictures"); a.setApplicationName("Pineapple Pictures");
a.setApplicationDisplayName(QCoreApplication::translate("main", "Pineapple Pictures")); a.setApplicationDisplayName(QCoreApplication::translate("main", "Pineapple Pictures"));

View File

Before

Width:  |  Height:  |  Size: 212 KiB

After

Width:  |  Height:  |  Size: 212 KiB

View File

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 44 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 2.5 KiB

After

Width:  |  Height:  |  Size: 2.5 KiB

View File

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

View File

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.9 KiB

View File

Before

Width:  |  Height:  |  Size: 2.3 KiB

After

Width:  |  Height:  |  Size: 2.3 KiB

View File

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 2.6 KiB

View File

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

@ -0,0 +1,6 @@
<ul>
<li><u>French</u>: J. Lavoie, K. Herbert</li>
<li><u>German</u>: K. Herbert, J. Lavoie</li>
<li><u>Norwegian Bokmål</u>: Allan Nordhøy</li>
<li><u>Russian</u>: Artem</li>
</ul>

View File

@ -10,5 +10,6 @@
<file>icons/window-close.svg</file> <file>icons/window-close.svg</file>
<file>icons/go-next.svg</file> <file>icons/go-next.svg</file>
<file>icons/go-previous.svg</file> <file>icons/go-previous.svg</file>
<file>plain/translators.html</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -57,11 +57,11 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target !isEmpty(target.path): INSTALLS += target
RESOURCES += \ RESOURCES += \
resources.qrc assets/resources.qrc
# Generate from svg: # Generate from svg:
# magick convert -background none app-icon.svg -define icon:auto-resize="16,32,48,64,128,256" app-icon.ico # magick convert -background none app-icon.svg -define icon:auto-resize="16,32,48,64,128,256" app-icon.ico
RC_ICONS = icons/app-icon.ico RC_ICONS = assets/icons/app-icon.ico
# Windows only, for rc file (we're not going to use the .rc file in this repo) # Windows only, for rc file (we're not going to use the .rc file in this repo)
QMAKE_TARGET_PRODUCT = Pineapple Pictures QMAKE_TARGET_PRODUCT = Pineapple Pictures