Commit 8b6a7160 authored by Camilo Higuita's avatar Camilo Higuita

fixes and clean up debugging messages

parent 3ccff1b2
......@@ -34,11 +34,13 @@ ApplicationWindow
property var currentTrack
property string currentArtwork
// minimumWidth: columnWidth
// pageStack.defaultColumnWidth: columnWidth
// pageStack.initialPage: [playlistPage, views]
function play(track)
{
Player.playTrack(track)
......@@ -54,7 +56,6 @@ ApplicationWindow
babeBtnIcon.text = MdiFont.Icon.heartOutline
babeBtnIcon.color = myPalette.dark
}
}
function pause()
......@@ -77,12 +78,16 @@ ApplicationWindow
if(empty === 0 && mainPlaylistTable.count>0)
{
mainPlaylistTable.currentIndex = 0
play(mainPlaylistTable.model.get(0))
}
}
onClosing: Player.savePlaylist()
onClosing:
{
Player.savePlaylist()
Player.savePlaylistPos()
}
Connections
{
......@@ -96,12 +101,8 @@ ApplicationWindow
target: set
onRefreshTables:
{
console.log(JSON.stringify(tables))
tracksView.clearTable()
albumsView.clearGrid()
artistsView.clearGrid()
tracksView.populate()
......@@ -125,14 +126,12 @@ ApplicationWindow
onSettingsViewClicked: currentView = 5
}
Page
{
id: views
width: parent.width
height: parent.height
// clip: true
clip: true
Column
{
......@@ -208,10 +207,7 @@ ApplicationWindow
visible: mainPlaylistTable.count>0
spacing: 0
onMoved:
{
player.seek(player.duration() / 1000 * value);
}
onMoved: player.seek(player.duration() / 1000 * value);
}
Rectangle
......@@ -305,28 +301,28 @@ ApplicationWindow
id: mainPlaylistTable
width: parent.width
height: parent.height
onRowClicked:
{
play(model.get(index))
}
onRowClicked: play(model.get(index))
holder.message: "Empty playlist..."
Component.onCompleted:
{
var list = util.lastPlaylist()
for(var i in list)
var n = list.length
for(var i = 0; i < n; i++)
{
var track = con.get("select * from tracks where url = \""+list[i]+"\"")
appendTrack(track[0])
}
// var pos = util.lastPlaylistPos()
// console.log("POSSS:", pos)
// mainPlaylistTable.currentIndex = pos
// play(mainPlaylistTable.model.get(pos))
}
}
}
}
}
TracksView
{
id: tracksView
......@@ -342,8 +338,13 @@ ApplicationWindow
mainPlaylistTable.clearTable()
for(var i in tracks)
appendTrack(tracks[i])
mainPlaylistTable.currentIndex = 0
play(mainPlaylistTable.model.get(0))
currentView = 0
}
onAppendAlbum:
{
for(var i in tracks)
......@@ -361,8 +362,13 @@ ApplicationWindow
mainPlaylistTable.clearTable()
for(var i in tracks)
appendTrack(tracks[i])
mainPlaylistTable.currentIndex = 0
play(mainPlaylistTable.model.get(0))
currentView = 0
}
onAppendAlbum:
{
for(var i in tracks)
......@@ -413,7 +419,5 @@ ApplicationWindow
}
}
}
}
}
......@@ -29,18 +29,7 @@ TagInfo::~TagInfo(){};
void TagInfo::feed(const QString &url)
{
this->path = url;
this->file = TagLib::FileRef(path.toUtf8());
qDebug()<<"READABLE"<<QFileInfo(path).isReadable();
qDebug()<<"IS FILE"<<QFileInfo(path).isFile();
qDebug()<<"WRITABLE"<<QFileInfo(path).isWritable();
qDebug()<<"BASENAME"<<QFileInfo(path).baseName();
qDebug()<<"READLINK"<<QFileInfo(path).readLink();
qDebug()<<"SUFIX"<<QFileInfo(path).suffix();
qDebug()<<"GROUP"<<QFileInfo(path).group();
qDebug()<<"TAG"<<QString::fromStdWString(file.tag()->artist().toWString());
qDebug()<<"FF<<"<<path;
this->file = TagLib::FileRef(path.toUtf8());
}
QString TagInfo::getAlbum() const
......
......@@ -66,10 +66,10 @@ public slots:
} else if (QFileInfo(path).isFile()) urls<<path;
emit collectionSize(urls.size());
if(urls.size()>0)
{
int newTracks = 0;
for(auto url : urls)
{
if(go)
......@@ -101,14 +101,15 @@ public slots:
};
this->con->addTrack(trackMap);
newTracks++;
// emit trackReady(trackMap);
// while(this->wait){t.msleep(100);}
// this->wait=!this->wait;
}
}else break;
}
emit collectionSize(newTracks);
}
this->t.msleep(100);
......
......@@ -76,10 +76,10 @@ settings::settings(QObject *parent) : QObject(parent)
connect(this->fileLoader, &FileLoader::collectionSize, [this](int size)
{
if(size>0)
this->brainzOn = true;
else
{
}else
{
this->brainzOn = false;
this->dirs.clear();
this->collectionWatcher();
this->watcher->removePaths(watcher->directories());
......@@ -205,7 +205,8 @@ void settings::checkCollection()
void settings::startBrainz()
{
this->brainDeamon->start();
if(this->brainzOn)
this->brainDeamon->start();
}
void settings::populateDB(const QString &path)
......
......@@ -49,6 +49,8 @@ private:
YouTube *ytFetch;
Socket *babeSocket;
bool brainzOn = false;
const QString notifyDir = BAE::NotifyDir;
QString pathToRemove;
......
......@@ -664,7 +664,6 @@ MP4::Tag::title() const
String
MP4::Tag::artist() const
{
debug("trying to get artist name");
if(d->items.contains("\251ART"))
return d->items["\251ART"].toStringList().toString(", ");
return String::null;
......
......@@ -37,9 +37,14 @@ function savePlaylist()
var list = []
var n = mainPlaylistTable.count
for(var i=0 ; i<n; i++)
{
{
var url = mainPlaylistTable.model.get(i).url
list.push(url)
}
util.savePlaylist(list)
}
function savePlaylistPos()
{
util.savePlaylistPos(mainPlaylistTable.currentIndex)
}
......@@ -14,5 +14,16 @@ void Utils::savePlaylist(const QStringList &list)
QStringList Utils::lastPlaylist()
{
return BAE::loadSettings("PLAYLIST","MAINWINDOW",{}).toStringList();
}
void Utils::savePlaylistPos(const int &pos)
{
BAE::saveSettings("PLAYLIST_POS", pos, "MAINWINDOW");
}
int Utils::lastPlaylistPos()
{
return BAE::loadSettings("PLAYLIST_POS","MAINWINDOW",QVariant(0)).toInt();
}
......@@ -10,9 +10,11 @@ public:
explicit Utils(QObject *parent = nullptr);
Q_INVOKABLE static void savePlaylist(const QStringList &list);
Q_INVOKABLE static QStringList lastPlaylist();
signals:
public slots:
Q_INVOKABLE static void savePlaylistPos(const int &pos);
Q_INVOKABLE static int lastPlaylistPos();
};
#endif // UTILS_H
......@@ -8,7 +8,7 @@ ListView
property int currentRow : -1
property bool trackNumberVisible
property alias holder : holder
signal rowClicked(int index)
signal rowPressed(int index)
......@@ -33,11 +33,11 @@ ListView
listModel.clear()
}
BabeHolder
{
visible: list.count === 0
}
BabeHolder
{
id: holder
visible: list.count === 0
}
Component
{
......@@ -50,14 +50,14 @@ ListView
color: myPalette.highlight
opacity: 0.2
y: list.currentItem.y
Behavior on y
{
SpringAnimation
{
spring: 3
damping: 0.2
}
}
// Behavior on y
// {
// SpringAnimation
// {
// spring: 3
// damping: 0.2
// }
// }
}
}
......
......@@ -10,7 +10,7 @@ ToolBar
property alias babeBar : babeBar
property string accentColor : "#E91E63"
property string textColor : "#ffffff"
property string backgroundColor : "#31363b"
property string backgroundColor : "#31363b"
property int size
property int currentIndex : 0
......@@ -44,7 +44,6 @@ ToolBar
text: MdiFont.Icon.play
color: currentIndex === 0? accentColor : textColor
iconSize: size
}
onClicked: playlistViewClicked()
......@@ -59,7 +58,6 @@ ToolBar
Row
{
anchors.centerIn: parent
ToolButton
{
id: tracksView
......
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