Merge pull request #3786 from LMMS/fix/qt5-vst

Add all the Qt5 Linux VST implementations
This commit is contained in:
Lukas W
2017-12-18 22:15:45 +01:00
committed by GitHub
26 changed files with 703 additions and 506 deletions

View File

@@ -1,4 +1,9 @@
set(CMAKE_C_FLAGS "")
set(CMAKE_CXX_FLAGS "")
IF(QT5 AND LMMS_BUILD_LINUX)
set(BUILD_SHARED_LIBS OFF)
add_subdirectory(qt5-x11embed)
ENDIF()
ADD_SUBDIRECTORY(rpmalloc)

1
src/3rdparty/qt5-x11embed vendored Submodule

View File

@@ -134,7 +134,7 @@ IF(LMMS_BUILD_HAIKU)
SET(EXTRA_LIBRARIES "-lnetwork")
ENDIF()
SET(LMMS_REQUIRED_LIBS
SET(LMMS_REQUIRED_LIBS ${LMMS_REQUIRED_LIBS}
${CMAKE_THREAD_LIBS_INIT}
${QT_LIBRARIES}
${ASOUND_LIBRARY}

View File

@@ -186,6 +186,39 @@ QString ConfigManager::defaultVersion() const
return LMMS_VERSION;
}
QStringList ConfigManager::availabeVstEmbedMethods()
{
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 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;
}
QString ConfigManager::vstEmbedMethod() const
{
QStringList methods = availabeVstEmbedMethods();
QString defaultMethod = *(methods.end() - 1);
QString currentMethod = value( "ui", "vstembedmethod", defaultMethod );
return methods.contains(currentMethod) ? currentMethod : defaultMethod;
}
bool ConfigManager::hasWorkingDir() const
{
return QDir( m_workingDir ).exists();
@@ -336,12 +369,15 @@ void ConfigManager::setValue( const QString & cls,
{
if( m_settings.contains( cls ) )
{
for( stringPairVector::iterator it = m_settings[cls].begin();
it != m_settings[cls].end(); ++it )
for( QPair<QString, QString>& pair : m_settings[cls])
{
if( ( *it ).first == attribute )
if( pair.first == attribute )
{
( *it ).second = value;
if ( pair.second != value )
{
pair.second = value;
emit valueChanged( cls, attribute, value );
}
return;
}
}

View File

@@ -164,8 +164,8 @@ RemotePlugin::~RemotePlugin()
bool RemotePlugin::init( const QString &pluginExecutable,
bool waitForInitDoneMsg )
bool RemotePlugin::init(const QString &pluginExecutable,
bool waitForInitDoneMsg , QStringList extraArgs)
{
lock();
if( m_failed )
@@ -208,6 +208,7 @@ bool RemotePlugin::init( const QString &pluginExecutable,
#else
args << m_socketFile;
#endif
args << extraArgs;
#ifndef DEBUG_REMOTE_PLUGIN
m_process.setProcessChannelMode( QProcess::ForwardedChannels );
m_process.setWorkingDirectory( QCoreApplication::applicationDirPath() );
@@ -392,6 +393,20 @@ void RemotePlugin::processMidiEvent( const MidiEvent & _e,
unlock();
}
void RemotePlugin::showUI()
{
lock();
sendMessage( IdShowUI );
unlock();
}
void RemotePlugin::hideUI()
{
lock();
sendMessage( IdHideUI );
unlock();
}

View File

@@ -67,8 +67,6 @@
#include "MidiApple.h"
#include "MidiDummy.h"
inline void labelWidget( QWidget * _w, const QString & _txt )
{
QLabel * title = new QLabel( _txt, _w );
@@ -137,12 +135,13 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
m_displayWaveform(ConfigManager::inst()->value( "ui",
"displaywaveform").toInt() ),
m_disableAutoQuit(ConfigManager::inst()->value( "ui",
"disableautoquit").toInt() )
"disableautoquit").toInt() ),
m_vstEmbedMethod( ConfigManager::inst()->vstEmbedMethod() )
{
setWindowIcon( embed::getIconPixmap( "setup_general" ) );
setWindowTitle( tr( "Setup LMMS" ) );
setModal( true );
setFixedSize( 452, 520 );
setFixedSize( 452, 570 );
Engine::projectJournal()->setJournalling( false );
@@ -159,7 +158,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
m_tabBar->setFixedWidth( 72 );
QWidget * ws = new QWidget( settings );
int wsHeight = 370;
int wsHeight = 420;
#ifdef LMMS_HAVE_STK
wsHeight += 50;
#endif
@@ -168,7 +167,7 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
#endif
ws->setFixedSize( 360, wsHeight );
QWidget * general = new QWidget( ws );
general->setFixedSize( 360, 240 );
general->setFixedSize( 360, 290 );
QVBoxLayout * gen_layout = new QVBoxLayout( general );
gen_layout->setSpacing( 0 );
gen_layout->setMargin( 0 );
@@ -335,6 +334,27 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
misc_tw->setFixedHeight( YDelta*labelNumber + HeaderSize );
TabWidget* embed_tw = new TabWidget( tr( "PLUGIN EMBEDDING" ), general);
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( 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" );
}
m_vstEmbedComboBox->setCurrentIndex( m_vstEmbedComboBox->findData( m_vstEmbedMethod ) );
TabWidget * lang_tw = new TabWidget( tr( "LANGUAGE" ), general );
lang_tw->setFixedHeight( 48 );
QComboBox * changeLang = new QComboBox( lang_tw );
@@ -380,13 +400,15 @@ SetupDialog::SetupDialog( ConfigTabs _tab_to_open ) :
gen_layout->addSpacing( 10 );
gen_layout->addWidget( misc_tw );
gen_layout->addSpacing( 10 );
gen_layout->addWidget( embed_tw );
gen_layout->addSpacing( 10 );
gen_layout->addWidget( lang_tw );
gen_layout->addStretch();
QWidget * paths = new QWidget( ws );
int pathsHeight = 370;
int pathsHeight = 420;
#ifdef LMMS_HAVE_STK
pathsHeight += 55;
#endif
@@ -1001,6 +1023,20 @@ SetupDialog::~SetupDialog()
void SetupDialog::accept()
{
if( m_warnAfterSetup )
{
QMessageBox::information( NULL, tr( "Restart LMMS" ),
tr( "Please note that most changes "
"won't take effect until "
"you restart LMMS!" ),
QMessageBox::Ok );
}
// Hide dialog before setting values. This prevents an obscure bug
// where non-embedded VST windows would steal focus and prevent LMMS
// from taking mouse input, rendering the application unusable.
QDialog::accept();
ConfigManager::inst()->setValue( "mixer", "framesperaudiobuffer",
QString::number( m_bufferSize ) );
ConfigManager::inst()->setValue( "mixer", "audiodev",
@@ -1044,6 +1080,12 @@ void SetupDialog::accept()
ConfigManager::inst()->setValue( "ui", "disableautoquit",
QString::number( m_disableAutoQuit ) );
ConfigManager::inst()->setValue( "app", "language", m_lang );
ConfigManager::inst()->setValue( "ui", "vstembedmethod",
#if QT_VERSION >= 0x050000
m_vstEmbedComboBox->currentData().toString() );
#else
m_vstEmbedComboBox->itemData(m_vstEmbedComboBox->currentIndex()).toString() );
#endif
ConfigManager::inst()->setWorkingDir(QDir::fromNativeSeparators(m_workingDir));
@@ -1074,16 +1116,6 @@ void SetupDialog::accept()
}
ConfigManager::inst()->saveConfigFile();
QDialog::accept();
if( m_warnAfterSetup )
{
QMessageBox::information( NULL, tr( "Restart LMMS" ),
tr( "Please note that most changes "
"won't take effect until "
"you restart LMMS!" ),
QMessageBox::Ok );
}
}

View File

@@ -97,7 +97,10 @@ void SubWindow::paintEvent( QPaintEvent * )
{
QPainter p( this );
QRect rect( 0, 0, width(), m_titleBarHeight );
bool isActive = SubWindow::mdiArea()->activeSubWindow() == this;
bool isActive = mdiArea()
? mdiArea()->activeSubWindow() == this
: false;
p.fillRect( rect, isActive ? activeColor() : p.pen().brush() );