show media title
This commit is contained in:
parent
2ddeee2d73
commit
beba95ccef
3 changed files with 30 additions and 0 deletions
|
|
@ -38,6 +38,8 @@ void MusicModel::init(NavigationItemModel *item)
|
|||
mMedia->addMedia(new VlcMedia(dir.filePath(file), true, mVlc));
|
||||
}
|
||||
}
|
||||
|
||||
setMediaTitle(mMedia->at(0));
|
||||
}
|
||||
|
||||
void MusicModel::navigateBack()
|
||||
|
|
@ -115,6 +117,11 @@ double MusicModel::getProgress() const
|
|||
return mCurrentMediaItemProgress;
|
||||
}
|
||||
|
||||
QString MusicModel::getMediaTitle() const
|
||||
{
|
||||
return mMediaTitle;
|
||||
}
|
||||
|
||||
QString MusicModel::getMediaLength()
|
||||
{
|
||||
return timeToString(mCurrentMediaItemLength);
|
||||
|
|
@ -127,6 +134,8 @@ QString MusicModel::getTime()
|
|||
|
||||
void MusicModel::onNextMediaSet(VlcMedia *media)
|
||||
{
|
||||
setMediaTitle(media);
|
||||
|
||||
mHasNext = true;
|
||||
mHasPrevious = true;
|
||||
if(mMedia->at(0) == media){
|
||||
|
|
@ -175,3 +184,11 @@ QString MusicModel::timeToString(int time)
|
|||
QString secStr = sec < 10 ? "0"+QString::number(sec) : QString::number(sec);
|
||||
return QString::number(min) + ":" + secStr;
|
||||
}
|
||||
|
||||
void MusicModel::setMediaTitle(VlcMedia *media)
|
||||
{
|
||||
auto list = media->currentLocation().split("/");
|
||||
auto title = list.at(list.count() -1 );
|
||||
mMediaTitle = title.left(title.lastIndexOf("."));
|
||||
emit mediaTitleChanged();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue