connect(action, SIGNAL(triggered()), mediaView, SLOT(downloadVideo()));
actions->insert("download", action);
+ /*
+ action = new QAction(tr("&Snapshot"), this);
+ action->setShortcut(QKeySequence(Qt::CTRL + Qt::ALT + Qt::Key_S));
+ actions->insert("snapshot", action);
+ connect(action, SIGNAL(triggered()), mediaView, SLOT(snapshot()));
+ */
+
QString shareTip = tr("Share the current video using %1");
action = new QAction("&Twitter", this);
videoMenu->addAction(findVideoPartsAct);
videoMenu->addSeparator();
videoMenu->addAction(webPageAct);
-#ifndef APP_NO_DOWNLOADS
videoMenu->addSeparator();
+#ifndef APP_NO_DOWNLOADS
videoMenu->addAction(The::globalActions()->value("download"));
- videoMenu->addAction(copyLinkAct);
+ // videoMenu->addAction(copyLinkAct);
#endif
+ // videoMenu->addAction(The::globalActions()->value("snapshot"));
QMenu* viewMenu = menuBar()->addMenu(tr("&View"));
menus->insert("view", viewMenu);
videoAreaWidget = new VideoAreaWidget(this);
// videoAreaWidget->setMinimumSize(320,240);
-#ifdef APP_MAC
+#ifdef APP_MAC_NO
// mouse autohide does not work on the Mac (no mouseMoveEvent)
videoWidget = new Phonon::VideoWidget(this);
#else
if (mainWindow) mainWindow->statusBar()->showMessage(message);
}
+void MediaView::snapshot() {
+ QImage image = videoWidget->snapshot();
+ qDebug() << image.size();
+
+ const QPixmap& pixmap = QPixmap::grabWindow(videoWidget->winId());
+ // qDebug() << pixmap.size();
+ videoAreaWidget->showSnapshotPreview(pixmap);
+}
+
void MediaView::fullscreen() {
videoAreaWidget->setParent(0);
videoAreaWidget->showFullScreen();
void setPlaylistVisible(bool visible=true);
void saveSplitterState();
void downloadVideo();
+ void snapshot();
void fullscreen();
void findVideoParts();
#include "videoareawidget.h"
#include "videomimedata.h"
+#ifndef Q_WS_X11
+#include "extra.h"
+#endif
VideoAreaWidget::VideoAreaWidget(QWidget *parent) : QWidget(parent) {
QBoxLayout *vLayout = new QVBoxLayout(this);
stackedLayout = new QStackedLayout();
vLayout->addLayout(stackedLayout);
+
+ snapshotPreview = new QLabel(this);
+ stackedLayout->addWidget(snapshotPreview);
setLayout(vLayout);
setAcceptDrops(true);
messageLabel->clear();
}
+void VideoAreaWidget::showSnapshotPreview(QPixmap pixmap) {
+ snapshotPreview->setPixmap(pixmap);
+ stackedLayout->setCurrentWidget(snapshotPreview);
+#ifndef Q_WS_X11
+ Extra::flashInWidget(snapshotPreview);
+#endif
+ QTimer::singleShot(1500, this, SLOT(hideSnapshotPreview()));
+}
+
+void VideoAreaWidget::hideSnapshotPreview() {
+ stackedLayout->setCurrentWidget(videoWidget);
+}
+
void VideoAreaWidget::clear() {
stackedLayout->setCurrentWidget(loadingWidget);
loadingWidget->clear();
messageLabel->hide();
messageLabel->clear();
+ snapshotPreview->clear();
}
void VideoAreaWidget::mouseDoubleClickEvent(QMouseEvent *event) {
void setListModel(ListModel *listModel) {
this->listModel = listModel;
}
+ void showSnapshotPreview(QPixmap pixmap);
signals:
void doubleClicked();
void mouseMoveEvent(QMouseEvent *event);
void leaveEvent(QMouseEvent *event);
+private slots:
+ void hideSnapshotPreview();
+
private:
QStackedLayout *stackedLayout;
QWidget *videoWidget;
LoadingWidget *loadingWidget;
ListModel *listModel;
QLabel *messageLabel;
+ QLabel *snapshotPreview;
};
}
void VideoWidget::mouseMoveEvent(QMouseEvent *event) {
- Phonon::VideoWidget::mouseMoveEvent(event);
+ QWidget::mouseMoveEvent(event);
// qDebug() << "VideoWidget::mouseMoveEvent" << event->pos();