***************************************************************************/
#include <QDir>
+#include <QTimer>
#include <KStandardDirs>
#include <KDebug>
+#include <stdlib.h>
+#include <stdio.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <linux/input.h>
+
#include "profilesdialog.h"
#include "kdenlivesettings.h"
#include "kdenlivesettingsdialog.h"
m_configEnv.rendererpathurl->lineEdit()->setObjectName("kcfg_rendererpath");
m_configEnv.tmppathurl->setMode(KFile::Directory);
m_configEnv.tmppathurl->lineEdit()->setObjectName("kcfg_currenttmpfolder");
+ m_configEnv.capturefolderurl->setMode(KFile::Directory);
+ m_configEnv.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder");
page2 = addPage(p2, i18n("Environnement"), "terminal");
QWidget *p4 = new QWidget;
m_configCapture.setupUi(p4);
- m_configCapture.capturefolderurl->setMode(KFile::Directory);
- m_configCapture.capturefolderurl->lineEdit()->setObjectName("kcfg_capturefolder");
page4 = addPage(p4, i18n("Capture"), "audio-card");
- connect(m_configCapture.kcfg_video4vdevice, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
- connect(m_configCapture.kcfg_video4adevice, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
- connect(m_configCapture.kcfg_video4vformat, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
- connect(m_configCapture.kcfg_video4aformat, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
- connect(m_configCapture.kcfg_video4vencoding, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
- connect(m_configCapture.kcfg_video4aencoding, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
- connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
- connect(m_configCapture.kcfg_video4rate, SIGNAL(editingFinished ()), this, SLOT(rebuildVideo4Commands()));
+ QWidget *p5 = new QWidget;
+ m_configShuttle.setupUi(p5);
+ connect(m_configShuttle.kcfg_enableshuttle, SIGNAL(stateChanged(int)), this, SLOT(slotCheckShuttle(int)));
+ connect(m_configShuttle.shuttledevicelist, SIGNAL(activated(int)), this, SLOT(slotUpdateShuttleDevice(int)));
+ slotCheckShuttle(KdenliveSettings::enableshuttle());
+ page5 = addPage(p5, i18n("JogShuttle"), "input-mouse");
+
+ QStringList actions;
+ actions << i18n("Do nothing");
+ actions << i18n("Play / Pause");
+ actions << i18n("Cut");
+ m_configShuttle.kcfg_shuttle1->addItems(actions);
+ m_configShuttle.kcfg_shuttle2->addItems(actions);
+ m_configShuttle.kcfg_shuttle3->addItems(actions);
+ m_configShuttle.kcfg_shuttle4->addItems(actions);
+ m_configShuttle.kcfg_shuttle5->addItems(actions);
+
+ connect(m_configCapture.kcfg_video4vdevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+ connect(m_configCapture.kcfg_video4adevice, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+ connect(m_configCapture.kcfg_video4vformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+ connect(m_configCapture.kcfg_video4aformat, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+ connect(m_configCapture.kcfg_video4vencoding, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+ connect(m_configCapture.kcfg_video4aencoding, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+ connect(m_configCapture.kcfg_video4size, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+ connect(m_configCapture.kcfg_video4rate, SIGNAL(editingFinished()), this, SLOT(rebuildVideo4Commands()));
+
QStringList profilesNames = ProfilesDialog::getProfileNames();
- m_configMisc.profiles_list->addItems(profilesNames);
- m_defaulfProfile = ProfilesDialog::getSettingsFromFile(KdenliveSettings::default_profile()).value("description");
- if (profilesNames.contains(m_defaulfProfile)) m_configMisc.profiles_list->setCurrentItem(m_defaulfProfile);
+ m_configMisc.kcfg_profiles_list->addItems(profilesNames);
+ m_defaultProfile = ProfilesDialog::getSettingsFromFile(KdenliveSettings::default_profile()).value("description");
+ if (profilesNames.contains(m_defaultProfile)) {
+ m_configMisc.kcfg_profiles_list->setCurrentItem(m_defaultProfile);
+ KdenliveSettings::setProfiles_list(profilesNames.indexOf(m_defaultProfile));
+ }
slotUpdateDisplay();
- connect(m_configMisc.profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
+
+ connect(m_configMisc.kcfg_profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay()));
}
KdenliveSettingsDialog::~KdenliveSettingsDialog() {}
+void KdenliveSettingsDialog::slotCheckShuttle(int state) {
+ m_configShuttle.config_group->setEnabled(state);
+ if (m_configShuttle.shuttledevicelist->count() == 0) {
+ // parse devices
+ QString baseName = "/dev/input/event";
+ int fd;
+ for (int i = 0; i < 30; i++) {
+ QString filename = baseName + QString::number(i);
+ kDebug() << "/// CHECKING OFR: " << filename;
+
+ char name[256] = "unknown";
+ fd = ::open((char *) filename.toUtf8().data(), O_RDONLY);
+ if (fd >= 0 && ioctl(fd, EVIOCGNAME(sizeof(name)), name) >= 0) {
+ m_configShuttle.shuttledevicelist->addItem(name, filename);
+ }
+ ::close(fd);
+ }
+ if (KdenliveSettings::shuttledevice().isEmpty()) QTimer::singleShot(1500, this, SLOT(slotUpdateShuttleDevice()));
+ }
+}
+
+void KdenliveSettingsDialog::slotUpdateShuttleDevice(int ix) {
+ QString device = m_configShuttle.shuttledevicelist->itemData(ix).toString();
+ //KdenliveSettings::setShuttledevice(device);
+ m_configShuttle.kcfg_shuttledevice->setText(device);
+}
+
void KdenliveSettingsDialog::rebuildVideo4Commands() {
QString captureCommand;
- if (!m_configCapture.kcfg_video4adevice->text().isEmpty()) captureCommand = "-f " + m_configCapture.kcfg_video4aformat->text() + " -i " + m_configCapture.kcfg_video4adevice->text();
+ if (!m_configCapture.kcfg_video4adevice->text().isEmpty()) captureCommand = "-f " + m_configCapture.kcfg_video4aformat->text() + " -i " + m_configCapture.kcfg_video4adevice->text();
- captureCommand += " -f " + m_configCapture.kcfg_video4vformat->text() + " -s " + m_configCapture.kcfg_video4size->text() + " -r " + QString::number(m_configCapture.kcfg_video4rate->value()) + " -i " + m_configCapture.kcfg_video4vdevice->text() + " -f " + m_configCapture.kcfg_video4vencoding->text();
- m_configCapture.kcfg_video4capture->setText(captureCommand);
+ captureCommand += " -f " + m_configCapture.kcfg_video4vformat->text() + " -s " + m_configCapture.kcfg_video4size->text() + " -r " + QString::number(m_configCapture.kcfg_video4rate->value()) + " -i " + m_configCapture.kcfg_video4vdevice->text() + " -f " + m_configCapture.kcfg_video4vencoding->text();
+ m_configCapture.kcfg_video4capture->setText(captureCommand);
- QString playbackCommand;
- playbackCommand = "-f " + m_configCapture.kcfg_video4vencoding->text();
- m_configCapture.kcfg_video4playback->setText(playbackCommand);
+ QString playbackCommand;
+ playbackCommand = "-f " + m_configCapture.kcfg_video4vencoding->text();
+ m_configCapture.kcfg_video4playback->setText(playbackCommand);
}
bool KdenliveSettingsDialog::hasChanged() {
- kDebug() << "// // // KCONFIG hasChanged called";
- if (m_configMisc.profiles_list->currentText() != m_defaulfProfile) return true;
+ kDebug() << "// // // KCONFIG hasChanged called: " << m_configMisc.kcfg_profiles_list->currentText() << ", " << m_defaultProfile;
+ if (m_configMisc.kcfg_profiles_list->currentText() != m_defaultProfile) return true;
return KConfigDialog::hasChanged();
}
+void KdenliveSettingsDialog::updateSettings() {
+ kDebug() << "// // // KCONFIG UPDATE called";
+ m_defaultProfile = m_configMisc.kcfg_profiles_list->currentText();
+ KdenliveSettings::setDefault_profile(m_defaultPath);
+ KConfigDialog::updateSettings();
+}
+
void KdenliveSettingsDialog::slotUpdateDisplay() {
- QString currentProfile = m_configMisc.profiles_list->currentText();
+ QString currentProfile = m_configMisc.kcfg_profiles_list->currentText();
QMap< QString, QString > values = ProfilesDialog::getSettingsForProfile(currentProfile);
m_configMisc.p_size->setText(values.value("width") + "x" + values.value("height"));
m_configMisc.p_fps->setText(values.value("frame_rate_num") + "/" + values.value("frame_rate_den"));
m_configMisc.p_display->setText(values.value("display_aspect_num") + "/" + values.value("display_aspect_den"));
if (values.value("progressive").toInt() == 0) m_configMisc.p_progressive->setText(i18n("Interlaced"));
else m_configMisc.p_progressive->setText(i18n("Progressive"));
+ m_defaultPath = values.value("path");
}