]> git.sesse.net Git - kdenlive/commitdiff
Show the recently introduced colorspace info in profile dialogs
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 28 Sep 2010 16:21:10 +0000 (16:21 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Tue, 28 Sep 2010 16:21:10 +0000 (16:21 +0000)
svn path=/trunk/kdenlive/; revision=4950

src/definitions.h
src/profilesdialog.cpp
src/profilesdialog.h
src/projectsettings.cpp
src/widgets/profiledialog_ui.ui
src/widgets/projectsettings_ui.ui

index 33bffbd447ad3aa0a0bb07eb435009da80ecb195..f67c473608d0b7886467d61fdd63301bf067f46d 100644 (file)
@@ -91,6 +91,7 @@ struct MltVideoProfile {
     int sample_aspect_den;
     int display_aspect_num;
     int display_aspect_den;
+    int colorspace;
 };
 
 
@@ -149,7 +150,7 @@ class CommentedTime
 public:
     CommentedTime(): t(GenTime(0)) {}
     CommentedTime(const GenTime time, QString comment)
-            : t(time), c(comment) { }
+        : t(time), c(comment) { }
 
     QString comment()   const          {
         return (c.isEmpty() ? i18n("Marker") : c);
index fca5e8eac2a9e3693ba22159096e91515f570134..0486072fad815a8a0924f957ec443a43764178d0 100644 (file)
@@ -35,6 +35,12 @@ ProfilesDialog::ProfilesDialog(QWidget * parent) :
 {
     m_view.setupUi(this);
 
+    // Fill colorspace list (see mlt_profile.h)
+    m_view.colorspace->addItem(getColorspaceDescription(601), 601);
+    m_view.colorspace->addItem(getColorspaceDescription(709), 709);
+    m_view.colorspace->addItem(getColorspaceDescription(240), 240);
+    m_view.colorspace->addItem(getColorspaceDescription(0), 0);
+
     QStringList profilesFilter;
     profilesFilter << "*";
 
@@ -167,7 +173,7 @@ void ProfilesDialog::saveProfile(const QString path)
         return;
     }
     QTextStream out(&file);
-    out << "description=" << m_view.description->text() << "\n" << "frame_rate_num=" << m_view.frame_num->value() << "\n" << "frame_rate_den=" << m_view.frame_den->value() << "\n" << "width=" << m_view.size_w->value() << "\n" << "height=" << m_view.size_h->value() << "\n" << "progressive=" << m_view.progressive->isChecked() << "\n" << "sample_aspect_num=" << m_view.aspect_num->value() << "\n" << "sample_aspect_den=" << m_view.aspect_den->value() << "\n" << "display_aspect_num=" << m_view.display_num->value() << "\n" << "display_aspect_den=" << m_view.display_den->value() << "\n";
+    out << "description=" << m_view.description->text() << "\n" << "frame_rate_num=" << m_view.frame_num->value() << "\n" << "frame_rate_den=" << m_view.frame_den->value() << "\n" << "width=" << m_view.size_w->value() << "\n" << "height=" << m_view.size_h->value() << "\n" << "progressive=" << m_view.progressive->isChecked() << "\n" << "sample_aspect_num=" << m_view.aspect_num->value() << "\n" << "sample_aspect_den=" << m_view.aspect_den->value() << "\n" << "display_aspect_num=" << m_view.display_num->value() << "\n" << "display_aspect_den=" << m_view.display_den->value() << "\n" << "colorspace=" << m_view.colorspace->itemData(m_view.colorspace->currentIndex()).toInt() << "\n";
     if (file.error() != QFile::NoError) {
         KMessageBox::error(this, i18n("Cannot write to file %1", path));
     }
@@ -225,6 +231,7 @@ MltVideoProfile ProfilesDialog::getVideoProfile(QString name)
     result.sample_aspect_den = confFile.entryMap().value("sample_aspect_den").toInt();
     result.display_aspect_num = confFile.entryMap().value("display_aspect_num").toInt();
     result.display_aspect_den = confFile.entryMap().value("display_aspect_den").toInt();
+    result.colorspace = confFile.entryMap().value("colorspace").toInt();
     return result;
 }
 
@@ -288,6 +295,7 @@ QString ProfilesDialog::existingProfile(MltVideoProfile profile)
         if (profile.frame_rate_den != confFile.entryMap().value("frame_rate_den").toInt()) continue;
         if (profile.frame_rate_num != confFile.entryMap().value("frame_rate_num").toInt()) continue;
         if (profile.progressive != confFile.entryMap().value("progressive").toInt()) continue;
+        if (profile.colorspace != confFile.entryMap().value("colorspace").toInt()) continue;
         return profilesFiles.at(i);
     }
 
