48 lines
770 B
C++
48 lines
770 B
C++
#include "MusicModel.h"
|
|
|
|
MusicModel::MusicModel(VlcInstance* instance, QObject *parent) : QObject(parent),
|
|
mVlc(instance)
|
|
{
|
|
|
|
}
|
|
|
|
MusicModel::~MusicModel()
|
|
{
|
|
if(mMedia)
|
|
mMedia->deleteLater();
|
|
}
|
|
|
|
void MusicModel::init(NavigationItemModel *item)
|
|
{
|
|
mCurrentItem = item;
|
|
emit currentItemChanged();
|
|
|
|
if(mMedia)
|
|
delete mMedia;
|
|
mMedia = new VlcMedia(mCurrentItem->getPath()+"/Pink Panther.mp3", true, mVlc);
|
|
}
|
|
|
|
void MusicModel::navigateBack()
|
|
{
|
|
emit navigateTo(mCurrentItem);
|
|
}
|
|
|
|
void MusicModel::playPause()
|
|
{
|
|
mIsPlaying = !mIsPlaying;
|
|
}
|
|
|
|
NavigationItemModel *MusicModel::getCurrentItem()
|
|
{
|
|
return mCurrentItem;
|
|
}
|
|
|
|
VlcMedia *MusicModel::getMedia()
|
|
{
|
|
return mMedia;
|
|
}
|
|
|
|
bool MusicModel::isPlaying()
|
|
{
|
|
return mIsPlaying;
|
|
}
|