Skip to content

Commit fa212af

Browse files
author
timlinux
committed
Added refresh button so when plugging in a gps device after dialog is opened, it can be selectd from the ports list. Use button box for gps add device dialog
git-svn-id: http://svn.osgeo.org/qgis/trunk@8916 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 615b120 commit fa212af

File tree

3 files changed

+254
-179
lines changed

3 files changed

+254
-179
lines changed

src/plugins/gps_importer/qgsgpsdevicedialogbase.ui

+88-77
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,7 @@
1010
</rect>
1111
</property>
1212
<property name="sizePolicy" >
13-
<sizepolicy>
14-
<hsizetype>1</hsizetype>
15-
<vsizetype>1</vsizetype>
13+
<sizepolicy vsizetype="Minimum" hsizetype="Minimum" >
1614
<horstretch>0</horstretch>
1715
<verstretch>0</verstretch>
1816
</sizepolicy>
@@ -23,32 +21,33 @@
2321
<property name="modal" >
2422
<bool>true</bool>
2523
</property>
26-
<layout class="QVBoxLayout" >
27-
<property name="margin" >
28-
<number>9</number>
29-
</property>
30-
<property name="spacing" >
31-
<number>6</number>
32-
</property>
33-
<item>
24+
<layout class="QGridLayout" >
25+
<item row="0" column="0" >
3426
<widget class="QSplitter" name="splitter" >
3527
<property name="orientation" >
3628
<enum>Qt::Horizontal</enum>
3729
</property>
3830
<widget class="QWidget" name="layoutWidget_2" >
3931
<layout class="QVBoxLayout" >
40-
<property name="margin" >
41-
<number>0</number>
42-
</property>
4332
<property name="spacing" >
4433
<number>6</number>
4534
</property>
35+
<property name="leftMargin" >
36+
<number>0</number>
37+
</property>
38+
<property name="topMargin" >
39+
<number>0</number>
40+
</property>
41+
<property name="rightMargin" >
42+
<number>0</number>
43+
</property>
44+
<property name="bottomMargin" >
45+
<number>0</number>
46+
</property>
4647
<item>
4748
<widget class="QListWidget" name="lbDeviceList" >
4849
<property name="sizePolicy" >
49-
<sizepolicy>
50-
<hsizetype>5</hsizetype>
51-
<vsizetype>5</vsizetype>
50+
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
5251
<horstretch>0</horstretch>
5352
<verstretch>0</verstretch>
5453
</sizepolicy>
@@ -58,9 +57,7 @@
5857
<item>
5958
<widget class="QPushButton" name="pbnNewDevice" >
6059
<property name="sizePolicy" >
61-
<sizepolicy>
62-
<hsizetype>1</hsizetype>
63-
<vsizetype>0</vsizetype>
60+
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
6461
<horstretch>0</horstretch>
6562
<verstretch>0</verstretch>
6663
</sizepolicy>
@@ -73,9 +70,7 @@
7370
<item>
7471
<widget class="QPushButton" name="pbnDeleteDevice" >
7572
<property name="sizePolicy" >
76-
<sizepolicy>
77-
<hsizetype>1</hsizetype>
78-
<vsizetype>0</vsizetype>
73+
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
7974
<horstretch>0</horstretch>
8075
<verstretch>0</verstretch>
8176
</sizepolicy>
@@ -88,9 +83,7 @@
8883
<item>
8984
<widget class="QPushButton" name="pbnUpdateDevice" >
9085
<property name="sizePolicy" >
91-
<sizepolicy>
92-
<hsizetype>1</hsizetype>
93-
<vsizetype>0</vsizetype>
86+
<sizepolicy vsizetype="Fixed" hsizetype="Minimum" >
9487
<horstretch>0</horstretch>
9588
<verstretch>0</verstretch>
9689
</sizepolicy>
@@ -104,41 +97,55 @@
10497
</widget>
10598
<widget class="QWidget" name="layoutWidget_3" >
10699
<layout class="QVBoxLayout" >
107-
<property name="margin" >
108-
<number>0</number>
109-
</property>
110100
<property name="spacing" >
111101
<number>6</number>
112102
</property>
103+
<property name="leftMargin" >
104+
<number>0</number>
105+
</property>
106+
<property name="topMargin" >
107+
<number>0</number>
108+
</property>
109+
<property name="rightMargin" >
110+
<number>0</number>
111+
</property>
112+
<property name="bottomMargin" >
113+
<number>0</number>
114+
</property>
113115
<item>
114116
<layout class="QHBoxLayout" >
115-
<property name="margin" >
116-
<number>0</number>
117-
</property>
118117
<property name="spacing" >
119118
<number>6</number>
120119
</property>
120+
<property name="leftMargin" >
121+
<number>0</number>
122+
</property>
123+
<property name="topMargin" >
124+
<number>0</number>
125+
</property>
126+
<property name="rightMargin" >
127+
<number>0</number>
128+
</property>
129+
<property name="bottomMargin" >
130+
<number>0</number>
131+
</property>
121132
<item>
122133
<widget class="QLabel" name="textLabel3" >
123134
<property name="sizePolicy" >
124-
<sizepolicy>
125-
<hsizetype>1</hsizetype>
126-
<vsizetype>5</vsizetype>
135+
<sizepolicy vsizetype="Preferred" hsizetype="Minimum" >
127136
<horstretch>0</horstretch>
128137
<verstretch>0</verstretch>
129138
</sizepolicy>
130139
</property>
131140
<property name="text" >
132-
<string>Device name:</string>
141+
<string>Device name</string>
133142
</property>
134143
</widget>
135144
</item>
136145
<item>
137146
<widget class="QLineEdit" name="leDeviceName" >
138147
<property name="sizePolicy" >
139-
<sizepolicy>
140-
<hsizetype>7</hsizetype>
141-
<vsizetype>0</vsizetype>
148+
<sizepolicy vsizetype="Fixed" hsizetype="Expanding" >
142149
<horstretch>2</horstretch>
143150
<verstretch>0</verstretch>
144151
</sizepolicy>
@@ -159,10 +166,22 @@
159166
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
160167
</property>
161168
<layout class="QGridLayout" >
162-
<property name="margin" >
169+
<property name="leftMargin" >
170+
<number>9</number>
171+
</property>
172+
<property name="topMargin" >
173+
<number>9</number>
174+
</property>
175+
<property name="rightMargin" >
176+
<number>9</number>
177+
</property>
178+
<property name="bottomMargin" >
163179
<number>9</number>
164180
</property>
165-
<property name="spacing" >
181+
<property name="horizontalSpacing" >
182+
<number>6</number>
183+
</property>
184+
<property name="verticalSpacing" >
166185
<number>6</number>
167186
</property>
168187
<item row="4" column="0" >
@@ -255,58 +274,50 @@
255274
<item>
256275
<widget class="QTextEdit" name="textEdit" >
257276
<property name="sizePolicy" >
258-
<sizepolicy>
259-
<hsizetype>5</hsizetype>
260-
<vsizetype>5</vsizetype>
277+
<sizepolicy vsizetype="Preferred" hsizetype="Preferred" >
261278
<horstretch>0</horstretch>
262279
<verstretch>0</verstretch>
263280
</sizepolicy>
264281
</property>
265282
<property name="html" >
266-
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;/head>&lt;body style=" white-space: pre-wrap; font-family:Sans Serif; font-size:9pt; font-weight:400; font-style:normal; text-decoration:none;">&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">In the download and upload commands there can be special words that will be replaced by QGIS when the commands are used. These words are:&lt;span style=" font-style:italic;">%babel&lt;/span> - the path to GPSBabel&lt;br />&lt;span style=" font-style:italic;">%in&lt;/span> - the GPX filename when uploading or the port when downloading&lt;br />&lt;span style=" font-style:italic;">%out&lt;/span> - the port when uploading or the GPX filename when downloading&lt;/p>&lt;/body>&lt;/html></string>
283+
<string>&lt;html>&lt;head>&lt;meta name="qrichtext" content="1" />&lt;style type="text/css">
284+
p, li { white-space: pre-wrap; }
285+
&lt;/style>&lt;/head>&lt;body style=" font-family:'Verdana'; font-size:10pt; font-weight:400; font-style:normal;">
286+
&lt;p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Sans Serif'; font-size:9pt;">In the download and upload commands there can be special words that will be replaced by QGIS when the commands are used. These words are:&lt;span style=" font-style:italic;">%babel&lt;/span> - the path to GPSBabel&lt;br />&lt;span style=" font-style:italic;">%in&lt;/span> - the GPX filename when uploading or the port when downloading&lt;br />&lt;span style=" font-style:italic;">%out&lt;/span> - the port when uploading or the GPX filename when downloading&lt;/p>&lt;/body>&lt;/html></string>
267287
</property>
268288
</widget>
269289
</item>
270290
</layout>
271291
</widget>
272292
</widget>
273293
</item>
274-
<item>
275-
<layout class="QHBoxLayout" >
276-
<property name="margin" >
277-
<number>0</number>
278-
</property>
279-
<property name="spacing" >
280-
<number>6</number>
294+
<item row="1" column="0" >
295+
<widget class="QDialogButtonBox" name="buttonBox" >
296+
<property name="standardButtons" >
297+
<set>QDialogButtonBox::Close</set>
281298
</property>
282-
<item>
283-
<spacer>
284-
<property name="orientation" >
285-
<enum>Qt::Horizontal</enum>
286-
</property>
287-
<property name="sizeHint" >
288-
<size>
289-
<width>381</width>
290-
<height>21</height>
291-
</size>
292-
</property>
293-
</spacer>
294-
</item>
295-
<item>
296-
<widget class="QPushButton" name="pbnClose" >
297-
<property name="text" >
298-
<string>Close</string>
299-
</property>
300-
<property name="default" >
301-
<bool>true</bool>
302-
</property>
303-
</widget>
304-
</item>
305-
</layout>
299+
</widget>
306300
</item>
307301
</layout>
308302
</widget>
309303
<layoutdefault spacing="6" margin="11" />
310304
<resources/>
311-
<connections/>
305+
<connections>
306+
<connection>
307+
<sender>buttonBox</sender>
308+
<signal>clicked(QAbstractButton*)</signal>
309+
<receiver>QgsGPSDeviceDialogBase</receiver>
310+
<slot>accept()</slot>
311+
<hints>
312+
<hint type="sourcelabel" >
313+
<x>453</x>
314+
<y>418</y>
315+
</hint>
316+
<hint type="destinationlabel" >
317+
<x>498</x>
318+
<y>403</y>
319+
</hint>
320+
</hints>
321+
</connection>
322+
</connections>
312323
</ui>

src/plugins/gps_importer/qgsgpsplugingui.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -285,9 +285,14 @@ void QgsGPSPluginGui::on_pbnIMPOutput_clicked() {
285285
leIMPOutput->setText(myFileNameQString);
286286
}
287287

288+
void QgsGPSPluginGui::on_pbnRefresh_clicked()
289+
{
290+
populatePortComboBoxes();
291+
}
288292

289293
void QgsGPSPluginGui::populatePortComboBoxes() {
290294

295+
cmbDLPort->clear();
291296
#ifdef linux
292297
// look for linux serial devices
293298
QString linuxDev("/dev/ttyS%1");

0 commit comments

Comments
 (0)