[QGIS Commit] r13190 - in trunk/qgis: python/gui src/app src/gui

svn_qgis at osgeo.org svn_qgis at osgeo.org
Mon Mar 29 09:16:11 EDT 2010


Author: mhugent
Date: 2010-03-29 09:16:08 -0400 (Mon, 29 Mar 2010)
New Revision: 13190

Added:
   trunk/qgis/src/app/qgsannotationwidget.cpp
   trunk/qgis/src/app/qgsannotationwidget.h
   trunk/qgis/src/app/qgsformannotationdialog.cpp
   trunk/qgis/src/app/qgsformannotationdialog.h
   trunk/qgis/src/app/qgstextannotationdialog.cpp
   trunk/qgis/src/app/qgstextannotationdialog.h
Removed:
   trunk/qgis/src/gui/qgsannotationwidget.cpp
   trunk/qgis/src/gui/qgsannotationwidget.h
   trunk/qgis/src/gui/qgsformannotationdialog.cpp
   trunk/qgis/src/gui/qgsformannotationdialog.h
   trunk/qgis/src/gui/qgstextannotationdialog.cpp
   trunk/qgis/src/gui/qgstextannotationdialog.h
Modified:
   trunk/qgis/python/gui/qgsannotationitem.sip
   trunk/qgis/python/gui/qgsformannotationitem.sip
   trunk/qgis/python/gui/qgstextannotationitem.sip
   trunk/qgis/src/app/CMakeLists.txt
   trunk/qgis/src/app/qgsmaptoolannotation.cpp
   trunk/qgis/src/app/qgsmaptoolannotation.h
   trunk/qgis/src/gui/CMakeLists.txt
   trunk/qgis/src/gui/qgsannotationitem.h
   trunk/qgis/src/gui/qgsformannotationitem.cpp
   trunk/qgis/src/gui/qgsformannotationitem.h
   trunk/qgis/src/gui/qgstextannotationitem.cpp
   trunk/qgis/src/gui/qgstextannotationitem.h
Log:
Move annotation items and widgets from gui to app

Modified: trunk/qgis/python/gui/qgsannotationitem.sip
===================================================================
--- trunk/qgis/python/gui/qgsannotationitem.sip	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/python/gui/qgsannotationitem.sip	2010-03-29 13:16:08 UTC (rev 13190)
@@ -25,9 +25,6 @@
     QgsAnnotationItem( QgsMapCanvas* mapCanvas );
     virtual ~QgsAnnotationItem();
 
-    /**Creates an editor widget (caller takes ownership)*/
-    virtual QDialog* createEditor() = 0;
-
     void updatePosition();
 
     QRectF boundingRect() const;
@@ -71,4 +68,4 @@
 
     void _writeXML( QDomDocument& doc, QDomElement& itemElem ) const;
     void _readXML( const QDomDocument& doc, const QDomElement& annotationElem );
-};
\ No newline at end of file
+};

Modified: trunk/qgis/python/gui/qgsformannotationitem.sip
===================================================================
--- trunk/qgis/python/gui/qgsformannotationitem.sip	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/python/gui/qgsformannotationitem.sip	2010-03-29 13:16:08 UTC (rev 13190)
@@ -13,9 +13,6 @@
     //! paint function called by map canvas
     void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
 
-    /**Create a configuration dialog*/
-    QDialog* createEditor();
-
     QSizeF minimumFrameSize() const;
     /**Returns the optimal frame size*/
     QSizeF preferredFrameSize() const;
@@ -28,4 +25,4 @@
 
     void writeXML( QDomDocument& doc ) const;
     void readXML( const QDomDocument& doc, const QDomElement& itemElem );
-};
\ No newline at end of file
+};

Modified: trunk/qgis/python/gui/qgstextannotationitem.sip
===================================================================
--- trunk/qgis/python/gui/qgstextannotationitem.sip	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/python/gui/qgstextannotationitem.sip	2010-03-29 13:16:08 UTC (rev 13190)
@@ -7,8 +7,6 @@
     QgsTextAnnotationItem( QgsMapCanvas* canvas );
     ~QgsTextAnnotationItem();
 
-    QDialog* createEditor();
-
     /**Returns document (caller takes ownership)*/
     QTextDocument* document() const;
     /**Sets document (does not take ownership)*/
@@ -18,4 +16,4 @@
     void readXML( const QDomDocument& doc, const QDomElement& itemElem );
     
     void paint( QPainter* painter );
-};
\ No newline at end of file
+};

Modified: trunk/qgis/src/app/CMakeLists.txt
===================================================================
--- trunk/qgis/src/app/CMakeLists.txt	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/app/CMakeLists.txt	2010-03-29 13:16:08 UTC (rev 13190)
@@ -4,6 +4,7 @@
   qgisappinterface.cpp
   qgsabout.cpp
   qgsaddattrdialog.cpp
+  qgsannotationwidget.cpp
   qgsattributeactiondialog.cpp
   qgsattributedialog.cpp
   qgsattributetypedialog.cpp
@@ -17,6 +18,7 @@
   qgscustomprojectiondialog.cpp
   qgsdbfilterproxymodel.cpp
   qgsdbtablemodel.cpp
+  qgsformannotationdialog.cpp
   qgsspatialitefilterproxymodel.cpp
   qgsspatialitetablemodel.cpp
   qgsdelattrdialog.cpp
@@ -65,6 +67,7 @@
   qgsprojectproperties.cpp
   qgsrasterlayerproperties.cpp
   qgssearchquerybuilder.cpp
+  qgstextannotationdialog.cpp
   qgswmssourceselect.cpp
   qgsshortcutsmanager.cpp
   qgssinglesymboldialog.cpp
@@ -126,6 +129,7 @@
   qgisappinterface.h
   qgsabout.h
   qgsaddattrdialog.h
+  qgsannotationwidget.h
   qgsattributeactiondialog.h
   qgsattributedialog.h
   qgsattributetypedialog.h
@@ -137,15 +141,14 @@
   qgscustomprojectiondialog.h
   qgsdelattrdialog.h
   qgsfieldcalculator.h
