From 96cceeafeb7a52e0dd2005677deec0af2fa4db92 Mon Sep 17 00:00:00 2001 From: TakSuyu Date: Sat, 6 Jul 2013 19:11:24 -0700 Subject: [PATCH] implemented ModEditUI and mapped ModEditUI Buttons for implementation enabled EditMods button on MainWindowUI added validation check for renaming instances --- gui/mainwindow.cpp | 19 ++++++++++++++++--- gui/mainwindow.h | 2 ++ gui/mainwindow.ui | 2 +- gui/modeditwindow.cpp | 10 +++++++++- gui/modeditwindow.h | 27 ++++++++++++++++++++++++++- 5 files changed, 54 insertions(+), 6 deletions(-) diff --git a/gui/mainwindow.cpp b/gui/mainwindow.cpp index 3f0221b2..5336b12c 100644 --- a/gui/mainwindow.cpp +++ b/gui/mainwindow.cpp @@ -42,6 +42,7 @@ #include "gui/versionselectdialog.h" #include "gui/lwjglselectdialog.h" #include "gui/consolewindow.h" +#include "gui/modeditwindow.h" #include "kcategorizedview.h" #include "kcategorydrawer.h" @@ -313,9 +314,12 @@ void MainWindow::on_actionRenameInstance_triggered() QString name ( inst->name() ); name = QInputDialog::getText ( this, tr ( "Instance name" ), tr ( "Enter a new instance name." ), QLineEdit::Normal, name, &ok ); - //FIXME: dialog should do the validation!!! - if(ok && name.length() && name.length() <= 25) - inst->setName(name); + + if (name.length() > 0) + { + if(ok && name.length() && name.length() <= 25) + inst->setName(name); + } } } @@ -329,6 +333,15 @@ void MainWindow::on_actionViewSelectedInstFolder_triggered() } } +void MainWindow::on_actionEditInstMods_triggered() +{ + Instance* inst = selectedInstance(); + if (inst) + { + ModEditWindow dialog ( this, inst ); + dialog.exec(); + } +} void MainWindow::closeEvent ( QCloseEvent *event ) { diff --git a/gui/mainwindow.h b/gui/mainwindow.h index b861cbe7..f13d9395 100644 --- a/gui/mainwindow.h +++ b/gui/mainwindow.h @@ -92,6 +92,8 @@ private slots: void on_actionChangeInstMCVersion_triggered(); + void on_actionEditInstMods_triggered(); + void doLogin(const QString& errorMsg = ""); diff --git a/gui/mainwindow.ui b/gui/mainwindow.ui index 44b8a31f..771e7096 100644 --- a/gui/mainwindow.ui +++ b/gui/mainwindow.ui @@ -342,7 +342,7 @@ - false + true Edit Mods diff --git a/gui/modeditwindow.cpp b/gui/modeditwindow.cpp index e457252a..322197ef 100644 --- a/gui/modeditwindow.cpp +++ b/gui/modeditwindow.cpp @@ -15,8 +15,11 @@ #include "modeditwindow.h" #include "ui_modeditwindow.h" +#include "instance.h" -ModEditWindow::ModEditWindow(QWidget *parent) : +#include + +ModEditWindow::ModEditWindow(QWidget *parent, Instance* m_inst) : QDialog(parent), ui(new Ui::ModEditWindow) { @@ -27,3 +30,8 @@ ModEditWindow::~ModEditWindow() { delete ui; } + +void ModEditWindow::on_buttonBox_rejected() +{ + close(); +} \ No newline at end of file diff --git a/gui/modeditwindow.h b/gui/modeditwindow.h index c669e0b1..87b02938 100644 --- a/gui/modeditwindow.h +++ b/gui/modeditwindow.h @@ -18,6 +18,8 @@ #include +#include "instance.h" + namespace Ui { class ModEditWindow; } @@ -27,9 +29,32 @@ class ModEditWindow : public QDialog Q_OBJECT public: - explicit ModEditWindow(QWidget *parent = 0); + explicit ModEditWindow(QWidget *parent = 0, Instance* m_inst = 0); ~ModEditWindow(); +private slots: + /* Mapped for implementation + void on_addTPackButton_clicked(); + void on_delTPackButton_clicked(); + void on_viewTPackButton_clicked(); + + void on_addMlModButton_clicked(); + void on_delMlModButton_clicked(); + void on_viewMlModbutton_clicked(); + + void on_addCoreModButton_clicked(); + void on_delCoreModButton_clicked(); + void on_viewCoreModButton_clicked(); + + void on_addJarModButton_clicked(); + void on_delJarModButton_clicked(); + void on_mcforgeButton_clicked(); + void on_jarModMoveUpButton_clicked(); + void on_jarModMoveDownButton_clicked(); + */ + // Questionable: SettingsDialog doesn't need this for some reason? + void on_buttonBox_rejected(); + private: Ui::ModEditWindow *ui; };