-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Effect Blacklisting #1674
Effect Blacklisting #1674
Changes from 1 commit
6d61872
9caa1f7
02cf7dd
566db03
036f0e2
92acfe0
94ff53a
260bfcd
72b1f91
eb992a3
8caa6ab
0aa3cf8
cd39efb
4e3468c
b4efad1
e250f10
5bbe893
ff90165
b87b2bb
99bb100
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
namespace { | ||
const int kColumnEnabled = 0; | ||
const int kColumnName = 1; | ||
const int kColumnType = 2; | ||
} | ||
|
||
EffectSettingsModel::EffectSettingsModel() { | ||
|
@@ -59,29 +60,31 @@ int EffectSettingsModel::rowCount(const QModelIndex& parent) const { | |
|
||
int EffectSettingsModel::columnCount(const QModelIndex& parent) const { | ||
Q_UNUSED(parent); | ||
return 2; | ||
return 3; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. move this magic number to the anonymous namespace at the top of the file |
||
} | ||
|
||
QVariant EffectSettingsModel::data(const QModelIndex& index, int role) const { | ||
int rowIndex = index.row(); | ||
if (!index.isValid() || rowIndex >= m_profiles.size()) | ||
if (!index.isValid() || rowIndex >= m_profiles.size()) { | ||
return QVariant(); | ||
} | ||
|
||
EffectProfilePtr profile = m_profiles.at(rowIndex); | ||
if (profile) { | ||
if (role == Qt::UserRole) | ||
if (role == Qt::UserRole) { | ||
return profile->getEffectId(); | ||
} | ||
int column = index.column(); | ||
if (column == kColumnEnabled) { | ||
if (role == Qt::CheckStateRole) { | ||
return (profile->isVisible() == true ? Qt::Checked : Qt::Unchecked); | ||
} | ||
else if (role == Qt::TextAlignmentRole) { | ||
} else if (role == Qt::TextAlignmentRole) { | ||
return Qt::AlignCenter; | ||
} | ||
} | ||
else if (column == kColumnName && role == Qt::DisplayRole) { | ||
} else if (column == kColumnName && role == Qt::DisplayRole) { | ||
return profile->getDisplayName(); | ||
} else if (column == kColumnType && role == Qt::DisplayRole) { | ||
return profile->getManifest()->backendName(); | ||
} | ||
} | ||
|
||
|
@@ -96,6 +99,8 @@ QVariant EffectSettingsModel::headerData(int section, Qt::Orientation orientatio | |
return tr("Visible"); | ||
} else if(section == kColumnName) { | ||
return tr("Name"); | ||
} else if(section == kColumnType) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space after "if": |
||
return tr("Type"); | ||
} | ||
} | ||
} | ||
|
@@ -109,6 +114,9 @@ Qt::ItemFlags EffectSettingsModel::flags(const QModelIndex& index) const { | |
if(index.column() == kColumnName) | ||
return QAbstractItemModel::flags(index) | Qt::ItemIsSelectable; | ||
|
||
if(index.column() == kColumnType) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. space after "if" |
||
return QAbstractItemModel::flags(index) | Qt::ItemIsSelectable; | ||
|
||
return QAbstractItemModel::flags(index) | Qt::ItemIsEnabled; | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be helpful to add a column here for the type of effect (built-in or LV2).