#include "mapplugin.h"

#include "mapview.h"
#include "mapview_tile_provider_osm.h"

#include <QtCore/QtPlugin>


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


void MapPlugin::initialize(QDesignerFormEditorInterface * /* core */) {
	if (m_initialized) return;

	// Add extension registrations, etc. here

	m_initialized = true;
}


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


QWidget * MapPlugin::createWidget(QWidget * parent) {
	MapView * w = new MapView(parent);
	w->setTileProvider(new MapViewTileProvider_OSM());
	return w;
}


QString MapPlugin::name() const {
	return QLatin1String("MapView");
}


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


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


QString MapPlugin::toolTip() const {
	return QLatin1String("");
}


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


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


QString MapPlugin::domXml() const {
	return QLatin1String("<widget class=\"MapView\" name=\"map\">\n</widget>\n");
}


QString MapPlugin::includeFile() const {
	return QLatin1String("mapview.h");
}
