]> git.sesse.net Git - kdenlive/commitdiff
show progress of auido thumb creation
authorMarco Gittler <marco@gitma.de>
Mon, 25 Feb 2008 15:55:36 +0000 (15:55 +0000)
committerMarco Gittler <marco@gitma.de>
Mon, 25 Feb 2008 15:55:36 +0000 (15:55 +0000)
svn path=/branches/KDE4/; revision=1935

src/events.h [new file with mode: 0644]
src/kthumb.cpp
src/mainwindow.cpp
src/mainwindow.h

diff --git a/src/events.h b/src/events.h
new file mode 100644 (file)
index 0000000..ecc11f9
--- /dev/null
@@ -0,0 +1,33 @@
+/***************************************************************************
+                          events.h  -  description
+                             -------------------
+    begin                : Feb 15 2008
+    copyright            : (C) 2008 by Marco Gittler
+    email                : g.marco@freenet.de
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef EVENTS_H
+#define EVENTS_H
+
+#include <QEvent>
+
+class ProgressEvent : public QEvent {
+public:
+       ProgressEvent( int value, QEvent::Type eventType  )
+               : QEvent( eventType ), m_val( value ) {};
+       int value() const { return m_val; };
+private:
+       int m_val;
+       
+};
+
+#endif
index cf3dee8efca30eb42ab49854f63a741cb2dd5696..d905aa728601c10854bb43f76e63f01a25ea91d2 100644 (file)
@@ -42,7 +42,7 @@
 #include "renderer.h"
 #include "kthumb.h"
 #include "kdenlivesettings.h"
-
+#include "events.h"
 void MyThread::init(KUrl url, QString target, double frame, double frameLength, int frequency, int channels, int arrayWidth)
     {
        stop_me = false;
@@ -80,11 +80,11 @@ void MyThread::init(KUrl url, QString target, double frame, double frameLength,
                    Mlt::Filter m_convert(prof,"volume");
                    m_convert.set("gain", "normalise");
                    m_producer.attach(m_convert);
-               }
+               }*/
 
-               /*TODO if (qApp->mainWidget()) 
-                   QApplication::postEvent(qApp->mainWidget(), new ProgressEvent(-1, 10005));
-       */
+               if (QApplication::activeWindow()) 
+                       QApplication::postEvent(QApplication::activeWindow(), new ProgressEvent(-1, (QEvent::Type)10005));
+       
                int last_val = 0;
                int val = 0;
                kDebug() << "for " << m_frame << " " << m_frameLength << " " << m_producer.is_valid();
@@ -92,7 +92,8 @@ void MyThread::init(KUrl url, QString target, double frame, double frameLength,
                        if (stop_me) break;
                        val=(int)((z-m_frame)/(m_frame+m_frameLength)*100.0);
                        if (last_val!=val & val > 1){
-                               //TODO QApplication::postEvent(qApp->mainWidget(), new ProgressEvent(val, 10005));
+                               QApplication::postEvent(QApplication::activeWindow(), new ProgressEvent(val, (QEvent::Type)10005));
+                               
                                last_val=val;
                        }
                                m_producer.seek( z );
@@ -125,9 +126,11 @@ void MyThread::init(KUrl url, QString target, double frame, double frameLength,
                m_isWorking = false;
                if (stop_me) {
                    f.remove();
-                  //TODO  QApplication::postEvent(qApp->mainWidget(), new ProgressEvent(-1, 10005));
+                        QApplication::postEvent(QApplication::activeWindow(), new ProgressEvent(-1, (QEvent::Type)10005));
+                  
                }
-               //TODO else QApplication::postEvent(qApp->mainWidget(), new ProgressEvent(0, 10005));
+               QApplication::postEvent(QApplication::activeWindow(), new ProgressEvent(0, (QEvent::Type)10005));
+               
     }
 
 
index e8c556c3ec29de8d23941aafd84c2b612388fa32..7b385d3ae7a07d4ba5c056bc1566d00da3866213 100644 (file)
@@ -50,6 +50,7 @@
 #include "initeffects.h"
 #include "profilesdialog.h"
 #include "projectsettings.h"
+#include "events.h"
 
 #define ID_STATUS_MSG 1
 #define ID_EDITMODE_MSG 2
@@ -136,6 +137,14 @@ MainWindow::MainWindow(QWidget *parent)
   m_timecodeFormat = new KComboBox(this);
   m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
   m_timecodeFormat->addItem(i18n("Frames"));
+
+  statusProgressBar=new QProgressBar(this);
+  statusProgressBar->setMinimum(0);
+  statusProgressBar->setMaximum(100);
+  statusLabel=new QLabel(this);        
+
+  statusBar()->insertPermanentWidget(0,statusProgressBar,1);
+  statusBar()->insertPermanentWidget(1,statusLabel,1);
   statusBar()->insertPermanentFixedItem("00:00:00:00", ID_TIMELINE_POS);
   statusBar()->insertPermanentWidget(ID_TIMELINE_FORMAT, m_timecodeFormat); 
 
@@ -499,5 +508,15 @@ void MainWindow::slotPreferences()
   //connect( dialog, SIGNAL(settingsChanged()), this, SLOT(updateConfiguration()) );
   dialog->show();
 }
-
+void MainWindow::customEvent ( QEvent * event ){
+       if (event->type()==10005){
+               ProgressEvent* p=(ProgressEvent*) event;
+               statusProgressBar->setValue(p->value());
+               statusProgressBar->setFormat("%p done");
+               if (p->value()>0)
+                       statusLabel->setText(tr("Creating Audio Thumbs"));
+               else
+                       statusLabel->setText("");
+       }
+}
 #include "mainwindow.moc"
index 060f657e7e32dfe48543626f8f9d4abfc24173c4..4f7f24979eb36fd515493d13714ca75beffc7ba0 100644 (file)
@@ -24,6 +24,7 @@
 #include <QDockWidget>
 #include <QUndoView>
 #include <QLabel>
+#include <QProgressBar>
 
 #include <KXmlGuiWindow>
 #include <KTextEdit>
@@ -43,6 +44,7 @@
 #include "effectslistview.h"
 #include "effectstackview.h"
 
+
 class MainWindow : public KXmlGuiWindow
 {
   Q_OBJECT
@@ -51,12 +53,14 @@ class MainWindow : public KXmlGuiWindow
     MainWindow(QWidget *parent=0);
 
     void parseProfiles();
-
+    void customEvent ( QEvent * event );
   protected:
     virtual bool queryClose();
   
   private:
     KTabWidget* m_timelineArea;
+    QProgressBar *statusProgressBar;
+    QLabel* statusLabel;
     void setupActions();
     QString fileName;
     KdenliveDoc *m_activeDocument;