CarlaInstrumentView::CarlaInstrumentView(CarlaInstrument* const instrument, QWidget* const parent) : InstrumentView(instrument, parent), fHandle(instrument->fHandle), fDescriptor(instrument->fDescriptor), fTimerId(fHandle != NULL && fDescriptor->ui_idle != NULL ? startTimer(30) : 0) { setAutoFillBackground(true); QPalette pal; pal.setBrush(backgroundRole(), instrument->kIsPatchbay ? PLUGIN_NAME::getIconPixmap("artwork-patchbay") : PLUGIN_NAME::getIconPixmap("artwork-rack")); setPalette(pal); QVBoxLayout * l = new QVBoxLayout( this ); l->setContentsMargins( 20, 180, 10, 10 ); l->setSpacing( 10 ); m_toggleUIButton = new QPushButton( tr( "Show GUI" ), this ); m_toggleUIButton->setCheckable( true ); m_toggleUIButton->setChecked( false ); m_toggleUIButton->setIcon( embed::getIconPixmap( "zoom" ) ); m_toggleUIButton->setFont( pointSize<8>( m_toggleUIButton->font() ) ); connect( m_toggleUIButton, SIGNAL( clicked(bool) ), this, SLOT( toggleUI( bool ) ) ); m_toggleUIButton->setWhatsThis( tr( "Click here to show or hide the graphical user interface (GUI) of Carla." ) ); l->addWidget( m_toggleUIButton ); l->addStretch(); connect(instrument, SIGNAL(uiClosed()), this, SLOT(uiClosed())); }
void uiShow(const bool show) override { if (show) { if (isPipeRunning()) { writeFocusMessage(); return; } carla_stdout("Trying to start UI using \"%s\"", fExtUiPath.buffer()); CarlaExternalUI::setData(fExtUiPath, getSampleRate(), getUiName()); if (! CarlaExternalUI::startPipeServer(true)) { uiClosed(); hostUiUnavailable(); } } else { CarlaExternalUI::stopPipeServer(2000); } }
void uiIdle() override { CarlaExternalUI::idlePipe(); switch (CarlaExternalUI::getAndResetUiState()) { case CarlaExternalUI::UiNone: case CarlaExternalUI::UiShow: break; case CarlaExternalUI::UiCrashed: uiClosed(); hostUiUnavailable(); break; case CarlaExternalUI::UiHide: uiClosed(); CarlaExternalUI::stopPipeServer(1000); break; } }
void uiShow(const bool show) override { if (! show) return; if (const char* const filename = uiOpenFile(false, "Open Audio File", "")) uiCustomDataChanged("file", filename); uiClosed(); }
void uiIdle() override { CarlaExternalUI::idle(); if (! CarlaExternalUI::isOk()) return; switch (CarlaExternalUI::getAndResetUiState()) { case CarlaExternalUI::UiNone: case CarlaExternalUI::UiShow: break; case CarlaExternalUI::UiCrashed: hostUiUnavailable(); break; case CarlaExternalUI::UiHide: uiClosed(); CarlaExternalUI::stop(); break; } }
void CarlaInstrument::handleUiClosed() { emit uiClosed(); }