view editor/edres.cpp @ 2576:812b16ee49db

I had been living under apparent false impression that "realfft.c" on which the FFT implementation in DMLIB was basically copied from was released in public domain at some point, but it could very well be that it never was. Correct license is (or seems to be) GNU GPL. Thus I removing the code from DMLIB, and profusely apologize to the author, Philip Van Baren. It was never my intention to distribute code based on his original work under a more liberal license than originally intended.
author Matti Hamalainen <ccr@tnsp.org>
date Fri, 11 Mar 2022 16:32:50 +0200
parents e2ac08228a0f
children
line wrap: on
line source

#include "edres.h"
#include "dmengine.h"


QEDResourceModel::QEDResourceModel(QObject *parent)
    : QAbstractTableModel(parent)
{
}


int QEDResourceModel::rowCount(const QModelIndex &parent) const
{
    Q_UNUSED(parent);
    return nengineEffects;
}


int QEDResourceModel::columnCount(const QModelIndex &parent) const
{
    Q_UNUSED(parent);
    return 2;
}


QVariant QEDResourceModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (index.row() >= nengineEffects || index.row() < 0)
        return QVariant();

    if (role == Qt::DisplayRole)
    {
        DMEffect *ef = &engineEffects[index.row()];
        switch (index.column())
        {
            case 0:
                return QString(ef->name);

            case 1:
                return QVariant(ef->nparams);
        }
    }
    return QVariant();
}


QVariant QEDResourceModel::headerData(int section, Qt::Orientation orientation, int role) const
{
    if (role != Qt::DisplayRole)
        return QVariant();

    if (orientation == Qt::Horizontal)
    {
        switch (section) {
            case 0:
                return "Name";

            case 1:
                return "# params";
        }
    }
    return QVariant();
}


Qt::ItemFlags QEDResourceModel::flags(const QModelIndex &index) const
{
    if (!index.isValid())
        return Qt::ItemIsEnabled;

    return QAbstractTableModel::flags(index); // | Qt::ItemIsEditable;
}