diff options
Diffstat (limited to 'src/sessiontreemodel.cpp')
-rw-r--r-- | src/sessiontreemodel.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/sessiontreemodel.cpp b/src/sessiontreemodel.cpp index d63bab5..d0fc79e 100644 --- a/src/sessiontreemodel.cpp +++ b/src/sessiontreemodel.cpp @@ -7,6 +7,7 @@ #include <QtDebug> #include "sessiontreeitem.h" +#include "vsession.h" SessionTreeModel::SessionTreeModel(QObject *parent) : QAbstractItemModel(parent) { @@ -57,7 +58,20 @@ QVariant SessionTreeModel::data(const QModelIndex &index, int role) const { if (QFileInfo(icon).isAbsolute()) { // try to load icon from file - return QIcon(icon); + QFile iconFile(icon); + if (iconFile.exists()) { + return QIcon(icon); + } + + // fallback to os icon + if (s->type() == Session::VSESSION) { + const VSession* vs = (VSession*) s; + if (vs->getAttribute("os", "param").toLower().startsWith("win")) { + return QIcon(":windows"); + } else { + return QIcon(":linux"); + } + } } else { // try to load icon from QResource if (QResource(":" + icon.toLower() + ".svg").isValid()) { |