New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bunch of UI features + some fixes #17

Merged
merged 4 commits into from Jun 1, 2014
Jump to file or symbol
Failed to load files and symbols.
+24 −3
Diff settings

Always

Just for now

Viewing a subset of changes. View all
Prev

Make 'Detailed Host View' properly handle offline and indicate 'no re…

…mote' nodes

* HostListModel
  - Offline nodes no longer creep back onto the list.
  - Now has a 'No remote?' column.
  - Hosts with 'no remote' are now displayed grayed out (but not disabled).
  • Loading branch information...
rplociennik committed May 20, 2014
commit 23575444c1870b4c4c3a9ce619e795f36515716b
View
@@ -22,6 +22,8 @@
#include <algorithm>
#include <QLocale>
#include <QApplication>
#include <QPalette>
HostListModel::HostListModel(HostInfoManager* manager, QObject* parent)
: QAbstractListModel(parent)
@@ -37,6 +39,8 @@ QVariant HostListModel::headerData(int section, Qt::Orientation orientation, int
return tr("ID");
case ColumnName:
return tr("Name");
case ColumnNoRemote:
return tr("No remote?");
case ColumnColor:
return tr("Color");
case ColumnIP:
@@ -72,6 +76,8 @@ QVariant HostListModel::data(const QModelIndex& index, int role) const
return info.id();
case ColumnName:
return info.name();
case ColumnNoRemote:
return info.noRemote() ? tr("Yes") : "";
case ColumnColor:
return HostInfo::colorName(info.color());
case ColumnIP:
@@ -91,6 +97,8 @@ QVariant HostListModel::data(const QModelIndex& index, int role) const
switch (column) {
case ColumnID:
return Qt::AlignRight;
case ColumnNoRemote:
return Qt::AlignCenter;
case ColumnMaxJobs:
return Qt::AlignRight;
case ColumnSpeed:
@@ -100,6 +108,14 @@ QVariant HostListModel::data(const QModelIndex& index, int role) const
default:
break;
}
} else if (role == Qt::BackgroundRole) {
if (info.noRemote()) {
return QApplication::palette().color(QPalette::Disabled, QPalette::Base);
}
} else if (role == Qt::ForegroundRole) {
if (info.noRemote()) {
return QApplication::palette().color(QPalette::Disabled, QPalette::Text);
}
}
return QVariant();
}
@@ -141,9 +157,13 @@ void HostListModel::checkNode(unsigned int hostid)
const int index = m_hostInfos.indexOf(*info);
if (index != -1) {
m_hostInfos[index] = *info;
emit dataChanged(indexForHostInfo(*info, 0), indexForHostInfo(*info, _ColumnCount - 1));
} else {
if(info->isOffline()) {
removeNodeById(hostid);
} else {
m_hostInfos[index] = *info;
emit dataChanged(indexForHostInfo(*info, 0), indexForHostInfo(*info, _ColumnCount - 1));
}
} else if(!info->isOffline()) {
beginInsertRows(QModelIndex(), m_hostInfos.size(), m_hostInfos.size());
m_hostInfos << *info;
endInsertRows();
@@ -34,6 +34,7 @@ class HostListModel : public QAbstractListModel
{
ColumnID,
ColumnName,
ColumnNoRemote,
ColumnColor,
ColumnIP,
ColumnPlatform,
ProTip! Use n and p to navigate between commits in a pull request.