diff --git a/python/gui/qgsprojectionselector.sip b/python/gui/qgsprojectionselector.sip index 2ae9ef53991..2a4bab05d52 100644 --- a/python/gui/qgsprojectionselector.sip +++ b/python/gui/qgsprojectionselector.sip @@ -89,8 +89,6 @@ class QgsProjectionSelector: QWidget //, private Ui::QgsProjectionSelectorBase */ void setOgcWmsCrsFilter(QSet crsFilter); - void on_pbnFind_clicked(); - protected: /** Used to ensure the projection list view is actually populated */ void showEvent ( QShowEvent * theEvent ); diff --git a/src/core/qgsapplication.cpp b/src/core/qgsapplication.cpp index d880959a9d0..863ea349424 100644 --- a/src/core/qgsapplication.cpp +++ b/src/core/qgsapplication.cpp @@ -551,6 +551,16 @@ QString QgsApplication::reportStyleSheet() " color: black;" " font-family: arial,sans-serif;" "}" + "h1{ background-color: #F6F6F6;" + " color: #8FB171; " + " font-size: x-large; " + " font-weight: normal;" + " font-family: luxi serif, georgia, times new roman, times, serif;" + " background: none;" + " padding: 0.75em 0 0;" + " margin: 0;" + " line-height: 3em;" + "}" "h2{ background-color: #F6F6F6;" " color: #8FB171; " " font-size: medium; " diff --git a/src/gui/qgsgenericprojectionselector.cpp b/src/gui/qgsgenericprojectionselector.cpp index 46f8d5452e4..0e319c34e71 100644 --- a/src/gui/qgsgenericprojectionselector.cpp +++ b/src/gui/qgsgenericprojectionselector.cpp @@ -15,6 +15,8 @@ * (at your option) any later version. * * * ***************************************************************************/ +#include "qgsapplication.h" + #include #include @@ -38,20 +40,18 @@ void QgsGenericProjectionSelector::setMessage( QString theMessage ) if ( theMessage.isEmpty() ) { // Set up text edit pane - QString format( "

%1

%2 %3" ); + QString format( "

%1

