aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Cord-Landwehr <[email protected]>2015-09-07 10:32:10 +0200
committerAndreas Cord-Landwehr <[email protected]>2015-09-07 10:32:10 +0200
commit5b092303d2dc7d7368d96b582a29ca49433d34b7 (patch)
tree50299a1999bdfaf6bee4b9323d952490999958b3
parent28ddf80854c4f328f3d4b5ab4b9d109993a7f6ce (diff)
Rename PhraseModel to PhraseListModel.
-rw-r--r--src/CMakeLists.txt6
-rw-r--r--src/application.cpp4
-rw-r--r--src/models/phrasefiltermodel.cpp16
-rw-r--r--src/models/phrasefiltermodel.h10
-rw-r--r--src/models/phraselistmodel.cpp (renamed from src/models/phrasemodel.cpp)32
-rw-r--r--src/models/phraselistmodel.h (renamed from src/models/phrasemodel.h)10
-rw-r--r--src/qml/TrainerProgressBar.qml2
-rw-r--r--src/qml/UnitEditor.qml2
8 files changed, 41 insertions, 41 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 9d9f3f3..fc1b649 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -1,5 +1,5 @@
###
-# Copyright 2013-2014 Andreas Cord-Landwehr <[email protected]>
+# Copyright 2013-2015 Andreas Cord-Landwehr <[email protected]>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
@@ -98,7 +98,7 @@ set(artikulate_SRCS
models/learningprogressmodel.cpp
models/unitmodel.cpp
models/unitfiltermodel.cpp
- models/phrasemodel.cpp
+ models/phraselistmodel.cpp
models/phrasefiltermodel.cpp
models/phonememodel.cpp
models/phonemegroupmodel.cpp
@@ -129,7 +129,7 @@ set(artikulate_editor_SRCS
models/learningprogressmodel.cpp
models/unitmodel.cpp
models/unitfiltermodel.cpp
- models/phrasemodel.cpp
+ models/phraselistmodel.cpp
models/phrasefiltermodel.cpp
models/phonememodel.cpp
models/phonemegroupmodel.cpp
diff --git a/src/application.cpp b/src/application.cpp
index ad7337e..7e04282 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -39,7 +39,7 @@
#include "models/learningprogressmodel.h"
#include "models/unitmodel.h"
#include "models/unitfiltermodel.h"
-#include "models/phrasemodel.h"
+#include "models/phraselistmodel.h"
#include "models/phrasefiltermodel.h"
#include "models/phonememodel.h"
#include "models/phonemegroupmodel.h"
@@ -90,7 +90,7 @@ void Application::registerQmlTypes()
qmlRegisterType<LearningProgressModel>("artikulate", 1, 0, "LearningProgressModel");
qmlRegisterType<UnitModel>("artikulate", 1, 0, "UnitModel");
qmlRegisterType<UnitFilterModel>("artikulate", 1, 0, "UnitFilterModel");
- qmlRegisterType<PhraseModel>("artikulate", 1, 0, "PhraseModel");
+ qmlRegisterType<PhraseListModel>("artikulate", 1, 0, "PhraseListModel");
qmlRegisterType<PhraseFilterModel>("artikulate", 1, 0, "PhraseFilterModel");
qmlRegisterType<PhonemeModel>("artikulate", 1, 0, "PhonemeModel");
qmlRegisterType<PhonemeGroupModel>("artikulate", 1, 0, "PhonemeGroupModel");
diff --git a/src/models/phrasefiltermodel.cpp b/src/models/phrasefiltermodel.cpp
index dfd8dd2..2faa9b8 100644
--- a/src/models/phrasefiltermodel.cpp
+++ b/src/models/phrasefiltermodel.cpp
@@ -20,22 +20,22 @@
*/
#include "phrasefiltermodel.h"
-#include "models/phrasemodel.h"
+#include "models/phraselistmodel.h"
#include <QSortFilterProxyModel>
#include <KLocalizedString>
#include <QDebug>
-PhraseFilterModel::PhraseFilterModel(QObject* parent)
+PhraseFilterModel::PhraseFilterModel(QObject *parent)
: QSortFilterProxyModel(parent)
- , m_phraseModel(0)
+ , m_phraseModel(nullptr)
, m_hideExcluded(true)
{
setHideExcluded(true);
}
-PhraseModel * PhraseFilterModel::phraseModel() const
+PhraseListModel * PhraseFilterModel::phraseModel() const
{
return m_phraseModel;
}
@@ -64,7 +64,7 @@ bool PhraseFilterModel::isHideNotRecorded() const
return m_hideNotRecorded;
}
-void PhraseFilterModel::setPhraseModel(PhraseModel* phraseModel)
+void PhraseFilterModel::setPhraseModel(PhraseListModel* phraseModel)
{
if (phraseModel == m_phraseModel) {
return;
@@ -98,7 +98,7 @@ int PhraseFilterModel::filteredCount() const
bool PhraseFilterModel::lessThan(const QModelIndex& left, const QModelIndex& right) const
{
if (m_sortOption == Type) {
- return sourceModel()->data(left, PhraseModel::TypeRole).toInt() < sourceModel()->data(right, PhraseModel::TypeRole).toInt();
+ return sourceModel()->data(left, PhraseListModel::TypeRole).toInt() < sourceModel()->data(right, PhraseListModel::TypeRole).toInt();
}
return QSortFilterProxyModel::lessThan(left, right);
}
@@ -108,8 +108,8 @@ bool PhraseFilterModel::filterAcceptsRow(int source_row, const QModelIndex &sour
int result = true;
if (m_hideNotRecorded || m_hideExcluded) {
QModelIndex index = sourceModel()->index(source_row, 0, source_parent);
- bool notRecorded = sourceModel()->data(index, PhraseModel::SoundFileRole).value<QUrl>().isEmpty();
- bool excluded = sourceModel()->data(index, PhraseModel::ExcludedRole).toBool();
+ bool notRecorded = sourceModel()->data(index, PhraseListModel::SoundFileRole).value<QUrl>().isEmpty();
+ bool excluded = sourceModel()->data(index, PhraseListModel::ExcludedRole).toBool();
result = !(notRecorded || excluded);
}
return result;
diff --git a/src/models/phrasefiltermodel.h b/src/models/phrasefiltermodel.h
index cea79be..95fd7c8 100644
--- a/src/models/phrasefiltermodel.h
+++ b/src/models/phrasefiltermodel.h
@@ -24,13 +24,13 @@
#include <QSortFilterProxyModel>
-class PhraseModel;
+class PhraseListModel;
class QSignalMapper;
class PhraseFilterModel : public QSortFilterProxyModel
{
Q_OBJECT
- Q_PROPERTY(PhraseModel *phraseModel READ phraseModel WRITE setPhraseModel NOTIFY phraseModelChanged)
+ Q_PROPERTY(PhraseListModel *phraseModel READ phraseModel WRITE setPhraseModel NOTIFY phraseModelChanged)
Q_PROPERTY(bool hideExcluded READ isHideExcluded WRITE setHideExcluded NOTIFY hideExcludedChanged)
Q_PROPERTY(bool hideNotRecorded READ isHideNotRecorded WRITE setHideNotRecorded NOTIFY hideNotRecordedChanged)
Q_PROPERTY(SortOption sortOption READ sortOption WRITE setSortOption NOTIFY sortOptionChanged)
@@ -43,8 +43,8 @@ public:
Type
};
explicit PhraseFilterModel(QObject *parent = nullptr);
- PhraseModel * phraseModel() const;
- void setPhraseModel(PhraseModel* phraseModel);
+ PhraseListModel * phraseModel() const;
+ void setPhraseModel(PhraseListModel* phraseModel);
void setSortOption(SortOption option = Id);
SortOption sortOption() const;
int filteredCount() const;
@@ -63,7 +63,7 @@ Q_SIGNALS:
void filteredCountChanged();
private:
- PhraseModel *m_phraseModel;
+ PhraseListModel *m_phraseModel;
bool m_hideExcluded;
bool m_hideNotRecorded;
SortOption m_sortOption;
diff --git a/src/models/phrasemodel.cpp b/src/models/phraselistmodel.cpp
index a771591..53d34a4 100644
--- a/src/models/phrasemodel.cpp
+++ b/src/models/phraselistmodel.cpp
@@ -18,16 +18,16 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include "phrasemodel.h"
+#include "phraselistmodel.h"
#include "core/unit.h"
#include "core/phrase.h"
#include <QAbstractListModel>
#include <QSignalMapper>
#include <KLocalizedString>
-PhraseModel::PhraseModel(QObject *parent)
+PhraseListModel::PhraseListModel(QObject *parent)
: QAbstractListModel(parent)
- , m_unit(0)
+ , m_unit(nullptr)
, m_signalMapper(new QSignalMapper(this))
{
connect(m_signalMapper, SIGNAL(mapped(int)), SLOT(emitPhraseChanged(int)));
@@ -37,7 +37,7 @@ PhraseModel::PhraseModel(QObject *parent)
connect(this, SIGNAL(unitChanged()), this, SIGNAL(countChanged()));
}
-QHash< int, QByteArray > PhraseModel::roleNames() const
+QHash< int, QByteArray > PhraseListModel::roleNames() const
{
QHash<int, QByteArray> roles;
roles[TextRole] = "text";
@@ -50,7 +50,7 @@ QHash< int, QByteArray > PhraseModel::roleNames() const
return roles;
}
-void PhraseModel::setUnit(Unit *unit)
+void PhraseListModel::setUnit(Unit *unit)
{
if (m_unit == unit) {
return;
@@ -88,12 +88,12 @@ void PhraseModel::setUnit(Unit *unit)
emit unitChanged();
}
-Unit * PhraseModel::unit() const
+Unit * PhraseListModel::unit() const
{
return m_unit;
}
-QVariant PhraseModel::data(const QModelIndex &index, int role) const
+QVariant PhraseListModel::data(const QModelIndex &index, int role) const
{
Q_ASSERT(m_unit);
@@ -131,7 +131,7 @@ QVariant PhraseModel::data(const QModelIndex &index, int role) const
}
}
-int PhraseModel::rowCount(const QModelIndex &parent) const
+int PhraseListModel::rowCount(const QModelIndex &parent) const
{
if (!m_unit) {
return 0;
@@ -143,7 +143,7 @@ int PhraseModel::rowCount(const QModelIndex &parent) const
return m_unit->phraseList().count();
}
-void PhraseModel::onPhraseAboutToBeAdded(Phrase *phrase, int index)
+void PhraseListModel::onPhraseAboutToBeAdded(Phrase *phrase, int index)
{
connect(phrase, SIGNAL(textChanged()), m_signalMapper, SLOT(map()));
connect(phrase, SIGNAL(typeChanged()), m_signalMapper, SLOT(map()));
@@ -151,25 +151,25 @@ void PhraseModel::onPhraseAboutToBeAdded(Phrase *phrase, int index)
beginInsertRows(QModelIndex(), index, index);
}
-void PhraseModel::onPhraseAdded()
+void PhraseListModel::onPhraseAdded()
{
updateMappings();
endInsertRows();
emit countChanged();
}
-void PhraseModel::onPhrasesAboutToBeRemoved(int first, int last)
+void PhraseListModel::onPhrasesAboutToBeRemoved(int first, int last)
{
beginRemoveRows(QModelIndex(), first, last);
}
-void PhraseModel::onPhrasesRemoved()
+void PhraseListModel::onPhrasesRemoved()
{
endRemoveRows();
emit countChanged();
}
-void PhraseModel::emitPhraseChanged(int row)
+void PhraseListModel::emitPhraseChanged(int row)
{
beginResetModel();
endResetModel();
@@ -179,7 +179,7 @@ void PhraseModel::emitPhraseChanged(int row)
emit dataChanged(index(row, 0), index(row, 0));
}
-QVariant PhraseModel::headerData(int section, Qt::Orientation orientation, int role) const
+QVariant PhraseListModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (role != Qt::DisplayRole) {
return QVariant();
@@ -190,7 +190,7 @@ QVariant PhraseModel::headerData(int section, Qt::Orientation orientation, int r
return QVariant(i18nc("@title:column", "Phrase"));
}
-int PhraseModel::count() const
+int PhraseListModel::count() const
{
if (!m_unit) {
return 0;
@@ -198,7 +198,7 @@ int PhraseModel::count() const
return m_unit->phraseList().count();
}
-void PhraseModel::updateMappings()
+void PhraseListModel::updateMappings()
{
if (!m_unit) {
return;
diff --git a/src/models/phrasemodel.h b/src/models/phraselistmodel.h
index dc4cac6..c2cac5c 100644
--- a/src/models/phrasemodel.h
+++ b/src/models/phraselistmodel.h
@@ -18,8 +18,8 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#ifndef PHRASEMODEL_H
-#define PHRASEMODEL_H
+#ifndef PHRASELISTMODEL_H
+#define PHRASELISTMODEL_H
#include <QAbstractListModel>
#include "core/phrase.h"
@@ -27,7 +27,7 @@
class Unit;
class QSignalMapper;
-class PhraseModel : public QAbstractListModel
+class PhraseListModel : public QAbstractListModel
{
Q_OBJECT
Q_PROPERTY(Unit *unit READ unit WRITE setUnit NOTIFY unitChanged)
@@ -43,7 +43,7 @@ public:
DataRole
};
- explicit PhraseModel(QObject *parent = nullptr);
+ explicit PhraseListModel(QObject *parent = nullptr);
/**
* Reimplemented from QAbstractListModel::roleNames()
*/
@@ -81,4 +81,4 @@ private:
QSignalMapper *m_signalMapper;
};
-#endif // PHRASEMODEL_H
+#endif
diff --git a/src/qml/TrainerProgressBar.qml b/src/qml/TrainerProgressBar.qml
index 62899e2..2d19e08 100644
--- a/src/qml/TrainerProgressBar.qml
+++ b/src/qml/TrainerProgressBar.qml
@@ -173,7 +173,7 @@ Item {
hideNotRecorded: true
hideExcluded: true
sortOption: PhraseFilterModel.Type
- phraseModel: PhraseModel {
+ phraseModel: PhraseListModel {
id: progressBarModel
unit: trainingSession2.unit
}
diff --git a/src/qml/UnitEditor.qml b/src/qml/UnitEditor.qml
index 20802db..b031eaf 100644
--- a/src/qml/UnitEditor.qml
+++ b/src/qml/UnitEditor.qml
@@ -227,7 +227,7 @@ Item {
model: PhraseFilterModel
{
hideExcluded: false
- phraseModel: PhraseModel {
+ phraseModel: PhraseListModel {
unit: root.unit
}
}