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();
}
void RsFriendListModel::setDisplayStatusString(bool b)
{
mDisplayStatusString = b;
postMods();
}
void RsFriendListModel::setDisplayGroups(bool 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);
if(!css.empty())
if(!css.empty() && mDisplayStatusString)
return QVariant(QString::fromUtf8(node->node_info.location.c_str())+"\n"+QString::fromUtf8(css.c_str()));
else
return QVariant(QString::fromUtf8(node->node_info.location.c_str()));

View File

@ -119,6 +119,9 @@ public:
void setDisplayGroups(bool b);
bool getDisplayGroups() const { return mDisplayGroups; }
void setDisplayStatusString(bool b);
bool getDisplayStatusString() const { return mDisplayStatusString; }
EntryType getType(const QModelIndex&) const;
bool getGroupData (const QModelIndex&,RsGroupInfo &) const;
@ -198,6 +201,7 @@ private:
FilterType mFilterType;
bool mDisplayGroups ;
bool mDisplayStatusString ;
// 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

View File

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