%2 %3" ); QString header = tr( "Define this layer's coordinate reference system:" ); QString sentence1 = tr( "This layer appears to have no projection specification." ); QString sentence2 = tr( "By default, this layer will now have its projection set to that of the project, " "but you may override this by selecting a different projection below." ); - textEdit->setHtml( format.arg( header ).arg( sentence1 ) - .arg( sentence2 ) ); + theMessage = format.arg( header ).arg( sentence1 ).arg( sentence2 ); } - else - { - textEdit->setHtml( theMessage ); - } - textEdit->show(); + QString myStyle = QgsApplication::reportStyleSheet(); + theMessage = "" + theMessage + ""; + textEdit->setHtml( theMessage ); + textEdit->show(); } //! Destructor QgsGenericProjectionSelector::~QgsGenericProjectionSelector() diff --git a/src/gui/qgsprojectionselector.cpp b/src/gui/qgsprojectionselector.cpp index 4c15170f16b..378a5162f5b 100644 --- a/src/gui/qgsprojectionselector.cpp +++ b/src/gui/qgsprojectionselector.cpp @@ -61,16 +61,6 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name, // Hide (internal) ID column lstRecent->setColumnHidden(QGIS_CRS_ID_COLUMN, true); - cbxAuthority->addItem( tr( "All" ) ); - cbxAuthority->addItems( authorities() ); - - // TEMP? hide buttons, we now implemented filter - cbxAuthority->hide(); - cbxMode->hide(); - label->hide(); - label_2->hide(); - pbnFind->hide(); - // Read settings from persistent storage QSettings settings; mRecentProjections = settings.value( "/UI/recentProjections" ).toStringList(); @@ -146,7 +136,6 @@ QgsProjectionSelector::~QgsProjectionSelector() } } - void QgsProjectionSelector::resizeEvent( QResizeEvent * theEvent ) { lstCoordinateSystems->header()->resizeSection( NAME_COLUMN, theEvent->size().width() - 240 ); @@ -877,121 +866,6 @@ void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *cu setSelectedCrsId( current->text( QGIS_CRS_ID_COLUMN ).toLong() ); } -void QgsProjectionSelector::on_pbnFind_clicked() -{ - QgsDebugMsg( "pbnFind..." ); - - QString mySearchString( sqlSafeString( leSearch->text() ) ); - - // Set up the query to retrieve the projection information needed to populate the list - QString mySql = "select srs_id from tbl_srs where "; - if ( cbxAuthority->currentIndex() > 0 ) - { - mySql += QString( "auth_name='%1' AND " ).arg( cbxAuthority->currentText() ); - } - - if ( cbxHideDeprecated->isChecked() ) - { - mySql += "not deprecated AND "; - } - - if ( cbxMode->currentIndex() == 0 ) - { - mySql += QString( "auth_id='%1'" ).arg( mySearchString ); - } - else - { - mySql += "upper(description) like '%" + mySearchString.toUpper() + "%' "; - - long myLargestSrsId = getLargestCRSIDMatch( QString( "%1 order by srs_id desc limit 1" ).arg( mySql ) ); - QgsDebugMsg( QString( "Largest CRSID%1" ).arg( myLargestSrsId ) ); - - //a name search is ambiguous, so we find the first srsid after the current selected srsid - // each time the find button is pressed. This means we can loop through all matches. - if ( myLargestSrsId <= selectedCrsId() ) - { - mySql = QString( "%1 order by srs_id limit 1" ).arg( mySql ); - } - else - { - // search ahead of the current position - mySql = QString( "%1 and srs_id > %2 order by srs_id limit 1" ).arg( mySql ).arg( selectedCrsId() ); - } - } - QgsDebugMsg( QString( " Search sql: %1" ).arg( mySql ) ); - - // - // Now perform the actual search - // - - sqlite3 *myDatabase; - const char *myTail; - sqlite3_stmt *myPreparedStatement; - int myResult; - //check the db is available - myResult = sqlite3_open( mSrsDatabaseFileName.toUtf8().data(), &myDatabase ); - if ( myResult ) - { - // XXX This will likely never happen since on open, sqlite creates the - // database if it does not exist. But we checked earlier for its existance - // and aborted in that case. This is because we may be runnig from read only - // media such as live cd and don't want to force trying to create a db. - showDBMissingWarning( mSrsDatabaseFileName ); - return; - } - - myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail ); - // XXX Need to free memory from the error msg if one is set - if ( myResult == SQLITE_OK ) - { - myResult = sqlite3_step( myPreparedStatement ); - if ( myResult == SQLITE_ROW ) - { - QString mySrsId = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ); - setSelectedCrsId( mySrsId.toLong() ); - // close the sqlite3 statement - sqlite3_finalize( myPreparedStatement ); - sqlite3_close( myDatabase ); - return; - } - } - //search the users db - QString myDatabaseFileName = QgsApplication::qgisUserDbFilePath(); - QFileInfo myFileInfo; - myFileInfo.setFile( myDatabaseFileName ); - if ( !myFileInfo.exists( ) ) //its not critical if this happens - { - QgsDebugMsg( QString( "%1\nUser db does not exist" ).arg( myDatabaseFileName ) ); - return ; - } - myResult = sqlite3_open( myDatabaseFileName.toUtf8().data(), &myDatabase ); - if ( myResult ) - { - QgsDebugMsg( QString( "Can't open * user * database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) ); - //no need for assert because user db may not have been created yet - return; - } - - myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail ); - // XXX Need to free memory from the error msg if one is set - if ( myResult == SQLITE_OK ) - { - myResult = sqlite3_step( myPreparedStatement ); - if ( myResult == SQLITE_ROW ) - { - QString mySrsId = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) ); - setSelectedCrsId( mySrsId.toLong() ); - // close the sqlite3 statement - sqlite3_finalize( myPreparedStatement ); - sqlite3_close( myDatabase ); - return; - } - } - - QMessageBox::information( this, tr( "Find projection" ), tr( "No matching projection found." ) ); - lstCoordinateSystems->clearSelection(); - teProjection->setText( "" ); -} void QgsProjectionSelector::on_leSearch_textChanged( const QString & theFilterTxt) { diff --git a/src/gui/qgsprojectionselector.h b/src/gui/qgsprojectionselector.h index 4c280dc48f5..5cc769b8550 100644 --- a/src/gui/qgsprojectionselector.h +++ b/src/gui/qgsprojectionselector.h @@ -113,8 +113,6 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio * \warning This function's behaviour is undefined if it is called after the widget is shown. */ void setOgcWmsCrsFilter( QSet crsFilter ); - - void on_pbnFind_clicked(); void on_lstRecent_currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * ); void on_cbxHideDeprecated_stateChanged(); void on_leSearch_textChanged(const QString &); diff --git a/src/ui/qgsprojectionselectorbase.ui b/src/ui/qgsprojectionselectorbase.ui index ebde5751ff7..b3d0ee9d882 100644 --- a/src/ui/qgsprojectionselectorbase.ui +++ b/src/ui/qgsprojectionselectorbase.ui @@ -7,7 +7,7 @@ 0 0 574 - 389 + 390 @@ -24,170 +24,172 @@ - - - 3 - - - 3 - + - - - - 0 - 0 - - - - Filter - - - - - - - - - - - - 100 - 16777215 - - - - Find - - - true - - - - - - - + + + + + Filter + + + + + + + - + + + + 75 + true + + Recently used coordinate references systems - - - - - 0 - 0 - + + + + Qt::Vertical - - - 0 - 105 - - - - - 16777215 - 200 - - - + true - - false - - - true - - - 3 - - - - Coordinate Reference System + + + + 0 + 0 + - - - - Authority ID + + + 0 + 105 + - - - - ID + + + 16777215 + 200 + - + + true + + + false + + + true + + + 3 + + + + Coordinate Reference System + + + + + Authority ID + + + + + ID + + + + + + + 0 + + + + + 0 + + + + + + 75 + true + + + + Coordinate reference systems of the world + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + 7 + + + + Hide deprecated CRSs + + + + + + + + + true + + + true + + + 3 + + + + Coordinate Reference System + + + + + Authority ID + + + + + ID + + + + + + - - - - 15 - - - - - Coordinate reference systems of the world - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - - - Hide deprecated CRSs - - - - - - - - - true - - - true - - - 3 - - - - Coordinate Reference System - - - - - Authority ID - - - - - ID - - - - - + @@ -198,7 +200,7 @@ 0 - 30 + 40 @@ -210,7 +212,7 @@ 0 - 50 + 40 @@ -221,64 +223,13 @@ - - - - - - Authority - - - - - - - - - - Search for - - - - - - - - ID - - - - - Name - - - - - - - - Qt::Horizontal - - - - 40 - 20 - - - - - - lstCoordinateSystems teProjection - cbxAuthority - cbxMode leSearch - pbnFind