+  qgsformannotationdialog.h
   qgsmaptoolmeasureangle.h
   qgsnewvectorlayerdialog.h
   qgsgraduatedsymboldialog.h
   qgshelpviewer.h
   qgsidentifyresults.h
   qgslabeldialog.h
-
   qgsmanageconnectionsdialog.h
-
   qgsmaptoolidentify.h
   qgsmaptoolsplitfeatures.h
   qgsmaptoolvertexedit.h
@@ -161,7 +164,6 @@
   qgsmaptooldeletevertex.h
   qgsmaptoolmovevertex.h
   qgsmaptoolsimplify.h
-
   qgsmeasuretool.h
   qgsmeasuredialog.h
   qgsmergeattributesdialog.h
@@ -172,6 +174,7 @@
   qgsprojectproperties.h
   qgsrasterlayerproperties.h
   qgssearchquerybuilder.h
+  qgstextannotationdialog.h
   qgswmssourceselect.h
   qgssinglesymboldialog.h
   qgssnappingdialog.h

Copied: trunk/qgis/src/app/qgsannotationwidget.cpp (from rev 13189, trunk/qgis/src/gui/qgsannotationwidget.cpp)
===================================================================
--- trunk/qgis/src/app/qgsannotationwidget.cpp	                        (rev 0)
+++ trunk/qgis/src/app/qgsannotationwidget.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -0,0 +1,127 @@
+/***************************************************************************
+                              qgsannotationwidget.cpp
+                              ------------------------
+  begin                : February 25, 2010
+  copyright            : (C) 2010 by Marco Hugentobler
+  email                : marco dot hugentobler at hugis dot net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "qgsannotationwidget.h"
+#include "qgsannotationitem.h"
+#include "qgsstylev2.h"
+#include "qgssymbollayerv2utils.h"
+#include "qgssymbolv2.h"
+#include "qgssymbolv2selectordialog.h"
+#include <QColorDialog>
+
+
+QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QWidget( parent, f ), mItem( item ), mMarkerSymbol( 0 )
+{
+  setupUi( this );
+
+  if ( mItem )
+  {
+    blockAllSignals( true );
+
+    if ( mItem->mapPositionFixed() )
+    {
+      mMapPositionFixedCheckBox->setCheckState( Qt::Checked );
+    }
+    else
+    {
+      mMapPositionFixedCheckBox->setCheckState( Qt::Unchecked );
+    }
+    mFrameWidthSpinBox->setValue( mItem->frameBorderWidth() );
+    mFrameColorButton->setColor( mItem->frameColor() );
+
+    const QgsMarkerSymbolV2* symbol = mItem->markerSymbol();
+    if ( symbol )
+    {
+      mMarkerSymbol = dynamic_cast<QgsMarkerSymbolV2*>( symbol->clone() );
+      updateCenterIcon();
+    }
+
+    blockAllSignals( false );
+  }
+}
+
+QgsAnnotationWidget::~QgsAnnotationWidget()
+{
+  delete mMarkerSymbol;
+}
+
+void QgsAnnotationWidget::apply()
+{
+  if ( mItem )
+  {
+    mItem->setMapPositionFixed( mMapPositionFixedCheckBox->checkState() == Qt::Checked );
+    mItem->setFrameBorderWidth( mFrameWidthSpinBox->value() );
+    mItem->setFrameColor( mFrameColorButton->color() );
+    mItem->setMarkerSymbol( mMarkerSymbol );
+    mMarkerSymbol = 0; //item takes ownership
+    mItem->update();
+  }
+}
+
+void QgsAnnotationWidget::blockAllSignals( bool block )
+{
+  mMapPositionFixedCheckBox->blockSignals( block );
+  mMapMarkerButton->blockSignals( block );
+  mFrameWidthSpinBox->blockSignals( block );
+  mFrameColorButton->blockSignals( block );
+}
+
+void QgsAnnotationWidget::on_mMapMarkerButton_clicked()
+{
+  if ( !mMarkerSymbol )
+  {
+    return;
+  }
+  QgsMarkerSymbolV2* markerSymbol = dynamic_cast<QgsMarkerSymbolV2*>( mMarkerSymbol->clone() );
+  QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), this );
+  if ( dlg.exec() == QDialog::Rejected )
+  {
+    delete markerSymbol;
+  }
+  else
+  {
+    delete mMarkerSymbol;
+    mMarkerSymbol = markerSymbol;
+    updateCenterIcon();
+  }
+}
+
+void QgsAnnotationWidget::on_mFrameColorButton_clicked()
+{
+  if ( !mItem )
+  {
+    return;
+  }
+
+  QColor c = QColorDialog::getColor( mFrameColorButton->color(), 0, tr( "Select frame color" ), QColorDialog::ShowAlphaChannel );
+  if ( c.isValid() )
+  {
+    mFrameColorButton->setColor( c );
+    mItem->setFrameColor( c );
+  }
+}
+
+void QgsAnnotationWidget::updateCenterIcon()
+{
+  if ( !mMarkerSymbol )
+  {
+    return;
+  }
+  QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( mMarkerSymbol, mMapMarkerButton->iconSize() );
+  mMapMarkerButton->setIcon( icon );
+}
+

Copied: trunk/qgis/src/app/qgsannotationwidget.h (from rev 13189, trunk/qgis/src/gui/qgsannotationwidget.h)
===================================================================
--- trunk/qgis/src/app/qgsannotationwidget.h	                        (rev 0)
+++ trunk/qgis/src/app/qgsannotationwidget.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -0,0 +1,49 @@
+/***************************************************************************
+                              qgsannotationwidget.h
+                              ------------------------
+  begin                : February 25, 2010
+  copyright            : (C) 2010 by Marco Hugentobler
+  email                : marco dot hugentobler at hugis dot net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef QGSANNOTATIONWIDGET_H
+#define QGSANNOTATIONWIDGET_H
+
+#include "ui_qgsannotationwidgetbase.h"
+
+class QgsAnnotationItem;
+class QgsMarkerSymbolV2;
+
+/**A configuration widget to configure the annotation item properties. Usually embedded by QgsAnnotationItem
+subclass configuration dialogs*/
+class GUI_EXPORT QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationWidgetBase
+{
+    Q_OBJECT
+  public:
+    QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 );
+    ~QgsAnnotationWidget();
+
+    void apply();
+
+  private slots:
+    void on_mMapMarkerButton_clicked();
+    void on_mFrameColorButton_clicked();
+
+  private:
+    QgsAnnotationItem* mItem;
+    QgsMarkerSymbolV2* mMarkerSymbol;
+
+    void blockAllSignals( bool block );
+    void updateCenterIcon();
+};
+
+#endif // QGSANNOTATIONWIDGET_H

