feat: show fake statusbar with path
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
#include "networkstreammodel.h"
|
||||
|
||||
NetworkStreamModel::NetworkStreamModel(Data *data, QObject *parent)
|
||||
: QAbstractItemModel(parent), m_data(data)
|
||||
NetworkStreamModel::NetworkStreamModel(Data *data, QObject *parent) : QAbstractItemModel(parent), m_data(data)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -82,7 +81,7 @@ int NetworkStreamModel::rowCount(const QModelIndex &parent) const
|
||||
int NetworkStreamModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return 2; // Column 0: name, Column 1: unseen count
|
||||
return 2; // Column 0: name, Column 1: unseen count
|
||||
}
|
||||
|
||||
QVariant NetworkStreamModel::data(const QModelIndex &index, int role) const
|
||||
@@ -103,7 +102,7 @@ QVariant NetworkStreamModel::data(const QModelIndex &index, int role) const
|
||||
int actualNetworkIndex = static_cast<int>(id & 0xFFFFFFFF);
|
||||
if (actualNetworkIndex >= 0 && actualNetworkIndex < m_data->networks().size())
|
||||
{
|
||||
return m_data->networks().at(actualNetworkIndex).name;
|
||||
return m_data->networks().at(actualNetworkIndex).name.toUpper();
|
||||
}
|
||||
}
|
||||
// Networks don't show unseen count in column 1
|
||||
@@ -179,6 +178,29 @@ QString NetworkStreamModel::streamIdFromIndex(const QModelIndex &index) const
|
||||
return QString();
|
||||
}
|
||||
|
||||
QString NetworkStreamModel::networkIdFromIndex(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
quintptr id = index.internalId();
|
||||
int networkIndex = static_cast<int>((id >> 32) & 0xFFFFFFFF);
|
||||
|
||||
// Check if this is a stream item (not a network)
|
||||
if (networkIndex == 0xFFFFFFFF)
|
||||
{
|
||||
int actualNetworkIndex = static_cast<int>(id & 0xFFFFFFFF);
|
||||
if (actualNetworkIndex >= 0 && actualNetworkIndex < m_data->networks().size())
|
||||
{
|
||||
return m_data->networks().at(actualNetworkIndex).id;
|
||||
}
|
||||
}
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
bool NetworkStreamModel::isStreamItem(const QModelIndex &index) const
|
||||
{
|
||||
if (!index.isValid())
|
||||
|
||||
Reference in New Issue
Block a user