Implement some bits and pieces, disable dead buttons.
This commit is contained in:
@ -64,7 +64,8 @@
|
||||
|
||||
// Opens the given file in the default application.
|
||||
// TODO: Move this somewhere.
|
||||
void openInDefaultProgram ( QString filename );
|
||||
void openFileInDefaultProgram ( QString filename );
|
||||
void openDirInDefaultProgram ( QString dirpath, bool ensureExists = false );
|
||||
|
||||
MainWindow::MainWindow ( QWidget *parent ) :
|
||||
QMainWindow ( parent ),
|
||||
@ -224,16 +225,22 @@ void MainWindow::on_actionChangeInstGroup_triggered()
|
||||
Instance* inst = selectedInstance();
|
||||
if(inst)
|
||||
{
|
||||
bool ok = false;
|
||||
QString name ( inst->group() );
|
||||
name = QInputDialog::getText ( this, tr ( "Group name" ), tr ( "Enter a new group name." ), QLineEdit::Normal, name );
|
||||
inst->setGroup(name);
|
||||
QInputDialog dlg(this);
|
||||
dlg.result();
|
||||
name = QInputDialog::getText ( this, tr ( "Group name" ), tr ( "Enter a new group name." ),
|
||||
QLineEdit::Normal, name, &ok );
|
||||
if(ok)
|
||||
inst->setGroup(name);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::on_actionViewInstanceFolder_triggered()
|
||||
{
|
||||
openInDefaultProgram ( globalSettings->get ( "InstanceDir" ).toString() );
|
||||
QString str = globalSettings->get ( "InstanceDir" ).toString();
|
||||
openDirInDefaultProgram ( str );
|
||||
}
|
||||
|
||||
void MainWindow::on_actionRefresh_triggered()
|
||||
@ -243,7 +250,7 @@ void MainWindow::on_actionRefresh_triggered()
|
||||
|
||||
void MainWindow::on_actionViewCentralModsFolder_triggered()
|
||||
{
|
||||
openInDefaultProgram ( globalSettings->get ( "CentralModsDir" ).toString() );
|
||||
openDirInDefaultProgram ( globalSettings->get ( "CentralModsDir" ).toString() , true);
|
||||
}
|
||||
|
||||
void MainWindow::on_actionCheckUpdate_triggered()
|
||||
@ -282,6 +289,37 @@ void MainWindow::on_mainToolBar_visibilityChanged ( bool )
|
||||
ui->mainToolBar->setVisible ( true );
|
||||
}
|
||||
|
||||
void MainWindow::on_actionDeleteInstance_triggered()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void MainWindow::on_actionRenameInstance_triggered()
|
||||
{
|
||||
Instance* inst = selectedInstance();
|
||||
if(inst)
|
||||
{
|
||||
bool ok = false;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::on_actionViewSelectedInstFolder_triggered()
|
||||
{
|
||||
Instance* inst = selectedInstance();
|
||||
if(inst)
|
||||
{
|
||||
QString str = inst->rootDir();
|
||||
openDirInDefaultProgram ( QDir(str).absolutePath() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void MainWindow::closeEvent ( QCloseEvent *event )
|
||||
{
|
||||
// Save the window state and geometry.
|
||||
@ -449,7 +487,18 @@ void MainWindow::openWebPage ( QUrl url )
|
||||
browser->exec();
|
||||
}
|
||||
|
||||
void openInDefaultProgram ( QString filename )
|
||||
void openDirInDefaultProgram ( QString path, bool ensureExists )
|
||||
{
|
||||
QDir parentPath;
|
||||
QDir dir( path );
|
||||
if(!dir.exists())
|
||||
{
|
||||
parentPath.mkpath(dir.absolutePath());
|
||||
}
|
||||
QDesktopServices::openUrl ( "file:///" + dir.absolutePath() );
|
||||
}
|
||||
|
||||
void openFileInDefaultProgram ( QString filename )
|
||||
{
|
||||
QDesktopServices::openUrl ( "file:///" + QFileInfo ( filename ).absolutePath() );
|
||||
}
|
||||
|
@ -63,6 +63,8 @@ private slots:
|
||||
void on_actionChangeInstGroup_triggered();
|
||||
|
||||
void on_actionViewInstanceFolder_triggered();
|
||||
|
||||
void on_actionViewSelectedInstFolder_triggered();
|
||||
|
||||
void on_actionRefresh_triggered();
|
||||
|
||||
@ -82,8 +84,11 @@ private slots:
|
||||
|
||||
void on_actionLaunchInstance_triggered();
|
||||
|
||||
|
||||
void on_actionMakeDesktopShortcut_triggered();
|
||||
void on_actionDeleteInstance_triggered();
|
||||
|
||||
void on_actionRenameInstance_triggered();
|
||||
|
||||
void on_actionMakeDesktopShortcut_triggered();
|
||||
|
||||
void on_actionChangeInstMCVersion_triggered();
|
||||
|
||||
|
@ -6,8 +6,8 @@
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>600</width>
|
||||
<height>400</height>
|
||||
<width>692</width>
|
||||
<height>596</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
@ -271,6 +271,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionChangeInstIcon">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change Icon</string>
|
||||
</property>
|
||||
@ -282,6 +285,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEditInstNotes">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Notes</string>
|
||||
</property>
|
||||
@ -293,6 +299,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionInstanceSettings">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Settings</string>
|
||||
</property>
|
||||
@ -304,6 +313,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionMakeDesktopShortcut">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Make Shortcut</string>
|
||||
</property>
|
||||
@ -315,6 +327,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionManageInstSaves">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Manage Saves</string>
|
||||
</property>
|
||||
@ -326,6 +341,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionEditInstMods">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Edit Mods</string>
|
||||
</property>
|
||||
@ -359,6 +377,9 @@
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionRebuildInstJar">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Rebuild Jar</string>
|
||||
</property>
|
||||
|
@ -45,8 +45,6 @@ public slots:
|
||||
void changeStatus(const QString& status);
|
||||
void changeProgress(int progress);
|
||||
|
||||
void test() { qDebug("Lol"); }
|
||||
|
||||
signals:
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user