Copied: trunk/qgis/src/app/qgsformannotationdialog.cpp (from rev 13189, trunk/qgis/src/gui/qgsformannotationdialog.cpp)
===================================================================
--- trunk/qgis/src/app/qgsformannotationdialog.cpp	                        (rev 0)
+++ trunk/qgis/src/app/qgsformannotationdialog.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -0,0 +1,69 @@
+#include "qgsformannotationdialog.h"
+#include "qgsannotationwidget.h"
+#include <QFileDialog>
+#include <QFileInfo>
+#include <QGraphicsScene>
+
+QgsFormAnnotationDialog::QgsFormAnnotationDialog( QgsFormAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): \
+    QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 )
+{
+  setupUi( this );
+  mEmbeddedWidget = new QgsAnnotationWidget( mItem );
+  mEmbeddedWidget->show();
+  mStackedWidget->addWidget( mEmbeddedWidget );
+  mStackedWidget->setCurrentWidget( mEmbeddedWidget );
+
+  if ( item )
+  {
+    mFileLineEdit->setText( item->designerForm() );
+  }
+
+  QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
+  QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
+  QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
+  mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
+}
+
+QgsFormAnnotationDialog::~QgsFormAnnotationDialog()
+{
+
+}
+
+void QgsFormAnnotationDialog::applySettingsToItem()
+{
+  //apply settings from embedded item widget
+  if ( mEmbeddedWidget )
+  {
+    mEmbeddedWidget->apply();
+  }
+
+  if ( mItem )
+  {
+    mItem->setDesignerForm( mFileLineEdit->text() );
+    mItem->update();
+  }
+}
+
+void QgsFormAnnotationDialog::on_mBrowseToolButton_clicked()
+{
+  QString directory;
+  QFileInfo fi( mFileLineEdit->text() );
+  if ( fi.exists() )
+  {
+    directory = fi.absolutePath();
+  }
+  QString filename = QFileDialog::getOpenFileName( 0, tr( "Qt designer file" ), directory, "*.ui" );
+  mFileLineEdit->setText( filename );
+}
+
+void QgsFormAnnotationDialog::deleteItem()
+{
+  QGraphicsScene* scene = mItem->scene();
+  if ( scene )
+  {
+    scene->removeItem( mItem );
+  }
+  delete mItem;
+  mItem = 0;
+}
+

Copied: trunk/qgis/src/app/qgsformannotationdialog.h (from rev 13189, trunk/qgis/src/gui/qgsformannotationdialog.h)
===================================================================
--- trunk/qgis/src/app/qgsformannotationdialog.h	                        (rev 0)
+++ trunk/qgis/src/app/qgsformannotationdialog.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -0,0 +1,26 @@
+#ifndef QGSFORMANNOTATIONDIALOG_H
+#define QGSFORMANNOTATIONDIALOG_H
+
+#include "ui_qgsformannotationdialogbase.h"
+#include "qgsformannotationitem.h"
+
+class QgsAnnotationWidget;
+
+class GUI_EXPORT QgsFormAnnotationDialog: public QDialog, private Ui::QgsFormAnnotationDialogBase
+{
+    Q_OBJECT
+  public:
+    QgsFormAnnotationDialog( QgsFormAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 );
+    ~QgsFormAnnotationDialog();
+
+  private:
+    QgsFormAnnotationItem* mItem;
+    QgsAnnotationWidget* mEmbeddedWidget;
+
+  private slots:
+    void applySettingsToItem();
+    void on_mBrowseToolButton_clicked();
+    void deleteItem();
+};
+
+#endif // QGSFORMANNOTATIONDIALOG_H

Modified: trunk/qgis/src/app/qgsmaptoolannotation.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptoolannotation.cpp	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/app/qgsmaptoolannotation.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -16,9 +16,11 @@
  ***************************************************************************/
 
 #include "qgsmaptoolannotation.h"
+#include "qgsformannotationdialog.h"
 #include "qgsformannotationitem.h"
 #include "qgslogger.h"
 #include "qgsmapcanvas.h"
+#include "qgstextannotationdialog.h"
 #include "qgstextannotationitem.h"
 #include <QDialog>
 #include <QMouseEvent>
@@ -39,6 +41,28 @@
   return 0;
 }
 
