summaryrefslogtreecommitdiffstats
path: root/gui/dialogs/OneSixModEditDialog.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-03-09 17:38:42 +0100
committerPetr Mrázek <peterix@gmail.com>2014-03-09 17:38:42 +0100
commitffff2cd3248a574d3d666731580ac7b8c33e1735 (patch)
tree34938608cd6b87001557a9cc7290267623b1f24a /gui/dialogs/OneSixModEditDialog.cpp
parent47bc7e5ee377dacfeb7cf3d13f07cfd24db906fb (diff)
downloadMultiMC-ffff2cd3248a574d3d666731580ac7b8c33e1735.tar
MultiMC-ffff2cd3248a574d3d666731580ac7b8c33e1735.tar.gz
MultiMC-ffff2cd3248a574d3d666731580ac7b8c33e1735.tar.lz
MultiMC-ffff2cd3248a574d3d666731580ac7b8c33e1735.tar.xz
MultiMC-ffff2cd3248a574d3d666731580ac7b8c33e1735.zip
Remove version patch reordering. Remove the main class display from onesix edit mods.
Diffstat (limited to 'gui/dialogs/OneSixModEditDialog.cpp')
-rw-r--r--gui/dialogs/OneSixModEditDialog.cpp114
1 files changed, 9 insertions, 105 deletions
diff --git a/gui/dialogs/OneSixModEditDialog.cpp b/gui/dialogs/OneSixModEditDialog.cpp
index 96205d0a..c211d3e1 100644
--- a/gui/dialogs/OneSixModEditDialog.cpp
+++ b/gui/dialogs/OneSixModEditDialog.cpp
@@ -110,7 +110,6 @@ void OneSixModEditDialog::updateVersionControls()
{
ui->forgeBtn->setEnabled(true);
ui->liteloaderBtn->setEnabled(true);
- ui->mainClassEdit->setText(m_version->mainClass);
}
void OneSixModEditDialog::disableVersionControls()
@@ -119,7 +118,6 @@ void OneSixModEditDialog::disableVersionControls()
ui->liteloaderBtn->setEnabled(false);
ui->reloadLibrariesBtn->setEnabled(false);
ui->removeLibraryBtn->setEnabled(false);
- ui->mainClassEdit->setText("");
}
void OneSixModEditDialog::on_reloadLibrariesBtn_clicked()
@@ -131,6 +129,7 @@ void OneSixModEditDialog::on_removeLibraryBtn_clicked()
{
if (ui->libraryTreeView->currentIndex().isValid())
{
+ // FIXME: use actual model, not reloading.
if (!m_version->remove(ui->libraryTreeView->currentIndex().row()))
{
QMessageBox::critical(this, tr("Error"), tr("Couldn't remove file"));
@@ -144,97 +143,31 @@ void OneSixModEditDialog::on_removeLibraryBtn_clicked()
void OneSixModEditDialog::on_resetLibraryOrderBtn_clicked()
{
- QDir(m_inst->instanceRoot()).remove("order.json");
- m_inst->reloadVersion();
+ // FIXME: IMPLEMENT LOGIC IN MODEL. SEE LEGACY DIALOG FOR EXAMPLE(S).
}
+
void OneSixModEditDialog::on_moveLibraryUpBtn_clicked()
{
-
- QMap<QString, int> order = getExistingOrder();
- if (order.size() < 2 || ui->libraryTreeView->selectionModel()->selectedIndexes().isEmpty())
- {
- return;
- }
- const int ourRow = ui->libraryTreeView->selectionModel()->selectedIndexes().first().row();
- const QString ourId = m_version->versionFileId(ourRow);
- const int ourOrder = order[ourId];
- if (ourId.isNull() || ourId.startsWith("org.multimc."))
- {
- return;
- }
-
- QMap<int, QString> sortedOrder = invert(order);
-
- QList<int> sortedOrders = sortedOrder.keys();
- const int ourIndex = sortedOrders.indexOf(ourOrder);
- if (ourIndex <= 0)
- {
- return;
- }
- const int ourNewOrder = sortedOrders.at(ourIndex - 1);
- order[ourId] = ourNewOrder;
- order[sortedOrder[sortedOrders[ourIndex - 1]]] = ourOrder;
-
- // FIXME: why is GUI code doing this in particular? why isn't this part of a model?
- if (!OneSixVersionBuilder::writeOverrideOrders(order, m_inst))
- {
- QMessageBox::critical(this, tr("Error"), tr("Couldn't save the new order"));
- }
- else
- {
- m_inst->reloadVersion();
- ui->libraryTreeView->selectionModel()->select(m_version->index(ourRow - 1), QItemSelectionModel::SelectCurrent);
- }
+ // FIXME: IMPLEMENT LOGIC IN MODEL. SEE LEGACY DIALOG FOR EXAMPLE(S).
}
-// FIXME: WHY IS THIS DUPLICATED?
void OneSixModEditDialog::on_moveLibraryDownBtn_clicked()
{
- QMap<QString, int> order = getExistingOrder();
- if (order.size() < 2 || ui->libraryTreeView->selectionModel()->selectedIndexes().isEmpty())
- {
- return;
- }
- const int ourRow = ui->libraryTreeView->selectionModel()->selectedIndexes().first().row();
- const QString ourId = m_version->versionFileId(ourRow);
- const int ourOrder = order[ourId];
- if (ourId.isNull() || ourId.startsWith("org.multimc."))
- {
- return;
- }
-
- QMap<int, QString> sortedOrder = invert(order);
-
- QList<int> sortedOrders = sortedOrder.keys();
- const int ourIndex = sortedOrders.indexOf(ourOrder);
- if ((ourIndex + 1) >= sortedOrders.size())
- {
- return;
- }
- const int ourNewOrder = sortedOrders.at(ourIndex + 1);
- order[ourId] = ourNewOrder;
- order[sortedOrder[sortedOrders[ourIndex + 1]]] = ourOrder;
-
- // FIXME: why is GUI code doing this in particular? why isn't this part of a model?
- if (!OneSixVersionBuilder::writeOverrideOrders(order, m_inst))
- {
- QMessageBox::critical(this, tr("Error"), tr("Couldn't save the new order"));
- }
- else
- {
- m_inst->reloadVersion();
- ui->libraryTreeView->selectionModel()->select(m_version->index(ourRow + 1), QItemSelectionModel::SelectCurrent);
- }
+ // FIXME: IMPLEMENT LOGIC IN MODEL. SEE LEGACY DIALOG FOR EXAMPLE(S).
}
void OneSixModEditDialog::on_forgeBtn_clicked()
{
+ // FIXME: use actual model, not reloading. Move logic to model.
+
+ // FIXME: model::isCustom();
if (QDir(m_inst->instanceRoot()).exists("custom.json"))
{
if (QMessageBox::question(this, tr("Revert?"), tr("This action will remove your custom.json. Continue?")) != QMessageBox::Yes)
{
return;
}
+ // FIXME: model::revertToBase();
QDir(m_inst->instanceRoot()).remove("custom.json");
m_inst->reloadVersion();
}
@@ -351,35 +284,6 @@ bool OneSixModEditDialog::resourcePackListFilter(QKeyEvent *keyEvent)
return QDialog::eventFilter(ui->resPackTreeView, keyEvent);
}
-QMap<QString, int> OneSixModEditDialog::getExistingOrder() const
-{
-
- QMap<QString, int> order;
- // default
- {
- for (auto & file : m_version->versionFiles)
- {
- if (file.id.startsWith("org.multimc."))
- {
- continue;
- }
- order.insert(file.id, file.order);
- }
- }
- // overriden
- {
- QMap<QString, int> overridenOrder = OneSixVersionBuilder::readOverrideOrders(m_inst);
- for (auto id : order.keys())
- {
- if (overridenOrder.contains(id))
- {
- order[id] = overridenOrder[id];
- }
- }
- }
- return order;
-}
-
bool OneSixModEditDialog::eventFilter(QObject *obj, QEvent *ev)
{
if (ev->type() != QEvent::KeyPress)