Fix more stuff. Detached tools, only MCEdit for now.
This commit is contained in:
@ -1440,7 +1440,34 @@ void MainWindow::instanceChanged(const QModelIndex ¤t, const QModelIndex &
|
||||
for (auto profiler : MMC->profilers().values())
|
||||
{
|
||||
QAction *profilerAction = launchMenu->addAction(profiler->name());
|
||||
connect(profilerAction, &QAction::triggered, [this, profiler](){doLaunch(true, profiler.get());});
|
||||
QString error;
|
||||
if (!profiler->check(&error))
|
||||
{
|
||||
profilerAction->setDisabled(true);
|
||||
profilerAction->setToolTip(tr("Profiler not setup correctly. Go into settings, \"External Tools\"."));
|
||||
}
|
||||
else
|
||||
{
|
||||
connect(profilerAction, &QAction::triggered, [this, profiler](){doLaunch(true, profiler.get());});
|
||||
}
|
||||
}
|
||||
launchMenu->addSeparator()->setText(tr("Tools"));
|
||||
for (auto tool : MMC->tools().values())
|
||||
{
|
||||
QAction *toolAction = launchMenu->addAction(tool->name());
|
||||
QString error;
|
||||
if (!tool->check(&error))
|
||||
{
|
||||
toolAction->setDisabled(true);
|
||||
toolAction->setToolTip(tr("Tool not setup correctly. Go into settings, \"External Tools\"."));
|
||||
}
|
||||
else
|
||||
{
|
||||
connect(toolAction, &QAction::triggered, [this, tool]()
|
||||
{
|
||||
tool->createDetachedTool(m_selectedInstance, this)->run();
|
||||
});
|
||||
}
|
||||
}
|
||||
ui->actionLaunchInstance->setMenu(launchMenu);
|
||||
|
||||
|
@ -374,6 +374,7 @@ void SettingsDialog::applySettings(SettingsObject *s)
|
||||
// Profilers
|
||||
s->set("JProfilerPath", ui->jprofilerPathEdit->text());
|
||||
s->set("JVisualVMPath", ui->jvisualvmPathEdit->text());
|
||||
s->set("MCEditPath", ui->mceditPathEdit->text());
|
||||
}
|
||||
|
||||
void SettingsDialog::loadSettings(SettingsObject *s)
|
||||
@ -457,6 +458,7 @@ void SettingsDialog::loadSettings(SettingsObject *s)
|
||||
// Profilers
|
||||
ui->jprofilerPathEdit->setText(s->get("JProfilerPath").toString());
|
||||
ui->jvisualvmPathEdit->setText(s->get("JVisualVMPath").toString());
|
||||
ui->mceditPathEdit->setText(s->get("MCEditPath").toString());
|
||||
}
|
||||
|
||||
void SettingsDialog::on_javaDetectBtn_clicked()
|
||||
@ -565,3 +567,29 @@ void SettingsDialog::on_jvisualvmCheckBtn_clicked()
|
||||
QMessageBox::information(this, tr("OK"), tr("JVisualVM setup seems to be OK"));
|
||||
}
|
||||
}
|
||||
|
||||
void SettingsDialog::on_mceditPathBtn_clicked()
|
||||
{
|
||||
QString raw_dir = QFileDialog::getOpenFileName(this, tr("MCEdit Path"),
|
||||
ui->jvisualvmPathEdit->text());
|
||||
QString cooked_dir = NormalizePath(raw_dir);
|
||||
|
||||
// do not allow current dir - it's dirty. Do not allow dirs that don't exist
|
||||
if (!cooked_dir.isEmpty() && QDir(cooked_dir).exists())
|
||||
{
|
||||
ui->mceditPathEdit->setText(cooked_dir);
|
||||
}
|
||||
}
|
||||
void SettingsDialog::on_mceditCheckBtn_clicked()
|
||||
{
|
||||
QString error;
|
||||
if (!MMC->tools()["mcedit"]->check(ui->mceditPathEdit->text(), &error))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Error"),
|
||||
tr("Error while checking MCEdit install:\n%1").arg(error));
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::information(this, tr("OK"), tr("MCEdit setup seems to be OK"));
|
||||
}
|
||||
}
|
||||
|
@ -79,6 +79,8 @@ slots:
|
||||
void on_jprofilerCheckBtn_clicked();
|
||||
void on_jvisualvmPathBtn_clicked();
|
||||
void on_jvisualvmCheckBtn_clicked();
|
||||
void on_mceditPathBtn_clicked();
|
||||
void on_mceditCheckBtn_clicked();
|
||||
|
||||
/*!
|
||||
* Updates the list of update channels in the combo box.
|
||||
|
@ -863,9 +863,9 @@
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="profilingTab">
|
||||
<widget class="QWidget" name="externalToolsTab">
|
||||
<attribute name="title">
|
||||
<string>Profiling</string>
|
||||
<string>External Tools</string>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_13">
|
||||
<item>
|
||||
@ -928,6 +928,36 @@
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QGroupBox" name="groupBox_4">
|
||||
<property name="title">
|
||||
<string>MCEdit</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_12">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_6">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="mceditPathEdit"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mceditPathBtn">
|
||||
<property name="text">
|
||||
<string>...</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="mceditCheckBtn">
|
||||
<property name="text">
|
||||
<string>Check</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
|
Reference in New Issue
Block a user