Skip to content

Commit

Permalink
apply pull #64:
Browse files Browse the repository at this point in the history
- make proj4 string area resizable
- this overriding the cursor messes up the cursor in the Qsplitter etc.
- 4 recent crs's is a little low... make it 8
- fixing the selecting of the non-current crs when dialog shows
  • Loading branch information
rduivenvoorde authored and jef-n committed Dec 22, 2011
1 parent 875337c commit 5829fed
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 66 deletions.
10 changes: 6 additions & 4 deletions src/app/qgisapp.cpp
Expand Up @@ -343,7 +343,9 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
mySelector->setSelectedCrsId( defaultCrs.srsid() );
}

QApplication::setOverrideCursor( Qt::ArrowCursor );
// why is this: it overrides the default cursor in the splitter in the dialog
// commenting it now till somebody tells us why it is neccesary :-)
//QApplication::setOverrideCursor( Qt::ArrowCursor );

if ( mySelector->exec() )
{
Expand All @@ -352,7 +354,7 @@ static void customSrsValidation_( QgsCoordinateReferenceSystem* srs )
srs->createFromOgcWmsCrs( mySelector->selectedAuthId() );
}

QApplication::restoreOverrideCursor();
//QApplication::restoreOverrideCursor();

delete mySelector;
}
Expand Down Expand Up @@ -2873,8 +2875,8 @@ void QgisApp::fileSaveAs()
QString lastUsedDir = settings.value( "/UI/lastProjectDir", "." ).toString();

std::auto_ptr<QFileDialog> saveFileDialog( new QFileDialog( this,
tr( "Choose a file name to save the QGIS project file as" ),
lastUsedDir, tr( "QGis files (*.qgs)" ) ) );
tr( "Choose a file name to save the QGIS project file as" ),
lastUsedDir, tr( "QGis files (*.qgs)" ) ) );
saveFileDialog->setFileMode( QFileDialog::AnyFile );
saveFileDialog->setAcceptMode( QFileDialog::AcceptSave );
saveFileDialog->setConfirmOverwrite( true );
Expand Down
119 changes: 64 additions & 55 deletions src/gui/qgsprojectionselector.cpp
Expand Up @@ -53,13 +53,13 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name,
lstCoordinateSystems->header()->resizeSection( QGIS_CRS_ID_COLUMN, 0 );
lstCoordinateSystems->header()->setResizeMode( QGIS_CRS_ID_COLUMN, QHeaderView::Fixed );
// Hide (internal) ID column
lstCoordinateSystems->setColumnHidden(QGIS_CRS_ID_COLUMN, true);
lstCoordinateSystems->setColumnHidden( QGIS_CRS_ID_COLUMN, true );

lstRecent->header()->setResizeMode( AUTHID_COLUMN, QHeaderView::Stretch );
lstRecent->header()->resizeSection( QGIS_CRS_ID_COLUMN, 0 );
lstRecent->header()->setResizeMode( QGIS_CRS_ID_COLUMN, QHeaderView::Fixed );
// Hide (internal) ID column
lstRecent->setColumnHidden(QGIS_CRS_ID_COLUMN, true);
lstRecent->setColumnHidden( QGIS_CRS_ID_COLUMN, true );

// Read settings from persistent storage
QSettings settings;
Expand Down Expand Up @@ -108,7 +108,7 @@ QgsProjectionSelector::~QgsProjectionSelector()
mRecentProjections.removeAll( QString::number( crsId ) );
mRecentProjections.prepend( QString::number( crsId ) );
// Prune size of list
while ( mRecentProjections.size() > 4 )
while ( mRecentProjections.size() > 8 )
{
mRecentProjections.removeLast();
}
Expand Down Expand Up @@ -794,7 +794,7 @@ void QgsProjectionSelector::loadCrsList( QSet<QString> *crsFilter )
// display the qgis srs_id (field 1) in the third column of the list view
newItem->setText( QGIS_CRS_ID_COLUMN, QString::fromUtf8(( char * )sqlite3_column_text( ppStmt, 1 ) ) );
// expand also parent node
newItem->parent()->setExpanded(true);
newItem->parent()->setExpanded( true );
}

