Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 30da2564 authored by Camilo Higuita's avatar Camilo Higuita

fixes on andorid cache deletion, ui scaling

parent 72f660ab
...@@ -200,7 +200,7 @@ SOURCES += main.cpp \ ...@@ -200,7 +200,7 @@ SOURCES += main.cpp \
RESOURCES += qml.qrc RESOURCES += qml.qrc \
# Additional import path used to resolve QML modules in Qt Creator's code model # Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH = QML_IMPORT_PATH =
......
...@@ -352,14 +352,14 @@ QVariantList Babe::getDirs(const QString &pathUrl) ...@@ -352,14 +352,14 @@ QVariantList Babe::getDirs(const QString &pathUrl)
QVariantMap Babe::getParentDir(const QString &path) QVariantMap Babe::getParentDir(const QString &path)
{ {
auto dirUrl = QFileInfo(path).dir().absolutePath(); auto dir = QDir(path);
auto dir = QDir(dirUrl); dir.cdUp();
auto dirPath = dir.absolutePath();
if(dir.exists() && dir.isReadable() && !dir.isRoot()) if(dir.isReadable() && !dir.isRoot() && dir.exists())
return {{"url", dirUrl}, {"name", QFileInfo(path).dir().dirName()}}; return {{"url", dirPath}, {"name", dir.dirName()}};
else else
return {{"url", path}, {"name", QDir(path).dirName()}}; return {{"url", path}, {"name", QFileInfo(path).dir().dirName()}};
} }
void Babe::registerTypes() void Babe::registerTypes()
......
...@@ -53,7 +53,7 @@ settings::settings(QObject *parent) : QObject(parent) ...@@ -53,7 +53,7 @@ settings::settings(QObject *parent) : QObject(parent)
#endif #endif
QDir collectionDBPath_dir(BAE::CollectionDBPath); QDir collectionDBPath_dir(BAE::CollectionDBPath);
QDir cachePath_dir(BAE::isMobile() ? BAE::ArtworkPath : BAE::CachePath); QDir cachePath_dir(BAE::CachePath);
QDir youtubeCache_dir(BAE::YoutubeCachePath); QDir youtubeCache_dir(BAE::YoutubeCachePath);
if (!collectionDBPath_dir.exists()) if (!collectionDBPath_dir.exists())
......
...@@ -54,6 +54,7 @@ private: ...@@ -54,6 +54,7 @@ private:
QString pathToRemove; QString pathToRemove;
QStringList dirs; QStringList dirs;
QFileSystemWatcher *watcher; QFileSystemWatcher *watcher;
......
...@@ -19,6 +19,26 @@ namespace BAE ...@@ -19,6 +19,26 @@ namespace BAE
{ {
Q_NAMESPACE Q_NAMESPACE
inline bool isMobile()
{
#if defined(Q_OS_ANDROID)
return true;
#elif defined(Q_OS_LINUX)
return false;
#elif defined(Q_OS_WIN32)
return false;
#elif defined(Q_OS_WIN64)
return false;
#elif defined(Q_OS_MACOS)
return false;
#elif defined(Q_OS_IOS)
return true;
#elif defined(Q_OS_HAIKU)
return false;
#endif
}
enum SearchT enum SearchT
{ {
LIKE, LIKE,
...@@ -216,9 +236,9 @@ namespace BAE ...@@ -216,9 +236,9 @@ namespace BAE
const QString MusicPath = QStandardPaths::writableLocation(QStandardPaths::MusicLocation); const QString MusicPath = QStandardPaths::writableLocation(QStandardPaths::MusicLocation);
const QString HomePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation); const QString HomePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
const QString SettingPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)+"/babe/"; const QString SettingPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)+"/babe/";
const QString ArtworkPath = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation)+"/babe/artwork/"; const QString ArtworkPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/babe/artwork/";
const QString CollectionDBPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/babe/"; const QString CollectionDBPath = QStandardPaths::writableLocation(QStandardPaths::GenericDataLocation)+"/babe/";
const QString CachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)+"/babe/"; const QString CachePath = BAE::isMobile() ? BAE::ArtworkPath : QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)+"/babe/";
const QString YoutubeCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)+"/babe/youtube/"; const QString YoutubeCachePath = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation)+"/babe/youtube/";
const QString DownloadsPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation); const QString DownloadsPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
const QString NotifyDir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation); const QString NotifyDir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
...@@ -391,26 +411,6 @@ namespace BAE ...@@ -391,26 +411,6 @@ namespace BAE
return false; return false;
} }
inline bool isMobile()
{
#if defined(Q_OS_ANDROID)
return true;
#elif defined(Q_OS_LINUX)
return false;
#elif defined(Q_OS_WIN32)
return false;
#elif defined(Q_OS_WIN64)
return false;
#elif defined(Q_OS_MACOS)
return false;
#elif defined(Q_OS_IOS)
return true;
#elif defined(Q_OS_HAIKU)
return false;
#endif
}
enum class AlbumSizeHint : uint enum class AlbumSizeHint : uint
{ {
BIG_ALBUM = 200, BIG_ALBUM = 200,
...@@ -433,13 +433,13 @@ namespace BAE ...@@ -433,13 +433,13 @@ namespace BAE
static const ALBUM_FACTOR SMALL_ALBUM_FACTOR = 0.006; static const ALBUM_FACTOR SMALL_ALBUM_FACTOR = 0.006;
static const ALBUM_FACTOR SMALL_ALBUM_FACTOR_SUBWIDGET = 0.5; static const ALBUM_FACTOR SMALL_ALBUM_FACTOR_SUBWIDGET = 0.5;
inline uint getWidgetSizeHint(const AlbumSizeHint &deafultValue) inline uint getWidgetSizeHint(const AlbumSizeHint &defaultValue)
{ {
QScreen *screenSize = QApplication::screens().at(0); QScreen *screenSize = QApplication::screens().at(0);
auto screen = static_cast<uint>(sqrt((screenSize->availableSize().height()*screenSize->availableSize().width()))); auto screen = static_cast<uint>(sqrt((screenSize->availableSize().height()*screenSize->availableSize().width())));
switch(deafultValue) switch(defaultValue)
{ {
case AlbumSizeHint::BIG_ALBUM: case AlbumSizeHint::BIG_ALBUM:
return screen * 0.3 ; return screen * 0.3 ;
...@@ -448,6 +448,8 @@ namespace BAE ...@@ -448,6 +448,8 @@ namespace BAE
case AlbumSizeHint::SMALL_ALBUM: case AlbumSizeHint::SMALL_ALBUM:
return screen * 0.05 ; return screen * 0.05 ;
} }
return static_cast<uint>(defaultValue);
} }
} }
......
...@@ -5,6 +5,8 @@ import QtQuick.Layouts 1.3 ...@@ -5,6 +5,8 @@ import QtQuick.Layouts 1.3
Item Item
{ {
id: babeAlbumRoot
signal albumClicked(int index) signal albumClicked(int index)
property int albumSize : 150 property int albumSize : 150
property int borderRadius : 2 property int borderRadius : 2
...@@ -12,7 +14,6 @@ Item ...@@ -12,7 +14,6 @@ Item
property string textColor: bae.foregroundColor() property string textColor: bae.foregroundColor()
property int fontSize : bae.isMobile()? 12 : 10 property int fontSize : bae.isMobile()? 12 : 10
property bool hide : false property bool hide : false
id: root
width: albumSize width: albumSize
height: typeof album === 'undefined' ? parseInt(albumSize+(albumSize*0.3)) : parseInt(albumSize+(albumSize*0.4)) height: typeof album === 'undefined' ? parseInt(albumSize+(albumSize*0.3)) : parseInt(albumSize+(albumSize*0.4))
...@@ -30,7 +31,6 @@ Item ...@@ -30,7 +31,6 @@ Item
source: card source: card
} }
Rectangle Rectangle
{ {
id: card id: card
...@@ -48,12 +48,14 @@ Item ...@@ -48,12 +48,14 @@ Item
Image Image
{ {
id: img id: img
width: albumSize width: babeAlbumRoot.width
height: albumSize height: babeAlbumRoot.width
fillMode: Image.PreserveAspectFit fillMode: Image.PreserveAspectFit
cache: false
antialiasing: true
source: (artwork.length>0 && artwork !== "none")? "file://"+encodeURIComponent(artwork) : "qrc:/assets/cover.png" source: (artwork.length>0 && artwork !== "none" && artwork)? "file://"+encodeURIComponent(artwork) : "qrc:/assets/cover.png"
// layer.enabled: true // layer.enabled: true
// layer.effect: OpacityMask // layer.effect: OpacityMask
// { // {
......
...@@ -11,8 +11,17 @@ BabeGrid ...@@ -11,8 +11,17 @@ BabeGrid
{ {
id: albumsViewGrid id: albumsViewGrid
visible: true visible: true
albumSize: Math.sqrt(root.width*root.height)*0.25
borderRadius: 20 property int hintSize : Math.sqrt(root.width*root.height)*0.25
albumSize:
{
if(hintSize>200)
200
else if (hintSize < 150)
bae.isMobile() && hintSize < 120 ? 120 : 150
else
hintSize
}
signal rowClicked(var track) signal rowClicked(var track)
signal playAlbum(var tracks) signal playAlbum(var tracks)
......
...@@ -11,8 +11,17 @@ BabeGrid ...@@ -11,8 +11,17 @@ BabeGrid
{ {
id:artistsViewGrid id:artistsViewGrid
visible: true visible: true
albumSize:Math.sqrt(root.width*root.height)*0.25 property int hintSize : Math.sqrt(root.width*root.height)*0.25
borderRadius: 20 albumSize:
{
if(hintSize>200)
200
else if (hintSize<150)
bae.isMobile() && hintSize < 120 ? 120 : 150
else
hintSize
}
signal rowClicked(var track) signal rowClicked(var track)
signal playAlbum(var tracks) signal playAlbum(var tracks)
......
...@@ -10,7 +10,7 @@ Drawer ...@@ -10,7 +10,7 @@ Drawer
{ {
id: settingsView id: settingsView
y: header.height y: header.height
height: parent.height - header.height height: parent.height - header.height - footer.height
width: bae.isMobile() ? parent.width* 0.7 : parent.width* 0.5 width: bae.isMobile() ? parent.width* 0.7 : parent.width* 0.5
edge: Qt.RightEdge edge: Qt.RightEdge
interactive: true interactive: true
......
Markdown is supported
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