diff --git a/src/app/GUI/mainwindow.cpp b/src/app/GUI/mainwindow.cpp
index a8772133f..82a03d685 100644
--- a/src/app/GUI/mainwindow.cpp
+++ b/src/app/GUI/mainwindow.cpp
@@ -1146,6 +1146,11 @@ void MainWindow::setupMenuBar()
QMessageBox::aboutQt(this, tr("About Qt"));
});
+ help->addSeparator();
+ help->addAction(QIcon::fromTheme("renderlayers"),
+ tr("Reinstall default render profiles"),
+ this, &MainWindow::askInstallRenderPresets);
+
mToolbar->addAction(QIcon::fromTheme("render_animation"),
tr("Render"),
this, &MainWindow::openRendererWindow);
@@ -1292,12 +1297,14 @@ void MainWindow::closedRenderQueueWindow()
tr("Queue"));
}
-void MainWindow::initRenderPresets()
+void MainWindow::initRenderPresets(const bool reinstall)
{
- if (!AppSupport::getSettings("settings",
- "firstRunRenderPresets",
- true).toBool()) { return; }
+ const bool doInstall = reinstall ? true : AppSupport::getSettings("settings",
+ "firstRunRenderPresets",
+ true).toBool();
+ if (!doInstall) { return; }
const QString path = AppSupport::getAppOutputProfilesPath();
+ if (path.isEmpty() || !QFileInfo(path).isWritable()) { return; }
QStringList presets;
presets << "001-friction-preset-mp4-h264.conf";
@@ -1309,9 +1316,9 @@ void MainWindow::initRenderPresets()
for (const auto &preset : presets) {
QString filePath(QString("%1/%2").arg(path, preset));
- if (QFile::exists(filePath)) { continue; }
+ if (QFile::exists(filePath) && !reinstall) { continue; }
QFile file(filePath);
- if (file.open(QIODevice::WriteOnly | QIODevice::Text)) {
+ if (file.open(QIODevice::WriteOnly | QIODevice::Text | QIODevice::Truncate)) {
QFile res(QString(":/presets/render/%1").arg(preset));
if (res.open(QIODevice::ReadOnly | QIODevice::Text)) {
file.write(res.readAll());
@@ -1324,6 +1331,16 @@ void MainWindow::initRenderPresets()
AppSupport::setSettings("settings", "firstRunRenderPresets", false);
}
+void MainWindow::askInstallRenderPresets()
+{
+ const auto result = QMessageBox::question(this,
+ tr("Install Render Profiles"),
+ tr("Are you sure you want to install the default render profiles?"
+ "
Note that a restart of the application is required to detect new profiles."));
+ if (result != QMessageBox::Yes) { return; }
+ initRenderPresets(true);
+}
+
void MainWindow::openWelcomeDialog()
{
mStackWidget->setCurrentIndex(mStackIndexWelcome);
diff --git a/src/app/GUI/mainwindow.h b/src/app/GUI/mainwindow.h
index ef9b9f954..b971ae1c9 100644
--- a/src/app/GUI/mainwindow.h
+++ b/src/app/GUI/mainwindow.h
@@ -410,7 +410,8 @@ class MainWindow : public QMainWindow
void openRenderQueueWindow();
void closedRenderQueueWindow();
- void initRenderPresets();
+ void initRenderPresets(const bool reinstall = false);
+ void askInstallRenderPresets();
protected:
void keyPressEvent(QKeyEvent *event);