+QDialog* QgsMapToolAnnotation::createItemEditor( QgsAnnotationItem* item )
+{
+  if ( !item )
+  {
+    return 0;
+  }
+
+  QgsTextAnnotationItem* tItem = dynamic_cast<QgsTextAnnotationItem*>( item );
+  if ( tItem )
+  {
+    return new QgsTextAnnotationDialog( tItem );
+  }
+
+  QgsFormAnnotationItem* fItem = dynamic_cast<QgsFormAnnotationItem*>( item );
+  if ( fItem )
+  {
+    return new QgsFormAnnotationDialog( fItem );
+  }
+
+  return 0;
+}
+
 void QgsMapToolAnnotation::canvasReleaseEvent( QMouseEvent * e )
 {
   mCurrentMoveAction = QgsAnnotationItem::NoAction;
@@ -193,7 +217,7 @@
   {
     return;
   }
-  QDialog* itemEditor = item->createEditor();
+  QDialog* itemEditor = createItemEditor( item );
   if ( itemEditor )
   {
     itemEditor->exec();

Modified: trunk/qgis/src/app/qgsmaptoolannotation.h
===================================================================
--- trunk/qgis/src/app/qgsmaptoolannotation.h	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/app/qgsmaptoolannotation.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -36,6 +36,8 @@
   protected:
     /**Creates a new item. To be implemented by subclasses. Returns 0 by default*/
     virtual QgsAnnotationItem* createItem( QMouseEvent* e );
+    /**Creates an editor widget (caller takes ownership)*/
+    QDialog* createItemEditor( QgsAnnotationItem* item );
 
   private:
     /**Returns the topmost annotation item at the position (or 0 if none)*/

Copied: trunk/qgis/src/app/qgstextannotationdialog.cpp (from rev 13189, trunk/qgis/src/gui/qgstextannotationdialog.cpp)
===================================================================
--- trunk/qgis/src/app/qgstextannotationdialog.cpp	                        (rev 0)
+++ trunk/qgis/src/app/qgstextannotationdialog.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -0,0 +1,167 @@
+/***************************************************************************
+                              qgstextannotationdialog.cpp
+                              ---------------------------
+  begin                : February 24, 2010
+  copyright            : (C) 2010 by Marco Hugentobler
+  email                : marco dot hugentobler at hugis dot net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#include "qgstextannotationdialog.h"
+#include "qgsannotationwidget.h"
+#include "qgstextannotationitem.h"
+#include <QColorDialog>
+#include <QGraphicsScene>
+
+QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f ), mItem( item ), mTextDocument( 0 )
+{
+  setupUi( this );
+  mEmbeddedWidget = new QgsAnnotationWidget( mItem );
+  mEmbeddedWidget->show();
+  mStackedWidget->addWidget( mEmbeddedWidget );
+  mStackedWidget->setCurrentWidget( mEmbeddedWidget );
+  if ( mItem )
+  {
+    mTextDocument = mItem->document();
+    mTextEdit->setDocument( mTextDocument );
+    mBackgroundColorButton->setColor( mItem->frameBackgroundColor() );
+  }
+  setCurrentFontPropertiesToGui();
+
+  QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applyTextToItem() ) );
+  QObject::connect( mFontComboBox, SIGNAL( currentFontChanged( const QFont& ) ), this, SLOT( changeCurrentFormat() ) );
+  QObject::connect( mFontSizeSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( changeCurrentFormat() ) );
+  QObject::connect( mBoldPushButton, SIGNAL( toggled( bool ) ), this, SLOT( changeCurrentFormat() ) );
+  QObject::connect( mItalicsPushButton, SIGNAL( toggled( bool ) ), this, SLOT( changeCurrentFormat() ) );
+  QObject::connect( mTextEdit, SIGNAL( cursorPositionChanged() ), this, SLOT( setCurrentFontPropertiesToGui() ) );
+
+  QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
+  QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
+  QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
+  mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
+}
+
+QgsTextAnnotationDialog::~QgsTextAnnotationDialog()
+{
+  delete mTextDocument;
+}
+
+void QgsTextAnnotationDialog::applyTextToItem()
+{
+  if ( mItem && mTextDocument )
+  {
+    //apply settings from embedded item widget
+    if ( mEmbeddedWidget )
+    {
+      mEmbeddedWidget->apply();
+    }
+    mItem->setDocument( mTextDocument );
+    mItem->update();
+  }
+}
+
+void QgsTextAnnotationDialog::changeCurrentFormat()
+{
+  QFont newFont;
+  newFont.setFamily( mFontComboBox->currentFont().family() );
+
+  //bold
+  if ( mBoldPushButton->isChecked() )
+  {
+    newFont.setBold( true );
+  }
+  else
+  {
+    newFont.setBold( false );
+  }
+
+  //italic
+  if ( mItalicsPushButton->isChecked() )
+  {
+    newFont.setItalic( true );
+  }
+  else
+  {
+    newFont.setItalic( false );
+  }
+
+  //size
+  newFont.setPointSize( mFontSizeSpinBox->value() );
+  mTextEdit->setCurrentFont( newFont );
+
+  //color
+  mTextEdit->setTextColor( mFontColorButton->color() );
+}
+
+void QgsTextAnnotationDialog::on_mFontColorButton_clicked()
+{
+  QColor newColor = QColorDialog::getColor( mFontColorButton->color(), 0, tr( "Select font color" ), QColorDialog::ShowAlphaChannel );
+  if ( !newColor.isValid() )
+  {
+    return; //dialog canceled
+  }
+  mFontColorButton->setColor( newColor );
+  changeCurrentFormat();
+}
+
+void QgsTextAnnotationDialog::setCurrentFontPropertiesToGui()
+{
+  blockAllSignals( true );
+  QFont currentFont = mTextEdit->currentFont();
+  mFontComboBox->setCurrentFont( currentFont );
+  mFontSizeSpinBox->setValue( currentFont.pointSize() );
+  mBoldPushButton->setChecked( currentFont.bold() );
+  mItalicsPushButton->setChecked( currentFont.italic() );
+  mFontColorButton->setColor( mTextEdit->textColor() );
+  blockAllSignals( false );
+}
+
+void QgsTextAnnotationDialog::blockAllSignals( bool block )
+{
+  mFontComboBox->blockSignals( block );
+  mFontSizeSpinBox->blockSignals( block );
+  mBoldPushButton->blockSignals( block );
+  mItalicsPushButton->blockSignals( block );
+  mFontColorButton->blockSignals( block );
+}
+
+void QgsTextAnnotationDialog::deleteItem()
+{
+  QGraphicsScene* scene = mItem->scene();
+  if ( scene )
+  {
+    scene->removeItem( mItem );
+  }
+  delete mItem;
+  mItem = 0;
+}
+
+void QgsTextAnnotationDialog::on_mBackgroundColorButton_clicked()
+{
+  if ( !mItem )
+  {
+    return;
+  }
+
+  QColor bgColor;
+#if QT_VERSION >= 0x040500
+  bgColor = QColorDialog::getColor( mItem->frameBackgroundColor(), 0, tr( "Select background color" ), QColorDialog::ShowAlphaChannel );
+#else
+  bgColor = QColorDialog::getColor( mItem->frameBackgroundColor() );
+#endif
+
+  if ( bgColor.isValid() )
+  {
+    mItem->setFrameBackgroundColor( bgColor );
+    mBackgroundColorButton->setColor( bgColor );
+  }
+}
+

Copied: trunk/qgis/src/app/qgstextannotationdialog.h (from rev 13189, trunk/qgis/src/gui/qgstextannotationdialog.h)
===================================================================
--- trunk/qgis/src/app/qgstextannotationdialog.h	                        (rev 0)
+++ trunk/qgis/src/app/qgstextannotationdialog.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -0,0 +1,50 @@
+/***************************************************************************
+                              qgstextannotationdialog.h
+                              ------------------------
+  begin                : February 24, 2010
+  copyright            : (C) 2010 by Marco Hugentobler
+  email                : marco dot hugentobler at hugis dot net
+ ***************************************************************************/
+
+/***************************************************************************
+ *                                                                         *
+ *   This program is free software; you can redistribute it and/or modify  *
+ *   it under the terms of the GNU General Public License as published by  *
+ *   the Free Software Foundation; either version 2 of the License, or     *
+ *   (at your option) any later version.                                   *
+ *                                                                         *
+ ***************************************************************************/
+
+#ifndef QGSTEXTANNOTATIONDIALOG_H
+#define QGSTEXTANNOTATIONDIALOG_H
+
+#include "ui_qgstextannotationdialogbase.h"
+
+class QgsAnnotationWidget;
+class QgsTextAnnotationItem;
+
+class GUI_EXPORT QgsTextAnnotationDialog: public QDialog, private Ui::QgsTextAnnotationDialogBase
+{
+    Q_OBJECT
+  public:
+    QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 );
+    ~QgsTextAnnotationDialog();
+
+  private:
+    QgsTextAnnotationItem* mItem;
+    /**Text document (a clone of the annotation items document)*/
+    QTextDocument* mTextDocument;
+    QgsAnnotationWidget* mEmbeddedWidget;
+
+    void blockAllSignals( bool block );
+
+  private slots:
+    void applyTextToItem();
+    void changeCurrentFormat();
+    void on_mFontColorButton_clicked();
+    void setCurrentFontPropertiesToGui();
+    void deleteItem();
+    void on_mBackgroundColorButton_clicked();
+};
+
+#endif // QGSTEXTANNOTATIONDIALOG_H

Modified: trunk/qgis/src/gui/CMakeLists.txt
===================================================================
--- trunk/qgis/src/gui/CMakeLists.txt	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/CMakeLists.txt	2010-03-29 13:16:08 UTC (rev 13190)
@@ -22,7 +22,6 @@
 qgisgui.cpp
 qgisinterface.cpp
 qgsannotationitem.cpp
-qgsannotationwidget.cpp
 qgsattributeeditor.cpp
 qgslegendinterface.cpp
 qgscolorbutton.cpp
@@ -33,7 +32,6 @@
 qgsdetaileditemdata.cpp
 qgsencodingfiledialog.cpp
 qgsfiledropedit.cpp
-qgsformannotationdialog.cpp
 qgsformannotationitem.cpp
 qgsgenericprojectionselector.cpp
 qgsmapcanvas.cpp
@@ -52,7 +50,6 @@
 qgsprojectionselector.cpp
 qgsquickprint.cpp
 qgsrubberband.cpp
-qgstextannotationdialog.cpp
 qgstextannotationitem.cpp
 qgsvertexmarker.cpp
 qgsludialog.cpp
@@ -75,7 +72,6 @@
 symbology-ng/qgsvectorcolorbrewercolorrampv2dialog.h
 symbology-ng/characterwidget.h
 
-qgsannotationwidget.h
 qgsattributeeditor.h
 qgscomposerview.h
 qgsdetaileditemdelegate.h
@@ -83,7 +79,6 @@
 qgslegendinterface.h
 qgisinterface.h
 qgsencodingfiledialog.h
-qgsformannotationdialog.h
 qgsformannotationitem.h
 qgsgenericprojectionselector.h
 qgsmapcanvas.h
@@ -93,7 +88,6 @@
 qgscredentialdialog.h
 qgsprojectionselector.h
 qgsquickprint.h
-qgstextannotationdialog.h
 qgsludialog.h
 qgsprojectbadlayerguihandler.h
 )

