Commit 909494e7 authored by Albert Astals Cid's avatar Albert Astals Cid
Browse files

Android: Make it work again

Need the files to be in a qrc, i can't figure out how to read them
otherwise nowadays
parent c34f5e79
Pipeline #110896 passed with stage
in 49 seconds
......@@ -17,7 +17,7 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${ECM_MODULE_PATH} )
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS PrintSupport Svg Widgets Xml Multimedia)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Config I18n)
if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")
if(NOT ANDROID)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS
Completion
ConfigWidgets
......@@ -50,8 +50,6 @@ add_definitions(-DQT_DEPRECATED_WARNINGS_SINCE=0x050C00)
add_definitions(-DKF_DEPRECATED_WARNINGS_SINCE=0x054400)
add_subdirectory(sounds)
add_subdirectory(pics)
if(KF5DocTools_FOUND)
add_subdirectory(doc)
endif()
......@@ -67,7 +65,7 @@ set(ktuberling_common_SRCS
)
ecm_qt_declare_logging_category(ktuberling_common_SRCS HEADER ktuberling_debug.h IDENTIFIER KTUBERLING_LOG CATEGORY_NAME org.kde.kdegames.ktuberling DESCRIPTION "ktuberling (kdegames)" EXPORT KTUBERLING)
if(${CMAKE_SYSTEM_NAME} MATCHES "Android")
if(ANDROID)
set(ktuberling_mobile_SRCS
${ktuberling_common_SRCS}
main_mobile.cpp
......@@ -134,6 +132,9 @@ else()
64-mimetypes-application-x-tuberling.png
DESTINATION ${KDE_INSTALL_ICONDIR} THEME hicolor
)
add_subdirectory(sounds)
add_subdirectory(pics)
endif()
install(FILES org.kde.ktuberling.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR})
......
......@@ -3,5 +3,108 @@
<file>games-config-theme.png</file>
<file>audio-volume-high.png</file>
<file>audio-volume-muted.png</file>
<file>../pics/butterflies.desktop</file>
<file>../pics/butterflies.svgz</file>
<file>../pics/butterflies.theme</file>
<file>../pics/christmas.desktop</file>
<file>../pics/christmas.svgz</file>
<file>../pics/christmas.theme</file>
<file>../pics/default_theme.desktop</file>
<file>../pics/default_theme.svg</file>
<file>../pics/default_theme.theme</file>
<file>../pics/egypt.desktop</file>
<file>../pics/egypt.svg</file>
<file>../pics/egypt.theme</file>
<file>../pics/moon.desktop</file>
<file>../pics/moon.svg</file>
<file>../pics/moon.theme</file>
<file>../pics/pizzeria.desktop</file>
<file>../pics/pizzeria.svgz</file>
<file>../pics/pizzeria.theme</file>
<file>../pics/potato-game.desktop</file>
<file>../pics/potato-game.svg</file>
<file>../pics/potato-game.theme</file>
<file>../pics/robin-tux.desktop</file>
<file>../pics/robin-tux.svgz</file>
<file>../pics/robin-tux.theme</file>
<file>../pics/robot_workshop.desktop</file>
<file>../pics/robot_workshop.svgz</file>
<file>../pics/robot_workshop.theme</file>
<file>../pics/train_valley.desktop</file>
<file>../pics/train_valley.svgz</file>
<file>../pics/train_valley.theme</file>
<file>../sounds/en.soundtheme</file>
<file alias="sounds/en/ball.ogg">../sounds/ball.ogg</file>
<file alias="sounds/en/bow.ogg">../sounds/bow.ogg</file>
<file alias="sounds/en/coat.ogg">../sounds/coat.ogg</file>
<file alias="sounds/en/ear.ogg">../sounds/ear.ogg</file>
<file alias="sounds/en/earring.ogg">../sounds/earring.ogg</file>
<file alias="sounds/en/egypt_arch.ogg">../sounds/egypt_arch.ogg</file>
<file alias="sounds/en/egypt_birds.ogg">../sounds/egypt_birds.ogg</file>
<file alias="sounds/en/egypt_boy.ogg">../sounds/egypt_boy.ogg</file>
<file alias="sounds/en/egypt_bridge.ogg">../sounds/egypt_bridge.ogg</file>
<file alias="sounds/en/egypt_camel.ogg">../sounds/egypt_camel.ogg</file>
<file alias="sounds/en/egypt_cart.ogg">../sounds/egypt_cart.ogg</file>
<file alias="sounds/en/egypt_column.ogg">../sounds/egypt_column.ogg</file>
<file alias="sounds/en/egypt_donkey.ogg">../sounds/egypt_donkey.ogg</file>
<file alias="sounds/en/egypt_girl.ogg">../sounds/egypt_girl.ogg</file>
<file alias="sounds/en/egypt_grass.ogg">../sounds/egypt_grass.ogg</file>
<file alias="sounds/en/egypt_man.ogg">../sounds/egypt_man.ogg</file>
<file alias="sounds/en/egypt_oasis.ogg">../sounds/egypt_oasis.ogg</file>
<file alias="sounds/en/egypt_palmtree.ogg">../sounds/egypt_palmtree.ogg</file>
<file alias="sounds/en/egypt_pyramid.ogg">../sounds/egypt_pyramid.ogg</file>
<file alias="sounds/en/egypt_road.ogg">../sounds/egypt_road.ogg</file>
<file alias="sounds/en/egypt_sphynx.ogg">../sounds/egypt_sphynx.ogg</file>
<file alias="sounds/en/egypt_well.ogg">../sounds/egypt_well.ogg</file>
<file alias="sounds/en/egypt_woman.ogg">../sounds/egypt_woman.ogg</file>
<file alias="sounds/en/eyebrow.ogg">../sounds/eyebrow.ogg</file>
<file alias="sounds/en/eye.ogg">../sounds/eye.ogg</file>
<file alias="sounds/en/flower.ogg">../sounds/flower.ogg</file>
<file alias="sounds/en/hair.ogg">../sounds/hair.ogg</file>
<file alias="sounds/en/hat.ogg">../sounds/hat.ogg</file>
<file alias="sounds/en/moon_alien.ogg">../sounds/moon_alien.ogg</file>
<file alias="sounds/en/moon_astronaut.ogg">../sounds/moon_astronaut.ogg</file>
<file alias="sounds/en/moon_earth.ogg">../sounds/moon_earth.ogg</file>
<file alias="sounds/en/moon_fallingstar.ogg">../sounds/moon_fallingstar.ogg</file>
<file alias="sounds/en/moon_hotel.ogg">../sounds/moon_hotel.ogg</file>
<file alias="sounds/en/moon_monster.ogg">../sounds/moon_monster.ogg</file>
<file alias="sounds/en/moon_moonwalker.ogg">../sounds/moon_moonwalker.ogg</file>
<file alias="sounds/en/moon_planet.ogg">../sounds/moon_planet.ogg</file>
<file alias="sounds/en/moon_radar.ogg">../sounds/moon_radar.ogg</file>
<file alias="sounds/en/moon_rocket.ogg">../sounds/moon_rocket.ogg</file>
<file alias="sounds/en/moon_satellite.ogg">../sounds/moon_satellite.ogg</file>
<file alias="sounds/en/moon_sign.ogg">../sounds/moon_sign.ogg</file>
<file alias="sounds/en/moon_star.ogg">../sounds/moon_star.ogg</file>
<file alias="sounds/en/moon_ufo.ogg">../sounds/moon_ufo.ogg</file>
<file alias="sounds/en/moustache.ogg">../sounds/moustache.ogg</file>
<file alias="sounds/en/mouth.ogg">../sounds/mouth.ogg</file>
<file alias="sounds/en/nose.ogg">../sounds/nose.ogg</file>
<file alias="sounds/en/pizzeria_anchovy.ogg">../sounds/pizzeria_anchovy.ogg</file>
<file alias="sounds/en/pizzeria_bacon.ogg">../sounds/pizzeria_bacon.ogg</file>
<file alias="sounds/en/pizzeria_broccolli.ogg">../sounds/pizzeria_broccolli.ogg</file>
<file alias="sounds/en/pizzeria_cheese.ogg">../sounds/pizzeria_cheese.ogg</file>
<file alias="sounds/en/pizzeria_cucumber.ogg">../sounds/pizzeria_cucumber.ogg</file>
<file alias="sounds/en/pizzeria_mushroom.ogg">../sounds/pizzeria_mushroom.ogg</file>
<file alias="sounds/en/pizzeria_olive.ogg">../sounds/pizzeria_olive.ogg</file>
<file alias="sounds/en/pizzeria_onion.ogg">../sounds/pizzeria_onion.ogg</file>
<file alias="sounds/en/pizzeria_oregano.ogg">../sounds/pizzeria_oregano.ogg</file>
<file alias="sounds/en/pizzeria_pepper.ogg">../sounds/pizzeria_pepper.ogg</file>
<file alias="sounds/en/pizzeria_pepperoni.ogg">../sounds/pizzeria_pepperoni.ogg</file>
<file alias="sounds/en/pizzeria_pineapple.ogg">../sounds/pizzeria_pineapple.ogg</file>
<file alias="sounds/en/pizzeria_salami.ogg">../sounds/pizzeria_salami.ogg</file>
<file alias="sounds/en/pizzeria_tomato.ogg">../sounds/pizzeria_tomato.ogg</file>
<file alias="sounds/en/shoe.ogg">../sounds/shoe.ogg</file>
<file alias="sounds/en/shorts.ogg">../sounds/shorts.ogg</file>
<file alias="sounds/en/skirt.ogg">../sounds/skirt.ogg</file>
<file alias="sounds/en/spectacles.ogg">../sounds/spectacles.ogg</file>
<file alias="sounds/en/stick.ogg">../sounds/stick.ogg</file>
<file alias="sounds/en/sunglasses.ogg">../sounds/sunglasses.ogg</file>
<file alias="sounds/en/tie.ogg">../sounds/tie.ogg</file>
<file alias="sounds/en/tv_bicycle.ogg">../sounds/tv_bicycle.ogg</file>
<file alias="sounds/en/tv_car.ogg">../sounds/tv_car.ogg</file>
<file alias="sounds/en/tv_cyclist.ogg">../sounds/tv_cyclist.ogg</file>
<file alias="sounds/en/tv_train.ogg">../sounds/tv_train.ogg</file>
<file alias="sounds/en/tv_tree.ogg">../sounds/tv_tree.ogg</file>
<file alias="sounds/en/umbrella.ogg">../sounds/umbrella.ogg</file>
</qresource>
</RCC>
......@@ -15,8 +15,8 @@
bool FileFactory::folderExists(const QString &relativePath)
{
#if defined(Q_OS_ANDROID)
QFileInfo fi("/data/data/org.kde.ktuberling/qt-reserved-files/share/ktuberling/" + relativePath);
return fi.isDir();
Q_UNUSED(relativePath);
return true;
#else
return !(QStandardPaths::locate(QStandardPaths::AppDataLocation, relativePath, QStandardPaths::LocateDirectory).isEmpty());
#endif
......@@ -25,7 +25,7 @@ bool FileFactory::folderExists(const QString &relativePath)
QString FileFactory::locate(const QString &relativePath)
{
#if defined(Q_OS_ANDROID)
return "/data/data/org.kde.ktuberling/qt-reserved-files/share/ktuberling/" + relativePath;
return ":/" + relativePath;
#else
return QStandardPaths::locate(QStandardPaths::AppDataLocation, relativePath);
#endif
......@@ -34,7 +34,7 @@ QString FileFactory::locate(const QString &relativePath)
QStringList FileFactory::locateAll(const QString &relativePath)
{
#if defined(Q_OS_ANDROID)
return { "/data/data/org.kde.ktuberling/qt-reserved-files/share/ktuberling/" + relativePath };
return { ":/" + relativePath };
#else
return QStandardPaths::locateAll(QStandardPaths::AppDataLocation, relativePath, QStandardPaths::LocateDirectory);
#endif
......
......@@ -49,7 +49,11 @@ void SoundFactory::playSound(const QString &soundRef) const
const QString soundFile = FileFactory::locate(QLatin1String( "sounds/" ) + filesList[sound]);
if (soundFile.isEmpty()) return;
player->setMedia(QUrl::fromLocalFile(soundFile));
if (soundFile.startsWith(':')) {
player->setMedia(QUrl("qrc" + soundFile));
} else {
player->setMedia(QUrl::fromLocalFile(soundFile));
}
player->play();
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment