]> git.sesse.net Git - kdenlive/commitdiff
* more infos in clip properties dialog
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 23 Mar 2008 20:55:33 +0000 (20:55 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Sun, 23 Mar 2008 20:55:33 +0000 (20:55 +0000)
* do not try to create audio thumbs on mute files

svn path=/branches/KDE4/; revision=2104

src/clipproperties.cpp
src/clipproperties.h
src/docclipbase.cpp
src/docclipbase.h
src/mainwindow.cpp
src/widgets/clipproperties_ui.ui

index 63564bb4603e25b34c3fda7c192ffc6087df7c77..1938df1f7a93bbb6b3d0369610fbf5f91aa6bd56 100644 (file)
 
 #include <KStandardDirs>
 #include <KDebug>
+#include <KFileItem>
 
 #include "kdenlivesettings.h"
 #include "clipproperties.h"
 #include "kthumb.h"
 
-ClipProperties::ClipProperties(DocClipBase *clip, QWidget * parent): QDialog(parent) {
+ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent): QDialog(parent), m_tc(tc), m_clip(clip), m_fps(fps) {
     m_view.setupUi(this);
-    m_clip = clip;
-
-    m_view.clip_path->setText(m_clip->fileURL().path());
+    KUrl url = m_clip->fileURL();
+    m_view.clip_path->setText(url.path());
     m_view.clip_description->setText(m_clip->description());
     QMap <QString, QString> props = m_clip->properties();
-    if (props.contains("frame_size"))
-        m_view.clip_size->setText(props["frame_size"]);
-    if (props.contains("videocodec"))
-        m_view.clip_vcodec->setText(props["videocodec"]);
+
     if (props.contains("audiocodec"))
         m_view.clip_acodec->setText(props["audiocodec"]);
-    if (props.contains("fps"))
-        m_view.clip_fps->setText(props["fps"]);
     if (props.contains("frequency"))
         m_view.clip_frequency->setText(props["frequency"]);
     if (props.contains("channels"))
         m_view.clip_channels->setText(props["channels"]);
-    if (props.contains("aspect_ratio"))
-        m_view.clip_ratio->setText(props["aspect_ratio"]);
-    QPixmap pix = m_clip->thumbProducer()->getImage(m_clip->fileURL(), 240, 180);
-    m_view.clip_thumb->setPixmap(pix);
+
     CLIPTYPE t = m_clip->clipType();
-    if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(1);
+    if (t != AUDIO) {
+        if (props.contains("frame_size"))
+            m_view.clip_size->setText(props["frame_size"]);
+        if (props.contains("videocodec"))
+            m_view.clip_vcodec->setText(props["videocodec"]);
+        if (props.contains("fps"))
+            m_view.clip_fps->setText(props["fps"]);
+        if (props.contains("aspect_ratio"))
+            m_view.clip_ratio->setText(props["aspect_ratio"]);
+
+        QPixmap pix = m_clip->thumbProducer()->getImage(url, 240, 180);
+        m_view.clip_thumb->setPixmap(pix);
+        if (t == IMAGE || t == VIDEO) m_view.tabWidget->removeTab(1);
+    } else {
+        m_view.tabWidget->removeTab(0);
+        m_view.clip_thumb->setHidden(true);
+    }
+    if (t != IMAGE && t != COLOR) m_view.clip_duration->setReadOnly(true);
+
+    KFileItem f(KFileItem::Unknown, KFileItem::Unknown, url, true);
+    m_view.clip_filesize->setText(KIO::convertSize(f.size()));
+    m_view.clip_duration->setText(tc.getTimecode(m_clip->duration(), m_fps));
 }
 
 #include "clipproperties.moc"
index 3bb8728fa86cd6bef9e221a9b2f79a41e39bd0bb..a02d5db41bb7fdb75a4f5d60e10bdfbdf3bca01e 100644 (file)
 
 #include "definitions.h"
 #include "docclipbase.h"
+#include "timecode.h"
 #include "ui_clipproperties_ui.h"
 
 class ClipProperties : public QDialog {
     Q_OBJECT
 
 public:
-    ClipProperties(DocClipBase *clip, QWidget * parent = 0);
+    ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent = 0);
 
 
 private slots:
@@ -40,7 +41,8 @@ private slots:
 private:
     Ui::ClipProperties_UI m_view;
     DocClipBase *m_clip;
-
+    Timecode m_tc;
+    double m_fps;
 };
 
 
index fdfc143d3d2a3919704b425ea61d33e4302d5c08..344d692df825c29012c0f1701b5c82fc6f34093a 100644 (file)
@@ -32,18 +32,12 @@ DocClipBase::DocClipBase(ClipManager *clipManager, QDomElement xml, uint id):
     int out = xml.attribute("out").toInt();
     if (out != 0) setDuration(GenTime(out, 25));
     if (m_name.isEmpty()) m_name = url.fileName();
+
     if (!url.isEmpty()) {
         m_thumbProd = new KThumb(clipManager, url);
-        connect(m_thumbProd, SIGNAL(audioThumbReady(QMap <int, QMap <int, QByteArray> >)), this , SLOT(updateAudioThumbnail(QMap <int, QMap <int, QByteArray> >)));
-        connect(this, SIGNAL(getAudioThumbs()), this , SLOT(slotGetAudioThumbs()));
-
-    }
-    kDebug() << "type is video" << (m_clipType == AV) << " " << m_clipType;
-
-    if (m_clipType == AV || m_clipType == AUDIO || m_clipType == UNKNOWN) {
-        m_audioTimer = new QTimer(this);
-        connect(m_audioTimer, SIGNAL(timeout()), this, SLOT(slotGetAudioThumbs()));
+        if (m_clipType == AV || m_clipType == AUDIO) slotCreateAudioTimer();
     }
+    //kDebug() << "type is video" << (m_clipType == AV) << " " << m_clipType;
 }
 
 
@@ -72,6 +66,13 @@ DocClipBase::~DocClipBase() {
     if (m_thumbProd) delete m_thumbProd;
 }
 
+void DocClipBase::slotCreateAudioTimer() {
+    connect(m_thumbProd, SIGNAL(audioThumbReady(QMap <int, QMap <int, QByteArray> >)), this , SLOT(updateAudioThumbnail(QMap <int, QMap <int, QByteArray> >)));
+    connect(this, SIGNAL(getAudioThumbs()), this , SLOT(slotGetAudioThumbs()));
+    m_audioTimer = new QTimer(this);
+    connect(m_audioTimer, SIGNAL(timeout()), this, SLOT(slotGetAudioThumbs()));
+}
+
 void DocClipBase::slotRequestAudioThumbs() {
     emit getAudioThumbs();
 }
