[kde-doc-english] [dragon] src/app: Add 'Play Stream' functionality

Andrea Scarpino me at andreascarpino.it
Fri May 10 18:38:00 UTC 2013


Git commit 2ac2feec3b65e094e96d10f13200021f50219b7c by Andrea Scarpino.
Committed on 10/05/2013 at 20:37.
Pushed by scarpino into branch 'master'.

Add 'Play Stream' functionality

REVIEW: 110381
GUI:

M  +3    -0    src/app/loadView.cpp
M  +1    -0    src/app/loadView.h
M  +7    -0    src/app/loadView.ui
M  +18   -0    src/app/mainWindow.cpp
M  +1    -0    src/app/mainWindow.h

http://commits.kde.org/dragon/2ac2feec3b65e094e96d10f13200021f50219b7c

diff --git a/src/app/loadView.cpp b/src/app/loadView.cpp
index 01af7c3..46a7878 100644
--- a/src/app/loadView.cpp
+++ b/src/app/loadView.cpp
@@ -38,9 +38,12 @@ LoadView::LoadView( QWidget *parent )
     m_playDiskButton->setIconSize( QSize( KIconLoader::SizeMedium, KIconLoader::SizeMedium ) );
     m_playFileButton->setIcon( KIcon( QLatin1String(  "folder" ) ) );
     m_playFileButton->setIconSize( QSize( KIconLoader::SizeMedium, KIconLoader::SizeMedium ) );
+    m_playStreamButton->setIcon( KIcon( QLatin1String(  "document-open-remote" ) ) );
+    m_playStreamButton->setIconSize( QSize( KIconLoader::SizeMedium, KIconLoader::SizeMedium ) );
 
     connect( m_playDiskButton, SIGNAL(released()), this, SIGNAL(openDVDPressed()) );
     connect( m_playFileButton, SIGNAL(released()), this, SIGNAL(openFilePressed()) );
+    connect( m_playStreamButton, SIGNAL(released()), this, SIGNAL(openStreamPressed()) );
     connect( m_recentlyPlayed, SIGNAL(itemDoubleClicked(KUrl)), this, SIGNAL(loadUrl(KUrl)) );
 }
 
diff --git a/src/app/loadView.h b/src/app/loadView.h
index e11f7fd..606851f 100644
--- a/src/app/loadView.h
+++ b/src/app/loadView.h
@@ -37,6 +37,7 @@ class LoadView : public QWidget, private Ui_LoadView
       void loadUrl(KUrl);
       void openFilePressed();
       void openDVDPressed();
+      void openStreamPressed();
 };
 
 }
diff --git a/src/app/loadView.ui b/src/app/loadView.ui
index 2fa6151..491bb29 100644
--- a/src/app/loadView.ui
+++ b/src/app/loadView.ui
@@ -28,6 +28,13 @@
       </widget>
      </item>
      <item>
+      <widget class="QPushButton" name="m_playStreamButton">
+       <property name="text">
+        <string>Play Stream</string>
+       </property>
+      </widget>
+     </item>
+     <item>
       <spacer name="verticalSpacer">
        <property name="orientation">
         <enum>Qt::Vertical</enum>
diff --git a/src/app/mainWindow.cpp b/src/app/mainWindow.cpp
index b47e279..2c71499 100644
--- a/src/app/mainWindow.cpp
+++ b/src/app/mainWindow.cpp
@@ -28,6 +28,7 @@
 #include <KCursor>
 #include <KDebug>
 #include <KFileDialog>      //::open()
+#include <KInputDialog>
 #include <KGlobalSettings> //::timerEvent()
 #include <KIO/NetAccess>
 #include <KLocale>
@@ -204,6 +205,7 @@ MainWindow::init()
     //connect the stuff in loadView
     connect( m_loadView, SIGNAL(openDVDPressed()), this, SLOT(playDisc()) );
     connect( m_loadView, SIGNAL(openFilePressed()), this, SLOT(openFileDialog()) );
+    connect( m_loadView, SIGNAL(openStreamPressed()), this, SLOT(openStreamDialog()) );
     connect( m_loadView, SIGNAL(loadUrl(KUrl)), this, SLOT(open(KUrl)) );
 
     //connect the video player
@@ -663,6 +665,22 @@ MainWindow::openFileDialog()
 }
 
 void
+MainWindow::openStreamDialog()
+{
+    KUrl url(KInputDialog::getText( i18nc("@title:window", "Stream to Play"), i18n("Stream:") ));
+
+    if( url.isEmpty() )
+    {
+        kDebug() << "URL empty in MainWindow::openStreamDialog()";
+        return;
+    }
+    else
+    {
+        open( url );
+    }
+}
+
+void
 MainWindow::playDisc()
 {
     QList< Solid::Device > playableDiscs;
diff --git a/src/app/mainWindow.h b/src/app/mainWindow.h
index 5f79573..bc65121 100644
--- a/src/app/mainWindow.h
+++ b/src/app/mainWindow.h
@@ -75,6 +75,7 @@ namespace Dragon
       bool open( const KUrl& );
       void playDisc();
       void openFileDialog();
+      void openStreamDialog();
       void play();
       void toggleVideoSettings( bool );
       void toggleVolumeSlider( bool );


More information about the kde-doc-english mailing list