layoutActions->addAction("save_layout" + QString::number(i), save);
}
+ KAction *action;
+ // Stop motion actions. Beware of the order, we MUST use the same order in stopmotion/stopmotion.cpp
+ m_stopmotion_actions = new KActionCategory(i18n("Stop Motion"), actionCollection());
+ action = new KAction(KIcon("media-record"), i18n("Capture frame"), this);
+ action->setShortcut(Qt::Key_Space);
+ //action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ m_stopmotion_actions->addAction("stopmotion_capture", action);
+ action = new KAction(i18n("Switch live / captured frame"), this);
+ //action->setShortcutContext(Qt::WidgetWithChildrenShortcut);
+ m_stopmotion_actions->addAction("stopmotion_switch", action);
+ action = new KAction(KIcon("edit-paste"), i18n("Show last frame over video"), this);
+ action->setCheckable(true);
+ action->setChecked(false);
+ m_stopmotion_actions->addAction("stopmotion_overlay", action);
setupGUI();
static_cast<QMenu*>(factory()->container("transcoders", this)),
clipInTimeline);
- KAction *action;
// build themes menus
QMenu *themesMenu = static_cast<QMenu*>(factory()->container("themes_menu", this));
QActionGroup *themegroup = new QActionGroup(this);
void MainWindow::queryQuit()
{
if (queryClose()) {
- kapp->quit();
+ close();
}
}
// Recreate stopmotion widget on document change
if (m_stopmotion) {
- delete m_stopmotion;
- m_stopmotion = NULL;
+ delete m_stopmotion;
+ m_stopmotion = NULL;
}
KProgressDialog progressDialog(this, i18n("Loading project"), i18n("Loading project"));
// Recreate the stopmotion widget if profile changes
if (m_stopmotion) {
- delete m_stopmotion;
- m_stopmotion = NULL;
+ delete m_stopmotion;
+ m_stopmotion = NULL;
}
// Deselect current effect / transition
void MainWindow::slotOpenStopmotion()
{
if (m_stopmotion == NULL) {
- m_stopmotion = new StopmotionWidget(m_activeDocument->projectFolder(), this);
+ m_stopmotion = new StopmotionWidget(m_activeDocument->projectFolder(), m_stopmotion_actions->actions(), this);
connect(m_stopmotion, SIGNAL(addOrUpdateSequence(const QString)), m_projectList, SLOT(slotAddOrUpdateSequence(const QString)));
}
m_stopmotion->show();
#include <KRecentFilesAction>
#include <KComboBox>
#include <kautosavefile.h>
+#include <KActionCategory>
#include "effectslist.h"
#include "gentime.h"
QMenu *m_timelineContextTransitionMenu;
KUrl m_startUrl;
+ /** Actions used in the stopmotion widget */
+ KActionCategory *m_stopmotion_actions;
+
/** @brief Shortcut to remove the focus from any element.
*
* It allows to get out of e.g. text input fields and to press another
void slotEditClipMarker();
/** @brief Adds marker or auide at the current position without showing the marker dialog.
- *
+ *
* Adds a marker if clip monitor is active, otherwise a guide.
* The comment is set to the current position (therefore not dialog).
* This can be useful to mark something during playback. */
}
-StopmotionWidget::StopmotionWidget(KUrl projectFolder, QWidget *parent) :
+StopmotionWidget::StopmotionWidget(KUrl projectFolder, const QList< QAction * > actions, QWidget *parent) :
QDialog(parent)
, Ui::Stopmotion_UI()
, m_projectFolder(projectFolder)
, m_sequenceFrame(0)
, m_animatedIndex(-1)
{
+ addActions(actions);
setupUi(this);
setWindowTitle(i18n("Stop Motion Capture"));
setFont(KGlobalSettings::toolBarFont());
live_button->setIcon(KIcon("camera-photo"));
- m_captureAction = new QAction(KIcon("media-record"), i18n("Capture frame"), this);
- m_captureAction->setShortcut(QKeySequence(Qt::Key_Space));
+
+ m_captureAction = actions.at(0);
connect(m_captureAction, SIGNAL(triggered()), this, SLOT(slotCaptureFrame()));
capture_button->setDefaultAction(m_captureAction);
+ connect(actions.at(1), SIGNAL(triggered()), this, SLOT(slotSwitchLive()));
+
preview_button->setIcon(KIcon("media-playback-start"));
capture_button->setEnabled(false);
// Build config menu
QMenu *confMenu = new QMenu;
- m_showOverlay = new QAction(KIcon("edit-paste"), i18n("Show last frame over video"), this);
- m_showOverlay->setCheckable(true);
- m_showOverlay->setChecked(false);
+ m_showOverlay = actions.at(2);
connect(m_showOverlay, SIGNAL(triggered(bool)), this, SLOT(slotShowOverlay(bool)));
confMenu->addAction(m_showOverlay);
}
}
+void StopmotionWidget::slotSwitchLive()
+{
+ setUpdatesEnabled(false);
+ if (m_frame_preview->isHidden()) {
+ m_bmCapture->hidePreview(true);
+ m_frame_preview->setHidden(false);
+ } else {
+ m_frame_preview->setHidden(true);
+ m_bmCapture->hidePreview(false);
+ }
+ setUpdatesEnabled(true);
+}
+
void StopmotionWidget::slotLive(bool isOn)
{
if (isOn) {
- m_frame_preview->setImage(QImage());
+ //m_frame_preview->setImage(QImage());
m_frame_preview->setHidden(true);
m_bmCapture->startPreview(KdenliveSettings::hdmi_capturedevice(), KdenliveSettings::hdmi_capturemode());
capture_button->setEnabled(true);
} else {
m_bmCapture->stopPreview();
+ m_frame_preview->setHidden(false);
capture_button->setEnabled(false);
live_button->setChecked(false);
}
void StopmotionWidget::slotShowFrame(const QString &path)
{
- slotLive(false);
+ //slotLive(false);
QImage img(path);
capture_button->setEnabled(false);
if (!img.isNull()) {
/** @brief Build the stopmotion dialog.
* @param projectFolder The current project folder, where captured files will be stored.
+ * @param actions The actions for this widget that can have a keyboard shortcut.
* @param parent (optional) parent widget */
- StopmotionWidget(KUrl projectFolder, QWidget *parent = 0);
+ StopmotionWidget(KUrl projectFolder, const QList< QAction * > actions, QWidget *parent = 0);
virtual ~StopmotionWidget();
protected:
/** @brief Set the effect to be applied to overlay frame. */
void slotUpdateOverlayEffect(QAction *act);
+ /** @brief Switch between live view / currently selected fram. */
+ void slotSwitchLive();
signals:
/** @brief Ask to add sequence to current project. */
void addOrUpdateSequence(const QString);