Commit 73a1755f authored by Scott Wheeler's avatar Scott Wheeler

Fixed Ogg tag reading to use the file name, minus extension, if there is no

track name.

Applied Daniel's two patches for (1) making the slider jump to where you click
with RMB and (2) making "replay" -- clicking on play while a track is playing --
work.

svn path=/trunk/kdemultimedia/juk/; revision=188998
parent edb48dde
......@@ -296,12 +296,13 @@ void JuK::playFile()
if(player.paused()) {
player.play();
if(player.playing()) {
playAction->setEnabled(false);
pauseAction->setEnabled(true);
stopAction->setEnabled(true);
playTimer->start(pollInterval);
}
}
else if(player.playing())
player.seekPosition(0);
else if(splitter) {
PlaylistItemList items = splitter->playlistSelection();
if(items.count() > 0)
......@@ -315,7 +316,6 @@ void JuK::pauseFile()
{
playTimer->stop();
player.pause();
playAction->setEnabled(true);
pauseAction->setEnabled(false);
}
......@@ -323,7 +323,6 @@ void JuK::stopFile()
{
playTimer->stop();
player.stop();
playAction->setEnabled(true);
pauseAction->setEnabled(false);
stopAction->setEnabled(false);
sliderAction->getTrackPositionSlider()->setValue(0);
......@@ -420,7 +419,6 @@ void JuK::playItem(PlaylistItem *item)
float volume = float(sliderAction->getVolumeSlider()->value()) / float(sliderAction->getVolumeSlider()->maxValue());
player.play(playingItem->absFilePath(), volume);
if(player.playing()) {
playAction->setEnabled(false);
pauseAction->setEnabled(true);
stopAction->setEnabled(true);
sliderAction->getTrackPositionSlider()->setEnabled(true);
......
......@@ -29,6 +29,7 @@
OggTag::OggTag(const QString &file) : Tag(file)
{
fileInfo.setFile(file);
metaInfo = KFileMetaInfo(file);
commentGroup = KFileMetaInfoGroup(metaInfo.group("Comment"));
}
......@@ -53,7 +54,12 @@ bool OggTag::hasTag() const
QString OggTag::track() const
{
return readCommentString("Title");
QString s = readCommentString("Title");
if(s.stripWhiteSpace().isEmpty())
s = fileInfo.baseName();
return(s);
}
QString OggTag::artist() const
......
......@@ -18,6 +18,8 @@
#ifndef OGGTAG_H
#define OGGTAG_H
#include <qfileinfo.h>
#include "tag.h"
class OggTag : public Tag
......@@ -71,6 +73,7 @@ private:
*/
void writeCommentItem(const QString &key, int value);
QFileInfo fileInfo;
KFileMetaInfo metaInfo;
KFileMetaInfoGroup commentGroup;
};
......
......@@ -170,8 +170,9 @@ void PlaylistSplitter::setSelected(PlaylistItem *i)
void PlaylistSplitter::open()
{
QStringList files = KFileDialog::getOpenFileNames(QString::null,
extensionsString((mediaExtensions + listExtensions), i18n("Media Files")));
// QStringList files = KFileDialog::getOpenFileNames(QString::null,
// extensionsString((mediaExtensions + listExtensions), i18n("Media Files")));
QStringList files = KFileDialog::getOpenFileNames();
open(files);
}
......
......@@ -24,6 +24,24 @@
#include "slideraction.h"
////////////////////////////////////////////////////////////////////////////////
// convenience class
////////////////////////////////////////////////////////////////////////////////
class TrackPositionSlider : public QSlider
{
public:
TrackPositionSlider(QWidget *parent, const char *name) : QSlider(parent, name) {}
protected:
void mousePressEvent(QMouseEvent *e) {
if(e->button() == LeftButton)
QSlider::mousePressEvent(new QMouseEvent(QEvent::MouseButtonPress, e->pos(), MidButton, e->state()));
else if(e->button() == MidButton)
QSlider::mousePressEvent(new QMouseEvent(QEvent::MouseButtonPress, e->pos(), LeftButton, e->state()));
}
};
////////////////////////////////////////////////////////////////////////////////
// public members
////////////////////////////////////////////////////////////////////////////////
......@@ -90,7 +108,7 @@ QWidget *SliderAction::createWidget(QWidget *parent) // virtual -- used by base
layout = new QBoxLayout(base, QBoxLayout::TopToBottom, 5, 5);
trackPositionSlider = new QSlider(base, "trackPositionSlider");
trackPositionSlider = new TrackPositionSlider(base, "trackPositionSlider");
trackPositionSlider->setMaxValue(1000);
QToolTip::add(trackPositionSlider, i18n("Track Position"));
layout->addWidget(trackPositionSlider);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment