Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

cleanup

parent 8b51d7f9
......@@ -197,11 +197,6 @@ void AbstractTreeModel::deregisterItem(int id, TreeItem *item)
m_allItems.erase(id);
}
int AbstractTreeModel::clipsCount() const
{
return (int)m_allItems.size();
}
std::shared_ptr<TreeItem> AbstractTreeModel::getItemById(int id) const
{
if (id == rootItem->getId()) {
......
......@@ -78,9 +78,6 @@ public:
/* @brief Helper function to generate a lambda that changes the row of an item */
Fun moveItem_lambda(int id, int destRow, bool force = false);
/* @brief Returns the number of clips in bin */
int clipsCount() const;
friend class TreeItem;
friend class AbstractProjectItem;
......
......@@ -1816,96 +1816,6 @@ void Bin::slotRemoveInvalidClip(const QString &id, bool replace, const QString &
emit requesteInvalidRemoval(id, clip->url(), errorMessage);
}
// TODO refac cleanup
/*
void Bin::slotProducerReady(const requestClipInfo &info, std::shared_ptr<Mlt::Producer> producer)
{
std::shared_ptr<ProjectClip> clip = m_itemModel->getClipByBinID(info.clipId);
if (clip) {
if ((producer == nullptr || clip->setProducer(producer, info.replaceProducer)) && !clip->hasProxy()) {
if (producer) {
pCore->binController()->replaceBinPlaylistClip(info.clipId, producer);
}
emit producerReady(info.clipId);
// Check for file modifications
ClipType t = clip->clipType();
if (t == AV || t == Audio || t == Image || t == Video || t == Playlist || t == TextTemplate) {
m_fileWatcher.addFile(info.clipId, clip->url());
}
if (m_doc->useProxy()) {
if (t == AV || t == Video) {
int width = clip->getProducerIntProperty(QStringLiteral("meta.media.width"));
if (m_doc->autoGenerateProxy(width)) {
// Start proxy
m_doc->slotProxyCurrentItem(true, {clip});
}
} else if (t == Playlist) {
// always proxy playlists
m_doc->slotProxyCurrentItem(true, {clip});
} else if (t == Image && m_doc->autoGenerateImageProxy(clip->getProducerIntProperty(QStringLiteral("meta.media.width")))) {
// Start proxy
m_doc->slotProxyCurrentItem(true, {clip});
}
} else {
emit producerReady(info.clipId);
}
QString currentClip = m_monitor->activeClipId();
if (currentClip.isEmpty()) {
// No clip displayed in monitor, check if item is selected
QModelIndexList indexes = m_proxyModel->selectionModel()->selectedIndexes();
if (indexes.isEmpty()) {
// No clip selected, focus this new one
selectClip(clip);
} else {
for (const QModelIndex &ix : indexes) {
if (!ix.isValid() || ix.column() != 0) {
continue;
}
std::shared_ptr<AbstractProjectItem> item = m_itemModel->getBinItemByIndex(m_proxyModel->mapToSource(ix));
if ((item != nullptr) && item->clipId() == info.clipId) {
// Item was selected, show it in monitor
setCurrent(item);
break;
}
}
}
} else if (currentClip == info.clipId) {
setCurrent(clip);
}
}
} else {
// Clip not found, create it
QString groupId = producer->get("kdenlive:folderid");
std::shared_ptr<ProjectFolder> parentFolder;
if (!groupId.isEmpty() && groupId != QLatin1String("-1")) {
parentFolder = m_itemModel->getFolderByBinId(groupId);
if (!parentFolder) {
// parent folder does not exist, put in root folder
parentFolder = m_itemModel->getRootFolder();
}
if (groupId.toInt() >= m_folderCounter) {
m_folderCounter = groupId.toInt() + 1;
}
} else {
parentFolder = m_itemModel->getRootFolder();
}
std::shared_ptr<ProjectClip> newClip = ProjectClip::construct(info.clipId, m_blankThumb, m_itemModel, producer);
parentFolder->appendChild(newClip);
emit producerReady(info.clipId);
newClip->createAudioThumbs();
ClipType t = newClip->clipType();
if (t == AV || t == Audio || t == Image || t == Video || t == Playlist || t == TextTemplate) {
m_fileWatcher.addFile(info.clipId, newClip->url());
}
if (info.clipId.toInt() >= m_clipCounter) {
m_clipCounter = info.clipId.toInt() + 1;
}
}
}
*/
void Bin::selectClip(const std::shared_ptr<ProjectClip> &clip)
{
QModelIndex ix = m_itemModel->getIndexFromItem(clip);
......
......@@ -185,3 +185,8 @@ QMap<QString, QString> BinPlaylist::getProxies(const QString &root)
}
return proxies;
}
int BinPlaylist::count() const
{
return m_binPlaylist->count();
}
......@@ -72,6 +72,9 @@ public:
/** @brief Retrieve a list of proxy/original urls */
QMap<QString, QString> getProxies(const QString &root);
/** @brief The number of clips in the Bin Playlist */
int count() const;
// id of the mlt object
static QString binPlaylistId;
......
......@@ -906,3 +906,8 @@ void ProjectItemModel::setDragType(PlaylistState::ClipState type)
{
m_dragType = type;
}
int ProjectItemModel::clipsCount() const
{
return m_binPlaylist->count();
}
......@@ -193,6 +193,9 @@ public:
/** @brief Set the status of the clip to "waiting". This happens when the corresponding file has changed*/
void setClipWaiting(const QString &binId);
/** @brief Number of clips in the bin playlist */
int clipsCount() const;
protected:
/* @brief Register the existence of a new element
*/
......
......@@ -546,7 +546,7 @@ bool LoadJob::commitResult(Fun &undo, Fun &redo)
};
bool ok = operation();
if (ok) {
if (pCore->projectItemModel()->clipsCount() == 2) {
if (pCore->projectItemModel()->clipsCount() == 1) {
// Always select first added clip
pCore->selectBinClip(m_clipId);
}
......
......@@ -1659,7 +1659,7 @@ void MainWindow::slotEditProjectSettings()
modified = true;
project->setDocumentProperty(QStringLiteral("proxyparams"), w->proxyParams());
project->setDocumentProperty(QStringLiteral("proxyextension"), w->proxyExtension());
if (pCore->binController()->clipCount() > 0 &&
if (pCore->projectItemModel()->clipsCount() > 0 &&
KMessageBox::questionYesNo(this, i18n("You have changed the proxy parameters. Do you want to recreate all proxy clips for this project?")) ==
KMessageBox::Yes) {
// TODO: rebuild all proxies
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment