From: Jean-Baptiste Mardelle Date: Tue, 5 Jun 2012 22:07:00 +0000 (+0200) Subject: Show / hide widget menu is now sorted alphabetically, shortcuts can be assigned to... X-Git-Url: https://git.sesse.net/?a=commitdiff_plain;h=1d1760bd3f2ddd1bcc479d443ced77b59bb4e48c;p=kdenlive Show / hide widget menu is now sorted alphabetically, shortcuts can be assigned to show / hide widgets --- diff --git a/src/kdenliveui.rc b/src/kdenliveui.rc index c6b393fb..870d074b 100644 --- a/src/kdenliveui.rc +++ b/src/kdenliveui.rc @@ -170,10 +170,9 @@ - + - diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index eb4c6cfb..b9c21904 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -407,6 +407,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & save->setData("_" + QString::number(i)); layoutActions->addAction("save_layout" + QString::number(i), save); } + // Required to enable user to add the load layout action to toolbar layoutActions->addAction("load_layouts", m_loadLayout); connect(m_loadLayout, SIGNAL(triggered(QAction*)), this, SLOT(slotLoadLayout(QAction*))); @@ -430,6 +431,9 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & m_effectList->reloadEffectList(m_effectsMenu, m_effectActions); m_effectsActionCollection->readSettings(); + // Populate View menu with show / hide actions for dock widgets + KActionCategory *guiActions = new KActionCategory(i18n("Interface"), actionCollection()); + setupGUI(); // Find QDockWidget tab bars and show / hide widget title bars on right click @@ -526,11 +530,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & connect(m, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *))); connect(m_effectsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddVideoEffect(QAction *))); - connect(m_transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *))); - - QMenu *viewMenu = static_cast(factory()->container("dockwindows", this)); - const QList viewActions = createPopupMenu()->actions(); - viewMenu->insertActions(NULL, viewActions); + connect(m_transitionsMenu, SIGNAL(triggered(QAction *)), this, SLOT(slotAddTransition(QAction *))); m_timelineContextMenu = new QMenu(this); m_timelineContextClipMenu = new QMenu(this); @@ -604,6 +604,33 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString & actionCollection()->addAssociatedWidget(m_clipMonitor->container()); actionCollection()->addAssociatedWidget(m_projectMonitor->container()); + QMap viewActions; + KAction *showTimeline = new KAction(i18n("Timeline"), this); + showTimeline->setCheckable(true); + showTimeline->setChecked(true); + connect(showTimeline, SIGNAL(triggered(bool)), this, SLOT(slotShowTimeline(bool))); + viewActions.insert(showTimeline->text(), showTimeline); + + QList docks = findChildren(); + for (int i = 0; i < docks.count(); i++) { + QDockWidget* dock = docks.at(i); + KAction* dockInformations = new KAction(this); + dockInformations->setText(dock->windowTitle()); + dockInformations->setCheckable(true); + dockInformations->setChecked(!dock->isHidden()); + connect(dockInformations,SIGNAL(toggled(bool)), dock, SLOT(setVisible(bool))); + viewActions.insert(dockInformations->text(), dockInformations); + } + + + KMenu *viewMenu = static_cast(factory()->container("dockwindows", this)); + //const QList viewActions = createPopupMenu()->actions(); + QMap::const_iterator i = viewActions.constBegin(); + while (i != viewActions.constEnd()) { + viewMenu->addAction(guiActions->addAction(i.key(), i.value())); + ++i; + } + // Populate encoding profiles KConfig conf("encodingprofiles.rc", KConfig::FullConfig, "appdata"); if (KdenliveSettings::proxyparams().isEmpty() || KdenliveSettings::proxyextension().isEmpty()) { @@ -1558,12 +1585,6 @@ void MainWindow::setupActions() pasteEffects->setData("paste_effects"); connect(pasteEffects , SIGNAL(triggered()), this, SLOT(slotPasteEffects())); - QAction *showTimeline = new KAction(i18n("Show Timeline"), this); - collection.addAction("show_timeline", showTimeline); - showTimeline->setCheckable(true); - showTimeline->setChecked(true); - connect(showTimeline, SIGNAL(triggered(bool)), this, SLOT(slotShowTimeline(bool))); - QAction *showTitleBar = new KAction(i18n("Show Title Bars"), this); collection.addAction("show_titlebars", showTitleBar); showTitleBar->setCheckable(true); @@ -1578,7 +1599,7 @@ void MainWindow::setupActions() KStandardAction::saveAs(this, SLOT(saveFileAs()), collection); KStandardAction::openNew(this, SLOT(newFile()), collection); // TODO: make the following connection to slotEditKeys work - KStandardAction::keyBindings(this, SLOT(slotEditKeys()), collection); + //KStandardAction::keyBindings(this, SLOT(slotEditKeys()), collection); KStandardAction::preferences(this, SLOT(slotPreferences()), collection); KStandardAction::configureNotifications(this, SLOT(configureNotifications()), collection); KStandardAction::copy(this, SLOT(slotCopy()), collection);