Permalink
Browse files

GH-2144 Append '(installed)' to the installed version name

  • Loading branch information...
Janrupf authored and peterix committed Nov 9, 2018
1 parent 16df8d7 commit 4cc7329ce33e1d6441c9b43b217b003c0a78e985
@@ -126,7 +126,14 @@ QVariant VersionProxyModel::data(const QModelIndex &index, int role) const
switch(column)
{
case Name:
return sourceModel()->data(parentIndex, BaseVersionList::VersionRole);
{
QString version = sourceModel()->data(parentIndex, BaseVersionList::VersionRole).toString();
if(version == m_currentVersion)
{
return version + " " + tr("(installed)");
}
return version;
}
case ParentVersion:
return sourceModel()->data(parentIndex, BaseVersionList::ParentVersionRole);
case Branch:
@@ -432,5 +439,9 @@ void VersionProxyModel::sourceRowsRemoved(const QModelIndex& parent, int first,
endRemoveRows();
}
void VersionProxyModel::setCurrentVersion(const QString &version)
{
m_currentVersion = version;
}
#include "VersionProxyModel.moc"
@@ -42,6 +42,7 @@ class VersionProxyModel: public QAbstractProxyModel
void clearFilters();
QModelIndex getRecommended() const;
QModelIndex getVersion(const QString & version) const;
void setCurrentVersion(const QString &version);
private slots:
void sourceDataChanged(const QModelIndex &source_top_left,const QModelIndex &source_bottom_right);
@@ -62,4 +63,5 @@ private slots:
VersionFilterModel * filterModel;
bool hasRecommended = false;
bool hasLatest = false;
QString m_currentVersion;
};
@@ -41,6 +41,7 @@ VersionSelectWidget::VersionSelectWidget(QWidget* parent)
void VersionSelectWidget::setCurrentVersion(const QString& version)
{
m_currentVersion = version;
m_proxyModel->setCurrentVersion(version);
}
void VersionSelectWidget::setEmptyString(QString emptyString)

0 comments on commit 4cc7329

Please sign in to comment.