Skip to content

Commit 36e178f

Browse files
NathanW2jef-n
authored andcommittedNov 27, 2011
UI tweaks to the projection UI; Remove old buttons and code etc
1 parent dc56ea9 commit 36e178f

File tree

6 files changed

+166
-335
lines changed

6 files changed

+166
-335
lines changed
 

‎python/gui/qgsprojectionselector.sip

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,6 @@ class QgsProjectionSelector: QWidget //, private Ui::QgsProjectionSelectorBase
8989
*/
9090
void setOgcWmsCrsFilter(QSet<QString> crsFilter);
9191

92-
void on_pbnFind_clicked();
93-
9492
protected:
9593
/** Used to ensure the projection list view is actually populated */
9694
void showEvent ( QShowEvent * theEvent );

‎src/core/qgsapplication.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -551,6 +551,16 @@ QString QgsApplication::reportStyleSheet()
551551
" color: black;"
552552
" font-family: arial,sans-serif;"
553553
"}"
554+
"h1{ background-color: #F6F6F6;"
555+
" color: #8FB171; "
556+
" font-size: x-large; "
557+
" font-weight: normal;"
558+
" font-family: luxi serif, georgia, times new roman, times, serif;"
559+
" background: none;"
560+
" padding: 0.75em 0 0;"
561+
" margin: 0;"
562+
" line-height: 3em;"
563+
"}"
554564
"h2{ background-color: #F6F6F6;"
555565
" color: #8FB171; "
556566
" font-size: medium; "

‎src/gui/qgsgenericprojectionselector.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
* (at your option) any later version. *
1616
* *
1717
***************************************************************************/
18+
#include "qgsapplication.h"
19+
1820
#include <qgsgenericprojectionselector.h>
1921
#include <QApplication>
2022

@@ -38,20 +40,18 @@ void QgsGenericProjectionSelector::setMessage( QString theMessage )
3840
if ( theMessage.isEmpty() )
3941
{
4042
// Set up text edit pane
41-
QString format( "<h2>%1</h2>%2 %3" );
43+
QString format( "<h1>%1</h1>%2 %3" );
4244
QString header = tr( "Define this layer's coordinate reference system:" );
4345
QString sentence1 = tr( "This layer appears to have no projection specification." );
4446
QString sentence2 = tr( "By default, this layer will now have its projection set to that of the project, "
4547
"but you may override this by selecting a different projection below." );
46-
textEdit->setHtml( format.arg( header ).arg( sentence1 )
47-
.arg( sentence2 ) );
48-
}
49-
else
50-
{
51-
textEdit->setHtml( theMessage );
48+
theMessage = format.arg( header ).arg( sentence1 ).arg( sentence2 );
5249
}
53-
textEdit->show();
5450

51+
QString myStyle = QgsApplication::reportStyleSheet();
52+
theMessage = "<head><style>" + myStyle + "</style></head><body>" + theMessage + "</body>";
53+
textEdit->setHtml( theMessage );
54+
textEdit->show();
5555
}
5656
//! Destructor
5757
QgsGenericProjectionSelector::~QgsGenericProjectionSelector()

‎src/gui/qgsprojectionselector.cpp

Lines changed: 0 additions & 126 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ QgsProjectionSelector::QgsProjectionSelector( QWidget* parent, const char *name,
6161
// Hide (internal) ID column
6262
lstRecent->setColumnHidden(QGIS_CRS_ID_COLUMN, true);
6363

64-
cbxAuthority->addItem( tr( "All" ) );
65-
cbxAuthority->addItems( authorities() );
66-
67-
// TEMP? hide buttons, we now implemented filter
68-
cbxAuthority->hide();
69-
cbxMode->hide();
70-
label->hide();
71-
label_2->hide();
72-
pbnFind->hide();
73-
7464
// Read settings from persistent storage
7565
QSettings settings;
7666
mRecentProjections = settings.value( "/UI/recentProjections" ).toStringList();
@@ -146,7 +136,6 @@ QgsProjectionSelector::~QgsProjectionSelector()
146136
}
147137
}
148138

