X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=src%2Fkdenlivesettingsdialog.cpp;h=431f9170fa9b5137c5c7e95ba6f84ddcbdf3f665;hb=67b516688ebe28ebae23296ea72e11ae2fb52cf2;hp=4a73a877a18556a17d63ffc9bd0276fe74f48df8;hpb=5e706476c65bb87b1c7e1159a82048067d400bcd;p=kdenlive diff --git a/src/kdenlivesettingsdialog.cpp b/src/kdenlivesettingsdialog.cpp index 4a73a877..431f9170 100644 --- a/src/kdenlivesettingsdialog.cpp +++ b/src/kdenlivesettingsdialog.cpp @@ -18,10 +18,17 @@ ***************************************************************************/ #include +#include #include #include +#include +#include +#include +#include +#include + #include "profilesdialog.h" #include "kdenlivesettings.h" #include "kdenlivesettingsdialog.h" @@ -53,6 +60,9 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog( 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; @@ -78,7 +88,6 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog( 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); - slotUpdateDisplay(); connect(m_configMisc.profiles_list, SIGNAL(currentIndexChanged(int)), this, SLOT(slotUpdateDisplay())); } @@ -86,6 +95,33 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent): KConfigDialog( 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();