feat: bundle resources

- Update linux build to package resources
- Refactor macOS packaging re: resources.rcc
This commit is contained in:
Richard Ramos 2020-06-30 17:35:24 -04:00 committed by Iuri Matias
parent 3a6655f8f3
commit 5b3f077fa9
6 changed files with 37 additions and 13 deletions

2
.gitignore vendored
View File

@ -22,3 +22,5 @@ yarn-debug.log*
yarn-error.log*
yarn.lock
TODO
resources.rcc
resources.qrc

View File

@ -167,7 +167,13 @@ $(QRCODEGEN): | deps
+ cd vendor/QR-Code-generator/c && \
$(MAKE)
nim_status_client: | $(DOTHERSIDE) $(STATUSGO) $(QRCODEGEN) deps
rcc:
rm -f ./bin/resources.rcc
rm -f ./resources.qrc
./ui/generate-rcc.sh
rcc --binary ui/resources.qrc -o ./resources.rcc
nim_status_client: | $(DOTHERSIDE) $(STATUSGO) $(QRCODEGEN) rcc deps
echo -e $(BUILD_MSG) "$@" && \
$(ENV_SCRIPT) nim c $(NIM_PARAMS) --passL:"$(STATUSGO)" --passL:"$(QRCODEGEN)" --passL:"-lm" src/nim_status_client.nim
@ -193,10 +199,11 @@ $(STATUS_CLIENT_APPIMAGE): nim_status_client $(APPIMAGE_TOOL) nim-status.desktop
cp bin/nim_status_client tmp/linux/dist/usr/bin
cp nim-status.desktop tmp/linux/dist/.
cp status.svg tmp/linux/dist/status.svg
cp -R ui tmp/linux/dist/usr/.
cp status.svg tmp/linux/dist/usr/.
cp -R resources.rcc tmp/linux/dist/usr/.
echo -e $(BUILD_MSG) "AppImage"
linuxdeployqt tmp/linux/dist/nim-status.desktop -no-translations -no-copy-copyright-files -qmldir=tmp/linux/dist/usr/ui -qmlimport=$(QTDIR)/qml -bundle-non-qt-libs
linuxdeployqt tmp/linux/dist/nim-status.desktop -no-translations -no-copy-copyright-files -qmldir=ui -qmlimport=$(QTDIR)/qml -bundle-non-qt-libs
rm tmp/linux/dist/AppRun
cp AppRun tmp/linux/dist/.
@ -223,7 +230,8 @@ $(STATUS_CLIENT_DMG): nim_status_client $(DMG_TOOL)
cp nim_status_client.sh $(MACOS_OUTER_BUNDLE)/Contents/MacOS/
chmod +x $(MACOS_OUTER_BUNDLE)/Contents/MacOS/nim_status_client.sh
cp status-icon.icns $(MACOS_OUTER_BUNDLE)/Contents/Resources/
cp -R ui $(MACOS_OUTER_BUNDLE)/Contents/
cp status.svg $(MACOS_OUTER_BUNDLE)/Contents/
cp -R resources.rcc $(MACOS_OUTER_BUNDLE)/Contents/
macdeployqt \
$(MACOS_OUTER_BUNDLE) \
@ -269,7 +277,7 @@ clean: | clean-common
rm -rf bin/* node_modules pkg/* tmp/* $(STATUSGO)
+ $(MAKE) -C vendor/DOtherSide/build --no-print-directory clean
run:
run: | rcc
LD_LIBRARY_PATH="$(QT5_LIBDIR)" ./bin/nim_status_client
endif # "variables.mk" was not included

View File

@ -23,7 +23,9 @@ proc mainProc() =
enableHDPI()
let app = newQApplication("Nim Status Client")
app.icon("./status.svg")
QResource.registerResource(app.applicationDirPath & "/../resources.rcc")
app.icon(app.applicationDirPath & "/../status.svg")
let engine = newQQmlApplicationEngine()
let signalController = signals.newController(app)
@ -116,7 +118,7 @@ proc mainProc() =
engine.setRootContextProperty("signals", signalController.variant)
engine.load("../ui/main.qml")
engine.load(newQUrl("qrc:///main.qml"))
# Please note that this must use the `cdecl` calling convention because
# it will be passed as a regular C function to libstatus. This means that

View File

@ -261,11 +261,10 @@ Item {
textFormat: TextEdit.RichText
text: {
if(contentType === Constants.stickerType) return "";
if (isMessage) return linkify(message);
if(isEmoji){
return Emoji.parse(message, "72x72");
} else {
return Emoji.parse(message, "26x26");
return Emoji.parse(linkify(message), "26x26");
}
}
anchors.left: parent.left

View File

@ -83,13 +83,11 @@ ModalPopup {
ScrollView {
anchors.fill: parent
anchors.topMargin: 50
anchors.top: searchBox.bottom
Layout.fillWidth: true
Layout.fillHeight: true
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
ScrollBar.vertical.policy: groupMembers.contentHeight > groupMembers.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
ScrollBar.vertical.policy: contactListView.contentHeight > contactListView.height ? ScrollBar.AlwaysOn : ScrollBar.AlwaysOff
ListView {
anchors.fill: parent
@ -101,7 +99,7 @@ ModalPopup {
showCheckbox: false
pubKey: model.pubKey
isContact: model.isContact
isUser: model.isUser
isUser: false
name: model.name
address: model.address
identicon: model.identicon

15
ui/generate-rcc.sh Executable file
View File

@ -0,0 +1,15 @@
#!/bin/sh
cd ./ui/
QRC=./resources.qrc
echo '<!DOCTYPE RCC>' > $QRC
echo '<RCC version="1.0">' >> $QRC
echo ' <qresource>' >> $QRC
for a in $(find . -not -name "*.pro" -not -name "*.rcc" -not -name "*.sh" -not -name "*.qrc" )
do
if [ ! -d "$a" ]; then
echo ' <file>'$a'</file>' >> $QRC
fi
done
echo ' </qresource>' >> $QRC
echo '</RCC>' >> $QRC
cd ..