Skip to content

Commit

Permalink
Вернул сборку на qmake, теперь работает статическая линковка с
Browse files Browse the repository at this point in the history
библотеками Qt
  • Loading branch information
levovix0 committed Mar 25, 2021
1 parent 2eedb86 commit 01f5c6b
Show file tree
Hide file tree
Showing 11 changed files with 158 additions and 105 deletions.
6 changes: 3 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/DMusic
/.vscode
/build-*
*.user
/yapi/tests/test1
/yapi/tests/test1.exe

# Qt translation binaries
*.qm
73 changes: 0 additions & 73 deletions CMakeLists.txt

This file was deleted.

101 changes: 101 additions & 0 deletions DMusic.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
QT += quick multimedia dbus svg
win32: QT += winextras

CONFIG += c++17

SOURCES += \
AudioPlayer.cpp \
IClient.cpp \
ID.cpp \
IPlaylist.cpp \
IPlaylistRadio.cpp \
IRadio.cpp \
ITrack.cpp \
Log.cpp \
QmlTrack.cpp \
RemoteMediaController.cpp \
api.cpp \
main.cpp \
mediaplayer.cpp \
settings.cpp \
yapi.cpp

HEADERS += \
AudioPlayer.hpp \
IClient.hpp \
ID.hpp \
IPlaylist.hpp \
IPlaylistRadio.hpp \
IRadio.hpp \
ITrack.hpp \
Log.hpp \
QmlTrack.hpp \
RemoteMediaController.hpp \
api.hpp \
file.hpp \
mediaplayer.hpp \
python.hpp \
settings.hpp \
types.hpp \
utils.hpp \
yapi.hpp

RESOURCES += qml.qrc translations.qrc
win32:RC_ICONS += resources/application.ico

TRANSLATIONS += \
translations/russian.ts

!isEmpty(TRANSLATIONS): contains(RESOURCES, translations.qrc) {
# generate translations.qrc if TRANSLATIONS changed
_old_translations = $$cat($$OUT_PWD/translations.txt)
_current_translations = $$TRANSLATIONS
_current_translations -= $$_old_translations
_old_translations -= $$TRANSLATIONS
_transaltions_diff = $$_old_translations $$_current_translations
!isEmpty(_transaltions_diff)|!exists($$OUT_PWD/translations.txt)|!exists($$PWD/translations.qrc) {
message(regenerating translations.qrc)

# create translations.qrc
_translations_qrc += <RCC><qresource prefix=\"/\">$$escape_expand(\n)
for(_translation_name, TRANSLATIONS) {
_translation_name_qm = $$section(_translation_name,".", 0, 0).qm
_translations_qrc += <file>$$_translation_name_qm</file>$$escape_expand(\n)

# if *.qm not exist - create dummy
system($$shell_path($$[QT_INSTALL_BINS]/lrelease) $$shell_path($$PWD/$$_translation_name) -qm $$shell_path($$_translation_name_qm))
}
_translations_qrc += </qresource></RCC>$$escape_expand(\n)
write_file($$PWD/translations.qrc, _translations_qrc)
write_file($$OUT_PWD/translations.txt, TRANSLATIONS);

QMAKE_CLEAN += $$shell_path($$OUT_PWD/translations.txt)
}

# run lrelease
QMAKE_EXTRA_COMPILERS += _translations_lrelease
_translations_lrelease.input = TRANSLATIONS
_translations_lrelease.output = $$PWD/translations/${QMAKE_FILE_BASE}.qm
_translations_lrelease.commands = $$[QT_INSTALL_BINS]/lrelease ${QMAKE_FILE_IN} -qm ${QMAKE_FILE_OUT}
_translations_lrelease.CONFIG += no_link
}

QML_IMPORT_PATH =

QML_DESIGNER_IMPORT_PATH =

qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

win32 {
LIBS += -LC:\Users\levovix\AppData\Local\Programs\Python\Python39\libs -lpython39
INCLUDEPATH += C:\Users\levovix\AppData\Local\Programs\Python\Python39\include
DEPENDPATH += C:\Users\levovix\AppData\Local\Programs\Python\Python39\include
}

unix {
LIBS += -L/usr/local/lib/python3.9 -lpython3.9
INCLUDEPATH += /usr/include/python3.9
DEPENDPATH += /usr/include/python3.9
}
2 changes: 1 addition & 1 deletion Icon.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import QtQuick 2.0
import QtGraphicalEffects 1.0
import QtGraphicalEffects 1.15

Item {
id: root
Expand Down
1 change: 0 additions & 1 deletion VolumeControlPanel.qml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import QtQuick 2.0
import QtGraphicalEffects 1.15
import DMusic 1.0

FloatingPanel {
Expand Down
2 changes: 1 addition & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ int main(int argc, char *argv[])
Py_Initialize();

QTranslator translator;
translator.load("russian");
translator.load(":translations/russian");

QGuiApplication app(argc, argv);
app.installTranslator(&translator);
Expand Down
5 changes: 3 additions & 2 deletions main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ Window {
anchors.right: root.horizontalCenter
anchors.rightMargin: 10

text: "Прослушать"
//: Play button
text: qsTr("Play")

onClick: {
_player.player.play(_yapi.track(parseInt(_id_input.text)))
Expand All @@ -107,7 +108,7 @@ Window {
anchors.left: root.horizontalCenter
anchors.leftMargin: 10

text: "Прослушать скачанное"
text: qsTr("Play downloaded")

onClick: {
_player.player.play(_yapi.downloadsPlaylist())
Expand Down
1 change: 0 additions & 1 deletion qml.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,5 @@
<file>VolumeSlider.qml</file>
<file>FloatingPanel.qml</file>
<file>PopupController.qml</file>
<file>russian.ts</file>
</qresource>
</RCC>
23 changes: 0 additions & 23 deletions russian.ts

This file was deleted.

7 changes: 7 additions & 0 deletions translations.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<RCC><qresource
prefix="/">

<file>translations/russian.qm</file>

</qresource></RCC>

42 changes: 42 additions & 0 deletions translations/russian.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE TS>
<TS version="2.1" language="ru_RU">
<context>
<name>ThumbnailController</name>
<message>
<location filename="../RemoteMediaController.cpp" line="445"/>
<location filename="../RemoteMediaController.cpp" line="479"/>
<source>Play</source>
<translation>Продолжить</translation>
</message>
<message>
<location filename="../RemoteMediaController.cpp" line="451"/>
<source>Next</source>
<translation>Следующий</translation>
</message>
<message>
<location filename="../RemoteMediaController.cpp" line="457"/>
<source>Previous</source>
<translation>Предыдуший</translation>
</message>
<message>
<location filename="../RemoteMediaController.cpp" line="476"/>
<source>Pause</source>
<translation>Пауза</translation>
</message>
</context>
<context>
<name>main</name>
<message>
<location filename="../main.qml" line="97"/>
<source>Play</source>
<extracomment>Play button</extracomment>
<translation>Прослушать</translation>
</message>
<message>
<location filename="../main.qml" line="111"/>
<source>Play downloaded</source>
<translation>Прослушать скачанное</translation>
</message>
</context>
</TS>

0 comments on commit 01f5c6b

Please sign in to comment.