Skip to content

Commit

Permalink
raster properties pipe tab removed
Browse files Browse the repository at this point in the history
  • Loading branch information
blazek committed Apr 15, 2013
1 parent ea694c7 commit f9a6f0a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 209 deletions.
105 changes: 0 additions & 105 deletions src/app/qgsrasterlayerproperties.cpp
Expand Up @@ -382,8 +382,6 @@ QgsRasterLayerProperties::QgsRasterLayerProperties( QgsMapLayer* lyr, QgsMapCanv
}
on_mRenderTypeComboBox_currentIndexChanged( mRenderTypeComboBox->currentIndex() );

updatePipeList();

// update based on lyr's current state
sync();

Expand Down Expand Up @@ -902,8 +900,6 @@ void QgsRasterLayerProperties::apply()

// notify the project we've made a change
QgsProject::instance()->dirty( true );

updatePipeList();
}//apply

void QgsRasterLayerProperties::on_mLayerOrigNameLineEd_textEdited( const QString& text )
Expand Down Expand Up @@ -1691,107 +1687,6 @@ void QgsRasterLayerProperties::toggleBuildPyramidsButton()
}
}

void QgsRasterLayerProperties::updatePipeList()
{
QgsDebugMsg( "Entered" );

#ifndef QGISDEBUG
mOptionsStackedWidget->removeWidget( mOptsPage_Pipe ); // just delete instead?
#else
mPipeTreeWidget->clear();

mPipeTreeWidget->header()->setResizeMode( QHeaderView::ResizeToContents );

if ( mPipeTreeWidget->columnCount() <= 1 )
{
QStringList labels;
labels << tr( "Filter" ) << tr( "Bands" );
mPipeTreeWidget->setHeaderLabels( labels );
connect( mPipeTreeWidget, SIGNAL( itemClicked( QTreeWidgetItem *, int ) ), this, SLOT( pipeItemClicked( QTreeWidgetItem *, int ) ) );
}

QgsRasterPipe *pipe = mRasterLayer->pipe();
for ( int i = 0; i < pipe->size(); i++ )
{
QgsRasterInterface * interface = pipe->at( i );
QStringList texts;
QString name;
// Unfortunately at this moment not all interfaces inherits from QObject
QObject *o = dynamic_cast<QObject*>( interface );
if ( o )
{
//name = o->objectName(); // gives empty with provider
name = o->metaObject()->className();
}
else
{
name = QString( typeid( *interface ).name() ).replace( QRegExp( ".*Qgs" ), "Qgs" );
}

texts << name << QString( "%1" ).arg( interface->bandCount() );
//texts << QString( "%1 ms" ).arg( interface->time() );
QTreeWidgetItem *item = new QTreeWidgetItem( texts );

#if 0
// Switching on/off would be possible but problematic - drawer is not pipe
// memer so we don't know required output format
// Checkboxes are very useful however for QgsRasterPipe debugging.
bool on = interface->on();
item->setCheckState( 0, on ? Qt::Checked : Qt::Unchecked );

Qt::ItemFlags flags = Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDragEnabled;
#endif
Qt::ItemFlags flags = Qt::ItemIsEnabled;
item->setFlags( flags );

mPipeTreeWidget->addTopLevelItem( item );
}
updatePipeItems();
#endif
}

void QgsRasterLayerProperties::pipeItemClicked( QTreeWidgetItem * item, int column )
{
Q_UNUSED( column );
QgsDebugMsg( "Entered" );
int idx = mPipeTreeWidget->indexOfTopLevelItem( item );

// This should not fail because we have enabled only checkboxes of items
// which may be changed
mRasterLayer->pipe()->setOn( idx, item->checkState( 0 ) );

updatePipeItems();
}

void QgsRasterLayerProperties::updatePipeItems()
{
QgsDebugMsg( "Entered" );

QgsRasterPipe *pipe = mRasterLayer->pipe();

for ( int i = 0; i < pipe->size(); i++ )
{
if ( i >= mPipeTreeWidget->topLevelItemCount() ) break;
QTreeWidgetItem *item = mPipeTreeWidget->topLevelItem( i );
if ( !item ) continue;
// Checkboxes disabled for now, see above
#if 0
QgsRasterInterface * iface = pipe->at( i );
bool on = iface->on();
Qt::ItemFlags flags = item->flags();
if ( pipe->canSetOn( i, !on ) )
{
flags |= Qt::ItemIsUserCheckable;
}
else
{
flags |= ( Qt::ItemFlags )~Qt::ItemIsUserCheckable;
}
item->setFlags( flags );
#endif
}
}

