Commit aa3bfd7f authored by Bernhard Beschow's avatar Bernhard Beschow
Browse files

merge init() into c'tor

parent c7caa116
......@@ -37,11 +37,29 @@ OsmRelationManagerWidget::OsmRelationManagerWidget( GeoDataPlacemark *placemark,
const QHash<qint64, OsmPlacemarkData> *relations,
QWidget *parent )
: QWidget( parent ),
d( new OsmRelationManagerWidgetPrivate( this ) )
d( new OsmRelationManagerWidgetPrivate )
{
d->m_placemark = placemark;
d->m_allRelations = relations;
d->init( this );
d->setupUi( this );
d->populateRelationsList();
d->m_relationDropMenu = new QMenu( d->m_addRelation );
d->m_currentRelations->setRootIsDecorated( false );
d->m_currentRelations->setEditTriggers( QTreeWidget::DoubleClicked );
d->m_currentRelations->setContextMenuPolicy( Qt::CustomContextMenu );
d->m_currentRelations->setMinimumWidth( d->m_currentRelations->columnCount() * d->m_currentRelations->columnWidth( 0 ) + 10 );
d->m_addRelation->setMenu( d->m_relationDropMenu );
d->populateDropMenu();
QObject::connect( d->m_currentRelations, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
this, SLOT( handleDoubleClick(QTreeWidgetItem*,int) ) );
QObject::connect( d->m_currentRelations, SIGNAL( customContextMenuRequested( QPoint ) ),
this, SLOT( handleRelationContextMenuRequest( QPoint ) ) );
QObject::connect( d->m_relationDropMenu, SIGNAL( triggered( QAction* ) ),
this, SLOT( addRelation( QAction* ) ) );
QObject::connect( d->m_currentRelations, SIGNAL( itemChanged(QTreeWidgetItem*,int) ),
this, SLOT( handleItemChange( QTreeWidgetItem*,int ) ) );
}
OsmRelationManagerWidget::~OsmRelationManagerWidget()
......
......@@ -28,8 +28,7 @@
namespace Marble
{
OsmRelationManagerWidgetPrivate::OsmRelationManagerWidgetPrivate( OsmRelationManagerWidget* q_ )
:q( q_ )
OsmRelationManagerWidgetPrivate::OsmRelationManagerWidgetPrivate()
{
// nothing to do
}
......@@ -39,31 +38,6 @@ OsmRelationManagerWidgetPrivate::~OsmRelationManagerWidgetPrivate()
// nothing to do
}
void OsmRelationManagerWidgetPrivate::init( QWidget* parent )
{
setupUi( parent );
populateRelationsList();
m_relationDropMenu = new QMenu( m_addRelation );
m_currentRelations->setRootIsDecorated( false );
m_currentRelations->setEditTriggers( QTreeWidget::DoubleClicked );
m_currentRelations->setContextMenuPolicy( Qt::CustomContextMenu );
m_currentRelations->setMinimumWidth( m_currentRelations->columnCount() *
m_currentRelations->columnWidth( 0 ) + 10 );
m_addRelation->setMenu( m_relationDropMenu );
populateDropMenu();
QObject::connect( m_currentRelations, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
q, SLOT( handleDoubleClick(QTreeWidgetItem*,int) ) );
QObject::connect( m_currentRelations, SIGNAL( customContextMenuRequested( QPoint ) ),
q, SLOT( handleRelationContextMenuRequest( QPoint ) ) );
QObject::connect( m_relationDropMenu, SIGNAL( triggered( QAction* ) ),
q, SLOT( addRelation( QAction* ) ) );
QObject::connect( m_currentRelations, SIGNAL( itemChanged(QTreeWidgetItem*,int) ),
q, SLOT( handleItemChange( QTreeWidgetItem*,int ) ) );
}
void OsmRelationManagerWidgetPrivate::populateRelationsList()
{
m_currentRelations->clear();
......
......@@ -23,15 +23,13 @@ class OsmPlacemarkData;
class OsmRelationManagerWidgetPrivate : public Ui::OsmRelationManagerWidgetPrivate
{
public:
OsmRelationManagerWidgetPrivate( OsmRelationManagerWidget *q_ );
OsmRelationManagerWidgetPrivate();
~OsmRelationManagerWidgetPrivate();
void init( QWidget* parent );
void populateRelationsList();
void populateDropMenu();
private:
friend class OsmRelationManagerWidget;
OsmRelationManagerWidget* const q;
GeoDataPlacemark *m_placemark;
const QHash< qint64, OsmPlacemarkData > *m_allRelations;
QMenu *m_relationDropMenu;
......
......@@ -33,10 +33,30 @@ namespace Marble
OsmTagEditorWidget::OsmTagEditorWidget( GeoDataPlacemark *placemark, QWidget *parent )
: QWidget( parent ),
d( new OsmTagEditorWidgetPrivate( this ) )
d( new OsmTagEditorWidgetPrivate )
{
d->m_placemark = placemark;
d->init( this );
d->setupUi( this );
d->populatePresetTagsList();
d->populateCurrentTagsList();
d->m_recommendedTagsList->setSelectionBehavior( QAbstractItemView::SelectRows );
d->m_recommendedTagsList->setSelectionMode( QAbstractItemView::SingleSelection );
d->m_recommendedTagsList->setRootIsDecorated( false );
d->m_currentTagsList->setSelectionBehavior( QAbstractItemView::SelectRows );
d->m_currentTagsList->setSelectionMode( QAbstractItemView::SingleSelection );
d->m_currentTagsList->setRootIsDecorated( false );
QObject::connect( d->m_addTagButton, SIGNAL( pressed() ),
this, SLOT( addSelectedTag() ) );
QObject::connect( d->m_recommendedTagsList, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
this, SLOT( addSelectedTag() ) );
QObject::connect( d->m_removeTagButton, SIGNAL( pressed() ),
this, SLOT( removeSelectedTag() ) );
QObject::connect( d->m_currentTagsList, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ),
this, SLOT( handleItemChanged( QTreeWidgetItem*, int ) ) );
QObject::connect( d->m_currentTagsList, SIGNAL( itemDoubleClicked(QTreeWidgetItem*,int) ),
this, SLOT( handleDoubleClick( QTreeWidgetItem*, int) ) );
}
OsmTagEditorWidget::~OsmTagEditorWidget()
......
......@@ -28,8 +28,7 @@ namespace Marble
{
const QString OsmTagEditorWidgetPrivate::m_customTagAdderText = QObject::tr( "Add custom tag..." );
OsmTagEditorWidgetPrivate::OsmTagEditorWidgetPrivate( OsmTagEditorWidget* q_)
:q( q_ )
OsmTagEditorWidgetPrivate::OsmTagEditorWidgetPrivate()
{
// nothing to do
}
......@@ -39,31 +38,6 @@ OsmTagEditorWidgetPrivate::~OsmTagEditorWidgetPrivate()
// nothing to do
}
void OsmTagEditorWidgetPrivate::init( QWidget* parent )
{
setupUi( parent );
populatePresetTagsList();
populateCurrentTagsList();
m_recommendedTagsList->setSelectionBehavior( QAbstractItemView::SelectRows );
m_recommendedTagsList->setSelectionMode( QAbstractItemView::SingleSelection );
m_recommendedTagsList->setRootIsDecorated( false );
m_currentTagsList->setSelectionBehavior( QAbstractItemView::SelectRows );
m_currentTagsList->setSelectionMode( QAbstractItemView::SingleSelection );
m_currentTagsList->setRootIsDecorated( false );
QObject::connect( m_addTagButton, SIGNAL( pressed() ),
q, SLOT( addSelectedTag() ) );
QObject::connect( m_recommendedTagsList, SIGNAL( itemDoubleClicked( QTreeWidgetItem*, int ) ),
q, SLOT( addSelectedTag() ) );
QObject::connect( m_removeTagButton, SIGNAL( pressed() ),
q, SLOT( removeSelectedTag() ) );
QObject::connect( m_currentTagsList, SIGNAL( itemChanged( QTreeWidgetItem*, int ) ),
q, SLOT( handleItemChanged( QTreeWidgetItem*, int ) ) );
QObject::connect( m_currentTagsList, SIGNAL( itemDoubleClicked(QTreeWidgetItem*,int) ),
q, SLOT( handleDoubleClick( QTreeWidgetItem*, int) ) );
}
void OsmTagEditorWidgetPrivate::populateCurrentTagsList()
{
// Name tag
......
......@@ -23,9 +23,8 @@ class OsmTagEditorWidgetPrivate : public Ui::OsmTagEditorWidgetPrivate
{
public:
typedef OsmPresetLibrary::OsmTag OsmTag;
OsmTagEditorWidgetPrivate( OsmTagEditorWidget *q_ );
OsmTagEditorWidgetPrivate();
~OsmTagEditorWidgetPrivate();
void init( QWidget* parent );
void populatePresetTagsList();
void populateCurrentTagsList();
......@@ -57,8 +56,6 @@ private:
*/
void addPattern( QStringList &filter, const OsmPlacemarkData &osmData, const QStringList &pattern ) const;
OsmTagEditorWidget* const q;
GeoDataPlacemark *m_placemark;
static const QString m_customTagAdderText;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment