Added to identify for Channel Files if its a media file(s) or not, to change the Play Button text from "Play" to "Open"

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@5781 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2012-11-06 16:25:20 +00:00
parent 4009ff47cb
commit 07d8db4505
3 changed files with 14 additions and 1 deletions

View File

@ -21,6 +21,7 @@
#include <QDateTime>
#include <QTimer>
#include <QFileInfo>
#include "rshare.h"
#include "ChanMsgItem.h"
@ -209,7 +210,12 @@ void ChanMsgItem::updateItemStatic()
/* add file */
SubFileItem *fi = new SubFileItem(it->hash, it->fname, it->path, it->size,
SFI_STATE_REMOTE | SFI_TYPE_CHANNEL, "");
mFileItems.push_back(fi);
mFileItems.push_back(fi);
/* check if the file is a media file */
if (!misc::isPreviewable(QFileInfo(QString::fromUtf8(it->fname.c_str())).suffix()))
fi->mediatype();
QLayout *layout = expandFrame->layout();
layout->addWidget(fi);

View File

@ -686,3 +686,9 @@ bool SubFileItem::isPlayable(bool &startable)
return visible;
}
void SubFileItem::mediatype()
{
/* check if the file is not a media file and change text */
playButton->setText(tr("Open"));
playButton->setToolTip(tr("Open File"));
}

View File

@ -76,6 +76,7 @@ public:
public slots:
void download();
void play();
void mediatype();
private slots:
void toggle();