mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-12 02:28:11 +02:00
Merge pull request #2722 from Nordsoft91/launcher-doubleclick
Launcher mod double click behavior
This commit is contained in:
commit
48e6e0228c
@ -888,3 +888,51 @@ QString CModListView::getTranslationModName(const QString & language)
|
||||
|
||||
return QString();
|
||||
}
|
||||
|
||||
void CModListView::on_allModsView_doubleClicked(const QModelIndex &index)
|
||||
{
|
||||
if(!index.isValid())
|
||||
return;
|
||||
|
||||
auto modName = index.data(ModRoles::ModNameRole).toString();
|
||||
auto mod = modModel->getMod(modName);
|
||||
|
||||
bool hasInvalidDeps = !findInvalidDependencies(modName).empty();
|
||||
bool hasBlockingMods = !findBlockingMods(modName).empty();
|
||||
bool hasDependentMods = !findDependentMods(modName, true).empty();
|
||||
|
||||
if(!hasInvalidDeps && mod.isAvailable() && !mod.getName().contains('.'))
|
||||
{
|
||||
on_installButton_clicked();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!hasInvalidDeps && !hasDependentMods && mod.isUpdateable() && index.column() == ModFields::STATUS_UPDATE)
|
||||
{
|
||||
on_updateButton_clicked();
|
||||
return;
|
||||
}
|
||||
|
||||
if(index.column() == ModFields::NAME)
|
||||
{
|
||||
if(ui->allModsView->isExpanded(index))
|
||||
ui->allModsView->collapse(index);
|
||||
else
|
||||
ui->allModsView->expand(index);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if(!hasBlockingMods && !hasInvalidDeps && mod.isDisabled())
|
||||
{
|
||||
on_enableButton_clicked();
|
||||
return;
|
||||
}
|
||||
|
||||
if(!hasDependentMods && !mod.isEssential() && mod.isEnabled())
|
||||
{
|
||||
on_disableButton_clicked();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -126,6 +126,8 @@ private slots:
|
||||
|
||||
void on_screenshotsList_clicked(const QModelIndex & index);
|
||||
|
||||
void on_allModsView_doubleClicked(const QModelIndex &index);
|
||||
|
||||
private:
|
||||
Ui::CModListView * ui;
|
||||
};
|
||||
|
@ -119,6 +119,9 @@
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="handleWidth">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<widget class="QTreeView" name="allModsView">
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
|
Loading…
Reference in New Issue
Block a user