Commit 37603e59 authored by Jean-Baptiste Mardelle's avatar Jean-Baptiste Mardelle

Add menu on Windows to switch between OpenGL modes (in settings menu)

parent 8701571d
Pipeline #9386 passed with stage
in 15 minutes and 37 seconds
......@@ -63,7 +63,7 @@
<label>Default image sequence frame duration.</label>
<default>00:00:00:01</default>
</entry>
<entry name="fade_duration" type="String">
<label>Default image sequence frame duration.</label>
<default>00:00:03:00</default>
......@@ -119,6 +119,11 @@
<default></default>
</entry>
<entry name="opengl_backend" type="Int">
<label>Default OpenGL backend.</label>
<default>0</default>
</entry>
</group>
<group name="project">
......
<!DOCTYPE kpartgui SYSTEM "kpartgui.dtd">
<kpartgui name="kdenlive" version="166" translationDomain="kdenlive">
<kpartgui name="kdenlive" version="167" translationDomain="kdenlive">
<MenuBar>
<Menu name="file" >
<Action name="dvd_wizard" />
......@@ -218,8 +218,13 @@
<ActionList name="dock_actions" />
</Menu>
<Menu name="settings" >
<Action name="get_new_mlt_profiles" />
<Action name="run_wizard" />
<Menu name="qt_opengl" ><text>OpenGL Backend</text>
<Action name="opengl_auto" />
<Action name="opengl_desktop" />
<Action name="opengl_es" />
<Action name="opengl_software" />
</Menu>
<Action name="force_icon_theme" />
<Action name="themes_menu" />
<Action name="styles_menu" />
......
......@@ -60,16 +60,24 @@ int main(int argc, char *argv[])
#endif
// Force QDomDocument to use a deterministic XML attribute order
qSetGlobalQHashSeed(0);
Logger::init();
QApplication app(argc, argv);
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
QCoreApplication::setAttribute(Qt::AA_ShareOpenGLContexts, true);
KSharedConfigPtr config = KSharedConfig::openConfig();
#if defined(Q_OS_UNIX) && !defined(Q_OS_MAC)
QCoreApplication::setAttribute(Qt::AA_X11InitThreads);
#elif defined(Q_OS_WIN)
QCoreApplication::setAttribute(Qt::AA_UseOpenGLES, true);
KConfigGroup grp1(config, "misc");
if (grp1.exists()) {
int glMode = grp1.readEntry("opengl_backend", 0);
if (glMode > 0) {
QCoreApplication::setAttribute((Qt::ApplicationAttribute)glMode, true);
}
}
#endif
Logger::init();
QApplication app(argc, argv);
app.setApplicationName(QStringLiteral("kdenlive"));
app.setOrganizationDomain(QStringLiteral("kde.org"));
app.setWindowIcon(QIcon(QStringLiteral(":/pics/kdenlive.png")));
......@@ -98,7 +106,6 @@ int main(int argc, char *argv[])
}
}
#endif
KSharedConfigPtr config = KSharedConfig::openConfig();
KConfigGroup grp(config, "unmanaged");
if (!grp.exists()) {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();
......
......@@ -501,7 +501,20 @@ void MainWindow::init()
loadGenerators();
loadDockActions();
loadClipActions();
QMenu *openGLMenu = static_cast<QMenu *>(factory()->container(QStringLiteral("qt_opengl"), this));
#if defined(Q_OS_WIN)
connect(openGLMenu, &QMenu::triggered, [&](QAction *ac) {
KdenliveSettings::setOpengl_backend(ac->data().toInt());
if (KMessageBox::questionYesNo(this, i18n("Kdenlive needs to be restarted to change this setting. Do you want to proceed?")) != KMessageBox::Yes) {
return;
}
slotRestart(false);
});
#else
if (openGLMenu) {
delete openGLMenu;
}
#endif
// Connect monitor overlay info menu.
QMenu *monitorOverlay = static_cast<QMenu *>(factory()->container(QStringLiteral("monitor_config_overlay"), this));
connect(monitorOverlay, &QMenu::triggered, this, &MainWindow::slotSwitchMonitorOverlay);
......@@ -1172,6 +1185,33 @@ void MainWindow::setupActions()
addAction(QStringLiteral("snap"), m_buttonSnap);
addAction(QStringLiteral("zoom_fit"), m_buttonFitZoom);
#if defined(Q_OS_WIN)
int glBackend = KdenliveSettings::opengl_backend();
QAction *openGLAuto = new QAction(i18n("Auto"), this);
openGLAuto->setData(0);
openGLAuto->setCheckable(true);
openGLAuto->setChecked(glBackend == 0);
QAction *openGLDesktop = new QAction(i18n("Desktop OpenGL"), this);
openGLDesktop->setData(Qt::AA_UseDesktopOpenGL);
openGLDesktop->setCheckable(true);
openGLDesktop->setChecked(glBackend == Qt::AA_UseDesktopOpenGL);
QAction *openGLES = new QAction(i18n("OpenGLES"), this);
openGLES->setData(Qt::AA_UseOpenGLES);
openGLES->setCheckable(true);
openGLES->setChecked(glBackend == Qt::AA_UseOpenGLES);
QAction *openGLSoftware = new QAction(i18n("Software OpenGL"), this);
openGLSoftware->setData(Qt::AA_UseSoftwareOpenGL);
openGLSoftware->setCheckable(true);
openGLSoftware->setChecked(glBackend == Qt::AA_UseSoftwareOpenGL);
addAction(QStringLiteral("opengl_auto"), openGLAuto);
addAction(QStringLiteral("opengl_desktop"), openGLDesktop);
addAction(QStringLiteral("opengl_es"), openGLES);
addAction(QStringLiteral("opengl_software"), openGLSoftware);
#endif
addAction(QStringLiteral("run_wizard"), i18n("Run Config Wizard"), this, SLOT(slotRunWizard()), QIcon::fromTheme(QStringLiteral("tools-wizard")));
addAction(QStringLiteral("project_settings"), i18n("Project Settings"), this, SLOT(slotEditProjectSettings()),
QIcon::fromTheme(QStringLiteral("configure")));
......@@ -3098,6 +3138,7 @@ void MainWindow::buildDynamicActions()
connect(action, &QAction::triggered,
[&]() { pCore->jobManager()->startJob<SpeedJob>(pCore->bin()->selectedClipsIds(), {}, i18n("Change clip speed")); });
}
// TODO refac reimplement analyseclipjob
/*
QAction *action = new QAction(i18n("Analyse keyframes"), m_extraFactory->actionCollection());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment