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 \
RESOURCES += qml.qrc
RESOURCES += qml.qrc \
# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
......
......@@ -352,14 +352,14 @@ QVariantList Babe::getDirs(const QString &pathUrl)
QVariantMap Babe::getParentDir(const QString &path)
{
auto dirUrl = QFileInfo(path).dir().absolutePath();
auto dir = QDir(dirUrl);
auto dir = QDir(path);
dir.cdUp();
auto dirPath = dir.absolutePath();
if(dir.exists() && dir.isReadable() && !dir.isRoot())
return {{"url", dirUrl}, {"name", QFileInfo(path).dir().dirName()}};
if(dir.isReadable() && !dir.isRoot() && dir.exists())
return {{"url", dirPath}, {"name", dir.dirName()}};
else
return {{"url", path}, {"name", QDir(path).dirName()}};
return {{"url", path}, {"name", QFileInfo(path).dir().dirName()}};
}
void Babe::registerTypes()
......
......@@ -53,7 +53,7 @@ settings::settings(QObject *parent) : QObject(parent)
#endif
QDir collectionDBPath_dir(BAE::CollectionDBPath);
QDir cachePath_dir(BAE::isMobile() ? BAE::ArtworkPath : BAE::CachePath);
QDir cachePath_dir(BAE::CachePath);
QDir youtubeCache_dir(BAE::YoutubeCachePath);
if (!collectionDBPath_dir.exists())
......
......@@ -54,6 +54,7 @@ private:
QString pathToRemove;
QStringList dirs;
QFileSystemWatcher *watcher;
......
......@@ -19,6 +19,26 @@ namespace BAE
{
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
{
LIKE,
......@@ -216,9 +236,9 @@ namespace BAE
const QString MusicPath = QStandardPaths::writableLocation(QStandardPaths::MusicLocation);
const QString HomePath = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
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 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 DownloadsPath = QStandardPaths::writableLocation(QStandardPaths::DownloadLocation);
const QString NotifyDir = QStandardPaths::writableLocation(QStandardPaths::ConfigLocation);
......@@ -391,26 +411,6 @@ namespace BAE
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
{
BIG_ALBUM = 200,
......@@ -433,13 +433,13 @@ namespace BAE
static const ALBUM_FACTOR SMALL_ALBUM_FACTOR = 0.006;
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);
auto screen = static_cast<uint>(sqrt((screenSize->availableSize().height()*screenSize->availableSize().width())));
switch(deafultValue)
switch(defaultValue)
{
case AlbumSizeHint::BIG_ALBUM:
return screen * 0.3 ;
......@@ -448,6 +448,8 @@ namespace BAE
case AlbumSizeHint::SMALL_ALBUM:
return screen * 0.05 ;
}
return static_cast<uint>(defaultValue);
}
}
......
......@@ -5,6 +5,8 @@ import QtQuick.Layouts 1.3
Item
{
id: babeAlbumRoot
signal albumClicked(int index)
property int albumSize : 150
property int borderRadius : 2
......@@ -12,7 +14,6 @@ Item
property string textColor: bae.foregroundColor()
property int fontSize : bae.isMobile()? 12 : 10
property bool hide : false
id: root
width: albumSize
height: typeof album === 'undefined' ? parseInt(albumSize+(albumSize*0.3)) : parseInt(albumSize+(albumSize*0.4))
......@@ -30,7 +31,6 @@ Item
source: card
}
Rectangle
{
id: card
......@@ -48,12 +48,14 @@ Item
Image
{
id: img
width: albumSize
height: albumSize
width: babeAlbumRoot.width
height: babeAlbumRoot.width
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.effect: OpacityMask
// {
......
......@@ -11,8 +11,17 @@ BabeGrid
{
id: albumsViewGrid
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 playAlbum(var tracks)
......
......@@ -11,8 +11,17 @@ BabeGrid
{
id:artistsViewGrid
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 playAlbum(var tracks)
......
......@@ -10,7 +10,7 @@ Drawer
{
id: settingsView
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
edge: Qt.RightEdge
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