@@ -306,6 +314,7 @@ QString ProfilesDialog::existingProfile(MltVideoProfile profile)
             if (profile.frame_rate_den != confFile.entryMap().value("frame_rate_den").toInt()) continue;
             if (profile.frame_rate_num != confFile.entryMap().value("frame_rate_num").toInt()) continue;
             if (profile.progressive != confFile.entryMap().value("progressive").toInt()) continue;
+            if (profile.colorspace != confFile.entryMap().value("colorspace").toInt()) continue;
             return customProfiles.at(i) + profilesFiles.at(j);
         }
     }
@@ -497,7 +506,7 @@ void ProfilesDialog::saveProfile(MltVideoProfile &profile)
         return;
     }
     QTextStream out(&file);
-    out << "description=" << profile.description << "\n" << "frame_rate_num=" << profile.frame_rate_num << "\n" << "frame_rate_den=" << profile.frame_rate_den << "\n" << "width=" << profile.width << "\n" << "height=" << profile.height << "\n" << "progressive=" << profile.progressive << "\n" << "sample_aspect_num=" << profile.sample_aspect_num << "\n" << "sample_aspect_den=" << profile.sample_aspect_den << "\n" << "display_aspect_num=" << profile.display_aspect_num << "\n" << "display_aspect_den=" << profile.display_aspect_den << "\n";
+    out << "description=" << profile.description << "\n" << "frame_rate_num=" << profile.frame_rate_num << "\n" << "frame_rate_den=" << profile.frame_rate_den << "\n" << "width=" << profile.width << "\n" << "height=" << profile.height << "\n" << "progressive=" << profile.progressive << "\n" << "sample_aspect_num=" << profile.sample_aspect_num << "\n" << "sample_aspect_den=" << profile.sample_aspect_den << "\n" << "display_aspect_num=" << profile.display_aspect_num << "\n" << "display_aspect_den=" << profile.display_aspect_den << "\n" << "colorspace=" << profile.colorspace << "\n";
     if (file.error() != QFile::NoError) {
         KMessageBox::error(0, i18n("Cannot write to file %1", profilePath));
     }
@@ -538,9 +547,27 @@ void ProfilesDialog::slotUpdateDisplay()
     } else {
         m_view.fields->setText(QString::number((double) 2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2));
     }
+
+    int colorix = m_view.colorspace->findData(values.value("colorspace").toInt());
+    if (colorix > -1) m_view.colorspace->setCurrentIndex(colorix);
     m_profileIsModified = false;
 }
 
+//static
+QString ProfilesDialog::getColorspaceDescription(int colorspace)
+{
+    //TODO: should the descriptions be translated?
+    switch (colorspace) {
+    case 601:
+        return QString("ITU-R 601");
+    case 709:
+        return QString("ITU-R 709");
+    case 240:
+        return QString("SMPTE240M");
+    default:
+        return i18n("Unknown");
+    }
+}
 
 #include "profilesdialog.moc"
 
index 54d263afbcbbd9385a6c193fcec9043db99ddd54..ef4ea0865972f7eeca04b44d05ea0791a8915220 100644 (file)
@@ -67,6 +67,11 @@ public:
      *  @return the evaluated value */
     static double getStringEval(const MltVideoProfile &profile, QString eval);
 