Modified: trunk/qgis/src/gui/qgsannotationitem.h
===================================================================
--- trunk/qgis/src/gui/qgsannotationitem.h	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgsannotationitem.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -50,9 +50,6 @@
     QgsAnnotationItem( QgsMapCanvas* mapCanvas );
     virtual ~QgsAnnotationItem();
 
-    /**Creates an editor widget (caller takes ownership)*/
-    virtual QDialog* createEditor() = 0;
-
     void updatePosition();
 
     QRectF boundingRect() const;

Deleted: trunk/qgis/src/gui/qgsannotationwidget.cpp
===================================================================
--- trunk/qgis/src/gui/qgsannotationwidget.cpp	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgsannotationwidget.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -1,127 +0,0 @@
-/***************************************************************************
-                              qgsannotationwidget.cpp
-                              ------------------------
-  begin                : February 25, 2010
-  copyright            : (C) 2010 by Marco Hugentobler
-  email                : marco dot hugentobler at hugis dot net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "qgsannotationwidget.h"
-#include "qgsannotationitem.h"
-#include "qgsstylev2.h"
-#include "qgssymbollayerv2utils.h"
-#include "qgssymbolv2.h"
-#include "qgssymbolv2selectordialog.h"
-#include <QColorDialog>
-
-
-QgsAnnotationWidget::QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QWidget( parent, f ), mItem( item ), mMarkerSymbol( 0 )
-{
-  setupUi( this );
-
-  if ( mItem )
-  {
-    blockAllSignals( true );
-
-    if ( mItem->mapPositionFixed() )
-    {
-      mMapPositionFixedCheckBox->setCheckState( Qt::Checked );
-    }
-    else
-    {
-      mMapPositionFixedCheckBox->setCheckState( Qt::Unchecked );
-    }
-    mFrameWidthSpinBox->setValue( mItem->frameBorderWidth() );
-    mFrameColorButton->setColor( mItem->frameColor() );
-
-    const QgsMarkerSymbolV2* symbol = mItem->markerSymbol();
-    if ( symbol )
-    {
-      mMarkerSymbol = dynamic_cast<QgsMarkerSymbolV2*>( symbol->clone() );
-      updateCenterIcon();
-    }
-
-    blockAllSignals( false );
-  }
-}
-
-QgsAnnotationWidget::~QgsAnnotationWidget()
-{
-  delete mMarkerSymbol;
-}
-
-void QgsAnnotationWidget::apply()
-{
-  if ( mItem )
-  {
-    mItem->setMapPositionFixed( mMapPositionFixedCheckBox->checkState() == Qt::Checked );
-    mItem->setFrameBorderWidth( mFrameWidthSpinBox->value() );
-    mItem->setFrameColor( mFrameColorButton->color() );
-    mItem->setMarkerSymbol( mMarkerSymbol );
-    mMarkerSymbol = 0; //item takes ownership
-    mItem->update();
-  }
-}
-
-void QgsAnnotationWidget::blockAllSignals( bool block )
-{
-  mMapPositionFixedCheckBox->blockSignals( block );
-  mMapMarkerButton->blockSignals( block );
-  mFrameWidthSpinBox->blockSignals( block );
-  mFrameColorButton->blockSignals( block );
-}
-
-void QgsAnnotationWidget::on_mMapMarkerButton_clicked()
-{
-  if ( !mMarkerSymbol )
-  {
-    return;
-  }
-  QgsMarkerSymbolV2* markerSymbol = dynamic_cast<QgsMarkerSymbolV2*>( mMarkerSymbol->clone() );
-  QgsSymbolV2SelectorDialog dlg( markerSymbol, QgsStyleV2::defaultStyle(), this );
-  if ( dlg.exec() == QDialog::Rejected )
-  {
-    delete markerSymbol;
-  }
-  else
-  {
-    delete mMarkerSymbol;
-    mMarkerSymbol = markerSymbol;
-    updateCenterIcon();
-  }
-}
-
-void QgsAnnotationWidget::on_mFrameColorButton_clicked()
-{
-  if ( !mItem )
-  {
-    return;
-  }
-
-  QColor c = QColorDialog::getColor( mFrameColorButton->color(), 0, tr( "Select frame color" ), QColorDialog::ShowAlphaChannel );
-  if ( c.isValid() )
-  {
-    mFrameColorButton->setColor( c );
-    mItem->setFrameColor( c );
-  }
-}
-
-void QgsAnnotationWidget::updateCenterIcon()
-{
-  if ( !mMarkerSymbol )
-  {
-    return;
-  }
-  QIcon icon = QgsSymbolLayerV2Utils::symbolPreviewIcon( mMarkerSymbol, mMapMarkerButton->iconSize() );
-  mMapMarkerButton->setIcon( icon );
-}
-

Deleted: trunk/qgis/src/gui/qgsannotationwidget.h
===================================================================
--- trunk/qgis/src/gui/qgsannotationwidget.h	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgsannotationwidget.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -1,49 +0,0 @@
-/***************************************************************************
-                              qgsannotationwidget.h
-                              ------------------------
-  begin                : February 25, 2010
-  copyright            : (C) 2010 by Marco Hugentobler
-  email                : marco dot hugentobler at hugis dot net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef QGSANNOTATIONWIDGET_H
-#define QGSANNOTATIONWIDGET_H
-
-#include "ui_qgsannotationwidgetbase.h"
-
-class QgsAnnotationItem;
-class QgsMarkerSymbolV2;
-
-/**A configuration widget to configure the annotation item properties. Usually embedded by QgsAnnotationItem
-subclass configuration dialogs*/
-class GUI_EXPORT QgsAnnotationWidget: public QWidget, private Ui::QgsAnnotationWidgetBase
-{
-    Q_OBJECT
-  public:
-    QgsAnnotationWidget( QgsAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 );
-    ~QgsAnnotationWidget();
-
-    void apply();
-
-  private slots:
-    void on_mMapMarkerButton_clicked();
-    void on_mFrameColorButton_clicked();
-
-  private:
-    QgsAnnotationItem* mItem;
-    QgsMarkerSymbolV2* mMarkerSymbol;
-
-    void blockAllSignals( bool block );
-    void updateCenterIcon();
-};
-
-#endif // QGSANNOTATIONWIDGET_H

