mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-14 08:45:36 +08:00
Hide model string for ATC clients
This commit is contained in:
@@ -43,5 +43,23 @@ namespace BlackGui
|
||||
(void)QT_TRANSLATE_NOOP("ViewClientList", "model");
|
||||
(void)QT_TRANSLATE_NOOP("ViewClientList", "server");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
QVariant CClientListModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
static const CPropertyIndex ms( {CClient::IndexModel, CAircraftModel::IndexModelString});
|
||||
if (role != Qt::DisplayRole) { return CListModelBase::data(index, role); }
|
||||
CPropertyIndex pi = modelIndexToPropertyIndex(index);
|
||||
if (pi == ms)
|
||||
{
|
||||
// no model string for ATC
|
||||
CClient client = this->at(index);
|
||||
bool atc = client.isAtc();
|
||||
if (atc)
|
||||
{
|
||||
return QVariant("ATC");
|
||||
}
|
||||
}
|
||||
return CListModelBase::data(index, role);
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
|
||||
@@ -20,9 +20,7 @@ namespace BlackGui
|
||||
{
|
||||
namespace Models
|
||||
{
|
||||
/*!
|
||||
* Server list model
|
||||
*/
|
||||
//! Client list model
|
||||
class CClientListModel : public CListModelBase<BlackMisc::Network::CClient, BlackMisc::Network::CClientList>
|
||||
{
|
||||
|
||||
@@ -32,7 +30,11 @@ namespace BlackGui
|
||||
|
||||
//! Destructor
|
||||
virtual ~CClientListModel() {}
|
||||
|
||||
//! \copydoc QAbstractListModel::data()
|
||||
virtual QVariant data(const QModelIndex &index, int role) const override;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
} // namespace
|
||||
} // namespace
|
||||
#endif // guard
|
||||
|
||||
@@ -116,9 +116,7 @@ namespace BlackGui
|
||||
Qt::SortOrder m_sortOrder; //!< sort order (asc/desc)
|
||||
};
|
||||
|
||||
/*!
|
||||
* List model
|
||||
*/
|
||||
//! List model
|
||||
template <typename ObjectType, typename ContainerType> class CListModelBase :
|
||||
public CListModelBaseNonTemplate
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user