Added optional display status icon from friendslist context menu

This commit is contained in:
defnax 2024-06-24 23:36:45 +02:00
parent 3461da7c3a
commit 56b6b0cb5a
5 changed files with 70 additions and 5 deletions

View file

@ -261,6 +261,7 @@ NewFriendList::NewFriendList(QWidget */*parent*/) : /* RsAutoUpdatePage(5000,par
connect(ui->actionShowOfflineFriends, SIGNAL(triggered(bool)), this, SLOT(setShowUnconnected(bool)));
connect(ui->actionShowState, SIGNAL(triggered(bool)), this, SLOT(setShowState(bool)) );
connect(ui->actionShowStateIcon, SIGNAL(triggered(bool)), this, SLOT(setShowStateIcon(bool)) );
connect(ui->actionShowGroups, SIGNAL(triggered(bool)), this, SLOT(setShowGroups(bool)) );
connect(ui->actionExportFriendlist, SIGNAL(triggered()) , this, SLOT(exportFriendlistClicked()));
connect(ui->actionImportFriendlist, SIGNAL(triggered()) , this, SLOT(importFriendlistClicked()));
@ -341,10 +342,12 @@ void NewFriendList::headerContextMenuRequested(QPoint /*p*/)
displayMenu.addAction(ui->actionShowOfflineFriends);
displayMenu.addAction(ui->actionShowState);
displayMenu.addAction(ui->actionShowStateIcon);
displayMenu.addAction(ui->actionShowGroups);
ui->actionShowOfflineFriends->setChecked(mProxyModel->showOfflineNodes());
ui->actionShowState->setChecked(mModel->getDisplayStatusString());
ui->actionShowStateIcon->setChecked(mModel->getDisplayStatusIcon());
ui->actionShowGroups->setChecked(mModel->getDisplayGroups());
QHeaderView *header = ui->peerTreeWidget->header();
@ -505,6 +508,8 @@ void NewFriendList::processSettings(bool load)
mModel->setDisplayStatusString(Settings->value("showState", mModel->getDisplayStatusString()).toBool());
mModel->setDisplayGroups(Settings->value("showGroups", mModel->getDisplayGroups()).toBool());
mModel->setDisplayStatusIcon(Settings->value("showStateIcon", mModel->getDisplayStatusIcon()).toBool());
setColumnVisible(RsFriendListModel::COLUMN_THREAD_IP,Settings->value("showIP", isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP)).toBool());
setColumnVisible(RsFriendListModel::COLUMN_THREAD_ID,Settings->value("showID", isColumnVisible(RsFriendListModel::COLUMN_THREAD_ID)).toBool());
@ -528,6 +533,8 @@ void NewFriendList::processSettings(bool load)
Settings->setValue("hideUnconnected", !mProxyModel->showOfflineNodes());
Settings->setValue("showState", mModel->getDisplayStatusString());
Settings->setValue("showGroups", mModel->getDisplayGroups());
Settings->setValue("showStateIcon", mModel->getDisplayStatusIcon());
Settings->setValue("showIP",isColumnVisible(RsFriendListModel::COLUMN_THREAD_IP));
Settings->setValue("showID",isColumnVisible(RsFriendListModel::COLUMN_THREAD_ID));
@ -1643,6 +1650,12 @@ void NewFriendList::setShowState(bool show)
processSettings(false);
}
void NewFriendList::setShowStateIcon(bool show)
{
applyWhileKeepingTree([show,this]() { mModel->setDisplayStatusIcon(show) ; });
processSettings(false);
}
void NewFriendList::setShowGroups(bool show)
{
applyWhileKeepingTree([show,this]() { mModel->setDisplayGroups(show) ; });