コード例 #1
0
ファイル: dlgprefeffects.cpp プロジェクト: MK-42/mixxx
void DlgPrefEffects::availableEffectsListItemSelected(const QModelIndex& selected) {
    QString effectId = m_availableEffectsModel.data(selected, Qt::UserRole).toString();

    if (effectId == QVariant().toString())
        return;

    EffectManifestPointer pManifest = m_pEffectsManager->getEffectManifest(effectId);

    effectName->setText(pManifest->name());
    effectAuthor->setText(pManifest->author());
    effectDescription->setText(pManifest->description());
    effectVersion->setText(pManifest->version());
    effectType->setText(pManifest->translatedBackendName());
}
コード例 #2
0
ファイル: dlgprefeq.cpp プロジェクト: badescunicu/mixxx
void DlgPrefEQ::slotPopulateDeckEffectSelectors() {
    m_inSlotPopulateDeckEffectSelectors = true; // prevents a recursive call

    EffectsManager::EffectManifestFilterFnc filterEQ;
    if (CheckBoxEqOnly->isChecked()) {
        m_pConfig->set(ConfigKey(kConfigKey, kEqsOnly), QString("yes"));
        filterEQ = isMixingEQ;
    } else {
        m_pConfig->set(ConfigKey(kConfigKey, kEqsOnly), QString("no"));
        filterEQ = nullptr; // take all
    }

    const QList<EffectManifestPointer> availableEQEffects =
        m_pEffectsManager->getAvailableEffectManifestsFiltered(filterEQ);
    const QList<EffectManifestPointer> availableQuickEffects =
        m_pEffectsManager->getAvailableEffectManifestsFiltered(hasSuperKnobLinking);

    for (QComboBox* box : m_deckEqEffectSelectors) {
        // Populate comboboxes with all available effects
        // Save current selection
        QString selectedEffectId = box->itemData(box->currentIndex()).toString();
        QString selectedEffectName = box->itemText(box->currentIndex());
        box->clear();
        int currentIndex = -1; // Nothing selected

        int i;
        for (i = 0; i < availableEQEffects.size(); ++i) {
            EffectManifestPointer pManifest = availableEQEffects.at(i);
            box->addItem(pManifest->name(), QVariant(pManifest->id()));
            if (selectedEffectId == pManifest->id()) {
                currentIndex = i;
            }
        }
        //: Displayed when no effect is selected
        box->addItem(tr("None"), QVariant(QString("")));
        if (selectedEffectId.isNull()) {
            currentIndex = availableEQEffects.size(); // selects "None"
        }
        if (currentIndex < 0 && !selectedEffectName.isEmpty()) {
            // current selection is not part of the new list
            // So we need to add it
            box->addItem(selectedEffectName, QVariant(selectedEffectId));
            currentIndex = i + 1;
        }
        box->setCurrentIndex(currentIndex);
    }

    for (QComboBox* box : m_deckQuickEffectSelectors) {
        // Populate comboboxes with all available effects
        // Save current selection
        QString selectedEffectId = box->itemData(box->currentIndex()).toString();
        QString selectedEffectName = box->itemText(box->currentIndex());
        box->clear();
        int currentIndex = -1;// Nothing selected

        int i;
        for (i = 0; i < availableQuickEffects.size(); ++i) {
            EffectManifestPointer pManifest = availableQuickEffects.at(i);
            box->addItem(pManifest->name(), QVariant(pManifest->id()));
            if (selectedEffectId == pManifest->id()) {
                currentIndex = i;
            }
        }
        //: Displayed when no effect is selected
        box->addItem(tr("None"), QVariant(QString("")));
        if (selectedEffectId.isNull()) {
            currentIndex = availableQuickEffects.size(); // selects "None"
        }
        if (currentIndex < 0 && !selectedEffectName.isEmpty()) {
            // current selection is not part of the new list
            // So we need to add it
            box->addItem(selectedEffectName, QVariant(selectedEffectId));
            currentIndex = i + 1;
        }
        box->setCurrentIndex(currentIndex);
    }

    m_inSlotPopulateDeckEffectSelectors = false;
}