mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-12-16 17:13:58 -05:00
Created a basic widget of the group tree with the filter out of the channels and used it in the forums tree too.
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@3937 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7b3da2165a
commit
df1e8b7537
14 changed files with 2357 additions and 2646 deletions
|
|
@ -1,27 +0,0 @@
|
|||
/*
|
||||
* ChanGroupDelegate.cpp
|
||||
*
|
||||
* Created on: Sep 7, 2009
|
||||
* Author: alex
|
||||
*/
|
||||
|
||||
#include "ChanGroupDelegate.h"
|
||||
#include <QApplication>
|
||||
#include <QPainter>
|
||||
#include <QColor>
|
||||
|
||||
ChanGroupDelegate::ChanGroupDelegate(QObject *parent) : RSItemDelegate(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void ChanGroupDelegate::paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const
|
||||
{
|
||||
if (index.child(0, 0).isValid()) {
|
||||
painter->setPen(Qt::blue);
|
||||
QStyleOptionButton opt;
|
||||
opt.rect = option.rect;
|
||||
QApplication::style()->drawControl(QStyle::CE_PushButtonBevel, &opt, painter);
|
||||
}
|
||||
|
||||
RSItemDelegate::paint(painter, option, index);
|
||||
}
|
||||
|
|
@ -1,21 +0,0 @@
|
|||
/*
|
||||
* ChanGroupDelegate.h
|
||||
*
|
||||
* Created on: Sep 7, 2009
|
||||
* Author: alex
|
||||
*/
|
||||
|
||||
#ifndef CHANGROUPDELEGATE_H_
|
||||
#define CHANGROUPDELEGATE_H_
|
||||
|
||||
#include "common/RSItemDelegate.h"
|
||||
|
||||
class ChanGroupDelegate : public RSItemDelegate
|
||||
{
|
||||
public:
|
||||
ChanGroupDelegate(QObject *parent = 0);
|
||||
|
||||
virtual void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const;
|
||||
};
|
||||
|
||||
#endif /* CHANGROUPDELEGATE_H_ */
|
||||
|
|
@ -22,7 +22,6 @@
|
|||
#include <QMenu>
|
||||
#include <QTimer>
|
||||
#include <QStandardItemModel>
|
||||
#include <QDateTime>
|
||||
|
||||
#include <iostream>
|
||||
#include <algorithm>
|
||||
|
|
@ -41,24 +40,8 @@
|
|||
#include "channels/ShareKey.h"
|
||||
#include "notifyqt.h"
|
||||
|
||||
#include "ChanGroupDelegate.h"
|
||||
|
||||
#define CHAN_DEFAULT_IMAGE ":/images/channels.png"
|
||||
|
||||
#define COLUMN_NAME 0
|
||||
#define COLUMN_POPULARITY 1
|
||||
#define COLUMN_COUNT 2
|
||||
#define COLUMN_DATA COLUMN_NAME
|
||||
|
||||
#define ROLE_ID Qt::UserRole
|
||||
#define ROLE_CHANNEL_TITLE Qt::UserRole + 1
|
||||
#define ROLE_CHANNEL_SEARCH_SCORE Qt::UserRole + 2
|
||||
#define ROLE_CHANNEL_TS Qt::UserRole + 3
|
||||
|
||||
|
||||
#define COMBO_TITLE_INDEX 0
|
||||
#define COMBO_DESC_INDEX 1
|
||||
|
||||
#define WARNING_LIMIT 3600*24*2
|
||||
|
||||
/****
|
||||
|
|
@ -77,69 +60,25 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
|||
connect(subscribeButton, SIGNAL( clicked( void ) ), this, SLOT( subscribeChannel ( void ) ) );
|
||||
connect(unsubscribeButton, SIGNAL( clicked( void ) ), this, SLOT( unsubscribeChannel ( void ) ) );
|
||||
connect(setAllAsReadButton, SIGNAL(clicked()), this, SLOT(setAllAsReadClicked()));
|
||||
connect(resetButton, SIGNAL(clicked()), this, SLOT(finishSearching( void )));
|
||||
connect( searchLine, SIGNAL(textChanged(const QString &)), this, SLOT(filterRegExpChanged()));
|
||||
|
||||
connect(NotifyQt::getInstance(), SIGNAL(channelMsgReadSatusChanged(QString,QString,int)), this, SLOT(channelMsgReadSatusChanged(QString,QString,int)));
|
||||
|
||||
/*************** Setup Left Hand Side (List of Channels) ****************/
|
||||
|
||||
connect(treeView, SIGNAL(customContextMenuRequested( QPoint ) ), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
|
||||
connect(treeWidget, SIGNAL(treeCustomContextMenuRequested(QPoint)), this, SLOT( channelListCustomPopupMenu( QPoint ) ) );
|
||||
connect(treeWidget, SIGNAL(treeCurrentItemChanged(QString)), this, SLOT(selectChannel(QString)));
|
||||
|
||||
mChannelId.clear();
|
||||
|
||||
model = new QStandardItemModel(0, COLUMN_COUNT, this);
|
||||
model->setHeaderData(COLUMN_NAME, Qt::Horizontal, tr("Name"), Qt::DisplayRole);
|
||||
model->setHeaderData(COLUMN_POPULARITY, Qt::Horizontal, tr("Popularity"), Qt::DisplayRole);
|
||||
|
||||
treeView->setModel(model);
|
||||
|
||||
RSItemDelegate *itemDelegate = new ChanGroupDelegate(this);
|
||||
itemDelegate->removeFocusRect(COLUMN_POPULARITY);
|
||||
itemDelegate->setSpacing(QSize(0, 2));
|
||||
treeView->setItemDelegate(itemDelegate);
|
||||
|
||||
connect(treeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), this, SLOT(selectChannel(QModelIndex)));
|
||||
|
||||
/* Set header resize modes and initial section sizes TreeView*/
|
||||
QHeaderView * _header = treeView->header () ;
|
||||
_header->setResizeMode ( COLUMN_NAME, QHeaderView::Stretch);
|
||||
_header->setResizeMode ( COLUMN_POPULARITY, QHeaderView::Fixed);
|
||||
_header->resizeSection ( COLUMN_POPULARITY, 25 );
|
||||
|
||||
// set ChannelList Font
|
||||
itemFont = QFont("ARIAL", 10);
|
||||
itemFont.setBold(true);
|
||||
|
||||
QStandardItem *ownChannels = new QStandardItem(tr("Own Channels"));
|
||||
ownChannels->setFont(itemFont);
|
||||
ownChannels->setForeground(QBrush(QColor(79, 79, 79)));
|
||||
|
||||
QStandardItem *subcribedChannels = new QStandardItem(tr("Subscribed Channels"));
|
||||
subcribedChannels->setFont(itemFont);
|
||||
subcribedChannels->setForeground(QBrush(QColor(79, 79, 79)));
|
||||
|
||||
QStandardItem *popularChannels = new QStandardItem(tr("Popular Channels"));
|
||||
popularChannels->setFont(itemFont);
|
||||
popularChannels->setForeground(QBrush(QColor(79, 79, 79)));
|
||||
|
||||
QStandardItem *otherChannels = new QStandardItem(tr("Other Channels"));
|
||||
otherChannels->setFont(itemFont);
|
||||
otherChannels->setForeground(QBrush(QColor(79, 79, 79)));
|
||||
|
||||
model->appendRow(ownChannels);
|
||||
model->appendRow(subcribedChannels);
|
||||
model->appendRow(popularChannels);
|
||||
model->appendRow(otherChannels);
|
||||
|
||||
treeView->expand(ownChannels->index());
|
||||
treeView->expand(subcribedChannels->index());
|
||||
ownChannels = treeWidget->addCategoryItem(tr("Own Channels"), QIcon(), true);
|
||||
subcribedChannels = treeWidget->addCategoryItem(tr("Subscribed Channels"), QIcon(), true);
|
||||
popularChannels = treeWidget->addCategoryItem(tr("Popular Channels"), QIcon(), false);
|
||||
otherChannels = treeWidget->addCategoryItem(tr("Other Channels"), QIcon(), false);
|
||||
|
||||
//added from ahead
|
||||
updateChannelList();
|
||||
|
||||
mChannelFont = QFont("MS SANS SERIF", 22);
|
||||
nameLabel->setFont(mChannelFont);
|
||||
nameLabel->setFont(QFont("MS SANS SERIF", 22));
|
||||
nameLabel->setMinimumWidth(20);
|
||||
|
||||
// Setup Channel Menu:
|
||||
|
|
@ -147,7 +86,6 @@ ChannelFeed::ChannelFeed(QWidget *parent)
|
|||
channelmenu->addAction(actionCreate_Channel);
|
||||
channelmenu->addSeparator();
|
||||
channelpushButton->setMenu(channelmenu);
|
||||
resetButton->setVisible(false);
|
||||
|
||||
updateChannelMsgs();
|
||||
}
|
||||
|
|
@ -215,16 +153,6 @@ void ChannelFeed::createChannel()
|
|||
cf.exec();
|
||||
}
|
||||
|
||||
void ChannelFeed::channelSelection()
|
||||
{
|
||||
/* which item was selected? */
|
||||
|
||||
|
||||
/* update mChannelId */
|
||||
|
||||
updateChannelMsgs();
|
||||
}
|
||||
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
/*************************************************************************************/
|
||||
|
|
@ -266,22 +194,9 @@ void ChannelFeed::restoreChannelKeys()
|
|||
rsChannels->channelRestoreKeys(mChannelId);
|
||||
}
|
||||
|
||||
void ChannelFeed::selectChannel(QModelIndex index)
|
||||
void ChannelFeed::selectChannel(const QString &id)
|
||||
{
|
||||
QStandardItem *itemData = NULL;
|
||||
|
||||
if (index.isValid()) {
|
||||
QStandardItem *item = model->itemFromIndex(index);
|
||||
if (item && item->parent() != NULL) {
|
||||
itemData = item->parent()->child(item->row(), COLUMN_DATA);
|
||||
}
|
||||
}
|
||||
|
||||
if (itemData) {
|
||||
mChannelId = itemData->data(ROLE_ID).toString().toStdString();
|
||||
} else {
|
||||
mChannelId.clear();
|
||||
}
|
||||
mChannelId = id.toStdString();
|
||||
|
||||
updateChannelMsgs();
|
||||
}
|
||||
|
|
@ -306,269 +221,99 @@ void ChannelFeed::updateDisplay()
|
|||
}
|
||||
}
|
||||
|
||||
void ChannelFeed::filterRegExpChanged(){
|
||||
static void channelInfoToGroupItemInfo(const ChannelInfo &channelInfo, GroupItemInfo &groupItemInfo)
|
||||
{
|
||||
groupItemInfo.id = QString::fromStdString(channelInfo.channelId);
|
||||
groupItemInfo.name = QString::fromStdWString(channelInfo.channelName);
|
||||
groupItemInfo.description = QString::fromStdWString(channelInfo.channelDesc);
|
||||
groupItemInfo.popularity = channelInfo.pop;
|
||||
groupItemInfo.lastpost = QDateTime::fromTime_t(channelInfo.lastPost);
|
||||
|
||||
|
||||
if(searchLine->text().isEmpty()){
|
||||
finishSearching();
|
||||
return;
|
||||
QPixmap chanImage;
|
||||
if (channelInfo.pngImageLen) {
|
||||
chanImage.loadFromData(channelInfo.pngChanImage, channelInfo.pngImageLen, "PNG");
|
||||
} else {
|
||||
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
|
||||
}
|
||||
|
||||
resetButton->setEnabled(true);
|
||||
resetButton->setVisible(true);
|
||||
|
||||
// force display to be updated
|
||||
updateChannelList();
|
||||
|
||||
return;
|
||||
groupItemInfo.icon = QIcon(chanImage);
|
||||
}
|
||||
|
||||
void ChannelFeed::finishSearching(){
|
||||
|
||||
|
||||
searchLine->clear();
|
||||
resetButton->setVisible(false);
|
||||
resetButton->setEnabled(false);
|
||||
mChanSearchScore.clear();
|
||||
updateChannelList();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
void ChannelFeed::updateChannelList()
|
||||
{
|
||||
if (!rsChannels) {
|
||||
return;
|
||||
}
|
||||
if (!rsChannels) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::list<ChannelInfo> channelList;
|
||||
std::list<ChannelInfo>::iterator it;
|
||||
std::list<ChannelInfo> channelList;
|
||||
std::list<ChannelInfo>::iterator it;
|
||||
rsChannels->getChannelList(channelList);
|
||||
|
||||
rsChannels->getChannelList(channelList);
|
||||
std::list<std::string> keysAvailable;
|
||||
std::list<std::string>::iterator keyIt;
|
||||
rsChannels->getPubKeysAvailableGrpIds(keysAvailable);
|
||||
|
||||
/* get the ids for our lists */
|
||||
std::list<ChannelInfo> adminList;
|
||||
std::list<ChannelInfo> subList;
|
||||
std::list<ChannelInfo> popList;
|
||||
std::list<ChannelInfo> otherList;
|
||||
std::multimap<uint32_t, ChannelInfo> popMap;
|
||||
/* get the ids for our lists */
|
||||
QList<GroupItemInfo> adminList;
|
||||
QList<GroupItemInfo> subList;
|
||||
QList<GroupItemInfo> popList;
|
||||
QList<GroupItemInfo> otherList;
|
||||
std::multimap<uint32_t, GroupItemInfo> popMap;
|
||||
|
||||
for(it = channelList.begin(); it != channelList.end(); it++) {
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->channelFlags;
|
||||
for(it = channelList.begin(); it != channelList.end(); it++) {
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->channelFlags;
|
||||
|
||||
if ((flags & RS_DISTRIB_ADMIN) && (flags & RS_DISTRIB_PUBLISH) && (flags & RS_DISTRIB_SUBSCRIBED)) {
|
||||
adminList.push_back(*it);
|
||||
} else if ((flags & RS_DISTRIB_SUBSCRIBED) || ((flags & RS_DISTRIB_SUBSCRIBED) && (flags &RS_DISTRIB_PUBLISH)) ) {
|
||||
subList.push_back(*it);
|
||||
} else {
|
||||
/* rate the others by popularity */
|
||||
popMap.insert(std::make_pair(it->pop, *it));
|
||||
}
|
||||
}
|
||||
GroupItemInfo groupItemInfo;
|
||||
channelInfoToGroupItemInfo(*it, groupItemInfo);
|
||||
|
||||
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
||||
uint32_t popCount = 5;
|
||||
if (popCount < popMap.size() / 10) {
|
||||
popCount = popMap.size() / 10;
|
||||
}
|
||||
if ((flags & RS_DISTRIB_ADMIN) && (flags & RS_DISTRIB_PUBLISH) && (flags & RS_DISTRIB_SUBSCRIBED)) {
|
||||
adminList.push_back(groupItemInfo);
|
||||
} else {
|
||||
for (keyIt = keysAvailable.begin(); keyIt != keysAvailable.end(); keyIt++) {
|
||||
if (it->channelId == *keyIt) {
|
||||
/* Found Key, set title text to bold and colored blue */
|
||||
groupItemInfo.privatekey = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
std::multimap<uint32_t, ChannelInfo>::reverse_iterator rit;
|
||||
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
|
||||
if (i < popCount) {
|
||||
popList.push_back(rit->second);
|
||||
i++;
|
||||
} else {
|
||||
otherList.push_back(rit->second);
|
||||
}
|
||||
}
|
||||
|
||||
// check if search filter is being used
|
||||
if(! searchLine->text().isEmpty()){
|
||||
|
||||
filterChannelList(adminList);
|
||||
filterChannelList(subList);
|
||||
filterChannelList(popList);
|
||||
filterChannelList(otherList);
|
||||
}
|
||||
|
||||
/* now we have our lists ---> update entries */
|
||||
|
||||
fillChannelList(OWN, adminList);
|
||||
fillChannelList(SUBSCRIBED, subList);
|
||||
fillChannelList(POPULAR, popList);
|
||||
fillChannelList(OTHER, otherList);
|
||||
|
||||
// place notices for channel with private keys available
|
||||
highlightPrivateKeys(SUBSCRIBED);
|
||||
highlightPrivateKeys(POPULAR);
|
||||
highlightPrivateKeys(OTHER);
|
||||
|
||||
updateMessageSummaryList("");
|
||||
}
|
||||
|
||||
|
||||
void ChannelFeed::filterChannelList(std::list<ChannelInfo> &ci){
|
||||
|
||||
uint32_t score = 0;
|
||||
QString scoreString;
|
||||
mChanSearchScore.clear();
|
||||
std::list<ChannelInfo>::iterator it = ci.begin();
|
||||
|
||||
// first find out which has given word in it
|
||||
for(;it != ci.end(); it++){
|
||||
|
||||
if(sectionCombo->currentIndex() == COMBO_DESC_INDEX){
|
||||
scoreString = QString::fromStdWString(it->channelDesc);
|
||||
score = scoreString.count(searchLine->text(), Qt::CaseInsensitive);
|
||||
mChanSearchScore.insert(std::pair<std::string, uint32_t>(it->channelId, score));
|
||||
}
|
||||
else {
|
||||
scoreString = QString::fromStdWString(it->channelName);
|
||||
score = scoreString.count(searchLine->text(), Qt::CaseInsensitive);
|
||||
mChanSearchScore.insert(std::pair<std::string, uint32_t>(it->channelId, score));
|
||||
}
|
||||
|
||||
if(score == 0){
|
||||
it = ci.erase(it);
|
||||
it--;
|
||||
if ((flags & RS_DISTRIB_SUBSCRIBED) || ((flags & RS_DISTRIB_SUBSCRIBED) && (flags & RS_DISTRIB_PUBLISH)) ) {
|
||||
subList.push_back(groupItemInfo);
|
||||
} else {
|
||||
/* rate the others by popularity */
|
||||
popMap.insert(std::make_pair(it->pop, groupItemInfo));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* iterate backwards through popMap - take the top 5 or 10% of list */
|
||||
uint32_t popCount = 5;
|
||||
if (popCount < popMap.size() / 10) {
|
||||
popCount = popMap.size() / 10;
|
||||
}
|
||||
|
||||
uint32_t i = 0;
|
||||
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
|
||||
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
|
||||
if (i < popCount) {
|
||||
popList.push_back(rit->second);
|
||||
i++;
|
||||
} else {
|
||||
otherList.push_back(rit->second);
|
||||
}
|
||||
}
|
||||
|
||||
/* now we have our lists ---> update entries */
|
||||
|
||||
treeWidget->fillGroupItems(ownChannels, adminList);
|
||||
treeWidget->fillGroupItems(subcribedChannels, subList);
|
||||
treeWidget->fillGroupItems(popularChannels, popList);
|
||||
treeWidget->fillGroupItems(otherChannels, otherList);
|
||||
|
||||
updateMessageSummaryList("");
|
||||
}
|
||||
|
||||
void ChannelFeed::highlightPrivateKeys(int group){
|
||||
|
||||
QStandardItem *groupItem = model->item(group);
|
||||
QStandardItem *item = NULL;
|
||||
std::list<std::string> keysAvailable;
|
||||
std::list<std::string>::iterator it;
|
||||
int rowCount = 0;
|
||||
QBrush brush;
|
||||
|
||||
brush.setColor(Qt::blue);
|
||||
|
||||
if((groupItem == NULL) || (rsChannels == NULL))
|
||||
return;
|
||||
|
||||
rowCount = groupItem->rowCount();
|
||||
rsChannels->getPubKeysAvailableGrpIds(keysAvailable);
|
||||
|
||||
|
||||
for(it= keysAvailable.begin(); it != keysAvailable.end(); it++)
|
||||
|
||||
for (int row = 0; row < rowCount; row++) {
|
||||
if (groupItem->child(row, COLUMN_DATA)->data(ROLE_ID).toString() == QString::fromStdString(*it)) {
|
||||
/* found channel */
|
||||
item = groupItem->child(row, COLUMN_NAME);
|
||||
|
||||
/* set title text to bold and colored blue */
|
||||
QFont chanFont = item->font();
|
||||
chanFont.setBold(true);
|
||||
item->setFont(chanFont);
|
||||
item->setForeground(brush);
|
||||
item->setToolTip(item->toolTip() + QString("\nPrivate Key Available"));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChannelFeed::fillChannelList(int channelItem, std::list<ChannelInfo> &channelInfos){
|
||||
std::list<ChannelInfo>::iterator iit;
|
||||
|
||||
/* remove rows with groups before adding new ones */
|
||||
QStandardItem *groupItem = model->item(channelItem);
|
||||
if (groupItem == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* iterate all channels */
|
||||
for (iit = channelInfos.begin(); iit != channelInfos.end(); iit++) {
|
||||
#ifdef CHAN_DEBUG
|
||||
std::cerr << "ChannelFeed::fillChannelList(): " << channelItem << " - " << iit->channelId << std::endl;
|
||||
#endif
|
||||
|
||||
ChannelInfo &ci = *iit;
|
||||
QString channelId = QString::fromStdString(ci.channelId);
|
||||
|
||||
/* search exisiting channel item */
|
||||
int row;
|
||||
int rowCount = groupItem->rowCount();
|
||||
for (row = 0; row < rowCount; row++) {
|
||||
if (groupItem->child(row, COLUMN_DATA)->data(ROLE_ID).toString() == channelId) {
|
||||
/* found channel */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
QStandardItem *chNameItem = NULL;
|
||||
QStandardItem *chPopItem = NULL;
|
||||
if (row < rowCount) {
|
||||
chNameItem = groupItem->child(row, COLUMN_NAME);
|
||||
chPopItem = groupItem->child(row, COLUMN_POPULARITY);
|
||||
} else {
|
||||
QList<QStandardItem*> channel;
|
||||
chNameItem = new QChannelItem();
|
||||
chPopItem = new QStandardItem();
|
||||
|
||||
channel.append(chNameItem);
|
||||
channel.append(chPopItem);
|
||||
groupItem->appendRow(channel);
|
||||
|
||||
groupItem->child(chNameItem->index().row(), COLUMN_DATA)->setData(channelId, ROLE_ID);
|
||||
}
|
||||
|
||||
chNameItem->setText(QString::fromStdWString(ci.channelName));
|
||||
groupItem->child(chNameItem->index().row(), COLUMN_DATA)->setData(QString::fromStdWString(ci.channelName), ROLE_CHANNEL_TITLE);
|
||||
|
||||
// important for arrangement of channels
|
||||
groupItem->child(chNameItem->index().row(), COLUMN_DATA)->setData(((mChanSearchScore.find(channelId.toStdString()))->second),
|
||||
ROLE_CHANNEL_SEARCH_SCORE);
|
||||
groupItem->child(chNameItem->index().row(), COLUMN_DATA)->setData(QDateTime::fromTime_t(ci.lastPost), ROLE_CHANNEL_TS);
|
||||
|
||||
|
||||
chNameItem->setToolTip(PopularityDefs::tooltip(ci.pop));
|
||||
chPopItem->setToolTip(PopularityDefs::tooltip(ci.pop));
|
||||
|
||||
QPixmap chanImage;
|
||||
if (ci.pngImageLen != 0) {
|
||||
chanImage.loadFromData(ci.pngChanImage, ci.pngImageLen, "PNG");
|
||||
} else {
|
||||
chanImage = QPixmap(CHAN_DEFAULT_IMAGE);
|
||||
}
|
||||
chNameItem->setIcon(QIcon(chanImage));
|
||||
|
||||
/* set Popularity icon */
|
||||
chPopItem->setIcon(PopularityDefs::icon(ci.pop));
|
||||
}
|
||||
|
||||
/* remove all items not in list */
|
||||
int row = 0;
|
||||
int rowCount = groupItem->rowCount();
|
||||
while (row < rowCount) {
|
||||
std::string channelId = groupItem->child(row, COLUMN_DATA)->data(ROLE_ID).toString().toStdString();
|
||||
|
||||
for (iit = channelInfos.begin(); iit != channelInfos.end(); iit++) {
|
||||
if (iit->channelId == channelId) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (iit == channelInfos.end()) {
|
||||
groupItem->removeRow(row);
|
||||
rowCount = groupItem->rowCount();
|
||||
} else {
|
||||
row++;
|
||||
}
|
||||
}
|
||||
|
||||
model->item(channelItem)->sortChildren(COLUMN_NAME, Qt::DescendingOrder);
|
||||
|
||||
}
|
||||
|
||||
void ChannelFeed::channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status)
|
||||
{
|
||||
|
|
@ -577,52 +322,33 @@ void ChannelFeed::channelMsgReadSatusChanged(const QString& channelId, const QSt
|
|||
|
||||
void ChannelFeed::updateMessageSummaryList(const std::string &channelId)
|
||||
{
|
||||
int channelItems[2] = { OWN, SUBSCRIBED };
|
||||
QTreeWidgetItem *items[2] = { ownChannels, subcribedChannels };
|
||||
|
||||
for (int item = 0; item < 2; item++) {
|
||||
int child;
|
||||
int childCount = items[item]->childCount();
|
||||
for (child = 0; child < childCount; child++) {
|
||||
QTreeWidgetItem *childItem = items[item]->child(child);
|
||||
std::string childId = treeWidget->itemId(childItem).toStdString();
|
||||
if (childId.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (channelId.empty() || childId == channelId) {
|
||||
/* Calculate unread messages */
|
||||
unsigned int newMessageCount = 0;
|
||||
unsigned int unreadMessageCount = 0;
|
||||
rsChannels->getMessageCount(childId, newMessageCount, unreadMessageCount);
|
||||
|
||||
for (int channelItem = 0; channelItem < 2; channelItem++) {
|
||||
QStandardItem *groupItem = model->item(channelItems[channelItem]);
|
||||
if (groupItem == NULL) {
|
||||
continue;
|
||||
}
|
||||
treeWidget->setUnreadCount(childItem, unreadMessageCount);
|
||||
|
||||
int row;
|
||||
int rowCount = groupItem->rowCount();
|
||||
for (row = 0; row < rowCount; row++) {
|
||||
std::string rowChannelId = groupItem->child(row, COLUMN_DATA)->data(ROLE_ID).toString().toStdString();
|
||||
if (rowChannelId.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (channelId.empty() || rowChannelId == channelId) {
|
||||
/* calculate unread messages */
|
||||
unsigned int newMessageCount = 0;
|
||||
unsigned int unreadMessageCount = 0;
|
||||
rsChannels->getMessageCount(rowChannelId, newMessageCount, unreadMessageCount);
|
||||
|
||||
QStandardItem *item = groupItem->child(row, COLUMN_NAME);
|
||||
|
||||
QString title = item->data(ROLE_CHANNEL_TITLE).toString();
|
||||
QFont font = item->font();
|
||||
|
||||
if (unreadMessageCount) {
|
||||
title += " (" + QString::number(unreadMessageCount) + ")";
|
||||
font.setBold(true);
|
||||
} else {
|
||||
font.setBold(false);
|
||||
}
|
||||
|
||||
item->setText(title);
|
||||
item->setFont(font);
|
||||
|
||||
if (channelId.empty() == false) {
|
||||
/* calculate only this channel */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (channelId.empty() == false) {
|
||||
/* Calculate only this channel */
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static bool sortChannelMsgSummary(const ChannelMsgSummary &msg1, const ChannelMsgSummary &msg2)
|
||||
|
|
@ -779,39 +505,3 @@ void ChannelFeed::setAllAsReadClicked()
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
QChannelItem::QChannelItem()
|
||||
: QStandardItem(){
|
||||
}
|
||||
|
||||
|
||||
QChannelItem::~QChannelItem(){
|
||||
|
||||
}
|
||||
|
||||
bool QChannelItem::operator<(const QStandardItem& other) const {
|
||||
|
||||
uint32_t otherCount = 0, thisCount = 0;
|
||||
uint otherChanTs = other.data(ROLE_CHANNEL_TS).toDateTime().toTime_t();
|
||||
uint thisChanTs = this->data(ROLE_CHANNEL_TS).toDateTime().toTime_t();
|
||||
|
||||
|
||||
otherCount = other.data(ROLE_CHANNEL_SEARCH_SCORE).toUInt();
|
||||
thisCount = this->data(ROLE_CHANNEL_SEARCH_SCORE).toUInt();
|
||||
|
||||
// if counts are equal then determine by who has the most recent post
|
||||
if(otherCount == thisCount){
|
||||
if(thisChanTs < otherChanTs)
|
||||
return true;
|
||||
}
|
||||
|
||||
// choose the item where the string occurs the most
|
||||
if(thisCount < otherCount)
|
||||
return true;
|
||||
|
||||
if(thisChanTs < otherChanTs)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -33,16 +33,8 @@
|
|||
|
||||
#include "gui/feeds/FeedHolder.h"
|
||||
|
||||
|
||||
|
||||
#define OWN 0
|
||||
#define SUBSCRIBED 1
|
||||
#define POPULAR 2
|
||||
#define OTHER 3
|
||||
|
||||
class ChanMsgItem;
|
||||
class QStandardItemModel;
|
||||
class QStandardItem;
|
||||
class QTreeWidgetItem;
|
||||
|
||||
class ChannelFeed : public RsAutoUpdatePage, public FeedHolder, private Ui::ChannelFeed
|
||||
{
|
||||
|
|
@ -53,23 +45,18 @@ public:
|
|||
ChannelFeed(QWidget *parent = 0);
|
||||
/** Default Destructor */
|
||||
|
||||
|
||||
virtual void deleteFeedItem(QWidget *item, uint32_t type);
|
||||
virtual void openChat(std::string peerId);
|
||||
|
||||
/* overloaded from RsAuthUpdatePage */
|
||||
virtual void updateDisplay();
|
||||
|
||||
public slots:
|
||||
void selectChannel(QModelIndex index);
|
||||
|
||||
private slots:
|
||||
void channelListCustomPopupMenu( QPoint point );
|
||||
void selectChannel(const QString &id);
|
||||
|
||||
void createChannel();
|
||||
|
||||
void channelSelection();
|
||||
|
||||
void subscribeChannel();
|
||||
void unsubscribeChannel();
|
||||
void setAllAsReadClicked();
|
||||
|
|
@ -82,19 +69,12 @@ private slots:
|
|||
void shareKey();
|
||||
|
||||
void channelMsgReadSatusChanged(const QString& channelId, const QString& msgId, int status);
|
||||
void filterRegExpChanged();
|
||||
void finishSearching();
|
||||
|
||||
private:
|
||||
void highlightPrivateKeys(int group);
|
||||
void updateChannelList();
|
||||
void fillChannelList(int channelItem, std::list<ChannelInfo> &channelInfos);
|
||||
void filterChannelList(std::list<ChannelInfo>&);
|
||||
void updateChannelMsgs();
|
||||
void updateMessageSummaryList(const std::string &channelId);
|
||||
|
||||
QStandardItemModel *model;
|
||||
|
||||
std::string mChannelId; /* current Channel */
|
||||
|
||||
/* Layout Pointers */
|
||||
|
|
@ -103,26 +83,11 @@ private:
|
|||
std::list<ChanMsgItem *> mChanMsgItems;
|
||||
std::map<std::string, uint32_t> mChanSearchScore; //chanId, score
|
||||
|
||||
QFont mChannelFont;
|
||||
QFont itemFont;
|
||||
QTreeWidgetItem *ownChannels;
|
||||
QTreeWidgetItem *subcribedChannels;
|
||||
QTreeWidgetItem *popularChannels;
|
||||
QTreeWidgetItem *otherChannels;
|
||||
};
|
||||
|
||||
class QChannelItem : public QStandardItem
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
QChannelItem();
|
||||
virtual ~QChannelItem();
|
||||
|
||||
/**
|
||||
* reimplementing comparison operator so QChannelItems can be ordered in terms
|
||||
* of occurences of property searchText in its data columns
|
||||
*/
|
||||
bool operator<(const QStandardItem& other) const;
|
||||
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -65,18 +65,6 @@
|
|||
#define VIEW_THREADED 1
|
||||
#define VIEW_FLAT 2
|
||||
|
||||
/* Forum constants */
|
||||
#define COLUMN_FORUM_COUNT 2
|
||||
#define COLUMN_FORUM_TITLE 0
|
||||
#define COLUMN_FORUM_POPULARITY 1
|
||||
|
||||
#define COLUMN_FORUM_DATA 0
|
||||
|
||||
#define ROLE_FORUM_ID Qt::UserRole
|
||||
#define ROLE_FORUM_TITLE Qt::UserRole + 1
|
||||
|
||||
#define ROLE_FORUM_COUNT 2
|
||||
|
||||
/* Thread constants */
|
||||
#define COLUMN_THREAD_COUNT 6
|
||||
#define COLUMN_THREAD_TITLE 0
|
||||
|
|
@ -141,14 +129,14 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||
m_bIsForumSubscribed = false;
|
||||
m_bIsForumAdmin = false;
|
||||
|
||||
connect( ui.forumTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
||||
connect( ui.forumTreeWidget, SIGNAL( treeCustomContextMenuRequested( QPoint ) ), this, SLOT( forumListCustomPopupMenu( QPoint ) ) );
|
||||
connect( ui.threadTreeWidget, SIGNAL( customContextMenuRequested( QPoint ) ), this, SLOT( threadListCustomPopupMenu( QPoint ) ) );
|
||||
|
||||
connect(ui.actionCreate_Forum, SIGNAL(triggered()), this, SLOT(newforum()));
|
||||
connect(ui.newmessageButton, SIGNAL(clicked()), this, SLOT(createmessage()));
|
||||
connect(ui.newthreadButton, SIGNAL(clicked()), this, SLOT(createthread()));
|
||||
|
||||
connect( ui.forumTreeWidget, SIGNAL( currentItemChanged ( QTreeWidgetItem *, QTreeWidgetItem *) ), this, SLOT( changedForum( QTreeWidgetItem *, QTreeWidgetItem * ) ) );
|
||||
connect( ui.forumTreeWidget, SIGNAL( treeCurrentItemChanged(QString) ), this, SLOT( changedForum(QString) ) );
|
||||
|
||||
connect( ui.threadTreeWidget, SIGNAL( itemSelectionChanged() ), this, SLOT( changedThread () ) );
|
||||
connect( ui.threadTreeWidget, SIGNAL( itemClicked(QTreeWidgetItem*,int)), this, SLOT( clickedThread (QTreeWidgetItem*,int) ) );
|
||||
|
|
@ -168,19 +156,6 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||
itemDelegate->setSpacing(QSize(0, 2));
|
||||
ui.threadTreeWidget->setItemDelegate(itemDelegate);
|
||||
|
||||
itemDelegate = new RSItemDelegate(this);
|
||||
itemDelegate->removeFocusRect(COLUMN_FORUM_POPULARITY);
|
||||
itemDelegate->setSpacing(QSize(0, 2));
|
||||
ui.forumTreeWidget->setItemDelegate(itemDelegate);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
ui.forumTreeWidget->setColumnCount(COLUMN_FORUM_COUNT);
|
||||
QHeaderView * ftheader = ui.forumTreeWidget->header ();
|
||||
ftheader->setResizeMode (COLUMN_FORUM_TITLE, QHeaderView::Stretch);
|
||||
ftheader->resizeSection (COLUMN_FORUM_TITLE, 170);
|
||||
ftheader->setResizeMode (COLUMN_FORUM_POPULARITY, QHeaderView::Fixed);
|
||||
ftheader->resizeSection (COLUMN_FORUM_POPULARITY, 25);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView * ttheader = ui.threadTreeWidget->header () ;
|
||||
ttheader->setResizeMode (COLUMN_THREAD_TITLE, QHeaderView::Interactive);
|
||||
|
|
@ -203,47 +178,10 @@ ForumsDialog::ForumsDialog(QWidget *parent)
|
|||
ui.forumpushButton->setMenu(forummenu);
|
||||
|
||||
/* create forum tree */
|
||||
m_ItemFont = QFont("ARIAL", 10);
|
||||
m_ItemFont.setBold(true);
|
||||
|
||||
QList<QTreeWidgetItem *> TopList;
|
||||
|
||||
YourForums = new QTreeWidgetItem();
|
||||
YourForums->setText(COLUMN_FORUM_TITLE, tr("Your Forums"));
|
||||
YourForums->setFont(COLUMN_FORUM_TITLE, m_ItemFont);
|
||||
YourForums->setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FOLDER)));
|
||||
YourForums->setSizeHint(COLUMN_FORUM_TITLE, QSize( 18,18 ) );
|
||||
YourForums->setForeground(COLUMN_FORUM_TITLE, QBrush(QColor(79, 79, 79)));
|
||||
TopList.append(YourForums);
|
||||
|
||||
SubscribedForums = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
SubscribedForums->setText(COLUMN_FORUM_TITLE, tr("Subscribed Forums"));
|
||||
SubscribedForums->setFont(COLUMN_FORUM_TITLE, m_ItemFont);
|
||||
SubscribedForums->setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FOLDERRED)));
|
||||
SubscribedForums->setSizeHint(COLUMN_FORUM_TITLE, QSize( 18,18 ) );
|
||||
SubscribedForums->setForeground(COLUMN_FORUM_TITLE, QBrush(QColor(79, 79, 79)));
|
||||
TopList.append(SubscribedForums);
|
||||
|
||||
PopularForums = new QTreeWidgetItem();
|
||||
PopularForums->setText(COLUMN_FORUM_TITLE, tr("Popular Forums"));
|
||||
PopularForums->setFont(COLUMN_FORUM_TITLE, m_ItemFont);
|
||||
PopularForums->setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FOLDERGREEN)));
|
||||
PopularForums->setSizeHint(COLUMN_FORUM_TITLE, QSize( 18,18 ) );
|
||||
PopularForums->setForeground(COLUMN_FORUM_TITLE, QBrush(QColor(79, 79, 79)));
|
||||
TopList.append(PopularForums);
|
||||
|
||||
OtherForums = new QTreeWidgetItem();
|
||||
OtherForums->setText(COLUMN_FORUM_TITLE, tr("Other Forums"));
|
||||
OtherForums->setFont(COLUMN_FORUM_TITLE, m_ItemFont);
|
||||
OtherForums->setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FOLDERYELLOW)));
|
||||
OtherForums->setSizeHint(COLUMN_FORUM_TITLE, QSize( 18,18 ) );
|
||||
OtherForums->setForeground(COLUMN_FORUM_TITLE, QBrush(QColor(79, 79, 79)));
|
||||
TopList.append(OtherForums);
|
||||
|
||||
ui.forumTreeWidget->addTopLevelItems(TopList);
|
||||
|
||||
YourForums->setExpanded(true);
|
||||
SubscribedForums->setExpanded(true);
|
||||
yourForums = ui.forumTreeWidget->addCategoryItem(tr("Your Forums"), QIcon(IMAGE_FOLDER), true);
|
||||
subscribedForums = ui.forumTreeWidget->addCategoryItem(tr("Subscribed Forums"), QIcon(IMAGE_FOLDERRED), true);
|
||||
popularForums = ui.forumTreeWidget->addCategoryItem(tr("Popular Forums"), QIcon(IMAGE_FOLDERGREEN), false);
|
||||
otherForums = ui.forumTreeWidget->addCategoryItem(tr("Other Forums"), QIcon(IMAGE_FOLDERYELLOW), false);
|
||||
|
||||
m_LastViewType = -1;
|
||||
|
||||
|
|
@ -489,6 +427,22 @@ static void CleanupItems (QList<QTreeWidgetItem *> &Items)
|
|||
}
|
||||
}
|
||||
|
||||
void ForumsDialog::forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo)
|
||||
{
|
||||
groupItemInfo.id = QString::fromStdString(forumInfo.forumId);
|
||||
groupItemInfo.name = QString::fromStdWString(forumInfo.forumName);
|
||||
groupItemInfo.description = QString::fromStdWString(forumInfo.forumDesc);
|
||||
groupItemInfo.popularity = forumInfo.pop;
|
||||
groupItemInfo.lastpost = QDateTime::fromTime_t(forumInfo.lastPost);
|
||||
|
||||
if (forumInfo.forumFlags & RS_DISTRIB_AUTHEN_REQ) {
|
||||
groupItemInfo.name += " (" + tr("AUTHD") + ")";
|
||||
groupItemInfo.icon = QIcon(IMAGE_FORUMAUTHD);
|
||||
} else {
|
||||
groupItemInfo.icon = QIcon(IMAGE_FORUM);
|
||||
}
|
||||
}
|
||||
|
||||
void ForumsDialog::insertForums()
|
||||
{
|
||||
std::list<ForumInfo> forumList;
|
||||
|
|
@ -500,93 +454,27 @@ void ForumsDialog::insertForums()
|
|||
|
||||
rsForums->getForumList(forumList);
|
||||
|
||||
QList<QTreeWidgetItem *> AdminList;
|
||||
QList<QTreeWidgetItem *> SubList;
|
||||
QList<QTreeWidgetItem *> PopList;
|
||||
QList<QTreeWidgetItem *> OtherList;
|
||||
std::multimap<uint32_t, std::string> popMap;
|
||||
QList<GroupItemInfo> adminList;
|
||||
QList<GroupItemInfo> subList;
|
||||
QList<GroupItemInfo> popList;
|
||||
QList<GroupItemInfo> otherList;
|
||||
std::multimap<uint32_t, GroupItemInfo> popMap;
|
||||
|
||||
for(it = forumList.begin(); it != forumList.end(); it++)
|
||||
{
|
||||
for (it = forumList.begin(); it != forumList.end(); it++) {
|
||||
/* sort it into Publish (Own), Subscribed, Popular and Other */
|
||||
uint32_t flags = it->subscribeFlags;
|
||||
|
||||
if (flags & RS_DISTRIB_ADMIN)
|
||||
{
|
||||
/* own */
|
||||
GroupItemInfo groupItemInfo;
|
||||
forumInfoToGroupItemInfo(*it, groupItemInfo);
|
||||
|
||||
/* Name,
|
||||
* Type,
|
||||
* Rank,
|
||||
* LastPost
|
||||
* ForumId,
|
||||
*/
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
QString name = QString::fromStdWString(it->forumName);
|
||||
if (it->forumFlags & RS_DISTRIB_AUTHEN_REQ)
|
||||
{
|
||||
name += " (AUTHD)";
|
||||
item -> setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FORUMAUTHD)));
|
||||
}
|
||||
else
|
||||
{
|
||||
item -> setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FORUM)));
|
||||
}
|
||||
|
||||
item -> setText(COLUMN_FORUM_TITLE, name);
|
||||
item -> setData(COLUMN_FORUM_DATA, ROLE_FORUM_TITLE, name);
|
||||
|
||||
/* (1) Popularity */
|
||||
item -> setIcon(COLUMN_FORUM_POPULARITY, PopularityDefs::icon(it->pop));
|
||||
item -> setToolTip(COLUMN_FORUM_TITLE, PopularityDefs::tooltip(it->pop));
|
||||
item -> setToolTip(COLUMN_FORUM_POPULARITY, PopularityDefs::tooltip(it->pop));
|
||||
|
||||
// Id.
|
||||
item -> setData(COLUMN_FORUM_DATA, ROLE_FORUM_ID, QString::fromStdString(it->forumId));
|
||||
AdminList.append(item);
|
||||
}
|
||||
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
if (flags & RS_DISTRIB_ADMIN) {
|
||||
adminList.push_back(groupItemInfo);
|
||||
} else if (flags & RS_DISTRIB_SUBSCRIBED) {
|
||||
/* subscribed forum */
|
||||
|
||||
/* Name,
|
||||
* Type,
|
||||
* Rank,
|
||||
* LastPost
|
||||
* ForumId,
|
||||
*/
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
QString name = QString::fromStdWString(it->forumName);
|
||||
if (it->forumFlags & RS_DISTRIB_AUTHEN_REQ)
|
||||
{
|
||||
name += " (AUTHD)";
|
||||
item -> setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FORUMAUTHD)));
|
||||
}
|
||||
else
|
||||
{
|
||||
item -> setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FORUM)));
|
||||
}
|
||||
|
||||
item -> setText(COLUMN_FORUM_TITLE, name);
|
||||
item -> setData(COLUMN_FORUM_DATA, ROLE_FORUM_TITLE, name);
|
||||
|
||||
/* (1) Popularity */
|
||||
item -> setIcon(COLUMN_FORUM_POPULARITY, PopularityDefs::icon(it->pop));
|
||||
item -> setToolTip(COLUMN_FORUM_TITLE, PopularityDefs::tooltip(it->pop));
|
||||
item -> setToolTip(COLUMN_FORUM_POPULARITY, PopularityDefs::tooltip(it->pop));
|
||||
|
||||
// Id.
|
||||
item -> setData(COLUMN_FORUM_DATA, ROLE_FORUM_ID, QString::fromStdString(it->forumId));
|
||||
SubList.append(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
subList.push_back(groupItemInfo);
|
||||
} else {
|
||||
/* rate the others by popularity */
|
||||
popMap.insert(std::make_pair(it->pop, it->forumId));
|
||||
popMap.insert(std::make_pair(it->pop, groupItemInfo));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -599,151 +487,34 @@ void ForumsDialog::insertForums()
|
|||
|
||||
uint32_t i = 0;
|
||||
uint32_t popLimit = 0;
|
||||
std::multimap<uint32_t, std::string>::reverse_iterator rit;
|
||||
std::multimap<uint32_t, GroupItemInfo>::reverse_iterator rit;
|
||||
for(rit = popMap.rbegin(); ((rit != popMap.rend()) && (i < popCount)); rit++, i++);
|
||||
if (rit != popMap.rend())
|
||||
{
|
||||
popLimit = rit->first;
|
||||
}
|
||||
if (rit != popMap.rend()) {
|
||||
popLimit = rit->first;
|
||||
}
|
||||
|
||||
for(it = forumList.begin(); it != forumList.end(); it++)
|
||||
{
|
||||
/* ignore the ones we've done already */
|
||||
uint32_t flags = it->subscribeFlags;
|
||||
|
||||
if (flags & RS_DISTRIB_ADMIN)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else if (flags & RS_DISTRIB_SUBSCRIBED)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* popular forum */
|
||||
|
||||
/* Name,
|
||||
* Type,
|
||||
* Rank,
|
||||
* LastPost
|
||||
* ForumId,
|
||||
*/
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem((QTreeWidget*)0);
|
||||
|
||||
QString name = QString::fromStdWString(it->forumName);
|
||||
if (it->forumFlags & RS_DISTRIB_AUTHEN_REQ)
|
||||
{
|
||||
name += " (AUTHD)";
|
||||
item -> setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FORUMAUTHD)));
|
||||
}
|
||||
else
|
||||
{
|
||||
item -> setIcon(COLUMN_FORUM_TITLE,(QIcon(IMAGE_FORUM)));
|
||||
}
|
||||
|
||||
item -> setText(COLUMN_FORUM_TITLE, name);
|
||||
item -> setData(COLUMN_FORUM_DATA, ROLE_FORUM_TITLE, name);
|
||||
|
||||
|
||||
/* (1) Popularity */
|
||||
item -> setIcon(COLUMN_FORUM_POPULARITY, PopularityDefs::icon(it->pop));
|
||||
item -> setToolTip(COLUMN_FORUM_TITLE, PopularityDefs::tooltip(it->pop));
|
||||
item -> setToolTip(COLUMN_FORUM_POPULARITY, PopularityDefs::tooltip(it->pop));
|
||||
|
||||
// Id.
|
||||
item -> setData(COLUMN_FORUM_DATA, ROLE_FORUM_ID, QString::fromStdString(it->forumId));
|
||||
|
||||
if (it->pop < popLimit)
|
||||
{
|
||||
OtherList.append(item);
|
||||
}
|
||||
else
|
||||
{
|
||||
PopList.append(item);
|
||||
}
|
||||
}
|
||||
for (rit = popMap.rbegin(); rit != popMap.rend(); rit++) {
|
||||
if (rit->second.popularity < (int) popLimit) {
|
||||
otherList.append(rit->second);
|
||||
} else {
|
||||
popList.append(rit->second);
|
||||
}
|
||||
}
|
||||
|
||||
/* now we can add them in as a tree! */
|
||||
FillForums (YourForums, AdminList);
|
||||
FillForums (SubscribedForums, SubList);
|
||||
FillForums (PopularForums, PopList);
|
||||
FillForums (OtherForums, OtherList);
|
||||
|
||||
// cleanup
|
||||
CleanupItems (AdminList);
|
||||
CleanupItems (SubList);
|
||||
CleanupItems (PopList);
|
||||
CleanupItems (OtherList);
|
||||
ui.forumTreeWidget->fillGroupItems(yourForums, adminList);
|
||||
ui.forumTreeWidget->fillGroupItems(subscribedForums, subList);
|
||||
ui.forumTreeWidget->fillGroupItems(popularForums, popList);
|
||||
ui.forumTreeWidget->fillGroupItems(otherForums, otherList);
|
||||
|
||||
updateMessageSummaryList("");
|
||||
}
|
||||
|
||||
void ForumsDialog::FillForums(QTreeWidgetItem *Forum, QList<QTreeWidgetItem *> &ChildList)
|
||||
void ForumsDialog::changedForum(const QString &id)
|
||||
{
|
||||
int ChildIndex;
|
||||
int ChildIndexCur = 0;
|
||||
mCurrForumId = id.toStdString();
|
||||
|
||||
QTreeWidgetItem *Child;
|
||||
|
||||
// iterate all new children
|
||||
QList<QTreeWidgetItem *>::iterator NewChild;
|
||||
for (NewChild = ChildList.begin (); NewChild != ChildList.end (); NewChild++) {
|
||||
// search existing child
|
||||
int ChildIndexFound = -1;
|
||||
int ChildCount = Forum->childCount ();
|
||||
for (ChildIndex = ChildIndexCur; ChildIndex < ChildCount; ChildIndex++) {
|
||||
Child = Forum->child (ChildIndex);
|
||||
if (Child->data (COLUMN_FORUM_DATA, ROLE_FORUM_ID) == (*NewChild)->data (COLUMN_FORUM_DATA, ROLE_FORUM_ID)) {
|
||||
// found it
|
||||
ChildIndexFound = ChildIndex;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (ChildIndexFound >= 0) {
|
||||
// delete all children between
|
||||
while (ChildIndexCur < ChildIndexFound) {
|
||||
Child = Forum->takeChild (ChildIndexCur);
|
||||
delete (Child);
|
||||
ChildIndexFound--;
|
||||
}
|
||||
|
||||
// set child data
|
||||
Child = Forum->child (ChildIndexFound);
|
||||
Child->setIcon (COLUMN_FORUM_TITLE, (*NewChild)->icon (COLUMN_FORUM_TITLE));
|
||||
Child->setToolTip (COLUMN_FORUM_TITLE, (*NewChild)->toolTip (COLUMN_FORUM_TITLE));
|
||||
|
||||
int i;
|
||||
for (i = 0; i < COLUMN_FORUM_COUNT; i++) {
|
||||
Child->setText (i, (*NewChild)->text (i));
|
||||
}
|
||||
for (i = 0; i < ROLE_FORUM_COUNT; i++) {
|
||||
Child->setData (COLUMN_FORUM_DATA, Qt::UserRole + i, (*NewChild)->data (COLUMN_FORUM_DATA, Qt::UserRole + i));
|
||||
}
|
||||
} else {
|
||||
// insert new child
|
||||
if (ChildIndexCur < ChildCount) {
|
||||
Forum->insertChild (ChildIndexCur, *NewChild);
|
||||
} else {
|
||||
Forum->addChild (*NewChild);
|
||||
}
|
||||
*NewChild = NULL;
|
||||
}
|
||||
ChildIndexCur++;
|
||||
}
|
||||
|
||||
// delete rest
|
||||
while (ChildIndexCur < Forum->childCount ()) {
|
||||
Child = Forum->takeChild (ChildIndexCur);
|
||||
delete (Child);
|
||||
}
|
||||
}
|
||||
|
||||
void ForumsDialog::changedForum( QTreeWidgetItem *curr, QTreeWidgetItem *prev )
|
||||
{
|
||||
insertThreads();
|
||||
insertThreads();
|
||||
}
|
||||
|
||||
void ForumsDialog::changedThread ()
|
||||
|
|
@ -861,8 +632,7 @@ void ForumsDialog::insertThreads()
|
|||
m_bIsForumSubscribed = false;
|
||||
m_bIsForumAdmin = false;
|
||||
|
||||
QTreeWidgetItem *forumItem = ui.forumTreeWidget->currentItem();
|
||||
if ((!forumItem) || (forumItem->parent() == NULL))
|
||||
if (mCurrForumId.empty())
|
||||
{
|
||||
/* not an actual forum - clear */
|
||||
ui.threadTreeWidget->clear();
|
||||
|
|
@ -881,13 +651,8 @@ void ForumsDialog::insertThreads()
|
|||
return;
|
||||
}
|
||||
|
||||
/* store forumId */
|
||||
mCurrForumId = forumItem->data(COLUMN_FORUM_DATA, ROLE_FORUM_ID).toString().toStdString();
|
||||
ui.forumName->setText(forumItem->text(COLUMN_FORUM_TITLE));
|
||||
std::string fId = mCurrForumId;
|
||||
|
||||
ForumInfo fi;
|
||||
if (rsForums->getForumInfo (fId, fi)) {
|
||||
if (rsForums->getForumInfo (mCurrForumId, fi)) {
|
||||
if (fi.subscribeFlags & RS_DISTRIB_ADMIN) {
|
||||
m_bIsForumAdmin = true;
|
||||
}
|
||||
|
|
@ -898,6 +663,8 @@ void ForumsDialog::insertThreads()
|
|||
return;
|
||||
}
|
||||
|
||||
ui.forumName->setText(QString::fromStdWString(fi.forumName));
|
||||
|
||||
ui.newmessageButton->setEnabled (m_bIsForumSubscribed);
|
||||
ui.newthreadButton->setEnabled (m_bIsForumSubscribed);
|
||||
|
||||
|
|
@ -917,6 +684,12 @@ void ForumsDialog::insertThreads()
|
|||
break;
|
||||
}
|
||||
|
||||
if (flatView) {
|
||||
ui.threadTreeWidget->setRootIsDecorated( true );
|
||||
} else {
|
||||
ui.threadTreeWidget->setRootIsDecorated( true );
|
||||
}
|
||||
|
||||
bool bExpandNewMessages = Settings->getExpandNewMessages();
|
||||
std::list<QTreeWidgetItem*> itemToExpand;
|
||||
|
||||
|
|
@ -939,7 +712,7 @@ void ForumsDialog::insertThreads()
|
|||
std::cerr << tit->msgId << std::endl;
|
||||
|
||||
ForumMsgInfo msginfo;
|
||||
if (rsForums->getForumMessage(fId,tit->msgId,msginfo) == false) {
|
||||
if (rsForums->getForumMessage(mCurrForumId, tit->msgId, msginfo) == false) {
|
||||
std::cerr << "ForumsDialog::insertThreads() Failed to Get Msg";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
|
|
@ -1028,7 +801,7 @@ void ForumsDialog::insertThreads()
|
|||
std::cerr << "ForumsDialog::insertThreads() Getting Children of : " << pId;
|
||||
std::cerr << std::endl;
|
||||
|
||||
if (rsForums->getForumThreadMsgList(fId, pId, msgs))
|
||||
if (rsForums->getForumThreadMsgList(mCurrForumId, pId, msgs))
|
||||
{
|
||||
std::cerr << "ForumsDialog::insertThreads() #Children " << msgs.size();
|
||||
std::cerr << std::endl;
|
||||
|
|
@ -1040,7 +813,7 @@ void ForumsDialog::insertThreads()
|
|||
std::cerr << std::endl;
|
||||
|
||||
ForumMsgInfo msginfo;
|
||||
if (rsForums->getForumMessage(fId,mit->msgId,msginfo) == false) {
|
||||
if (rsForums->getForumMessage(mCurrForumId, mit->msgId, msginfo) == false) {
|
||||
std::cerr << "ForumsDialog::insertThreads() Failed to Get Msg";
|
||||
std::cerr << std::endl;
|
||||
continue;
|
||||
|
|
@ -1050,12 +823,10 @@ void ForumsDialog::insertThreads()
|
|||
if (flatView)
|
||||
{
|
||||
child = new QTreeWidgetItem();
|
||||
ui.threadTreeWidget->setRootIsDecorated( true );
|
||||
}
|
||||
else
|
||||
{
|
||||
child = new QTreeWidgetItem(parent);
|
||||
ui.threadTreeWidget->setRootIsDecorated( true );
|
||||
}
|
||||
|
||||
{
|
||||
|
|
@ -1624,22 +1395,16 @@ void ForumsDialog::unsubscribeToForum()
|
|||
|
||||
void ForumsDialog::forumSubscribe(bool subscribe)
|
||||
{
|
||||
QTreeWidgetItem *forumItem = ui.forumTreeWidget->currentItem();
|
||||
if ((!forumItem) || (forumItem->parent() == NULL))
|
||||
{
|
||||
return;
|
||||
if (mCurrForumId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* store forumId */
|
||||
std::string fId = forumItem->data(COLUMN_FORUM_DATA, ROLE_FORUM_ID).toString().toStdString();
|
||||
|
||||
rsForums->forumSubscribe(fId, subscribe);
|
||||
rsForums->forumSubscribe(mCurrForumId, subscribe);
|
||||
}
|
||||
|
||||
void ForumsDialog::showForumDetails()
|
||||
{
|
||||
if (mCurrForumId == "")
|
||||
{
|
||||
if (mCurrForumId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1651,8 +1416,7 @@ void ForumsDialog::showForumDetails()
|
|||
|
||||
void ForumsDialog::editForumDetails()
|
||||
{
|
||||
if (mCurrForumId == "")
|
||||
{
|
||||
if (mCurrForumId.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -1786,38 +1550,28 @@ bool ForumsDialog::FilterItem(QTreeWidgetItem *pItem, QString &sPattern, int nFi
|
|||
|
||||
void ForumsDialog::updateMessageSummaryList(std::string forumId)
|
||||
{
|
||||
QTreeWidgetItem *apToplevelItem[2] = { YourForums, SubscribedForums };
|
||||
int nToplevelItem;
|
||||
QTreeWidgetItem *items[2] = { yourForums, subscribedForums };
|
||||
|
||||
for (nToplevelItem = 0; nToplevelItem < 2; nToplevelItem++) {
|
||||
QTreeWidgetItem *pToplevelItem = apToplevelItem[nToplevelItem];
|
||||
for (int item = 0; item < 2; item++) {
|
||||
int child;
|
||||
int childCount = items[item]->childCount();
|
||||
for (child = 0; child < childCount; child++) {
|
||||
QTreeWidgetItem *childItem = items[item]->child(child);
|
||||
std::string childId = ui.forumTreeWidget->itemId(childItem).toStdString();
|
||||
if (childId.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
int nItem;
|
||||
int nItemCount = pToplevelItem->childCount();
|
||||
|
||||
for (nItem = 0; nItem < nItemCount; nItem++) {
|
||||
QTreeWidgetItem *pItem = pToplevelItem->child(nItem);
|
||||
std::string fId = pItem->data(COLUMN_FORUM_DATA, ROLE_FORUM_ID).toString().toStdString();
|
||||
if (forumId.empty() || fId == forumId) {
|
||||
/* calculating the new messages */
|
||||
if (forumId.empty() || childId == forumId) {
|
||||
/* calculate unread messages */
|
||||
unsigned int newMessageCount = 0;
|
||||
unsigned int unreadMessageCount = 0;
|
||||
rsForums->getMessageCount(fId, newMessageCount, unreadMessageCount);
|
||||
rsForums->getMessageCount(childId, newMessageCount, unreadMessageCount);
|
||||
|
||||
QString sTitle = pItem->data(COLUMN_FORUM_DATA, ROLE_FORUM_TITLE).toString();
|
||||
QFont qf = pItem->font(COLUMN_FORUM_TITLE);
|
||||
if (unreadMessageCount) {
|
||||
sTitle += " (" + QString::number(unreadMessageCount) + ")";
|
||||
qf.setBold(true);
|
||||
} else {
|
||||
qf.setBold(false);
|
||||
}
|
||||
|
||||
pItem->setText(COLUMN_FORUM_TITLE, sTitle);
|
||||
pItem->setFont(COLUMN_FORUM_TITLE, qf);
|
||||
ui.forumTreeWidget->setUnreadCount(childItem, unreadMessageCount);
|
||||
|
||||
if (forumId.empty() == false) {
|
||||
/* calculate only this forum */
|
||||
/* Calculate only this forum */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,6 +26,8 @@
|
|||
#include "RsAutoUpdatePage.h"
|
||||
#include "ui_ForumsDialog.h"
|
||||
|
||||
class ForumInfo;
|
||||
|
||||
class ForumsDialog : public RsAutoUpdatePage
|
||||
{
|
||||
Q_OBJECT
|
||||
|
|
@ -44,7 +46,7 @@ private slots:
|
|||
|
||||
void newforum();
|
||||
|
||||
void changedForum( QTreeWidgetItem *curr, QTreeWidgetItem *prev );
|
||||
void changedForum(const QString &id);
|
||||
void changedThread();
|
||||
void clickedThread (QTreeWidgetItem *item, int column);
|
||||
|
||||
|
|
@ -86,9 +88,9 @@ private:
|
|||
void insertThreads();
|
||||
void insertPost();
|
||||
void updateMessageSummaryList(std::string forumId);
|
||||
void forumInfoToGroupItemInfo(const ForumInfo &forumInfo, GroupItemInfo &groupItemInfo);
|
||||
|
||||
void forumSubscribe(bool subscribe);
|
||||
void FillForums(QTreeWidgetItem *Forum, QList<QTreeWidgetItem *> &ChildList);
|
||||
void FillThreads(QList<QTreeWidgetItem *> &ThreadList, bool bExpandNewMessages, std::list<QTreeWidgetItem*> &itemToExpand);
|
||||
void FillChildren(QTreeWidgetItem *Parent, QTreeWidgetItem *NewParent, bool bExpandNewMessages, std::list<QTreeWidgetItem*> &itemToExpand);
|
||||
|
||||
|
|
@ -106,10 +108,10 @@ private:
|
|||
|
||||
bool m_bProcessSettings;
|
||||
|
||||
QTreeWidgetItem *YourForums;
|
||||
QTreeWidgetItem *SubscribedForums;
|
||||
QTreeWidgetItem *PopularForums;
|
||||
QTreeWidgetItem *OtherForums;
|
||||
QTreeWidgetItem *yourForums;
|
||||
QTreeWidgetItem *subscribedForums;
|
||||
QTreeWidgetItem *popularForums;
|
||||
QTreeWidgetItem *otherForums;
|
||||
|
||||
std::string mCurrForumId;
|
||||
std::string mCurrThreadId;
|
||||
|
|
@ -117,7 +119,6 @@ private:
|
|||
bool m_bIsForumAdmin;
|
||||
|
||||
QFont m_ForumNameFont;
|
||||
QFont m_ItemFont;
|
||||
int m_LastViewType;
|
||||
std::string m_LastForumID;
|
||||
|
||||
|
|
|
|||
|
|
@ -709,28 +709,13 @@ p, li { white-space: pre-wrap; }
|
|||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QTreeWidget" name="forumTreeWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="GroupTreeWidget" name="forumTreeWidget" native="true">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
|
|
@ -742,42 +727,12 @@ p, li { white-space: pre-wrap; }
|
|||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<property name="iconSize">
|
||||
<property name="iconSize" stdset="0">
|
||||
<size>
|
||||
<width>19</width>
|
||||
<height>19</height>
|
||||
<width>-1</width>
|
||||
<height>-1</height>
|
||||
</size>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>RetroShare Forums</string>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
|
|
@ -1282,6 +1237,14 @@ border-image: url(:/images/closepressed.png)
|
|||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>GroupTreeWidget</class>
|
||||
<extends>QWidget</extends>
|
||||
<header>gui/common/GroupTreeWidget.h</header>
|
||||
<container>1</container>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources>
|
||||
<include location="images.qrc"/>
|
||||
</resources>
|
||||
|
|
|
|||
356
retroshare-gui/src/gui/common/GroupTreeWidget.cpp
Normal file
356
retroshare-gui/src/gui/common/GroupTreeWidget.cpp
Normal file
|
|
@ -0,0 +1,356 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2010, RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#include "GroupTreeWidget.h"
|
||||
#include "ui_GroupTreeWidget.h"
|
||||
|
||||
#include "RSItemDelegate.h"
|
||||
#include "PopularityDefs.h"
|
||||
|
||||
#define COLUMN_NAME 0
|
||||
#define COLUMN_POPULARITY 1
|
||||
#define COLUMN_COUNT 2
|
||||
#define COLUMN_DATA COLUMN_NAME
|
||||
|
||||
#define ROLE_ID Qt::UserRole
|
||||
#define ROLE_NAME Qt::UserRole + 1
|
||||
#define ROLE_DESCRIPTION Qt::UserRole + 2
|
||||
#define ROLE_LASTPOST Qt::UserRole + 3
|
||||
#define ROLE_SEARCH_SCORE Qt::UserRole + 4
|
||||
|
||||
#define COMBO_NAME_INDEX 0
|
||||
#define COMBO_DESC_INDEX 1
|
||||
|
||||
GroupTreeWidget::GroupTreeWidget(QWidget *parent) :
|
||||
QWidget(parent), ui(new Ui::GroupTreeWidget)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
/* Connect signals */
|
||||
connect(ui->clearFilter, SIGNAL(clicked()), this, SLOT(clearFilter()));
|
||||
connect(ui->filterText, SIGNAL(textChanged(const QString &)), this, SLOT(filterChanged()));
|
||||
connect(ui->filterCombo, SIGNAL(currentIndexChanged(int)), this, SLOT(filterChanged()));
|
||||
|
||||
connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(customContextMenuRequested(QPoint)));
|
||||
connect(ui->treeWidget, SIGNAL(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)), this, SLOT(currentItemChanged(QTreeWidgetItem*, QTreeWidgetItem*)));
|
||||
|
||||
/* Add own item delegate */
|
||||
RSItemDelegate *itemDelegate = new RSItemDelegate(this);
|
||||
itemDelegate->removeFocusRect(COLUMN_POPULARITY);
|
||||
itemDelegate->setSpacing(QSize(0, 2));
|
||||
ui->treeWidget->setItemDelegate(itemDelegate);
|
||||
|
||||
/* Initialize tree widget */
|
||||
ui->treeWidget->setColumnCount(COLUMN_COUNT);
|
||||
|
||||
/* Set header resize modes and initial section sizes */
|
||||
QHeaderView *header = ui->treeWidget->header ();
|
||||
header->setResizeMode(COLUMN_NAME, QHeaderView::Stretch);
|
||||
header->resizeSection(COLUMN_NAME, 170);
|
||||
header->setResizeMode(COLUMN_POPULARITY, QHeaderView::Fixed);
|
||||
header->resizeSection(COLUMN_POPULARITY, 25);
|
||||
|
||||
/* Initialize filter */
|
||||
ui->clearFilter->hide();
|
||||
}
|
||||
|
||||
GroupTreeWidget::~GroupTreeWidget()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void GroupTreeWidget::changeEvent(QEvent *e)
|
||||
{
|
||||
QWidget::changeEvent(e);
|
||||
switch (e->type()) {
|
||||
case QEvent::LanguageChange:
|
||||
ui->retranslateUi(this);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void GroupTreeWidget::customContextMenuRequested(const QPoint &pos)
|
||||
{
|
||||
emit treeCustomContextMenuRequested(pos);
|
||||
}
|
||||
|
||||
void GroupTreeWidget::currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous)
|
||||
{
|
||||
QString id;
|
||||
|
||||
if (current) {
|
||||
id = current->data(COLUMN_DATA, ROLE_ID).toString();
|
||||
}
|
||||
|
||||
emit treeCurrentItemChanged(id);
|
||||
}
|
||||
|
||||
QTreeWidgetItem *GroupTreeWidget::addCategoryItem(const QString &name, const QIcon &icon, bool expand)
|
||||
{
|
||||
QFont font = QFont("ARIAL", 10);
|
||||
font.setBold(true);
|
||||
|
||||
QTreeWidgetItem *item = new QTreeWidgetItem();
|
||||
item->setText(COLUMN_NAME, name);
|
||||
item->setData(COLUMN_DATA, ROLE_NAME, name);
|
||||
item->setFont(COLUMN_NAME, font);
|
||||
item->setIcon(COLUMN_NAME, icon);
|
||||
item->setSizeHint(COLUMN_NAME, QSize(18, 18));
|
||||
item->setForeground(COLUMN_NAME, QBrush(QColor(79, 79, 79)));
|
||||
|
||||
ui->treeWidget->addTopLevelItem(item);
|
||||
|
||||
item->setExpanded(expand);
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
QString GroupTreeWidget::itemId(QTreeWidgetItem *item)
|
||||
{
|
||||
if (item == NULL) {
|
||||
return "";
|
||||
}
|
||||
|
||||
return item->data(COLUMN_DATA, ROLE_ID).toString();
|
||||
}
|
||||
|
||||
void GroupTreeWidget::fillGroupItems(QTreeWidgetItem *categoryItem, const QList<GroupItemInfo> &itemList)
|
||||
{
|
||||
if (categoryItem == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Iterate all items */
|
||||
QList<GroupItemInfo>::const_iterator it;
|
||||
for (it = itemList.begin(); it != itemList.end(); it++) {
|
||||
const GroupItemInfo &itemInfo = *it;
|
||||
|
||||
QTreeWidgetItem *item = NULL;
|
||||
|
||||
/* Search exisiting item */
|
||||
int childCount = categoryItem->childCount();
|
||||
for (int child = 0; child < childCount; child++) {
|
||||
QTreeWidgetItem *childItem = categoryItem->child(child);
|
||||
if (childItem->data(COLUMN_DATA, ROLE_ID).toString() == itemInfo.id) {
|
||||
/* Found child */
|
||||
item = childItem;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (item == NULL) {
|
||||
item = new GroupTreeWidgetItem();
|
||||
item->setData(COLUMN_DATA, ROLE_ID, itemInfo.id);
|
||||
categoryItem->addChild(item);
|
||||
}
|
||||
|
||||
item->setText(COLUMN_NAME, itemInfo.name);
|
||||
item->setData(COLUMN_DATA, ROLE_NAME, itemInfo.name);
|
||||
item->setData(COLUMN_DATA, ROLE_DESCRIPTION, itemInfo.description);
|
||||
|
||||
/* Set last post */
|
||||
item->setData(COLUMN_DATA, ROLE_LASTPOST, itemInfo.lastpost);
|
||||
|
||||
/* Set icon */
|
||||
item->setIcon(COLUMN_NAME, itemInfo.icon);
|
||||
|
||||
/* Set popularity */
|
||||
QString tooltip = PopularityDefs::tooltip(itemInfo.popularity);
|
||||
item->setIcon(COLUMN_POPULARITY, PopularityDefs::icon(itemInfo.popularity));
|
||||
|
||||
/* Set tooltip */
|
||||
if (itemInfo.privatekey) {
|
||||
tooltip += "\n" + tr("Private Key Available");
|
||||
}
|
||||
item->setToolTip(COLUMN_NAME, tooltip);
|
||||
item->setToolTip(COLUMN_POPULARITY, tooltip);
|
||||
|
||||
/* Set color */
|
||||
QBrush brush;
|
||||
if (itemInfo.privatekey) {
|
||||
brush = QBrush(Qt::blue);
|
||||
}
|
||||
item->setForeground(COLUMN_NAME, brush);
|
||||
|
||||
/* Calculate score */
|
||||
calculateScore(item);
|
||||
}
|
||||
|
||||
/* Remove all items not in list */
|
||||
int child = 0;
|
||||
int childCount = categoryItem->childCount();
|
||||
while (child < childCount) {
|
||||
QString id = categoryItem->child(child)->data(COLUMN_DATA, ROLE_ID).toString();
|
||||
|
||||
for (it = itemList.begin(); it != itemList.end(); it++) {
|
||||
if (it->id == id) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (it == itemList.end()) {
|
||||
delete(categoryItem->takeChild(child));
|
||||
childCount = categoryItem->childCount();
|
||||
} else {
|
||||
child++;
|
||||
}
|
||||
}
|
||||
|
||||
categoryItem->sortChildren(COLUMN_NAME, Qt::DescendingOrder);
|
||||
}
|
||||
|
||||
void GroupTreeWidget::setUnreadCount(QTreeWidgetItem *item, int unreadCount)
|
||||
{
|
||||
if (item == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
QString name = item->data(COLUMN_DATA, ROLE_NAME).toString();
|
||||
QFont font = item->font(COLUMN_NAME);
|
||||
|
||||
if (unreadCount) {
|
||||
name += QString(" (%1)").arg(unreadCount);
|
||||
font.setBold(true);
|
||||
} else {
|
||||
font.setBold(false);
|
||||
}
|
||||
|
||||
item->setText(COLUMN_NAME, name);
|
||||
item->setFont(COLUMN_NAME, font);
|
||||
|
||||
}
|
||||
|
||||
void GroupTreeWidget::calculateScore(QTreeWidgetItem *item)
|
||||
{
|
||||
if (item) {
|
||||
/* Calculate one item */
|
||||
QString filterText = ui->filterText->text();
|
||||
int score;
|
||||
if (filterText.isEmpty()) {
|
||||
score = 0;
|
||||
item->setHidden(false);
|
||||
} else {
|
||||
QString scoreString;
|
||||
|
||||
switch (ui->filterCombo->currentIndex()) {
|
||||
case COMBO_NAME_INDEX:
|
||||
scoreString = item->data(COLUMN_DATA, ROLE_NAME).toString();
|
||||
break;
|
||||
case COMBO_DESC_INDEX:
|
||||
scoreString = item->data(COLUMN_DATA, ROLE_DESCRIPTION).toString();
|
||||
break;
|
||||
}
|
||||
|
||||
score = scoreString.count(filterText, Qt::CaseInsensitive);
|
||||
|
||||
if (score) {
|
||||
item->setHidden(false);
|
||||
} else {
|
||||
item->setHidden(true);
|
||||
}
|
||||
}
|
||||
|
||||
item->setData(COLUMN_DATA, ROLE_SEARCH_SCORE, score);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find out which has given word in it */
|
||||
QTreeWidgetItemIterator itemIterator(ui->treeWidget);
|
||||
QTreeWidgetItem *item;
|
||||
while ((item = *itemIterator) != NULL) {
|
||||
itemIterator++;
|
||||
|
||||
if (item->data(COLUMN_DATA, ROLE_ID).toString().isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
calculateScore(item);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupTreeWidget::filterChanged()
|
||||
{
|
||||
if (ui->filterText->text().isEmpty()) {
|
||||
clearFilter();
|
||||
return;
|
||||
}
|
||||
|
||||
ui->clearFilter->setEnabled(true);
|
||||
ui->clearFilter->show();
|
||||
|
||||
/* Recalculate score */
|
||||
calculateScore(NULL);
|
||||
|
||||
int count = ui->treeWidget->topLevelItemCount();
|
||||
for (int child = 0; child < count; child++) {
|
||||
ui->treeWidget->topLevelItem(child)->sortChildren(COLUMN_NAME, Qt::DescendingOrder);
|
||||
}
|
||||
}
|
||||
|
||||
void GroupTreeWidget::clearFilter()
|
||||
{
|
||||
ui->filterText->clear();
|
||||
ui->clearFilter->hide();
|
||||
ui->filterText->setFocus();
|
||||
|
||||
/* Recalculate score */
|
||||
calculateScore(NULL);
|
||||
|
||||
int count = ui->treeWidget->topLevelItemCount();
|
||||
for (int child = 0; child < count; child++) {
|
||||
ui->treeWidget->topLevelItem(child)->sortChildren(COLUMN_NAME, Qt::DescendingOrder);
|
||||
}
|
||||
}
|
||||
|
||||
GroupTreeWidgetItem::GroupTreeWidgetItem() : QTreeWidgetItem()
|
||||
{
|
||||
}
|
||||
|
||||
bool GroupTreeWidgetItem::operator<(const QTreeWidgetItem& other) const
|
||||
{
|
||||
QDateTime otherChanTs = other.data(COLUMN_DATA, ROLE_LASTPOST).toDateTime();
|
||||
QDateTime thisChanTs = this->data(COLUMN_DATA, ROLE_LASTPOST).toDateTime();
|
||||
|
||||
uint32_t otherCount = other.data(COLUMN_DATA, ROLE_SEARCH_SCORE).toUInt();
|
||||
uint32_t thisCount = this->data(COLUMN_DATA, ROLE_SEARCH_SCORE).toUInt();
|
||||
|
||||
/* If counts are equal then determine by who has the most recent post */
|
||||
if (otherCount == thisCount){
|
||||
if (thisChanTs < otherChanTs) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/* Choose the item where the string occurs the most */
|
||||
if (thisCount < otherCount) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (thisChanTs < otherChanTs) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Compare name */
|
||||
return text(COLUMN_NAME) < other.text(COLUMN_NAME);
|
||||
}
|
||||
102
retroshare-gui/src/gui/common/GroupTreeWidget.h
Normal file
102
retroshare-gui/src/gui/common/GroupTreeWidget.h
Normal file
|
|
@ -0,0 +1,102 @@
|
|||
/****************************************************************
|
||||
* This file is distributed under the following license:
|
||||
*
|
||||
* Copyright (c) 2010, RetroShare Team
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||
* Boston, MA 02110-1301, USA.
|
||||
****************************************************************/
|
||||
|
||||
#ifndef GROUPTREEWIDGET_H
|
||||
#define GROUPTREEWIDGET_H
|
||||
|
||||
#include <QWidget>
|
||||
#include <QIcon>
|
||||
#include <QTreeWidgetItem>
|
||||
#include <QDateTime>
|
||||
|
||||
namespace Ui {
|
||||
class GroupTreeWidget;
|
||||
}
|
||||
|
||||
class GroupItemInfo
|
||||
{
|
||||
public:
|
||||
GroupItemInfo()
|
||||
{
|
||||
popularity = 0;
|
||||
privatekey = false;
|
||||
}
|
||||
|
||||
public:
|
||||
QString id;
|
||||
QString name;
|
||||
QString description;
|
||||
int popularity;
|
||||
QDateTime lastpost;
|
||||
QIcon icon;
|
||||
bool privatekey;
|
||||
};
|
||||
|
||||
class GroupTreeWidget : public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GroupTreeWidget(QWidget *parent = 0);
|
||||
~GroupTreeWidget();
|
||||
|
||||
// Add a new category item
|
||||
QTreeWidgetItem *addCategoryItem(const QString &name, const QIcon &icon, bool expand);
|
||||
// Get id of item
|
||||
QString itemId(QTreeWidgetItem *item);
|
||||
// Fill items of a group
|
||||
void fillGroupItems(QTreeWidgetItem *categoryItem, const QList<GroupItemInfo> &itemList);
|
||||
// Set the unread count of an item
|
||||
void setUnreadCount(QTreeWidgetItem *item, int unreadCount);
|
||||
|
||||
signals:
|
||||
void treeCustomContextMenuRequested(const QPoint &pos);
|
||||
void treeCurrentItemChanged(const QString &id);
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
|
||||
private slots:
|
||||
void customContextMenuRequested(const QPoint &pos);
|
||||
void currentItemChanged(QTreeWidgetItem *current, QTreeWidgetItem *previous);
|
||||
void filterChanged();
|
||||
void clearFilter();
|
||||
|
||||
private:
|
||||
void calculateScore(QTreeWidgetItem *item);
|
||||
|
||||
private:
|
||||
Ui::GroupTreeWidget *ui;
|
||||
};
|
||||
|
||||
class GroupTreeWidgetItem : public QTreeWidgetItem
|
||||
{
|
||||
public:
|
||||
GroupTreeWidgetItem();
|
||||
|
||||
/**
|
||||
* reimplementing comparison operator so GroupTreeWidgetItem can be ordered in terms
|
||||
* of occurences of property filterText in its data columns
|
||||
*/
|
||||
bool operator<(const QTreeWidgetItem &other) const;
|
||||
};
|
||||
|
||||
#endif // GROUPTREEWIDGET_H
|
||||
240
retroshare-gui/src/gui/common/GroupTreeWidget.ui
Normal file
240
retroshare-gui/src/gui/common/GroupTreeWidget.ui
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>GroupTreeWidget</class>
|
||||
<widget class="QWidget" name="GroupTreeWidget">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>316</width>
|
||||
<height>257</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QComboBox QAbstractItemView {
|
||||
background-color:white;
|
||||
}
|
||||
|
||||
QComboBox::down-arrow {
|
||||
image: url(:/images/combobox_arrow.png);
|
||||
}
|
||||
|
||||
QComboBox:drop-down
|
||||
{
|
||||
subcontrol-origin: padding;
|
||||
subcontrol-position: top right;
|
||||
border-left-style: none;
|
||||
border-top-right-radius: 1px;
|
||||
border-bottom-right-radius: 1px;
|
||||
}
|
||||
|
||||
QComboBox {
|
||||
border-image: url(:/images/btn_26.png) 4;
|
||||
border-width: 4;
|
||||
padding: 0px 6px;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
QComboBox:hover {
|
||||
border-image: url(:/images/btn_26_hover.png) 4;
|
||||
}
|
||||
|
||||
QComboBox::disabled {
|
||||
color:gray;
|
||||
}</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>2</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QFrame" name="searchlineframe">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16777215</width>
|
||||
<height>22</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QFrame#searchlineframe{
|
||||
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
|
||||
stop:0 #FEFEFE, stop:1 #E8E8E8);
|
||||
|
||||
border: 1px solid #CCCCCC;}
|
||||
</string>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
<layout class="QGridLayout" name="gridLayout_6">
|
||||
<property name="horizontalSpacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="margin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLineEdit" name="filterText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
|
||||
<horstretch>3</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>1677777</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Enter a Keyword here</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLineEdit#searchLine{
|
||||
border: none;}
|
||||
</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="3">
|
||||
<widget class="QComboBox" name="filterCombo">
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Title</string>
|
||||
</property>
|
||||
</item>
|
||||
<item>
|
||||
<property name="text">
|
||||
<string>Description</string>
|
||||
</property>
|
||||
</item>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QPushButton" name="clearFilter">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>16</width>
|
||||
<height>16</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Reset</string>
|
||||
</property>
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QPushButton
|
||||
{
|
||||
border-image: url(:/images/closenormal.png)
|
||||
}
|
||||
|
||||
QPushButton:hover
|
||||
{
|
||||
border-image: url(:/images/closehover.png)
|
||||
}
|
||||
|
||||
QPushButton:pressed {
|
||||
border-image: url(:/images/closepressed.png)
|
||||
}</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTreeWidget" name="treeWidget">
|
||||
<property name="enabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="sizeIncrement">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="baseSize">
|
||||
<size>
|
||||
<width>300</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<pointsize>9</pointsize>
|
||||
</font>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="editTriggers">
|
||||
<set>QAbstractItemView::NoEditTriggers</set>
|
||||
</property>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
||||
Loading…
Add table
Add a link
Reference in a new issue