+    /** @brief Get the descriptive text for given colorspace code (defined by MLT)
+     *  @param colorspace An int as defined in mlt_profile.h
+     *  @return The string description */
+    static QString getColorspaceDescription(int colorspace);
+
 protected:
     virtual void closeEvent(QCloseEvent *event);
 
index fdfdb832d38f8012ceb17dff0c52f50b9d017ab2..bed29b1e9fe4817ffffe9f3593a4144f71ddb9ee 100644 (file)
@@ -34,7 +34,7 @@
 #include <kmessagebox.h>
 
 ProjectSettings::ProjectSettings(ProjectList *projectlist, QStringList lumas, int videotracks, int audiotracks, const QString projectPath, bool readOnlyTracks, bool savedProject, QWidget * parent) :
-        QDialog(parent), m_savedProject(savedProject), m_projectList(projectlist), m_lumas(lumas)
+    QDialog(parent), m_savedProject(savedProject), m_projectList(projectlist), m_lumas(lumas)
 {
     setupUi(this);
 
@@ -198,10 +198,11 @@ void ProjectSettings::slotUpdateDisplay()
     p_display->setText(values.value("display_aspect_num") + '/' + values.value("display_aspect_den"));
     if (values.value("progressive").toInt() == 0) {
         p_progressive->setText(i18n("Interlaced (%1 fields per second)",
-                                    QString::number((double)2*values.value("frame_rate_num").toInt()/values.value("frame_rate_den").toInt(), 'f', 2)));
+                                    QString::number((double)2 * values.value("frame_rate_num").toInt() / values.value("frame_rate_den").toInt(), 'f', 2)));
     } else {
         p_progressive->setText(i18n("Progressive"));
     }
+    p_colorspace->setText(ProfilesDialog::getColorspaceDescription(values.value("colorspace").toInt()));
 }
 
 void ProjectSettings::slotUpdateButton(const QString &path)
index 5a385c85c5d88c69bb726f200964179c6763e740..f326bfb58316adb1bfdc8b3429baf83794111b83 100644 (file)
@@ -6,8 +6,8 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>385</width>
-    <height>332</height>
+    <width>334</width>
+    <height>296</height>
    </rect>
   </property>
   <property name="windowTitle">
         </property>
        </widget>
       </item>
-      <item row="6" column="0" colspan="4">
-       <widget class="QCheckBox" name="progressive">
-        <property name="text">
-         <string>Progressive</string>
-        </property>
-       </widget>
-      </item>
-      <item row="7" column="0" colspan="2">
+      <item row="9" column="0" colspan="2">
        <spacer name="verticalSpacer">
         <property name="orientation">
          <enum>Qt::Vertical</enum>
         </property>
        </widget>
       </item>
+      <item row="7" column="0">
+       <widget class="QLabel" name="label_12">
+        <property name="text">
+         <string>Colorspace</string>
+        </property>
+       </widget>
+      </item>
+      <item row="7" column="1" colspan="3">
+       <widget class="KComboBox" name="colorspace"/>
+      </item>
+      <item row="8" column="0">
+       <widget class="QCheckBox" name="progressive">
+        <property name="text">
+         <string>Progressive</string>
+        </property>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
   </layout>
  </widget>
  <customwidgets>
+  <customwidget>
+   <class>KIntSpinBox</class>
+   <extends>QSpinBox</extends>
+   <header>knuminput.h</header>
+  </customwidget>
   <customwidget>
    <class>KPushButton</class>
    <extends>QPushButton</extends>
    <extends>QComboBox</extends>
    <header>kcombobox.h</header>
   </customwidget>
-  <customwidget>
-   <class>KIntSpinBox</class>
-   <extends>QSpinBox</extends>
-   <header>knuminput.h</header>
-  </customwidget>
  </customwidgets>
  <resources/>
  <connections>
index da2dca9064c402aaae62dc7cade762412c30a5e1..6f5c4e681966912cf54d620b9fac4d1e6db5aff2 100644 (file)
@@ -6,7 +6,7 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>349</width>
+    <width>295</width>
     <height>320</height>
    </rect>
   </property>
