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

View file

@ -527,6 +527,18 @@ QModelIndex RsIdentityListModel::getIndexOfIdentity(const RsGxsId& id) const
} }
return QModelIndex(); 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 QVariant RsIdentityListModel::foregroundRole(const EntryIndex& e, int /*col*/) const
{ {
auto it = getIdentityInfo(e); 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)); 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 ENTRY_TYPE_INVALID = 0x03
}; };
static const int CATEGORY_OWN = 0x00; enum Category{ CATEGORY_OWN = 0x00,
static const int CATEGORY_CTS = 0x01; CATEGORY_CTS = 0x01,
static const int CATEGORY_ALL = 0x02; CATEGORY_ALL = 0x02
};
struct HierarchicalCategoryInformation struct HierarchicalCategoryInformation
{ {
@ -107,6 +108,7 @@ public:
QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;} QModelIndex root() const{ return createIndex(0,0,(void*)NULL) ;}
QModelIndex getIndexOfIdentity(const RsGxsId& id) const; QModelIndex getIndexOfIdentity(const RsGxsId& id) const;
QModelIndex getIndexOfCategory(Category id) const;
void updateIdentityList(); void updateIdentityList();
@ -146,7 +148,6 @@ private:
const HierarchicalCategoryInformation *getCategoryInfo (const EntryIndex&) const; const HierarchicalCategoryInformation *getCategoryInfo (const EntryIndex&) const;
const HierarchicalIdentityInformation *getIdentityInfo(const EntryIndex&) const; const HierarchicalIdentityInformation *getIdentityInfo(const EntryIndex&) const;
bool isCategoryExpanded(const EntryIndex& e) const;
void checkIdentity(HierarchicalIdentityInformation& node); void checkIdentity(HierarchicalIdentityInformation& node);
QVariant sizeHintRole (const EntryIndex& e, int col) const; QVariant sizeHintRole (const EntryIndex& e, int col) const;