Exemple #1
0
	void click(int x,int y)
	{
		if(clicked(x,y))
		{
			if(ei.getNumberOfMoves()>0)
				ei.setNumberOfMoves(ei.getNumberOfMoves()-1);
		}
	}
void SuggestToCreateDiagramWidget::addItem(Id const &editor, Id const &diagram)
{
	EditorInterface *editorInterface = mMainWindow->manager()->editorInterface(editor.editor());

	QString const diagramName = editorInterface->diagramName(diagram.diagram());
	QString const diagramNodeName = editorInterface->diagramNodeName(diagram.diagram());

	if (diagramNodeName.isEmpty()) {
		return;
	}
	ListWidget::addItem(diagramName
			, "qrm:/" + editor.editor() + "/" + diagram.diagram() + "/" + diagramNodeName
			, tr("editor: ") + editor.editor() + tr(", diagram: ") + diagram.diagram());
}
Exemple #3
0
	void click(int x,int y)
	{
		if(clicked(x,y))
		{
			ei.moveBoardBack();
		}
	}
Exemple #4
0
	void click(int x,int y)
	{
		if(clicked(x,y))
		{
			ei.deleteBoard();
		}
	}
Exemple #5
0
	void click(int x,int y)
	{
		if(clicked(x,y))
		{
			ei.newBoard();
		}
	}
Exemple #6
0
QString EditorManager::loadPlugin(QString const &pluginName)
{
	EditorInterface *iEditor = mPluginManager.pluginLoadedByName<EditorInterface>(pluginName).first;
	QString const error = mPluginManager.pluginLoadedByName<EditorInterface>(pluginName).second;

	if (iEditor) {
		mPluginsLoaded += iEditor->id();
		mPluginFileName.insert(iEditor->id(), pluginName);
		mPluginIface[iEditor->id()] = iEditor;
		QLOG_INFO() << "Plugin" << pluginName << "loaded. Version: " << iEditor->version();
		return QString();
	}

	QLOG_WARN() << "Editor plugin" << pluginName << "loading failed: " << error;
	return error;
}
void LoaderDialog::run()
{
	FNTRACE("", "LoaderDialog", "run", "");

	if (mapList->topLevelItemCount() == 0)
		return;

	try {
		setEnabled(false);
		//QDir::setCurrent(ds1editPath);

		EditorInterface* editor = new EditorInterface(this, ds1editPath, ds1editName);
		connect(editor, SIGNAL(finished()), SLOT(enable()));
		connect(editor, SIGNAL(finished()), editor, SLOT(deleteLater()));
		editor->run();
		showOutput();
	} catch (Exception& e) {
		QMessageBox::critical(this, "Error", e.what());
		enable();
	}
}
Exemple #8
0
bool EditorManager::loadPlugin(QString const &pluginName)
{
	QPluginLoader *loader = new QPluginLoader(mPluginsDir.absoluteFilePath(pluginName));
	loader->load();
	QObject *plugin = loader->instance();

	if (plugin) {
		EditorInterface *iEditor = qobject_cast<EditorInterface *>(plugin);
		if (iEditor) {
			mPluginsLoaded += iEditor->id();
			mPluginFileName.insert(iEditor->id(), pluginName);
			mPluginIface[iEditor->id()] = iEditor;
			mLoaders.insert(pluginName, loader);
			return true;
		}
	}

	QMessageBox::warning(NULL, tr("error"), tr("Plugin loading failed: ") + loader->errorString());
	loader->unload();
	delete loader;
	return false;
}
Exemple #9
0
EditorManager::EditorManager(QObject *parent) : QObject(parent)
{
	mPluginsDir = QDir(qApp->applicationDirPath());

	while (!mPluginsDir.isRoot() && !mPluginsDir.entryList(QDir::Dirs).contains("plugins")) {
		mPluginsDir.cdUp();
	}

	mPluginsDir.cd("plugins");

	foreach (QString const &fileName, mPluginsDir.entryList(QDir::Files)) {
		QPluginLoader *loader  = new QPluginLoader(mPluginsDir.absoluteFilePath(fileName));
		QObject *plugin = loader->instance();

		if (plugin) {
			EditorInterface *iEditor = qobject_cast<EditorInterface *>(plugin);
			if (iEditor) {
				mPluginsLoaded += iEditor->id();
				mPluginFileName.insert(iEditor->id(), fileName);
				mPluginIface[iEditor->id()] = iEditor;
				mLoaders.insert(fileName, loader);
			} else {
				// TODO: Just does not work under Linux. Seems to be memory corruption when
				// loading, unloading, and then loading .so file again.
				// To reproduce, uncomment this, build VisualInterpreter, and try to launch QReal.
				// With some tool plugins, like MetaEditorSupport or Exterminatus, works fine,
				// also works fine on Windows. Investigation required.
				// loader->unload();
				delete loader;
			}
		} else {
			qDebug() << "Plugin loading failed: " << loader->errorString();
			loader->unload();
			delete loader;
		}
	}
}