Skip to content

Commit

Permalink
feat: bundle icons on android
Browse files Browse the repository at this point in the history
  • Loading branch information
pontaoski committed Jan 21, 2022
1 parent ff138ca commit c972177
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
13 changes: 13 additions & 0 deletions app/App.qbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import qbs.FileInfo

QtApplication {
name: "Challah"

Expand All @@ -8,14 +10,25 @@ QtApplication {
cpp.enableExceptions: true
cpp.enableReproducibleBuilds: true
cpp.enableRtti: true
cpp.defines: iconsDir.length > 0 ? ["CHALLAH_BUNDLED_ICONS=1"] : []

debugInformationInstallDir: "bin"
installDebugInformation: true

property string iconsDir: ""

files: [
"main.cpp",
]

Group {
condition: product.iconsDir.length > 0
files: [product.iconsDir]
fileTags: "qt.core.resource_data"
Qt.core.resourceSourceBase: product.iconsDir.slice(0, -FileInfo.baseName(product.iconsDir).length)
Qt.core.resourcePrefix: "/"
}

Group {
files: ["resources/**"]
excludeFiles: ["resources/img/io.harmonyapp.Challah.svg"]
Expand Down
9 changes: 9 additions & 0 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <QThreadPool>
#include <QLibraryInfo>
#include <QTranslator>
#include <QResource>

#ifdef Q_OS_ANDROID

Expand Down Expand Up @@ -50,6 +51,14 @@ int main(int argc, char *argv[])
#if defined(Q_OS_ANDROID)
QQuickStyle::setStyle(QStringLiteral("Material"));
#endif
#if defined(CHALLAH_BUNDLED_ICONS)
if (!QResource::registerResource(":/breeze-icons.rcc", "/icons/bundled-breeze")) {
qWarning() << "failed to register icons resource!";
} else {
qDebug() << "registered icons resource!";
}
QIcon::setThemeName("bundled-breeze");
#endif

QQmlApplicationEngine engine;
setupQML(&engine);
Expand Down
5 changes: 5 additions & 0 deletions app/setup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ Q_IMPORT_PLUGIN(QQC2BreezeStylePlugin)

#endif

#include <QtSvg>

Q_DECLARE_METATYPE(Future<ChannelsModel*>)
Q_DECLARE_METATYPE(Future<MembersModel*>)
Q_DECLARE_METATYPE(Future<MessagesModel*>)
Expand All @@ -82,6 +84,9 @@ void setupQML(QQmlEngine* engine)
Q_INIT_RESOURCE(kitemmodelsqml);
#endif

QSvgRenderer rend;
(void) rend;

qRegisterMetaType<Croutons::FutureBase>();

qRegisterMetaType<RolesModel*>();
Expand Down

0 comments on commit c972177

Please sign in to comment.