QWidget *p5 = new QWidget;
m_configShuttle.setupUi(p5);
+ m_configShuttle.toolBtnReload->setIcon(KIcon("view-refresh"));
#ifdef USE_JOGSHUTTLE
connect(m_configShuttle.kcfg_enableshuttle, SIGNAL(stateChanged(int)), this, SLOT(slotCheckShuttle(int)));
connect(m_configShuttle.shuttledevicelist, SIGNAL(activated(int)), this, SLOT(slotUpdateShuttleDevice(int)));
+ connect(m_configShuttle.toolBtnReload, SIGNAL(clicked(bool)), this, SLOT(slotReloadShuttleDevices()));
+
slotCheckShuttle(KdenliveSettings::enableshuttle());
m_configShuttle.shuttledisabled->hide();
// Store the button pointers into an array for easier handling them in the other functions.
// TODO: impl enumerator or live with cut and paste :-)))
+ setupJogshuttleBtns(KdenliveSettings::shuttledevice());
+
+#if 0
m_shuttle_buttons.push_back(m_configShuttle.shuttle1);
m_shuttle_buttons.push_back(m_configShuttle.shuttle2);
m_shuttle_buttons.push_back(m_configShuttle.shuttle3);
m_shuttle_buttons.push_back(m_configShuttle.shuttle13);
m_shuttle_buttons.push_back(m_configShuttle.shuttle14);
m_shuttle_buttons.push_back(m_configShuttle.shuttle15);
+#endif
- // populate the buttons with the current configuration. The items are sorted
- // according to the user-selected language, so they do not appear in random order.
- QList<QString> action_names = mappable_actions.keys();
- qSort(action_names);
-
- // Here we need to compute the action_id -> index-in-action_names. We iterate over the
- // action_names, as the sorting may depend on the user-language.
- QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
- QMap<QString, int> action_pos;
- foreach (const QString& action_id, actions_map) {
- // This loop find out at what index is the string that would map to the action_id.
- for (int i = 0; i < action_names.size(); ++i) {
- if (mappable_actions[action_names.at(i)] == action_id) {
- action_pos[action_id] = i;
- break;
- }
- }
- }
-
- int i = 0;
- foreach (KComboBox* button, m_shuttle_buttons) {
- button->addItems(action_names);
- connect(button, SIGNAL(activated(int)), this, SLOT(slotShuttleModified()));
- ++i;
- if (i < actions_map.size())
- button->setCurrentIndex(action_pos[actions_map[i]]);
- }
#else /* ! USE_JOGSHUTTLE */
m_configShuttle.kcfg_enableshuttle->hide();
m_configShuttle.kcfg_enableshuttle->setDisabled(true);
m_configSdl.reload_blackmagic->setIcon(KIcon("view-refresh"));
connect(m_configSdl.reload_blackmagic, SIGNAL(clicked(bool)), this, SLOT(slotReloadBlackMagic()));
-#ifndef USE_OPENGL
- m_configSdl.kcfg_openglmonitors->setHidden(true);
-#endif
-
m_page6 = addPage(p6, i18n("Playback"), "media-playback-start");
QWidget *p7 = new QWidget;
} else m_configCapture.dvgrab_info->setText(i18n("<strong><em>dvgrab</em> utility not found, please install it for firewire capture</strong>"));
}
+void KdenliveSettingsDialog::setupJogshuttleBtns(QString device)
+{
+ QList<KComboBox*> list;
+ QList<QLabel*> list1;
+
+ list << m_configShuttle.shuttle1;
+ list << m_configShuttle.shuttle2;
+ list << m_configShuttle.shuttle3;
+ list << m_configShuttle.shuttle4;
+ list << m_configShuttle.shuttle5;
+ list << m_configShuttle.shuttle6;
+ list << m_configShuttle.shuttle7;
+ list << m_configShuttle.shuttle8;
+ list << m_configShuttle.shuttle9;
+ list << m_configShuttle.shuttle10;
+ list << m_configShuttle.shuttle11;
+ list << m_configShuttle.shuttle12;
+ list << m_configShuttle.shuttle13;
+ list << m_configShuttle.shuttle14;
+ list << m_configShuttle.shuttle15;
+
+ list1 << m_configShuttle.label_2; // #1
+ list1 << m_configShuttle.label_4; // #2
+ list1 << m_configShuttle.label_3; // #3
+ list1 << m_configShuttle.label_7; // #4
+ list1 << m_configShuttle.label_5; // #5
+ list1 << m_configShuttle.label_6; // #6
+ list1 << m_configShuttle.label_8; // #7
+ list1 << m_configShuttle.label_9; // #8
+ list1 << m_configShuttle.label_10; // #9
+ list1 << m_configShuttle.label_11; // #10
+ list1 << m_configShuttle.label_12; // #11
+ list1 << m_configShuttle.label_13; // #12
+ list1 << m_configShuttle.label_14; // #13
+ list1 << m_configShuttle.label_15; // #14
+ list1 << m_configShuttle.label_16; // #15
+
+
+ for (int i = 0; i < list.count(); i++) {
+ list[i]->hide();
+ list1[i]->hide();
+ }
+
+#ifdef USE_JOGSHUTTLE
+ int keysCount = JogShuttle::keysCount(device);
+
+ for (int i = 0; i < keysCount; i++) {
+ m_shuttle_buttons.push_back(list[i]);
+ list[i]->show();
+ list1[i]->show();
+ }
+
+ // populate the buttons with the current configuration. The items are sorted
+ // according to the user-selected language, so they do not appear in random order.
+ QMap<QString, QString> mappable_actions(m_mappable_actions);
+ QList<QString> action_names = mappable_actions.keys();
+ QList<QString>::Iterator iter = action_names.begin();
+ kDebug() << "::::::::::::::::";
+ while (iter != action_names.end()) {
+ kDebug() << *iter;
+ ++iter;
+ }
+
+ kDebug() << "::::::::::::::::";
+
+ qSort(action_names);
+ iter = action_names.begin();
+ while (iter != action_names.end()) {
+ kDebug() << *iter;
+ ++iter;
+ }
+ kDebug() << "::::::::::::::::";
+
+ // Here we need to compute the action_id -> index-in-action_names. We iterate over the
+ // action_names, as the sorting may depend on the user-language.
+ QStringList actions_map = JogShuttleConfig::actionMap(KdenliveSettings::shuttlebuttons());
+ QMap<QString, int> action_pos;
+ foreach (const QString& action_id, actions_map) {
+ // This loop find out at what index is the string that would map to the action_id.
+ for (int i = 0; i < action_names.size(); ++i) {
+ if (mappable_actions[action_names.at(i)] == action_id) {
+ action_pos[action_id] = i;
+ break;
+ }
+ }
+ }
+
+ int i = 0;
+ foreach (KComboBox* button, m_shuttle_buttons) {
+ button->addItems(action_names);
+ connect(button, SIGNAL(activated(int)), this, SLOT(slotShuttleModified()));
+ ++i;
+ if (i < actions_map.size())
+ button->setCurrentIndex(action_pos[actions_map[i]]);
+ }
+#endif
+}
+
KdenliveSettingsDialog::~KdenliveSettingsDialog() {}
void KdenliveSettingsDialog::slotUpdateGrabRegionStatus()
{
#ifdef USE_JOGSHUTTLE
m_configShuttle.config_group->setEnabled(state);
- if (m_configShuttle.shuttledevicelist->count() == 0) {
- QString devDirStr = "/dev/input/by-id";
- QDir devDir(devDirStr);
- if (!devDir.exists()) {
- devDirStr = "/dev/input";
- }
+ m_configShuttle.shuttledevicelist->clear();
- DeviceMap devMap = JogShuttle::enumerateDevices(devDirStr);
-#if 0
- if (!devMap.isEmpty()) {
- m_configShuttle.shuttledevicelist->clear();
- }
-#endif
- DeviceMapIter iter = devMap.begin();
- while (iter != devMap.end()) {
- kDebug() << iter.key() << ": " << iter.value();
- m_configShuttle.shuttledevicelist->addItem(
- iter.key(),
- iter.value());
- ++iter;
- }
+ QStringList devNames = KdenliveSettings::shuttledevicenames();
+ QStringList devPaths = KdenliveSettings::shuttledevicepaths();
- if (KdenliveSettings::shuttledevice().isEmpty()) {
- QTimer::singleShot(1500, this, SLOT(slotUpdateShuttleDevice()));
- }
+ if (devNames.count() != devPaths.count()) {
+ return;
+ }
+ for (int i = 0; i < devNames.count(); i++) {
+ m_configShuttle.shuttledevicelist->addItem(
+ devNames.at(i), devPaths.at(i));
}
#endif /* USE_JOGSHUTTLE */
}
#ifdef USE_JOGSHUTTLE
QString device = m_configShuttle.shuttledevicelist->itemData(ix).toString();
//KdenliveSettings::setShuttledevice(device);
+ setupJogshuttleBtns(device);
m_configShuttle.kcfg_shuttledevice->setText(device);
#endif /* USE_JOGSHUTTLE */
}
}
m_configSdl.kcfg_external_display->setEnabled(KdenliveSettings::decklink_device_found());
}
+
+void KdenliveSettingsDialog::slotReloadShuttleDevices()
+{
+#ifdef USE_JOGSHUTTLE
+ QString devDirStr = "/dev/input/by-id";
+ QDir devDir(devDirStr);
+ if (!devDir.exists()) {
+ devDirStr = "/dev/input";
+ }
+
+ DeviceMap devMap = JogShuttle::enumerateDevices(devDirStr);
+ if (!devMap.isEmpty()) {
+ m_configShuttle.shuttledevicelist->clear();
+ }
+
+ QStringList devNamesList;
+ QStringList devPathList;
+ DeviceMapIter iter = devMap.begin();
+ if (iter == devMap.end()) {
+ KdenliveSettings::shuttledevicenames().clear();
+ KdenliveSettings::shuttledevicepaths().clear();
+ m_configShuttle.shuttledevicelist->clear();
+ }
+ while (iter != devMap.end()) {
+ kDebug() << iter.key() << ": " << iter.value();
+ m_configShuttle.shuttledevicelist->addItem(iter.key(), iter.value());
+ devNamesList << iter.key();
+ devPathList << iter.value();
+ ++iter;
+ }
+
+ KdenliveSettings::setShuttledevicenames(devNamesList);
+ KdenliveSettings::setShuttledevicepaths(devPathList);
+ QTimer::singleShot(200, this, SLOT(slotUpdateShuttleDevice()));
+
+ kDebug() << "Devices reloaded";
+
+#endif //USE_JOGSHUTTLE
+}
+
#include "kdenlivesettingsdialog.moc"