Commit fdf48c60 authored by Camilo Higuita's avatar Camilo Higuita

fixes on ui scaling in small screens and cleaning up code a little bit

parent 3e0b6199
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="150"
height="30"
viewBox="0 0 39.687497 7.9374999"
version="1.1"
id="svg1485"
inkscape:version="0.92.2 5c3e80d, 2017-08-06"
sodipodi:docname="beat.svg">
<defs
id="defs1479" />
<sodipodi:namedview
id="base"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1.0"
inkscape:pageopacity="0.0"
inkscape:pageshadow="2"
inkscape:zoom="2.8"
inkscape:cx="98.994749"
inkscape:cy="-15.964256"
inkscape:document-units="mm"
inkscape:current-layer="layer1"
showgrid="false"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:window-width="1920"
inkscape:window-height="1027"
inkscape:window-x="1366"
inkscape:window-y="26"
inkscape:window-maximized="1"
units="px" />
<metadata
id="metadata1482">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<g
inkscape:label="Layer 1"
inkscape:groupmode="layer"
id="layer1"
transform="translate(-156.48668,-140.78553)">
<path
id="rect5505-21-9-9-5-5-1-6"
style="color:#000000;font-style:normal;font-weight:normal;font-size:10.58333302px;line-height:6.61458349px;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;display:inline;overflow:visible;visibility:visible;fill:#1a1a1a;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:0.11826887;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker:none;enable-background:accumulate"
d="m 163.33756,142.39485 c -0.13094,0 -0.23629,0.10552 -0.23629,0.23667 v 4.14284 c 0,0.13115 0.10535,0.23668 0.23629,0.23668 h 4.13613 c 0.13093,0 0.23629,-0.10553 0.23629,-0.23668 v -4.14284 c 0,-0.13115 -0.10536,-0.23667 -0.23629,-0.23667 z m 1.09576,0.9248 h 0.50373 v 0.37841 h -0.50373 z m 1.41881,0 h 0.50373 v 0.37841 h -0.50373 z m -2.13114,0.25249 h 0.50395 v 0.37863 h -0.50395 z m 2.84822,0 h 0.50374 v 0.37863 h -0.50374 z m -1.41729,0.25271 h 0.50373 v 0.37863 h -0.50373 z m 0.70021,0.12592 h 0.50373 v 0.37842 h -0.50373 z m -1.41881,0.001 h 0.50373 v 0.37863 h -0.50373 z m -0.70822,0.23971 h 0.49984 v 0.37841 h -0.49984 z m 2.84411,0 h 0.49963 v 0.37841 h -0.49963 z m -1.41838,0.26181 h 0.50396 v 0.37842 h -0.50396 z m 0.69697,0.11986 h 0.50374 v 0.37863 h -0.50374 z m -1.41448,0.008 h 0.50373 v 0.37842 h -0.50373 z m -0.71233,0.25011 h 0.50395 v 0.37842 h -0.50395 z m 2.84822,0.002 h 0.50374 v 0.37842 h -0.50374 z m -1.41729,0.24924 h 0.50373 v 0.37842 h -0.50373 z m 0.69588,0.12549 h 0.50374 v 0.37842 h -0.50374 z m -1.42011,0.008 h 0.50373 v 0.37864 h -0.50373 z m 0.72747,0.50152 h 0.50374 v 0.37842 h -0.50374 z m 22.62041,-2.30618 q 0.31426,0 0.61869,0.0622 0.30443,0.0589 0.54339,0.19313 0.23896,0.13421 0.38627,0.35353 0.1473,0.21606 0.1473,0.5303 h -1.24063 q -0.003,-0.10474 -0.0524,-0.17021 -0.0491,-0.0687 -0.12112,-0.10475 -0.0687,-0.0393 -0.15057,-0.0524 -0.0818,-0.0131 -0.15058,-0.0131 -0.0426,0 -0.12439,0.003 -0.0818,0.003 -0.16368,0.0262 -0.0786,0.0196 -0.13749,0.0655 -0.0589,0.0459 -0.0589,0.13094 0,0.0949 0.0982,0.15058 0.0982,0.0524 0.2586,0.0851 0.16039,0.0327 0.36663,0.0589 0.20622,0.0262 0.41899,0.0687 0.21606,0.0393 0.42228,0.11129 0.20623,0.0687 0.36663,0.18987 0.1604,0.12111 0.2586,0.30443 0.0982,0.18331 0.0982,0.45501 0,0.36335 -0.15058,0.60558 -0.14731,0.24224 -0.39937,0.38628 -0.25205,0.14402 -0.58594,0.20295 -0.33062,0.0589 -0.69397,0.0589 -0.3339,0 -0.66124,-0.0687 -0.32407,-0.0687 -0.58268,-0.21605 -0.2586,-0.15058 -0.419,-0.383 -0.1604,-0.23568 -0.1604,-0.5663 h 1.23737 v 0.0262 q 0.003,0.12766 0.0655,0.2095 0.0655,0.0786 0.15386,0.12439 0.0916,0.0426 0.18986,0.0589 0.10147,0.0163 0.17677,0.0163 0.0687,0 0.16367,-0.007 0.0982,-0.007 0.18331,-0.0294 0.0884,-0.0262 0.14731,-0.0786 0.0622,-0.0524 0.0622,-0.1473 0,-0.0982 -0.0982,-0.15713 -0.0982,-0.0589 -0.25861,-0.0949 -0.1604,-0.0393 -0.36662,-0.0687 -0.20623,-0.0295 -0.42228,-0.0753 -0.21278,-0.0459 -0.419,-0.11457 -0.20623,-0.072 -0.36663,-0.18986 -0.1604,-0.12112 -0.2586,-0.29789 -0.0982,-0.18004 -0.0982,-0.44191 0,-0.35026 0.14731,-0.5794 0.1473,-0.23242 0.39281,-0.36991 0.24551,-0.13748 0.56631,-0.19313 0.3208,-0.0589 0.67106,-0.0589 z m -3.04758,0.0818 h 0.75289 v 0.90348 h -0.75289 v 1.34866 q 0,0.11457 0.0163,0.19968 0.0163,0.0851 0.0589,0.14403 0.0426,0.0589 0.11458,0.0884 0.072,0.0294 0.18658,0.0294 h 0.37645 v 0.78563 q -0.0851,0.0262 -0.19641,0.0491 -0.11129,0.0229 -0.22914,0.0393 -0.11784,0.0163 -0.23241,0.0229 -0.1113,0.01 -0.19969,0.01 -0.27169,0 -0.49756,-0.0459 -0.22587,-0.0459 -0.38954,-0.15385 -0.1604,-0.1113 -0.25206,-0.29134 -0.0884,-0.18331 -0.0884,-0.45501 v -1.77093 h -0.49756 v -0.90348 h 0.54994 l 0.28807,-1.07369 h 0.99186 z m -4.21948,-0.0818 q 0.36334,0 0.69397,0.0589 0.33389,0.0557 0.58594,0.18986 0.25533,0.13421 0.40264,0.35681 0.15058,0.21932 0.15058,0.54666 v 1.3814 q 0,0.1113 0.0491,0.18658 0.0524,0.0753 0.16368,0.0753 h 0.24223 v 0.77253 q -0.0753,0.0393 -0.18004,0.0687 -0.0884,0.0262 -0.21932,0.0459 -0.13094,0.0196 -0.29788,0.0196 -0.40591,0 -0.65142,-0.12112 -0.24224,-0.12112 -0.33389,-0.32407 -0.1113,0.0884 -0.24224,0.17022 -0.13094,0.0786 -0.29134,0.14075 -0.1604,0.0622 -0.35353,0.0982 -0.18986,0.036 -0.42228,0.036 -0.27497,0 -0.50738,-0.0524 -0.22914,-0.0491 -0.39282,-0.16694 -0.16367,-0.11785 -0.25533,-0.3077 -0.0916,-0.18987 -0.0916,-0.46811 0,-0.39609 0.16367,-0.64159 0.16695,-0.24879 0.4812,-0.38628 0.31425,-0.13748 0.76926,-0.18331 0.45501,-0.0491 1.03441,-0.0491 v -0.17349 q 0,-0.10803 -0.0426,-0.18659 -0.0393,-0.0818 -0.10803,-0.13094 -0.0687,-0.0524 -0.16367,-0.0786 -0.0949,-0.0262 -0.20296,-0.0262 -0.0884,0 -0.18004,0.0163 -0.0884,0.0131 -0.16367,0.0491 -0.072,0.036 -0.11784,0.0949 -0.0458,0.0589 -0.0458,0.14731 v 0.0295 h -1.31594 q -0.007,-0.0262 -0.007,-0.0459 0,-0.0229 0,-0.0491 0,-0.24551 0.11784,-0.44519 0.11785,-0.20295 0.35026,-0.34698 0.23569,-0.14404 0.5794,-0.2226 0.34699,-0.0786 0.802,-0.0786 z m 0.49756,2.07864 q -0.29789,0 -0.51066,0.036 -0.2095,0.0327 -0.34371,0.0949 -0.13421,0.0589 -0.19641,0.14404 -0.0622,0.0818 -0.0622,0.18004 0,0.10474 0.0393,0.17022 0.0393,0.0655 0.10148,0.10147 0.0655,0.036 0.1473,0.0524 0.0818,0.0131 0.16694,0.0131 0.12767,0 0.24551,-0.036 0.12112,-0.036 0.21278,-0.10148 0.0917,-0.0655 0.14403,-0.15385 0.0557,-0.0917 0.0557,-0.19968 z m -4.89382,-2.07864 q 0.47793,0 0.84783,0.11129 0.37317,0.10803 0.6285,0.33717 0.25533,0.22587 0.38627,0.57613 0.13421,0.34699 0.13421,0.82491 v 0.22914 h -2.65477 q 0,0.36663 0.16367,0.56959 0.16695,0.19967 0.54667,0.19967 0.18004,0 0.30443,-0.0393 0.12439,-0.0393 0.19968,-0.10802 0.0786,-0.072 0.1113,-0.16368 0.036,-0.0949 0.036,-0.20295 h 1.29301 q 0,0.31752 -0.12111,0.57285 -0.11784,0.25206 -0.36008,0.42882 -0.23896,0.17677 -0.59904,0.2717 -0.35681,0.0949 -0.83474,0.0949 -0.47792,0 -0.86419,-0.10803 -0.38299,-0.11129 -0.65142,-0.34043 -0.26842,-0.22914 -0.41245,-0.57613 -0.14403,-0.35026 -0.14403,-0.82818 0,-0.46483 0.14076,-0.81182 0.14075,-0.34698 0.39936,-0.57613 0.26188,-0.23241 0.6285,-0.34699 0.3699,-0.11457 0.82164,-0.11457 z m 0.0524,0.8511 q -0.33716,0 -0.50411,0.16039 -0.16368,0.16041 -0.19968,0.43537 h 1.30283 q 0,-0.27824 -0.15712,-0.43537 -0.15713,-0.16039 -0.44192,-0.16039 z m -3.92816,-1.84296 q 0.26188,0 0.49102,0.0851 0.23242,0.0818 0.40591,0.23242 0.17349,0.15058 0.27497,0.36008 0.10147,0.20622 0.10147,0.45501 0,0.25205 -0.0622,0.43537 -0.0622,0.18004 -0.17022,0.3077 -0.10475,0.12766 -0.24551,0.20623 -0.13748,0.0786 -0.29461,0.12439 v 0.0262 q 0.18004,0.0393 0.33717,0.12112 0.16039,0.0818 0.27824,0.21932 0.12112,0.13749 0.18986,0.33717 0.072,0.19968 0.072,0.47465 0,0.27497 -0.10476,0.50411 -0.10475,0.22587 -0.28806,0.38627 -0.18004,0.16039 -0.42555,0.24878 -0.24224,0.0884 -0.52048,0.0884 h -3.10978 v -4.6123 z m -1.59089,2.7497 v 0.78891 h 1.12607 q 0.072,0 0.13421,-0.0262 0.0655,-0.0294 0.11129,-0.0753 0.0459,-0.0491 0.072,-0.11457 0.0262,-0.0655 0.0262,-0.14403 v -0.0687 q 0,-0.0753 -0.0262,-0.14076 -0.0262,-0.0655 -0.072,-0.11457 -0.0459,-0.0491 -0.11129,-0.0753 -0.0622,-0.0294 -0.13421,-0.0294 z m 0,-1.7382 v 0.78563 h 1.01804 q 0.072,0 0.13421,-0.0262 0.0655,-0.0294 0.1113,-0.0786 0.0458,-0.0491 0.072,-0.11457 0.0262,-0.0687 0.0262,-0.14403 v -0.0655 q 0,-0.072 -0.0295,-0.13749 -0.0262,-0.0655 -0.072,-0.11457 -0.0459,-0.0491 -0.10803,-0.0753 -0.0622,-0.0295 -0.13421,-0.0295 z"
inkscape:connector-curvature="0" />
</g>
</svg>
......@@ -24,10 +24,9 @@
using namespace BAE;
Babe::Babe(QObject *parent) : QObject(parent)
Babe::Babe(QObject *parent) : CollectionDB(parent)
{
qDebug()<<"CONSTRUCTING ABE INTERFACE";
this->con = new CollectionDB(this);
this->set = new BabeSettings(this);
......@@ -58,17 +57,17 @@ Babe::~Babe()
QVariantList Babe::get(const QString &queryTxt)
{
return this->con->getDBDataQML(queryTxt);
return getDBDataQML(queryTxt);
}
QVariantList Babe::getList(const QStringList &urls)
{
return Babe::transformData(this->con->getDBData(urls));
return Babe::transformData(getDBData(urls));
}
void Babe::trackLyrics(const QString &url)
{
auto track = this->con->getDBData(QString("SELECT * FROM %1 WHERE %2 = \"%3\"").arg(TABLEMAP[TABLE::TRACKS],
auto track = getDBData(QString("SELECT * FROM %1 WHERE %2 = \"%3\"").arg(TABLEMAP[TABLE::TRACKS],
KEYMAP[KEY::URL], url));
if(track.isEmpty()) return;
......@@ -78,7 +77,7 @@ void Babe::trackLyrics(const QString &url)
bool Babe::trackBabe(const QString &path)
{
auto babe = this->con->getDBData(QString("SELECT %1 FROM %2 WHERE %3 = \"%4\"").arg(KEYMAP[KEY::BABE],
auto babe = getDBData(QString("SELECT %1 FROM %2 WHERE %3 = \"%4\"").arg(KEYMAP[KEY::BABE],
TABLEMAP[TABLE::TRACKS],
KEYMAP[KEY::URL],path));
......@@ -90,7 +89,7 @@ bool Babe::trackBabe(const QString &path)
QString Babe::artistArt(const QString &artist)
{
auto artwork = this->con->getDBData(QString("SELECT %1 FROM %2 WHERE %3 = \"%4\"").arg(KEYMAP[KEY::ARTWORK],
auto artwork = getDBData(QString("SELECT %1 FROM %2 WHERE %3 = \"%4\"").arg(KEYMAP[KEY::ARTWORK],
TABLEMAP[TABLE::ARTISTS],
KEYMAP[KEY::ARTIST],artist));
......@@ -103,7 +102,7 @@ QString Babe::artistArt(const QString &artist)
QString Babe::artistWiki(const QString &artist)
{
auto wiki = this->con->getDBData(QString("SELECT %1 FROM %2 WHERE %3 = \"%4\"").arg(KEYMAP[KEY::WIKI],
auto wiki = getDBData(QString("SELECT %1 FROM %2 WHERE %3 = \"%4\"").arg(KEYMAP[KEY::WIKI],
TABLEMAP[TABLE::ARTISTS],
KEYMAP[KEY::ARTIST],artist));
......@@ -119,7 +118,7 @@ QString Babe::albumArt(const QString &album, const QString &artist)
TABLEMAP[TABLE::ALBUMS],
KEYMAP[KEY::ALBUM],album,
KEYMAP[KEY::ARTIST],artist);
auto albumCover = this->con->getDBData(queryStr);
auto albumCover = getDBData(queryStr);
if(!albumCover.isEmpty())
if(!albumCover.first()[KEY::ARTWORK].isEmpty() && albumCover.first()[KEY::ARTWORK] != SLANG[W::NONE])
......@@ -140,7 +139,7 @@ void Babe::fetchTrackLyrics(DB &song)
if(!res[PULPO::ONTOLOGY::TRACK][PULPO::INFO::LYRICS].isEmpty())
{
auto lyrics = res[PULPO::ONTOLOGY::TRACK][PULPO::INFO::LYRICS][PULPO::CONTEXT::LYRIC].toString();
this->con->lyricsTrack(track, lyrics);
lyricsTrack(track, lyrics);
song.insert(KEY::LYRICS, lyrics);
qDebug()<<"GOT LYRICS"<<lyrics;
emit this->trackLyricsReady(song[KEY::LYRICS], song[KEY::URL]);
......@@ -158,7 +157,7 @@ QString Babe::albumWiki(const QString &album, const QString &artist)
TABLEMAP[TABLE::ALBUMS],
KEYMAP[KEY::ALBUM],album,
KEYMAP[KEY::ARTIST],artist);
auto wiki = this->con->getDBData(queryStr);
auto wiki = getDBData(queryStr);
if(!wiki.isEmpty())
return wiki.first()[KEY::WIKI];
......@@ -168,7 +167,7 @@ QString Babe::albumWiki(const QString &album, const QString &artist)
bool Babe::babeTrack(const QString &path, const bool &value)
{
if(this->con->update(TABLEMAP[TABLE::TRACKS],
if(update(TABLEMAP[TABLE::TRACKS],
KEYMAP[KEY::BABE],
value ? 1 : 0,
KEYMAP[KEY::URL],
......@@ -177,38 +176,6 @@ bool Babe::babeTrack(const QString &path, const bool &value)
return false;
}
bool Babe::rateTrack(const QString &path, const int &value)
{
return this->con->rateTrack(path, value);
}
int Babe::trackRate(const QString &path)
{
return this->con->getTrackStars(path);
}
bool Babe::moodTrack(const QString &path, const QString &color)
{
qDebug()<<path<<color;
return this->con->artTrack(path, color);
}
bool Babe::addPlaylist(const QString &playlist)
{
qDebug()<<playlist;
return this->con->addPlaylist(playlist);
}
QStringList Babe::getPlaylists()
{
return this->con->getPlaylists();
}
bool Babe::removeTrack(const QString &url)
{
return this->con->removeTrack(url);
}
void Babe::notify(const QString &title, const QString &body)
{
......@@ -225,7 +192,7 @@ void Babe::notifySong(const QString &url)
{
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
auto query = QString("select t.*, al.artwork from tracks t inner join albums al on al.album = t.album and al.artist = t.artist where url = \"%1\"").arg(url);
auto track = this->con->getDBData(query);
auto track = getDBData(query);
Babe::nof->notifySong(track.first());
#else
Q_UNUSED(url);
......@@ -343,7 +310,7 @@ QString Babe::textColor()
#endif
}
QString Babe::hightlightColor()
QString Babe::highlightColor()
{
#if defined(Q_OS_ANDROID)
return "#58bcff";
......@@ -355,7 +322,7 @@ QString Babe::hightlightColor()
#endif
}
QString Babe::hightlightTextColor()
QString Babe::highlightTextColor()
{
#if defined(Q_OS_ANDROID)
return "#FFF";
......@@ -418,7 +385,19 @@ QString Babe::altColor()
QString Babe::babeColor()
{
return "#f84172";
// return "#E91E63";
// return "#E91E63";
}
QString Babe::babeAltColor()
{
#if defined(Q_OS_ANDROID)
return "#31363b";
#elif defined(Q_OS_LINUX)
QWidget widget;
return widget.palette().color(QPalette::Background).name();
#elif defined(Q_OS_WIN32)
return "#31363b";
#endif
}
void Babe::androidStatusBarColor(const QString &color)
......@@ -573,16 +552,10 @@ uint Babe::sizeHint(const uint &hint)
else return hint;
}
QString Babe::icon(const QString &icon, const int &size)
{
auto pix = QIcon::fromTheme(icon).pixmap(QSize(size, size), QIcon::Mode::Normal, QIcon::State::On);
return "";
}
QString Babe::loadCover(const QString &url)
{
auto map = this->con->getDBData(QStringList() << url);
auto map = getDBData(QStringList() << url);
if(map.isEmpty()) return "";
......@@ -620,9 +593,9 @@ QVariantList Babe::searchFor(const QStringList &queries)
searchQuery = searchQuery.trimmed();
if(!searchQuery.isEmpty())
{
mapList += this->con->getSearchedTracks(BAE::KEY::WIKI, searchQuery);
mapList += this->con->getSearchedTracks(BAE::KEY::TAG, searchQuery);
mapList += this->con->getSearchedTracks(BAE::KEY::LYRICS, searchQuery);
mapList += getSearchedTracks(BAE::KEY::WIKI, searchQuery);
mapList += getSearchedTracks(BAE::KEY::TAG, searchQuery);
mapList += getSearchedTracks(BAE::KEY::LYRICS, searchQuery);
}
}else if(searchQuery.contains((BAE::SearchTMap[BAE::SearchT::SIMILAR]+":")))
......@@ -630,7 +603,7 @@ QVariantList Babe::searchFor(const QStringList &queries)
searchQuery=searchQuery.replace(BAE::SearchTMap[BAE::SearchT::SIMILAR]+":","").trimmed();
searchQuery=searchQuery.trimmed();
if(!searchQuery.isEmpty())
mapList += this->con->getSearchedTracks(BAE::KEY::TAG, searchQuery);
mapList += getSearchedTracks(BAE::KEY::TAG, searchQuery);
}else
{
......@@ -653,11 +626,11 @@ QVariantList Babe::searchFor(const QStringList &queries)
if(!searchQuery.isEmpty())
{
if(hasKey)
mapList += this->con->getSearchedTracks(key, searchQuery);
mapList += getSearchedTracks(key, searchQuery);
else
{
auto queryTxt = QString("SELECT t.*, al.artwork FROM tracks t INNER JOIN albums al ON t.album = al.album AND t.artist = al.artist WHERE t.title LIKE \"%"+searchQuery+"%\" OR t.artist LIKE \"%"+searchQuery+"%\" OR t.album LIKE \"%"+searchQuery+"%\"OR t.genre LIKE \"%"+searchQuery+"%\"OR t.url LIKE \"%"+searchQuery+"%\" LIMIT 1000");
mapList += this->con->getDBDataQML(queryTxt);
mapList += getDBDataQML(queryTxt);
}
}
}
......
......@@ -4,7 +4,7 @@
#include <QObject>
#include <QVariantList>
#include "utils/bae.h"
#include "db/collectionDB.h"
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
class Notify;
......@@ -16,7 +16,7 @@ class BabeSettings;
using namespace BAE;
class Babe : public QObject
class Babe : public CollectionDB
{
Q_OBJECT
public:
......@@ -35,6 +35,7 @@ public:
Q_INVOKABLE QVariantList get(const QString &queryTxt);
Q_INVOKABLE QVariantList getList(const QStringList &urls);
Q_INVOKABLE void trackLyrics(const QString &url);
Q_INVOKABLE bool trackBabe(const QString &path);
Q_INVOKABLE QString artistArt(const QString &artist);
......@@ -43,16 +44,6 @@ public:
Q_INVOKABLE QString albumWiki(const QString &album, const QString &artist);
Q_INVOKABLE bool babeTrack(const QString &path, const bool &value);
Q_INVOKABLE bool rateTrack(const QString &path, const int &value);
Q_INVOKABLE int trackRate(const QString &path);
Q_INVOKABLE bool moodTrack(const QString &path, const QString &color);
Q_INVOKABLE bool addPlaylist(const QString &playlist);
Q_INVOKABLE QStringList getPlaylists();
Q_INVOKABLE bool removeTrack(const QString &url);
Q_INVOKABLE void notify(const QString &title, const QString &body);
Q_INVOKABLE void notifySong(const QString &url);
......@@ -81,15 +72,18 @@ public:
Q_INVOKABLE static QString backgroundColor();
Q_INVOKABLE static QString foregroundColor();
Q_INVOKABLE static QString textColor();
Q_INVOKABLE static QString hightlightColor();
Q_INVOKABLE static QString hightlightTextColor();
Q_INVOKABLE static QString highlightColor();
Q_INVOKABLE static QString highlightTextColor();
Q_INVOKABLE static QString midColor();
Q_INVOKABLE static QString midLightColor();
Q_INVOKABLE static QString shadowColor();
Q_INVOKABLE static QString altColor();
Q_INVOKABLE static QString babeColor();
Q_INVOKABLE static QString babeAltColor();
Q_INVOKABLE static void androidStatusBarColor(const QString &color);
/*UTILS*/
Q_INVOKABLE static bool isMobile();
Q_INVOKABLE static int screenGeometry(QString side);
Q_INVOKABLE static int cursorPos(QString axis);
......@@ -102,16 +96,15 @@ public:
Q_INVOKABLE static QVariantList getDirs(const QString &pathUrl);
Q_INVOKABLE static QVariantMap getParentDir(const QString &path);
static void registerTypes();
Q_INVOKABLE static uint sizeHint(const uint &hint);
Q_INVOKABLE static QString icon(const QString &icon, const int &size);
/*USEFUL*/
/*USEFUL*/
Q_INVOKABLE QString loadCover(const QString &url);
Q_INVOKABLE QVariantList searchFor(const QStringList &queries);
private:
CollectionDB *con;
BabeSettings *set;
#if (defined (Q_OS_LINUX) && !defined (Q_OS_ANDROID))
Notify *nof;
......
......@@ -315,14 +315,7 @@ bool CollectionDB::rateTrack(const QString &path, const int &value)
}
bool CollectionDB::moodTrack(const QString &path, const QString &value)
{
Q_UNUSED(path);
Q_UNUSED(value);
return false;
}
bool CollectionDB::artTrack(const QString &path, const QString &value)
bool CollectionDB::colorTagTrack(const QString &path, const QString &value)
{
if(update(TABLEMAP[TABLE::TRACKS],
KEYMAP[KEY::ART],
......@@ -723,7 +716,7 @@ DB_LIST CollectionDB::getMostPlayedTracks(const int &greaterThan, const int &lim
}
QString CollectionDB::getTrackArt(const QString &path)
QString CollectionDB::trackColorTag(const QString &path)
{
QString color;
auto query = this->getDBData(QString("SELECT %1 FROM %2 WHERE %3 = \"%4\"").arg(KEYMAP[KEY::ART],
......@@ -866,35 +859,35 @@ void CollectionDB::insertArtwork(const DB &track)
switch(albumType(track))
{
case TABLE::ALBUMS :
{
auto queryStr = QString("UPDATE %1 SET %2 = \"%3\" WHERE %4 = \"%5\" AND %6 = \"%7\"").arg(TABLEMAP[TABLE::ALBUMS],
KEYMAP[KEY::ARTWORK],
path.isEmpty() ? SLANG[W::NONE] : path,
KEYMAP[KEY::ALBUM],
album,
KEYMAP[KEY::ARTIST],
artist);
auto query = this->getQuery(queryStr);
if(!query.exec())qDebug()<<"COULDNT Artwork[cover] inerted into DB"<<artist<<album;
break;
case TABLE::ALBUMS :
{
auto queryStr = QString("UPDATE %1 SET %2 = \"%3\" WHERE %4 = \"%5\" AND %6 = \"%7\"").arg(TABLEMAP[TABLE::ALBUMS],
KEYMAP[KEY::ARTWORK],
path.isEmpty() ? SLANG[W::NONE] : path,
KEYMAP[KEY::ALBUM],
album,
KEYMAP[KEY::ARTIST],
artist);
auto query = this->getQuery(queryStr);
if(!query.exec())qDebug()<<"COULDNT Artwork[cover] inerted into DB"<<artist<<album;
break;
}
case TABLE::ARTISTS:
{
auto queryStr = QString("UPDATE %1 SET %2 = \"%3\" WHERE %4 = \"%5\"").arg(TABLEMAP[TABLE::ARTISTS],
KEYMAP[KEY::ARTWORK],
path.isEmpty() ? SLANG[W::NONE] : path,
KEYMAP[KEY::ARTIST],
artist);
auto query = this->getQuery(queryStr);
if(!query.exec())qDebug()<<"COULDNT Artwork[head] inerted into DB"<<artist;
}
case TABLE::ARTISTS:
{
auto queryStr = QString("UPDATE %1 SET %2 = \"%3\" WHERE %4 = \"%5\"").arg(TABLEMAP[TABLE::ARTISTS],
KEYMAP[KEY::ARTWORK],
path.isEmpty() ? SLANG[W::NONE] : path,
KEYMAP[KEY::ARTIST],
artist);
auto query = this->getQuery(queryStr);
if(!query.exec())qDebug()<<"COULDNT Artwork[head] inerted into DB"<<artist;
break;
break;
}
default: return;
}
default: return;
}
emit artworkInserted(track);
......
......@@ -46,9 +46,10 @@ public:
void addTrack(const BAE::DB &track);
bool updateTrack(const BAE::DB &track);
bool rateTrack(const QString &path, const int &value);
bool moodTrack(const QString &path, const QString &value);
bool artTrack(const QString &path, const QString &value);
Q_INVOKABLE bool rateTrack(const QString &path, const int &value);
Q_INVOKABLE bool colorTagTrack(const QString &path, const QString &value);
Q_INVOKABLE QString trackColorTag(const QString &path);
bool lyricsTrack(const BAE::DB &track, const QString &value);
bool playedTrack(const QString &url, const int &increment = 1);
......@@ -63,7 +64,7 @@ public:
bool wikiAlbum(const BAE::DB &track, QString value);
bool tagsAlbum(const BAE::DB &track, const QString &value, const QString &context = "");
bool addPlaylist(const QString &title);
Q_INVOKABLE bool addPlaylist(const QString &title);
bool trackPlaylist(const QString &url, const QString &playlist);
bool addFolder(const QString &url);
......@@ -83,9 +84,8 @@ public:
BAE::DB_LIST getOnlineTracks(const BAE::KEY &orderBy = BAE::KEY::ADD_DATE, const BAE::W &order = BAE::W::DESC);
QString getTrackArt(const QString &path);
QStringList getTrackTags(const QString &path);
int getTrackStars(const QString &path);
Q_INVOKABLE int getTrackStars(const QString &path);
// QStringList getArtistTags(const QString &artist);
// QStringList getAlbumTags(const QString &album, const QString &artist);
QStringList getArtistAlbums(const QString &artist);
......@@ -99,7 +99,7 @@ public:
bool removeAlbum(const QString &album, const QString &artist);
bool cleanAlbums();
bool removeSource(const QString &path);
bool removeTrack(const QString &path);
Q_INVOKABLE bool removeTrack(const QString &path);
QSqlQuery getQuery(const QString &queryTxt);
/*useful tools*/
sourceTypes sourceType(const QString &url);
......
......@@ -14,6 +14,7 @@ import "widgets/PlaylistsView"
import "widgets/MainPlaylist"
import "widgets/SettingsView"
import "view_models"
import "view_models/BabeDialog"
Kirigami.ApplicationWindow
{
......@@ -26,20 +27,55 @@ Kirigami.ApplicationWindow
title: qsTr("Babe")
wideScreen: root.width > coverSize
/*THEMING*/
property int toolBarIconSize: bae.loadSetting("ICON_SIZE", "BABE", isMobile ? 24 : 22)
property string babeColor : bae.babeColor()
property string babeAltColor : bae.babeAltColor()
property string backgroundColor : bae.backgroundColor()
property string foregroundColor : bae.foregroundColor()
property string textColor : bae.textColor()
property string babeHighlightColor : bae.highlightColor()
property string highlightTextColor : bae.highlightTextColor()
property string midColor : bae.midColor()
property string midLightColor : bae.midLightColor()
property string darkColor : bae.darkColor()
property string baseColor : bae.baseColor()
property string altColor : bae.altColor()
property string shadowColor : bae.shadowColor()
readonly property string lightBackgroundColor : "#eff0f1"
readonly property string lightForegroundColor : "#31363b"
readonly property string lightTextColor : "#31363b"
readonly property string lightBabeHighlightColor : "#3daee9"
readonly property string lightHighlightTextColor : "#eff0f1"
readonly property string lightMidColor : "#cacaca"
readonly property string lightMidLightColor : "#dfdfdf"
readonly property string lightDarkColor : "#7f8c8d"
readonly property string lightBaseColor : "#fcfcfc"
readonly property string lightAltColor : "#eeeeee"
readonly property string lightShadowColor : "#868686"
Material.theme: Material.Light
Material.accent: bae.babeColor()
Material.background: bae.backgroundColor()
Material.primary: bae.backgroundColor()
Material.foreground: bae.foregroundColor()
Material.accent: babeColor
Material.background: backgroundColor
Material.primary: backgroundColor
Material.foreground: foregroundColor
/*SIGNALS*/
signal missingAlert(var track)
/*READONLY PROPS*/
readonly property bool isMobile: bae.isMobile()
readonly property int wideSize : bae.screenGeometry("width")*0.5
property int toolBarIconSize: isMobile ? 24 : 22
readonly property int rowHeight: isMobile ? 64 : 52
readonly property int rowHeightAlt: isMobile ? 48 : 32
/*PROPS*/
property int columnWidth: Kirigami.Units.gridUnit * 20
property int coverSize: isMobile ? Math.sqrt(root.width*root.height)*0.4 : columnWidth * 0.65
property int currentView : 0
......@@ -73,20 +109,24 @@ Kirigami.ApplicationWindow
{
if(pageStack.currentIndex === 0 && isMobile && !pageStack.wideMode)
{
bae.androidStatusBarColor(bae.babeColor())
Material.background = bae.babeColor()
bae.androidStatusBarColor(babeColor)
Material.background = babeColor
}else
{
bae.androidStatusBarColor(bae.backgroundColor())
Material.background = bae.backgroundColor()
bae.androidStatusBarColor(babeAltColor)
Material.background = babeAltColor
}
}
Component.onCompleted:
{
if(isMobile) settingsDrawer.switchColorScheme(bae.loadSetting("THEME", "BABE", "Dark"))
}
BabeDialog
BabeMessage
{
id: missingDialog
width: isMobile ? parent.width *0.9 : parent.width*0.4
title: "Missing file"
onAccepted:
{
......@@ -130,7 +170,7 @@ Kirigami.ApplicationWindow
searchView.clearTable()
searchView.headerTitle = ""
searchView.searchRes = []
currentView = 0
// currentView = 0
}
Connections
......@@ -170,9 +210,8 @@ Kirigami.ApplicationWindow
{
id: mainToolbar
visible: true
size: toolBarIconSize
currentIndex: currentView
backgroundColor: pageStack.currentIndex === 0 && !pageStack.wideMode ? bae.babeColor() : bae.backgroundColor()
bgColor: pageStack.currentIndex === 0 && !pageStack.wideMode ? babeColor : babeAltColor
textColor: pageStack.currentIndex === 0 && !pageStack.wideMode ? "#FFF" : bae.foregroundColor()
onPlaylistViewClicked:
......@@ -185,8 +224,8 @@ Kirigami.ApplicationWindow
onTracksViewClicked:
{
if(!isMobile && !pageStack.wideMode)
root.width = wideSize
// if(!isMobile && !pageStack.wideMode)
// root.width = wideSize
pageStack.currentIndex = 1
currentView = 0
......@@ -194,8 +233,8 @@ Kirigami.ApplicationWindow
onAlbumsViewClicked:
{
if(!isMobile && !pageStack.wideMode)
root.width = wideSize
// if(!isMobile && !pageStack.wideMode)
// root.width = wideSize
pageStack.currentIndex = 1
currentView = 1
......@@ -203,8 +242,8 @@ Kirigami.ApplicationWindow
onArtistsViewClicked:
{
if(!isMobile && !pageStack.wideMode)
root.width = wideSize
// if(!isMobile && !pageStack.wideMode)
// root.width = wideSize
pageStack.currentIndex = 1
currentView = 2
......@@ -212,8 +251,8 @@ Kirigami.ApplicationWindow
onPlaylistsViewClicked:
{
if(!isMobile && !pageStack.wideMode)
root.width = wideSize
// if(!isMobile && !pageStack.wideMode)
// root.width = wideSize
pageStack.currentIndex = 1
currentView = 3
......@@ -221,8 +260,8 @@ Kirigami.ApplicationWindow
onBabeViewClicked:
{
if(!isMobile && !pageStack.wideMode)
root.width = wideSize
// if(!isMobile && !pageStack.wideMode)
// root.width = wideSize
pageStack.currentIndex = 1
currentView = 4
......@@ -234,7 +273,7 @@ Kirigami.ApplicationWindow
id: searchBox
width: parent.width
height: 48
color: searchInput.activeFocus ? bae.midColor() : bae.midLightColor()
color: searchInput.activeFocus ? midColor : midLightColor
Kirigami.Separator
{
Rectangle
......@@ -259,7 +298,7 @@ Kirigami.ApplicationWindow
{
id: searchBtn
Layout.fillHeight: true
iconColor: currentView === 5 ? bae.babeColor() : bae.foregroundColor()
iconColor: currentView === 5 ? babeColor : foregroundColor
// visible: !(searchInput.focus || searchInput.text)
iconName: "edit-find" //"search"
onClicked:
......@@ -284,14 +323,14 @@ Kirigami.ApplicationWindow
TextInput
{
id: searchInput
color: bae.foregroundColor()
color: foregroundColor
anchors.fill: parent
anchors.centerIn: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
selectByMouse: !root.isMobile
selectionColor: bae.hightlightColor()
selectedTextColor: bae.foregroundColor()
selectionColor: babeHighlightColor
selectedTextColor: foregroundColor
property string placeholderText: "Search..."
onAccepted: runSearch()
......@@ -312,7 +351,7 @@ Kirigami.ApplicationWindow
Layout.fillHeight: true
iconName: "games-config-options"
iconColor: settingsDrawer.visible ? bae.babeColor() : bae.foregroundColor()
iconColor: settingsDrawer.visible ? babeColor : foregroundColor
onClicked: settingsDrawer.visible ? settingsDrawer.close() : settingsDrawer.open()
}
......@@ -322,7 +361,7 @@ Kirigami.ApplicationWindow
background: Rectangle
{
anchors.fill: parent
color: bae.altColor()
color