Skip to content
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

Merged
merged 20 commits into from
May 29, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/preferences/dialog/dlgprefeffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ DlgPrefEffects::DlgPrefEffects(QWidget* pParent,
// Highlight first row
availableEffectsList->selectRow(0);

availableEffectsList->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
availableEffectsList->horizontalHeader()->setResizeMode(0, QHeaderView::ResizeToContents);
availableEffectsList->setColumnWidth(1, 200);
availableEffectsList->horizontalHeader()->setResizeMode(2, QHeaderView::ResizeToContents);
}

DlgPrefEffects::~DlgPrefEffects() {
Expand Down
2 changes: 1 addition & 1 deletion src/preferences/dialog/dlgprefeffectsdlg.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<widget class="QTableView" name="availableEffectsList">
Copy link
Contributor

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).

<property name="maximumSize">
<size>
<width>300</width>
<width>400</width>
<height>16777215</height>
</size>
</property>
Expand Down
22 changes: 15 additions & 7 deletions src/preferences/effectsettingsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
namespace {
const int kColumnEnabled = 0;
const int kColumnName = 1;
const int kColumnType = 2;
}

EffectSettingsModel::EffectSettingsModel() {
Expand Down Expand Up @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The 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();
}
}

Expand All @@ -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) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

space after "if": } else if (

return tr("Type");
}
}
}
Expand All @@ -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)
Copy link
Contributor

Choose a reason for hiding this comment

The 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;
}

Expand Down