@@ -117,6 +118,8 @@ const CLIPTYPE & DocClipBase::clipType() const {
 
 void DocClipBase::setClipType(CLIPTYPE type) {
     m_clipType = type;
+    if (m_audioTimer == NULL && (m_clipType == AV || m_clipType == AUDIO))
+        slotCreateAudioTimer();
 }
 
 KUrl DocClipBase::fileURL() const {
index 68984b1cc289178a9061e4015aa16e67da283f9f..693d8caa7b04a86fd6b06a2db59bc8600932b933 100644 (file)
@@ -230,8 +230,10 @@ private:   // Private attributes
     uint m_id;
     uint m_projectThumbFrame;
     void setAudioThumbCreated(bool isDone);
-
+    /** Holds clip infos like fps, size,... */
     QMap <QString, QString> m_properties;
+    /** Create connections for audio thumbnails */
+    void slotCreateAudioTimer();
 
 public slots:
     void updateAudioThumbnail(QMap<int, QMap<int, QByteArray> > data);
index 8c6a5ec1b9638b17171e54b7e959a85e825aac29..1bea50b7f68a7c13a912ec83e6d294e66e1b228a 100644 (file)
@@ -893,7 +893,7 @@ void MainWindow::slotGotProgressInfo(KUrl url, int progress) {
 }
 
 void MainWindow::slotShowClipProperties(DocClipBase *clip) {
-    ClipProperties dia(clip);
+    ClipProperties dia(clip, m_activeDocument->timecode(), m_activeDocument->fps(), this);
     dia.exec();
 }
 
index 3e0f0f3979ec90bafbc8cdb0cf20926b6df67f9a..b57d2dcb5ee77f6b4fa5a815908f58598f066b1f 100644 (file)
@@ -5,46 +5,77 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>284</width>
-    <height>439</height>
+    <width>310</width>
+    <height>459</height>
    </rect>
   </property>
   <property name="windowTitle" >
-   <string>Dialog</string>
+   <string>Clip Properties</string>
   </property>
   <layout class="QGridLayout" name="gridLayout_2" >
-   <item row="1" column="0" >
+   <item row="0" column="0" colspan="4" >
+    <widget class="QLabel" name="clip_thumb" >
+     <property name="text" >
+      <string>Image preview</string>
+     </property>
+     <property name="alignment" >
+      <set>Qt::AlignCenter</set>
+     </property>
+    </widget>
+   </item>
+   <item row="1" column="0" colspan="4" >
     <widget class="QLabel" name="label_5" >
      <property name="text" >
       <string>Path</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="0" >
+   <item row="2" column="0" colspan="4" >
     <widget class="KLineEdit" name="clip_path" >
      <property name="readOnly" >
       <bool>true</bool>
      </property>
     </widget>
    </item>
-   <item row="3" column="0" >
+   <item row="3" column="0" colspan="4" >
     <widget class="QLabel" name="label_3" >
      <property name="text" >
       <string>Description</string>
      </property>
     </widget>
    </item>
-   <item row="4" column="0" >
+   <item row="4" column="0" colspan="4" >
     <widget class="KLineEdit" name="clip_description" />
    </item>
    <item row="5" column="0" >
+    <widget class="QLabel" name="clip_filesize_2" >
+     <property name="text" >
+      <string>Duration</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="1" >
+    <widget class="KRestrictedLine" name="clip_duration" >
+     <property name="inputMask" >
+      <string>99:99:99:99; </string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="2" >
+    <widget class="QLabel" name="clip_filesize_3" >
+     <property name="text" >
+      <string>Size:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="5" column="3" >
     <widget class="QLabel" name="clip_filesize" >
      <property name="text" >
-      <string>File size:</string>
+      <string>File size</string>
      </property>
     </widget>
    </item>
-   <item row="6" column="0" >
+   <item row="6" column="0" colspan="4" >
     <widget class="QTabWidget" name="tabWidget" >
      <property name="currentIndex" >
       <number>0</number>
@@ -54,8 +85,8 @@
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>264</width>
-        <height>187</height>
+        <width>290</width>
+        <height>171</height>
        </rect>
       </property>
       <attribute name="title" >
          </property>
         </widget>
        </item>
-       <item row="0" column="2" >
+       <item row="0" column="1" >
         <widget class="KLineEdit" name="clip_vcodec" >
          <property name="readOnly" >
           <bool>true</bool>
          </property>
         </widget>
        </item>
-       <item row="1" column="0" colspan="2" >
+       <item row="1" column="0" >
         <widget class="QLabel" name="label_6" >
          <property name="text" >
           <string>Frame size</string>
          </property>
         </widget>
        </item>
-       <item row="1" column="2" >
+       <item row="1" column="1" >
         <widget class="KLineEdit" name="clip_size" >
          <property name="readOnly" >
           <bool>true</bool>
          </property>
         </widget>
        </item>
-       <item row="2" column="0" colspan="2" >
+       <item row="2" column="0" >
         <widget class="QLabel" name="label_7" >
          <property name="text" >
           <string>Frame rate</string>
          </property>
         </widget>
        </item>
-       <item row="2" column="2" >
+       <item row="2" column="1" >
         <widget class="KLineEdit" name="clip_fps" >
          <property name="readOnly" >
           <bool>true</bool>
          </property>
         </widget>
        </item>
-       <item row="3" column="0" colspan="2" >
+       <item row="3" column="0" >
         <widget class="QLabel" name="label_12" >
          <property name="text" >
           <string>Aspect ratio</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="2" >
+       <item row="3" column="1" >
         <widget class="KLineEdit" name="clip_ratio" >
          <property name="readOnly" >
           <bool>true</bool>
          </property>
         </widget>
        </item>
-       <item row="4" column="1" colspan="2" >
+       <item row="4" column="1" >
         <spacer name="verticalSpacer_2" >
          <property name="orientation" >
           <enum>Qt::Vertical</enum>
          <property name="sizeHint" stdset="0" >
           <size>
            <width>77</width>
-           <height>68</height>
+           <height>52</height>
           </size>
          </property>
         </spacer>
        <rect>
         <x>0</x>
         <y>0</y>
-        <width>264</width>
-        <height>187</height>
+        <width>263</width>
+        <height>171</height>
        </rect>
       </property>
       <attribute name="title" >
          <property name="sizeHint" stdset="0" >
           <size>
            <width>20</width>
-           <height>35</height>
+           <height>19</height>
           </size>
          </property>
         </spacer>
      </widget>
     </widget>
    </item>
-   <item row="7" column="0" >
+   <item row="7" column="1" colspan="2" >
+    <spacer name="verticalSpacer_4" >
+     <property name="orientation" >
+      <enum>Qt::Vertical</enum>
+     </property>
+     <property name="sizeHint" stdset="0" >
+      <size>
+       <width>20</width>
+       <height>17</height>
+      </size>
+     </property>
+    </spacer>
+   </item>
+   <item row="8" column="0" colspan="4" >
     <widget class="QDialogButtonBox" name="buttonBox" >
      <property name="orientation" >
       <enum>Qt::Horizontal</enum>
      </property>
     </widget>
    </item>
-   <item row="0" column="0" >
-    <widget class="QLabel" name="clip_thumb" >
-     <property name="text" >
-      <string>Image preview</string>
-     </property>
-     <property name="alignment" >
-      <set>Qt::AlignCenter</set>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <customwidgets>
    <extends>QLineEdit</extends>
    <header>klineedit.h</header>
   </customwidget>
+  <customwidget>
+   <class>KRestrictedLine</class>
+   <extends>KLineEdit</extends>
+   <header>krestrictedline.h</header>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections>