1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2024-10-28 08:49:35 +01:00

misc: use compiled rcc file to collect lrc web resources

Instead of using absolute path, use a rcc file compiled
from lrc web resources qrc

Gitlab: #233

Change-Id: Ife3c3b81654984247aed0664031ad45ffb8413db
This commit is contained in:
Ming Rui Zhang 2020-12-30 12:03:57 -05:00
parent d61a9a9da9
commit dc634feded
3 changed files with 34 additions and 9 deletions

View file

@ -95,6 +95,8 @@ def setup_parameters(parsed_args):
else:
globalVar.qt_version = execute_cmd('qmake -v', True)
if globalVar.qt_version == -1:
print(bcolors.WARNING + "No qmake found, trying qmake-qt5..." + bcolors.ENDC)
globalVar.qt_version = execute_cmd('qmake-qt5 -v', True)
if globalVar.qt_version == -1:
print(bcolors.FAIL + "No qmake found!" + bcolors.ENDC)
@ -177,6 +179,28 @@ def copy_ringtones():
shutil.copy(ringtone_path + os.sep + file, copy_to_path)
def compile_and_copy_web_resources():
# web resources
rcc = 'rcc'
if globalVar.qt_path:
rcc = globalVar.qt_path + os.sep + 'bin' + os.sep + \
'rcc' + ('.exe' if globalVar.system_name == "Windows" else '')
if execute_cmd(rcc + ' -v', True) == -1:
print(bcolors.WARNING + "No rcc found, trying rcc-qt5..." + bcolors.ENDC)
rcc = rcc.replace('rcc', 'rcc-qt5')
if execute_cmd(rcc + ' -v', True) == -1:
print(bcolors.FAIL + "No rcc found!" + bcolors.ENDC)
sys.exit()
lrc_web_resources_path = globalVar.lrc_path + os.sep + 'webresource.qrc'
execute_cmd(rcc + ' -binary ' + lrc_web_resources_path +
' -o ' + globalVar.output_path + os.sep + 'webresource.rcc')
def release_and_copy_translations():
# translations binary
lrelease = 'lrelease'
@ -186,6 +210,8 @@ def release_and_copy_translations():
'lrelease' + ('.exe' if globalVar.system_name == "Windows" else '')
if execute_cmd(lrelease + ' -version', True) == -1:
print(bcolors.WARNING + "No lrelease found, trying lrelease-qt5..." + bcolors.ENDC)
lrelease = lrelease.replace('lrelease', 'lrelease-qt5')
if execute_cmd(lrelease + ' -version', True) == -1:
print(bcolors.FAIL + "No lrelease found!" + bcolors.ENDC)
@ -305,6 +331,9 @@ def main():
# translations
release_and_copy_translations()
# web resources
compile_and_copy_web_resources()
# write stamp
write_stamp()

View file

@ -74,14 +74,6 @@
<file>images/icons/round-remove_circle-24px.svg</file>
<file>images/icons/round-settings-24px.svg</file>
<file>images/icons/round-undo-24px.svg</file>
<file alias="chatview.css">../lrc/src/web-chatview/chatview.css</file>
<file alias="chatview.html">../lrc/src/web-chatview/chatview.html</file>
<file alias="chatview.js">../lrc/src/web-chatview/chatview.js</file>
<file alias="linkify.js">../lrc/src/web-chatview/linkify.js</file>
<file alias="linkify-html.js">../lrc/src/web-chatview/linkify-html.js</file>
<file alias="linkify-string.js">../lrc/src/web-chatview/linkify-string.js</file>
<file alias="qwebchannel.js">../lrc/src/web-chatview/qwebchannel.js</file>
<file alias="chatview-windows.css">../lrc/src/web-chatview/chatview-windows.css</file>
<file>images/icons/round-check_circle-24px.svg</file>
<file>images/icons/round-error-24px.svg</file>
<file>images/icons/round-save_alt-24px.svg</file>

View file

@ -1,4 +1,4 @@
/*!
/*!
* Copyright (C) 2015-2020 by Savoir-faire Linux
* Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>
* Author: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
@ -133,6 +133,10 @@ MainApplication::init()
{
setWindowIcon(QIcon(":images/jami.ico"));
// Lrc web resources
QResource::registerResource(QCoreApplication::applicationDirPath() + QDir::separator()
+ "webresource.rcc");
#ifdef Q_OS_LINUX
if (!getenv("QT_QPA_PLATFORMTHEME"))
setenv("QT_QPA_PLATFORMTHEME", "gtk3", true);