Progressbar fix
authorElias Woods <EliasWoods@gmail.com>
Sat, 19 Jun 2010 05:30:10 +0000 (01:30 -0400)
committerElias Woods <EliasWoods@gmail.com>
Sat, 19 Jun 2010 05:30:10 +0000 (01:30 -0400)
Groove.pro
Groove.pro.user
Makefile
grooveprogressbar.cpp [new file with mode: 0644]
grooveprogressbar.h [new file with mode: 0644]
splayer.cpp
splayer.h
streamio.cpp

index 86ae9ea..719fe07 100644 (file)
@@ -27,7 +27,8 @@ SOURCES += main.cpp \
     splayer.cpp \
     streamio.cpp \
     playlist.cpp \
-    downloadmanager.cpp
+    downloadmanager.cpp \
+    grooveprogressbar.cpp
 
 HEADERS += \
     groove.h \
@@ -35,4 +36,5 @@ HEADERS += \
     splayer.h \
     streamio.h \
     playlist.h \
-    downloadmanager.h
+    downloadmanager.h \
+    grooveprogressbar.h
index 922c54a..b68c481 100644 (file)
     </valuemap>
     <value key="Qt4ProjectManager.MaemoRunConfiguration.DeviceId" type="qulonglong">1</value>
     <valuemap key="Qt4ProjectManager.MaemoRunConfiguration.LastDeployed" type="QVariantMap">
-     <value key="192.168.1.3" type="QDateTime">2010-06-18T23:28:49</value>
+     <value key="192.168.1.3" type="QDateTime">2010-06-19T01:08:31</value>
     </valuemap>
     <value key="Qt4ProjectManager.MaemoRunConfiguration.Simulator" type="QString"></value>
    </valuemap>
index b09e6fe..308dfaa 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
 #############################################################################
 # Makefile for building: groove
-# Generated by qmake (2.01a) (Qt 4.6.2) on: Fri Jun 18 23:18:05 2010
+# Generated by qmake (2.01a) (Qt 4.6.2) on: Sat Jun 19 00:00:46 2010
 # Project:  Groove.pro
 # Template: app
 # Command: /usr/bin/qmake -unix -o Makefile Groove.pro
diff --git a/grooveprogressbar.cpp b/grooveprogressbar.cpp
new file mode 100644 (file)
index 0000000..dc130bd
--- /dev/null
@@ -0,0 +1,26 @@
+#include "grooveprogressbar.h"
+
+grooveProgressBar::grooveProgressBar(QDialog *parent) :
+    QDialog(parent)
+{
+    bar = new QProgressBar();
+    bar->setMaximum(100);
+    bar->setValue(0);
+    lay = new QHBoxLayout();
+    lay->addWidget(bar);
+    this->setLayout(lay);
+    this->setWindowTitle("Downloading /  Buffering");
+}
+void grooveProgressBar::setMaximum(int maximum)
+{
+    bar->setMaximum(maximum);
+}
+int grooveProgressBar::maximum()
+{
+   return bar->maximum();
+}
+
+void grooveProgressBar::setValue(int position)
+{
+    bar->setValue(position);
+}
diff --git a/grooveprogressbar.h b/grooveprogressbar.h
new file mode 100644 (file)
index 0000000..770e1b1
--- /dev/null
@@ -0,0 +1,25 @@
+#ifndef GROOVEPROGRESSBAR_H
+#define GROOVEPROGRESSBAR_H
+
+#include <QDialog>
+#include <QtGui>
+
+class grooveProgressBar : public QDialog
+{
+    Q_OBJECT
+public:
+    explicit grooveProgressBar(QDialog *parent = 0);
+    void setMaximum(int maximum);
+    void setValue(int position);
+    int maximum();
+
+signals:
+
+public slots:
+
+private:
+    QProgressBar *bar;
+    QHBoxLayout  *lay;
+};
+
+#endif // GROOVEPROGRESSBAR_H
index bc54f00..dae3fcc 100644 (file)
@@ -22,7 +22,8 @@ sPlayer::~sPlayer()
 }
 void sPlayer::abortDownload()
 {
-    reply->abort();
+    //pd->hide();
+    //reply->abort();
 }
 
 void sPlayer::play(QString StreamKey,QUrl server)
@@ -31,11 +32,15 @@ void sPlayer::play(QString StreamKey,QUrl server)
     {
         //reply->abort();
     }
-    pd = new QProgressDialog("Downloading / Buffering.", "Cancel", 0, 100);
-    pd->setValue(0);
+    pd = new grooveProgressBar();
+    //pd->setAttribute();
+
 #ifdef Q_WS_MAEMO_5
     pd->setAttribute(Qt::WA_Maemo5AutoOrientation,true);
+    //pd->setModal(false);
 #endif
+    pd->show();
+    pd->setValue(0);
     QNetworkRequest req;
     req.setUrl(server);
     qDebug() << server;
@@ -44,7 +49,7 @@ void sPlayer::play(QString StreamKey,QUrl server)
     buffer->open(buffer->ReadWrite | buffer->Truncate);
     connect(reply,SIGNAL(finished()),this,SLOT(start()));
     connect(reply,SIGNAL(downloadProgress(qint64,qint64)),this,SLOT(putb(qint64,qint64)));
-    connect(pd,SIGNAL(canceled()),this,SLOT(abortDownload()));
+    //connect(pd,SIGNAL(canceled()),this,SLOT(abortDownload()));
     media->stop();
     playing = false;
     startStreamT = QTime::currentTime();
index 9ae0c37..fe3a5ec 100644 (file)
--- a/splayer.h
+++ b/splayer.h
@@ -6,6 +6,7 @@
 #include <phonon>
 #include "streamio.h"
 #include <QProgressDialog>
+#include "grooveprogressbar.h"
 
 class sPlayer : public QObject
 {
@@ -33,6 +34,6 @@ private:
     bool playing;
     QObject *internal;
     QTime startStreamT;
-    QProgressDialog *pd;
+    grooveProgressBar *pd;
 };
 #endif // SPLAYER_H
index ce3cc30..6d9133b 100644 (file)
@@ -9,7 +9,7 @@ void StreamIO::setSizeOfStream(qint64 s)
 {
     internal->stream()->setStreamSize(s);
 }
-/*qint64 StreamIO::size()
+qint64 StreamIO::size()
 {
     return sized;
 }
@@ -20,7 +20,7 @@ qint64 StreamIO::bytesAvailable()
 bool StreamIO::isSequential()
 {
     return true;
-}/*
+}
 qint64 StreamIO::readData(char* data, qint64 maxsize)
 {
     internal->data().at(rpos);