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

Fix missing icons in dock widgets (don't initialize too early)

Fixes #1575
parent 57fa1a3e
......@@ -350,11 +350,6 @@ std::shared_ptr<ProjectClip> ProjectClip::clipAt(int ix)
return std::shared_ptr<ProjectClip>();
}
/*bool ProjectClip::isValid() const
{
return m_controller->isValid();
}*/
bool ProjectClip::hasUrl() const
{
if ((m_clipType != ClipType::Color) && (m_clipType != ClipType::Unknown)) {
......
......@@ -151,25 +151,7 @@ void Core::initGUI(bool inSandbox, const QString &MltPath, const QUrl &Url, cons
connect(m_projectItemModel.get(), &ProjectItemModel::addTag, m_mainWindow->activeBin(), &Bin::slotTagDropped);
connect(m_projectItemModel.get(), &QAbstractItemModel::dataChanged, m_mainWindow->activeBin(), &Bin::slotItemEdited);
m_library = new LibraryWidget(m_projectManager, m_mainWindow);
m_subtitleWidget = new SubtitleEdit(m_mainWindow);
m_textEditWidget = new TextBasedEdit(m_mainWindow);
m_timeRemapWidget = new TimeRemap(m_mainWindow);
m_guidesList = new GuidesList(m_mainWindow);
connect(m_library, SIGNAL(addProjectClips(QList<QUrl>)), m_mainWindow->getBin(), SLOT(droppedUrls(QList<QUrl>)));
connect(this, &Core::updateLibraryPath, m_library, &LibraryWidget::slotUpdateLibraryPath);
m_monitorManager = new MonitorManager(this);
m_mixerWidget = new MixerManager(m_mainWindow);
connect(m_capture.get(), &MediaCapture::recordStateChanged, m_mixerWidget, &MixerManager::recordStateChanged);
connect(m_mixerWidget, &MixerManager::updateRecVolume, m_capture.get(), &MediaCapture::setAudioVolume);
connect(m_monitorManager, &MonitorManager::cleanMixer, m_mixerWidget, &MixerManager::clearMixers);
connect(m_subtitleWidget, &SubtitleEdit::addSubtitle, m_mainWindow, &MainWindow::slotAddSubtitle);
connect(m_subtitleWidget, &SubtitleEdit::cutSubtitle, this, [this](int id, int cursorPos) {
if (m_guiConstructed && m_mainWindow->getCurrentTimeline()->controller()) {
m_mainWindow->getCurrentTimeline()->controller()->cutSubtitle(id, cursorPos);
}
});
// The MLT Factory will be initiated there, all MLT classes will be usable only after this
if (inSandbox) {
......@@ -184,7 +166,7 @@ void Core::initGUI(bool inSandbox, const QString &MltPath, const QUrl &Url, cons
// Open connection with Mlt
m_mainWindow->init(MltPath);
}
m_mixerWidget->checkAudioLevelVersion();
m_projectItemModel->buildPlaylist();
// load the profiles from disk
ProfileRepository::get()->refresh();
......@@ -248,6 +230,41 @@ void Core::initGUI(bool inSandbox, const QString &MltPath, const QUrl &Url, cons
emit m_mainWindow->GUISetupDone();
}
void Core::buildDocks()
{
// Mixer
m_mixerWidget = new MixerManager(m_mainWindow);
connect(m_capture.get(), &MediaCapture::recordStateChanged, m_mixerWidget, &MixerManager::recordStateChanged);
connect(m_mixerWidget, &MixerManager::updateRecVolume, m_capture.get(), &MediaCapture::setAudioVolume);
connect(m_monitorManager, &MonitorManager::cleanMixer, m_mixerWidget, &MixerManager::clearMixers);
connect(m_subtitleWidget, &SubtitleEdit::addSubtitle, m_mainWindow, &MainWindow::slotAddSubtitle);
connect(m_subtitleWidget, &SubtitleEdit::cutSubtitle, this, [this](int id, int cursorPos) {
if (m_guiConstructed && m_mainWindow->getCurrentTimeline()->controller()) {
m_mainWindow->getCurrentTimeline()->controller()->cutSubtitle(id, cursorPos);
}
});
m_mixerWidget->checkAudioLevelVersion();
// Library
m_library = new LibraryWidget(m_projectManager, m_mainWindow);
connect(m_library, SIGNAL(addProjectClips(QList<QUrl>)), m_mainWindow->getBin(), SLOT(droppedUrls(QList<QUrl>)));
connect(this, &Core::updateLibraryPath, m_library, &LibraryWidget::slotUpdateLibraryPath);
m_library->setupActions();
// Subtitles
m_subtitleWidget = new SubtitleEdit(m_mainWindow);
// Text edit speech
m_textEditWidget = new TextBasedEdit(m_mainWindow);
// Time remap
m_timeRemapWidget = new TimeRemap(m_mainWindow);
// Guides
m_guidesList = new GuidesList(m_mainWindow);
}
void Core::buildLumaThumbs(const QStringList &values)
{
for (auto &entry : values) {
......
......@@ -280,6 +280,8 @@ public:
MixAlignment getMixAlign(int cid) const;
/** @brief Closing current document, do some cleanup */
void cleanup();
/** @brief Create the dock widgets */
void buildDocks();
#if KNEWSTUFF_VERSION < QT_VERSION_CHECK(5, 98, 0)
/** @brief Instantiates a "Get Hot New Stuff" dialog.
* @param configFile configuration file for KNewStuff
......
......@@ -215,7 +215,7 @@ LibraryWidget::LibraryWidget(ProjectManager *manager, QWidget *parent)
connect(m_libraryTree, &LibraryTree::itemChanged, this, &LibraryWidget::slotItemEdited, Qt::UniqueConnection);
}
void LibraryWidget::setupActions(const QList<QAction *> &list)
void LibraryWidget::setupActions()
{
QList<QAction *> menuList;
m_addAction = new QAction(QIcon::fromTheme(QStringLiteral("kdenlive-add-clip")), i18n("Add Clip to Project"), this);
......@@ -233,11 +233,12 @@ void LibraryWidget::setupActions(const QList<QAction *> &list)
m_toolBar->addAction(m_addAction);
m_toolBar->addSeparator();
m_toolBar->addAction(addFolder);
for (QAction *action : list) {
m_toolBar->addAction(action);
menuList << action;
connect(this, &LibraryWidget::enableAddSelection, action, &QAction::setEnabled);
}
QAction *sentToLibrary = new QAction(QIcon::fromTheme(QStringLiteral("bookmark-new")), i18n("Add Timeline Selection to Library"), this);
connect(sentToLibrary, &QAction::triggered, this, &LibraryWidget::slotAddToLibrary);
sentToLibrary->setEnabled(false);
m_toolBar->addAction(sentToLibrary);
menuList << sentToLibrary;
connect(this, &LibraryWidget::enableAddSelection, sentToLibrary, &QAction::setEnabled);
// Create spacer
QWidget *spacer = new QWidget();
......
......@@ -158,7 +158,7 @@ class LibraryWidget : public QWidget
public:
explicit LibraryWidget(ProjectManager *m_manager, QWidget *parent = nullptr);
void setupActions(const QList<QAction *> &list);
void setupActions();
public slots:
void slotAddToLibrary();
......
......@@ -269,6 +269,7 @@ void MainWindow::init(const QString &mltPath)
setupActions();
auto *layoutManager = new LayoutManagement(this);
pCore->bin()->setupMenu();
pCore->buildDocks();
QDockWidget *libraryDock = addDock(i18n("Library"), QStringLiteral("library"), pCore->library());
QDockWidget *subtitlesDock = addDock(i18n("Subtitles"), QStringLiteral("Subtitles"), pCore->subtitleWidget());
......@@ -1817,12 +1818,6 @@ void MainWindow::setupActions()
m_saveAction = KStandardAction::save(pCore->projectManager(), SLOT(saveFile()), actionCollection());
m_saveAction->setIcon(QIcon::fromTheme(QStringLiteral("document-save")));
QAction *sentToLibrary = addAction(QStringLiteral("send_library"), i18n("Add Timeline Selection to Library"), pCore->library(), SLOT(slotAddToLibrary()),
QIcon::fromTheme(QStringLiteral("bookmark-new")));
sentToLibrary->setEnabled(false);
pCore->library()->setupActions(QList<QAction *>() << sentToLibrary);
QAction *const showMenuBarAction = KStandardAction::showMenubar(this, &MainWindow::showMenuBar, actionCollection());
showMenuBarAction->setWhatsThis(xi18nc("@info:whatsthis", "This switches between having a <emphasis>Menubar</emphasis> "
"and having a <interface>Hamburger Menu</interface> button in the main Toolbar."));
......
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