#include "graphicplugin.h"

#include "graphic.h"

#include <QtPlugin>


GraphicPlugin::GraphicPlugin(QObject * parent): QObject(parent) {
	m_initialized = m_designer = false;
}


void GraphicPlugin::initialize(QDesignerFormEditorInterface *) {
	m_designer = true;
	if (m_initialized) return;
	m_initialized = true;
}


bool GraphicPlugin::isInitialized() const {
	return m_initialized;
}


QWidget * GraphicPlugin::createWidget(QWidget * parent) {
	auto ret = new Graphic(parent);
	if (m_designer) ret->m_fakeGL = true;
	return ret;
}


QString GraphicPlugin::name() const {
	return QLatin1String("Graphic");
}


QString GraphicPlugin::group() const {
	return QLatin1String("Display Widgets");
}


QIcon GraphicPlugin::icon() const {
	return QIcon(":/icons/widgets/graphic.png");
}


QString GraphicPlugin::toolTip() const {
	return QLatin1String(""); // QLatin1String("Widget for display any math graphics with grid and navigation");
}


QString GraphicPlugin::whatsThis() const {
	return QLatin1String("");
}


bool GraphicPlugin::isContainer() const {
	return false;
}


QString GraphicPlugin::domXml() const {
	return QLatin1String("<widget class=\"Graphic\" name=\"graphic\">\n</widget>\n");
}


QString GraphicPlugin::includeFile() const {
	return QLatin1String("graphic.h");
}
