mirror of
https://invent.kde.org/system/dolphin
synced 2024-09-17 15:31:20 +00:00
Initial import of Matthias's draft patch for adding video and audio previewing (similar to the file dialog) to Dolphin's metadata panel. Since Phonon is currently in-process only with the memory/ stability issues that come with this, this might have to be disabled by default - we'll see how it goes. Thanks, Matthias!
CCMAIL:kretz@kde.org CCMAIL:peter.penz@gmx.at svn path=/trunk/KDE/kdebase/apps/; revision=917389
This commit is contained in:
parent
68b3e86fdf
commit
9d3ed99ab0
|
@ -106,6 +106,7 @@ set(dolphin_SRCS
|
|||
panels/information/informationpanel.cpp
|
||||
panels/information/metadatawidget.cpp
|
||||
panels/information/metatextlabel.cpp
|
||||
panels/information/phononwidget.cpp
|
||||
panels/folders/ktreeview.cpp
|
||||
panels/places/placespanel.cpp
|
||||
panels/panel.cpp
|
||||
|
@ -165,7 +166,7 @@ kde4_add_app_icon(dolphin_SRCS "${KDE4_ICON_INSTALL_DIR}/oxygen/*/apps/system-fi
|
|||
|
||||
kde4_add_executable(dolphin ${dolphin_SRCS})
|
||||
|
||||
target_link_libraries(dolphin ${KDE4_KIO_LIBS} ${KDE4_KDEPRINT_LIBS} ${KDE4_KFILE_LIBS} konq dolphinprivate)
|
||||
target_link_libraries(dolphin ${KDE4_KIO_LIBS} ${KDE4_KDEPRINT_LIBS} ${KDE4_KFILE_LIBS} konq dolphinprivate ${KDE4_PHONON_LIBS})
|
||||
|
||||
if (Nepomuk_FOUND)
|
||||
target_link_libraries(dolphin ${NEPOMUK_LIBRARIES} ${SOPRANO_LIBRARIES})
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
#include <kiconloader.h>
|
||||
|
||||
#include <QEvent>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <QInputDialog>
|
||||
#include <QLabel>
|
||||
#include <QPainter>
|
||||
|
@ -47,8 +48,12 @@
|
|||
|
||||
#include "settings/dolphinsettings.h"
|
||||
#include "metadatawidget.h"
|
||||
#include "phononwidget.h"
|
||||
#include "metatextlabel.h"
|
||||
#include "pixmapviewer.h"
|
||||
#include <Phonon/BackendCapabilities>
|
||||
#include <Phonon/MediaObject>
|
||||
#include <Phonon/SeekSlider>
|
||||
|
||||
InformationPanel::InformationPanel(QWidget* parent) :
|
||||
Panel(parent),
|
||||
|
@ -60,6 +65,8 @@ InformationPanel::InformationPanel(QWidget* parent) :
|
|||
m_urlCandidate(),
|
||||
m_fileItem(),
|
||||
m_selection(),
|
||||
m_infoLabel(0),
|
||||
m_phononWidget(0),
|
||||
m_nameLabel(0),
|
||||
m_preview(0),
|
||||
m_metaDataWidget(0),
|
||||
|
@ -354,6 +361,9 @@ void InformationPanel::cancelRequest()
|
|||
|
||||
void InformationPanel::showMetaInfo()
|
||||
{
|
||||
delete m_phononWidget;
|
||||
m_phononWidget = 0;
|
||||
|
||||
m_metaTextLabel->clear();
|
||||
|
||||
if (showMultipleSelectionInfo()) {
|
||||
|
@ -413,6 +423,16 @@ void InformationPanel::showMetaInfo()
|
|||
if (m_metaDataWidget != 0) {
|
||||
m_metaDataWidget->setFile(item.targetUrl());
|
||||
}
|
||||
|
||||
if (Phonon::BackendCapabilities::isMimeTypeAvailable(item.mimetype())) {
|
||||
PhononWidget *p = new PhononWidget(this);
|
||||
p->setUrl(item.url());
|
||||
m_phononWidget = p;
|
||||
|
||||
QVBoxLayout *l = qobject_cast<QVBoxLayout *>(layout());
|
||||
Q_ASSERT(l);
|
||||
l->insertWidget(3, m_phononWidget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -185,6 +185,9 @@ private:
|
|||
KFileItem m_fileItem; // file item for m_shownUrl if available (otherwise null)
|
||||
KFileItemList m_selection;
|
||||
|
||||
QLabel* m_infoLabel;
|
||||
QWidget* m_phononWidget;
|
||||
|
||||
QLabel* m_nameLabel;
|
||||
PixmapViewer* m_preview;
|
||||
MetaDataWidget* m_metaDataWidget;
|
||||
|
|
85
src/panels/information/phononwidget.cpp
Normal file
85
src/panels/information/phononwidget.cpp
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "phononwidget.h"
|
||||
|
||||
#include <Phonon/Global>
|
||||
#include <Phonon/MediaObject>
|
||||
#include <Phonon/SeekSlider>
|
||||
#include <QtGui/QHBoxLayout>
|
||||
#include <QtGui/QToolButton>
|
||||
#include <kicon.h>
|
||||
#include <kurl.h>
|
||||
#include <klocale.h>
|
||||
|
||||
PhononWidget::PhononWidget(QWidget *parent)
|
||||
: QWidget(parent),
|
||||
m_media(0)
|
||||
{
|
||||
QHBoxLayout *innerLayout = new QHBoxLayout(this);
|
||||
innerLayout->setMargin(0);
|
||||
innerLayout->setSpacing(0);
|
||||
m_playButton = new QToolButton(this);
|
||||
m_stopButton = new QToolButton(this);
|
||||
m_seekSlider = new Phonon::SeekSlider(this);
|
||||
innerLayout->addWidget(m_playButton);
|
||||
innerLayout->addWidget(m_stopButton);
|
||||
innerLayout->addWidget(m_seekSlider);
|
||||
|
||||
m_playButton->setToolTip(i18n("play"));
|
||||
m_playButton->setIconSize(QSize(16, 16));
|
||||
m_playButton->setIcon(KIcon("media-playback-start"));
|
||||
m_stopButton->setToolTip(i18n("stop"));
|
||||
m_stopButton->setIconSize(QSize(16, 16));
|
||||
m_stopButton->setIcon(KIcon("media-playback-stop"));
|
||||
m_stopButton->hide();
|
||||
m_seekSlider->setIconVisible(false);
|
||||
}
|
||||
|
||||
void PhononWidget::setUrl(const KUrl &url)
|
||||
{
|
||||
if (m_media) {
|
||||
m_media->setCurrentSource(url);
|
||||
} else {
|
||||
m_media = Phonon::createPlayer(Phonon::MusicCategory, url);
|
||||
m_media->setParent(this);
|
||||
connect(m_playButton, SIGNAL(clicked()), m_media, SLOT(play()));
|
||||
connect(m_stopButton, SIGNAL(clicked()), m_media, SLOT(stop()));
|
||||
connect(m_media, SIGNAL(stateChanged(Phonon::State, Phonon::State)), SLOT(stateChanged(Phonon::State)));
|
||||
m_seekSlider->setMediaObject(m_media);
|
||||
}
|
||||
}
|
||||
|
||||
void PhononWidget::stateChanged(Phonon::State newstate)
|
||||
{
|
||||
setUpdatesEnabled(false);
|
||||
switch (newstate) {
|
||||
case Phonon::PlayingState:
|
||||
case Phonon::BufferingState:
|
||||
m_stopButton->show();
|
||||
m_playButton->hide();
|
||||
break;
|
||||
default:
|
||||
m_stopButton->hide();
|
||||
m_playButton->show();
|
||||
break;
|
||||
}
|
||||
setUpdatesEnabled(true);
|
||||
}
|
54
src/panels/information/phononwidget.h
Normal file
54
src/panels/information/phononwidget.h
Normal file
|
@ -0,0 +1,54 @@
|
|||
/* This file is part of the KDE project
|
||||
Copyright (C) 2007 Matthias Kretz <kretz@kde.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License as
|
||||
published by the Free Software Foundation; either version 2 of
|
||||
the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
||||
02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef PHONONWIDGET_H
|
||||
#define PHONONWIDGET_H
|
||||
|
||||
#include <QtGui/QWidget>
|
||||
|
||||
#include <Phonon/Global>
|
||||
|
||||
namespace Phonon
|
||||
{
|
||||
class MediaObject;
|
||||
class SeekSlider;
|
||||
} // namespace Phonon
|
||||
|
||||
class QToolButton;
|
||||
class KUrl;
|
||||
|
||||
class PhononWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
PhononWidget(QWidget *parent = 0);
|
||||
void setUrl(const KUrl &url);
|
||||
|
||||
private slots:
|
||||
void stateChanged(Phonon::State);
|
||||
|
||||
private:
|
||||
QToolButton *m_playButton;
|
||||
QToolButton *m_stopButton;
|
||||
Phonon::MediaObject *m_media;
|
||||
Phonon::SeekSlider *m_seekSlider;
|
||||
};
|
||||
|
||||
#endif // PHONONWIDGET_H
|
Loading…
Reference in a new issue