+
+#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