refactor: remove collapsed group logic

Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
Sefa Eyeoglu 2022-10-03 16:11:17 +02:00
parent 2bf8fa9cb4
commit 9050230b01
No known key found for this signature in database
GPG Key ID: C10411294912A422
2 changed files with 1 additions and 26 deletions

View File

@ -331,11 +331,6 @@ void InstanceList::deleteGroup(const QString& name)
}
}
bool InstanceList::isGroupCollapsed(const QString& group)
{
return m_collapsedGroups.contains(group);
}
bool InstanceList::trashInstance(const InstanceId& id)
{
auto inst = getInstanceById(id);
@ -685,7 +680,7 @@ void InstanceList::saveGroupList()
auto name = iter.key();
QJsonObject groupObj;
QJsonArray instanceArr;
groupObj.insert("hidden", QJsonValue(m_collapsedGroups.contains(name)));
groupObj.insert("hidden", false); // preserve compatiblity with older versions
for (auto item : list) {
instanceArr.append(QJsonValue(item));
}
@ -774,11 +769,6 @@ void InstanceList::loadGroupList()
// keep a list/set of groups for choosing
groupSet.insert(groupName);
auto hidden = groupObj.value("hidden").toBool(false);
if (hidden) {
m_collapsedGroups.insert(groupName);
}
// Iterate through the list of instances in the group.
QJsonArray instancesArray = groupObj.value("instances").toArray();
@ -810,17 +800,6 @@ void InstanceList::on_InstFolderChanged(const Setting& setting, QVariant value)
}
}
void InstanceList::on_GroupStateChanged(const QString& group, bool collapsed)
{
qDebug() << "Group" << group << (collapsed ? "collapsed" : "expanded");
if (collapsed) {
m_collapsedGroups.insert(group);
} else {
m_collapsedGroups.remove(group);
}
saveGroupList();
}
class InstanceStaging : public Task {
Q_OBJECT
const unsigned minBackoff = 1;

View File

@ -80,7 +80,6 @@ class InstanceList : public QAbstractTableModel {
InstancePtr getInstanceByManagedName(const QString& managed_name) const;
QModelIndex getInstanceIndexById(const QString& id) const;
QStringList getGroups();
bool isGroupCollapsed(const QString& groupName);
GroupId getInstanceGroup(const InstanceId& id) const;
void setInstanceGroup(const InstanceId& id, const GroupId& name);
@ -134,7 +133,6 @@ class InstanceList : public QAbstractTableModel {
public slots:
void on_InstFolderChanged(const Setting& setting, QVariant value);
void on_GroupStateChanged(const QString& group, bool collapsed);
private slots:
void propertiesChanged(BaseInstance* inst);
@ -162,8 +160,6 @@ class InstanceList : public QAbstractTableModel {
SettingsObjectPtr m_globalSettings;
QString m_instDir;
QFileSystemWatcher* m_watcher;
// FIXME: this is so inefficient that looking at it is almost painful.
QSet<QString> m_collapsedGroups;
QMap<InstanceId, GroupId> m_instanceGroupIndex;
QSet<InstanceId> instanceSet;
bool m_groupsLoaded = false;