Deleted: trunk/qgis/src/gui/qgsformannotationdialog.cpp
===================================================================
--- trunk/qgis/src/gui/qgsformannotationdialog.cpp	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgsformannotationdialog.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -1,69 +0,0 @@
-#include "qgsformannotationdialog.h"
-#include "qgsannotationwidget.h"
-#include <QFileDialog>
-#include <QFileInfo>
-#include <QGraphicsScene>
-
-QgsFormAnnotationDialog::QgsFormAnnotationDialog( QgsFormAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): \
-    QDialog( parent, f ), mItem( item ), mEmbeddedWidget( 0 )
-{
-  setupUi( this );
-  mEmbeddedWidget = new QgsAnnotationWidget( mItem );
-  mEmbeddedWidget->show();
-  mStackedWidget->addWidget( mEmbeddedWidget );
-  mStackedWidget->setCurrentWidget( mEmbeddedWidget );
-
-  if ( item )
-  {
-    mFileLineEdit->setText( item->designerForm() );
-  }
-
-  QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
-  QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
-  QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
-  mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
-}
-
-QgsFormAnnotationDialog::~QgsFormAnnotationDialog()
-{
-
-}
-
-void QgsFormAnnotationDialog::applySettingsToItem()
-{
-  //apply settings from embedded item widget
-  if ( mEmbeddedWidget )
-  {
-    mEmbeddedWidget->apply();
-  }
-
-  if ( mItem )
-  {
-    mItem->setDesignerForm( mFileLineEdit->text() );
-    mItem->update();
-  }
-}
-
-void QgsFormAnnotationDialog::on_mBrowseToolButton_clicked()
-{
-  QString directory;
-  QFileInfo fi( mFileLineEdit->text() );
-  if ( fi.exists() )
-  {
-    directory = fi.absolutePath();
-  }
-  QString filename = QFileDialog::getOpenFileName( 0, tr( "Qt designer file" ), directory, "*.ui" );
-  mFileLineEdit->setText( filename );
-}
-
-void QgsFormAnnotationDialog::deleteItem()
-{
-  QGraphicsScene* scene = mItem->scene();
-  if ( scene )
-  {
-    scene->removeItem( mItem );
-  }
-  delete mItem;
-  mItem = 0;
-}
-

