m_ui.buttonSave->setToolTip(i18n("Save effect"));
m_ui.buttonReset->setIcon(KIcon("view-refresh"));
m_ui.buttonReset->setToolTip(i18n("Reset effect"));
+ m_ui.checkAll->setToolTip(i18n("Enable/Disable all effects"));
- m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop);//use internal if drop is recognised right
+ m_ui.effectlist->setDragDropMode(QAbstractItemView::NoDragDrop); //use internal if drop is recognised right
connect(m_ui.effectlist, SIGNAL(itemSelectionChanged()), this , SLOT(slotItemSelectionChanged()));
connect(m_ui.effectlist, SIGNAL(itemChanged(QListWidgetItem *)), this , SLOT(slotItemChanged(QListWidgetItem *)));
connect(m_ui.buttonDel, SIGNAL(clicked()), this, SLOT(slotItemDel()));
connect(m_ui.buttonSave, SIGNAL(clicked()), this, SLOT(slotSaveEffect()));
connect(m_ui.buttonReset, SIGNAL(clicked()), this, SLOT(slotResetEffect()));
+ connect(m_ui.checkAll, SIGNAL(stateChanged(int)), this, SLOT(slotCheckAll(int)));
connect(m_effectedit, SIGNAL(parameterChanged(const QDomElement, const QDomElement)), this , SLOT(slotUpdateEffectParams(const QDomElement, const QDomElement)));
connect(m_effectedit, SIGNAL(seekTimeline(int)), this , SLOT(slotSeekTimeline(int)));
m_effectLists["audio"] = &MainWindow::audioEffects;
effectprops.setAttribute("id", name);
effectprops.setAttribute("type", "custom");
-
QFile file(path);
if (file.open(QFile::WriteOnly | QFile::Truncate)) {
QTextStream out(&file);
m_effectedit->updateParameter("disable", QString::number((int) disable));
emit changeEffectState(m_clipref, activeRow, disable);
}
+ slotUpdateCheckAllButton();
}
m_ui.buttonReset->setEnabled(false);
m_ui.buttonUp->setEnabled(false);
m_ui.buttonDown->setEnabled(false);
+ m_ui.checkAll->setEnabled(false);
} else {
if (ix < 0) ix = 0;
if (ix > m_ui.effectlist->count() - 1) ix = m_ui.effectlist->count() - 1;
m_ui.effectlist->setCurrentRow(ix);
+ m_ui.checkAll->setEnabled(true);
}
m_ui.effectlist->blockSignals(false);
if (m_ui.effectlist->count() == 0) m_effectedit->transferParamDesc(QDomElement(), 0, 0);
else slotItemSelectionChanged(false);
+ slotUpdateCheckAllButton();
}
void EffectStackView::slotItemSelectionChanged(bool update)
bool isChecked = false;
if (hasItem && m_ui.effectlist->currentItem()->checkState() == Qt::Checked) isChecked = true;
if (hasItem && m_ui.effectlist->currentItem()->isSelected()) {
- m_effectedit->transferParamDesc(m_clipref->effectAt(activeRow), m_clipref->cropStart().frames(KdenliveSettings::project_fps()), m_clipref->cropDuration().frames(KdenliveSettings::project_fps()));//minx max frame
+ m_effectedit->transferParamDesc(m_clipref->effectAt(activeRow),
+ m_clipref->cropStart().frames(KdenliveSettings::project_fps()),
+ m_clipref->cropDuration().frames(KdenliveSettings::project_fps())); //minx max frame
}
if (m_clipref && update) m_clipref->setSelectedEffect(activeRow);
m_ui.buttonDel->setEnabled(hasItem);
int activeRow = m_ui.effectlist->currentRow();
if (activeRow >= 0) {
emit removeEffect(m_clipref, m_clipref->effectAt(activeRow));
+ slotUpdateCheckAllButton();
}
}
m_ui.buttonReset->setEnabled(false);
m_ui.buttonUp->setEnabled(false);
m_ui.buttonDown->setEnabled(false);
+ m_ui.checkAll->setEnabled(false);
m_effectedit->transferParamDesc(QDomElement(), 0, 0);
m_ui.effectlist->blockSignals(false);
}
void EffectStackView::slotSeekTimeline(int pos)
{
- if (!m_clipref) return;
- emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
+ if (m_clipref)
+ emit seekTimeline(m_clipref->startPos().frames(KdenliveSettings::project_fps()) + pos);
+}
+
+void EffectStackView::slotUpdateCheckAllButton()
+{
+ bool hasEnabled = false;
+ bool hasDisabled = false;
+ for (int i = 0; i < m_ui.effectlist->count(); ++i) {
+ if (m_ui.effectlist->item(i)->checkState() == Qt::Checked)
+ hasEnabled = true;
+ else
+ hasDisabled = true;
+ }
+
+ m_ui.checkAll->blockSignals(true);
+ if (hasEnabled && hasDisabled)
+ m_ui.checkAll->setCheckState(Qt::PartiallyChecked);
+ else if (hasEnabled)
+ m_ui.checkAll->setCheckState(Qt::Checked);
+ else
+ m_ui.checkAll->setCheckState(Qt::Unchecked);
+ m_ui.checkAll->blockSignals(false);
+}
+
+void EffectStackView::slotCheckAll(int state)
+{
+ if (state == 1) {
+ state = 2;
+ m_ui.checkAll->blockSignals(true);
+ m_ui.checkAll->setCheckState(Qt::Checked);
+ m_ui.checkAll->blockSignals(false);
+ }
+
+ for (int i = 0; i < m_ui.effectlist->count(); ++i)
+ m_ui.effectlist->item(i)->setCheckState((Qt::CheckState)state);
}
#include "effectstackview.moc"
***************************************************************************/
/**
-* @class EffectStackView
-* @brief View part of the EffectStack
-* @author Marco Gittler
-*/
+ * @class EffectStackView
+ * @brief View part of the EffectStack
+ * @author Marco Gittler
+ */
#ifndef EFFECTSTACKVIEW_H
#define EFFECTSTACKVIEW_H
public:
EffectStackView(QWidget *parent = 0);
virtual ~EffectStackView();
- void raiseWindow(QWidget*);
+
+ /** @brief Raises @param dock if a clip is loaded. */
+ void raiseWindow(QWidget* dock);
+
+ /** @brief Clears the list of effects and updates the buttons accordingly. */
void clear();
+
+ /** @brief Sets the add effect button's menu to @param menu. */
void setMenu(QMenu *menu);
+
+ /** @brief Passes updates on @param profile and @param t on to the effect editor. */
void updateProjectFormat(MltVideoProfile profile, Timecode t);
+
+ /** @brief Tells the effect editor to update its timecode format. */
void updateTimecodeFormat();
private:
ClipItem* m_clipref;
QMap<QString, EffectsList*> m_effectLists;
EffectStackEdit* m_effectedit;
+
+ /** @brief Sets the list of effects according to the clip's effect list.
+ * @param ix Number of the effect to preselect */
void setupListView(int ix);
- //void updateButtonStatus();
public slots:
- void slotClipItemSelected(ClipItem*, int ix);
- void slotUpdateEffectParams(const QDomElement, const QDomElement);
- /** @brief Remove selected effect. */
+ /** @brief Sets the clip whose effect list should be managed.
+ * @param c Clip whose effect list should be managed
+ * @param ix Effect to preselect */
+ void slotClipItemSelected(ClipItem* c, int ix);
+
+ /** @brief Emits updateClipEffect.
+ * @param old Old effect information
+ * @param e New effect information
+ *
+ * Connected to a parameter change in the editor */
+ void slotUpdateEffectParams(const QDomElement old, const QDomElement e);
+
+ /** @brief Removes the selected effect. */
void slotItemDel();
private slots:
+ /** @brief Updates buttons and the editor according to selected effect.
+ * @param update (optional) Set the clip's selected effect (display keyframes in timeline) */
void slotItemSelectionChanged(bool update = true);
+
+ /** @brief Moves the selected effect upwards. */
void slotItemUp();
+
+ /** @brief Moves the selected effect downwards. */
void slotItemDown();
+
+ /** @brief Resets the selected effect to its default values. */
void slotResetEffect();
+
+ /** @brief Updates effect @param item if it was enabled or disabled. */
void slotItemChanged(QListWidgetItem *item);
+
+ /** @brief Saves the selected effect's values to a custom effect.
+ *
+ * TODO: save all effects into one custom effect */
void slotSaveEffect();
+
+ /** @brief Emits seekTimeline with position = clipstart + @param pos. */
void slotSeekTimeline(int pos);
+ /** @brief Makes the check all checkbox represent the check state of the effects. */
+ void slotUpdateCheckAllButton();
+
+ /** @brief Sets the check state of all effects according to @param state. */
+ void slotCheckAll(int state);
+
signals:
void removeEffect(ClipItem*, QDomElement);
/** Parameters for an effect changed, update the filter in playlist */
void reloadEffects();
/** An effect with position parameter was changed, seek */
void seekTimeline(int);
-
};
#endif
<property name="horizontalSpacing">
<number>2</number>
</property>
- <item row="0" column="0" colspan="7">
+ <item row="1" column="0" colspan="7">
<widget class="KListWidget" name="effectlist">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
</property>
</widget>
</item>
- <item row="1" column="0">
+ <item row="2" column="0">
<widget class="QToolButton" name="buttonNew">
<property name="text">
<string>N</string>
</property>
</widget>
</item>
- <item row="1" column="1">
+ <item row="2" column="1">
<widget class="QToolButton" name="buttonUp">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="2">
+ <item row="2" column="2">
<widget class="QToolButton" name="buttonDown">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="3">
+ <item row="2" column="3">
<widget class="QToolButton" name="buttonReset">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="4">
+ <item row="2" column="4">
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
</spacer>
</item>
- <item row="1" column="5">
+ <item row="2" column="5">
<widget class="QToolButton" name="buttonSave">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
- <item row="1" column="6">
+ <item row="2" column="6">
<widget class="QToolButton" name="buttonDel">
<property name="enabled">
<bool>false</bool>
</property>
</widget>
</item>
+ <item row="0" column="0">
+ <widget class="QCheckBox" name="checkAll">
+ <property name="enabled">
+ <bool>false</bool>
+ </property>
+ <property name="text">
+ <string/>
+ </property>
+ <property name="checkable">
+ <bool>true</bool>
+ </property>
+ <property name="tristate">
+ <bool>false</bool>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
<widget class="QFrame" name="frame">