summaryrefslogtreecommitdiff
path: root/src/filelist.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/filelist.cc')
-rw-r--r--src/filelist.cc54
1 files changed, 31 insertions, 23 deletions
diff --git a/src/filelist.cc b/src/filelist.cc
index c9e6a8a..990ae4c 100644
--- a/src/filelist.cc
+++ b/src/filelist.cc
@@ -59,14 +59,14 @@ public:
const QModelIndex &index) const override
{
// Name:
- if(index.column() == 1)
+ if(index.column() == 2)
{
auto w = new QLineEdit(parent);
return w;
}
// Channel Map ID:
- if(index.column() == 2)
+ if(index.column() == 3)
{
auto w = new QComboBox(parent);
w->addItem(tr("<None>"), -1);
@@ -85,7 +85,7 @@ public:
void setEditorData(QWidget *editor, const QModelIndex &index) const override
{
// Name:
- if(index.column() == 1)
+ if(index.column() == 2)
{
auto w = static_cast<QLineEdit*>(editor);
auto s = index.data(Qt::EditRole).toString();
@@ -93,7 +93,7 @@ public:
}
// Channel Map ID:
- if(index.column() == 2)
+ if(index.column() == 3)
{
auto w = static_cast<QComboBox*>(editor);
auto i = w->findData(index.data(Qt::EditRole).toInt());
@@ -104,14 +104,14 @@ public:
void setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const override
{ // Name:
- if(index.column() == 1)
+ if(index.column() == 2)
{
model->setData(index, static_cast<QLineEdit*>(editor)->text(),
Qt::EditRole);
}
// Channel Map ID:
- if(index.column() == 2)
+ if(index.column() == 3)
{
model->setData(index, static_cast<QComboBox*>(editor)->currentData(),
Qt::EditRole);
@@ -223,8 +223,9 @@ public:
{
switch(index.column())
{
- case 1: return audiofile.getName();
- case 2:
+ case 1: return audiofile.getFile();
+ case 2: return audiofile.getName();
+ case 3:
{
auto channelMapId = audiofile.getChannelMapId();
if(channelMapId == -1)
@@ -233,7 +234,6 @@ public:
}
return instrument.getProject().getChannel(channelMapId).getChannelName();
}
- case 3: return audiofile.getFile();
default: return QVariant();
}
}
@@ -241,9 +241,9 @@ public:
{
switch(index.column())
{
- case 1: return audiofile.getName();
- case 2: return audiofile.getChannelMapId();
- case 3: return audiofile.getFile();
+ case 1: return audiofile.getFile();
+ case 2: return audiofile.getName();
+ case 3: return audiofile.getChannelMapId();
default: return QVariant();
}
}
@@ -261,9 +261,9 @@ public:
switch(section)
{
case 0: return tr("M");
- case 1: return tr("Name");
- case 2: return tr("Kit Channel");
- case 3: return tr("Filename");
+ case 1: return tr("Filename");
+ case 2: return tr("Name");
+ case 3: return tr("Kit Channel");
default: return QVariant();
}
}
@@ -280,13 +280,14 @@ public:
switch(index.column())
{
- case 0:
+ case 0: // Master
return QAbstractItemModel::flags(index);
- case 1:
- case 2:
- return Qt::ItemIsEditable | QAbstractItemModel::flags(index);
- case 3:
+ case 1: // File
return QAbstractItemModel::flags(index); // only column 1 is editable
+ case 2: // Name
+ return Qt::ItemIsEditable | QAbstractItemModel::flags(index);
+ case 3: // Channel map id
+ return Qt::ItemIsEditable | QAbstractItemModel::flags(index);
}
}
@@ -305,9 +306,16 @@ public:
switch(index.column())
{
- case 0: break;
- case 1: audiofile.setName(value.toString()); break;
- case 2: audiofile.setChannelMapId(value.toInt()); break;
+ case 0: // Master
+ break;
+ case 1: // File
+ break;
+ case 2: // Name
+ audiofile.setName(value.toString());
+ break;
+ case 3: // Channel map id
+ audiofile.setChannelMapId(value.toInt());
+ break;
default: break;
}