-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.cpp | 110 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/audiowidget.h | 10 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.cpp | 81 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/mwindow.h | 16 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.cpp | 40 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/playlist.h | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.cpp | 77 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer3/videowidget.h | 11 |
8 files changed, 152 insertions, 195 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 @@ -19,12 +19,2 @@ AudioWidget::AudioWidget( QWidget * parent, const char * name, WFlags f) 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
}
@@ -35,34 +25,2 @@ 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)
@@ -77,8 +35,3 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) }
-#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) {
@@ -86,2 +39,6 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) }
+ if (!m_xineLib->hasVideo()) {
+ m_xineLib->setShowVideo( false );
+ }
+
// title
@@ -94,37 +51,35 @@ int AudioWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) 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;
}
@@ -140,7 +95,2 @@ void AudioWidget::updatePos(int /* val */) {
-#if 0
- if (m_pressed) return;
- m_uppos = val;
- m_PosSlider->setValue(val);
-#endif
}
diff --git a/noncore/multimedia/opieplayer3/audiowidget.h b/noncore/multimedia/opieplayer3/audiowidget.h index 5e5dc09..abdd781 100644 --- a/noncore/multimedia/opieplayer3/audiowidget.h +++ b/noncore/multimedia/opieplayer3/audiowidget.h @@ -34,13 +34,5 @@ protected: QTextView*m_InfoBox;
-#if 0
- QSlider*m_PosSlider;
- bool m_pressed;
- int m_uppos;
-#endif
+ static QString secToString(int sec);
protected slots:
- virtual void closeEvent(QCloseEvent*e);
- virtual void slotNewPos(int pos);
- virtual void sliderPressed();
- virtual void sliderReleased();
};
diff --git a/noncore/multimedia/opieplayer3/mwindow.cpp b/noncore/multimedia/opieplayer3/mwindow.cpp index 57418f0..75d1490 100644 --- a/noncore/multimedia/opieplayer3/mwindow.cpp +++ b/noncore/multimedia/opieplayer3/mwindow.cpp @@ -62,2 +62,3 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) {
+ checkLib();
setCaption( QObject::tr("Opie Mediaplayer 3" ) );
@@ -71,5 +72,5 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) m_l->addWidget(m_stack);
- m_scrollBar = new QSlider(QSlider::Horizontal,m_MainBox);
- m_l->addWidget(m_scrollBar);
- m_scrollBar->setEnabled(false);
+ m_PosSlider = new QSlider(QSlider::Horizontal,m_MainBox);
+ m_l->addWidget(m_PosSlider);
+ m_PosSlider->setEnabled(false);
@@ -89,4 +90,10 @@ PMainWindow::PMainWindow(QWidget*w, const char*name, WFlags f) + 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;
+
m_stack->raiseWidget(stack_list);
- m_PlayLib = 0;
m_LastItem = 0;
@@ -101,2 +108,3 @@ void PMainWindow::slotListChanged(int count) {
+ playersGroup->setEnabled(count>0);
if (!m_playList->isVisible()) {
@@ -119,4 +127,5 @@ void PMainWindow::checkLib() if (m_PlayLib == 0) {
- m_PlayLib = new XINE::Lib(XINE::Lib::InitializeImmediately);
- m_PlayLib->ensureInitialized();
+ m_PlayLib = new XINE::Lib(XINE::Lib::InitializeInThread);
+ qApp->processEvents();
+// m_PlayLib->ensureInitialized();
connect(m_PlayLib,SIGNAL(stopped()),this,SLOT(slotStopped()));
@@ -201,3 +210,3 @@ void PMainWindow::slotUserStop() m_PlayLib->stop();
- m_scrollBar->setEnabled(false);
+ m_PosSlider->setEnabled(false);
hideVideo();
@@ -233,3 +242,3 @@ void PMainWindow::slotPlayCurrent() if (m_PlayLib) m_PlayLib->stop();
- m_scrollBar->setEnabled(false);
+ m_PosSlider->setEnabled(false);
a_playAction->setOn(false);
@@ -239,6 +248,6 @@ void PMainWindow::slotPlayCurrent() }
- checkLib();
m_CurrentPos = 0;
m_playList->setCurrentItem(m_LastItem);
- odebug << "Pos: " << m_PlayLib->currentTime() << oendl;
+ m_uppos = 0;
+ m_PosSlider->setValue(0);
int result = 0;
@@ -260,5 +269,5 @@ void PMainWindow::slotPlayCurrent() odebug << "Range: " << result << oendl;
- m_scrollBar->setRange(0,result);
- m_scrollBar->setValue(0);
- m_scrollBar->setEnabled(true);
+ m_PosSlider->setEnabled(true);
+ m_PosSlider->setRange(0,m_PlayLib->length());
+ m_PosSlider->setValue(m_PlayLib->currentTime());
QTimer::singleShot( 500, this, SLOT( slotCheckPos() ) );
@@ -291,2 +300,3 @@ void PMainWindow::slotStopped() if (!m_playing) return;
+ odebug << "Slot stopped" << oendl;
m_playing = false;
@@ -298,4 +308,7 @@ void PMainWindow::slotCheckPos() if (!m_playing) return;
- //emit sigPos(m_PlayLib->currentTime());
- m_scrollBar->setValue(m_PlayLib->currentTime());
+ if (!m_pressed) {
+ m_uppos = m_PlayLib->currentTime();
+ emit sigPos(m_uppos);
+ m_PosSlider->setValue(m_PlayLib->currentTime());
+ }
QTimer::singleShot( 1000, this, SLOT( slotCheckPos() ) );
@@ -317,5 +330,5 @@ void PMainWindow::setupActions() connect(a_addDir,SIGNAL(activated()),m_playList,SLOT(slotAppendDir()));
- a_loadPlaylist = new QAction(tr("Append .m3u playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false);
+ a_loadPlaylist = new QAction(tr("Append playlist"),Resource::loadIconSet("opieplayer2/add_to_playlist"),0,0,this,0,false);
connect(a_loadPlaylist,SIGNAL(activated()),m_playList,SLOT(slotOpenM3u()));
- a_savePlaylist = new QAction(tr("Save .m3u playlist"),Resource::loadIconSet("save"),0,0,this,0,false);
+ a_savePlaylist = new QAction(tr("Save playlist"),Resource::loadIconSet("save"),0,0,this,0,false);
connect(a_savePlaylist,SIGNAL(activated()),m_playList,SLOT(slotSaveAsM3u()));
@@ -353,2 +366,3 @@ void PMainWindow::setupActions() +
/* initial states of actions */
@@ -357,2 +371,9 @@ void PMainWindow::setupActions() a_ShowMedia->setEnabled(false);
+ playersGroup->setEnabled(false);
+
+ settingsGroup = new QActionGroup(this,"configgroup",false);
+
+ a_Scaleup = new QAction(tr("Scale videos larger"),Resource::loadIconSet( "fullscreen" ), 0, 0, this, 0, true );
+ connect(a_Scaleup,SIGNAL(toggled(bool)),this,SLOT(slot_scaleupToggled(bool)));
+ settingsGroup->insert(a_Scaleup);
}
@@ -429,4 +450,28 @@ void PMainWindow::setupMenu() m_menuBar->insertItem(tr("Playing"),playMenu);
-
playersGroup->addTo(playMenu);
+ configMenu = new QPopupMenu(m_menuBar);
+ m_menuBar->insertItem(tr("Config"),configMenu);
+ settingsGroup->addTo(configMenu);
+}
+
+void PMainWindow::slotNewPos(int pos)
+{
+ if (!m_PlayLib) return;
+ if (m_uppos==pos) return;
+ m_PlayLib->seekTo(pos);
+}
+
+void PMainWindow::sliderPressed()
+{
+ m_pressed = true;
+}
+
+void PMainWindow::sliderReleased()
+{
+ m_pressed = false;
+}
+
+void PMainWindow::slot_scaleupToggled(bool how)
+{
+ m_VideoPlayer->scaleUp(how);
}
diff --git a/noncore/multimedia/opieplayer3/mwindow.h b/noncore/multimedia/opieplayer3/mwindow.h index 10c7a29..5d011d5 100644 --- a/noncore/multimedia/opieplayer3/mwindow.h +++ b/noncore/multimedia/opieplayer3/mwindow.h @@ -84,3 +84,3 @@ protected: QWidget*m_MainBox;
- QSlider*m_scrollBar;
+ QSlider*m_PosSlider;
@@ -89,5 +89,6 @@ protected: QAction*a_addDir,*a_loadPlaylist,*a_savePlaylist;
- QActionGroup*playersGroup,*playlistOnly;
+ QAction*a_Scaleup;
+ QActionGroup*playersGroup,*playlistOnly,*settingsGroup;
QToolBar*m_toolBar;
- QPopupMenu *fileMenu,*dispMenu,*playMenu;
+ QPopupMenu *fileMenu,*dispMenu,*playMenu,*configMenu;
QMenuBar*m_menuBar;
@@ -101,4 +102,6 @@ protected: void hideVideo();
-
bool m_playing:1;
+ bool m_pressed:1;
+ int m_uppos;
+
int m_CurrentPos;
@@ -124,2 +127,7 @@ protected slots: virtual void slotListChanged(int);
+ virtual void slotNewPos(int pos);
+ virtual void sliderPressed();
+ virtual void sliderReleased();
+ virtual void slot_scaleupToggled(bool);
+
diff --git a/noncore/multimedia/opieplayer3/playlist.cpp b/noncore/multimedia/opieplayer3/playlist.cpp index babe8ce..2eb40e3 100644 --- a/noncore/multimedia/opieplayer3/playlist.cpp +++ b/noncore/multimedia/opieplayer3/playlist.cpp @@ -106,2 +106,3 @@ void PlaylistView::checkLib() m_Infolib = new XINE::Lib(XINE::Lib::InitializeImmediately);
+ connect(m_Infolib,SIGNAL(stopped()),this,SLOT(slotDummyStop()));
m_Infolib->ensureInitialized();
@@ -110,5 +111,15 @@ void PlaylistView::checkLib() +void PlaylistView::slotDummyStop()
+{
+ odebug << "void PlaylistView::slotDummyStop()" << oendl;
+}
+
void PlaylistView::slotAddFile(const DocLnk&aLink)
{
- addFile(aLink.file(),aLink.name());
+ QFileInfo f(aLink.file());
+ if (f.extension(FALSE).lower()=="m3u"||f.extension(FALSE).lower()=="pls") {
+ readPlayList(aLink.file());
+ } else {
+ addFile(aLink.file(),aLink.name());
+ }
emit contentChanged(childCount());
@@ -121,4 +132,2 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName) checkLib();
- m_Infolib->stop();
-
QString name = aName;
@@ -128,2 +137,4 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName) int i = m_Infolib->setfile(aFile.utf8().data());
+ /* realy! otherwise we get an "stopped" signal when playing! - I don't know why */
+ m_Infolib->stop();
odebug << "File set: " << i << " ("<<aFile.utf8().data()<<")"<<oendl;
@@ -182,11 +193,5 @@ void PlaylistView::addFile(const QString&aFile,const QString&aName) if (h>0) {
- codec+=QString("%1 h").arg(h);
- }
- if (m>0) {
- if (!codec.isEmpty()) codec+=" ";
- codec+=QString("%1 m").arg(m);
- }
- if (l>0) {
- if (!codec.isEmpty()) codec+=" ";
- codec+=QString("%1 s").arg(l);
+ codec.sprintf("%2i:%2i:%2i h",h,m,l);
+ } else {
+ codec.sprintf("%02i:%02i m",m,l);
}
@@ -218,3 +223,3 @@ void PlaylistView::slotOpenM3u() mimeTypes.insert("Playlists",types);
- mimeTypes.insert("All",types);
+// mimeTypes.insert("All",types);
QString fileName= Opie::Ui::OFileDialog::getOpenFileName(Opie::Ui::OFileSelector::EXTENDED,
@@ -224,2 +229,8 @@ void PlaylistView::slotOpenM3u() }
+ readPlayList(fileName);
+ emit contentChanged(childCount());
+}
+
+void PlaylistView::readPlayList(const QString&fileName)
+{
QFileInfo f(fileName);
@@ -235,3 +246,2 @@ void PlaylistView::slotOpenM3u() }
- emit contentChanged(childCount());
}
@@ -244,5 +254,5 @@ void PlaylistView::slotSaveAsM3u() mimeTypes.insert("Playlists",types);
- mimeTypes.insert("All",types);
QString fileName= Opie::Ui::OFileDialog::getSaveFileName(Opie::Ui::OFileSelector::EXTENDED,
m_lastDir,"playlist.m3u", mimeTypes);
+ odebug << "Save as " << fileName << oendl;
if (fileName.isEmpty()) {
diff --git a/noncore/multimedia/opieplayer3/playlist.h b/noncore/multimedia/opieplayer3/playlist.h index 4a9268c..3c9a68d 100644 --- a/noncore/multimedia/opieplayer3/playlist.h +++ b/noncore/multimedia/opieplayer3/playlist.h @@ -97,2 +97,3 @@ public slots: virtual void slotSaveAsM3u();
+ virtual void slotDummyStop();
@@ -100,2 +101,3 @@ protected: void checkLib();
+ void readPlayList(const QString&);
QStringList columnLabels;
diff --git a/noncore/multimedia/opieplayer3/videowidget.cpp b/noncore/multimedia/opieplayer3/videowidget.cpp index a28d47d..833ecb4 100644 --- a/noncore/multimedia/opieplayer3/videowidget.cpp +++ b/noncore/multimedia/opieplayer3/videowidget.cpp @@ -17,3 +17,3 @@ VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) m_xineLib = 0;
-
+ m_scaleUp = false;
m_MainLayout = new QVBoxLayout(this);
@@ -21,16 +21,4 @@ VideoWidget::VideoWidget( QWidget * parent, const char * name, WFlags f) m_Videodisplay = new XineVideoWidget(this,"videodisp");
-#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()));
-#endif
connect(m_Videodisplay,SIGNAL(videoResized ( const QSize & )),this,SLOT(slot_Videoresized(const QSize&)));
connect(m_Videodisplay,SIGNAL(clicked()),this,SLOT(slotClicked()));
-#if 0
- m_pressed = false;
- m_uppos=0;
-#endif
}
@@ -43,3 +31,2 @@ void VideoWidget::slotClicked() {
- odebug << "clicked " << oendl;
emit videoclicked();
@@ -51,34 +38,4 @@ void VideoWidget::closeEvent(QCloseEvent*e) -void VideoWidget::slotNewPos(int /*pos*/)
-{
-#if 0
- if (!m_xineLib) return;
- if (m_uppos==pos) return;
- m_xineLib->seekTo(pos);
-#endif
-}
-
-void VideoWidget::sliderPressed()
-{
-#if 0
- m_pressed = true;
-#endif
-}
-
-void VideoWidget::sliderReleased()
-{
-#if 0
- m_pressed = false;
-#endif
-}
-
void VideoWidget::fullScreen(bool /* how */)
{
-#if 0
- if (how) {
- m_PosSlider->hide();
- } else {
- m_PosSlider->show();
- }
-#endif
}
@@ -98,10 +55,7 @@ int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) connect(m_xineLib,SIGNAL(stopped()),this,SLOT(slotStopped()));
-#if 0
- m_uppos=0;
- m_PosSlider->setValue(0);
-#endif
m_xineLib->setWidget(m_Videodisplay);
m_xineLib->setShowVideo(true);
- m_xineLib->resize(m_Videodisplay->size());
int res = m_xineLib->play(m_current.file());
+ vSize = m_xineLib->videoSize();
+ slot_Videoresized(m_Videodisplay->size());
odebug << "Xine play: " << res << oendl;
@@ -111,6 +65,2 @@ int VideoWidget::playFile(const DocLnk&aLnk,XINE::Lib*aLib) return m_xineLib->length();
-#if 0
- m_PosSlider->setRange(0,l);
- m_PosSlider->setPageStep(l/10);
-#endif
}
@@ -126,3 +76,2 @@ void VideoWidget::slotStopped() {
-// check fullscreen here!
}
@@ -131,5 +80,8 @@ void VideoWidget::slot_Videoresized(const QSize&s) {
- odebug << "Videoresized: " << s << oendl;
if (m_xineLib) {
- m_xineLib->resize(s);
+ if (vSize.width()<s.width()&&vSize.height()<s.height()&&!m_scaleUp) {
+ m_xineLib->resize(vSize);
+ } else {
+ m_xineLib->resize(s);
+ }
}
@@ -137,9 +89,12 @@ void VideoWidget::slot_Videoresized(const QSize&s) +void VideoWidget::scaleUp(bool how)
+{
+ if (how == m_scaleUp) return;
+ m_scaleUp = how;
+ slot_Videoresized(m_Videodisplay->size());
+ m_Videodisplay->repaint();
+}
+
void VideoWidget::updatePos(int /*val*/)
{
-#if 0
- if (m_pressed) return;
- m_uppos = val;
- m_PosSlider->setValue(val);
-#endif
}
diff --git a/noncore/multimedia/opieplayer3/videowidget.h b/noncore/multimedia/opieplayer3/videowidget.h index 935a648..e082407 100644 --- a/noncore/multimedia/opieplayer3/videowidget.h +++ b/noncore/multimedia/opieplayer3/videowidget.h @@ -24,2 +24,3 @@ public: void fullScreen(bool how);
+ void scaleUp(bool how);
@@ -38,7 +39,4 @@ protected: QWidget * m_holder;
-#if 0
- QSlider*m_PosSlider;
- bool m_pressed:1;
- int m_uppos;
-#endif
+ QSize vSize;
+ bool m_scaleUp:1;
@@ -46,5 +44,2 @@ protected slots: virtual void closeEvent(QCloseEvent*e);
- virtual void slotNewPos(int pos);
- virtual void sliderPressed();
- virtual void sliderReleased();
virtual void slot_Videoresized(const QSize&);
|