diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-03-24 18:21:35 -0400 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-03-24 18:21:35 -0400 |
| commit | b2c220caf1f2a3adc626e8da122fa32bf0c47498 (patch) | |
| tree | a1c3931a3c10c9e83157bd4b157d83593b19910a | |
| parent | d449bfb524539fae01bd4196a70e3fa83e096734 (diff) | |
Rename Plugin(Delegate|Model) to PluginTree(Delegate|Model)
| -rw-r--r-- | sigtools/CMakeLists.txt | 4 | ||||
| -rw-r--r-- | sigtools/PluginTree.cpp | 6 | ||||
| -rw-r--r-- | sigtools/PluginTree.h | 5 | ||||
| -rw-r--r-- | sigtools/PluginTreeDelegate.cpp (renamed from sigtools/PluginDelegate.cpp) | 14 | ||||
| -rw-r--r-- | sigtools/PluginTreeDelegate.h (renamed from sigtools/PluginDelegate.h) | 8 | ||||
| -rw-r--r-- | sigtools/PluginTreeModel.cpp (renamed from sigtools/PluginModel.cpp) | 22 | ||||
| -rw-r--r-- | sigtools/PluginTreeModel.h (renamed from sigtools/PluginModel.h) | 10 |
7 files changed, 35 insertions, 34 deletions
diff --git a/sigtools/CMakeLists.txt b/sigtools/CMakeLists.txt index 8efc8d11..94867a03 100644 --- a/sigtools/CMakeLists.txt +++ b/sigtools/CMakeLists.txt @@ -7,8 +7,8 @@ set(sigtools_HEADERS set(sigtools_SRCS BaseModel.cpp PluginTree.cpp - PluginDelegate.cpp - PluginModel.cpp + PluginTreeDelegate.cpp + PluginTreeModel.cpp RootPluginModel.cpp ) diff --git a/sigtools/PluginTree.cpp b/sigtools/PluginTree.cpp index fb881761..c200e768 100644 --- a/sigtools/PluginTree.cpp +++ b/sigtools/PluginTree.cpp @@ -19,8 +19,8 @@ #include "PluginTree.h" // Sigtools includes -#include "PluginDelegate.h" -#include "PluginModel.h" +#include "PluginTreeDelegate.h" +#include "PluginTreeModel.h" // Sigencore plugin includes #include <sigencore/plugins/ArenaPlugin.h> @@ -37,7 +37,7 @@ using namespace Sigtools; PluginTree::PluginTree(const QStringList& types, QWidget* parent) : QTreeView(parent), - m_model(new PluginModel(this)) + m_model(new PluginTreeModel(this)) { setSelectionBehavior(SelectItems); setSelectionMode(SingleSelection); diff --git a/sigtools/PluginTree.h b/sigtools/PluginTree.h index d4336364..4f0c7dc8 100644 --- a/sigtools/PluginTree.h +++ b/sigtools/PluginTree.h @@ -44,7 +44,8 @@ class Canvas; namespace Sigtools { -class PluginModel; +// Forward declarations +class PluginTreeModel; class SIGTOOLS_EXPORT PluginTree : public QTreeView { @@ -55,7 +56,7 @@ class SIGTOOLS_EXPORT PluginTree : public QTreeView private: void loadServiceType(const QString& type); - PluginModel* m_model; + PluginTreeModel* m_model; }; } diff --git a/sigtools/PluginDelegate.cpp b/sigtools/PluginTreeDelegate.cpp index 9a16e86c..013ed4df 100644 --- a/sigtools/PluginDelegate.cpp +++ b/sigtools/PluginTreeDelegate.cpp @@ -16,31 +16,31 @@ */ // Header include -#include "PluginDelegate.h" +#include "PluginTreeDelegate.h" // Sigtools includes #include "BaseModel.h" -#include "PluginModel.h" #include "PluginTree.h" +#include "PluginTreeModel.h" using namespace Sigtools; -PluginDelegate::PluginDelegate(PluginTree* parent) : +PluginTreeDelegate::PluginTreeDelegate(PluginTree* parent) : QAbstractItemDelegate(parent), m_view(parent) { } -void PluginDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const +void PluginTreeDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const { - PluginModel* model = qobject_cast<PluginModel*>(m_view->model()); + PluginTreeModel* model = qobject_cast<PluginTreeModel*>(m_view->model()); if (model) model->getItem(index)->paint(painter, option); } -QSize PluginDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const +QSize PluginTreeDelegate::sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const { - PluginModel* model = qobject_cast<PluginModel*>(m_view->model()); + PluginTreeModel* model = qobject_cast<PluginTreeModel*>(m_view->model()); if (model) return model->getItem(index)->sizeHint(option); return QSize(); diff --git a/sigtools/PluginDelegate.h b/sigtools/PluginTreeDelegate.h index 0fb0c6ad..25c7181f 100644 --- a/sigtools/PluginDelegate.h +++ b/sigtools/PluginTreeDelegate.h @@ -15,8 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGTOOLS_PLUGINDELEGATE -#define SIGTOOLS_PLUGINDELEGATE +#ifndef SIGTOOLS_PLUGINTREEDELEGATE +#define SIGTOOLS_PLUGINTREEDELEGATE // Sigtools includes #include "Global.h" @@ -29,12 +29,12 @@ namespace Sigtools // Forward declarations class PluginTree; -class SIGTOOLS_NO_EXPORT PluginDelegate : public QAbstractItemDelegate +class SIGTOOLS_NO_EXPORT PluginTreeDelegate : public QAbstractItemDelegate { Q_OBJECT public: - PluginDelegate(PluginTree* parent); + PluginTreeDelegate(PluginTree* parent); void paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const; QSize sizeHint(const QStyleOptionViewItem& option, const QModelIndex& index) const; diff --git a/sigtools/PluginModel.cpp b/sigtools/PluginTreeModel.cpp index 711c8fc2..ce2443ba 100644 --- a/sigtools/PluginModel.cpp +++ b/sigtools/PluginTreeModel.cpp @@ -16,7 +16,7 @@ */ // Header include -#include "PluginModel.h" +#include "PluginTreeModel.h" // Sigtools includes #include "BaseModel.h" @@ -28,18 +28,18 @@ using namespace Sigtools; -PluginModel::PluginModel(PluginTree* browser) : +PluginTreeModel::PluginTreeModel(PluginTree* browser) : QAbstractItemModel(browser), m_root(new RootPluginModel) { } -PluginModel::~PluginModel() +PluginTreeModel::~PluginTreeModel() { delete m_root; } -QModelIndex PluginModel::index(const int row, const int column, const QModelIndex& parent) const +QModelIndex PluginTreeModel::index(const int row, const int column, const QModelIndex& parent) const { if ((row < -1) || (column < -1)) return QModelIndex(); @@ -51,14 +51,14 @@ QModelIndex PluginModel::index(const int row, const int column, const QModelInde return createIndex(row, 0, model->childItem(row)); } -QVariant PluginModel::data(const QModelIndex& index, const int role) const +QVariant PluginTreeModel::data(const QModelIndex& index, const int role) const { Q_UNUSED(index) Q_UNUSED(role) return QVariant(); } -QModelIndex PluginModel::parent(const QModelIndex& index) const +QModelIndex PluginTreeModel::parent(const QModelIndex& index) const { if (!index.isValid()) return QModelIndex(); @@ -68,18 +68,18 @@ QModelIndex PluginModel::parent(const QModelIndex& index) const return createIndex(parent->indexNumber(), 0, parent); } -int PluginModel::rowCount(const QModelIndex& parent) const +int PluginTreeModel::rowCount(const QModelIndex& parent) const { return getItem(parent)->rowCount(); } -int PluginModel::columnCount(const QModelIndex& parent) const +int PluginTreeModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent) return 1; } -Qt::ItemFlags PluginModel::flags(const QModelIndex& index) const +Qt::ItemFlags PluginTreeModel::flags(const QModelIndex& index) const { Qt::ItemFlags flags = QAbstractItemModel::flags(index); if (index.isValid()) @@ -87,14 +87,14 @@ Qt::ItemFlags PluginModel::flags(const QModelIndex& index) const return flags; } -BaseModel* PluginModel::getItem(const QModelIndex& index) const +BaseModel* PluginTreeModel::getItem(const QModelIndex& index) const { if (index.isValid()) return static_cast<BaseModel*>(index.internalPointer()); return m_root; } -void PluginModel::addPlugin(const QString& type, KService::Ptr service) +void PluginTreeModel::addPlugin(const QString& type, KService::Ptr service) { m_root->addPlugin(type, service); } diff --git a/sigtools/PluginModel.h b/sigtools/PluginTreeModel.h index 32457455..fd17fef6 100644 --- a/sigtools/PluginModel.h +++ b/sigtools/PluginTreeModel.h @@ -15,8 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGTOOLS_PLUGINMODEL -#define SIGTOOLS_PLUGINMODEL +#ifndef SIGTOOLS_PLUGINTREEMODEL +#define SIGTOOLS_PLUGINTREEMODEL // Sigtools includes #include "Global.h" @@ -39,13 +39,13 @@ class BaseModel; class PluginTree; class RootPluginModel; -class SIGTOOLS_NO_EXPORT PluginModel : public QAbstractItemModel +class SIGTOOLS_NO_EXPORT PluginTreeModel : public QAbstractItemModel { Q_OBJECT public: - PluginModel(PluginTree* browser); - ~PluginModel(); + PluginTreeModel(PluginTree* browser); + ~PluginTreeModel(); QVariant data(const QModelIndex& index, int role) const; |
