only used icons compiled into executable, update languages, fixed loading of qt locales, updated/fixed compilation

This commit is contained in:
Martin Rotter 2019-04-03 09:50:29 +02:00
parent d33eb1034e
commit 4c5fab2746
23 changed files with 96436 additions and 1577 deletions

View File

@ -5,7 +5,7 @@ clone_depth: 1
clone_folder: C:\rssguard
environment:
QTDIR: 'C:\Qt\5.9\msvc2017_64'
QTDIR: 'C:\Qt\5.12\msvc2017_64'
QMAKESPEC: win32-msvc
COMPILERBAT: '"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"'
access_token:

3
.gitignore vendored
View File

@ -23,5 +23,4 @@
# Other files.
*.autosave
*.user*
resources/localizations/*rssguard*
localization/rssguard*qm
localization/*qm

7147
localization/qtbase_cs.ts Normal file

File diff suppressed because it is too large Load Diff

7105
localization/qtbase_da.ts Normal file

File diff suppressed because it is too large Load Diff

7490
localization/qtbase_de.ts Normal file

File diff suppressed because it is too large Load Diff

6760
localization/qtbase_es.ts Normal file

File diff suppressed because it is too large Load Diff

6632
localization/qtbase_fr.ts Normal file

File diff suppressed because it is too large Load Diff

6646
localization/qtbase_he.ts Normal file

File diff suppressed because it is too large Load Diff

6994
localization/qtbase_it.ts Normal file

File diff suppressed because it is too large Load Diff

6656
localization/qtbase_ja.ts Normal file

File diff suppressed because it is too large Load Diff

10250
localization/qtbase_lt.ts Normal file

File diff suppressed because it is too large Load Diff

7007
localization/qtbase_pl.ts Normal file

File diff suppressed because it is too large Load Diff

8009
localization/qtbase_pt.ts Normal file

File diff suppressed because it is too large Load Diff

7954
localization/qtbase_sv.ts Normal file

File diff suppressed because it is too large Load Diff

7544
localization/qtbase_zh.ts Normal file

File diff suppressed because it is too large Load Diff

63
resources/icons.qrc Normal file
View File

@ -0,0 +1,63 @@
<RCC>
<qresource prefix="/">
<file>./graphics/Faenza/actions/64/application-exit.png</file>
<file>./graphics/Faenza/actions/64/back.png</file>
<file>./graphics/Faenza/actions/64/call-start.png</file>
<file>./graphics/Faenza/actions/64/dialog-yes.png</file>
<file>./graphics/Faenza/actions/64/document-export.png</file>
<file>./graphics/Faenza/actions/64/document-import.png</file>
<file>./graphics/Faenza/actions/64/document-new.png</file>
<file>./graphics/Faenza/actions/64/document-open.png</file>
<file>./graphics/Faenza/actions/64/document-properties.png</file>
<file>./graphics/Faenza/actions/64/document-revert.png</file>
<file>./graphics/Faenza/actions/64/down.png</file>
<file>./graphics/Faenza/actions/64/edit-clear.png</file>
<file>./graphics/Faenza/actions/64/format-indent-more.png</file>
<file>./graphics/Faenza/actions/64/format-justify-fill.png</file>
<file>./graphics/Faenza/actions/64/forward.png</file>
<file>./graphics/Faenza/actions/64/go-down.png</file>
<file>./graphics/Faenza/actions/64/go-home.png</file>
<file>./graphics/Faenza/actions/64/go-jump.png</file>
<file>./graphics/Faenza/actions/64/go-next.png</file>
<file>./graphics/Faenza/actions/64/go-previous.png</file>
<file>./graphics/Faenza/actions/64/go-up.png</file>
<file>./graphics/Faenza/actions/64/gtk-edit.png</file>
<file>./graphics/Faenza/actions/64/help-about.png</file>
<file>./graphics/Faenza/actions/64/insert-object.png</file>
<file>./graphics/Faenza/actions/64/list-add.png</file>
<file>./graphics/Faenza/actions/64/list-remove.png</file>
<file>./graphics/Faenza/actions/64/mail-attachment.png</file>
<file>./graphics/Faenza/actions/64/mail-inbox.png</file>
<file>./graphics/Faenza/actions/64/mail-mark-important.png</file>
<file>./graphics/Faenza/actions/64/mail-mark-junk.png</file>
<file>./graphics/Faenza/actions/64/mail-mark-read.png</file>
<file>./graphics/Faenza/actions/64/mail-mark-unread.png</file>
<file>./graphics/Faenza/actions/64/mail-message-new.png</file>
<file>./graphics/Faenza/actions/64/mail-send.png</file>
<file>./graphics/Faenza/actions/64/mail-sent.png</file>
<file>./graphics/Faenza/actions/64/process-stop.png</file>
<file>./graphics/Faenza/actions/64/reload.png</file>
<file>./graphics/Faenza/actions/64/system-search.png</file>
<file>./graphics/Faenza/actions/64/system-upgrade.png</file>
<file>./graphics/Faenza/actions/64/tab-new.png</file>
<file>./graphics/Faenza/actions/64/up.png</file>
<file>./graphics/Faenza/actions/64/view-fullscreen.png</file>
<file>./graphics/Faenza/actions/64/view-refresh.png</file>
<file>./graphics/Faenza/actions/64/view-restore.png</file>
<file>./graphics/Faenza/actions/64/window-close.png</file>
<file>./graphics/Faenza/categories/64/applications-internet.png</file>
<file>./graphics/Faenza/categories/64/applications-office.png</file>
<file>./graphics/Faenza/categories/64/applications-science.png</file>
<file>./graphics/Faenza/emblems/64/emblem-downloads.png</file>
<file>./graphics/Faenza/emblems/64/emblem-system.png</file>
<file>./graphics/Faenza/index.theme</file>
<file>./graphics/Faenza/mimetypes/64/image-x-generic.png</file>
<file>./graphics/Faenza/mimetypes/64/text-html.png</file>
<file>./graphics/Faenza/places/64/folder.png</file>
<file>./graphics/Faenza/places/64/user-trash.png</file>
<file>./graphics/Faenza/status/64/dialog-error.png</file>
<file>./graphics/Faenza/status/64/dialog-information.png</file>
<file>./graphics/Faenza/status/64/dialog-question.png</file>
<file>./graphics/Faenza/status/64/dialog-warning.png</file>
</qresource>
</RCC>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
#!/bin/bash
# This script will generate .qrc file from used icons.
#
# PWD is used as used src root folder.
# "resources/graphics/Faenza" is used as folder for icons.
# Output qrc file has paths relative to "resources" folder.
echo_formatted_qrc() {
printf "<RCC>\n <qresource prefix=\"/\">\n"
# Sort icons first.
readarray -t sorted < <(for a in "$@"; do echo "$a"; done | sort)
for ICON_FILE in "${sorted[@]}"; do
# We find icon.
echo " <file>$ICON_FILE</file>"
done
printf " </qresource>\n</RCC>"
}
discover_used_icons() {
local ROOT_SRC_FOLDER="$(pwd)"
local RESOURCES_FOLDER="$ROOT_SRC_FOLDER/../resources"
local INDEX_FILE="./graphics/Faenza/index.theme"
declare -a ICON_FILES
#echo "Root src folder: \"$ROOT_SRC_FOLDER\"."
# Now we discover all usages of icons.
local ICON_NAMES=$(grep -Prioh '(?<=fromTheme\(QSL\(\")[-a-z]+' "$ROOT_SRC_FOLDER" | sort -u)
cd "$RESOURCES_FOLDER"
for ICON_NAME in $ICON_NAMES; do
# We find icon.
local ICON_FILE="$(find . -name "${ICON_NAME}.png")"
ICON_FILES+=("$ICON_FILE")
done
ICON_FILES+=("$INDEX_FILE")
cd "$ROOT_SRC_FOLDER"
echo_formatted_qrc ${ICON_FILES[@]}
}
discover_used_icons

View File

@ -1,7 +1,6 @@
<RCC>
<qresource prefix="/">
<file>sql/db_init_mysql.sql</file>
<file>sql/db_init_sqlite.sql</file>
<file>sql/db_init_mysql.sql</file>
<file>sql/db_update_mysql_1_2.sql</file>
<file>sql/db_update_mysql_2_3.sql</file>
<file>sql/db_update_mysql_3_4.sql</file>
@ -12,6 +11,8 @@
<file>sql/db_update_mysql_8_9.sql</file>
<file>sql/db_update_mysql_9_10.sql</file>
<file>sql/db_update_mysql_10_11.sql</file>
<file>sql/db_init_sqlite.sql</file>
<file>sql/db_update_sqlite_1_2.sql</file>
<file>sql/db_update_sqlite_2_3.sql</file>
<file>sql/db_update_sqlite_3_4.sql</file>

View File

@ -2,7 +2,6 @@
#
# For license of this file, see <project-root-folder>/LICENSE.md.
#
#
# This is RSS Guard compilation script for qmake.
#
# Usage:
@ -25,8 +24,6 @@
# value of this variable is tweaked automatically.
# PREFIX - specifies base folder to which files are copied during "make install"
# step, defaults to "$$OUT_PWD/usr" on Linux and to "$$OUT_PWD/app" on Windows.
# LRELEASE_EXECUTABLE - specifies the name/path of "lrelease" executable, defaults to "lrelease".
#
#
# Other information:
# - supports Windows, Linux, Mac OS X, Android,
@ -39,9 +36,8 @@
#
#################################################################
TEMPLATE = app
TARGET = rssguard
DEFINES *= QT_USE_QSTRINGBUILDER
TEMPLATE = app
TARGET = rssguard
message(rssguard: Welcome RSS Guard qmake script.)
@ -54,7 +50,7 @@ APP_LOW_NAME = "rssguard"
APP_REVERSE_NAME = "com.github.rssguard"
APP_LOW_H_NAME = ".rssguard"
APP_AUTHOR = "Martin Rotter"
APP_COPYRIGHT = "(C) 2011-2017 $$APP_AUTHOR"
APP_COPYRIGHT = "(C) 2011-2019 $$APP_AUTHOR"
APP_VERSION = "3.5.7"
APP_LONG_NAME = "$$APP_NAME $$APP_VERSION"
APP_EMAIL = "rotter.martinos@gmail.com"
@ -63,7 +59,7 @@ APP_URL_ISSUES = "https://github.com/martinrotter/rssguard/issues
APP_URL_ISSUES_NEW = "https://github.com/martinrotter/rssguard/issues/new"
APP_URL_WIKI = "https://github.com/martinrotter/rssguard/wiki"
APP_USERAGENT = "RSS Guard/$$APP_VERSION (github.com/martinrotter/rssguard)"
APP_DONATE_URL = "https://martinrotter.github.io/donate/"
APP_DONATE_URL = "https://martinrotter.github.io/donate"
APP_WIN_ARCH = "win64"
isEmpty(PREFIX) {
@ -102,27 +98,22 @@ isEmpty(USE_WEBENGINE) {
message(rssguard: Shadow copy build directory \"$$OUT_PWD\".)
isEmpty(LRELEASE_EXECUTABLE) {
LRELEASE_EXECUTABLE = lrelease
message(rssguard: LRELEASE_EXECUTABLE variable is not set.)
}
# Custom definitions.
DEFINES += APP_VERSION='"\\\"$$APP_VERSION\\\""'
DEFINES += APP_NAME='"\\\"$$APP_NAME\\\""'
DEFINES += APP_LOW_NAME='"\\\"$$APP_LOW_NAME\\\""'
DEFINES += APP_LOW_H_NAME='"\\\"$$APP_LOW_H_NAME\\\""'
DEFINES += APP_LONG_NAME='"\\\"$$APP_LONG_NAME\\\""'
DEFINES += APP_AUTHOR='"\\\"$$APP_AUTHOR\\\""'
DEFINES += APP_EMAIL='"\\\"$$APP_EMAIL\\\""'
DEFINES += APP_URL='"\\\"$$APP_URL\\\""'
DEFINES += APP_URL_ISSUES='"\\\"$$APP_URL_ISSUES\\\""'
DEFINES += APP_URL_ISSUES_NEW='"\\\"$$APP_URL_ISSUES_NEW\\\""'
DEFINES += APP_URL_WIKI='"\\\"$$APP_URL_WIKI\\\""'
DEFINES += APP_USERAGENT='"\\\"$$APP_USERAGENT\\\""'
DEFINES += APP_DONATE_URL='"\\\"$$APP_DONATE_URL\\\""'
DEFINES += APP_SYSTEM_NAME='"\\\"$$QMAKE_HOST.os\\\""'
DEFINES += APP_SYSTEM_VERSION='"\\\"$$QMAKE_HOST.arch\\\""'
DEFINES *= APP_VERSION='"\\\"$$APP_VERSION\\\""'
DEFINES *= APP_NAME='"\\\"$$APP_NAME\\\""'
DEFINES *= APP_LOW_NAME='"\\\"$$APP_LOW_NAME\\\""'
DEFINES *= APP_LOW_H_NAME='"\\\"$$APP_LOW_H_NAME\\\""'
DEFINES *= APP_LONG_NAME='"\\\"$$APP_LONG_NAME\\\""'
DEFINES *= APP_AUTHOR='"\\\"$$APP_AUTHOR\\\""'
DEFINES *= APP_EMAIL='"\\\"$$APP_EMAIL\\\""'
DEFINES *= APP_URL='"\\\"$$APP_URL\\\""'
DEFINES *= APP_URL_ISSUES='"\\\"$$APP_URL_ISSUES\\\""'
DEFINES *= APP_URL_ISSUES_NEW='"\\\"$$APP_URL_ISSUES_NEW\\\""'
DEFINES *= APP_URL_WIKI='"\\\"$$APP_URL_WIKI\\\""'
DEFINES *= APP_USERAGENT='"\\\"$$APP_USERAGENT\\\""'
DEFINES *= APP_DONATE_URL='"\\\"$$APP_DONATE_URL\\\""'
DEFINES *= APP_SYSTEM_NAME='"\\\"$$QMAKE_HOST.os\\\""'
DEFINES *= APP_SYSTEM_VERSION='"\\\"$$QMAKE_HOST.arch\\\""'
CODECFORTR = UTF-8
CODECFORSRC = UTF-8
@ -140,18 +131,19 @@ equals(USE_WEBENGINE, false) {
APP_REVISION = $$sprintf('%1-%2', $$APP_REVISION, nowebengine)
}
DEFINES += APP_REVISION='"\\\"$$APP_REVISION\\\""'
DEFINES *= APP_REVISION='"\\\"$$APP_REVISION\\\""'
message(rssguard: RSS Guard version is: \"$$APP_VERSION\".)
message(rssguard: Detected Qt version: \"$$QT_VERSION\".)
message(rssguard: Build destination directory: \"$$DESTDIR\".)
message(rssguard: Prefix directory: \"$$PREFIX\".)
message(rssguard: Build revision: \"$$APP_REVISION\".)
message(rssguard: lrelease executable name: \"$$LRELEASE_EXECUTABLE\".)
message(rssguard: lrelease executable name: \"$$LRELEASE\".)
QT *= core gui widgets sql network xml
CONFIG *= c++11 warn_on
CONFIG *= c++1z warn_on
CONFIG -= debug_and_release
DEFINES *= QT_USE_QSTRINGBUILDER QT_USE_FAST_CONCATENATION QT_USE_FAST_OPERATOR_PLUS UNICODE _UNICODE
VERSION = $$APP_VERSION
@ -164,9 +156,41 @@ win32 {
message(rssguard: Compilling x86_64 variant.)
QMAKE_LFLAGS_WINDOWS = /SUBSYSTEM:WINDOWS,5.02
}
# Additionally link against Shell32.
LIBS *= Shell32.lib
}
DISTFILES += resources/scripts/uncrustify/uncrustify.cfg
gcc|g++|clang* {
QMAKE_CXXFLAGS *= -std=c++17
}
msvc {
QMAKE_CXXFLAGS *= /std:c++17
}
clang* {
DEFINES *= CLANG=1
}
# Setup specific compiler options.
CONFIG(release, debug|release) {
message(rssguard: Building in "release" mode.)
gcc:QMAKE_CXXFLAGS_RELEASE -= -O2
clang:QMAKE_CXXFLAGS_RELEASE -= -O2
gcc:QMAKE_CXXFLAGS_RELEASE *= -O3
clang:QMAKE_CXXFLAGS_RELEASE *= -O3
}
else {
message(rssguard: Building in "debug" mode.)
DEFINES *= DEBUG=1
gcc:QMAKE_CXXFLAGS_DEBUG *= -Wall
clang:QMAKE_CXXFLAGS_DEBUG *= -Wall
}
DISTFILES += resources/scripts/uncrustify/uncrustify.cfg
MOC_DIR = $$OUT_PWD/moc
RCC_DIR = $$OUT_PWD/rcc
@ -196,7 +220,8 @@ win32 {
CONFIG *= resources_big
RESOURCES += resources/sql.qrc \
resources/rssguard.qrc
resources/rssguard.qrc \
resources/icons.qrc
HEADERS += src/core/feeddownloader.h \
src/core/feedsmodel.h \
@ -575,39 +600,56 @@ else {
src/gui/newspaperpreviewer.ui
}
TRANSLATIONS += $$PWD/localization/rssguard_cs.ts \
$$PWD/localization/rssguard_da.ts \
$$PWD/localization/rssguard_de.ts \
$$PWD/localization/rssguard_en_GB.ts \
$$PWD/localization/rssguard_en.ts \
$$PWD/localization/rssguard_es.ts \
$$PWD/localization/rssguard_fr.ts \
$$PWD/localization/rssguard_he.ts \
$$PWD/localization/rssguard_id.ts \
$$PWD/localization/rssguard_it.ts \
$$PWD/localization/rssguard_ja.ts \
$$PWD/localization/rssguard_lt.ts \
$$PWD/localization/rssguard_nl.ts \
$$PWD/localization/rssguard_pl.ts \
$$PWD/localization/rssguard_pt.ts \
$$PWD/localization/rssguard_sv.ts \
$$PWD/localization/rssguard_zh.ts
INCLUDEPATH += $$PWD/. \
$$PWD/src \
$$PWD/src/gui \
$$PWD/src/gui/dialogs \
$$PWD/src/dynamic-shortcuts
TRANSLATIONS_WO_QT += $$PWD/localization/rssguard_cs.ts \
$$PWD/localization/rssguard_da.ts \
$$PWD/localization/rssguard_de.ts \
$$PWD/localization/rssguard_en.ts \
$$PWD/localization/rssguard_es.ts \
$$PWD/localization/rssguard_fr.ts \
$$PWD/localization/rssguard_he.ts \
$$PWD/localization/rssguard_id.ts \
$$PWD/localization/rssguard_it.ts \
$$PWD/localization/rssguard_ja.ts \
$$PWD/localization/rssguard_lt.ts \
$$PWD/localization/rssguard_nl.ts \
$$PWD/localization/rssguard_pl.ts \
$$PWD/localization/rssguard_pt.ts \
$$PWD/localization/rssguard_sv.ts \
$$PWD/localization/rssguard_zh.ts
TRANSLATIONS += $$TRANSLATIONS_WO_QT \
$$PWD/localization/qtbase_cs.ts \
$$PWD/localization/qtbase_da.ts \
$$PWD/localization/qtbase_de.ts \
$$PWD/localization/qtbase_es.ts \
$$PWD/localization/qtbase_fr.ts \
$$PWD/localization/qtbase_he.ts \
$$PWD/localization/qtbase_it.ts \
$$PWD/localization/qtbase_ja.ts \
$$PWD/localization/qtbase_lt.ts \
$$PWD/localization/qtbase_pl.ts \
$$PWD/localization/qtbase_pt.ts \
$$PWD/localization/qtbase_sv.ts \
$$PWD/localization/qtbase_zh.ts
load(uic)
uic.commands -= -no-stringliteral
# Create new "make lupdate" target.
lupdate.target = lupdate
lupdate.commands = lupdate $$shell_path($$PWD/rssguard.pro)
lupdate.commands = lupdate -no-obsolete -pro $$shell_quote($$shell_path($$PWD/rssguard.pro)) -ts $$TRANSLATIONS_WO_QT
QMAKE_EXTRA_TARGETS += lupdate
# Make sure QM translations are nerated.
qtPrepareTool(LRELEASE, lrelease) {
system($$LRELEASE_EXECUTABLE -compress $$shell_quote($$shell_path($$PWD/rssguard.pro)))
system($$LRELEASE -compress $$shell_quote($$shell_path($$PWD/rssguard.pro)))
}
# Create new "make 7zip" target and "make zip" target.
@ -655,20 +697,20 @@ win32 {
win32 {
target.path = $$PREFIX
qt_dlls_root.files = resources/binaries/windows/qt5-msvc2015/*.*
qt_dlls_root.files = resources/binaries/windows/qt5-msvc2017/*.*
qt_dlls_root.path = $$quote($$PREFIX/)
qt_dlls_plugins.files = resources/binaries/windows/qt5-msvc2015/*
qt_dlls_plugins.files = resources/binaries/windows/qt5-msvc2017/*
qt_dlls_plugins.path = $$quote($$PREFIX/)
INSTALLS += target qt_dlls_root qt_dlls_plugins
equals(USE_WEBENGINE, true) {
# Copy extra resource files for QtWebEngine.
qtwebengine_dlls.files = resources/binaries/windows/qt5-msvc2015-webengine/*
qtwebengine_dlls.files = resources/binaries/windows/qt5-msvc2017-webengine/*
qtwebengine_dlls.path = $$quote($$PREFIX/)
qtwebengine.files = resources/binaries/windows/qt5-msvc2015-webengine/*.*
qtwebengine.files = resources/binaries/windows/qt5-msvc2017-webengine/*.*
qtwebengine.path = $$quote($$PREFIX/)
INSTALLS += qtwebengine_dlls qtwebengine
@ -702,7 +744,7 @@ mac {
CONFIG -= app_bundle
ICON = resources/macosx/$${TARGET}.icns
QMAKE_MAC_SDK = macosx10.12
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.7
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.8
LIBS += -framework AppKit
target.path = $$quote($$PREFIX/Contents/MacOS/)

View File

@ -39,15 +39,6 @@ QByteArray IconFactory::toByteArray(const QIcon& icon) {
return array.toBase64();
}
QPixmap IconFactory::pixmap(const QString& name) {
if (QIcon::themeName() == APP_NO_THEME) {
return QPixmap();
}
else {
return QIcon::fromTheme(name).pixmap(64, 64);
}
}
QIcon IconFactory::fromTheme(const QString& name) {
return QIcon::fromTheme(name);
}

View File

@ -17,11 +17,7 @@ class IconFactory : public QObject {
Q_OBJECT
public:
// Constructor.
explicit IconFactory(QObject* parent = 0);
// Destructor.
explicit IconFactory(QObject* parent = nullptr);
virtual ~IconFactory();
// Used to store/retrieve QIcons from/to Base64-encoded
@ -29,8 +25,6 @@ class IconFactory : public QObject {
static QIcon fromByteArray(QByteArray array);
static QByteArray toByteArray(const QIcon& icon);
QPixmap pixmap(const QString& name);
// Returns icon from active theme or invalid icon if
// "no icon theme" is set.
QIcon fromTheme(const QString& name);
@ -50,12 +44,14 @@ class IconFactory : public QObject {
void loadCurrentIconTheme();
// Returns name of currently activated theme for the application.
inline QString currentIconTheme() const {
return QIcon::themeName();
}
QString currentIconTheme() const;
// Sets icon theme with given name as the active one and loads it.
void setCurrentIconTheme(const QString& theme_name);
};
inline QString IconFactory::currentIconTheme() const {
return QIcon::themeName();
}
#endif // ICONFACTORY_H

View File

@ -41,7 +41,7 @@ void Localization::loadActiveLanguage() {
desired_localization = DEFAULT_LOCALE;
}
if (qt_translator->load(QLocale(desired_localization), "qt", QSL("_"), APP_LANG_PATH)) {
if (qt_translator->load(QLocale(desired_localization), "qtbase", QSL("_"), APP_LANG_PATH)) {
Application::installTranslator(qt_translator);
qDebug("Qt localization '%s' loaded successfully.", qPrintable(desired_localization));
}