// display the qgis deprecated in the user data of the item
Expand Down Expand Up @@ -861,68 +861,77 @@ void QgsProjectionSelector::on_cbxHideDeprecated_stateChanged()

void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *current, QTreeWidgetItem *previous )
{
Q_UNUSED( previous );
if ( current )
// we receive a change event when we make dialog visible,
// on only when there is also a'previous' it is a real user induced event
if ( current && previous )
{
setSelectedCrsId( current->text( QGIS_CRS_ID_COLUMN ).toLong() );
}
}


void QgsProjectionSelector::on_leSearch_textChanged( const QString & theFilterTxt)
void QgsProjectionSelector::on_leSearch_textChanged( const QString & theFilterTxt )
{
// filter recent crs's
QTreeWidgetItemIterator itr(lstRecent);
while (*itr) {
if ( (*itr)->childCount() == 0 ) // it's an end node aka a projection
// filter recent crs's
QTreeWidgetItemIterator itr( lstRecent );
while ( *itr )
{
if (( *itr )->childCount() == 0 ) // it's an end node aka a projection
{
if (( *itr )->text( NAME_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
|| ( *itr )->text( AUTHID_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
)
{
( *itr )->setHidden( false );
QTreeWidgetItem * parent = ( *itr )->parent();
while ( parent != NULL )
{
if ( (*itr)->text( NAME_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
|| (*itr)->text( AUTHID_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
)
{
(*itr)->setHidden(false);
QTreeWidgetItem * parent = (*itr)->parent();
while (parent != NULL)
{
parent->setExpanded(true);
parent->setHidden(false);
parent = parent->parent();
}
}
else{
(*itr)->setHidden(true);
}
}
else{
(*itr)->setHidden(true);
parent->setExpanded( true );
parent->setHidden( false );
parent = parent->parent();
}
++itr;
}
else
{
( *itr )->setHidden( true );
}
}
else
{
( *itr )->setHidden( true );
}
// filter crs's
QTreeWidgetItemIterator it(lstCoordinateSystems);
while (*it) {
if ( (*it)->childCount() == 0 ) // it's an end node aka a projection
++itr;
}
// filter crs's
QTreeWidgetItemIterator it( lstCoordinateSystems );
while ( *it )
{
if (( *it )->childCount() == 0 ) // it's an end node aka a projection
{
if (( *it )->text( NAME_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
|| ( *it )->text( AUTHID_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
)
{
( *it )->setHidden( false );
QTreeWidgetItem * parent = ( *it )->parent();
while ( parent != NULL )
{
if ( (*it)->text( NAME_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
|| (*it)->text( AUTHID_COLUMN ).contains( theFilterTxt, Qt::CaseInsensitive )
)
{
(*it)->setHidden(false);
QTreeWidgetItem * parent = (*it)->parent();
while (parent != NULL)
{
parent->setExpanded(true);
parent->setHidden(false);
parent = parent->parent();
}
}
else{
(*it)->setHidden(true);
}
parent->setExpanded( true );
parent->setHidden( false );
parent = parent->parent();
}
else{
(*it)->setHidden(true);
}
++it;
}
else
{
( *it )->setHidden( true );
}
}
else
{
( *it )->setHidden( true );
}
++it;
}
}


Expand Down
8 changes: 1 addition & 7 deletions src/ui/qgsprojectionselectorbase.ui
Expand Up @@ -191,12 +191,6 @@
</item>
<item row="3" column="0">
<widget class="QTextEdit" name="teProjection">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
Expand All @@ -206,7 +200,7 @@
<property name="maximumSize">
<size>
<width>16777215</width>
<height>50</height>
<height>90</height>
</size>
</property>
<property name="baseSize">
Expand Down

0 comments on commit 5829fed

Please sign in to comment.