mirror of
https://github.com/LMMS/lmms.git
synced 2026-01-26 23:38:10 -05:00
Try to improve embedding method logic
This commit is contained in:
@@ -210,6 +210,7 @@ public:
|
||||
return m_recentlyOpenedProjects;
|
||||
}
|
||||
|
||||
static QStringList availabeVstEmbedMethods();
|
||||
QString vstEmbedMethod() const;
|
||||
|
||||
// returns true if the working dir (e.g. ~/lmms) exists on disk
|
||||
|
||||
@@ -190,19 +190,34 @@ QString ConfigManager::defaultVersion() const
|
||||
return LMMS_VERSION;
|
||||
}
|
||||
|
||||
QString ConfigManager::vstEmbedMethod() const
|
||||
QStringList ConfigManager::availabeVstEmbedMethods()
|
||||
{
|
||||
QString defaultMethod = "qt";
|
||||
QStringList methods;
|
||||
methods.append("none");
|
||||
#if QT_VERSION >= 0x050100
|
||||
methods.append("qt");
|
||||
#endif
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
methods.append("win32");
|
||||
#endif
|
||||
#ifdef LMMS_BUILD_LINUX
|
||||
if (QX11Info::isPlatformX11()) {
|
||||
defaultMethod = "xembed";
|
||||
#if QT_VERSION >= 0x050000
|
||||
if (static_cast<QGuiApplication*>(QApplication::instance())->
|
||||
platformName() == "xcb")
|
||||
#else
|
||||
if (qgetenv("QT_QPA_PLATFORM").isNull()
|
||||
|| qgetenv("QT_QPA_PLATFORM") == "xcb")
|
||||
#endif
|
||||
{
|
||||
methods.append("xembed");
|
||||
}
|
||||
#endif
|
||||
return methods;
|
||||
}
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
defaultMethod = "win32";
|
||||
#endif
|
||||
|
||||
QString ConfigManager::vstEmbedMethod() const
|
||||
{
|
||||
QString defaultMethod = *(availabeVstEmbedMethods().end() - 1);
|
||||
return value( "ui", "vstembedmethod", defaultMethod );
|
||||
}
|
||||
|
||||
|
||||
@@ -342,20 +342,21 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
|
||||
embed_tw->setFixedHeight( 48 );
|
||||
m_vstEmbedComboBox = new QComboBox( embed_tw );
|
||||
m_vstEmbedComboBox->move( XDelta, YDelta );
|
||||
|
||||
QStringList embedMethods = ConfigManager::availabeVstEmbedMethods();
|
||||
m_vstEmbedComboBox->addItem( tr( "No embedding" ), "none" );
|
||||
#if QT_VERSION >= 0x050100
|
||||
m_vstEmbedComboBox->addItem( tr( "Embed using Qt API" ), "qt" );
|
||||
#endif
|
||||
|
||||
#ifdef LMMS_BUILD_WIN32
|
||||
m_vstEmbedComboBox->addItem( tr( "Embed using native Win32 API" ), "win32" );
|
||||
#endif
|
||||
|
||||
#ifdef LMMS_BUILD_LINUX
|
||||
if ( QX11Info::isPlatformX11() ) {
|
||||
if( embedMethods.contains("qt") )
|
||||
{
|
||||
m_vstEmbedComboBox->addItem( tr( "Embed using Qt API" ), "qt" );
|
||||
}
|
||||
if( embedMethods.contains("win32") )
|
||||
{
|
||||
m_vstEmbedComboBox->addItem( tr( "Embed using native Win32 API" ), "win32" );
|
||||
}
|
||||
if( embedMethods.contains("xembed") )
|
||||
{
|
||||
m_vstEmbedComboBox->addItem( tr( "Embed using XEmbed protocol" ), "xembed" );
|
||||
}
|
||||
#endif
|
||||
m_vstEmbedComboBox->setCurrentIndex( m_vstEmbedComboBox->findData( m_vstEmbedMethod ) );
|
||||
|
||||
TabWidget * lang_tw = new TabWidget( tr( "LANGUAGE" ), general );
|
||||
|
||||
Reference in New Issue
Block a user