refactor: remove collapsed group logic
Signed-off-by: Sefa Eyeoglu <contact@scrumplex.net>
This commit is contained in:
parent
2bf8fa9cb4
commit
9050230b01
@ -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)
|
bool InstanceList::trashInstance(const InstanceId& id)
|
||||||
{
|
{
|
||||||
auto inst = getInstanceById(id);
|
auto inst = getInstanceById(id);
|
||||||
@ -685,7 +680,7 @@ void InstanceList::saveGroupList()
|
|||||||
auto name = iter.key();
|
auto name = iter.key();
|
||||||
QJsonObject groupObj;
|
QJsonObject groupObj;
|
||||||
QJsonArray instanceArr;
|
QJsonArray instanceArr;
|
||||||
groupObj.insert("hidden", QJsonValue(m_collapsedGroups.contains(name)));
|
groupObj.insert("hidden", false); // preserve compatiblity with older versions
|
||||||
for (auto item : list) {
|
for (auto item : list) {
|
||||||
instanceArr.append(QJsonValue(item));
|
instanceArr.append(QJsonValue(item));
|
||||||
}
|
}
|
||||||
@ -774,11 +769,6 @@ void InstanceList::loadGroupList()
|
|||||||
// keep a list/set of groups for choosing
|
// keep a list/set of groups for choosing
|
||||||
groupSet.insert(groupName);
|
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.
|
// Iterate through the list of instances in the group.
|
||||||
QJsonArray instancesArray = groupObj.value("instances").toArray();
|
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 {
|
class InstanceStaging : public Task {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
const unsigned minBackoff = 1;
|
const unsigned minBackoff = 1;
|
||||||
|
@ -80,7 +80,6 @@ class InstanceList : public QAbstractTableModel {
|
|||||||
InstancePtr getInstanceByManagedName(const QString& managed_name) const;
|
InstancePtr getInstanceByManagedName(const QString& managed_name) const;
|
||||||
QModelIndex getInstanceIndexById(const QString& id) const;
|
QModelIndex getInstanceIndexById(const QString& id) const;
|
||||||
QStringList getGroups();
|
QStringList getGroups();
|
||||||
bool isGroupCollapsed(const QString& groupName);
|
|
||||||
|
|
||||||
GroupId getInstanceGroup(const InstanceId& id) const;
|
GroupId getInstanceGroup(const InstanceId& id) const;
|
||||||
void setInstanceGroup(const InstanceId& id, const GroupId& name);
|
void setInstanceGroup(const InstanceId& id, const GroupId& name);
|
||||||
@ -134,7 +133,6 @@ class InstanceList : public QAbstractTableModel {
|
|||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void on_InstFolderChanged(const Setting& setting, QVariant value);
|
void on_InstFolderChanged(const Setting& setting, QVariant value);
|
||||||
void on_GroupStateChanged(const QString& group, bool collapsed);
|
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void propertiesChanged(BaseInstance* inst);
|
void propertiesChanged(BaseInstance* inst);
|
||||||
@ -162,8 +160,6 @@ class InstanceList : public QAbstractTableModel {
|
|||||||
SettingsObjectPtr m_globalSettings;
|
SettingsObjectPtr m_globalSettings;
|
||||||
QString m_instDir;
|
QString m_instDir;
|
||||||
QFileSystemWatcher* m_watcher;
|
QFileSystemWatcher* m_watcher;
|
||||||
// FIXME: this is so inefficient that looking at it is almost painful.
|
|
||||||
QSet<QString> m_collapsedGroups;
|
|
||||||
QMap<InstanceId, GroupId> m_instanceGroupIndex;
|
QMap<InstanceId, GroupId> m_instanceGroupIndex;
|
||||||
QSet<InstanceId> instanceSet;
|
QSet<InstanceId> instanceSet;
|
||||||
bool m_groupsLoaded = false;
|
bool m_groupsLoaded = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user