Slight refactor of the mod edit dialog constructor
Also some other insignificant refactors
This commit is contained in:
parent
73f534939a
commit
a266e5d0cc
@ -28,29 +28,46 @@ LegacyModEditDialog::LegacyModEditDialog( LegacyInstance* inst, QWidget* parent
|
||||
ui(new Ui::LegacyModEditDialog)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
ensureFolderPathExists(m_inst->coreModsDir());
|
||||
ensureFolderPathExists(m_inst->mlModsDir());
|
||||
ensureFolderPathExists(m_inst->jarModsDir());
|
||||
|
||||
m_mods = m_inst->loaderModList();
|
||||
m_coremods = m_inst->coreModList();
|
||||
m_jarmods = m_inst->jarModList();
|
||||
m_texturepacks = m_inst->texturePackList();
|
||||
|
||||
ui->jarModsTreeView->setModel(m_jarmods.data());
|
||||
//ui->jarModsTreeView->setDragDropMode(QAbstractItemView::DragDrop);
|
||||
ui->coreModsTreeView->setModel(m_coremods.data());
|
||||
ui->mlModTreeView->setModel(m_mods.data());
|
||||
ui->texPackTreeView->setModel(m_texturepacks.data());
|
||||
|
||||
ui->jarModsTreeView->installEventFilter( this );
|
||||
ui->coreModsTreeView->installEventFilter( this );
|
||||
ui->mlModTreeView->installEventFilter( this );
|
||||
ui->texPackTreeView->installEventFilter( this );
|
||||
m_mods->startWatching();
|
||||
m_coremods->startWatching();
|
||||
m_jarmods->startWatching();
|
||||
m_texturepacks->startWatching();
|
||||
// Jar mods
|
||||
{
|
||||
ensureFolderPathExists(m_inst->jarModsDir());
|
||||
m_jarmods = m_inst->jarModList();
|
||||
ui->jarModsTreeView->setModel(m_jarmods.data());
|
||||
|
||||
/*
|
||||
// FIXME: internal DnD causes segfaults later
|
||||
ui->jarModsTreeView->setDragDropMode(QAbstractItemView::DragDrop);
|
||||
// FIXME: DnD is glitched with contiguous (we move only first item in selection)
|
||||
ui->jarModsTreeView->setSelectionMode(QAbstractItemView::SingleSelection);
|
||||
*/
|
||||
|
||||
ui->jarModsTreeView->installEventFilter( this );
|
||||
m_jarmods->startWatching();
|
||||
}
|
||||
// Core mods
|
||||
{
|
||||
ensureFolderPathExists(m_inst->coreModsDir());
|
||||
m_coremods = m_inst->coreModList();
|
||||
ui->coreModsTreeView->setModel(m_coremods.data());
|
||||
ui->coreModsTreeView->installEventFilter( this );
|
||||
m_coremods->startWatching();
|
||||
}
|
||||
// Loader mods
|
||||
{
|
||||
ensureFolderPathExists(m_inst->loaderModsDir());
|
||||
m_mods = m_inst->loaderModList();
|
||||
ui->mlModTreeView->setModel(m_mods.data());
|
||||
ui->mlModTreeView->installEventFilter( this );
|
||||
m_mods->startWatching();
|
||||
}
|
||||
// texture packs
|
||||
{
|
||||
m_texturepacks = m_inst->texturePackList();
|
||||
ui->texPackTreeView->setModel(m_texturepacks.data());
|
||||
ui->texPackTreeView->installEventFilter( this );
|
||||
m_texturepacks->startWatching();
|
||||
}
|
||||
}
|
||||
|
||||
LegacyModEditDialog::~LegacyModEditDialog()
|
||||
@ -294,7 +311,7 @@ void LegacyModEditDialog::on_viewCoreBtn_clicked()
|
||||
}
|
||||
void LegacyModEditDialog::on_viewModBtn_clicked()
|
||||
{
|
||||
openDirInDefaultProgram(m_inst->mlModsDir(), true);
|
||||
openDirInDefaultProgram(m_inst->loaderModsDir(), true);
|
||||
}
|
||||
void LegacyModEditDialog::on_viewTexPackBtn_clicked()
|
||||
{
|
||||
|
@ -124,7 +124,7 @@ QSharedPointer< ModList > LegacyInstance::loaderModList()
|
||||
I_D(LegacyInstance);
|
||||
if(!d->loader_mod_list)
|
||||
{
|
||||
d->loader_mod_list.reset(new ModList(mlModsDir()));
|
||||
d->loader_mod_list.reset(new ModList(loaderModsDir()));
|
||||
}
|
||||
else
|
||||
d->loader_mod_list->update();
|
||||
@ -171,7 +171,7 @@ QString LegacyInstance::savesDir() const
|
||||
return PathCombine(minecraftRoot(), "saves");
|
||||
}
|
||||
|
||||
QString LegacyInstance::mlModsDir() const
|
||||
QString LegacyInstance::loaderModsDir() const
|
||||
{
|
||||
return PathCombine(minecraftRoot(), "mods");
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public:
|
||||
QString texturePackDir() const;
|
||||
QString jarModsDir() const;
|
||||
QString binDir() const;
|
||||
QString mlModsDir() const;
|
||||
QString loaderModsDir() const;
|
||||
QString coreModsDir() const;
|
||||
QString resourceDir() const;
|
||||
virtual QString instanceConfigFolder() const;
|
||||
|
Loading…
Reference in New Issue
Block a user