Merge pull request #2 from TakSuyu/master

Did some grunt work for the Edit Mods Dialog
This commit is contained in:
Petr Mrázek 2013-07-07 09:14:11 -07:00
commit 8f5516ceb6
5 changed files with 54 additions and 6 deletions

View File

@ -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,11 +314,14 @@ 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 (name.length() > 0)
{
if(ok && name.length() && name.length() <= 25)
inst->setName(name);
}
}
}
void MainWindow::on_actionViewSelectedInstFolder_triggered()
{
@ -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 )
{

View File

@ -92,6 +92,8 @@ private slots:
void on_actionChangeInstMCVersion_triggered();
void on_actionEditInstMods_triggered();
void doLogin(const QString& errorMsg = "");

View File

@ -342,7 +342,7 @@
</action>
<action name="actionEditInstMods">
<property name="enabled">
<bool>false</bool>
<bool>true</bool>
</property>
<property name="text">
<string>Edit Mods</string>

View File

@ -15,8 +15,11 @@
#include "modeditwindow.h"
#include "ui_modeditwindow.h"
#include "instance.h"
ModEditWindow::ModEditWindow(QWidget *parent) :
#include <QDebug>
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();
}

View File

@ -18,6 +18,8 @@
#include <QDialog>
#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;
};