]> git.sesse.net Git - kdenlive/blobdiff - src/clipproperties.cpp
add explicit keyword when necessary. Add const ref when necessary
[kdenlive] / src / clipproperties.cpp
index 9ba02d3c211a23c3953bf72131316b79dbe53eb6..2bc19e620b84b7d4a0a448472e8c5eee75d7db6a 100644 (file)
@@ -57,13 +57,14 @@ static const int ADVANCEDTAB = 7;
 
 
 ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidget * parent) :
-    QDialog(parent),
-    m_clip(clip),
-    m_tc(tc),
-    m_fps(fps),
-    m_count(0),
-    m_clipNeedsRefresh(false),
-    m_clipNeedsReLoad(false)
+    QDialog(parent)
+    , m_clip(clip)
+    , m_tc(tc)
+    , m_fps(fps)
+    , m_count(0)
+    , m_clipNeedsRefresh(false)
+    , m_clipNeedsReLoad(false)
+    , m_proxyContainer(NULL)
 {
     setAttribute(Qt::WA_DeleteOnClose, true);
     setFont(KGlobalSettings::toolBarFont());
@@ -196,12 +197,42 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
     connect(m_view.clip_full_luma, SIGNAL(toggled(bool)), this, SLOT(slotModified()));
 
     // Check for Metadata
-    QMap<QString, QString> meta = m_clip->metadata();
-    QMap<QString, QString>::const_iterator i = meta.constBegin();
+    QMap<QString, QStringList> meta = m_clip->metadata();
+    QMap<QString, QStringList>::const_iterator i = meta.constBegin();
     while (i != meta.constEnd()) {
-        QTreeWidgetItem *metaitem = new QTreeWidgetItem(m_view.metadata_list);
+       QStringList values = i.value();
+       QString parentName;
+       QString iconName;
+       if (values.count() > 1 && !values.at(1).isEmpty()) parentName = values.at(1);
+       else {
+           if (KdenliveSettings::ffmpegpath().endsWith("avconv")) {
+               parentName = i18n("Libav");
+               iconName = "meta_libav.png";
+           }
+           else {
+               parentName = i18n("FFmpeg");
+               iconName = "meta_ffmpeg.png";
+           }
+       }
+       QTreeWidgetItem *parent = NULL;
+       QList <QTreeWidgetItem *> matches = m_view.metadata_list->findItems(parentName, Qt::MatchExactly);
+       if (!matches.isEmpty()) parent = matches.at(0);
+       else {
+           if (parentName == "Magic Lantern") iconName = "meta_magiclantern.png";
+           parent = new QTreeWidgetItem(m_view.metadata_list, QStringList() << parentName);
+           if (!iconName.isEmpty()) {
+               KIcon icon(KStandardDirs::locate("appdata", iconName));
+               parent->setIcon(0, icon);
+           }
+       }
+       QTreeWidgetItem *metaitem = NULL;
+        if (parent) {
+           metaitem = new QTreeWidgetItem(parent);
+           parent->setExpanded(true);
+       }
+       else metaitem = new QTreeWidgetItem(m_view.metadata_list);
         metaitem->setText(0, i.key()); //i18n(i.key().section('.', 2, 3).toUtf8().data()));
-        metaitem->setText(1, i.value());
+        metaitem->setText(1, values.at(0));
         ++i;
     }
 
@@ -469,7 +500,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
             m_view.clip_license->setText(i18n("License: %1", res.property(Nepomuk::Vocabulary::NIE::license()).toString()));
             if (ltype.startsWith("http")) {
                 m_view.clip_license->setUrl(ltype);
-                connect(m_view.clip_license, SIGNAL(leftClickedUrl(const QString &)), this, SLOT(slotOpenUrl(const QString &)));
+                connect(m_view.clip_license, SIGNAL(leftClickedUrl(QString)), this, SLOT(slotOpenUrl(QString)));
             }
         }
         else m_view.clip_license->setHidden(true);
@@ -490,7 +521,7 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
     connect(m_view.marker_delete, SIGNAL(clicked()), this, SLOT(slotDeleteMarker()));
     connect(m_view.marker_save, SIGNAL(clicked()), this, SLOT(slotSaveMarkers()));
     connect(m_view.marker_load, SIGNAL(clicked()), this, SLOT(slotLoadMarkers()));
-    connect(m_view.markers_list, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(slotEditMarker()));
+    connect(m_view.markers_list, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(slotEditMarker()));
     
     connect(m_view.analysis_delete, SIGNAL(clicked()), this, SLOT(slotDeleteAnalysis()));
     connect(m_view.analysis_save, SIGNAL(clicked()), this, SLOT(slotSaveAnalysis()));
@@ -499,6 +530,10 @@ ClipProperties::ClipProperties(DocClipBase *clip, Timecode tc, double fps, QWidg
     connect(this, SIGNAL(accepted()), this, SLOT(slotApplyProperties()));
     connect(m_view.buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(slotApplyProperties()));
     m_view.buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
+    
+    m_view.metadata_list->resizeColumnToContents(0);
+    m_view.clip_vproperties->resizeColumnToContents(0);
+    m_view.clip_aproperties->resizeColumnToContents(0);
     adjustSize();
 }