proper on/off switch for status show

This commit is contained in:
csoler 2019-08-15 19:43:41 +02:00
parent 038a0ae4c7
commit 70680fae47
No known key found for this signature in database
GPG key ID: 7BCA522266C0804C
3 changed files with 15 additions and 6 deletions

View file

@ -56,6 +56,12 @@ RsFriendListModel::RsFriendListModel(QObject *parent)
mFilterStrings.clear(); mFilterStrings.clear();
} }
void RsFriendListModel::setDisplayStatusString(bool b)
{
mDisplayStatusString = b;
postMods();
}
void RsFriendListModel::setDisplayGroups(bool b) void RsFriendListModel::setDisplayGroups(bool b)
{ {
mDisplayGroups = b; mDisplayGroups = b;
@ -676,7 +682,7 @@ QVariant RsFriendListModel::displayRole(const EntryIndex& e, int col) const
{ {
std::string css = rsMsgs->getCustomStateString(node->node_info.id); std::string css = rsMsgs->getCustomStateString(node->node_info.id);
if(!css.empty()) if(!css.empty() && mDisplayStatusString)
return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"+QString::fromUtf8(css.c_str())); return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"+QString::fromUtf8(css.c_str()));
else else
return QVariant(QString::fromUtf8(node->node_info.location.c_str())); return QVariant(QString::fromUtf8(node->node_info.location.c_str()));

View file

@ -119,6 +119,9 @@ public:
void setDisplayGroups(bool b); void setDisplayGroups(bool b);
bool getDisplayGroups() const { return mDisplayGroups; } bool getDisplayGroups() const { return mDisplayGroups; }
void setDisplayStatusString(bool b);
bool getDisplayStatusString() const { return mDisplayStatusString; }
EntryType getType(const QModelIndex&) const; EntryType getType(const QModelIndex&) const;
bool getGroupData (const QModelIndex&,RsGroupInfo &) const; bool getGroupData (const QModelIndex&,RsGroupInfo &) const;
@ -198,6 +201,7 @@ private:
FilterType mFilterType; FilterType mFilterType;
bool mDisplayGroups ; bool mDisplayGroups ;
bool mDisplayStatusString ;
// The 3 vectors below store thehierarchical information for groups, profiles and locations, // The 3 vectors below store thehierarchical information for groups, profiles and locations,
// meaning which is the child/parent of which. The actual group/profile/node data are also stored in the // meaning which is the child/parent of which. The actual group/profile/node data are also stored in the

View file

@ -158,7 +158,6 @@ NewFriendList::NewFriendList(QWidget *parent) :
QWidget(parent), QWidget(parent),
ui(new Ui::NewFriendList()), ui(new Ui::NewFriendList()),
// mCompareRole(new RSTreeWidgetItemCompareRole), // mCompareRole(new RSTreeWidgetItemCompareRole),
mShowState(false),
groupsHasChanged(false) groupsHasChanged(false)
{ {
ui->setupUi(this); ui->setupUi(this);
@ -294,7 +293,7 @@ void NewFriendList::headerContextMenuRequested(QPoint p)
displayMenu.addAction(ui->actionShowGroups); displayMenu.addAction(ui->actionShowGroups);
ui->actionShowOfflineFriends->setChecked(mProxyModel->showOfflineNodes()); ui->actionShowOfflineFriends->setChecked(mProxyModel->showOfflineNodes());
ui->actionShowState->setChecked(mShowState); ui->actionShowState->setChecked(mModel->getDisplayStatusString());
ui->actionShowGroups->setChecked(mModel->getDisplayGroups()); ui->actionShowGroups->setChecked(mModel->getDisplayGroups());
QHeaderView *header = ui->peerTreeWidget->header(); QHeaderView *header = ui->peerTreeWidget->header();
@ -347,7 +346,7 @@ void NewFriendList::processSettings(bool load)
// states // states
setShowUnconnected(!Settings->value("hideUnconnected", mProxyModel->showOfflineNodes()).toBool()); setShowUnconnected(!Settings->value("hideUnconnected", mProxyModel->showOfflineNodes()).toBool());
setShowState(Settings->value("showState", mShowState).toBool()); setShowState(Settings->value("showState", mModel->getDisplayStatusString()).toBool());
setShowGroups(Settings->value("showGroups", mModel->getDisplayGroups()).toBool()); setShowGroups(Settings->value("showGroups", mModel->getDisplayGroups()).toBool());
setColumnVisible(RsFriendListModel::COLUMN_THREAD_IP,Settings->value("showIP", isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP)).toBool()); setColumnVisible(RsFriendListModel::COLUMN_THREAD_IP,Settings->value("showIP", isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP)).toBool());
@ -379,7 +378,7 @@ void NewFriendList::processSettings(bool load)
// states // states
Settings->setValue("hideUnconnected", !mProxyModel->showOfflineNodes()); Settings->setValue("hideUnconnected", !mProxyModel->showOfflineNodes());
Settings->setValue("showState", mShowState); Settings->setValue("showState", mModel->getDisplayStatusString());
Settings->setValue("showGroups", mModel->getDisplayGroups()); Settings->setValue("showGroups", mModel->getDisplayGroups());
Settings->setValue("showIP",isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP)); Settings->setValue("showIP",isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP));
@ -1467,7 +1466,7 @@ void NewFriendList::sortByColumn(int column, Qt::SortOrder sortOrder)
void NewFriendList::setShowState(bool show) void NewFriendList::setShowState(bool show)
{ {
mShowState = show; mModel->setDisplayStatusString(show);
} }
void NewFriendList::setShowGroups(bool show) void NewFriendList::setShowGroups(bool show)