]> git.sesse.net Git - kdenlive/commitdiff
Color clip dialog:
authorTill Theato <root@ttill.de>
Sat, 19 Jun 2010 18:46:56 +0000 (18:46 +0000)
committerTill Theato <root@ttill.de>
Sat, 19 Jun 2010 18:46:56 +0000 (18:46 +0000)
 - Restore color, which was selected the last time
 - Use TimecodeDisplay (but always display as HH:MM:SS:FF)
 - Use KColorCombo (drop down with a set of colors and a dialog to choose custom colors)

svn path=/trunk/kdenlive/; revision=4528

src/kdenlivesettings.kcfg
src/projectlist.cpp
src/projectlist.h
src/widgets/colorclip_ui.ui

index 7fadebf35cc1ae5c73a54d1f718ff6e8593ad669..58e4058b6270f3d83296bb876f76a3d27232fb84 100644 (file)
       <label>Show thumbnails in slideshow dialog.</label>
       <default>false</default>
     </entry>
+
     <entry name="showtitlebars" type="Bool">
       <label>Show dock widget titlebars to allow un/docking.</label>
       <default>true</default>
     </entry>    
+
+    <entry name="colorclipcolor" type="Color">
+      <label>Color to preselect in the color clip dialog.</label>
+      <default>#000000</default>
+    </entry>
   </group>
 </kcfg>
index c88815744a048ff82b5afa46dd65ebbb4a080998..d6e13f76b446fa5a14a0e8d1b4fc51620f4003a7 100644 (file)
@@ -31,6 +31,7 @@
 #include "renderer.h"
 #include "kthumb.h"
 #include "projectlistview.h"
+#include "timecodedisplay.h"
 #include "editclipcommand.h"
 #include "editclipcutcommand.h"
 #include "editfoldercommand.h"
@@ -1059,23 +1060,29 @@ void ProjectList::slotRemoveInvalidClip(const QString &id, bool replace)
 
 void ProjectList::slotAddColorClip()
 {
-    if (!m_commandStack) {
+    if (!m_commandStack)
         kDebug() << "!!!!!!!!!!!!!!!! NO CMD STK";
-    }
+
     QDialog *dia = new QDialog(this);
     Ui::ColorClip_UI dia_ui;
     dia_ui.setupUi(dia);
     dia->setWindowTitle(i18n("Color Clip"));
     dia_ui.clip_name->setText(i18n("Color Clip"));
-    dia_ui.clip_duration->setInputMask("");
-    dia_ui.clip_duration->setValidator(m_timecode.validator());
-    dia_ui.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::color_duration()));
+
+    TimecodeDisplay *t = new TimecodeDisplay(m_timecode);
+    t->setValue(KdenliveSettings::color_duration());
+    t->setTimeCodeFormat(false);
+    dia_ui.clip_durationBox->addWidget(t);
+    dia_ui.clip_color->setColor(KdenliveSettings::colorclipcolor());
+
     if (dia->exec() == QDialog::Accepted) {
         QString color = dia_ui.clip_color->color().name();
+        KdenliveSettings::setColorclipcolor(color);
         color = color.replace(0, 1, "0x") + "ff";
         QStringList groupInfo = getGroup();
-        m_doc->slotCreateColorClip(dia_ui.clip_name->text(), color, dia_ui.clip_duration->text(), groupInfo.at(0), groupInfo.at(1));
+        m_doc->slotCreateColorClip(dia_ui.clip_name->text(), color, m_timecode.getTimecode(t->gentime()), groupInfo.at(0), groupInfo.at(1));
     }
+    delete t;
     delete dia;
 }
 
index 376c9c60c5183108e756ae749dc8cfb29a117543..5d12e21aae2d41669f384932e18ba87d8fe02c7b 100644 (file)
@@ -183,6 +183,8 @@ public slots:
     void slotOpenClip();
     void slotEditClip();
     void slotReloadClip(const QString &id = QString());
+
+    /** @brief Shows dialog for setting up a color clip. */
     void slotAddColorClip();
     void regenerateTemplate(const QString &id);
     void slotUpdateClipCut(QPoint p);
index 272f5588fcee8865ddbf7c04cf3ead458b9e3ef2..67087d36d3c9efa2791d4734d78bb82dd45f1d5c 100644 (file)
@@ -1,66 +1,65 @@
-<ui version="4.0" >
+<?xml version="1.0" encoding="UTF-8"?>
+<ui version="4.0">
  <class>ColorClip_UI</class>
