Commit 49efc53a authored by Carsten Fuhrmann's avatar Carsten Fuhrmann

remove [spacer] from spacer text

parent 730008ac
......@@ -237,17 +237,16 @@ void OverlayController::displayChannelList()
channelInfo tmp;
tmp.id = channelIDList[i];
tmp.name = channelID2Name(m_SCHID, channelIDList[i]);
ts3.getChannelVariableAsInt(m_SCHID, tmp.id, CHANNEL_ORDER, &tmp.order);
ts3.getParentChannelOfChannel(m_SCHID, channelIDList[i], &tmp.parent);
tmp.entry = new QTreeWidgetItem;
tmp.entry->setData(0, Qt::DisplayRole, tmp.name);
tmp.entry->setData(1, Qt::UserRole, tmp.id);
if (tmp.name.startsWith('[') && tmp.name.contains("spacer"))
{
tmp.entry->setData(2, Qt::UserRole, spacer);
tmp.name = tmp.name.remove(QRegularExpression(""));
tmp.name = tmp.name.remove(QRegExp("\\[.*spacer.*\\]"));
tmp.entry->setData(0, Qt::DisplayRole, tmp.name);
}
else
tmp.entry->setData(2, Qt::UserRole, channel);
......@@ -256,23 +255,22 @@ void OverlayController::displayChannelList()
i++;
}
// sort the list
qSort(channelList.begin(), channelList.end(), [](const channelInfo& a, const channelInfo& b) { return a.order < b.order; });
// get all toplvl channels
QVector<channelInfo> topLvlList;
for (int i = 0; i < channelList.size(); i++)
if (channelList[i].parent == 0)
topLvlList.push_back(channelList[i]);
for (auto &it : channelList)
if (it.parent == 0)
topLvlList.push_back(it);
int next = 0;
// sort the toplvl channels
int prevID = 0;
while(!topLvlList.isEmpty())
{
int i;
for (i = 0; i < topLvlList.size(); i++)
if (topLvlList[i].order == next)
if (topLvlList[i].order == prevID)
break;
next = topLvlList[i].id;
prevID = topLvlList[i].id;
m_tree->getTree()->addTopLevelItem(topLvlList.takeAt(i).entry);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment