#include "networkaccess.h"
#include "videowidget.h"
#include "minisplitter.h"
+#include "flickcharm.h"
namespace The {
QMap<QString, QAction*>* globalActions();
listView->setFrameShape( QFrame::NoFrame );
listView->setAttribute(Qt::WA_MacShowFocusRect, false);
listView->setMinimumSize(320,240);
+ listView->setUniformItemSizes(true);
// respond to the user doubleclicking a playlist item
connect(listView, SIGNAL(activated(const QModelIndex &)), this, SLOT(itemActivated(const QModelIndex &)));
workaroundTimer->setInterval(3000);
connect(workaroundTimer, SIGNAL(timeout()), SLOT(timerPlay()));
+ FlickCharm *flickCharm = new FlickCharm(this);
+ flickCharm->activateOn(listView);
+
}
MediaView::~MediaView() {
void MediaView::search(SearchParams *searchParams) {
reallyStopped = false;
+ videoAreaWidget->clear();
+ workaroundTimer->stop();
+ errorTimer->stop();
+
this->searchParams = searchParams;
// start serching for videos
listView->setFocus();
- loadingWidget->clear();
}
void MediaView::disappear() {
listModel->abortSearch();
reallyStopped = true;
mediaObject->stop();
+ videoAreaWidget->clear();
workaroundTimer->stop();
errorTimer->stop();
+ listView->selectionModel()->clearSelection();
+
+ // turn off HD indicator
+ bool ret = QMetaObject::invokeMethod(parent()->parent(), "hdIndicator", Qt::DirectConnection, Q_ARG(bool, false));
+ if (!ret) qDebug() << "hdIndicator invokeMethod failed";
+ QAction *hdAct = The::globalActions()->value("hd");
+ hdAct->setToolTip("");
}
void MediaView::activeRowChanged(int row) {
}
void MediaView::currentSourceChanged(const Phonon::MediaSource source) {
- qDebug() << source.url().toString();
+ qDebug() << "Playing" << source.url().toString();
}
void MediaView::timerPlay() {
// Workaround Phonon bug on Mac OSX
- qDebug() << mediaObject->currentTime();
+ // qDebug() << mediaObject->currentTime();
if (mediaObject->currentTime() <= 0 && mediaObject->state() == Phonon::PlayingState) {
// qDebug() << "Mac playback workaround";
mediaObject->pause();
- QTimer::singleShot(1000, mediaObject, SLOT(play()));
- // mediaObject->play();
+ // QTimer::singleShot(1000, mediaObject, SLOT(play()));
+ mediaObject->play();
}
}
messageLabel->clear();
}
+void VideoAreaWidget::clear() {
+ stackedLayout->setCurrentWidget(loadingWidget);
+ loadingWidget->clear();
+ messageLabel->hide();
+ messageLabel->clear();
+}
+
void VideoAreaWidget::mouseDoubleClickEvent(QMouseEvent *event) {
if (event->button() == Qt::LeftButton)
emit doubleClicked();
}
void VideoAreaWidget::dragEnterEvent(QDragEnterEvent *event) {
- qDebug() << event->mimeData()->formats();
+ // qDebug() << event->mimeData()->formats();
if (event->mimeData()->hasFormat("application/x-minitube-video")) {
event->acceptProposedAction();
}
if(!videoMimeData ) return;
QList<Video*> droppedVideos = videoMimeData->videos();
- foreach( Video *video, droppedVideos) {
- int row = listModel->rowForVideo(video);
- if (row != -1)
- listModel->setActiveRow(row);
- }
+ if (droppedVideos.isEmpty())
+ return;
+ Video *video = droppedVideos.first();
+ int row = listModel->rowForVideo(video);
+ if (row != -1)
+ listModel->setActiveRow(row);
event->acceptProposedAction();
}