Commit dafd50fd authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle
Browse files

Fix some issues in multiple bin

parent bbdddf56
......@@ -1767,7 +1767,7 @@ void Bin::cleanDocument()
}
setEnabled(false);
// Cleanup references in the cli properties dialog
showClipProperties(nullptr);
requestShowClipProperties(nullptr);
// Cleanup previous project
m_itemModel->clean();
......@@ -2065,7 +2065,7 @@ void Bin::selectProxyModel(const QModelIndex &id)
m_tagsWidget->setTagData(clip->tags());
ClipType::ProducerType type = clip->clipType();
m_openAction->setEnabled(type == ClipType::Image || type == ClipType::Audio || type == ClipType::Text || type == ClipType::TextTemplate);
showClipProperties(clip, false);
requestShowClipProperties(clip, false);
m_deleteAction->setText(i18n("Delete Clip"));
m_proxyAction->setText(i18n("Proxy Clip"));
//TODO: testing only, we should check clip type...
......@@ -2086,7 +2086,7 @@ void Bin::selectProxyModel(const QModelIndex &id)
m_proxyAction->setText(i18n("Proxy Folder"));
} else if (currentItem->itemType() == AbstractProjectItem::SubClipItem) {
m_tagsWidget->setTagData(currentItem->tags());
showClipProperties(std::static_pointer_cast<ProjectClip>(currentItem->parent()), false);
requestShowClipProperties(std::static_pointer_cast<ProjectClip>(currentItem->parent()), false);
m_openAction->setEnabled(false);
m_reloadAction->setEnabled(false);
m_replaceAction->setEnabled(false);
......@@ -2111,7 +2111,7 @@ void Bin::selectProxyModel(const QModelIndex &id)
m_openAction->setEnabled(false);
m_deleteAction->setEnabled(false);
m_renameAction->setEnabled(false);
showClipProperties(nullptr);
requestShowClipProperties(nullptr);
emit requestClipShow(nullptr);
// clear effect stack
emit requestShowEffectStack(QString(), nullptr, QSize(), false);
......@@ -2602,7 +2602,7 @@ void Bin::slotSwitchClipProperties(const std::shared_ptr<ProjectClip> &clip)
ClipCreationDialog::createQTextClip(m_doc, parentFolder, this, clip.get());
} else {
m_propertiesPanel->setEnabled(true);
showClipProperties(clip);
requestShowClipProperties(clip);
m_propertiesDock->show();
m_propertiesDock->raise();
}
......@@ -2614,7 +2614,7 @@ void Bin::doRefreshPanel(const QString &id)
{
std::shared_ptr<ProjectClip> currentItem = getFirstSelectedClip();
if ((currentItem != nullptr) && currentItem->AbstractProjectItem::clipId() == id) {
showClipProperties(currentItem, true);
requestShowClipProperties(currentItem, true);
}
}
......@@ -2700,7 +2700,7 @@ void Bin::reloadMonitorIfActive(const QString &id)
if (m_monitor->activeClipId() == id || m_monitor->activeClipId().isEmpty()) {
slotOpenCurrent();
if (m_monitor->activeClipId() == id) {
showClipProperties(getBinClip(id), true);
requestShowClipProperties(getBinClip(id), true);
}
}
}
......@@ -4340,7 +4340,7 @@ QString Bin::getCurrentFolder()
QModelIndex parentIx = m_itemView->rootIndex();
if (parentIx.isValid()) {
std::shared_ptr<AbstractProjectItem> item = m_itemModel->getBinItemByIndex(m_proxyModel->mapToSource(parentIx));
if (item) {
if (item && item != parentFolder) {
parentFolder = std::static_pointer_cast<ProjectFolder>(item->getEnclosingFolder());
}
}
......
......@@ -423,6 +423,7 @@ public slots:
void slotOpenClip();
void slotDuplicateClip();
void slotLocateClip();
void showClipProperties(const std::shared_ptr<ProjectClip> &clip, bool forceRefresh = false);
/** @brief Add extra data to a clip. */
void slotAddClipExtraData(const QString &id, const QString &key, const QString &data = QString(), QUndoCommand *groupCommand = nullptr);
void slotUpdateClipProperties(const QString &id, const QMap<QString, QString> &properties, bool refreshPropertiesPanel);
......@@ -543,7 +544,6 @@ private:
QFuture<void> m_audioThumbsThread;
QAction *addAction(const QString &name, const QString &text, const QIcon &icon);
void setupAddClipAction(QMenu *addClipMenu, ClipType::ProducerType type, const QString &name, const QString &text, const QIcon &icon);
void showClipProperties(const std::shared_ptr<ProjectClip> &clip, bool forceRefresh = false);
/** @brief Get the QModelIndex value for an item in the Bin. */
QModelIndex getIndexForId(const QString &id, bool folderWanted) const;
std::shared_ptr<ProjectClip> getFirstSelectedClip();
......@@ -562,6 +562,7 @@ signals:
void refreshTimeCode();
/** @brief Request display of effect stack for a Bin clip. */
void requestShowEffectStack(const QString &clipName, std::shared_ptr<EffectStackModel>, QSize frameSize, bool showKeyframes);
void requestShowClipProperties(const std::shared_ptr<ProjectClip> &clip, bool forceRefresh = false);
/** @brief Request that the given clip is displayed in the clip monitor */
void requestClipShow(std::shared_ptr<ProjectClip>);
void displayBinMessage(const QString &, KMessageWidget::MessageType);
......
......@@ -132,6 +132,7 @@ void Core::initGUI(bool isAppImage, const QString &MltPath, const QUrl &Url, con
std::shared_ptr<Bin> bin(new Bin(m_projectItemModel, m_mainWindow));
m_mainWindow->addBin(bin);
connect(bin.get(), &Bin::requestShowClipProperties, bin.get(), &Bin::showClipProperties);
connect(m_projectItemModel.get(), &ProjectItemModel::refreshPanel, m_mainWindow->activeBin().get(), &Bin::refreshPanel);
connect(m_projectItemModel.get(), &ProjectItemModel::refreshClip, m_mainWindow->activeBin().get(), &Bin::refreshClip);
connect(m_projectItemModel.get(), static_cast<void (ProjectItemModel::*)(const QStringList &, const QModelIndex &)>(&ProjectItemModel::itemDropped), m_mainWindow->activeBin().get(),
......@@ -142,7 +143,6 @@ void Core::initGUI(bool isAppImage, const QString &MltPath, const QUrl &Url, con
connect(m_projectItemModel.get(), &ProjectItemModel::addTag, m_mainWindow->activeBin().get(), &Bin::slotTagDropped);
connect(m_projectItemModel.get(), &QAbstractItemModel::dataChanged, m_mainWindow->activeBin().get(), &Bin::slotItemEdited);
qDebug()<<"::::::::: ADDED NEW FIRST BIN";
m_library = new LibraryWidget(m_projectManager, m_mainWindow);
m_subtitleWidget = new SubtitleEdit(m_mainWindow);
m_mixerWidget = new MixerManager(m_mainWindow);
......
......@@ -1741,6 +1741,7 @@ void MainWindow::setupActions()
// Keyframe actions
m_assetPanel = new AssetPanel(this);
connect(getBin().get(), &Bin::requestShowEffectStack, m_assetPanel, &AssetPanel::showEffectStack);
KActionCategory *kfActions = new KActionCategory(i18n("Effect Keyframes"), actionCollection());
addAction(QStringLiteral("keyframe_add"), i18n("Add/Remove Keyframe"), m_assetPanel, SLOT(slotAddRemoveKeyframe()),
QIcon::fromTheme(QStringLiteral("keyframe-add")), QKeySequence(), kfActions);
......@@ -4579,12 +4580,13 @@ void MainWindow::addBin(std::shared_ptr<Bin> bin)
getCurrentTimeline()->controller()->setTargetTracks(hasVideo, audioStreams);
}
);
connect(bin.get(), &Bin::requestShowEffectStack, m_assetPanel, &AssetPanel::showEffectStack);
if (!m_binWidgets.isEmpty()) {
// This is a secondary bin widget
int ix = binCount() + 1;
QDockWidget *binDock = addDock(i18n("Project Bin %1", ix), QString("project_bin_%1").arg(ix), bin.get());
bin->setupGeneratorMenu();
connect(bin.get(), &Bin::requestShowEffectStack, m_assetPanel, &AssetPanel::showEffectStack);
connect(bin.get(), &Bin::requestShowClipProperties, getBin().get(), &Bin::showClipProperties);
tabifyDockWidget(m_projectBinDock, binDock);
// Update dock list
updateDockMenu();
......
Supports Markdown
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