diff options
| author | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 00:38:05 -0500 |
|---|---|---|
| committer | Ben Boeckel <MathStuf@gmail.com> | 2009-02-24 00:38:05 -0500 |
| commit | 4ea3dd3a9ddd706d03e096d13bdb8c9d907dcb40 (patch) | |
| tree | 3f39322fccb07ea0ab3dad574ff8d40b3bcd4b38 | |
| parent | 7ccc2e3c73637e771c08b2c82539d6c4a7a5f0d7 (diff) | |
| download | sigen-4ea3dd3a9ddd706d03e096d13bdb8c9d907dcb40.tar.gz sigen-4ea3dd3a9ddd706d03e096d13bdb8c9d907dcb40.tar.xz sigen-4ea3dd3a9ddd706d03e096d13bdb8c9d907dcb40.zip | |
Rename SigmodTree and SigmodrTreeModel to SigmodrTree and SigmodrTreeModel
| -rw-r--r-- | sigmodr/tree/SigmodrTree.cpp | 42 | ||||
| -rw-r--r-- | sigmodr/tree/SigmodrTree.h | 9 | ||||
| -rw-r--r-- | sigmodr/tree/SigmodrTreeModel.cpp | 36 | ||||
| -rw-r--r-- | sigmodr/tree/SigmodrTreeModel.h | 11 |
4 files changed, 50 insertions, 48 deletions
diff --git a/sigmodr/tree/SigmodrTree.cpp b/sigmodr/tree/SigmodrTree.cpp index 90e1fa1b..23e9b0d5 100644 --- a/sigmodr/tree/SigmodrTree.cpp +++ b/sigmodr/tree/SigmodrTree.cpp @@ -32,17 +32,17 @@ // Qt includes #include <QtGui/QHeaderView> -Sigmodr::Tree::SigmodTree::SigmodTree(QWidget* parent) : +Sigmodr::Tree::SigmodrTree::SigmodrTree(QWidget* parent) : QTreeView(parent) { - SigmodTreeModel* model = new SigmodTreeModel(this); + SigmodrTreeModel* model = new SigmodrTreeModel(this); connect(model, SIGNAL(dirty(const Sigmod::Sigmod*, bool)), this, SLOT(setDirty(const Sigmod::Sigmod*, bool))); header()->hide(); setModel(model); setRootIndex(model->index(-1, 0, QModelIndex())); } -QString Sigmodr::Tree::SigmodTree::description(const QModelIndex& index) +QString Sigmodr::Tree::SigmodrTree::description(const QModelIndex& index) { QString type = model()->data(index, BaseModel::TypeRole).toString(); QString name = model()->data(index, Qt::DisplayRole).toString(); @@ -51,18 +51,18 @@ QString Sigmodr::Tree::SigmodTree::description(const QModelIndex& index) return QString("%1: %2").arg(type).arg(name); } -Sigmodr::Widgets::ObjectUI* Sigmodr::Tree::SigmodTree::editorWidget(const QModelIndex& index) +Sigmodr::Widgets::ObjectUI* Sigmodr::Tree::SigmodrTree::editorWidget(const QModelIndex& index) { Widgets::ObjectUI* widget = qobject_cast<Widgets::ObjectUI*>(model()->data(index, BaseModel::WidgetRole).value<QWidget*>()); return widget; } -KMenu* Sigmodr::Tree::SigmodTree::contextMenu(const QModelIndex& index) +KMenu* Sigmodr::Tree::SigmodrTree::contextMenu(const QModelIndex& index) { return model()->data(index, BaseModel::ContextMenuRole).value<KMenu*>(); } -const Sigmod::Sigmod* Sigmodr::Tree::SigmodTree::currentSigmod() const +const Sigmod::Sigmod* Sigmodr::Tree::SigmodrTree::currentSigmod() const { QModelIndex index = currentIndex(); if (index.isValid()) @@ -74,39 +74,39 @@ const Sigmod::Sigmod* Sigmodr::Tree::SigmodTree::currentSigmod() const return NULL; } -QDomDocument Sigmodr::Tree::SigmodTree::copy(const QModelIndex& index) +QDomDocument Sigmodr::Tree::SigmodrTree::copy(const QModelIndex& index) { QDomDocument xml; xml.setContent(model()->data(index, BaseModel::XmlRole).toString()); return xml; } -void Sigmodr::Tree::SigmodTree::paste(const QModelIndex& index, const QDomDocument& data) +void Sigmodr::Tree::SigmodrTree::paste(const QModelIndex& index, const QDomDocument& data) { model()->setData(index, data.toString(), BaseModel::XmlRole); } -QList<const Sigmod::Sigmod*> Sigmodr::Tree::SigmodTree::openedSigmods() const +QList<const Sigmod::Sigmod*> Sigmodr::Tree::SigmodrTree::openedSigmods() const { return m_sigmods.keys(); } -void Sigmodr::Tree::SigmodTree::addSigmod(Sigmod::Sigmod* sigmod, const KUrl& url) +void Sigmodr::Tree::SigmodrTree::addSigmod(Sigmod::Sigmod* sigmod, const KUrl& url) { - qobject_cast<SigmodTreeModel*>(model())->addSigmod(sigmod); + qobject_cast<SigmodrTreeModel*>(model())->addSigmod(sigmod); m_sigmods[sigmod] = UrlDirty(url, false); } -void Sigmodr::Tree::SigmodTree::deleteSigmod(const Sigmod::Sigmod* sigmod) +void Sigmodr::Tree::SigmodrTree::deleteSigmod(const Sigmod::Sigmod* sigmod) { if (m_sigmods.contains(sigmod)) { - qobject_cast<SigmodTreeModel*>(model())->deleteSigmod(sigmod); + qobject_cast<SigmodrTreeModel*>(model())->deleteSigmod(sigmod); m_sigmods.remove(sigmod); } } -bool Sigmodr::Tree::SigmodTree::isOpen(const KUrl& url) const +bool Sigmodr::Tree::SigmodrTree::isOpen(const KUrl& url) const { foreach (const UrlDirty& pair, m_sigmods.values()) { @@ -116,14 +116,14 @@ bool Sigmodr::Tree::SigmodTree::isOpen(const KUrl& url) const return false; } -KUrl Sigmodr::Tree::SigmodTree::url(const Sigmod::Sigmod* sigmod) const +KUrl Sigmodr::Tree::SigmodrTree::url(const Sigmod::Sigmod* sigmod) const { if (m_sigmods.contains(sigmod)) return m_sigmods[sigmod].first; return KUrl(); } -QStringList Sigmodr::Tree::SigmodTree::urls() const +QStringList Sigmodr::Tree::SigmodrTree::urls() const { QStringList urls; foreach (const UrlDirty& pair, m_sigmods.values()) @@ -131,31 +131,31 @@ QStringList Sigmodr::Tree::SigmodTree::urls() const return urls; } -void Sigmodr::Tree::SigmodTree::setUrl(const Sigmod::Sigmod* sigmod, const KUrl& url) +void Sigmodr::Tree::SigmodrTree::setUrl(const Sigmod::Sigmod* sigmod, const KUrl& url) { if (m_sigmods.contains(sigmod)) m_sigmods[sigmod] = UrlDirty(url, false); } -bool Sigmodr::Tree::SigmodTree::dirty(const Sigmod::Sigmod* sigmod) const +bool Sigmodr::Tree::SigmodrTree::dirty(const Sigmod::Sigmod* sigmod) const { if (m_sigmods.contains(sigmod)) return m_sigmods[sigmod].second; return false; } -bool Sigmodr::Tree::SigmodTree::dirty() const +bool Sigmodr::Tree::SigmodrTree::dirty() const { return dirty(currentSigmod()); } -void Sigmodr::Tree::SigmodTree::setDirty(const Sigmod::Sigmod* sigmod, const bool dirty) +void Sigmodr::Tree::SigmodrTree::setDirty(const Sigmod::Sigmod* sigmod, const bool dirty) { if (m_sigmods.contains(sigmod)) m_sigmods[sigmod].second = dirty; } -void Sigmodr::Tree::SigmodTree::setDirty() +void Sigmodr::Tree::SigmodrTree::setDirty() { setDirty(currentSigmod(), true); } diff --git a/sigmodr/tree/SigmodrTree.h b/sigmodr/tree/SigmodrTree.h index d0e79ac4..a51e8e67 100644 --- a/sigmodr/tree/SigmodrTree.h +++ b/sigmodr/tree/SigmodrTree.h @@ -15,8 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGMODRTREE_SIGMODTREE -#define SIGMODRTREE_SIGMODTREE +#ifndef SIGMODRTREE_SIGMODRTREE +#define SIGMODRTREE_SIGMODRTREE // Sigmodr tree includes #include "Global.h" @@ -45,12 +45,12 @@ class ObjectUI; namespace Tree { -class SIGMODRTREE_EXPORT SigmodTree : public QTreeView +class SIGMODRTREE_EXPORT SigmodrTree : public QTreeView { Q_OBJECT public: - SigmodTree(QWidget* parent = 0); + SigmodrTree(QWidget* parent = 0); QString description(const QModelIndex& index); Widgets::ObjectUI* editorWidget(const QModelIndex& index); @@ -84,5 +84,6 @@ class SIGMODRTREE_EXPORT SigmodTree : public QTreeView QMap<const Sigmod::Sigmod*, UrlDirty> m_sigmods; }; } +} #endif diff --git a/sigmodr/tree/SigmodrTreeModel.cpp b/sigmodr/tree/SigmodrTreeModel.cpp index 780e16c6..b57e762f 100644 --- a/sigmodr/tree/SigmodrTreeModel.cpp +++ b/sigmodr/tree/SigmodrTreeModel.cpp @@ -30,19 +30,19 @@ #include <QtCore/QUrl> #include <QtXml/QDomDocument> -Sigmodr::Tree::SigmodTreeModel::SigmodTreeModel(QObject* parent) : +Sigmodr::Tree::SigmodrTreeModel::SigmodrTreeModel(QObject* parent) : QAbstractItemModel(parent), m_root(new RootModel) { connect(m_root, SIGNAL(rowsChanged(QList<int>)), this, SLOT(rowsChanged(QList<int>))); } -Sigmodr::Tree::SigmodTreeModel::~SigmodTreeModel() +Sigmodr::Tree::SigmodrTreeModel::~SigmodrTreeModel() { delete m_root; } -QVariant Sigmodr::Tree::SigmodTreeModel::data(const QModelIndex& index, int role) const +QVariant Sigmodr::Tree::SigmodrTreeModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) return QVariant(); @@ -50,7 +50,7 @@ QVariant Sigmodr::Tree::SigmodTreeModel::data(const QModelIndex& index, int role return object->data(role); } -QVariant Sigmodr::Tree::SigmodTreeModel::headerData(int section, Qt::Orientation orientation, int role) const +QVariant Sigmodr::Tree::SigmodrTreeModel::headerData(int section, Qt::Orientation orientation, int role) const { Q_UNUSED(section) Q_UNUSED(orientation) @@ -58,7 +58,7 @@ QVariant Sigmodr::Tree::SigmodTreeModel::headerData(int section, Qt::Orientation return QVariant(); } -QModelIndex Sigmodr::Tree::SigmodTreeModel::index(int row, int column, const QModelIndex& parent) const +QModelIndex Sigmodr::Tree::SigmodrTreeModel::index(int row, int column, const QModelIndex& parent) const { if ((row < -1) || (column < -1)) return QModelIndex(); @@ -71,7 +71,7 @@ QModelIndex Sigmodr::Tree::SigmodTreeModel::index(int row, int column, const QMo return createIndex(row, 0, object); } -QModelIndex Sigmodr::Tree::SigmodTreeModel::parent(const QModelIndex& index) const +QModelIndex Sigmodr::Tree::SigmodrTreeModel::parent(const QModelIndex& index) const { if (!index.isValid()) return QModelIndex(); @@ -81,19 +81,19 @@ QModelIndex Sigmodr::Tree::SigmodTreeModel::parent(const QModelIndex& index) con return createIndex(parent->indexNumber(), 0, parent); } -int Sigmodr::Tree::SigmodTreeModel::rowCount(const QModelIndex& parent) const +int Sigmodr::Tree::SigmodrTreeModel::rowCount(const QModelIndex& parent) const { BaseModel* object = getItem(parent); return object->rowCount(); } -int Sigmodr::Tree::SigmodTreeModel::columnCount(const QModelIndex& parent) const +int Sigmodr::Tree::SigmodrTreeModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent) return 1; } -Qt::ItemFlags Sigmodr::Tree::SigmodTreeModel::flags(const QModelIndex& index) const +Qt::ItemFlags Sigmodr::Tree::SigmodrTreeModel::flags(const QModelIndex& index) const { if (!index.isValid()) return 0; @@ -101,7 +101,7 @@ Qt::ItemFlags Sigmodr::Tree::SigmodTreeModel::flags(const QModelIndex& index) co return object->flags(); } -bool Sigmodr::Tree::SigmodTreeModel::setData(const QModelIndex& index, const QVariant& value, int role) +bool Sigmodr::Tree::SigmodrTreeModel::setData(const QModelIndex& index, const QVariant& value, int role) { if (!index.isValid()) return false; @@ -117,7 +117,7 @@ bool Sigmodr::Tree::SigmodTreeModel::setData(const QModelIndex& index, const QVa return success; } -Sigmodr::Tree::BaseModel* Sigmodr::Tree::SigmodTreeModel::getItem(const QModelIndex& index) const +Sigmodr::Tree::BaseModel* Sigmodr::Tree::SigmodrTreeModel::getItem(const QModelIndex& index) const { if (index.isValid()) { @@ -128,12 +128,12 @@ Sigmodr::Tree::BaseModel* Sigmodr::Tree::SigmodTreeModel::getItem(const QModelIn return m_root; } -QStringList Sigmodr::Tree::SigmodTreeModel::mimeTypes() const +QStringList Sigmodr::Tree::SigmodrTreeModel::mimeTypes() const { return QStringList() << "application/x-sigmod+xml" << "text/uri-list"; } -QMimeData* Sigmodr::Tree::SigmodTreeModel::mimeData(const QModelIndexList& indexes) const +QMimeData* Sigmodr::Tree::SigmodrTreeModel::mimeData(const QModelIndexList& indexes) const { QMimeData *mimeData = new QMimeData; if ((indexes.size() == 1) && indexes[0].isValid()) @@ -145,7 +145,7 @@ QMimeData* Sigmodr::Tree::SigmodTreeModel::mimeData(const QModelIndexList& index return mimeData; } -bool Sigmodr::Tree::SigmodTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) +bool Sigmodr::Tree::SigmodrTreeModel::dropMimeData(const QMimeData* data, Qt::DropAction action, int row, int column, const QModelIndex& parent) { Q_UNUSED(row) Q_UNUSED(column) @@ -175,19 +175,19 @@ bool Sigmodr::Tree::SigmodTreeModel::dropMimeData(const QMimeData* data, Qt::Dro return success; } -void Sigmodr::Tree::SigmodTreeModel::addSigmod(Sigmod::Sigmod* sigmod) +void Sigmodr::Tree::SigmodrTreeModel::addSigmod(Sigmod::Sigmod* sigmod) { m_root->addSigmod(sigmod); reset(); } -void Sigmodr::Tree::SigmodTreeModel::deleteSigmod(const Sigmod::Sigmod* sigmod) +void Sigmodr::Tree::SigmodrTreeModel::deleteSigmod(const Sigmod::Sigmod* sigmod) { m_root->deleteSigmod(sigmod); reset(); } -const Sigmod::Sigmod* Sigmodr::Tree::SigmodTreeModel::findSigmod(const QModelIndex& index) const +const Sigmod::Sigmod* Sigmodr::Tree::SigmodrTreeModel::findSigmod(const QModelIndex& index) const { QModelIndex curIndex = index; QModelIndex parIndex = parent(curIndex); @@ -199,7 +199,7 @@ const Sigmod::Sigmod* Sigmodr::Tree::SigmodTreeModel::findSigmod(const QModelInd return qobject_cast<const Sigmod::Sigmod*>(getItem(curIndex)->object()); } -void Sigmodr::Tree::SigmodTreeModel::rowsChanged(const QList<int>& rows) +void Sigmodr::Tree::SigmodrTreeModel::rowsChanged(const QList<int>& rows) { QModelIndex curIndex; foreach (int row, rows) diff --git a/sigmodr/tree/SigmodrTreeModel.h b/sigmodr/tree/SigmodrTreeModel.h index 8481d314..89c8b1b5 100644 --- a/sigmodr/tree/SigmodrTreeModel.h +++ b/sigmodr/tree/SigmodrTreeModel.h @@ -15,8 +15,8 @@ * with this program. If not, see <http://www.gnu.org/licenses/>. */ -#ifndef SIGMODRTREE_SIGMODTREEMODEL -#define SIGMODRTREE_SIGMODTREEMODEL +#ifndef SIGMODRTREE_SIGMODRTREEMODEL +#define SIGMODRTREE_SIGMODRTREEMODEL // Sigmodr tree includes #include "RootModel.h" @@ -32,13 +32,13 @@ namespace Sigmodr { namespace Tree { -class SIGMODRTREE_IMPORT SigmodTreeModel : public QAbstractItemModel +class SIGMODRTREE_IMPORT SigmodrTreeModel : public QAbstractItemModel { Q_OBJECT public: - SigmodTreeModel(QObject* parent = 0); - ~SigmodTreeModel(); + SigmodrTreeModel(QObject* parent = 0); + ~SigmodrTreeModel(); QVariant data(const QModelIndex& index, int role) const; QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const; @@ -70,5 +70,6 @@ class SIGMODRTREE_IMPORT SigmodTreeModel : public QAbstractItemModel RootModel* m_root; }; } +} #endif |
