diff options
author | Simon Rettberg | 2015-11-12 17:03:11 +0100 |
---|---|---|
committer | Simon Rettberg | 2015-11-12 17:03:11 +0100 |
commit | 1c49173c8f62d3b9e609d22a027a42376db5d3de (patch) | |
tree | 2e5559d0435aa5ff784ee58e7dbcc8524a048984 /src/sessiontreemodel.cpp | |
parent | Add images for win2k, winxp, win8 (diff) | |
download | vmchooser2-1c49173c8f62d3b9e609d22a027a42376db5d3de.tar.gz vmchooser2-1c49173c8f62d3b9e609d22a027a42376db5d3de.tar.xz vmchooser2-1c49173c8f62d3b9e609d22a027a42376db5d3de.zip |
Start refactoring download helpers and icon management
Diffstat (limited to 'src/sessiontreemodel.cpp')
-rw-r--r-- | src/sessiontreemodel.cpp | 56 |
1 files changed, 1 insertions, 55 deletions
diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp index 7b88015..aaf47b9 100644 --- a/src/sessiontreemodel.cpp +++ b/src/sessiontreemodel.cpp @@ -13,7 +13,6 @@ SessionTreeModel::SessionTreeModel(QObject *parent) : QAbstractItemModel(parent) { root_ = new SessionTreeItem("dummy"); - iconHolder = new SessionsIconHolder(*this); } SessionTreeModel::~SessionTreeModel() { @@ -55,60 +54,7 @@ QVariant SessionTreeModel::data(const QModelIndex &index, int role) const { return s->description(); if (role == Qt::DecorationRole) { if (index.column() == 0) { // TODO: is this line needed? - QString icon(s->icon()); - - if (icon.isEmpty()) { - // Nothing... - } else if (icon.startsWith("http://")) { - // try to load icon from url - QIcon url_icon = iconHolder->getIcon(QUrl(icon)); - if (!url_icon.isNull()) { - return url_icon; - } - } else if (QFileInfo(icon).isAbsolute()) { - // try to load icon from file - return QIcon(icon); - } else { - // try to load icon from QResource - QIcon res_icon = iconHolder->getIcon(icon); - if (!res_icon.isNull()) { - return res_icon; - } - } - // fallback to os icon - if (s->type() == Session::VSESSION) { - const VSession* vs = (VSession*) s; - QString os(vs->getAttribute("os", "param").toLower()); - if (!os.isEmpty()) { - QIcon osi = iconHolder->getIcon(os); - if (!osi.isNull()) - return osi; - if (os == "dos") - return iconHolder->getIcon("dos"); - if (os.startsWith("windows7")) - return iconHolder->getIcon("win7"); - if (os.startsWith("win31")) - return iconHolder->getIcon("win311"); - if (os.startsWith("windows8")) - return iconHolder->getIcon("win8"); - if (os.startsWith("win2000")) - return iconHolder->getIcon("win2000"); - if (os.startsWith("winxp")) - return iconHolder->getIcon("winxp"); - if (os.startsWith("debian")) - return iconHolder->getIcon("debian"); - if (os.startsWith("ubuntu")) - return iconHolder->getIcon("ubuntu"); - if (os.startsWith("win")) - return iconHolder->getIcon("windows"); - if (os.contains("linux")) - return iconHolder->getIcon("linux"); - } - if (vs->imgtype() == VMWARE) - return iconHolder->getIcon("vmware"); - if (vs->imgtype() == VBOX) - return iconHolder->getIcon("virtualbox"); - } + return s->icon(); } } } else if (role == Qt::DisplayRole) { |