@@ -23,7 +23,7 @@
       <attribute name="title">
        <string>Settings</string>
       </attribute>
-      <layout class="QGridLayout" name="gridLayout_3">
+      <layout class="QGridLayout" name="gridLayout_2">
        <item row="0" column="0">
         <widget class="QLabel" name="label_4">
          <property name="text">
@@ -39,7 +39,7 @@
          <property name="title">
           <string>Video Profile</string>
          </property>
-         <layout class="QGridLayout" name="gridLayout_2">
+         <layout class="QGridLayout" name="gridLayout">
           <item row="0" column="0">
            <widget class="QLabel" name="label">
             <property name="text">
           <item row="0" column="1">
            <widget class="KComboBox" name="profiles_list"/>
           </item>
-          <item row="1" column="0" colspan="2">
-           <layout class="QGridLayout" name="gridLayout">
-            <item row="0" column="0">
-             <widget class="QLabel" name="label_5">
-              <property name="text">
-               <string>Size:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="1">
-             <widget class="QLabel" name="p_size">
-              <property name="text">
-               <string>720x576</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="2">
-             <widget class="QLabel" name="label_3">
-              <property name="text">
-               <string>Frame rate:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="0" column="3">
-             <widget class="QLabel" name="p_fps">
-              <property name="text">
-               <string>25/1</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="0">
-             <widget class="QLabel" name="label_9">
-              <property name="text">
-               <string>Pixel aspect ratio:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="1">
-             <widget class="QLabel" name="p_aspect">
-              <property name="text">
-               <string>59/54</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="2">
-             <widget class="QLabel" name="label_10">
-              <property name="text">
-               <string>Display aspect ratio:</string>
-              </property>
-             </widget>
-            </item>
-            <item row="1" column="3">
-             <widget class="QLabel" name="p_display">
-              <property name="text">
-               <string>4/3</string>
-              </property>
-             </widget>
-            </item>
-           </layout>
+          <item row="1" column="0">
+           <widget class="QLabel" name="label_5">
+            <property name="text">
+             <string>Size:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="1" column="1">
+           <widget class="QLabel" name="p_size">
+            <property name="text">
+             <string>720x576</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="0">
+           <widget class="QLabel" name="label_3">
+            <property name="text">
+             <string>Frame rate:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="2" column="1">
+           <widget class="QLabel" name="p_fps">
+            <property name="text">
+             <string>25/1</string>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="0">
+           <widget class="QLabel" name="label_9">
+            <property name="text">
+             <string>Pixel aspect ratio:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="3" column="1">
+           <widget class="QLabel" name="p_aspect">
+            <property name="text">
+             <string>59/54</string>
+            </property>
+           </widget>
+          </item>
+          <item row="4" column="0">
+           <widget class="QLabel" name="label_10">
+            <property name="text">
+             <string>Display aspect ratio:</string>
+            </property>
+           </widget>
+          </item>
+          <item row="4" column="1">
+           <widget class="QLabel" name="p_display">
+            <property name="text">
+             <string>4/3</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="0">
+           <widget class="QLabel" name="label_15">
+            <property name="text">
+             <string>Colorspace</string>
+            </property>
+           </widget>
+          </item>
+          <item row="5" column="1">
+           <widget class="QLabel" name="p_colorspace">
+            <property name="text">
+             <string/>
+            </property>
+           </widget>
           </item>
-          <item row="2" column="0" colspan="2">
+          <item row="6" column="0" colspan="2">
            <widget class="QLabel" name="p_progressive">
             <property name="text">
              <string>Interlaced</string>
          </property>
         </widget>
        </item>
-       <item row="3" column="3" colspan="3">
+       <item row="3" column="3" colspan="2">
         <spacer name="horizontalSpacer">
          <property name="orientation">
           <enum>Qt::Horizontal</enum>
          </property>
         </spacer>
        </item>
-       <item row="4" column="0" colspan="3">
+       <item row="4" column="0" colspan="2">
         <spacer name="verticalSpacer">
          <property name="orientation">
           <enum>Qt::Vertical</enum>