Deleted: trunk/qgis/src/gui/qgsformannotationdialog.h
===================================================================
--- trunk/qgis/src/gui/qgsformannotationdialog.h	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgsformannotationdialog.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -1,26 +0,0 @@
-#ifndef QGSFORMANNOTATIONDIALOG_H
-#define QGSFORMANNOTATIONDIALOG_H
-
-#include "ui_qgsformannotationdialogbase.h"
-#include "qgsformannotationitem.h"
-
-class QgsAnnotationWidget;
-
-class GUI_EXPORT QgsFormAnnotationDialog: public QDialog, private Ui::QgsFormAnnotationDialogBase
-{
-    Q_OBJECT
-  public:
-    QgsFormAnnotationDialog( QgsFormAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 );
-    ~QgsFormAnnotationDialog();
-
-  private:
-    QgsFormAnnotationItem* mItem;
-    QgsAnnotationWidget* mEmbeddedWidget;
-
-  private slots:
-    void applySettingsToItem();
-    void on_mBrowseToolButton_clicked();
-    void deleteItem();
-};
-
-#endif // QGSFORMANNOTATIONDIALOG_H

Modified: trunk/qgis/src/gui/qgsformannotationitem.cpp
===================================================================
--- trunk/qgis/src/gui/qgsformannotationitem.cpp	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgsformannotationitem.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -16,7 +16,6 @@
  ***************************************************************************/
 
 #include "qgsformannotationitem.h"
-#include "qgsformannotationdialog.h"
 #include "qgsattributeeditor.h"
 #include "qgsfeature.h"
 #include "qgslogger.h"
@@ -142,11 +141,6 @@
   }
 }
 
