Clean up the invalid values that do not exist for m_Collapsed.
Clean up the invalid Box names in BoxDisplayOrder.
This commit is contained in:
parent
4420ba4448
commit
038fb22cff
|
@ -1603,6 +1603,8 @@ void CSandMan::OnStatusChanged()
|
|||
|
||||
auto AllBoxes = theAPI->GetAllBoxes();
|
||||
|
||||
m_pBoxView->ClearUserUIConfig(AllBoxes);
|
||||
|
||||
foreach(const QString & Key, theConf->ListKeys("SizeCache")) {
|
||||
if (!AllBoxes.contains(Key.toLower()) || !theConf->GetBool("Options/WatchBoxSize", false))
|
||||
theConf->DelValue("SizeCache/" + Key);
|
||||
|
|
|
@ -1241,6 +1241,7 @@ void CSbieView::OnSandBoxAction(QAction* Action, const QList<CSandBoxPtr>& SandB
|
|||
|
||||
if (!Status.IsError()) {
|
||||
theConf->DelValue("SizeCache/" + Name);
|
||||
m_Collapsed.remove(Name);
|
||||
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I)
|
||||
{
|
||||
if (I.value().removeOne(Name))
|
||||
|
@ -1720,6 +1721,32 @@ void CSbieView::ReloadUserConfig()
|
|||
if (Collapsed.isEmpty())
|
||||
Collapsed = theAPI->GetUserSettings()->GetText("BoxCollapsedView");
|
||||
m_Collapsed = SplitStr(Collapsed, ",").toSet();
|
||||
|
||||
ClearUserUIConfig();
|
||||
}
|
||||
|
||||
void CSbieView::ClearUserUIConfig(const QMap<QString, CSandBoxPtr> AllBoxes) {
|
||||
if (!AllBoxes.isEmpty())
|
||||
{
|
||||
for (auto I = m_Groups.begin(); I != m_Groups.end(); ++I) {
|
||||
QStringList Temp = I.value();
|
||||
foreach(QString Name, I.value()) {
|
||||
if (AllBoxes.contains(Name.toLower()) || m_Groups.keys().contains(Name))
|
||||
continue;
|
||||
Temp.removeOne(Name);
|
||||
}
|
||||
I.value() = Temp;
|
||||
}
|
||||
}
|
||||
|
||||
QSet<QString> Temp = m_Collapsed;
|
||||
foreach(QString Name, m_Collapsed)
|
||||
{
|
||||
if (!count_if(m_Groups.begin(), m_Groups.end(),
|
||||
[Name](const QStringList& item)->int { return item.contains(Name); }))
|
||||
Temp.remove(Name);
|
||||
}
|
||||
m_Collapsed = Temp;
|
||||
}
|
||||
|
||||
void CSbieView::SaveUserConfig()
|
||||
|
|
|
@ -40,6 +40,7 @@ public slots:
|
|||
void Clear();
|
||||
void Refresh();
|
||||
void ReloadUserConfig();
|
||||
void ClearUserUIConfig(QMap<QString, CSandBoxPtr> AllBoxes = QMap<QString, CSandBoxPtr>());
|
||||
void SaveUserConfig();
|
||||
|
||||
private slots:
|
||||
|
@ -175,4 +176,4 @@ private:
|
|||
|
||||
QList<CSandBoxPtr> m_CurSandBoxes;
|
||||
QList<CBoxedProcessPtr> m_CurProcesses;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue