Convert images to use .qrc file, move images

All images have been moved to the /img/ folder in order to fully
separate qml from images. The .qrc file allows qml to use the images by
appending the qrc:/ prefix before the abstract path to the image.

Note that the .qrc file is also check at compile time, which further
enhances the confidence the lack of errors.

Some of the images are not used in the QML, but instead directly passed
through to the OpenVR API. These have not been added to the .qrc file.
This commit is contained in:
Vasily
2019-02-02 16:09:06 +01:00
parent e0768a38b3
commit a4ecb0b114
28 changed files with 40 additions and 29 deletions
+9 -13
View File
@@ -118,19 +118,15 @@ unix:DESTDIR = bin/linux/AdvancedSettings
DISTFILES += \
src/res/sounds/alarm01.wav \
src/res/qml/ptt_notification.png \
src/res/battery_0.png \
src/res/battery_1.png \
src/res/battery_2.png \
src/res/battery_3.png \
src/res/battery_4.png \
src/res/battery_5.png \
src/res/thumbicon.png \
src/res/qml/mic_off.svg \
src/res/qml/mic_on.svg \
src/res/qml/ptt_notification.svg \
src/res/qml/speaker_off.svg \
src/res/qml/speaker_on.svg \
src/res/img/audio/microphone/ptt_notification.png \
src/res/img/audio/microphone/ptt_notification.svg \
src/res/img/battery/battery_0.png \
src/res/img/battery/battery_1.png \
src/res/img/battery/battery_2.png \
src/res/img/battery/battery_3.png \
src/res/img/battery/battery_4.png \
src/res/img/battery/battery_5.png \
src/res/img/icons/thumbicon.png \
src/res/qml/qmldir \
src/res/qml/AccessibilityPage.qml \
src/res/qml/audio_page/* \
+3 -3
View File
@@ -332,9 +332,9 @@ void OverlayController::SetWidget( QQuickItem* quickItem,
m_ulOverlayHandle,
vr::VROverlayFlags_SendVRSmoothScrollEvents,
true );
QString thumbIconPath
= QStandardPaths::locate( QStandardPaths::AppDataLocation,
QStringLiteral( "res/thumbicon.png" ) );
QString thumbIconPath = QStandardPaths::locate(
QStandardPaths::AppDataLocation,
QStringLiteral( "res/img/icons/thumbicon.png" ) );
if ( QFile::exists( thumbIconPath ) )
{
vr::VROverlay()->SetOverlayFromFile(

Before

Width:  |  Height:  |  Size: 598 B

After

Width:  |  Height:  |  Size: 598 B

Before

Width:  |  Height:  |  Size: 216 B

After

Width:  |  Height:  |  Size: 216 B

Before

Width:  |  Height:  |  Size: 219 B

After

Width:  |  Height:  |  Size: 219 B

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 181 B

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 4.9 KiB

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Before

Width:  |  Height:  |  Size: 7.0 KiB

After

Width:  |  Height:  |  Size: 7.0 KiB

+1 -1
View File
@@ -344,7 +344,7 @@ MyStackViewPage {
Layout.leftMargin: 12
checkable: true
contentItem: Image {
source: parent.checked ? "audio_page/mic_off.svg" : "audio_page/mic_on.svg"
source: parent.checked ? "qrc:/microphone/off" : "qrc:/microphone/on"
sourceSize.width: 32
sourceSize.height: 32
anchors.fill: parent
@@ -61,7 +61,7 @@ ColumnLayout {
Layout.leftMargin: 12
checkable: true
contentItem: Image {
source: parent.checked ? "../mic_off.svg" : "../mic_on.svg"
source: parent.checked ? "qrc:/microphone/off" : "qrc:/microphone/on"
sourceSize.width: 32
sourceSize.height: 32
anchors.fill: parent
@@ -62,7 +62,7 @@ ColumnLayout {
Layout.leftMargin: 12
checkable: true
contentItem: Image {
source: parent.checked ? "../speaker_off.svg" : "../speaker_on.svg"
source: parent.checked ? "qrc:/speaker/off" : "qrc:/speaker/on"
sourceSize.width: 32
sourceSize.height: 32
anchors.fill: parent
+1 -1
View File
@@ -26,7 +26,7 @@ Rectangle {
enabled: headerShowBackButton
opacity: headerShowBackButton ? 1.0 : 0.0
contentItem: Image {
source: "qrc:/common/back-arrow"
source: "qrc:/common/backarrow"
sourceSize.width: 50
sourceSize.height: 50
anchors.fill: parent
+1 -1
View File
@@ -31,7 +31,7 @@ CheckBox {
height: 28
x: (parent.width - width) / 2
y: (parent.height - height) / 2
source: "qrc:/common/box-checkmark"
source: "qrc:/common/box_checkmark"
sourceSize.width: width
sourceSize.height: height
visible: parent.parent.checked
@@ -25,10 +25,10 @@ GroupBox {
}
RowLayout {
property string playPauseButtonPath: "outline_play_pause_white_24dp.svg"
property string stopButtonPath: "outline_stop_white_24dp.svg"
property string previousButtonPath: "outline_skip_previous_white_24dp.svg"
property string nextButtonPath: "outline_skip_next_white_24dp.svg"
property string playPauseButtonPath: "qrc:/media_keys/play_pause"
property string stopButtonPath: "qrc:/media_keys/stop"
property string previousButtonPath: "qrc:/media_keys/previous"
property string nextButtonPath: "qrc:/media_keys/next"
MediaButton {
id: previousSongButton
+16 -2
View File
@@ -1,6 +1,20 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/common">
<file alias="back-arrow">img/common/backarrow.svg</file>
<file alias="box-checkmark">img/common/check.svg</file>
<file alias="backarrow">img/common/backarrow.svg</file>
<file alias="box_checkmark">img/common/check.svg</file>
</qresource>
<qresource prefix="/microphone">
<file alias="on">img/audio/microphone/mic_on.svg</file>
<file alias="off">img/audio/microphone/mic_off.svg</file>
</qresource>
<qresource prefix="/speaker">
<file alias="on">img/audio/speaker/speaker_on.svg</file>
<file alias="off">img/audio/speaker/speaker_off.svg</file>
</qresource>
<qresource prefix="/media_keys">
<file alias="play_pause">img/audio/media_keys/outline_play_pause_white_24dp.svg</file>
<file alias="next">img/audio/media_keys/outline_skip_next_white_24dp.svg</file>
<file alias="previous">img/audio/media_keys/outline_skip_previous_white_24dp.svg</file>
<file alias="stop">img/audio/media_keys/outline_stop_white_24dp.svg</file>
</qresource>
</RCC>
+2 -1
View File
@@ -72,7 +72,8 @@ void AudioTabController::initStage2( OverlayController* var_parent,
{
QString notifIconPath = QStandardPaths::locate(
QStandardPaths::AppDataLocation,
QStringLiteral( "/res/qml/ptt_notification.png" ) );
QStringLiteral(
"/res/img/audio/microphone/ptt_notification.png" ) );
if ( QFile::exists( notifIconPath ) )
{
vr::VROverlay()->SetOverlayFromFile(
@@ -274,7 +274,7 @@ void UtilitiesTabController::modAlarmTimeMinute( int value, bool notify )
QString getBatteryIconPath( int batteryState )
{
QString batteryPrefix = "/res/battery_";
QString batteryPrefix = "/res/img/battery/battery_";
return QStandardPaths::locate(
QStandardPaths::AppDataLocation,
batteryPrefix + QString::number( batteryState ) + ".png" );