]> git.sesse.net Git - kdenlive/blob - src/monitorscenecontrolwidget.cpp
Make jog shuttle buttons work, based on patch from P. Fleury,
[kdenlive] / src / monitorscenecontrolwidget.cpp
1 /***************************************************************************
2  *   Copyright (C) 2010 by Till Theato (root@ttill.de)                     *
3  *                                                                         *
4  *   This program is free software; you can redistribute it and/or modify  *
5  *   it under the terms of the GNU General Public License as published by  *
6  *   the Free Software Foundation; either version 2 of the License, or     *
7  *   (at your option) any later version.                                   *
8  *                                                                         *
9  *   This program is distributed in the hope that it will be useful,       *
10  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
11  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
12  *   GNU General Public License for more details.                          *
13  *                                                                         *
14  *   You should have received a copy of the GNU General Public License     *
15  *   along with this program; if not, write to the                         *
16  *   Free Software Foundation, Inc.,                                       *
17  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA          *
18  ***************************************************************************/
19
20 #include "monitorscenecontrolwidget.h"
21 #include "monitorscene.h"
22 #include "kdenlivesettings.h"
23
24 #include <QGridLayout>
25
26
27 MonitorSceneControlWidget::MonitorSceneControlWidget(MonitorScene* scene, QWidget* parent) :
28         QWidget(parent),
29         m_scene(scene)
30 {
31     m_ui.setupUi(this);
32
33     m_buttonConfig = new QToolButton();
34     m_buttonConfig->setCheckable(true);
35     m_buttonConfig->setAutoRaise(true);
36     m_buttonConfig->setIcon(KIcon("system-run"));
37     m_buttonConfig->setToolTip(i18n("Show/Hide Settings"));
38     this->setHidden(true);
39
40     m_ui.buttonShowScene->setIcon(KIcon("video-display"));
41     m_ui.buttonShowScene->setToolTip(i18n("Show monitor scene"));
42     m_ui.buttonDirectUpdate->setIcon(KIcon("transform-scale"));
43     m_ui.buttonDirectUpdate->setToolTip(i18n("Update parameters while monitor scene changes"));
44     m_ui.buttonDirectUpdate->setChecked(KdenliveSettings::monitorscene_directupdate());
45
46     m_ui.buttonZoomFit->setIcon(KIcon("zoom-fit-best"));
47     m_ui.buttonZoomFit->setToolTip(i18n("Fit zoom to monitor size"));
48     m_ui.buttonZoomOriginal->setIcon(KIcon("zoom-original"));
49     m_ui.buttonZoomOriginal->setToolTip(i18n("Original size"));
50     m_ui.buttonZoomIn->setIcon(KIcon("zoom-in"));
51     m_ui.buttonZoomIn->setToolTip(i18n("Zoom in"));
52     m_ui.buttonZoomOut->setIcon(KIcon("zoom-out"));
53     m_ui.buttonZoomOut->setToolTip(i18n("Zoom out"));
54
55     connect(m_buttonConfig, SIGNAL(toggled(bool)), this, SLOT(setVisible(bool)));
56
57     connect(m_ui.sliderZoom, SIGNAL(valueChanged(int)), m_scene, SLOT(slotZoom(int)));
58     connect(m_scene, SIGNAL(zoomChanged(int)), m_ui.sliderZoom, SLOT(setValue(int)));
59     connect(m_ui.buttonZoomFit,      SIGNAL(clicked()), m_scene, SLOT(slotZoomFit()));
60     connect(m_ui.buttonZoomOriginal, SIGNAL(clicked()), m_scene, SLOT(slotZoomOriginal()));
61     connect(m_ui.buttonZoomIn,       SIGNAL(clicked()), m_scene, SLOT(slotZoomIn()));
62     connect(m_ui.buttonZoomOut,      SIGNAL(clicked()), m_scene, SLOT(slotZoomOut()));
63     m_scene->slotZoomFit();
64
65     connect(m_ui.buttonShowScene, SIGNAL(toggled(bool)), this, SIGNAL(showScene(bool)));
66     connect(m_ui.buttonDirectUpdate, SIGNAL(toggled(bool)), this, SLOT(slotSetDirectUpdate(bool)));
67 }
68
69 MonitorSceneControlWidget::~MonitorSceneControlWidget()
70 {
71     delete m_buttonConfig;
72 }
73
74 QToolButton *MonitorSceneControlWidget::getShowHideButton()
75 {
76     return m_buttonConfig;
77 }
78
79 void MonitorSceneControlWidget::addWidget(QWidget* widget, int row, int column)
80 {
81     ((QGridLayout*)m_ui.groupBox->layout())->addWidget(widget, row, column);
82 }
83
84 void MonitorSceneControlWidget::slotSetDirectUpdate(bool directUpdate)
85 {
86     KdenliveSettings::setMonitorscene_directupdate(directUpdate);
87 }
88
89
90 #include "monitorscenecontrolwidget.moc"