Add a method to check if gtk integration is forced

This commit is contained in:
Ilya Fedin 2020-06-01 12:25:37 +04:00 committed by John Preston
parent 368eeaf754
commit 47d7bd95ae
2 changed files with 15 additions and 0 deletions

View File

@ -263,6 +263,20 @@ bool IsStaticBinary() {
#endif // !DESKTOP_APP_USE_PACKAGED
}
bool IsGtkIntegrationForced() {
#ifndef TDESKTOP_DISABLE_GTK_INTEGRATION
static const auto GtkIntegration = [&] {
const auto platformThemes = QString::fromUtf8(qgetenv("QT_QPA_PLATFORMTHEME")).split(':');
return platformThemes.contains(qstr("gtk3"), Qt::CaseInsensitive)
|| platformThemes.contains(qstr("gtk2"), Qt::CaseInsensitive);
}();
return GtkIntegration;
#endif // !TDESKTOP_DISABLE_GTK_INTEGRATION
return false;
}
bool IsGtkFileDialogForced() {
#ifdef TDESKTOP_FORCE_GTK_FILE_DIALOG
return true;

View File

@ -24,6 +24,7 @@ bool InSandbox();
bool InSnap();
bool InAppImage();
bool IsStaticBinary();
bool IsGtkIntegrationForced();
bool IsGtkFileDialogForced();
bool IsQtPluginsBundled();