enabled processSettings

This commit is contained in:
csoler 2025-03-01 20:57:32 +01:00
parent e369ba3504
commit 06d9ea2398
3 changed files with 54 additions and 53 deletions

View File

@ -1297,41 +1297,42 @@ static QString getHumanReadableDuration(uint32_t seconds)
void IdDialog::processSettings(bool load)
{
#warning TODO
// Settings->beginGroup("IdDialog");
//
// // state of peer tree
// ui->idTreeWidget->processSettings(load);
//
// if (load) {
// // load settings
//
// // filterColumn
// ui->filterLineEdit->setCurrentFilter(Settings->value("filterColumn", RSID_COL_NICKNAME).toInt());
//
// // state of splitter
// ui->mainSplitter->restoreState(Settings->value("splitter").toByteArray());
//
// //Restore expanding
// allItem->setExpanded(Settings->value("ExpandAll", QVariant(true)).toBool());
// ownItem->setExpanded(Settings->value("ExpandOwn", QVariant(true)).toBool());
// contactsItem->setExpanded(Settings->value("ExpandContacts", QVariant(true)).toBool());
// } else {
// // save settings
//
// // filterColumn
// Settings->setValue("filterColumn", ui->filterLineEdit->currentFilter());
//
// // state of splitter
// Settings->setValue("splitter", ui->mainSplitter->saveState());
//
// //save expanding
// Settings->setValue("ExpandAll", allItem->isExpanded());
// Settings->setValue("ExpandContacts", contactsItem->isExpanded());
// Settings->setValue("ExpandOwn", ownItem->isExpanded());
// }
//
// Settings->endGroup();
Settings->beginGroup("IdDialog");
// state of peer tree
// ui->idTreeWidget->processSettings(load);
if (load) {
// load settings
// filterColumn
ui->filterLineEdit->setCurrentFilter(Settings->value("filterColumn", RsIdentityListModel::COLUMN_THREAD_NAME).toInt());
// state of splitter
ui->mainSplitter->restoreState(Settings->value("splitter").toByteArray());
//Restore expanding
ui->idTreeWidget->setExpanded(mIdListModel->getIndexOfCategory(RsIdentityListModel::CATEGORY_ALL),Settings->value("ExpandAll", QVariant(true)).toBool());
ui->idTreeWidget->setExpanded(mIdListModel->getIndexOfCategory(RsIdentityListModel::CATEGORY_OWN),Settings->value("ExpandOwn", QVariant(true)).toBool());
ui->idTreeWidget->setExpanded(mIdListModel->getIndexOfCategory(RsIdentityListModel::CATEGORY_CTS),Settings->value("ExpandContacts", QVariant(true)).toBool());
}
else
{
// save settings
// filterColumn
Settings->setValue("filterColumn", ui->filterLineEdit->currentFilter());
// state of splitter
Settings->setValue("splitter", ui->mainSplitter->saveState());
//save expanding
Settings->setValue("ExpandAll", ui->idTreeWidget->isExpanded(mIdListModel->getIndexOfCategory(RsIdentityListModel::CATEGORY_ALL)));
Settings->setValue("ExpandContacts", ui->idTreeWidget->isExpanded(mIdListModel->getIndexOfCategory(RsIdentityListModel::CATEGORY_OWN)));
Settings->setValue("ExpandOwn", ui->idTreeWidget->isExpanded(mIdListModel->getIndexOfCategory(RsIdentityListModel::CATEGORY_CTS)));
}
Settings->endGroup();
}
void IdDialog::filterChanged(const QString& /*text*/)

View File

@ -527,6 +527,18 @@ QModelIndex RsIdentityListModel::getIndexOfIdentity(const RsGxsId& id) const
}
return QModelIndex();
}
QModelIndex RsIdentityListModel::getIndexOfCategory(Category id) const
{
EntryIndex e;
e.category_index = id;
e.type = ENTRY_TYPE_CATEGORY;
quintptr idx;
convertIndexToInternalId(e,idx);
return createIndex((int)id,0,idx);
}
QVariant RsIdentityListModel::foregroundRole(const EntryIndex& e, int /*col*/) const
{
auto it = getIdentityInfo(e);
@ -900,18 +912,5 @@ void RsIdentityListModel::expandItem(const QModelIndex& index)
emit dataChanged(createIndex(0,0,(void*)NULL), createIndex(mCategories.size()-1,columnCount()-1,(void*)NULL));
}
bool RsIdentityListModel::isCategoryExpanded(const EntryIndex& e) const
{
return true;
#warning TODO
// if(e.type != ENTRY_TYPE_CATEGORY)
// return false;
//
// EntryIndex entry;
//
// if(!convertInternalIdToIndex<sizeof(uintptr_t)>(e.internalId(),entry))
// return false;
//
// return mExpandedCategories[entry.category_index];
}

View File

@ -69,9 +69,10 @@ public:
ENTRY_TYPE_INVALID = 0x03
};
static const int CATEGORY_OWN = 0x00;
static const int CATEGORY_CTS = 0x01;
static const int CATEGORY_ALL = 0x02;
enum Category{ CATEGORY_OWN = 0x00,
CATEGORY_CTS = 0x01,
CATEGORY_ALL = 0x02
};
struct HierarchicalCategoryInformation
{
@ -107,6 +108,7 @@ public:
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
QModelIndex getIndexOfIdentity(const RsGxsId& id) const;
QModelIndex getIndexOfCategory(Category id) const;
void updateIdentityList();
@ -146,7 +148,6 @@ private:
const HierarchicalCategoryInformation *getCategoryInfo (const EntryIndex&) const;
const HierarchicalIdentityInformation *getIdentityInfo(const EntryIndex&) const;
bool isCategoryExpanded(const EntryIndex& e) const;
void checkIdentity(HierarchicalIdentityInformation& node);
QVariant sizeHintRole (const EntryIndex& e, int col) const;