Skip to content

Commit ed654c4

Browse files
author
g_j_m
committedJan 7, 2006
Changes to get about box to work with qt4
Replaced all qt3 widgets with qt4 ones Added tr() to some displayed text Tweak the display of author's photos so that a photo is visible when the author tab is first selected git-svn-id: http://svn.osgeo.org/qgis/trunk@4491 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 4f3cf2f commit ed654c4

File tree

3 files changed

+227
-256
lines changed

3 files changed

+227
-256
lines changed
 

‎src/qgsabout.cpp

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@
1414
* (at your option) any later version. *
1515
* *
1616
***************************************************************************/
17-
/* $Id:$ */
17+
/* $Id$ */
1818

1919
#include "qgsabout.h"
2020
#include "qgsapplication.h"
2121
#ifdef Q_OS_MACX
2222
#include <ApplicationServices/ApplicationServices.h>
2323
#else
2424
#include <QInputDialog>
25-
#include <Q3Process>
25+
#include <QProcess>
2626
#include <QSettings>
2727
#endif
2828
#include <QFile>
@@ -70,6 +70,7 @@ void QgsAbout::init()
7070
QStringList myTokens = QStringList::split("\t",line);
7171
//printf ("Added contributor name to listbox: %s ",myTokens[0]);
7272
lines += myTokens[0];
73+
7374
// add the image to the map
7475
/* Uncomment this block to preload the images (takes time at initial startup)
7576
QString authorName = myTokens[0].replace(" ","_");
@@ -82,7 +83,11 @@ void QgsAbout::init()
8283
}
8384
file.close();
8485
listBox1->clear();
85-
listBox1->insertStringList(lines,0);
86+
listBox1->insertItems(0, lines);
87+
88+
// Load in the image for the first author
89+
if (listBox1->count() > 0)
90+
listBox1->setCurrentRow(0);
8691
}
8792

8893
}
@@ -112,13 +117,13 @@ void QgsAbout::on_buttonCancel_clicked()
112117
reject();
113118
}
114119

115-
void QgsAbout::on_listBox1_currentChanged(Q3ListBoxItem *theItem)
120+
void QgsAbout::on_listBox1_currentItemChanged(QListWidgetItem *theItem)
116121
{
117122
//replace spaces in author name
118123
#ifdef QGISDEBUG
119124
printf ("Loading mug: ");
120125
#endif
121-
QString myString = listBox1->currentText();
126+
QString myString = listBox1->currentItem()->text();
122127
myString = myString.replace(" ","_");
123128
#ifdef QGISDEBUG
124129
printf ("Loading mug: %s", (const char *)myString.toLocal8Bit().data());
@@ -166,10 +171,11 @@ void QgsAbout::openUrl(QString url)
166171
{
167172
// ask user for browser and use it
168173
bool ok;
169-
QString text = QInputDialog::getText("QGIS Browser Selection",
170-
"Enter the name of a web browser to use (eg. konqueror).\n"
171-
"Enter the full path if the browser is not in your PATH.\n"
172-
"You can change this option later by selection Options from the Tools menu.",
174+
QString text = QInputDialog::getText(tr("QGIS Browser Selection"),
175+
tr("Enter the name of a web browser to use (eg. konqueror).\n"
176+
"Enter the full path if the browser is not in your PATH.\n"
177+
"You can change this option later by selection Options from"
178+
" the Tools menu."),
173179
QLineEdit::Normal,
174180
QString::null, &ok, this);
175181
if (ok && !text.isEmpty())
@@ -188,10 +194,8 @@ void QgsAbout::openUrl(QString url)
188194
// find the installed location of the help files
189195
// open index.html using browser
190196
//XXX for debug on win32 QMessageBox::information(this, "Help opening...", browser + " - " + url);
191-
Q3Process *helpProcess = new Q3Process(this);
192-
helpProcess->addArgument(browser);
193-
helpProcess->addArgument(url);
194-
helpProcess->start();
197+
QProcess *helpProcess = new QProcess(this);
198+
helpProcess->start(browser, QStringList() << url);
195199
}
196200
#endif
197201
/* mHelpViewer = new QgsHelpViewer(this,"helpviewer",false);

‎src/qgsabout.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
#define QGSABOUT_H
2020

2121
#include "ui_qgsabout.h"
22-
#include <QDialog>
2322

2423
class QgsAbout : public QDialog, private Ui::QgsAbout
2524
{
@@ -38,7 +37,7 @@ class QgsAbout : public QDialog, private Ui::QgsAbout
3837

3938
private slots:
4039
void on_buttonCancel_clicked();
41-
void on_listBox1_currentChanged(Q3ListBoxItem *theItem);
40+
void on_listBox1_currentItemChanged(QListWidgetItem *theItem);
4241
void on_btnQgisUser_clicked();
4342
void on_btnQgisHome_clicked();
4443
};

‎src/ui/qgsabout.ui

Lines changed: 209 additions & 241 deletions
Original file line numberDiff line numberDiff line change
@@ -18,276 +18,244 @@
1818
<property name="sizeGripEnabled" >
1919
<bool>true</bool>
2020
</property>
21-
<widget class="QTabWidget" name="tabWidget" >
22-
<property name="geometry" >
23-
<rect>
24-
<x>9</x>
25-
<y>9</y>
26-
<width>496</width>
27-
<height>322</height>
28-
</rect>
21+
<layout class="QGridLayout" >
22+
<property name="margin" >
23+
<number>9</number>
2924
</property>
30-
<widget class="QWidget" name="Widget2" >
31-
<attribute name="title" >
32-
<string>About</string>
33-
</attribute>
34-
<layout class="QGridLayout" >
35-
<property name="margin" >
36-
<number>9</number>
37-
</property>
38-
<property name="spacing" >
39-
<number>6</number>
25+
<property name="spacing" >
26+
<number>6</number>
27+
</property>
28+
<item row="0" column="0" >
29+
<widget class="QTabWidget" name="tabWidget" >
30+
<property name="currentIndex" >
31+
<number>0</number>
4032
</property>
41-
<item row="1" column="0" >
42-
<widget class="QLabel" name="lblVersion" >
43-
<property name="text" >
44-
<string>Version</string>
45-
</property>
46-
<property name="alignment" >
47-
<set>Qt::AlignCenter</set>
48-
</property>
49-
</widget>
50-
</item>
51-
<item row="2" column="0" >
52-
<widget class="QPushButton" name="btnQgisUser" >
53-
<property name="text" >
54-
<string>Subscribe to the QGIS-User mailing list</string>
55-
</property>
56-
<property name="flat" >
57-
<bool>false</bool>
58-
</property>
59-
</widget>
60-
</item>
61-
<item row="3" column="0" >
62-
<widget class="QPushButton" name="btnQgisHome" >
63-
<property name="text" >
64-
<string>QGIS Home Page</string>
65-
</property>
66-
<property name="flat" >
67-
<bool>false</bool>
68-
</property>
69-
</widget>
70-
</item>
71-
<item row="4" column="0" >
72-
<widget class="Q3TextEdit" name="lblUrls" >
73-
<property name="enabled" >
74-
<bool>true</bool>
75-
</property>
76-
<property name="maximumSize" >
77-
<size>
78-
<width>32767</width>
79-
<height>70</height>
80-
</size>
33+
<widget class="QWidget" name="Widget2" >
34+
<attribute name="title" >
35+
<string>About</string>
36+
</attribute>
37+
<layout class="QVBoxLayout" >
38+
<property name="margin" >
39+
<number>9</number>
8140
</property>
82-
<property name="frameShadow" >
83-
<enum>QFrame::Sunken</enum>
41+
<property name="spacing" >
42+
<number>6</number>
8443
</property>
85-
<property name="text" >
86-
<string>&lt;p align="center">Quantum GIS is licensed under the GNU General Public License&lt;p>
87-
&lt;p align="center">http://www.gnu.org/licenses&lt;/p></string>
44+
<item>
45+
<widget class="QLabel" name="TextLabel4" >
46+
<property name="text" >
47+
<string>&lt;h2>Quantum GIS (qgis)&lt;/h2></string>
48+
</property>
49+
<property name="alignment" >
50+
<set>Qt::AlignCenter</set>
51+
</property>
52+
</widget>
53+
</item>
54+
<item>
55+
<widget class="QLabel" name="lblVersion" >
56+
<property name="text" >
57+
<string>Version</string>
58+
</property>
59+
<property name="alignment" >
60+
<set>Qt::AlignCenter</set>
61+
</property>
62+
</widget>
63+
</item>
64+
<item>
65+
<widget class="QPushButton" name="btnQgisUser" >
66+
<property name="text" >
67+
<string>Subscribe to the QGIS-User mailing list</string>
68+
</property>
69+
<property name="flat" >
70+
<bool>false</bool>
71+
</property>
72+
</widget>
73+
</item>
74+
<item>
75+
<widget class="QPushButton" name="btnQgisHome" >
76+
<property name="text" >
77+
<string>QGIS Home Page</string>
78+
</property>
79+
<property name="flat" >
80+
<bool>false</bool>
81+
</property>
82+
</widget>
83+
</item>
84+
<item>
85+
<widget class="QTextEdit" name="lblUrls" >
86+
<property name="html" >
87+
<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 align='center' style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Quantum GIS is licensed under the GNU General Public License&lt;/p>&lt;p align='center' style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">http://www.gnu.org/licenses&lt;/p>&lt;/body>&lt;/html></string>
88+
</property>
89+
</widget>
90+
</item>
91+
</layout>
92+
</widget>
93+
<widget class="QWidget" name="Widget3" >
94+
<attribute name="title" >
95+
<string>What's New</string>
96+
</attribute>
97+
<layout class="QGridLayout" >
98+
<property name="margin" >
99+
<number>9</number>
88100
</property>
89-
<property name="wordWrap" >
90-
<enum>Q3TextEdit::WidgetWidth</enum>
101+
<property name="spacing" >
102+
<number>6</number>
91103
</property>
92-
<property name="readOnly" >
93-
<bool>true</bool>
104+
<item row="0" column="0" >
105+
<widget class="QTextEdit" name="txtWhatsNew" >
106+
<property name="focusPolicy" >
107+
<enum>Qt::NoFocus</enum>
108+
</property>
109+
<property name="acceptDrops" >
110+
<bool>false</bool>
111+
</property>
112+
<property name="lineWidth" >
113+
<number>2</number>
114+
</property>
115+
<property name="readOnly" >
116+
<bool>true</bool>
117+
</property>
118+
</widget>
119+
</item>
120+
</layout>
121+
</widget>
122+
<widget class="QWidget" name="tab" >
123+
<attribute name="title" >
124+
<string>Developers</string>
125+
</attribute>
126+
<layout class="QGridLayout" >
127+
<property name="margin" >
128+
<number>9</number>
94129
</property>
95-
</widget>
96-
</item>
97-
<item row="0" column="0" >
98-
<widget class="QLabel" name="TextLabel4" >
99-
<property name="text" >
100-
<string>&lt;h2>Quantum GIS (qgis)&lt;/h2></string>
130+
<property name="spacing" >
131+
<number>6</number>
101132
</property>
102-
<property name="alignment" >
103-
<set>Qt::AlignCenter</set>
133+
<item row="1" column="0" >
134+
<widget class="QListWidget" name="listBox1" />
135+
</item>
136+
<item row="1" column="1" >
137+
<widget class="QFrame" name="frame" >
138+
<property name="sizePolicy" >
139+
<sizepolicy>
140+
<hsizetype>7</hsizetype>
141+
<vsizetype>5</vsizetype>
142+
<horstretch>0</horstretch>
143+
<verstretch>0</verstretch>
144+
</sizepolicy>
145+
</property>
146+
<property name="frameShape" >
147+
<enum>QFrame::StyledPanel</enum>
148+
</property>
149+
<property name="frameShadow" >
150+
<enum>QFrame::Raised</enum>
151+
</property>
152+
<layout class="QGridLayout" >
153+
<property name="margin" >
154+
<number>9</number>
155+
</property>
156+
<property name="spacing" >
157+
<number>6</number>
158+
</property>
159+
<item row="0" column="0" >
160+
<widget class="QLabel" name="pixAuthorMug" >
161+
<property name="sizePolicy" >
162+
<sizepolicy>
163+
<hsizetype>7</hsizetype>
164+
<vsizetype>7</vsizetype>
165+
<horstretch>0</horstretch>
166+
<verstretch>0</verstretch>
167+
</sizepolicy>
168+
</property>
169+
<property name="frameShape" >
170+
<enum>QFrame::NoFrame</enum>
171+
</property>
172+
<property name="frameShadow" >
173+
<enum>QFrame::Plain</enum>
174+
</property>
175+
<property name="pixmap" >
176+
<pixmap/>
177+
</property>
178+
<property name="scaledContents" >
179+
<bool>false</bool>
180+
</property>
181+
<property name="alignment" >
182+
<set>Qt::AlignCenter</set>
183+
</property>
184+
</widget>
185+
</item>
186+
</layout>
187+
</widget>
188+
</item>
189+
<item row="0" column="0" colspan="2" >
190+
<widget class="QLabel" name="textLabel1" >
191+
<property name="text" >
192+
<string>&lt;h2>QGIS Developers&lt;/h2></string>
193+
</property>
194+
</widget>
195+
</item>
196+
</layout>
197+
</widget>
198+
<widget class="QWidget" name="TabPage" >
199+
<attribute name="title" >
200+
<string>Providers</string>
201+
</attribute>
202+
<layout class="QGridLayout" >
203+
<property name="margin" >
204+
<number>9</number>
104205
</property>
105-
</widget>
106-
</item>
107-
</layout>
108-
</widget>
109-
<widget class="QWidget" name="Widget3" >
110-
<attribute name="title" >
111-
<string>What's New</string>
112-
</attribute>
113-
<layout class="QGridLayout" >
114-
<property name="margin" >
115-
<number>9</number>
116-
</property>
117-
<property name="spacing" >
118-
<number>6</number>
119-
</property>
120-
<item row="0" column="0" >
121-
<widget class="Q3TextEdit" name="txtWhatsNew" >
122-
<property name="readOnly" >
123-
<bool>true</bool>
206+
<property name="spacing" >
207+
<number>6</number>
124208
</property>
125-
</widget>
126-
</item>
127-
</layout>
128-
</widget>
129-
<widget class="QWidget" name="tab" >
130-
<attribute name="title" >
131-
<string>Developers</string>
132-
</attribute>
133-
<layout class="QGridLayout" >
209+
<item row="0" column="0" >
210+
<widget class="QTextBrowser" name="txtBrowserPlugins" />
211+
</item>
212+
</layout>
213+
</widget>
214+
</widget>
215+
</item>
216+
<item row="1" column="0" >
217+
<layout class="QHBoxLayout" >
134218
<property name="margin" >
135-
<number>9</number>
219+
<number>0</number>
136220
</property>
137221
<property name="spacing" >
138222
<number>6</number>
139223
</property>
140-
<item row="0" column="0" colspan="2" >
141-
<widget class="QLabel" name="textLabel1" >
142-
<property name="text" >
143-
<string>&lt;h2>QGIS Developers&lt;/h2></string>
224+
<item>
225+
<spacer>
226+
<property name="orientation" >
227+
<enum>Qt::Horizontal</enum>
144228
</property>
145-
</widget>
146-
</item>
147-
<item row="1" column="1" >
148-
<widget class="Q3Frame" name="picMugShot" >
149-
<property name="minimumSize" >
150-
<size>
151-
<width>180</width>
152-
<height>225</height>
153-
</size>
229+
<property name="sizeType" >
230+
<enum>QSizePolicy::Expanding</enum>
154231
</property>
155-
<property name="maximumSize" >
232+
<property name="sizeHint" >
156233
<size>
157-
<width>180</width>
158-
<height>225</height>
234+
<width>20</width>
235+
<height>0</height>
159236
</size>
160237
</property>
161-
<property name="frameShape" >
162-
<enum>QFrame::Box</enum>
163-
</property>
164-
<property name="frameShadow" >
165-
<enum>QFrame::Plain</enum>
166-
</property>
167-
<property name="lineWidth" >
168-
<number>1</number>
238+
</spacer>
239+
</item>
240+
<item>
241+
<widget class="QPushButton" name="buttonCancel" >
242+
<property name="text" >
243+
<string>Ok</string>
169244
</property>
170-
<property name="margin" >
171-
<number>0</number>
245+
<property name="shortcut" >
246+
<string/>
172247
</property>
173-
<layout class="QGridLayout" >
174-
<property name="margin" >
175-
<number>10</number>
176-
</property>
177-
<property name="spacing" >
178-
<number>6</number>
179-
</property>
180-
<item row="0" column="0" >
181-
<widget class="QLabel" name="pixAuthorMug" >
182-
<property name="pixmap" >
183-
<pixmap/>
184-
</property>
185-
<property name="scaledContents" >
186-
<bool>false</bool>
187-
</property>
188-
</widget>
189-
</item>
190-
</layout>
191-
</widget>
192-
</item>
193-
<item row="1" column="0" >
194-
<widget class="Q3ListBox" name="listBox1" >
195-
<property name="currentItem" >
196-
<number>-1</number>
248+
<property name="autoDefault" >
249+
<bool>true</bool>
197250
</property>
198251
</widget>
199252
</item>
200253
</layout>
201-
</widget>
202-
<widget class="QWidget" name="TabPage" >
203-
<attribute name="title" >
204-
<string>Providers</string>
205-
</attribute>
206-
<layout class="QGridLayout" >
207-
<property name="margin" >
208-
<number>9</number>
209-
</property>
210-
<property name="spacing" >
211-
<number>6</number>
212-
</property>
213-
<item row="0" column="0" >
214-
<widget class="Q3TextBrowser" name="txtBrowserPlugins" />
215-
</item>
216-
</layout>
217-
</widget>
218-
</widget>
219-
<widget class="QWidget" name="" >
220-
<layout class="QHBoxLayout" >
221-
<property name="margin" >
222-
<number>0</number>
223-
</property>
224-
<property name="spacing" >
225-
<number>6</number>
226-
</property>
227-
<item>
228-
<spacer>
229-
<property name="orientation" >
230-
<enum>Qt::Horizontal</enum>
231-
</property>
232-
<property name="sizeType" >
233-
<enum>QSizePolicy::Expanding</enum>
234-
</property>
235-
<property name="sizeHint" >
236-
<size>
237-
<width>20</width>
238-
<height>0</height>
239-
</size>
240-
</property>
241-
</spacer>
242-
</item>
243-
<item>
244-
<widget class="QPushButton" name="buttonCancel" >
245-
<property name="text" >
246-
<string>Ok</string>
247-
</property>
248-
<property name="shortcut" >
249-
<string/>
250-
</property>
251-
<property name="autoDefault" >
252-
<bool>true</bool>
253-
</property>
254-
</widget>
255-
</item>
256-
</layout>
257-
</widget>
254+
</item>
255+
</layout>
258256
</widget>
259257
<layoutdefault spacing="6" margin="11" />
260258
<pixmapfunction></pixmapfunction>
261-
<customwidgets>
262-
<customwidget>
263-
<class>Q3TextEdit</class>
264-
<extends></extends>
265-
<header>q3textedit.h</header>
266-
<container>0</container>
267-
<pixmap></pixmap>
268-
</customwidget>
269-
<customwidget>
270-
<class>Q3Frame</class>
271-
<extends></extends>
272-
<header>Qt3Support/Q3Frame</header>
273-
<container>1</container>
274-
<pixmap></pixmap>
275-
</customwidget>
276-
<customwidget>
277-
<class>Q3ListBox</class>
278-
<extends></extends>
279-
<header>q3listbox.h</header>
280-
<container>0</container>
281-
<pixmap></pixmap>
282-
</customwidget>
283-
<customwidget>
284-
<class>Q3TextBrowser</class>
285-
<extends>QWidget</extends>
286-
<header>q3textbrowser.h</header>
287-
<container>1</container>
288-
<pixmap></pixmap>
289-
</customwidget>
290-
</customwidgets>
291259
<resources/>
292260
<connections/>
293261
</ui>

0 commit comments

Comments
 (0)
Please sign in to comment.