summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opieplayer3/audiowidget.cpp
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opieplayer3/audiowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opieplayer3/audiowidget.cpp110
1 files changed, 30 insertions, 80 deletions
diff --git a/noncore/multimedia/opieplayer3/audiowidget.cpp b/noncore/multimedia/opieplayer3/audiowidget.cpp
index b435c1b..aeebf45 100644
--- a/noncore/multimedia/opieplayer3/audiowidget.cpp
+++ b/noncore/multimedia/opieplayer3/audiowidget.cpp
@@ -17,54 +17,12 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f)
m_MainLayout = new QVBoxLayout(this);
m_MainLayout->setAutoAdd(true);
m_InfoBox = new QTextView(this);
-#if 0
- m_PosSlider = new QSlider(QSlider::Horizontal,this);
- m_PosSlider->setTickInterval(60);
- connect(m_PosSlider,SIGNAL(valueChanged(int)),this,SLOT(slotNewPos(int)));
- connect(m_PosSlider,SIGNAL(sliderMoved(int)),this,SLOT(slotNewPos(int)));
- connect(m_PosSlider,SIGNAL(sliderPressed()),this,SLOT(sliderPressed()));
- connect(m_PosSlider,SIGNAL(sliderReleased()),this,SLOT(sliderReleased()));
- m_pressed = false;
- m_uppos=0;
-#endif
}
AudioWidget::~AudioWidget()
{
}
-void AudioWidget::slotNewPos(int /* pos*/)
-{
- if (!m_xineLib) return;
-#if 0
- if (m_uppos==pos) return;
- m_xineLib->seekTo(pos);
-#endif
-}
-
-void AudioWidget::sliderPressed()
-{
-#if 0
- m_pressed = true;
-#endif
-}
-
-void AudioWidget::sliderReleased()
-{
-#if 0
- m_pressed = false;
-#endif
-}
-
-void AudioWidget::closeEvent(QCloseEvent*e)
-{
- odebug << "AudioWidget::closeEvent(QCloseEvent*e)" << oendl;
- if (m_xineLib) {
- m_xineLib->stop();
- }
- QWidget::closeEvent(e);
-}
-
int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
{
m_current = aLnk;
@@ -75,15 +33,14 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
if (!m_xineLib) {
return -1;
}
-#if 0
- m_uppos=0;
- m_PosSlider->setValue(0);
-#endif
- m_xineLib->setShowVideo(false);
- int res = m_xineLib->play(m_current.file());
+ int res = m_xineLib->play(m_current.file(),0,0);
if (res != 1) {
return -2;
}
+ if (!m_xineLib->hasVideo()) {
+ m_xineLib->setShowVideo( false );
+ }
+
// title
QString title = m_xineLib->metaInfo(0);
// artist
@@ -92,41 +49,39 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib)
QString album = m_xineLib->metaInfo(4);
int l = m_xineLib->length();
- int tmp = l;
-#if 0
- m_PosSlider->setRange(0,l);
-#endif
- QString laenge="";
- int h = l/3600;
- l-=h*3600;
- int m = l/60;
- l-=m*60;
- if (h>0) {
- laenge+=QString("%1 h").arg(h);
- }
- if (m>0) {
- if (!laenge.isEmpty()) laenge+=" ";
- laenge+=QString("%1 m").arg(m);
- }
- if (l>0) {
- if (!laenge.isEmpty()) laenge+=" ";
- laenge+=QString("%1 s").arg(l);
- }
- QString text = "<qt>";
+ QString laenge = secToString(l);
+ QString text = "<qt><center><table border=\"0\">";
if (artist.length()) {
- text+="<H2><center>"+artist+"</center></h2>";
+ text+="<tr><td>"+tr("Artist: ")+"</td><td><b>"+artist+"</b></td></tr>";
}
if (title.length()) {
- text+="<H2><center>"+title+"</center></h2>";
+ text+="<tr><td>"+tr("Title: ")+"</td><td><font size=\"+2\">"+title+"</font></td></tr>";
} else {
- text+="<H2><center>"+m_current.name()+"</center></h2>";
+ text+="<tr><td>"+tr("Filename: ")+"</td><td><b>"+m_current.name()+"</b></td></tr>";
}
if (album.length()) {
- text+="<H2><center>"+album+"</center></h2>";
+ text+="<tr><td>"+tr("Album: ")+"</td><td><b>"+album+"</b></td></tr>";
}
- text+="<h3><center>"+laenge+"</center></h3>";
+ text+="<tr><td>"+tr("Length: ")+"</td><td><b>"+laenge+"</b></td></tr>";
+ text+="</table></center></qt>";
m_InfoBox->setText(text);
- return tmp;
+ return l;
+}
+
+QString AudioWidget::secToString(int sec)
+{
+ int l = sec;
+ int h = l/3600;
+ l-=h*3600;
+ int m = l/60;
+ l-=m*60;
+ QString s = "";
+ if (h>0) {
+ s.sprintf("%2i:%2i:%2i",h,m,l);
+ } else {
+ s.sprintf("%02i:%02i",m,l);
+ }
+ return s;
}
void AudioWidget::stopPlaying()
@@ -138,9 +93,4 @@ void AudioWidget::stopPlaying()
void AudioWidget::updatePos(int /* val */)
{
-#if 0
- if (m_pressed) return;
- m_uppos = val;
- m_PosSlider->setValue(val);
-#endif
}