-QDialog* QgsFormAnnotationItem::createEditor()
-{
-  return new QgsFormAnnotationDialog( this );
-}
-
 QSizeF QgsFormAnnotationItem::minimumFrameSize() const
 {
   if ( mDesignerWidget )

Modified: trunk/qgis/src/gui/qgsformannotationitem.h
===================================================================
--- trunk/qgis/src/gui/qgsformannotationitem.h	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgsformannotationitem.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -36,9 +36,6 @@
     //! paint function called by map canvas
     void paint( QPainter * painter, const QStyleOptionGraphicsItem * option, QWidget * widget = 0 );
 
-    /**Create a configuration dialog*/
-    QDialog* createEditor();
-
     QSizeF minimumFrameSize() const;
     /**Returns the optimal frame size*/
     QSizeF preferredFrameSize() const;

Deleted: trunk/qgis/src/gui/qgstextannotationdialog.cpp
===================================================================
--- trunk/qgis/src/gui/qgstextannotationdialog.cpp	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgstextannotationdialog.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -1,167 +0,0 @@
-/***************************************************************************
-                              qgstextannotationdialog.cpp
-                              ---------------------------
-  begin                : February 24, 2010
-  copyright            : (C) 2010 by Marco Hugentobler
-  email                : marco dot hugentobler at hugis dot net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#include "qgstextannotationdialog.h"
-#include "qgsannotationwidget.h"
-#include "qgstextannotationitem.h"
-#include <QColorDialog>
-#include <QGraphicsScene>
-
-QgsTextAnnotationDialog::QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent, Qt::WindowFlags f ): QDialog( parent, f ), mItem( item ), mTextDocument( 0 )
-{
-  setupUi( this );
-  mEmbeddedWidget = new QgsAnnotationWidget( mItem );
-  mEmbeddedWidget->show();
-  mStackedWidget->addWidget( mEmbeddedWidget );
-  mStackedWidget->setCurrentWidget( mEmbeddedWidget );
-  if ( mItem )
-  {
-    mTextDocument = mItem->document();
-    mTextEdit->setDocument( mTextDocument );
-    mBackgroundColorButton->setColor( mItem->frameBackgroundColor() );
-  }
-  setCurrentFontPropertiesToGui();
-
-  QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applyTextToItem() ) );
-  QObject::connect( mFontComboBox, SIGNAL( currentFontChanged( const QFont& ) ), this, SLOT( changeCurrentFormat() ) );
-  QObject::connect( mFontSizeSpinBox, SIGNAL( valueChanged( int ) ), this, SLOT( changeCurrentFormat() ) );
-  QObject::connect( mBoldPushButton, SIGNAL( toggled( bool ) ), this, SLOT( changeCurrentFormat() ) );
-  QObject::connect( mItalicsPushButton, SIGNAL( toggled( bool ) ), this, SLOT( changeCurrentFormat() ) );
-  QObject::connect( mTextEdit, SIGNAL( cursorPositionChanged() ), this, SLOT( setCurrentFontPropertiesToGui() ) );
-
-  QObject::connect( mButtonBox, SIGNAL( accepted() ), this, SLOT( applySettingsToItem() ) );
-  QPushButton* deleteButton = new QPushButton( tr( "Delete" ) );
-  QObject::connect( deleteButton, SIGNAL( clicked() ), this, SLOT( deleteItem() ) );
-  mButtonBox->addButton( deleteButton, QDialogButtonBox::RejectRole );
-}
-
-QgsTextAnnotationDialog::~QgsTextAnnotationDialog()
-{
-  delete mTextDocument;
-}
-
-void QgsTextAnnotationDialog::applyTextToItem()
-{
-  if ( mItem && mTextDocument )
-  {
-    //apply settings from embedded item widget
-    if ( mEmbeddedWidget )
-    {
-      mEmbeddedWidget->apply();
-    }
-    mItem->setDocument( mTextDocument );
-    mItem->update();
-  }
-}
-
-void QgsTextAnnotationDialog::changeCurrentFormat()
-{
-  QFont newFont;
-  newFont.setFamily( mFontComboBox->currentFont().family() );
-
-  //bold
-  if ( mBoldPushButton->isChecked() )
-  {
-    newFont.setBold( true );
-  }
-  else
-  {
-    newFont.setBold( false );
-  }
-
-  //italic
-  if ( mItalicsPushButton->isChecked() )
-  {
-    newFont.setItalic( true );
-  }
-  else
-  {
-    newFont.setItalic( false );
-  }
-
-  //size
-  newFont.setPointSize( mFontSizeSpinBox->value() );
-  mTextEdit->setCurrentFont( newFont );
-
-  //color
-  mTextEdit->setTextColor( mFontColorButton->color() );
-}
-
-void QgsTextAnnotationDialog::on_mFontColorButton_clicked()
-{
-  QColor newColor = QColorDialog::getColor( mFontColorButton->color(), 0, tr( "Select font color" ), QColorDialog::ShowAlphaChannel );
-  if ( !newColor.isValid() )
-  {
-    return; //dialog canceled
-  }
-  mFontColorButton->setColor( newColor );
-  changeCurrentFormat();
-}
-
-void QgsTextAnnotationDialog::setCurrentFontPropertiesToGui()
-{
-  blockAllSignals( true );
-  QFont currentFont = mTextEdit->currentFont();
-  mFontComboBox->setCurrentFont( currentFont );
-  mFontSizeSpinBox->setValue( currentFont.pointSize() );
-  mBoldPushButton->setChecked( currentFont.bold() );
-  mItalicsPushButton->setChecked( currentFont.italic() );
-  mFontColorButton->setColor( mTextEdit->textColor() );
-  blockAllSignals( false );
-}
-
-void QgsTextAnnotationDialog::blockAllSignals( bool block )
-{
-  mFontComboBox->blockSignals( block );
-  mFontSizeSpinBox->blockSignals( block );
-  mBoldPushButton->blockSignals( block );
-  mItalicsPushButton->blockSignals( block );
-  mFontColorButton->blockSignals( block );
-}
-
-void QgsTextAnnotationDialog::deleteItem()
-{
-  QGraphicsScene* scene = mItem->scene();
-  if ( scene )
-  {
-    scene->removeItem( mItem );
-  }
-  delete mItem;
-  mItem = 0;
-}
-
-void QgsTextAnnotationDialog::on_mBackgroundColorButton_clicked()
-{
-  if ( !mItem )
-  {
-    return;
-  }
-
-  QColor bgColor;
-#if QT_VERSION >= 0x040500
-  bgColor = QColorDialog::getColor( mItem->frameBackgroundColor(), 0, tr( "Select background color" ), QColorDialog::ShowAlphaChannel );
-#else
-  bgColor = QColorDialog::getColor( mItem->frameBackgroundColor() );
-#endif
-
-  if ( bgColor.isValid() )
-  {
-    mItem->setFrameBackgroundColor( bgColor );
-    mBackgroundColorButton->setColor( bgColor );
-  }
-}
-

Deleted: trunk/qgis/src/gui/qgstextannotationdialog.h
===================================================================
--- trunk/qgis/src/gui/qgstextannotationdialog.h	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgstextannotationdialog.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -1,50 +0,0 @@
-/***************************************************************************
-                              qgstextannotationdialog.h
-                              ------------------------
-  begin                : February 24, 2010
-  copyright            : (C) 2010 by Marco Hugentobler
-  email                : marco dot hugentobler at hugis dot net
- ***************************************************************************/
-
-/***************************************************************************
- *                                                                         *
- *   This program is free software; you can redistribute it and/or modify  *
- *   it under the terms of the GNU General Public License as published by  *
- *   the Free Software Foundation; either version 2 of the License, or     *
- *   (at your option) any later version.                                   *
- *                                                                         *
- ***************************************************************************/
-
-#ifndef QGSTEXTANNOTATIONDIALOG_H
-#define QGSTEXTANNOTATIONDIALOG_H
-
-#include "ui_qgstextannotationdialogbase.h"
-
-class QgsAnnotationWidget;
-class QgsTextAnnotationItem;
-
-class GUI_EXPORT QgsTextAnnotationDialog: public QDialog, private Ui::QgsTextAnnotationDialogBase
-{
-    Q_OBJECT
-  public:
-    QgsTextAnnotationDialog( QgsTextAnnotationItem* item, QWidget * parent = 0, Qt::WindowFlags f = 0 );
-    ~QgsTextAnnotationDialog();
-
-  private:
-    QgsTextAnnotationItem* mItem;
-    /**Text document (a clone of the annotation items document)*/
-    QTextDocument* mTextDocument;
-    QgsAnnotationWidget* mEmbeddedWidget;
-
-    void blockAllSignals( bool block );
-
-  private slots:
-    void applyTextToItem();
-    void changeCurrentFormat();
-    void on_mFontColorButton_clicked();
-    void setCurrentFontPropertiesToGui();
-    void deleteItem();
-    void on_mBackgroundColorButton_clicked();
-};
-
-#endif // QGSTEXTANNOTATIONDIALOG_H

Modified: trunk/qgis/src/gui/qgstextannotationitem.cpp
===================================================================
--- trunk/qgis/src/gui/qgstextannotationitem.cpp	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgstextannotationitem.cpp	2010-03-29 13:16:08 UTC (rev 13190)
@@ -16,7 +16,6 @@
  ***************************************************************************/
 
 #include "qgstextannotationitem.h"
-#include "qgstextannotationdialog.h"
 #include <QDomDocument>
 #include <QPainter>
 
@@ -46,11 +45,6 @@
   mDocument = doc->clone();
 }
 
-QDialog* QgsTextAnnotationItem::createEditor()
-{
-  return new QgsTextAnnotationDialog( this );
-}
-
 void QgsTextAnnotationItem::paint( QPainter * painter )
 {
   if ( !painter || !mDocument )

Modified: trunk/qgis/src/gui/qgstextannotationitem.h
===================================================================
--- trunk/qgis/src/gui/qgstextannotationitem.h	2010-03-29 12:11:48 UTC (rev 13189)
+++ trunk/qgis/src/gui/qgstextannotationitem.h	2010-03-29 13:16:08 UTC (rev 13190)
@@ -28,8 +28,6 @@
     QgsTextAnnotationItem( QgsMapCanvas* canvas );
     ~QgsTextAnnotationItem();
 
-    QDialog* createEditor();
-
     /**Returns document (caller takes ownership)*/
     QTextDocument* document() const;
     /**Sets document (does not take ownership)*/



More information about the QGIS-commit mailing list