Fix my small effect basket (list of favorite effects embedded in toolbar):

* react on shortcut
* do add effect when return pressed
parent 20b78493
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="95" translationDomain="kdenlive">
<kpartgui name="kdenlive" version="100" translationDomain="kdenlive">
<ToolBar name="extraToolBar" >
<text>Extra Toolbar</text>
<Action name="project_render" />
<Action name="favorite_effects" />
</ToolBar>
<MenuBar>
......
......@@ -40,6 +40,7 @@ EffectBasket::EffectBasket(EffectsListView *effectList) :
setDragEnabled(true);
m_effectList->creatFavoriteBasket(this);
connect(m_effectList, &EffectsListView::reloadBasket, this, &EffectBasket::slotReloadBasket);
connect(this, SIGNAL(itemActivated(QListWidgetItem *)), this, SLOT(slotAddEffect(QListWidgetItem *)));
}
void EffectBasket::slotReloadBasket()
......@@ -65,6 +66,20 @@ QMimeData *EffectBasket::mimeData(const QList<QListWidgetItem *> list) const
return mime;
}
void EffectBasket::showEvent(QShowEvent * event)
{
QListWidget::showEvent(event);
if (!currentItem()) {
setCurrentRow(0);
}
}
void EffectBasket::slotAddEffect(QListWidgetItem *item)
{
int type = item->data(EffectsListWidget::TypeRole).toInt();
QStringList info = item->data(EffectsListWidget::IdRole).toStringList();
QDomElement effect = EffectsListWidget::itemEffect(type, info);
emit addEffect(effect);
}
......@@ -22,6 +22,7 @@
#define EFFECTBASKET_H
#include <QListWidget>
#include <QDomElement>
class EffectsListView;
......@@ -40,12 +41,17 @@ public:
protected:
QMimeData *mimeData(const QList<QListWidgetItem *> list) const;
void showEvent(QShowEvent * event);
private:
EffectsListView *m_effectList;
private slots:
void slotReloadBasket();
void slotAddEffect(QListWidgetItem *item);
signals:
void addEffect(QDomElement);
};
......
......@@ -304,9 +304,12 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
// Create Effect Basket (dropdown list of favorites)
m_effectBasket = new EffectBasket(m_effectList);
connect(m_effectBasket, SIGNAL(addEffect(QDomElement)), this, SLOT(slotAddEffect(QDomElement)));
QWidgetAction *widgetlist = new QWidgetAction(this);
widgetlist->setText(i18n("Favorite Effects"));
widgetlist->setDefaultWidget(m_effectBasket);
widgetlist->setText(i18n("Favorite Effects"));
widgetlist->setToolTip(i18n("Favorite Effects"));
widgetlist->setIcon(KoIconUtils::themedIcon("favorite"));
QMenu *menu = new QMenu(this);
menu->addAction(widgetlist);
......@@ -314,21 +317,25 @@ MainWindow::MainWindow(const QString &MltPath, const QUrl &Url, const QString &
basketButton->setMenu(menu);
basketButton->setDefaultAction(widgetlist);
basketButton->setPopupMode(QToolButton::InstantPopup);
basketButton->setIcon(KoIconUtils::themedIcon("favorite"));
basketButton->setToolTip(i18n("Favorite Effects"));
basketButton->setText(i18n("Favorite Effects"));
basketButton->setShortcut(Qt::CTRL + Qt::Key_R);
actionCollection()->addAction("fav_aff", basketButton);
setupGUI();
basketButton->setToolTip(i18n("Favorite Effects"));
basketButton->setIcon(KoIconUtils::themedIcon("favorite"));
QWidgetAction* toolButtonAction = new QWidgetAction(this);
toolButtonAction->setText(i18n("Favorite Effects"));
toolButtonAction->setIcon(KoIconUtils::themedIcon("favorite"));
toolButtonAction->setDefaultWidget(basketButton);
QToolBar *extraTB = static_cast<QToolBar*>(factory()->container("extraToolBar", this));
extraTB->addWidget(basketButton);
addAction("favorite_effects", toolButtonAction);
connect(toolButtonAction, SIGNAL(triggered(bool)), basketButton, SLOT(showMenu()));
setupGUI();
/*ScriptingPart* sp = new ScriptingPart(this, QStringList());
guiFactory()->addClient(sp);*/
loadPlugins();
loadDockActions();
loadDockActions();
loadClipActions();
m_projectMonitor->setupMenu(static_cast<QMenu*>(factory()->container("monitor_go", this)), m_playZone, m_loopZone, NULL, m_loopClip);
......@@ -2658,11 +2665,10 @@ void MainWindow::loadClipActions()
QList <QAction *>atcActions = getExtraActions("audiotranscoderslist");
unplugActionList("audio_transcoders_list");
plugActionList("audio_transcoders_list", atcActions);
QList <QAction *>tcActions = getExtraActions("transcoderslist");
unplugActionList("transcoders_list");
plugActionList("transcoders_list", tcActions);
}
void MainWindow::loadDockActions()
......
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