m_listView->header()->restoreState(state);
}
+void ProjectList::updateProjectFormat(Timecode t)
+{
+ m_timecode = t;
+}
+
void ProjectList::slotEditClip()
{
QList<QTreeWidgetItem *> list = m_listView->selectedItems();
it2++;
}
- m_doc->deleteProjectClip(ids);
+ emit deleteProjectClips(ids, QMap <QString, QString>());
for (int i = 0; i < urls.count(); i++) {
KIO::NetAccess::del(KUrl(urls.at(i)), this);
}
folderids[folder->groupName()] = folder->clipId();
int children = folder->childCount();
- if (children > 0 && KMessageBox::questionYesNo(this, i18np("Delete folder <b>%2</b>?<br>This will also remove the clip in that folder", "Delete folder <b>%2</b>?<br>This will also remove the %1 clips in that folder", children, folder->text(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
+ if (children > 0 && KMessageBox::questionYesNo(this, i18np("Delete folder <b>%2</b>?<br />This will also remove the clip in that folder", "Delete folder <b>%2</b>?<br />This will also remove the %1 clips in that folder", children, folder->text(1)), i18n("Delete Folder")) != KMessageBox::Yes) return;
for (int i = 0; i < children; ++i) {
ProjectItem *child = static_cast <ProjectItem *>(folder->child(i));
ids << child->clipId();
ProjectItem *item = static_cast <ProjectItem *>(selected.at(i));
ids << item->clipId();
if (item->numReferences() > 0) {
- if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b>?<br>This will also remove the clip in timeline", "Delete clip <b>%2</b>?<br>This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
+ if (KMessageBox::questionYesNo(this, i18np("Delete clip <b>%2</b>?<br />This will also remove the clip in timeline", "Delete clip <b>%2</b>?<br />This will also remove its %1 clips in timeline", item->numReferences(), item->names().at(1)), i18n("Delete Clip")) != KMessageBox::Yes) return;
}
}
}
if (delCommand->childCount() == 0) delete delCommand;
else m_commandStack->push(delCommand);
- if (!ids.isEmpty()) m_doc->deleteProjectClip(ids);
- if (!folderids.isEmpty()) deleteProjectFolder(folderids);
+ emit deleteProjectClips(ids, folderids);
+}
+
+void ProjectList::updateButtons() const
+{
if (m_listView->topLevelItemCount() == 0) {
- m_editAction->setEnabled(false);
m_deleteAction->setEnabled(false);
- m_openAction->setEnabled(false);
- m_reloadAction->setEnabled(false);
- m_transcodeAction->setEnabled(false);
+ } else {
+ m_deleteAction->setEnabled(true);
+ if (!m_listView->currentItem()) m_listView->setCurrentItem(m_listView->topLevelItem(0));
+ QTreeWidgetItem *item = m_listView->currentItem();
+ if (item && item->type() == PROJECTCLIPTYPE) {
+ m_editAction->setEnabled(true);
+ m_openAction->setEnabled(true);
+ m_reloadAction->setEnabled(true);
+ m_transcodeAction->setEnabled(true);
+ return;
+ }
}
+
+ m_editAction->setEnabled(false);
+ m_openAction->setEnabled(false);
+ m_reloadAction->setEnabled(false);
+ m_transcodeAction->setEnabled(false);
}
void ProjectList::selectItemById(const QString &clipId)
return;
}
m_listView->blockSignals(true);
+ QTreeWidgetItem *newSelectedItem = m_listView->itemAbove(item);
+ if (!newSelectedItem) newSelectedItem = m_listView->itemBelow(item);
delete item;
m_doc->clipManager()->deleteClip(clipId);
m_listView->blockSignals(false);
- slotClipSelected();
+ if (newSelectedItem) m_listView->setCurrentItem(newSelectedItem);
+ else updateButtons();
}
FolderProjectItem *item = getFolderItemById(clipId);
if (item) {
m_doc->clipManager()->deleteFolder(clipId);
+ QTreeWidgetItem *newSelectedItem = m_listView->itemAbove(item);
+ if (!newSelectedItem) newSelectedItem = m_listView->itemBelow(item);
delete item;
+ if (newSelectedItem) m_listView->setCurrentItem(newSelectedItem);
+ else updateButtons();
}
} else {
if (edit) {
m_doc->clipManager()->addFolder(clipId, foldername);
m_listView->blockSignals(false);
}
+ updateButtons();
}
m_doc->setModified(true);
}
QDomElement e = clip->toXML().cloneNode().toElement();
e.removeAttribute("file_hash");
m_infoQueue.insert(clip->getId(), e);
+ clip->askForAudioThumbs();
//m_render->getFileProperties(clip->toXML(), clip->getId(), true);
}
const QString parent = clip->getProperty("groupid");
}
}
}
-
- if (getProperties && m_listView->isEnabled()) m_listView->blockSignals(false);
+ if (m_listView->isEnabled()) {
+ updateButtons();
+ if (getProperties) m_listView->blockSignals(false);
+ }
if (getProperties && !m_queueTimer.isActive()) m_queueTimer.start();
}
{
ProjectItem *item = getItemById(id);
m_listView->blockSignals(true);
- if (item) item->setData(1, UsageRole, QString::number(item->numReferences()));
+ if (item) item->setData(0, UsageRole, QString::number(item->numReferences()));
m_listView->blockSignals(false);
}
item->changeDuration(item->referencedClip()->producer()->get_playtime());
}
}
- item->setData(1, UsageRole, QString::number(item->numReferences()));
+ item->setData(0, UsageRole, QString::number(item->numReferences()));
}
//qApp->processEvents();
++it;
const QString path = item->referencedClip()->fileURL().path();
if (item->referencedClip()->isPlaceHolder()) replace = false;
if (!path.isEmpty()) {
- if (replace) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br>is invalid, will be removed from project.", path));
+ if (replace) KMessageBox::sorry(this, i18n("Clip <b>%1</b><br />is invalid, will be removed from project.", path));
else {
- if (KMessageBox::questionYesNo(this, i18n("Clip <b>%1</b><br>is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes) replace = true;
+ if (KMessageBox::questionYesNo(this, i18n("Clip <b>%1</b><br />is missing or invalid. Remove it from project?", path), i18n("Invalid clip")) == KMessageBox::Yes) replace = true;
}
}
QStringList ids;
ids << id;
- if (replace) m_doc->deleteProjectClip(ids);
+ if (replace) emit deleteProjectClips(ids, QMap <QString, QString>());
}
}
dia_ui.setupUi(dia);
dia->setWindowTitle(i18n("Color Clip"));
dia_ui.clip_name->setText(i18n("Color Clip"));
- dia_ui.clip_duration->setText(KdenliveSettings::color_duration());
+ dia_ui.clip_duration->setInputMask(m_timecode.inputMask());
+ dia_ui.clip_duration->setText(m_timecode.reformatSeparators(KdenliveSettings::color_duration()));
if (dia->exec() == QDialog::Accepted) {
QString color = dia_ui.clip_color->color().name();
color = color.replace(0, 1, "0x") + "ff";
emit displayMessage(QString(), -1);
m_listView->blockSignals(false);
m_listView->setEnabled(true);
+ updateButtons();
} else if (!m_refreshed) QTimer::singleShot(300, this, SLOT(slotCheckForEmptyQueue()));
}
}
//Q_ASSERT_X(item->referencedClip(), "void ProjectList::slotReplyGetFileProperties", QString("Item with groupName %1 does not have a clip associated").arg(item->groupName()).toLatin1());
item->referencedClip()->setProducer(producer, replace);
+ item->referencedClip()->askForAudioThumbs();
if (!replace && item->data(0, Qt::DecorationRole).isNull()) {
requestClipThumbnail(clipId);
}