diff --git a/images/designer_widget_icons/projectionselector.png b/images/designer_widget_icons/projectionselector.png new file mode 100644 index 00000000000..8117a8a517f Binary files /dev/null and b/images/designer_widget_icons/projectionselector.png differ diff --git a/images/themes/default/icon_template18x18.xcf b/images/themes/default/icon_template18x18.xcf index 6d86afcde20..42492fa093b 100644 Binary files a/images/themes/default/icon_template18x18.xcf and b/images/themes/default/icon_template18x18.xcf differ diff --git a/src/Makefile.am b/src/Makefile.am index 25a50080166..8b8249b103c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -15,5 +15,5 @@ endif # depend on the existence of libqgis_gui. # gui *must* be specified immediately before the providers # subdirectory. -SUBDIRS = core ui legend raster composer widgets gui providers plugins $(MAC) helpviewer +SUBDIRS = core ui legend raster composer widgets gui providers plugins $(MAC) helpviewer designer diff --git a/src/designer/Makefile.am b/src/designer/Makefile.am index 198a96eb345..2fb77beab34 100644 --- a/src/designer/Makefile.am +++ b/src/designer/Makefile.am @@ -10,22 +10,49 @@ # # $Id: Makefile.am 4490 2006-01-07 01:09:27Z timlinux $ +## +## ---------------------------------------------------------------------- +## Define Targets +## ---------------------------------------------------------------------- +## +lib_LTLIBRARIES= libqgis_designerwidgets.la +## TODO change this so it installs into ${QTDIR}/plugins/designer +libqgis_designerwidgetsdir = ${pkglibdir}/designer -plugindir = ${pkglibdir}/designer +## +## ---------------------------------------------------------------------- +## get Qt4 to run moc and rcc where required... +## ---------------------------------------------------------------------- +## +#run moc on files %.moc.cpp: %.h $(MOC) -o $@ $< -# name of the designer plugin -plugin_LTLIBRARIES = qgisdesignerwidgets.la +#qt resources +%.qrc.cpp: %.qrc + $(RCC) -o $@ $< -qgisdesignerwidgets_la_SOURCES = qgsdesignerwidgets.cpp \ - qgsdesignerwidgets.h \ - $(projectionselector_la_MOC) +libqgis_designerwidgets_la_MOC = qgsprojectionselectorwidget.moc.cpp -qgisdesignerwidgets_la_MOC = qgsprojectionselectorplugin.moc.cpp +libqgis_designerwidgets_RES = qgisdesignerwidgets.qrc.cpp -#projectionselector_la_LIBADD = ../src/gui/libqgis_gui.la $(QT_LDADD) -#qgisdesignerwidgets_la_LIBADD = $(QT_LDADD) ../widgets/projectionselector/libqgsprojectionselector.la -qgisdesignerwidgets_la_LDFLAGS = -avoid-version -module -qgisdesignerwidgets_la_CXXFLAGS = $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(QT_CXXFLAGS) $(DEBUG_QGIS) -I../gui/ -I../legend +libqgis_designerwidgets_QRC = qgisdesignerwidgets.qrc + + +## $(libqgis_designerwidgets_la_MOC) \ +libqgis_designerwidgets_la_SOURCES = qgsprojectionselectorwidget.cpp \ + $(libqgis_designerwidgets_QRC) \ + $(libqgis_designerwidgets_RES) + + +libqgis_designerwidgets_la_LIBADD = $(QT_LDADD) ../widgets/projectionselector/libqgsprojectionselector.la +libqgis_designerwidgets_la_LDFLAGS = -avoid-version -module +libqgis_designerwidgets_la_CXXFLAGS = $(CXXFLAGS) $(EXTRA_CXXFLAGS) $(QT_CXXFLAGS) $(DEBUG_QGIS) -I../gui/ -I../legend -I../core -I../widgets/projectionselector/ + +## +## ---------------------------------------------------------------------- +## additional files that need to be installed go here +## ---------------------------------------------------------------------- +## +libqgis_designerwidgets_HEADERS = qgsprojectionselectorwidget.h diff --git a/src/designer/qgisdesignerwidgets.qrc b/src/designer/qgisdesignerwidgets.qrc new file mode 100644 index 00000000000..016703341d3 --- /dev/null +++ b/src/designer/qgisdesignerwidgets.qrc @@ -0,0 +1,5 @@ + + + ../../images/designer_widget_icons/projectionselector.png + + diff --git a/src/designer/qgsdesignerwidgets.cpp b/src/designer/qgsdesignerwidgets.cpp deleted file mode 100644 index 0827f04e3b0..00000000000 --- a/src/designer/qgsdesignerwidgets.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include "qgsdesignerwidgets.h" -#include -#include -#include -#include "qgslegend.h" -#include "qgsmapcanvas.h" -#include "qgslinestylewidget.h" -#include "qgsfillstylewidget.h" -#include "qgspointstylewidget.h" -#include "qgsvectorsymbologywidget.h" -//Added by qt3to4: -#include -#include -static const char *legend_pixmap[] = { - "22 22 8 1", - " c Gray100", - ". c Gray97", - "X c #4f504f", - "o c #00007f", - "O c Gray0", - "+ c none", - "@ c Gray0", - "# c Gray0", - "++++++++++++++++++++++", - "++++++++++++++++++++++", - "++++++++++++++++++++++", - "++++++++++++++++++++++", - "+OOOOOOOOOOOOOOOOOOOO+", - "OOXXXXXXXXXXXXXXXXXXOO", - "OXX. O", - "OX. ooooooooo O", - "OX. o o .O", - "OX o o O", - "OX o o O", - "O o o O", - "OX o o o O", - "OX o o o O", - "OX o o O", - "OX ooooooooo o O", - "OO..................OO", - "+OOOOOOOOOOOOOOOOOOOO+", - "++++++++++++++++++++++", - "++++++++++++++++++++++", - "++++++++++++++++++++++", - "++++++++++++++++++++++" -}; - -//shamelessly snarfed from qwt stuff - a very nice simple neat way to -//accommodate building multiple widgets...Tim -namespace -{ - struct Entry - { - Entry() {} - Entry( QString theClassname, QString theHeader, QString thePixmap, - QString theTooltip, QString theWhatsThisString): - classname(theClassname), - header(theHeader), - pixmap(thePixmap), - tooltip(theTooltip), - whatshis(theWhatsThisString) - {} - - QString classname; - QString header; - QString pixmap; - QString tooltip; - QString whatshis; - }; - - Q3ValueList mEntriesVector; - - const Entry *entry(const QString& theString) - { - for ( uint i = 0; i < mEntriesVector.count(); i++ ) - { - if (theString == mEntriesVector[i].classname) - return &mEntriesVector[i]; - } - return NULL; - } -} - - QgsDesignerWidgets::QgsDesignerWidgets(QObject *parent) -: QObject(parent) - -{ - mInitialized = false; - - mEntriesVector.append(Entry("QgsLegend", "qgslegend.h", - "", "A legend widget that shows layers associated with a mapcanvas.", "A legend widget that shows layers associated with a mapcanvas")); - mEntriesVector.append(Entry("QgsMapCanvas", "qgsmapcanvas.h", - "", "A map canvas widget", "A map canvas is an interactive map that can be panned and zoomed.")); - mEntriesVector.append(Entry("QgsLineStyleWidget", "qgslinestylewidget.h", - "", "A widget that lets you select a line style.", "A widget that lets you select a line style")); - mEntriesVector.append(Entry("QgsFillStyleWidget", "qgsfillstylewidget.h", - "", "A widget that lets you select a fill style.", "A widget that lets you select a fill style")); - mEntriesVector.append(Entry("QgsPointStyleWidget", "qgspointstylewidget.h", - "", "A widget that lets you select a point style.", "A widget that lets you select a point style")); - mEntriesVector.append(Entry("QgsVectorSymbologyWidget", "QgsVectorSymbologyWidget", - "", "A widget that lets you select vector symbology.", "A widget that lets you select vector symbology")); -} - - -void QgsDesignerWidgets::initialize(QDesignerFormEditorInterface * core ) -{ - if (mInitialized) - return; - - mInitialized = true; -} - -bool QgsDesignerWidgets::isInitialized() const -{ - return mInitialized; -} - -QWidget* QgsDesignerWidgets::create(const QString &key, - QWidget* parent, const char* name) -{ - if ( key == "QgsLegend" ) - return new QgsLegend( parent, name ); - else if ( key == "QgsMapCanvas" ) - return new QgsMapCanvas ( parent, name ); - else if ( key == "QgsLineStyleWidget" ) - return new QgsLineStyleWidget ( parent, name ); - else if ( key == "QgsFillStyleWidget" ) - return new QgsFillStyleWidget ( parent, name ); - else if ( key == "QgsPointStyleWidget" ) - return new QgsPointStyleWidget ( parent, name ); - else if ( key == "QgsVectorSymbologyWidget" ) - return new QgsVectorSymbologyWidget( parent, name ); - return 0; -} - - -QStringList QgsDesignerWidgets::keys() const -{ - QStringList list; - - for (unsigned i = 0; i < mEntriesVector.count(); i++) - list += mEntriesVector[i].classname; - - return list; -} - -QString QgsDesignerWidgets::group( const QString& feature ) const -{ - if (entry(feature) != NULL ) - return QString("QGIS"); - return QString::null; -} - -QIcon QgsDesignerWidgets::iconSet( const QString& thePixmap) const -{ - QString pixmapKey("qwtwidget.png"); - if (entry(thePixmap) != NULL ) - pixmapKey = entry(thePixmap)->pixmap; - - const QMimeSource *ms = - Q3MimeSourceFactory::defaultFactory()->data(pixmapKey); - - QPixmap pixmap; - Q3ImageDrag::decode(ms, pixmap); - - return QIcon(pixmap); -} - -QString QgsDesignerWidgets::includeFile( const QString& feature ) const -{ - if (entry(feature) != NULL) - return entry(feature)->header; - return QString::null; -} - -QString QgsDesignerWidgets::toolTip( const QString& feature ) const -{ - if (entry(feature) != NULL ) - return entry(feature)->tooltip; - return QString::null; -} - -QString QgsDesignerWidgets::whatsThis( const QString& feature ) const -{ - if (entry(feature) != NULL) - return entry(feature)->whatshis; - return QString::null; -} - -bool QgsDesignerWidgets::isContainer( const QString& ) const -{ - return FALSE; -} - -/* - The Q_EXPORT_PLUGIN macro. - Q_EXPORT_PLUGIN( CustomWidgetPlugin ) - This macro identifies the module as a plugin -- all the other code simply - implements the relevant interface, i.e. wraps the classes you wish to make available. - This macro must appear once in your plugin. It should be copied with the class name - changed to the name of your plugin's class. (See the Qt Plugin documentation for more - information on the plugin entry point.) - Each widget you wrap in a widget plugin implementation becomes a class that the - plugin implementation offers. There is no limit to the number of classes that you - may include in an plugin implementation. - */ -Q_EXPORT_PLUGIN( QgsDesignerWidgets ) diff --git a/src/designer/qgsdesignerwidgets.h b/src/designer/qgsdesignerwidgets.h deleted file mode 100644 index 3123d7c047e..00000000000 --- a/src/designer/qgsdesignerwidgets.h +++ /dev/null @@ -1,23 +0,0 @@ -#include - -class QgsDesignerWidgets : public QObject, public QDesignerCustomWidgetInterface -{ - Q_OBJECT; - Q_INTERFACES(QDesignerCustomWidgetInterface); - - -public: - QgsDesignerWidgets(QObject *parent = 0); - void initialize(QDesignerFormEditorInterface *core); - QStringList keys() const; - QWidget* create( const QString &classname, QWidget* parent = 0, const char* name = 0 ); - QString group( const QString& ) const; - QIcon iconSet( const QString& ) const; - QString includeFile( const QString& ) const; - QString toolTip( const QString& ) const; - QString whatsThis( const QString& ) const; - bool isContainer( const QString& ) const; - bool isInitialized() const; -private: - bool mInitialized; -};