feat: update icon and change the directory of htmls

This commit is contained in:
2026-09-10 09:48:07 +08:00
parent 40d82e757e
commit f9991998ed
41 changed files with 42 additions and 1759 deletions
+5 -5
View File
@@ -26,7 +26,7 @@ AboutDialog::AboutDialog(QWidget *parent)
// blumia: Chain two arg() here since it seems lupdate will remove one of them if we use
// the old `arg(QCoreApp::translate(), tr())` way, but it's worth to mention
// `arg(QCoreApp::translate(), this->tr())` works, but lupdate will complain about the usage.
const QString HELP_HTML = loadEmbeddedHtml(u":/plain/help.html"_s)
const QString HELP_HTML = loadEmbeddedHtml(u":/htmls/help.html"_s)
.arg(tr("General Help"))
.arg(tr("Launch application with image file path as argument to load the file."))
.arg(tr("Passing in a single image file will load all the images in that directory and start viewing from that image."))
@@ -48,7 +48,7 @@ AboutDialog::AboutDialog(QWidget *parent)
#endif // GIT_DESCRIBE_VERSION_STRING
const QString QT_VERSION_ARG = QT_VERSION_STR;
const QString QT_ARCH_ARG = QSysInfo::buildCpuArchitecture();
const QString ABOUT_HTML = loadEmbeddedHtml(u":/plain/about.html"_s)
const QString ABOUT_HTML = loadEmbeddedHtml(u":/htmls/about.html"_s)
.arg(APP_NAME_ARG)
.arg(tr("Version: %1").arg(APP_VERSION_ARG))
.arg(tr("Upstream author"))
@@ -57,19 +57,19 @@ AboutDialog::AboutDialog(QWidget *parent)
.arg(tr("Built with Qt %1 (%2)").arg(QT_VERSION_ARG).arg(QT_ARCH_ARG))
.arg(tr("Source code"));
const QString SPECIAL_THANKS_HTML = loadEmbeddedHtml(u":/plain/special-thanks.html"_s)
const QString SPECIAL_THANKS_HTML = loadEmbeddedHtml(u":/htmls/special-thanks.html"_s)
.arg(tr("Contributors"))
.arg(tr("List of contributors on GitHub"))
.arg(tr("Thanks to all people who contributed to this project."))
.arg(tr("Translators"))
.arg(tr("I would like to thank the following people who volunteered to translate this application."));
const QString LICENSE_HTML = loadEmbeddedHtml(u":/plain/license.html"_s)
const QString LICENSE_HTML = loadEmbeddedHtml(u":/htmls/license.html"_s)
.arg(tr("License"))
.arg(tr("This application is released under the MIT License."))
.arg(tr("License Verbatim Copy"));
const QString THIRD_PARTY_LIBS_HTML = loadEmbeddedHtml(u":/plain/third-party-libs.html"_s)
const QString THIRD_PARTY_LIBS_HTML = loadEmbeddedHtml(u":/htmls/third-party-libs.html"_s)
.arg(tr("Third-party Libraries"))
.arg(tr("This application is built on the following free software libraries.", "Free as in freedom"))
.arg(tr("Some of them are optional and might not be included with this distribution depending on the build environment."));
+15 -21
View File
@@ -16,11 +16,8 @@
static QIcon loadHidpiIcon(const QString &resp, QSize sz = QSize(32, 32))
{
QSvgRenderer r(resp);
QPixmap pm = QPixmap(sz * qApp->devicePixelRatio());
pm.fill(Qt::transparent);
QPainter p(&pm);
r.render(&p);
QPixmap pm = QPixmap(resp);
pm.scaled(sz * qApp->devicePixelRatio(), Qt::KeepAspectRatio);
pm.setDevicePixelRatio(qApp->devicePixelRatio());
return QIcon(pm);
}
@@ -32,7 +29,7 @@ void ActionManager::setupAction(MainWindow *mainWindow)
// Declare some convenient macros and lambdas.
#define ICON_NAME(name)\
QStringLiteral(":/icons/" #name ".svg")
QStringLiteral(":/icons/" #name ".png")
#define ACTION_NAME(s) QStringLiteral(STRIFY(s))
#define STRIFY(s) #s
@@ -52,38 +49,35 @@ void ActionManager::setupAction(MainWindow *mainWindow)
/// This macro for register action with our custom icon.
#define CREATE_NEW_ICON_ACTION(w, a, i) create_action(w, &a, ICON_NAME(i), ACTION_NAME(a), false)
// TODO: We may replace all Qt theme icons to our custom icon for visual consistency.
// TODO: Some icons are invalid.
CREATE_NEW_ACTION(mainWindow, actionCopyPixmap);
CREATE_NEW_ACTION(mainWindow, actionCopyFilePath);
CREATE_NEW_ICON_ACTION(mainWindow, actionPrevPicture, go-previous);
CREATE_NEW_ICON_ACTION(mainWindow, actionNextPicture, go-next);
CREATE_NEW_ICON_ACTION(mainWindow, actionActualSize, zoom-original);
CREATE_NEW_ICON_ACTION(mainWindow, actionFitToScreen, app-icon);
CREATE_NEW_ICON_ACTION(mainWindow, actionFitByWidth, app-icon);
CREATE_NEW_ICON_ACTION(mainWindow, actionFitByHeight, app-icon);
CREATE_NEW_ICON_ACTION(mainWindow, actionActualSize, fit-to-size);
CREATE_NEW_ICON_ACTION(mainWindow, actionFitToScreen, fit-to-screen);
CREATE_NEW_ACTION(mainWindow, actionFitByWidth);
CREATE_NEW_ACTION(mainWindow, actionFitByHeight);
CREATE_NEW_ICON_ACTION(mainWindow, actionZoomIn, zoom-in);
CREATE_NEW_ICON_ACTION(mainWindow, actionZoomOut, zoom-out);
CREATE_NEW_ICON_ACTION(mainWindow, actionFlipHorizontal, app-icon);
CREATE_NEW_ICON_ACTION(mainWindow, actionFlipVertical, app-icon);
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateClockwise, object-rotate-right);
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateCounterClockwise, app-icon);
CREATE_NEW_ICON_ACTION(mainWindow, actionFlipHorizontal, flip-horizontal);
CREATE_NEW_ICON_ACTION(mainWindow, actionFlipVertical, flip-vertical);
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateClockwise, rotate-right);
CREATE_NEW_ICON_ACTION(mainWindow, actionRotateCounterClockwise, rotate-left);
CREATE_NEW_ACTION(mainWindow, actionToggleAvoidResetTransform);
CREATE_NEW_ACTION(mainWindow, actionToggleCheckerboard);
CREATE_NEW_ACTION(mainWindow, actionTogglePauseAnimation);
CREATE_NEW_ACTION(mainWindow, actionAnimationNextFrame);
CREATE_NEW_THEMEICON_ACTION(mainWindow, actionTrash, edit-delete);
CREATE_NEW_THEMEICON_ACTION(mainWindow, actionLocateInFileManager, system-file-manager);
CREATE_NEW_THEMEICON_ACTION(mainWindow, actionProperties, document-properties);
CREATE_NEW_ACTION(mainWindow, actionTrash/*, edit-delete*/);
CREATE_NEW_ACTION(mainWindow, actionLocateInFileManager/*, system-file-manager*/);
CREATE_NEW_ICON_ACTION(mainWindow, actionProperties, image-info);
CREATE_NEW_ACTION(mainWindow, actionSettings);
CREATE_NEW_THEMEICON_ACTION(mainWindow, actionHelp, system-help);
CREATE_NEW_ACTION(mainWindow, actionHelp/*, system-help*/);
// Remove convenient macros
+1 -1
View File
@@ -61,7 +61,7 @@ MainWindow::MainWindow(QWidget *parent)
// It is too small for modern device,
// so I level it up to SVGA resolution 800 x 600.
this->setMinimumSize(800, 600);
this->setWindowIcon(QIcon(u":/icons/app-icon.svg"_s));
this->setWindowIcon(QIcon(u":/icons/app-icon.png"_s));
this->setAcceptDrops(true);
// Initialize playlist manager
-3
View File
@@ -139,9 +139,6 @@
<property name="title">
<string>&amp;Copy</string>
</property>
<property name="icon">
<iconset theme="edit-copy"/>
</property>
</widget>
<widget class="QMenu" name="m_subMenuTransform">
<property name="title">