void QgsRasterLayerProperties::on_mMinimumScaleSetCurrentPushButton_clicked()
{
cbMinimumScale->setScale( 1.0 / QgisApp::instance()->mapCanvas()->mapRenderer()->scale() );
Expand Down
9 changes: 0 additions & 9 deletions src/app/qgsrasterlayerproperties.h
Expand Up @@ -115,9 +115,6 @@ class QgsRasterLayerProperties : public QgsOptionsDialogBase, private Ui::QgsRas
/**Enable or disable colorize controls depending on checkbox */
void toggleColorizeControls( bool colorizeEnabled );

/** Update items in pipe list */
void pipeItemClicked( QTreeWidgetItem * item, int column );

/** Transparency cell changed */
void transparencyCellTextEdited( const QString & text );

Expand Down Expand Up @@ -181,12 +178,6 @@ class QgsRasterLayerProperties : public QgsOptionsDialogBase, private Ui::QgsRas
qreal mGradientHeight;
qreal mGradientWidth;

/** Update pipe tab - interfaces list */
void updatePipeList();

/** Update items in pipe list */
void updatePipeItems();

QgsMapCanvas* mMapCanvas;
QgsMapToolEmitPoint* mPixelSelectorTool;

Expand Down
112 changes: 17 additions & 95 deletions src/ui/qgsrasterlayerpropertiesbase.ui
Expand Up @@ -152,18 +152,6 @@
<normaloff>:/images/themes/default/propertyicons/histogram.png</normaloff>:/images/themes/default/propertyicons/histogram.png</iconset>
</property>
</item>
<item>
<property name="text">
<string>Pipe</string>
</property>
<property name="toolTip">
<string>Pipe</string>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/propertyicons/action.png</normaloff>:/images/themes/default/propertyicons/action.png</iconset>
</property>
</item>
</widget>
</item>
</layout>
Expand Down Expand Up @@ -194,7 +182,7 @@
</sizepolicy>
</property>
<property name="currentIndex">
<number>0</number>
<number>2</number>
</property>
<widget class="QWidget" name="mOptsPage_General">
<layout class="QVBoxLayout" name="verticalLayout_6">
Expand Down Expand Up @@ -224,8 +212,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>646</height>
<width>713</width>
<height>686</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_7">
Expand Down Expand Up @@ -692,8 +680,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>646</height>
<width>150</width>
<height>236</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_10">
Expand Down Expand Up @@ -816,8 +804,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>646</height>
<width>713</width>
<height>686</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_13">
Expand Down Expand Up @@ -1331,8 +1319,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>646</height>
<width>431</width>
<height>384</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5">
Expand Down Expand Up @@ -1537,6 +1525,9 @@
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
<attribute name="horizontalHeaderStretchLastSection">
<bool>true</bool>
</attribute>
</widget>
</item>
<item row="0" column="0">
Expand Down Expand Up @@ -1748,8 +1739,8 @@
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>646</height>
<width>557</width>
<height>164</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_12">
Expand Down Expand Up @@ -1812,7 +1803,7 @@
<string>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
p, li { white-space: pre-wrap; }
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'Lucida Grande'; font-size:13pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:'DejaVu Sans'; font-size:10pt; font-weight:400; font-style:normal;&quot;&gt;
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:'Cantarell'; font-size:11pt;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</string>
</property>
</widget>
Expand Down Expand Up @@ -1919,8 +1910,8 @@ p, li { white-space: pre-wrap; }
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>646</height>
<width>82</width>
<height>18</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_16">
Expand Down Expand Up @@ -1951,75 +1942,6 @@ p, li { white-space: pre-wrap; }
</item>
</layout>
</widget>
<widget class="QWidget" name="mOptsPage_Pipe">
<layout class="QVBoxLayout" name="verticalLayout_17">
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label_14">
<property name="styleSheet">
<string notr="true">font-weight:bold;</string>
</property>
<property name="text">
<string>Pipe</string>
</property>
</widget>
</item>
<item>
<widget class="QScrollArea" name="scrollArea_7">
<property name="frameShape">
<enum>QFrame::NoFrame</enum>
</property>
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_7">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>693</width>
<height>646</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_18">
<property name="topMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QGroupBox" name="mPipeGrpBx">
<property name="title">
<string/>
</property>
<layout class="QVBoxLayout" name="verticalLayout_20">
<item>
<widget class="QTreeWidget" name="mPipeTreeWidget">
<property name="rootIsDecorated">
<bool>false</bool>
</property>
<attribute name="headerStretchLastSection">
<bool>true</bool>
</attribute>
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
Expand Down

0 comments on commit f9a6f0a

Please sign in to comment.