void PluginCreator::runClicked() { log->clear(); QDeclarativeEngine* qml = mscore->qml(); connect(qml, SIGNAL(warnings(const QList<QDeclarativeError>&)), SLOT(qmlWarnings(const QList<QDeclarativeError>&))); item = 0; QDeclarativeComponent component(qml); component.setData(textEdit->toPlainText().toUtf8(), QUrl()); QObject* obj = component.create(); if (obj == 0) { msg("creating component failed\n"); foreach(QDeclarativeError e, component.errors()) msg(QString(" line %1: %2\n").arg(e.line()).arg(e.description())); stop->setEnabled(false); return; } qInstallMsgHandler(qmlMsgHandler); stop->setEnabled(true); run->setEnabled(false); item = qobject_cast<QmlPlugin*>(obj); view = new QDeclarativeView; view->setResizeMode(QDeclarativeView::SizeViewToRootObject); // view->setResizeMode(QDeclarativeView::SizeRootObjectToView); QGraphicsObject* go = qobject_cast<QGraphicsObject*>(item); view->scene()->addItem(go); view->show(); if (item->pluginType() == "dock") { dock = new QDockWidget("Plugin", 0); dock->setAttribute(Qt::WA_DeleteOnClose); dock->setWidget(view); Qt::DockWidgetArea area = Qt::RightDockWidgetArea; if (item->dockArea() == "left") area = Qt::LeftDockWidgetArea; else if (item->dockArea() == "top") area = Qt::TopDockWidgetArea; else if (item->dockArea() == "bottom") area = Qt::BottomDockWidgetArea; addDockWidget(area, dock); } view->raise(); view->setAttribute(Qt::WA_DeleteOnClose); connect(qml, SIGNAL(quit()), SLOT(closePlugin())); connect(view, SIGNAL(destroyed()), SLOT(closePlugin())); if (dock) connect(dock, SIGNAL(destroyed()), SLOT(closePlugin())); if (mscore->currentScore()) mscore->currentScore()->startCmd(); item->runPlugin(); if (mscore->currentScore()) mscore->currentScore()->endCmd(); mscore->endCmd(); }
void vestigeInstrument::loadFile( const QString & _file ) { m_pluginMutex.lock(); const bool set_ch_name = ( m_plugin != NULL && instrumentTrack()->name() == m_plugin->name() ) || instrumentTrack()->name() == InstrumentTrack::tr( "Default preset" ) || instrumentTrack()->name() == displayName(); m_pluginMutex.unlock(); if ( m_plugin != NULL ) { closePlugin(); } m_pluginDLL = _file; textFloat * tf = textFloat::displayMessage( tr( "Loading plugin" ), tr( "Please wait while loading VST-plugin..." ), PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 ); m_pluginMutex.lock(); m_plugin = new VstPlugin( m_pluginDLL ); if( m_plugin->failed() ) { m_pluginMutex.unlock(); closePlugin(); delete tf; QMessageBox::information( 0, tr( "Failed loading VST-plugin" ), tr( "The VST-plugin %1 could not " "be loaded for some reason.\n" "If it runs with other VST-" "software under Linux, please " "contact an LMMS-developer!" ).arg( m_pluginDLL ), QMessageBox::Ok ); return; } m_plugin->showEditor( NULL, false ); if( set_ch_name ) { instrumentTrack()->setName( m_plugin->name() ); } m_pluginMutex.unlock(); emit dataChanged(); delete tf; }
void VstEffect::openPlugin( const QString & _plugin ) { textFloat * tf = textFloat::displayMessage( VstPlugin::tr( "Loading plugin" ), VstPlugin::tr( "Please wait while loading VST plugin..." ), PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 ); m_pluginMutex.lock(); m_plugin = new VstPlugin( _plugin ); if( m_plugin->failed() ) { m_pluginMutex.unlock(); closePlugin(); delete tf; QMessageBox::information( NULL, VstPlugin::tr( "Failed loading VST plugin" ), VstPlugin::tr( "The VST plugin %1 could not be loaded for some reason." ).arg( _plugin ), QMessageBox::Ok ); return; } VstPlugin::connect( engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), m_plugin, SLOT( setTempo( bpm_t ) ) ); m_plugin->setTempo( engine::getSong()->getTempo() ); m_pluginMutex.unlock(); delete tf; m_key.attributes["file"] = _plugin; }
void VstEffect::openPlugin( const QString & _plugin ) { TextFloat * tf = TextFloat::displayMessage( VstPlugin::tr( "Loading plugin" ), VstPlugin::tr( "Please wait while loading VST plugin..." ), PLUGIN_NAME::getIconPixmap( "logo", 24, 24 ), 0 ); m_pluginMutex.lock(); m_plugin = new VstPlugin( _plugin ); if( m_plugin->failed() ) { m_pluginMutex.unlock(); closePlugin(); delete tf; collectErrorForUI( VstPlugin::tr( "The VST plugin %1 could not be loaded." ).arg( _plugin ) ); return; } VstPlugin::connect( Engine::getSong(), SIGNAL( tempoChanged( bpm_t ) ), m_plugin, SLOT( setTempo( bpm_t ) ) ); m_plugin->setTempo( Engine::getSong()->getTempo() ); m_pluginMutex.unlock(); delete tf; m_key.attributes["file"] = _plugin; }
/** * returns paintViewPort **/ nmc::DkPluginViewPort* DkNikonPlugin::getViewPort() { if (!viewport) { // >DIR: dummy viewport [4.7.2014 markus] viewport = new DkNikonViewPort(); } if (!maidFacade) { QMainWindow* mainWindow = getMainWindow(); maidFacade = new MaidFacade(mainWindow); if (maidFacade->init()) { if (!camControls) { // get last location QSettings settings; int dockLocation = settings.value("camControlsLocation", Qt::RightDockWidgetArea).toInt(); camControls = new DkCamControls(maidFacade, tr("Camera Controls")); if (mainWindow) mainWindow->addDockWidget((Qt::DockWidgetArea)dockLocation, camControls); connect(camControls, SIGNAL(updateImage(QImage)), getViewPort(), SIGNAL(loadImage(QImage))); connect(camControls, SIGNAL(loadFile(QFileInfo)), getViewPort(), SIGNAL(loadFile(QFileInfo))); connect(camControls, SIGNAL(closeSignal()), getViewPort(), SIGNAL(closePlugin())); } camControls->setVisible(true); } else { QMessageBox warningDialog(mainWindow); warningDialog.setWindowTitle(tr("MAID Library could not be opened")); warningDialog.setText(tr("The MAID library could not be opened. Camera controls will be disabled.")); warningDialog.setIcon(QMessageBox::Warning); warningDialog.setStandardButtons(QMessageBox::Ok); warningDialog.setDefaultButton(QMessageBox::Ok); warningDialog.show(); warningDialog.exec(); return 0; } } return viewport; }
vestigeInstrument::~vestigeInstrument() { if (p_subWindow != NULL) { delete p_subWindow; p_subWindow = NULL; } if (knobFModel != NULL) { delete []knobFModel; knobFModel = NULL; } engine::mixer()->removePlayHandles( instrumentTrack() ); closePlugin(); }
bool Scripting::reloadPlugin(const QString &pluginName, bool isQuiet) { auto actionStr = "reload"; if (!closePlugin(pluginName, isQuiet)) { return pluginActionError(actionStr, pluginName, "close failed", isQuiet); } if (isPluginImported(pluginName)) { if (!evalScript(QString("reload(%1) != None").arg(getImportInContainerStr(pluginName)), Py_eval_input).toBool()) { return pluginActionError(actionStr, pluginName, "reload failed", isQuiet); } } if (!openPlugin(pluginName, isQuiet)) { return pluginActionError(actionStr, pluginName, "open failed", isQuiet); } return true; }
void PluginCreator::stopClicked() { closePlugin(); }
void PluginCreator::runClicked() { log->clear(); QQmlEngine* qml = Ms::MScore::qml(); connect(qml, SIGNAL(warnings(const QList<QQmlError>&)), SLOT(qmlWarnings(const QList<QQmlError>&))); item = 0; QQmlComponent component(qml); component.setData(textEdit->toPlainText().toUtf8(), QUrl()); QObject* obj = component.create(); if (obj == 0) { msg("creating component failed\n"); foreach(QQmlError e, component.errors()) msg(QString(" line %1: %2\n").arg(e.line()).arg(e.description())); stop->setEnabled(false); return; } qInstallMsgHandler(qmlMsgHandler); stop->setEnabled(true); run->setEnabled(false); item = qobject_cast<QmlPlugin*>(obj); if (item->pluginType() == "dock" || item->pluginType() == "dialog") { view = new QQuickView(qml, 0); view->setTitle(item->menuPath().mid(item->menuPath().lastIndexOf(".") + 1)); view->setColor(QApplication::palette().color(QPalette::Window)); view->setResizeMode(QQuickView::SizeRootObjectToView); view->setWidth(item->width()); view->setHeight(item->height()); item->setParentItem(view->contentItem()); if (item->pluginType() == "dock") { dock = new QDockWidget("Plugin", 0); dock->setAttribute(Qt::WA_DeleteOnClose); dock->setWidget(QWidget::createWindowContainer(view)); dock->widget()->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding)); Qt::DockWidgetArea area = Qt::RightDockWidgetArea; if (item->dockArea() == "left") area = Qt::LeftDockWidgetArea; else if (item->dockArea() == "top") area = Qt::TopDockWidgetArea; else if (item->dockArea() == "bottom") area = Qt::BottomDockWidgetArea; addDockWidget(area, dock); connect(dock, SIGNAL(destroyed()), SLOT(closePlugin())); dock->widget()->setAttribute(Qt::WA_DeleteOnClose); } view->show(); view->raise(); connect(view, SIGNAL(destroyed()), SLOT(closePlugin())); } connect(qml, SIGNAL(quit()), SLOT(closePlugin())); if (mscore->currentScore() && item->pluginType() != "dock") mscore->currentScore()->startCmd(); item->runPlugin(); if (mscore->currentScore() && item->pluginType() != "dock") mscore->currentScore()->endCmd(); mscore->endCmd(); }
VstEffect::~VstEffect() { closePlugin(); }
void DkPaintViewPort::discardChangesAndClose() { cancelTriggered = true; emit closePlugin(); }
void DkPaintViewPort::applyChangesAndClose() { cancelTriggered = false; emit closePlugin(); }
InputPlugin::~InputPlugin() { closePlugin(); unloadPlugin(); }