|
|
|
@ -34,6 +34,7 @@
|
|
|
|
|
#include <tdeparts/genericfactory.h>
|
|
|
|
|
#include <tdeglobalsettings.h>
|
|
|
|
|
#include <tdeio/netaccess.h>
|
|
|
|
|
#include <kstandarddirs.h>
|
|
|
|
|
#include <tdemessagebox.h>
|
|
|
|
|
#include <tdefiledialog.h>
|
|
|
|
|
#include <tdeaction.h>
|
|
|
|
@ -79,6 +80,10 @@ MpvPart::MpvPart(TQWidget* parentWidget, const char* widgetName, TQObject* paren
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_logoPath = locate( "data", "kaffeine/logo" );
|
|
|
|
|
kdDebug() << "libmpvpart: Found logo animation: " << m_logoPath << endl;
|
|
|
|
|
|
|
|
|
|
closeURL(); // displays logo
|
|
|
|
|
emit setStatusBarText(i18n("Ready"));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -311,24 +316,24 @@ bool MpvPart::openURL(const MRL& mrl) {
|
|
|
|
|
bool MpvPart::closeURL() {
|
|
|
|
|
if (!m_mpv) return false;
|
|
|
|
|
|
|
|
|
|
const char *args[] = {"playlist-remove", "current", nullptr};
|
|
|
|
|
mpv_command_async(m_mpv, 0, args);
|
|
|
|
|
m_mrl.reset();
|
|
|
|
|
if (!m_logoPath.isNull()) {
|
|
|
|
|
const char *logo_args[] = {"loadfile", m_logoPath.local8Bit(), nullptr };
|
|
|
|
|
mpv_command_async(m_mpv, 0, logo_args);
|
|
|
|
|
slotPause(true);
|
|
|
|
|
}
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MpvPart::slotPlay() {
|
|
|
|
|
if (!m_mpv) return;
|
|
|
|
|
|
|
|
|
|
if (isPaused()) {
|
|
|
|
|
int value = 0;
|
|
|
|
|
mpv_set_property(m_mpv, "pause", MPV_FORMAT_FLAG, &value);
|
|
|
|
|
stateChanged(isStream() ? "playing_stream" : "playing_file");
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
kdDebug() << "m_playlist count: " << m_playlist.count() << endl;
|
|
|
|
|
|
|
|
|
|
if (m_playlist.count() > 0) {
|
|
|
|
|
emit setStatusBarText( i18n("Opening...") );
|
|
|
|
|
MRL curMRL = m_playlist[m_current];
|
|
|
|
|
kdDebug() << "current: " << curMRL.url() << endl;
|
|
|
|
|
|
|
|
|
|
const char *args[] = {"loadfile", curMRL.url().local8Bit(), nullptr};
|
|
|
|
|
mpv_command_async(m_mpv, 0, args);
|
|
|
|
@ -339,6 +344,10 @@ void MpvPart::slotPlay() {
|
|
|
|
|
emit signalRequestCurrentTrack();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (isPaused()) {
|
|
|
|
|
slotPause(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
stateChanged(isStream() ? "playing_stream" : "playing_file");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -403,7 +412,7 @@ bool MpvPart::isSeekable() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MpvPart::resetTime() {
|
|
|
|
|
m_playtime->setText("0:00:00");
|
|
|
|
|
m_playtime->setText("00:00:00");
|
|
|
|
|
m_position->setValue(0);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -471,11 +480,15 @@ void MpvPart::slotNext() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MpvPart::slotStop() {
|
|
|
|
|
if (isPlaying()) {
|
|
|
|
|
const char *args[] = {"stop", nullptr};
|
|
|
|
|
mpv_command_async(m_mpv, 0, args);
|
|
|
|
|
stateChanged("not_playing");
|
|
|
|
|
if (!isPlaying()) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char *stop_args[] = {"stop", nullptr};
|
|
|
|
|
mpv_command(m_mpv, stop_args);
|
|
|
|
|
|
|
|
|
|
closeURL();
|
|
|
|
|
stateChanged("not_playing");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void MpvPart::slotMute() {
|
|
|
|
|