- <widget class="QDialog" name="ColorClip_UI" >
-  <property name="geometry" >
+ <widget class="QDialog" name="ColorClip_UI">
+  <property name="geometry">
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>286</width>
-    <height>176</height>
+    <width>200</width>
+    <height>124</height>
    </rect>
   </property>
-  <property name="windowTitle" >
+  <property name="windowTitle">
    <string>Dialog</string>
   </property>
-  <layout class="QGridLayout" >
-   <item row="0" column="0" >
-    <widget class="QLabel" name="label_3" >
-     <property name="text" >
+  <layout class="QGridLayout">
+   <item row="0" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
       <string>Name</string>
      </property>
     </widget>
    </item>
-   <item row="0" column="1" colspan="2" >
-    <widget class="KLineEdit" name="clip_name" />
+   <item row="0" column="1">
+    <widget class="KLineEdit" name="clip_name"/>
    </item>
-   <item row="1" column="0" >
-    <widget class="QLabel" name="label" >
-     <property name="text" >
+   <item row="1" column="0">
+    <widget class="QLabel" name="label">
+     <property name="text">
       <string>Clip Color</string>
      </property>
     </widget>
    </item>
-   <item row="1" column="1" colspan="2" >
-    <widget class="KColorButton" name="clip_color" >
-     <property name="color" >
-      <color>
-       <red>0</red>
-       <green>0</green>
-       <blue>0</blue>
-      </color>
-     </property>
-    </widget>
-   </item>
-   <item row="2" column="0" >
-    <widget class="QLabel" name="label_2" >
-     <property name="text" >
+   <item row="2" column="0">
+    <widget class="QLabel" name="label_2">
+     <property name="text">
       <string>Duration</string>
      </property>
     </widget>
    </item>
-   <item row="2" column="1" colspan="2" >
-    <widget class="KRestrictedLine" name="clip_duration" >
-     <property name="inputMask" >
-      <string>99:99:99:99; </string>
+   <item row="4" column="0" colspan="3">
+    <widget class="QDialogButtonBox" name="buttonBox">
+     <property name="orientation">
+      <enum>Qt::Horizontal</enum>
+     </property>
+     <property name="standardButtons">
+      <set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
      </property>
     </widget>
    </item>
-   <item row="3" column="2" >
+   <item row="2" column="1">
+    <layout class="QHBoxLayout" name="clip_durationBox"/>
+   </item>
+   <item row="1" column="1">
+    <widget class="KColorCombo" name="clip_color"/>
+   </item>
+   <item row="3" column="1">
     <spacer>
-     <property name="orientation" >
+     <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
-     <property name="sizeHint" >
+     <property name="sizeHint" stdset="0">
       <size>
        <width>20</width>
        <height>31</height>
      </property>
     </spacer>
    </item>
-   <item row="4" column="0" colspan="3" >
-    <widget class="QDialogButtonBox" name="buttonBox" >
-     <property name="orientation" >
-      <enum>Qt::Horizontal</enum>
-     </property>
-     <property name="standardButtons" >
-      <set>QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
-     </property>
-    </widget>
-   </item>
   </layout>
  </widget>
  <customwidgets>
-  <customwidget>
-   <class>KColorButton</class>
-   <extends>QPushButton</extends>
-   <header>kcolorbutton.h</header>
-  </customwidget>
   <customwidget>
    <class>KLineEdit</class>
    <extends>QLineEdit</extends>
    <header>klineedit.h</header>
   </customwidget>
   <customwidget>
-   <class>KRestrictedLine</class>
-   <extends>KLineEdit</extends>
-   <header>krestrictedline.h</header>
+   <class>KColorCombo</class>
+   <extends>QComboBox</extends>
+   <header>kcolorcombo.h</header>
   </customwidget>
  </customwidgets>
  <resources/>
    <receiver>ColorClip_UI</receiver>
    <slot>accept()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>248</x>
      <y>254</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>157</x>
      <y>274</y>
     </hint>
    <receiver>ColorClip_UI</receiver>
    <slot>reject()</slot>
    <hints>
-    <hint type="sourcelabel" >
+    <hint type="sourcelabel">
      <x>316</x>
      <y>260</y>
     </hint>
-    <hint type="destinationlabel" >
+    <hint type="destinationlabel">
      <x>286</x>
      <y>274</y>
     </hint>