GH-589 GH-842 GH-901 GH-1117 allow mass-enabling/disabling of mods
This commit is contained in:
parent
6ec2652b45
commit
b76d4573cd
@ -175,6 +175,21 @@ bool ModList::installMod(const QString &filename)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool ModList::enableMods(const QModelIndexList& indexes, bool enable)
|
||||||
|
{
|
||||||
|
if(indexes.isEmpty())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
for (auto i: indexes)
|
||||||
|
{
|
||||||
|
Mod &m = mods[i.row()];
|
||||||
|
m.enable(enable);
|
||||||
|
emit dataChanged(i, i);
|
||||||
|
}
|
||||||
|
emit changed();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool ModList::deleteMods(const QModelIndexList& indexes)
|
bool ModList::deleteMods(const QModelIndexList& indexes)
|
||||||
{
|
{
|
||||||
if(indexes.isEmpty())
|
if(indexes.isEmpty())
|
||||||
|
@ -86,6 +86,9 @@ public:
|
|||||||
/// Deletes all the selected mods
|
/// Deletes all the selected mods
|
||||||
virtual bool deleteMods(const QModelIndexList &indexes);
|
virtual bool deleteMods(const QModelIndexList &indexes);
|
||||||
|
|
||||||
|
/// Enable or disable listed mods
|
||||||
|
virtual bool enableMods(const QModelIndexList &indexes, bool enable = true);
|
||||||
|
|
||||||
void startWatching();
|
void startWatching();
|
||||||
void stopWatching();
|
void stopWatching();
|
||||||
|
|
||||||
|
@ -165,6 +165,18 @@ void ModFolderPage::on_addModBtn_clicked()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ModFolderPage::on_enableModBtn_clicked()
|
||||||
|
{
|
||||||
|
auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
|
||||||
|
m_mods->enableMods(selection.indexes(), true);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ModFolderPage::on_disableModBtn_clicked()
|
||||||
|
{
|
||||||
|
auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
|
||||||
|
m_mods->enableMods(selection.indexes(), false);
|
||||||
|
}
|
||||||
|
|
||||||
void ModFolderPage::on_rmModBtn_clicked()
|
void ModFolderPage::on_rmModBtn_clicked()
|
||||||
{
|
{
|
||||||
auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
|
auto selection = m_filterModel->mapSelectionToSource(ui->modTreeView->selectionModel()->selection());
|
||||||
|
@ -90,6 +90,8 @@ slots:
|
|||||||
void on_addModBtn_clicked();
|
void on_addModBtn_clicked();
|
||||||
void on_rmModBtn_clicked();
|
void on_rmModBtn_clicked();
|
||||||
void on_viewModBtn_clicked();
|
void on_viewModBtn_clicked();
|
||||||
|
void on_enableModBtn_clicked();
|
||||||
|
void on_disableModBtn_clicked();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CoreModFolderPage : public ModFolderPage
|
class CoreModFolderPage : public ModFolderPage
|
||||||
|
@ -55,6 +55,20 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="enableModBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Enable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="disableModBtn">
|
||||||
|
<property name="text">
|
||||||
|
<string>Disable</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer">
|
<spacer name="verticalSpacer">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
@ -143,10 +157,12 @@
|
|||||||
<tabstops>
|
<tabstops>
|
||||||
<tabstop>tabWidget</tabstop>
|
<tabstop>tabWidget</tabstop>
|
||||||
<tabstop>modTreeView</tabstop>
|
<tabstop>modTreeView</tabstop>
|
||||||
|
<tabstop>filterEdit</tabstop>
|
||||||
<tabstop>addModBtn</tabstop>
|
<tabstop>addModBtn</tabstop>
|
||||||
<tabstop>rmModBtn</tabstop>
|
<tabstop>rmModBtn</tabstop>
|
||||||
|
<tabstop>enableModBtn</tabstop>
|
||||||
|
<tabstop>disableModBtn</tabstop>
|
||||||
<tabstop>viewModBtn</tabstop>
|
<tabstop>viewModBtn</tabstop>
|
||||||
<tabstop>filterEdit</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user