149-
150139
void QgsProjectionSelector::resizeEvent( QResizeEvent * theEvent )
151140
{
152141
lstCoordinateSystems->header()->resizeSection( NAME_COLUMN, theEvent->size().width() - 240 );
@@ -877,121 +866,6 @@ void QgsProjectionSelector::on_lstRecent_currentItemChanged( QTreeWidgetItem *cu
877866
setSelectedCrsId( current->text( QGIS_CRS_ID_COLUMN ).toLong() );
878867
}
879868

880-
void QgsProjectionSelector::on_pbnFind_clicked()
881-
{
882-
QgsDebugMsg( "pbnFind..." );
883-
884-
QString mySearchString( sqlSafeString( leSearch->text() ) );
885-
886-
// Set up the query to retrieve the projection information needed to populate the list
887-
QString mySql = "select srs_id from tbl_srs where ";
888-
if ( cbxAuthority->currentIndex() > 0 )
889-
{
890-
mySql += QString( "auth_name='%1' AND " ).arg( cbxAuthority->currentText() );
891-
}
892-
893-
if ( cbxHideDeprecated->isChecked() )
894-
{
895-
mySql += "not deprecated AND ";
896-
}
897-
898-
if ( cbxMode->currentIndex() == 0 )
899-
{
900-
mySql += QString( "auth_id='%1'" ).arg( mySearchString );
901-
}
902-
else
903-
{
904-
mySql += "upper(description) like '%" + mySearchString.toUpper() + "%' ";
905-
906-
long myLargestSrsId = getLargestCRSIDMatch( QString( "%1 order by srs_id desc limit 1" ).arg( mySql ) );
907-
QgsDebugMsg( QString( "Largest CRSID%1" ).arg( myLargestSrsId ) );
908-
909-
//a name search is ambiguous, so we find the first srsid after the current selected srsid
910-
// each time the find button is pressed. This means we can loop through all matches.
911-
if ( myLargestSrsId <= selectedCrsId() )
912-
{
913-
mySql = QString( "%1 order by srs_id limit 1" ).arg( mySql );
914-
}
915-
else
916-
{
917-
// search ahead of the current position
918-
mySql = QString( "%1 and srs_id > %2 order by srs_id limit 1" ).arg( mySql ).arg( selectedCrsId() );
919-
}
920-
}
921-
QgsDebugMsg( QString( " Search sql: %1" ).arg( mySql ) );
922-
923-
//
924-
// Now perform the actual search
925-
//
926-
927-
sqlite3 *myDatabase;
928-
const char *myTail;
929-
sqlite3_stmt *myPreparedStatement;
930-
int myResult;
931-
//check the db is available
932-
myResult = sqlite3_open( mSrsDatabaseFileName.toUtf8().data(), &myDatabase );
933-
if ( myResult )
934-
{
935-
// XXX This will likely never happen since on open, sqlite creates the
936-
// database if it does not exist. But we checked earlier for its existance
937-
// and aborted in that case. This is because we may be runnig from read only
938-
// media such as live cd and don't want to force trying to create a db.
939-
showDBMissingWarning( mSrsDatabaseFileName );
940-
return;
941-
}
942-
943-
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail );
944-
// XXX Need to free memory from the error msg if one is set
945-
if ( myResult == SQLITE_OK )
946-
{
947-
myResult = sqlite3_step( myPreparedStatement );
948-
if ( myResult == SQLITE_ROW )
949-
{
950-
QString mySrsId = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) );
951-
setSelectedCrsId( mySrsId.toLong() );
952-
// close the sqlite3 statement
953-
sqlite3_finalize( myPreparedStatement );
954-
sqlite3_close( myDatabase );
955-
return;
956-
}
957-
}
958-
//search the users db
959-
QString myDatabaseFileName = QgsApplication::qgisUserDbFilePath();
960-
QFileInfo myFileInfo;
961-
myFileInfo.setFile( myDatabaseFileName );
962-
if ( !myFileInfo.exists( ) ) //its not critical if this happens
963-
{
964-
QgsDebugMsg( QString( "%1\nUser db does not exist" ).arg( myDatabaseFileName ) );
965-
return ;
966-
}
967-
myResult = sqlite3_open( myDatabaseFileName.toUtf8().data(), &myDatabase );
968-
if ( myResult )
969-
{
970-
QgsDebugMsg( QString( "Can't open * user * database: %1" ).arg( sqlite3_errmsg( myDatabase ) ) );
971-
//no need for assert because user db may not have been created yet
972-
return;
973-
}
974-
975-
myResult = sqlite3_prepare( myDatabase, mySql.toUtf8(), mySql.toUtf8().length(), &myPreparedStatement, &myTail );
976-
// XXX Need to free memory from the error msg if one is set
977-
if ( myResult == SQLITE_OK )
978-
{
979-
myResult = sqlite3_step( myPreparedStatement );
980-
if ( myResult == SQLITE_ROW )
981-
{
982-
QString mySrsId = QString::fromUtf8(( char * )sqlite3_column_text( myPreparedStatement, 0 ) );
983-
setSelectedCrsId( mySrsId.toLong() );
984-
// close the sqlite3 statement
985-
sqlite3_finalize( myPreparedStatement );
986-
sqlite3_close( myDatabase );
987-
return;
988-
}
989-
}
990-
991-
QMessageBox::information( this, tr( "Find projection" ), tr( "No matching projection found." ) );
992-
lstCoordinateSystems->clearSelection();
993-
teProjection->setText( "" );
994-
}
995869

996870
void QgsProjectionSelector::on_leSearch_textChanged( const QString & theFilterTxt)
997871
{

‎src/gui/qgsprojectionselector.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,6 @@ class GUI_EXPORT QgsProjectionSelector: public QWidget, private Ui::QgsProjectio
113113
* \warning This function's behaviour is undefined if it is called after the widget is shown.
114114
*/
115115
void setOgcWmsCrsFilter( QSet<QString> crsFilter );
116-
117-
void on_pbnFind_clicked();
118116
void on_lstRecent_currentItemChanged( QTreeWidgetItem *, QTreeWidgetItem * );
119117
void on_cbxHideDeprecated_stateChanged();
120118
void on_leSearch_textChanged(const QString &);

‎src/ui/qgsprojectionselectorbase.ui

Lines changed: 148 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<x>0</x>
88
<y>0</y>
99
<width>574</width>
10-
<height>389</height>
10+
<height>390</height>
1111
</rect>
1212
</property>
1313
<property name="sizePolicy">
@@ -24,170 +24,172 @@
2424
<normaloff/>
2525
</iconset>
2626
</property>
27-
<layout class="QGridLayout">
28-
<property name="verticalSpacing">
29-
<number>3</number>
30-
</property>
31-
<property name="margin">
32-
<number>3</number>
33-
</property>
27+
<layout class="QGridLayout" name="gridLayout_2">
3428
<item row="0" column="0">
35-
<widget class="QGroupBox" name="groupBox">
36-
<property name="sizePolicy">
37-
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Minimum">
38-
<horstretch>0</horstretch>
39-
<verstretch>0</verstretch>
40-
</sizepolicy>
41-
</property>
42-
<property name="title">
43-
<string>Filter</string>
44-
</property>
45-
<layout class="QVBoxLayout" name="verticalLayout">
46-
<item>
47-
<layout class="QHBoxLayout" name="horizontalLayout">
48-
<item>
49-
<widget class="QLineEdit" name="leSearch"/>
50-
</item>
51-
<item>
52-
<widget class="QPushButton" name="pbnFind">
53-
<property name="maximumSize">
54-
<size>
55-
<width>100</width>
56-
<height>16777215</height>
57-
</size>
58-
</property>
59-
<property name="text">
60-
<string>Find</string>
61-
</property>
62-
<property name="default">
63-
<bool>true</bool>
64-
</property>
65-
</widget>
66-
</item>
67-
</layout>
68-
</item>
69-
</layout>
70-
</widget>
29+
<layout class="QHBoxLayout" name="horizontalLayout">
30+
<item>
31+
<widget class="QLabel" name="label_5">
32+
<property name="text">
33+
<string>Filter</string>
34+
</property>
35+
</widget>
36+
</item>
37+
<item>
38+
<widget class="QLineEdit" name="leSearch"/>
39+
</item>
40+
</layout>
7141
</item>
72-
<item row="3" column="0">
42+
<item row="1" column="0">
7343
<widget class="QLabel" name="label_3">
44+
<property name="font">
45+
<font>
46+
<weight>75</weight>
47+
<bold>true</bold>
48+
</font>
49+
</property>
7450
<property name="text">
7551
<string>Recently used coordinate references systems</string>
7652
</property>
7753
</widget>
7854
</item>
79-
<item row="4" column="0">
80-
<widget class="QTreeWidget" name="lstRecent">
81-
<property name="sizePolicy">
82-
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
83-
<horstretch>0</horstretch>
84-
<verstretch>0</verstretch>
85-
</sizepolicy>
55+
<item row="2" column="0">
56+
<widget class="QSplitter" name="splitter">
57+
<property name="orientation">
58+
<enum>Qt::Vertical</enum>
8659
</property>
87-
<property name="minimumSize">
88-
<size>
89-
<width>0</width>
90-
<height>105</height>
91-
</size>
92-
</property>
93-
<property name="maximumSize">
94-
<size>
95-
<width>16777215</width>
96-
<height>200</height>
97-
</size>
98-
</property>
99-
<property name="alternatingRowColors">
100-
<bool>true</bool>
101-
</property>
102-
<property name="rootIsDecorated">
103-
<bool>false</bool>
104-
</property>
105-
<property name="uniformRowHeights">
60+
<property name="childrenCollapsible">
10661
<bool>true</bool>
10762
</property>
108-
<property name="columnCount">
109-
<number>3</number>
110-
</property>
111-
<column>
112-
<property name="text">
113-
<string>Coordinate Reference System</string>
63+
<widget class="QTreeWidget" name="lstRecent">
64+
<property name="sizePolicy">
65+
<sizepolicy hsizetype="Expanding" vsizetype="MinimumExpanding">
66+
<horstretch>0</horstretch>
67+
<verstretch>0</verstretch>
68+
</sizepolicy>
11469
</property>
115-
</column>
116-
<column>
117-
<property name="text">
118-
<string>Authority ID</string>
70+
<property name="minimumSize">
71+
<size>
72+
<width>0</width>
73+
<height>105</height>
74+
</size>
11975
</property>
120-
</column>
121-
<column>
122-
<property name="text">
123-
<string>ID</string>
76+
<property name="maximumSize">
77+
<size>
78+
<width>16777215</width>
79+
<height>200</height>
80+
</size>
12481
</property>
125-
</column>
126-
</widget>
127-
</item>
128-
<item row="7" column="0" rowspan="5">
129-
<layout class="QHBoxLayout" name="horizontalLayout_3">
130-
<property name="topMargin">
131-
<number>15</number>
132-
</property>
133-
<item>
134-
<widget class="QLabel" name="label_4">
82+
<property name="alternatingRowColors">
83+
<bool>true</bool>
84+
</property>
85+
<property name="rootIsDecorated">
86+
<bool>false</bool>
87+
</property>
88+
<property name="uniformRowHeights">
89+
<bool>true</bool>
90+
</property>
91+
<property name="columnCount">
92+
<number>3</number>
93+
</property>
94+
<column>
13595
<property name="text">
136-
<string>Coordinate reference systems of the world</string>
137-
</property>
138-
</widget>
139-
</item>
140-
<item>
141-
<spacer name="horizontalSpacer_2">
142-
<property name="orientation">
143-
<enum>Qt::Horizontal</enum>
96+
<string>Coordinate Reference System</string>
14497
</property>
145-
<property name="sizeHint" stdset="0">
146-
<size>
147-
<width>40</width>
148-
<height>20</height>
149-
</size>
98+
</column>
99+
<column>
100+
<property name="text">
101+
<string>Authority ID</string>
150102
</property>
151-
</spacer>
152-
</item>
153-
<item>
154-
<widget class="QCheckBox" name="cbxHideDeprecated">
103+
</column>
104+
<column>
155105
<property name="text">
156-
<string>Hide deprecated CRSs</string>
106+
<string>ID</string>
157107
</property>
158-
</widget>
159-
</item>
160-
</layout>
161-
</item>
162-
<item row="15" column="0">
163-
<widget class="QTreeWidget" name="lstCoordinateSystems">
164-
<property name="alternatingRowColors">
165-
<bool>true</bool>
166-
</property>
167-
<property name="uniformRowHeights">
168-
<bool>true</bool>
169-
</property>
170-
<property name="columnCount">
171-
<number>3</number>
172-
</property>
173-
<column>
174-
<property name="text">
175-
<string>Coordinate Reference System</string>
176-
</property>
177-
</column>
178-
<column>
179-
<property name="text">
180-
<string>Authority ID</string>
181-
</property>
182-
</column>
183-
<column>
184-
<property name="text">
185-
<string>ID</string>
186-
</property>
187-
</column>
108+
</column>
109+
</widget>
110+
<widget class="QWidget" name="">
111+
<layout class="QGridLayout" name="gridLayout">
112+
<property name="horizontalSpacing">
113+
<number>0</number>
114+
</property>
115+
<item row="0" column="0">
116+
<layout class="QHBoxLayout" name="horizontalLayout_3">
117+
<property name="topMargin">
118+
<number>0</number>
119+
</property>
120+
<item>
121+
<widget class="QLabel" name="label_4">
122+
<property name="font">
123+
<font>
124+
<weight>75</weight>
125+
<bold>true</bold>
126+
</font>
127+
</property>
128+
<property name="text">
129+
<string>Coordinate reference systems of the world</string>
130+
</property>
131+
</widget>
132+
</item>
133+
<item>
134+
<spacer name="horizontalSpacer_2">
135+
<property name="orientation">
136+
<enum>Qt::Horizontal</enum>
137+
</property>
138+
<property name="sizeHint" stdset="0">
139+
<size>
140+
<width>40</width>
141+
<height>20</height>
142+
</size>
143+
</property>
144+
</spacer>
145+
</item>
146+
<item>
147+
<widget class="QCheckBox" name="cbxHideDeprecated">
148+
<property name="font">
149+
<font>
150+
<pointsize>7</pointsize>
151+
</font>
152+
</property>
153+
<property name="text">
154+
<string>Hide deprecated CRSs</string>
155+
</property>
156+
</widget>
157+
</item>
158+
</layout>
159+
</item>
160+
<item row="1" column="0">
161+
<widget class="QTreeWidget" name="lstCoordinateSystems">
162+
<property name="alternatingRowColors">
163+
<bool>true</bool>
164+
</property>
165+
<property name="uniformRowHeights">
166+
<bool>true</bool>
167+
</property>
168+
<property name="columnCount">
169+
<number>3</number>
170+
</property>
171+
<column>
172+
<property name="text">
173+
<string>Coordinate Reference System</string>
174+
</property>
175+
</column>
176+
<column>
177+
<property name="text">
178+
<string>Authority ID</string>
179+
</property>
180+
</column>
181+
<column>
182+
<property name="text">
183+
<string>ID</string>
184+
</property>
185+
</column>
186+
</widget>
187+
</item>
188+
</layout>
189+
</widget>
188190
</widget>
189191
</item>
190-
<item row="19" column="0">
192+
<item row="3" column="0">
191193
<widget class="QTextEdit" name="teProjection">
192194
<property name="sizePolicy">
193195
<sizepolicy hsizetype="Expanding" vsizetype="Minimum">
@@ -198,7 +200,7 @@
198200
<property name="minimumSize">
199201
<size>
200202
<width>0</width>
201-
<height>30</height>
203+
<height>40</height>
202204
</size>
203205
</property>
204206
<property name="maximumSize">
@@ -210,7 +212,7 @@
210212
<property name="baseSize">
211213
<size>
212214
<width>0</width>
213-
<height>50</height>
215+
<height>40</height>
214216
</size>
215217
</property>
216218
<property name="autoFormatting">
@@ -221,64 +223,13 @@
221223
</property>
222224
</widget>
223225
</item>
224-
<item row="16" column="0">
225-
<layout class="QHBoxLayout" name="horizontalLayout_2">
226-
<item>
227-
<widget class="QLabel" name="label">
228-
<property name="text">
229-
<string>Authority</string>
230-
</property>
231-
</widget>
232-
</item>
233-
<item>
234-
<widget class="QComboBox" name="cbxAuthority"/>
235-
</item>
236-
<item>
237-
<widget class="QLabel" name="label_2">
238-
<property name="text">
239-
<string>Search for</string>
240-
</property>
241-
</widget>
242-
</item>
243-
<item>
244-
<widget class="QComboBox" name="cbxMode">
245-
<item>
246-
<property name="text">
247-
<string>ID</string>
248-
</property>
249-
</item>
250-
<item>
251-
<property name="text">
252-
<string>Name</string>
253-
</property>
254-
</item>
255-
</widget>
256-
</item>
257-
<item>
258-
<spacer name="horizontalSpacer">
259-
<property name="orientation">
260-
<enum>Qt::Horizontal</enum>
261-
</property>
262-
<property name="sizeHint" stdset="0">
263-
<size>
264-
<width>40</width>
265-
<height>20</height>
266-
</size>
267-
</property>
268-
</spacer>
269-
</item>
270-
</layout>
271-
</item>
272226
</layout>
273227
</widget>
274228
<layoutdefault spacing="6" margin="11"/>
275229
<tabstops>
276230
<tabstop>lstCoordinateSystems</tabstop>
277231
<tabstop>teProjection</tabstop>
278-
<tabstop>cbxAuthority</tabstop>
279-
<tabstop>cbxMode</tabstop>
280232
<tabstop>leSearch</tabstop>
281-
<tabstop>pbnFind</tabstop>
282233
</tabstops>
283234
<resources/>
284235
<connections/>

0 commit comments

Comments
 (0)
Please sign in to comment.