Skip to content

Commit

Permalink
Don't allow filters to be added when no producer is loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
bmatherly committed Oct 25, 2014
1 parent 2f010d2 commit 6c437fa
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/models/attachedfiltersmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ AttachedFiltersModel::AttachedFiltersModel(QObject *parent)
{
}

bool AttachedFiltersModel::isReady()
{
return m_producer != NULL;
}

void AttachedFiltersModel::calculateRows()
{
m_rows =-0;
Expand Down Expand Up @@ -267,4 +272,5 @@ void AttachedFiltersModel::reset(Mlt::Producer* producer)
m_producer.reset(new Mlt::Producer(producer? producer : MLT.producer()));
calculateRows();
endResetModel();
emit readyChanged();
}
3 changes: 3 additions & 0 deletions src/models/attachedfiltersmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
class AttachedFiltersModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(bool ready READ isReady NOTIFY readyChanged)
public:
explicit AttachedFiltersModel(QObject *parent = 0);

bool isReady();
Mlt::Filter* filterForRow(int row) const;
int indexForRow(int row) const;
int rowCount(const QModelIndex &parent = QModelIndex()) const;
Expand All @@ -43,6 +45,7 @@ class AttachedFiltersModel : public QAbstractListModel

signals:
void changed(bool modified = true);
void readyChanged();

public slots:
Mlt::Filter* add(const QString& mlt_service, const QString& shotcutName = QString());
Expand Down
2 changes: 2 additions & 0 deletions src/qml/views/filter/filterview.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ Rectangle {
id: addButton
Layout.minimumWidth: height
iconName: 'list-add'
enabled: attachedfiltersmodel.ready
opacity: enabled ? 1.0 : 0.5
tooltip: qsTr('Add a Filter')
onClicked: filterMenu.popup(addButton)
}
Expand Down

0 comments on commit 6c437fa

Please sign in to comment.