summaryrefslogtreecommitdiffstats
path: root/gui/LegacyModEditDialog.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-10-09 02:03:02 +0200
committerPetr Mrázek <peterix@gmail.com>2013-10-09 02:03:02 +0200
commit6bc9df84d9e72d8ee06c23c505b6c5ad54820115 (patch)
tree7d66742fdedf3384a0ba58b99e6dc3c5926286e6 /gui/LegacyModEditDialog.cpp
parent36edf6cbc6f0b329e0b8f96dc5543cff0acb8aec (diff)
downloadMultiMC-6bc9df84d9e72d8ee06c23c505b6c5ad54820115.tar
MultiMC-6bc9df84d9e72d8ee06c23c505b6c5ad54820115.tar.gz
MultiMC-6bc9df84d9e72d8ee06c23c505b6c5ad54820115.tar.lz
MultiMC-6bc9df84d9e72d8ee06c23c505b6c5ad54820115.tar.xz
MultiMC-6bc9df84d9e72d8ee06c23c505b6c5ad54820115.zip
Mod info, with less HTML!
And responding to keyboard events too.
Diffstat (limited to 'gui/LegacyModEditDialog.cpp')
-rw-r--r--gui/LegacyModEditDialog.cpp62
1 files changed, 34 insertions, 28 deletions
diff --git a/gui/LegacyModEditDialog.cpp b/gui/LegacyModEditDialog.cpp
index 585bfdfb..82532cfd 100644
--- a/gui/LegacyModEditDialog.cpp
+++ b/gui/LegacyModEditDialog.cpp
@@ -47,6 +47,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
#endif
ui->jarModsTreeView->installEventFilter(this);
m_jarmods->startWatching();
+ auto smodel = ui->jarModsTreeView->selectionModel();
+ connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
+ SLOT(jarCurrent(QModelIndex, QModelIndex)));
}
// Core mods
{
@@ -55,6 +58,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
ui->coreModsTreeView->setModel(m_coremods.get());
ui->coreModsTreeView->installEventFilter(this);
m_coremods->startWatching();
+ auto smodel = ui->coreModsTreeView->selectionModel();
+ connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
+ SLOT(coreCurrent(QModelIndex, QModelIndex)));
}
// Loader mods
{
@@ -63,6 +69,9 @@ LegacyModEditDialog::LegacyModEditDialog(LegacyInstance *inst, QWidget *parent)
ui->loaderModTreeView->setModel(m_mods.get());
ui->loaderModTreeView->installEventFilter(this);
m_mods->startWatching();
+ auto smodel = ui->loaderModTreeView->selectionModel();
+ connect(smodel, SIGNAL(currentChanged(QModelIndex, QModelIndex)),
+ SLOT(loaderCurrent(QModelIndex, QModelIndex)));
}
// texture packs
{
@@ -201,7 +210,7 @@ void LegacyModEditDialog::on_addForgeBtn_clicked()
if (vselect.exec() && vselect.selectedVersion())
{
ForgeVersionPtr forge =
- std::dynamic_pointer_cast<ForgeVersion> (vselect.selectedVersion());
+ std::dynamic_pointer_cast<ForgeVersion>(vselect.selectedVersion());
if (!forge)
return;
auto entry = MMC->metacache()->resolveEntry("minecraftforge", forge->filename);
@@ -345,41 +354,38 @@ void LegacyModEditDialog::on_buttonBox_rejected()
close();
}
-void LegacyModEditDialog::on_jarModsTreeView_pressed(const QModelIndex &index)
+void LegacyModEditDialog::jarCurrent(QModelIndex current, QModelIndex previous)
{
- int first, last;
- auto list = ui->jarModsTreeView->selectionModel()->selectedRows();
-
- if (!lastfirst(list, first, last))
+ if(!current.isValid())
+ {
+ ui->jarMIFrame->clear();
return;
-
- Mod &m = m_jarmods->operator[](first);
-
- handleModInfoUpdate(m, ui->jarMIFrame);
+ }
+ int row = current.row();
+ Mod &m = m_jarmods->operator[](row);
+ ui->jarMIFrame->updateWithMod(m);
}
-void LegacyModEditDialog::on_coreModsTreeView_pressed(const QModelIndex &index)
+void LegacyModEditDialog::coreCurrent(QModelIndex current, QModelIndex previous)
{
- int first, last;
- auto list = ui->coreModsTreeView->selectionModel()->selectedRows();
-
- if (!lastfirst(list, first, last))
+ if(!current.isValid())
+ {
+ ui->coreMIFrame->clear();
return;
-
- Mod &m = m_coremods->operator[](first);
-
- handleModInfoUpdate(m, ui->coreMIFrame);
+ }
+ int row = current.row();
+ Mod &m = m_coremods->operator[](row);
+ ui->coreMIFrame->updateWithMod(m);
}
-void LegacyModEditDialog::on_loaderModTreeView_pressed(const QModelIndex &index)
+void LegacyModEditDialog::loaderCurrent(QModelIndex current, QModelIndex previous)
{
- int first, last;
- auto list = ui->loaderModTreeView->selectionModel()->selectedRows();
-
- if (!lastfirst(list, first, last))
+ if(!current.isValid())
+ {
+ ui->loaderMIFrame->clear();
return;
-
- Mod &m = m_mods->operator[](first);
-
- handleModInfoUpdate(m, ui->loaderMIFrame);
+ }
+ int row = current.row();
+ Mod &m = m_mods->operator[](row);
+ ui->loaderMIFrame->updateWithMod(m);
}