summaryrefslogtreecommitdiffstats
path: root/logic/OneSixVersion.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-09-16 00:54:39 +0200
committerPetr Mrázek <peterix@gmail.com>2013-09-16 00:54:39 +0200
commitd38b90530b3ba3a49c4eb072eb344ae2b0836913 (patch)
tree5dd07e59ae1bc8392a773ec8fec6b6a3aa7e4840 /logic/OneSixVersion.cpp
parent7721c57e5e1093a3d8597b6b6f30c97d2aa3d8a5 (diff)
downloadMultiMC-d38b90530b3ba3a49c4eb072eb344ae2b0836913.tar
MultiMC-d38b90530b3ba3a49c4eb072eb344ae2b0836913.tar.gz
MultiMC-d38b90530b3ba3a49c4eb072eb344ae2b0836913.tar.lz
MultiMC-d38b90530b3ba3a49c4eb072eb344ae2b0836913.tar.xz
MultiMC-d38b90530b3ba3a49c4eb072eb344ae2b0836913.zip
Forge version list implementation. Needs integration and testing.
Diffstat (limited to 'logic/OneSixVersion.cpp')
-rw-r--r--logic/OneSixVersion.cpp71
1 files changed, 71 insertions, 0 deletions
diff --git a/logic/OneSixVersion.cpp b/logic/OneSixVersion.cpp
index 7ffe9a94..dc1b5d6f 100644
--- a/logic/OneSixVersion.cpp
+++ b/logic/OneSixVersion.cpp
@@ -28,3 +28,74 @@ QList<QSharedPointer<OneSixLibrary> > OneSixVersion::getActiveNativeLibs()
}
+QVariant OneSixVersion::data(const QModelIndex& index, int role) const
+{
+ if(!index.isValid())
+ return QVariant();
+
+ int row = index.row();
+ int column = index.column();
+
+ if(row < 0 || row >= libraries.size())
+ return QVariant();
+
+ if(role == Qt::DisplayRole)
+ {
+ switch(column)
+ {
+ case 0:
+ return libraries[row]->name();
+ case 1:
+ return libraries[row]->type();
+ case 2:
+ return libraries[row]->version();
+ default:
+ return QVariant();
+ }
+ }
+ return QVariant();
+}
+
+Qt::ItemFlags OneSixVersion::flags(const QModelIndex& index) const
+{
+ if(!index.isValid())
+ return Qt::NoItemFlags;
+ int row = index.row();
+ if(libraries[row]->isActive())
+ {
+ return Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemNeverHasChildren;
+ }
+ else
+ {
+ return Qt::ItemNeverHasChildren;
+ }
+ //return QAbstractListModel::flags(index);
+}
+
+
+QVariant OneSixVersion::headerData ( int section, Qt::Orientation orientation, int role ) const
+{
+ if (role != Qt::DisplayRole || orientation != Qt::Horizontal)
+ return QVariant();
+ switch (section)
+ {
+ case 0:
+ return QString("Name");
+ case 1:
+ return QString("Type");
+ case 2:
+ return QString("Version");
+ default:
+ return QString();
+ }
+}
+
+int OneSixVersion::rowCount(const QModelIndex& parent) const
+{
+ return libraries.size();
+}
+
+int OneSixVersion::columnCount(const QModelIndex& parent) const
+{
+ return 3;
+}