Merge lp:~daggerstab/stellarium/add-remove-landscapes into lp:stellarium

Proposed by Bogdan Marinov on 2010-09-13
Status: Merged
Merged at revision: 4760
Proposed branch: lp:~daggerstab/stellarium/add-remove-landscapes
Merge into: lp:stellarium
Diff against target: 2544 lines (+1500/-219) 11 files modified
To merge this branch: bzr merge lp:~daggerstab/stellarium/add-remove-landscapes
Reviewer Review Type Date Requested Status
Fabien Chéreau 2010-09-13 Approve on 2010-09-25
Review via email: mp+35304@code.launchpad.net

Description of the Change

A merge of my "AddRemoveLandscapes" plug-in into a feature in the main code, with improvements. (Lots of improvements, actually.)

To open the feature's window, go to the "Landscapes" tab of the "Sky and viewing options" window and press the "Add/remove landscapes..." button. You can test it with the landscape archives from the Stellarium Wiki:
http://www.stellarium.org/wiki/index.php/Landscapes

To post a comment you must log in.
Fabien Chéreau (xalioth) wrote :

Hi Bogdan,
I just come back from holidays (I just turned 30 years old 5 days ago!!)
From the code it looks fine, but I still need to have a closer look tomorrow.
Fab

Fabien Chéreau (xalioth) wrote :

I had a better look today and it's excellent :)
Worked perfectly, well commented code.
I merged in rev 4760.
Thanks a lot Bogdan!
Fabien

review: Approve

Preview Diff

1=== modified file 'po/stellarium/POTFILES.in'
2--- po/stellarium/POTFILES.in 2010-05-19 13:33:21 +0000
3+++ po/stellarium/POTFILES.in 2010-09-13 16:37:45 +0000
4@@ -19,6 +19,7 @@
5 src/gui/StelGuiItems.cpp
6 src/gui/ViewDialog.cpp
7 src/gui/LocationDialog.cpp
8+src/gui/AddRemoveLandscapesDialog.cpp
9 src/main.cpp
10 src/translations.h
11 src/ui_dateTimeDialogGui.h
12@@ -27,3 +28,5 @@
13 src/ui_searchDialogGui.h
14 src/ui_viewDialog.h
15 src/ui_configurationDialog.h
16+src/ui_addRemoveLandscapesDialog.h
17+
18
19=== modified file 'po/stellarium/stellarium.pot'
20--- po/stellarium/stellarium.pot 2010-05-19 13:33:21 +0000
21+++ po/stellarium/stellarium.pot 2010-09-13 16:37:45 +0000
22@@ -8,7 +8,7 @@
23 msgstr ""
24 "Project-Id-Version: PACKAGE VERSION\n"
25 "Report-Msgid-Bugs-To: \n"
26-"POT-Creation-Date: 2010-05-19 15:26+0200\n"
27+"POT-Creation-Date: 2010-09-13 19:07+0300\n"
28 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
29 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
30 "Language-Team: LANGUAGE <LL@li.org>\n"
31@@ -16,20 +16,20 @@
32 "Content-Type: text/plain; charset=CHARSET\n"
33 "Content-Transfer-Encoding: 8bit\n"
34
35-#: src/core/modules/LandscapeMgr.cpp:401
36+#: src/core/modules/LandscapeMgr.cpp:447
37 msgid "Author: "
38 msgstr ""
39
40-#: src/core/modules/LandscapeMgr.cpp:404
41+#: src/core/modules/LandscapeMgr.cpp:450
42 msgid "Location: "
43 msgstr ""
44
45-#: src/core/modules/LandscapeMgr.cpp:409
46+#: src/core/modules/LandscapeMgr.cpp:455
47 #, qt-format
48 msgid ", %1 m"
49 msgstr ""
50
51-#: src/core/modules/LandscapeMgr.cpp:412
52+#: src/core/modules/LandscapeMgr.cpp:458
53 msgid "Planet: "
54 msgstr ""
55
56@@ -115,7 +115,7 @@
57 msgid "Parallax: %1\""
58 msgstr ""
59
60-#: src/core/StelProjector.cpp:61
61+#: src/core/StelProjector.cpp:62
62 msgid "Maximum FOV: "
63 msgstr ""
64
65@@ -223,54 +223,54 @@
66 msgid "Az/Alt: %1/%2"
67 msgstr ""
68
69-#: src/gui/ConfigurationDialog.cpp:285
70+#: src/gui/ConfigurationDialog.cpp:294
71 msgid "Select screenshot directory"
72 msgstr ""
73
74-#: src/gui/ConfigurationDialog.cpp:451
75+#: src/gui/ConfigurationDialog.cpp:460
76 #, qt-format
77 msgid "Startup FOV: %1%2"
78 msgstr ""
79
80-#: src/gui/ConfigurationDialog.cpp:459
81+#: src/gui/ConfigurationDialog.cpp:468
82 #, qt-format
83 msgid "Startup direction of view Az/Alt: %1/%2"
84 msgstr ""
85
86-#: src/gui/ConfigurationDialog.cpp:495
87+#: src/gui/ConfigurationDialog.cpp:508
88 msgid "Authors"
89 msgstr ""
90
91-#: src/gui/ConfigurationDialog.cpp:499 src/gui/ViewDialog.cpp:337
92+#: src/gui/ConfigurationDialog.cpp:512 src/gui/ViewDialog.cpp:345
93 msgid "Contact"
94 msgstr ""
95
96-#: src/gui/ConfigurationDialog.cpp:571
97+#: src/gui/ConfigurationDialog.cpp:584
98 msgid "Author"
99 msgstr ""
100
101-#: src/gui/ConfigurationDialog.cpp:572
102+#: src/gui/ConfigurationDialog.cpp:585
103 msgid "License"
104 msgstr ""
105
106-#: src/gui/ConfigurationDialog.cpp:603
107+#: src/gui/ConfigurationDialog.cpp:614
108 msgid "Running script: "
109 msgstr ""
110
111-#: src/gui/ConfigurationDialog.cpp:610
112+#: src/gui/ConfigurationDialog.cpp:621
113 msgid "Running script: [none]"
114 msgstr ""
115
116-#: src/gui/ConfigurationDialog.cpp:653
117+#: src/gui/ConfigurationDialog.cpp:664
118 msgid "Finished downloading all star catalogs!"
119 msgstr ""
120
121-#: src/gui/ConfigurationDialog.cpp:662
122+#: src/gui/ConfigurationDialog.cpp:673
123 #, qt-format
124 msgid "Get catalog %1 of %2"
125 msgstr ""
126
127-#: src/gui/ConfigurationDialog.cpp:664
128+#: src/gui/ConfigurationDialog.cpp:675
129 #, qt-format
130 msgid ""
131 "Download size: %1MB\n"
132@@ -278,31 +278,31 @@
133 "Magnitude range: %3 - %4"
134 msgstr ""
135
136-#: src/gui/ConfigurationDialog.cpp:673
137+#: src/gui/ConfigurationDialog.cpp:684
138 msgid ""
139 "Finished downloading new star catalogs!\n"
140 "Restart Stellarium to display them."
141 msgstr ""
142
143-#: src/gui/ConfigurationDialog.cpp:711 src/gui/ConfigurationDialog.cpp:745
144+#: src/gui/ConfigurationDialog.cpp:722 src/gui/ConfigurationDialog.cpp:756
145 #, qt-format
146 msgid ""
147 "Error downloading %1:\n"
148 "%2"
149 msgstr ""
150
151-#: src/gui/ConfigurationDialog.cpp:716
152+#: src/gui/ConfigurationDialog.cpp:727
153 #, qt-format
154 msgid ""
155 "Downloading %1...\n"
156 "(You can close this window.)"
157 msgstr ""
158
159-#: src/gui/ConfigurationDialog.cpp:796
160+#: src/gui/ConfigurationDialog.cpp:807
161 msgid "Verifying file integrity..."
162 msgstr ""
163
164-#: src/gui/ConfigurationDialog.cpp:800
165+#: src/gui/ConfigurationDialog.cpp:811
166 #, qt-format
167 msgid ""
168 "Error downloading %1:\n"
169@@ -483,15 +483,15 @@
170 msgid "Constellation boundaries"
171 msgstr ""
172
173-#: src/gui/StelGui.cpp:104 src/ui_viewDialog.h:1027
174+#: src/gui/StelGui.cpp:104 src/ui_viewDialog.h:1034
175 msgid "Azimuthal grid"
176 msgstr ""
177
178-#: src/gui/StelGui.cpp:105 src/ui_viewDialog.h:1025
179+#: src/gui/StelGui.cpp:105 src/ui_viewDialog.h:1032
180 msgid "Equatorial grid"
181 msgstr ""
182
183-#: src/gui/StelGui.cpp:106 src/ui_viewDialog.h:1026
184+#: src/gui/StelGui.cpp:106 src/ui_viewDialog.h:1033
185 msgid "Equatorial J2000 grid"
186 msgstr ""
187
188@@ -499,19 +499,19 @@
189 msgid "Galactic grid"
190 msgstr ""
191
192-#: src/gui/StelGui.cpp:108 src/ui_viewDialog.h:1030
193+#: src/gui/StelGui.cpp:108 src/ui_viewDialog.h:1037
194 msgid "Ecliptic line"
195 msgstr ""
196
197-#: src/gui/StelGui.cpp:109 src/ui_viewDialog.h:1028
198+#: src/gui/StelGui.cpp:109 src/ui_viewDialog.h:1035
199 msgid "Equator line"
200 msgstr ""
201
202-#: src/gui/StelGui.cpp:110 src/ui_viewDialog.h:1029
203+#: src/gui/StelGui.cpp:110 src/ui_viewDialog.h:1036
204 msgid "Meridian line"
205 msgstr ""
206
207-#: src/gui/StelGui.cpp:111 src/ui_viewDialog.h:1031
208+#: src/gui/StelGui.cpp:111 src/ui_viewDialog.h:1038
209 msgid "Cardinal points"
210 msgstr ""
211
212@@ -519,7 +519,7 @@
213 msgid "Ground"
214 msgstr ""
215
216-#: src/gui/StelGui.cpp:114 src/ui_viewDialog.h:1009
217+#: src/gui/StelGui.cpp:114 src/ui_viewDialog.h:1016
218 msgid "Atmosphere"
219 msgstr ""
220
221@@ -527,7 +527,7 @@
222 msgid "Fog"
223 msgstr ""
224
225-#: src/gui/StelGui.cpp:117 src/ui_viewDialog.h:1014
226+#: src/gui/StelGui.cpp:117 src/ui_viewDialog.h:1021
227 msgid "Nebulas"
228 msgstr ""
229
230@@ -535,7 +535,7 @@
231 msgid "Nebulas background images"
232 msgstr ""
233
234-#: src/gui/StelGui.cpp:119 src/ui_viewDialog.h:995 src/ui_viewDialog.h:1013
235+#: src/gui/StelGui.cpp:119 src/ui_viewDialog.h:1002 src/ui_viewDialog.h:1020
236 msgid "Stars"
237 msgstr ""
238
239@@ -599,7 +599,7 @@
240 msgid "Script console window"
241 msgstr ""
242
243-#: src/gui/StelGui.cpp:140 src/ui_dateTimeDialogGui.h:295
244+#: src/gui/StelGui.cpp:140 src/ui_dateTimeDialogGui.h:294
245 msgid "Date and Time"
246 msgstr ""
247
248@@ -720,35 +720,110 @@
249 msgid "%1m"
250 msgstr ""
251
252-#: src/gui/ViewDialog.cpp:391
253+#: src/gui/ViewDialog.cpp:399
254 msgid "No description"
255 msgstr ""
256
257-#: src/gui/ViewDialog.cpp:451
258+#: src/gui/ViewDialog.cpp:467
259 msgid "No shooting stars"
260 msgstr ""
261
262-#: src/gui/ViewDialog.cpp:454
263+#: src/gui/ViewDialog.cpp:470
264 msgid "Normal rate"
265 msgstr ""
266
267-#: src/gui/ViewDialog.cpp:457
268+#: src/gui/ViewDialog.cpp:473
269 msgid "Standard Perseids rate"
270 msgstr ""
271
272-#: src/gui/ViewDialog.cpp:460
273+#: src/gui/ViewDialog.cpp:476
274 msgid "Exceptional Leonid rate"
275 msgstr ""
276
277-#: src/gui/ViewDialog.cpp:463
278+#: src/gui/ViewDialog.cpp:479
279 msgid "Highest rate ever (1966 Leonids)"
280 msgstr ""
281
282-#: src/gui/LocationDialog.cpp:340
283+#: src/gui/LocationDialog.cpp:331
284 msgid "New Location"
285 msgstr ""
286
287-#: src/main.cpp:317
288+#: src/gui/AddRemoveLandscapesDialog.cpp:113
289+msgid "Select a ZIP archive that contains a Stellarium landscape"
290+msgstr ""
291+
292+#. TRANSLATORS: This string is displayed in the "Files of type:" drop-down list in the standard file selection dialog.
293+#: src/gui/AddRemoveLandscapesDialog.cpp:115
294+msgid "ZIP archives"
295+msgstr ""
296+
297+#: src/gui/AddRemoveLandscapesDialog.cpp:128
298+#, qt-format
299+msgid "Landscape \"%1\" has been installed successfully."
300+msgstr ""
301+
302+#: src/gui/AddRemoveLandscapesDialog.cpp:129
303+#: src/gui/AddRemoveLandscapesDialog.cpp:156
304+msgid "Success"
305+msgstr ""
306+
307+#: src/gui/AddRemoveLandscapesDialog.cpp:142
308+#: src/gui/AddRemoveLandscapesDialog.cpp:212
309+#: src/gui/AddRemoveLandscapesDialog.cpp:221
310+#: src/gui/AddRemoveLandscapesDialog.cpp:229
311+msgid "No landscape was installed."
312+msgstr ""
313+
314+#: src/gui/AddRemoveLandscapesDialog.cpp:143
315+#: src/gui/AddRemoveLandscapesDialog.cpp:167
316+#: src/gui/AddRemoveLandscapesDialog.cpp:216
317+#: src/gui/AddRemoveLandscapesDialog.cpp:222
318+#: src/gui/AddRemoveLandscapesDialog.cpp:230
319+#: src/gui/AddRemoveLandscapesDialog.cpp:240
320+msgid "Error!"
321+msgstr ""
322+
323+#: src/gui/AddRemoveLandscapesDialog.cpp:155
324+#, qt-format
325+msgid "Landscape \"%1\" has been removed successfully."
326+msgstr ""
327+
328+#: src/gui/AddRemoveLandscapesDialog.cpp:166
329+#: src/gui/AddRemoveLandscapesDialog.cpp:236
330+msgid "The selected landscape could not be (completely) removed."
331+msgstr ""
332+
333+#. TRANSLATORS: MiB = mebibytes (IEC 60027-2 standard for 2^20 bytes)
334+#: src/gui/AddRemoveLandscapesDialog.cpp:189
335+#, qt-format
336+msgid "Size on disk: %1 MiB"
337+msgstr ""
338+
339+#. TRANSLATORS: The parameter is a file/directory path that may be quite long.
340+#: src/gui/AddRemoveLandscapesDialog.cpp:215
341+#, qt-format
342+msgid "Stellarium cannot open for reading or writing %1"
343+msgstr ""
344+
345+#: src/gui/AddRemoveLandscapesDialog.cpp:221
346+msgid ""
347+"The selected file is not a ZIP archive or does not contain a Stellarium "
348+"landscape."
349+msgstr ""
350+
351+#. TRANSLATORS: The parameter is the duplicate name or identifier.
352+#: src/gui/AddRemoveLandscapesDialog.cpp:228
353+#, qt-format
354+msgid "A landscape with the same name or identifier (%1) already exists."
355+msgstr ""
356+
357+#. TRANSLATORS: The parameter is a file/directory path that may be quite long. "It" refers to a landscape that can't be removed.
358+#: src/gui/AddRemoveLandscapesDialog.cpp:239
359+#, qt-format
360+msgid "You can remove it manually by deleting the following directory: %1"
361+msgstr ""
362+
363+#: src/main.cpp:335
364 msgid "This system does not support OpenGL."
365 msgstr ""
366
367@@ -1196,558 +1271,586 @@
368 msgid "Set UI Locale: "
369 msgstr ""
370
371-#: src/ui_dateTimeDialogGui.h:294 src/ui_helpDialogGui.h:259
372-#: src/ui_locationDialogGui.h:387 src/ui_viewDialog.h:979
373-#: src/ui_configurationDialog.h:746
374-msgid "Form"
375-msgstr ""
376-
377-#: src/ui_dateTimeDialogGui.h:297 src/ui_dateTimeDialogGui.h:298
378+#: src/ui_dateTimeDialogGui.h:296 src/ui_dateTimeDialogGui.h:297
379 msgid "/"
380 msgstr ""
381
382-#: src/ui_dateTimeDialogGui.h:299 src/ui_dateTimeDialogGui.h:300
383+#: src/ui_dateTimeDialogGui.h:298 src/ui_dateTimeDialogGui.h:299
384 msgid ":"
385 msgstr ""
386
387-#: src/ui_helpDialogGui.h:260 src/ui_helpDialogGui.h:266
388+#: src/ui_helpDialogGui.h:259 src/ui_helpDialogGui.h:265
389 msgid "Help"
390 msgstr ""
391
392-#: src/ui_helpDialogGui.h:268
393+#: src/ui_helpDialogGui.h:267
394 msgid "About"
395 msgstr ""
396
397-#: src/ui_helpDialogGui.h:270
398+#: src/ui_helpDialogGui.h:269
399 msgid "Log"
400 msgstr ""
401
402-#: src/ui_helpDialogGui.h:273
403+#: src/ui_helpDialogGui.h:272
404 msgid "Refresh"
405 msgstr ""
406
407-#: src/ui_locationDialogGui.h:388
408+#: src/ui_locationDialogGui.h:387
409 msgid "Location"
410 msgstr ""
411
412+#: src/ui_locationDialogGui.h:391
413+msgid "Current location information"
414+msgstr ""
415+
416 #: src/ui_locationDialogGui.h:392
417-msgid "Current location information"
418+msgid "Use as default"
419 msgstr ""
420
421 #: src/ui_locationDialogGui.h:393
422-msgid "Use as default"
423+msgid "Delete"
424 msgstr ""
425
426 #: src/ui_locationDialogGui.h:394
427-msgid "Delete"
428+msgid "Add to list"
429 msgstr ""
430
431 #: src/ui_locationDialogGui.h:395
432-msgid "Add to list"
433-msgstr ""
434-
435-#: src/ui_locationDialogGui.h:396
436 msgid "Latitude:"
437 msgstr ""
438
439-#: src/ui_locationDialogGui.h:398 src/ui_locationDialogGui.h:402
440+#: src/ui_locationDialogGui.h:397 src/ui_locationDialogGui.h:401
441 msgid ""
442 "You can enter values in decimal degrees, or using dms format, for example: "
443 "+1d 12m 8s"
444 msgstr ""
445
446-#: src/ui_locationDialogGui.h:400
447+#: src/ui_locationDialogGui.h:399
448 msgid "Longitude:"
449 msgstr ""
450
451-#: src/ui_locationDialogGui.h:404
452+#: src/ui_locationDialogGui.h:403
453 msgid "Altitude:"
454 msgstr ""
455
456-#: src/ui_locationDialogGui.h:406
457+#: src/ui_locationDialogGui.h:405
458 msgid "Enter the altitude in meter"
459 msgstr ""
460
461+#: src/ui_locationDialogGui.h:407
462+msgid " m"
463+msgstr ""
464+
465 #: src/ui_locationDialogGui.h:408
466-msgid " m"
467+msgid "Name/City:"
468 msgstr ""
469
470 #: src/ui_locationDialogGui.h:409
471-msgid "Name/City:"
472+msgid "Country:"
473 msgstr ""
474
475 #: src/ui_locationDialogGui.h:410
476-msgid "Country:"
477-msgstr ""
478-
479-#: src/ui_locationDialogGui.h:411
480 msgid "Planet:"
481 msgstr ""
482
483-#: src/ui_searchDialogGui.h:230 src/ui_searchDialogGui.h:231
484+#: src/ui_searchDialogGui.h:227 src/ui_searchDialogGui.h:228
485 msgid "Find Object"
486 msgstr ""
487
488-#: src/ui_searchDialogGui.h:236
489+#: src/ui_searchDialogGui.h:233
490 msgid "RA/Dec (J2000):"
491 msgstr ""
492
493-#: src/ui_viewDialog.h:980
494+#: src/ui_viewDialog.h:987
495 msgid "View"
496 msgstr ""
497
498-#: src/ui_viewDialog.h:986
499+#: src/ui_viewDialog.h:993
500 msgid "Sky"
501 msgstr ""
502
503-#: src/ui_viewDialog.h:988
504+#: src/ui_viewDialog.h:995
505 msgid "Markings"
506 msgstr ""
507
508-#: src/ui_viewDialog.h:990
509+#: src/ui_viewDialog.h:997
510 msgid "Landscape"
511 msgstr ""
512
513-#: src/ui_viewDialog.h:992
514+#: src/ui_viewDialog.h:999
515 msgid "Starlore"
516 msgstr ""
517
518-#: src/ui_viewDialog.h:996
519+#: src/ui_viewDialog.h:1003
520 msgid "Absolute scale:"
521 msgstr ""
522
523-#: src/ui_viewDialog.h:997
524+#: src/ui_viewDialog.h:1004
525 msgid "Relative scale:"
526 msgstr ""
527
528-#: src/ui_viewDialog.h:998
529+#: src/ui_viewDialog.h:1005
530 msgid "Twinkle:"
531 msgstr ""
532
533-#: src/ui_viewDialog.h:1000
534+#: src/ui_viewDialog.h:1007
535 msgid "Dim faint stars when a very bright object is visible"
536 msgstr ""
537
538-#: src/ui_viewDialog.h:1002
539+#: src/ui_viewDialog.h:1009
540 msgid "Dynamic eye adaptation"
541 msgstr ""
542
543-#: src/ui_viewDialog.h:1003
544+#: src/ui_viewDialog.h:1010
545 msgid "Planets and satellites"
546 msgstr ""
547
548-#: src/ui_viewDialog.h:1004
549+#: src/ui_viewDialog.h:1011
550 msgid "Show planets"
551 msgstr ""
552
553-#: src/ui_viewDialog.h:1005
554+#: src/ui_viewDialog.h:1012
555 msgid "Show planet markers"
556 msgstr ""
557
558-#: src/ui_viewDialog.h:1006
559+#: src/ui_viewDialog.h:1013
560 msgid "Show planet orbits"
561 msgstr ""
562
563-#: src/ui_viewDialog.h:1007
564+#: src/ui_viewDialog.h:1014
565 msgid "Simulate light speed"
566 msgstr ""
567
568-#: src/ui_viewDialog.h:1008
569+#: src/ui_viewDialog.h:1015
570 msgid "Scale Moon"
571 msgstr ""
572
573-#: src/ui_viewDialog.h:1010
574+#: src/ui_viewDialog.h:1017
575 msgid "Show atmosphere"
576 msgstr ""
577
578-#: src/ui_viewDialog.h:1011
579+#: src/ui_viewDialog.h:1018
580 msgid "Light pollution: "
581 msgstr ""
582
583-#: src/ui_viewDialog.h:1012
584+#: src/ui_viewDialog.h:1019
585 msgid "Labels and Markers"
586 msgstr ""
587
588-#: src/ui_viewDialog.h:1015
589+#: src/ui_viewDialog.h:1022
590 msgid "Planets"
591 msgstr ""
592
593-#: src/ui_viewDialog.h:1016
594+#: src/ui_viewDialog.h:1023
595 msgid "Shooting Stars"
596 msgstr ""
597
598-#: src/ui_viewDialog.h:1017
599+#: src/ui_viewDialog.h:1024
600 msgid "Hourly zenith rate:"
601 msgstr ""
602
603-#: src/ui_viewDialog.h:1018
604+#: src/ui_viewDialog.h:1025
605 msgid "0"
606 msgstr ""
607
608-#: src/ui_viewDialog.h:1019
609+#: src/ui_viewDialog.h:1026
610 msgid "10"
611 msgstr ""
612
613-#: src/ui_viewDialog.h:1020
614+#: src/ui_viewDialog.h:1027
615 msgid "80"
616 msgstr ""
617
618-#: src/ui_viewDialog.h:1021
619+#: src/ui_viewDialog.h:1028
620 msgid "10000"
621 msgstr ""
622
623-#: src/ui_viewDialog.h:1022
624+#: src/ui_viewDialog.h:1029
625 msgid "144000"
626 msgstr ""
627
628-#: src/ui_viewDialog.h:1024
629+#: src/ui_viewDialog.h:1031
630 msgid "Celestial Sphere"
631 msgstr ""
632
633-#: src/ui_viewDialog.h:1032
634+#: src/ui_viewDialog.h:1039
635 msgid "Constellations"
636 msgstr ""
637
638-#: src/ui_viewDialog.h:1033
639+#: src/ui_viewDialog.h:1040
640 msgid "Show lines"
641 msgstr ""
642
643-#: src/ui_viewDialog.h:1034
644+#: src/ui_viewDialog.h:1041
645 msgid "Show labels"
646 msgstr ""
647
648-#: src/ui_viewDialog.h:1035
649+#: src/ui_viewDialog.h:1042
650 msgid "Show boundaries"
651 msgstr ""
652
653-#: src/ui_viewDialog.h:1036
654+#: src/ui_viewDialog.h:1043
655 msgid "Show art"
656 msgstr ""
657
658-#: src/ui_viewDialog.h:1037
659+#: src/ui_viewDialog.h:1044
660 msgid "Art brightness: "
661 msgstr ""
662
663-#: src/ui_viewDialog.h:1038
664+#: src/ui_viewDialog.h:1045
665 msgid "Projection"
666 msgstr ""
667
668-#: src/ui_viewDialog.h:1039 src/ui_viewDialog.h:1044 src/ui_viewDialog.h:1046
669-#: src/ui_configurationDialog.h:853 src/ui_configurationDialog.h:864
670+#: src/ui_viewDialog.h:1046
671+msgid "Add/remove landscapes..."
672+msgstr ""
673+
674+#: src/ui_viewDialog.h:1047 src/ui_viewDialog.h:1052 src/ui_viewDialog.h:1054
675+#: src/ui_configurationDialog.h:852 src/ui_configurationDialog.h:863
676 msgid "Options"
677 msgstr ""
678
679-#: src/ui_viewDialog.h:1040
680+#: src/ui_viewDialog.h:1048
681 msgid "Show ground"
682 msgstr ""
683
684-#: src/ui_viewDialog.h:1041
685+#: src/ui_viewDialog.h:1049
686 msgid "Show fog"
687 msgstr ""
688
689-#: src/ui_viewDialog.h:1042
690+#: src/ui_viewDialog.h:1050
691 msgid "Use associated planet and position"
692 msgstr ""
693
694-#: src/ui_viewDialog.h:1043
695+#: src/ui_viewDialog.h:1051
696 msgid "Use this landscape as default"
697 msgstr ""
698
699-#: src/ui_viewDialog.h:1045
700+#: src/ui_viewDialog.h:1053
701 msgid "Use this sky culture as default"
702 msgstr ""
703
704-#: src/ui_viewDialog.h:1047
705+#: src/ui_viewDialog.h:1055
706 msgid "Visible"
707 msgstr ""
708
709-#: src/ui_configurationDialog.h:747
710+#: src/ui_configurationDialog.h:746
711 msgid "Configuration"
712 msgstr ""
713
714+#: src/ui_configurationDialog.h:748
715+msgid "Program language"
716+msgstr ""
717+
718 #: src/ui_configurationDialog.h:749
719-msgid "Program language"
720-msgstr ""
721-
722-#: src/ui_configurationDialog.h:750
723 msgid "Selected object information"
724 msgstr ""
725
726-#: src/ui_configurationDialog.h:752
727+#: src/ui_configurationDialog.h:751
728 msgid "Display all information available"
729 msgstr ""
730
731-#: src/ui_configurationDialog.h:754
732+#: src/ui_configurationDialog.h:753
733 msgid "All available"
734 msgstr ""
735
736-#: src/ui_configurationDialog.h:756
737+#: src/ui_configurationDialog.h:755
738 msgid "Display less information"
739 msgstr ""
740
741-#: src/ui_configurationDialog.h:758
742+#: src/ui_configurationDialog.h:757
743 msgid "Short"
744 msgstr ""
745
746-#: src/ui_configurationDialog.h:760
747+#: src/ui_configurationDialog.h:759
748 msgid "Display no information"
749 msgstr ""
750
751+#: src/ui_configurationDialog.h:761
752+msgid "None"
753+msgstr ""
754+
755 #: src/ui_configurationDialog.h:762
756-msgid "None"
757-msgstr ""
758-
759-#: src/ui_configurationDialog.h:763
760 msgid "Default options"
761 msgstr ""
762
763-#: src/ui_configurationDialog.h:765
764+#: src/ui_configurationDialog.h:764
765 msgid ""
766 "Save the settings you've changed this session to be the same the next time "
767 "you start Stellarium"
768 msgstr ""
769
770-#: src/ui_configurationDialog.h:767
771+#: src/ui_configurationDialog.h:766
772 msgid "Save settings"
773 msgstr ""
774
775-#: src/ui_configurationDialog.h:769
776+#: src/ui_configurationDialog.h:768
777 msgid "Restore the default settings that came with Stellarium"
778 msgstr ""
779
780+#: src/ui_configurationDialog.h:770
781+msgid "Restore defaults"
782+msgstr ""
783+
784 #: src/ui_configurationDialog.h:771
785-msgid "Restore defaults"
786-msgstr ""
787-
788-#: src/ui_configurationDialog.h:772
789 msgid ""
790 "Restoring default settings requires a restart of Stellarium. Saving all the "
791 "current options includes the current FOV and direction of view for use at "
792 "next startup."
793 msgstr ""
794
795-#: src/ui_configurationDialog.h:774
796+#: src/ui_configurationDialog.h:773
797 msgid "The width of your view when Stellarium starts"
798 msgstr ""
799
800-#: src/ui_configurationDialog.h:776
801+#: src/ui_configurationDialog.h:775
802 msgid "Startup FOV: XX"
803 msgstr ""
804
805-#: src/ui_configurationDialog.h:778
806+#: src/ui_configurationDialog.h:777
807 msgid "The direction you're looking when Stellarium starts"
808 msgstr ""
809
810+#: src/ui_configurationDialog.h:779
811+msgid "Startup direction of view: xxxx"
812+msgstr ""
813+
814 #: src/ui_configurationDialog.h:780
815-msgid "Startup direction of view: xxxx"
816-msgstr ""
817-
818-#: src/ui_configurationDialog.h:781
819 msgid "Control"
820 msgstr ""
821
822-#: src/ui_configurationDialog.h:783
823+#: src/ui_configurationDialog.h:782
824 msgid "Allow keyboard to pan and zoom"
825 msgstr ""
826
827-#: src/ui_configurationDialog.h:785
828+#: src/ui_configurationDialog.h:784
829 msgid "Enable keyboard navigation"
830 msgstr ""
831
832-#: src/ui_configurationDialog.h:787
833+#: src/ui_configurationDialog.h:786
834 msgid "Allow mouse to pan (drag) and zoom (mousewheel)"
835 msgstr ""
836
837+#: src/ui_configurationDialog.h:788
838+msgid "Enable mouse navigation"
839+msgstr ""
840+
841 #: src/ui_configurationDialog.h:789
842-msgid "Enable mouse navigation"
843-msgstr ""
844-
845-#: src/ui_configurationDialog.h:790
846 msgid "Startup date and time"
847 msgstr ""
848
849-#: src/ui_configurationDialog.h:792
850+#: src/ui_configurationDialog.h:791
851 msgid "Starts Stellarium at system clock date and time"
852 msgstr ""
853
854-#: src/ui_configurationDialog.h:794
855+#: src/ui_configurationDialog.h:793
856 msgid "System date and time"
857 msgstr ""
858
859-#: src/ui_configurationDialog.h:796
860+#: src/ui_configurationDialog.h:795
861 msgid ""
862 "Sets the simulation time to the next instance of this time of day when "
863 "Stellarium starts"
864 msgstr ""
865
866-#: src/ui_configurationDialog.h:798
867+#: src/ui_configurationDialog.h:797
868 msgid "System date at:"
869 msgstr ""
870
871-#: src/ui_configurationDialog.h:800
872+#: src/ui_configurationDialog.h:799
873 msgid "Use a specific date and time when Stellarium starts up"
874 msgstr ""
875
876+#: src/ui_configurationDialog.h:801
877+msgid "Other:"
878+msgstr ""
879+
880 #: src/ui_configurationDialog.h:802
881-msgid "Other:"
882+msgid "use current"
883 msgstr ""
884
885 #: src/ui_configurationDialog.h:803
886-msgid "use current"
887-msgstr ""
888-
889-#: src/ui_configurationDialog.h:804
890 msgid "Other"
891 msgstr ""
892
893-#: src/ui_configurationDialog.h:806
894+#: src/ui_configurationDialog.h:805
895 msgid "Hides the mouse cursor when inactive"
896 msgstr ""
897
898-#: src/ui_configurationDialog.h:808
899+#: src/ui_configurationDialog.h:807
900 msgid "Mouse cursor timeout (seconds):"
901 msgstr ""
902
903-#: src/ui_configurationDialog.h:810
904+#: src/ui_configurationDialog.h:809
905 msgid "Toggle vertical and horizontal image flip buttons."
906 msgstr ""
907
908+#: src/ui_configurationDialog.h:811
909+msgid "Show flip buttons"
910+msgstr ""
911+
912 #: src/ui_configurationDialog.h:812
913-msgid "Show flip buttons"
914-msgstr ""
915-
916-#: src/ui_configurationDialog.h:813
917 msgid "Planetarium options"
918 msgstr ""
919
920-#: src/ui_configurationDialog.h:815
921+#: src/ui_configurationDialog.h:814
922 msgid ""
923 "Spheric mirror distortion is used when projecting Stellarium onto a spheric "
924 "mirror for low-cost planetarium systems."
925 msgstr ""
926
927-#: src/ui_configurationDialog.h:817
928+#: src/ui_configurationDialog.h:816
929 msgid "Spheric mirror distortion"
930 msgstr ""
931
932-#: src/ui_configurationDialog.h:819
933+#: src/ui_configurationDialog.h:818
934 msgid "Align labels with the horizon"
935 msgstr ""
936
937-#: src/ui_configurationDialog.h:821
938+#: src/ui_configurationDialog.h:820
939 msgid "Gravity labels"
940 msgstr ""
941
942-#: src/ui_configurationDialog.h:823
943+#: src/ui_configurationDialog.h:822
944 msgid ""
945 "When enabled, the \"auto zoom out\" key will also set the initial viewing "
946 "direction"
947 msgstr ""
948
949-#: src/ui_configurationDialog.h:825
950+#: src/ui_configurationDialog.h:824
951 msgid "Auto zoom out returns to initial direction of view"
952 msgstr ""
953
954-#: src/ui_configurationDialog.h:827
955+#: src/ui_configurationDialog.h:826
956 msgid "Mask out everything outside a central circle in the main view"
957 msgstr ""
958
959-#: src/ui_configurationDialog.h:829
960+#: src/ui_configurationDialog.h:828
961 msgid "Disc viewport"
962 msgstr ""
963
964-#: src/ui_configurationDialog.h:831
965+#: src/ui_configurationDialog.h:830
966 msgid "Hide other constellations when you click one"
967 msgstr ""
968
969+#: src/ui_configurationDialog.h:832
970+msgid "Select single constellation"
971+msgstr ""
972+
973 #: src/ui_configurationDialog.h:833
974-msgid "Select single constellation"
975+msgid "Screenshots"
976 msgstr ""
977
978 #: src/ui_configurationDialog.h:834
979-msgid "Screenshots"
980-msgstr ""
981-
982-#: src/ui_configurationDialog.h:835
983 msgid "Screenshot Directory"
984 msgstr ""
985
986+#: src/ui_configurationDialog.h:836
987+msgid "Invert colors"
988+msgstr ""
989+
990 #: src/ui_configurationDialog.h:837
991-msgid "Invert colors"
992-msgstr ""
993-
994-#: src/ui_configurationDialog.h:838
995 msgid "Star catalog updates"
996 msgstr ""
997
998-#: src/ui_configurationDialog.h:840
999+#: src/ui_configurationDialog.h:839
1000 msgid "Click here to start downloading"
1001 msgstr ""
1002
1003+#: src/ui_configurationDialog.h:841
1004+msgid "Get catalog x of y"
1005+msgstr ""
1006+
1007 #: src/ui_configurationDialog.h:842
1008-msgid "Get catalog x of y"
1009+msgid "Download this file to view even more stars"
1010 msgstr ""
1011
1012 #: src/ui_configurationDialog.h:843
1013-msgid "Download this file to view even more stars"
1014-msgstr ""
1015-
1016-#: src/ui_configurationDialog.h:844
1017 msgid "xxx"
1018 msgstr ""
1019
1020-#: src/ui_configurationDialog.h:846
1021+#: src/ui_configurationDialog.h:845
1022 msgid "Restart the download"
1023 msgstr ""
1024
1025-#: src/ui_configurationDialog.h:848
1026+#: src/ui_configurationDialog.h:847
1027 msgid "Retry"
1028 msgstr ""
1029
1030-#: src/ui_configurationDialog.h:850
1031+#: src/ui_configurationDialog.h:849
1032 msgid "Stop the download. You can always restart it later"
1033 msgstr ""
1034
1035-#: src/ui_configurationDialog.h:852
1036+#: src/ui_configurationDialog.h:851
1037 msgid "Cancel"
1038 msgstr ""
1039
1040-#: src/ui_configurationDialog.h:855
1041+#: src/ui_configurationDialog.h:854
1042 msgid "Close window when script runs"
1043 msgstr ""
1044
1045-#: src/ui_configurationDialog.h:857
1046+#: src/ui_configurationDialog.h:856
1047 msgid "Run the selected script"
1048 msgstr ""
1049
1050-#: src/ui_configurationDialog.h:861
1051+#: src/ui_configurationDialog.h:860
1052 msgid "Stop a running script"
1053 msgstr ""
1054
1055+#: src/ui_configurationDialog.h:864
1056+msgid "Load at startup"
1057+msgstr ""
1058+
1059 #: src/ui_configurationDialog.h:865
1060-msgid "Load at startup"
1061-msgstr ""
1062-
1063-#: src/ui_configurationDialog.h:866
1064 msgid "configure"
1065 msgstr ""
1066
1067-#: src/ui_configurationDialog.h:871
1068+#: src/ui_configurationDialog.h:870
1069 msgid "Main"
1070 msgstr ""
1071
1072-#: src/ui_configurationDialog.h:873
1073+#: src/ui_configurationDialog.h:872
1074 msgid "Navigation"
1075 msgstr ""
1076
1077-#: src/ui_configurationDialog.h:875
1078+#: src/ui_configurationDialog.h:874
1079 msgid "Tools"
1080 msgstr ""
1081
1082-#: src/ui_configurationDialog.h:877
1083+#: src/ui_configurationDialog.h:876
1084 msgid "Scripts"
1085 msgstr ""
1086
1087-#: src/ui_configurationDialog.h:879
1088+#: src/ui_configurationDialog.h:878
1089 msgid "Plugins"
1090 msgstr ""
1091+
1092+#: src/ui_addRemoveLandscapesDialog.h:266
1093+msgid "Add/Remove Landscapes"
1094+msgstr ""
1095+
1096+#: src/ui_addRemoveLandscapesDialog.h:268
1097+msgid "Add a new landscape"
1098+msgstr ""
1099+
1100+#: src/ui_addRemoveLandscapesDialog.h:269
1101+msgid "Install a new landscape from a ZIP archive..."
1102+msgstr ""
1103+
1104+#: src/ui_addRemoveLandscapesDialog.h:270
1105+msgid "Switch to the new landscape after installation"
1106+msgstr ""
1107+
1108+#: src/ui_addRemoveLandscapesDialog.h:273
1109+msgid "Remove an installed landscape"
1110+msgstr ""
1111+
1112+#: src/ui_addRemoveLandscapesDialog.h:275
1113+msgid "Remove"
1114+msgstr ""
1115+
1116+#: src/ui_addRemoveLandscapesDialog.h:276
1117+msgid ""
1118+"WARNING: Removing the selected landscape means deleting its files. This "
1119+"operation is irreversible."
1120+msgstr ""
1121
1122=== modified file 'src/CMakeLists.txt'
1123--- src/CMakeLists.txt 2010-09-06 10:39:45 +0000
1124+++ src/CMakeLists.txt 2010-09-13 16:37:45 +0000
1125@@ -407,6 +407,8 @@
1126 gui/SearchDialog.cpp
1127 gui/ConfigurationDialog.hpp
1128 gui/ConfigurationDialog.cpp
1129+ gui/AddRemoveLandscapesDialog.hpp
1130+ gui/AddRemoveLandscapesDialog.cpp
1131 gui/StelDialog.hpp
1132 gui/StelDialog.cpp)
1133
1134@@ -424,6 +426,7 @@
1135 gui/ViewDialog.hpp
1136 gui/SearchDialog.hpp
1137 gui/ConfigurationDialog.hpp
1138+ gui/AddRemoveLandscapesDialog.hpp
1139 gui/StelDialog.hpp)
1140
1141 ################# compiles .ui files ############
1142@@ -433,7 +436,8 @@
1143 gui/dateTimeDialogGui.ui
1144 gui/viewDialog.ui
1145 gui/searchDialogGui.ui
1146- gui/configurationDialog.ui)
1147+ gui/configurationDialog.ui
1148+ gui/addRemoveLandscapesDialog.ui)
1149
1150 IF(ENABLE_SCRIPT_CONSOLE)
1151 SET(stellarium_gui_SRCS ${stellarium_gui_SRCS}
1152
1153=== modified file 'src/core/modules/LandscapeMgr.cpp'
1154--- src/core/modules/LandscapeMgr.cpp 2010-06-03 21:41:26 +0000
1155+++ src/core/modules/LandscapeMgr.cpp 2010-09-13 16:37:45 +0000
1156@@ -1,6 +1,7 @@
1157 /*
1158 * Stellarium
1159 * Copyright (C) 2006 Fabien Chereau
1160+ * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
1161 *
1162 * This program is free software; you can redistribute it and/or
1163 * modify it under the terms of the GNU General Public License
1164@@ -20,6 +21,9 @@
1165 #include <QDebug>
1166 #include <QSettings>
1167 #include <QString>
1168+#include <QDir>
1169+#include <QFile>
1170+#include <QTemporaryFile>
1171
1172 #ifdef USE_OPENGL_ES2
1173 #include "GLES2/gl2.h"
1174@@ -27,6 +31,8 @@
1175 #include <QtOpenGL>
1176 #endif
1177
1178+#include <stdexcept>
1179+
1180 #include "LandscapeMgr.hpp"
1181 #include "Landscape.hpp"
1182 #include "Atmosphere.hpp"
1183@@ -40,6 +46,8 @@
1184 #include "StelIniParser.hpp"
1185 #include "StelSkyDrawer.hpp"
1186 #include "StelPainter.hpp"
1187+#include "karchive.h"
1188+#include "kzip.h"
1189
1190 // Class which manages the cardinal points displaying
1191 class Cardinals
1192@@ -144,6 +152,10 @@
1193 LandscapeMgr::LandscapeMgr() : atmosphere(NULL), cardinalsPoints(NULL), landscape(NULL), flagLandscapeSetsLocation(false)
1194 {
1195 setObjectName("LandscapeMgr");
1196+
1197+ //TODO: Find a way to obtain this list automatically.
1198+ //Note: The first entry in the list is used as the default 'default landscape' in removeLandscape().
1199+ packagedLandscapeIDs = (QStringList() << "guereins" << "trees" << "moon" << "hurricane" << "ocean" << "garching" << "mars" << "saturn");
1200 }
1201
1202 LandscapeMgr::~LandscapeMgr()
1203@@ -408,6 +420,20 @@
1204 return result;
1205 }
1206
1207+QStringList LandscapeMgr::getUserLandscapeIDs() const
1208+{
1209+ QMap<QString,QString> nameToDirMap = getNameToDirMap();
1210+ QStringList result;
1211+ foreach (QString id, nameToDirMap.values())
1212+ {
1213+ if(!packagedLandscapeIDs.contains(id))
1214+ {
1215+ result += id;
1216+ }
1217+ }
1218+ return result;
1219+}
1220+
1221 QString LandscapeMgr::getCurrentLandscapeName() const
1222 {
1223 return landscape->getName();
1224@@ -604,3 +630,291 @@
1225 }
1226
1227
1228+QString LandscapeMgr::installLandscapeFromArchive(QString sourceFilePath, bool display, bool toMainDirectory)
1229+{
1230+ if (!QFile::exists(sourceFilePath))
1231+ {
1232+ qDebug() << "LandscapeMgr: File does not exist:" << sourceFilePath;
1233+ emit errorUnableToOpen(sourceFilePath);
1234+ return QString();
1235+ }
1236+
1237+ QDir parentDestinationDir;
1238+ //TODO: Fix the "for all users" option
1239+ parentDestinationDir.setPath(StelFileMgr::getUserDir());
1240+
1241+ if (!parentDestinationDir.exists("landscapes"))
1242+ {
1243+ //qDebug() << "LandscapeMgr: No 'landscapes' subdirectory exists in" << parentDestinationDir.absolutePath();
1244+ if (!parentDestinationDir.mkdir("landscapes"))
1245+ {
1246+ qWarning() << "LandscapeMgr: Unable to install landscape: Unable to create sub-directory 'landscapes' in" << parentDestinationDir.absolutePath();
1247+ emit errorUnableToOpen(QDir::cleanPath(parentDestinationDir.filePath("landscapes")));//parentDestinationDir.absolutePath()
1248+ return QString();
1249+ }
1250+ }
1251+ QDir destinationDir (parentDestinationDir.absoluteFilePath("landscapes"));
1252+
1253+ KZip sourceArchive(sourceFilePath);
1254+ if(!sourceArchive.open(QIODevice::ReadOnly))
1255+ {
1256+ qWarning() << "LandscapeMgr: Unable to open as a ZIP archive:" << sourceFilePath;
1257+ emit errorNotArchive();
1258+ return QString();
1259+ }
1260+
1261+ //Detect top directory
1262+ const KArchiveDirectory * archiveTopDirectory = NULL;
1263+ QStringList topLevelContents = sourceArchive.directory()->entries();
1264+ if(topLevelContents.contains("landscape.ini"))
1265+ {
1266+ //If the landscape archive has no top level directory...
1267+ //(test case is "tulipfield" from the Stellarium Wiki)
1268+ archiveTopDirectory = sourceArchive.directory();
1269+ }
1270+ else
1271+ {
1272+ foreach (QString entryPath, topLevelContents)
1273+ {
1274+ if (sourceArchive.directory()->entry(entryPath)->isDirectory())
1275+ {
1276+ if((dynamic_cast<const KArchiveDirectory*>(sourceArchive.directory()->entry(entryPath)))->entries().contains("landscape.ini"))
1277+ {
1278+ archiveTopDirectory = dynamic_cast<const KArchiveDirectory*>(sourceArchive.directory()->entry(entryPath));
1279+ break;
1280+ }
1281+ }
1282+ }
1283+ }
1284+ if (archiveTopDirectory == NULL)
1285+ {
1286+ qWarning() << "LandscapeMgr: Unable to install landscape. There is no directory that contains a 'landscape.ini' file in the source archive.";
1287+ emit errorNotArchive();
1288+ return QString();
1289+ }
1290+
1291+ /*
1292+ qDebug() << "LandscapeMgr: Contents of the source archive:" << endl
1293+ << "- top level direcotory:" << archiveTopDirectory->name() << endl
1294+ << "- contents:" << archiveTopDirectory->entries();
1295+ */
1296+
1297+ //Check if the top directory name is unique
1298+ //TODO: Prompt rename? Rename silently?
1299+ /*
1300+ if (destinationDir.exists(archiveTopDirectory->name()))
1301+ {
1302+ qWarning() << "LandscapeMgr: Unable to install landscape. A directory named" << archiveTopDirectory->name() << "already exists in" << destinationDir.absolutePath();
1303+ return QString();
1304+ }
1305+ */
1306+ //Determine the landscape's identifier
1307+ QString landscapeID = archiveTopDirectory->name();
1308+ if (landscapeID.length() < 2)
1309+ {
1310+ //If the archive has no top level directory (landscapeID is "/"),
1311+ //use the first 65 characters of its file name for an identifier
1312+ QFileInfo sourceFileInfo(sourceFilePath);
1313+ landscapeID = sourceFileInfo.baseName().left(65);
1314+ }
1315+
1316+ //Check for duplicate IDs
1317+ if (getAllLandscapeIDs().contains(landscapeID))
1318+ {
1319+ qWarning() << "LandscapeMgr: Unable to install landscape. A landscape with the ID" << landscapeID << "already exists.";
1320+ emit errorNotUnique(landscapeID);
1321+ return QString();
1322+ }
1323+
1324+ //Read the .ini file and check if the landscape name is unique
1325+ QTemporaryFile tempLandscapeIni("landscapeXXXXXX.ini");
1326+ if (tempLandscapeIni.open())
1327+ {
1328+ const KZipFileEntry * archLandscapeIni = static_cast<const KZipFileEntry*>(archiveTopDirectory->entry("landscape.ini"));
1329+ tempLandscapeIni.write(archLandscapeIni->createDevice()->readAll());
1330+ tempLandscapeIni.close();
1331+
1332+ QSettings confLandscapeIni(tempLandscapeIni.fileName(), StelIniFormat);
1333+ QString landscapeName = confLandscapeIni.value("landscape/name").toString();
1334+ if (getAllLandscapeNames().contains(landscapeName))
1335+ {
1336+ qWarning() << "LandscapeMgr: Unable to install landscape. There is already a landscape named" << landscapeName;
1337+ emit errorNotUnique(landscapeName);
1338+ return QString();
1339+ }
1340+ }
1341+
1342+ //Copy the landscape directory to the target
1343+ //sourceArchive.directory()->copyTo(destinationDir.absolutePath());
1344+
1345+ //This case already has been handled - and commented out - above. :)
1346+ if(destinationDir.exists(landscapeID))
1347+ {
1348+ qWarning() << "LandscapeMgr: A subdirectory" << landscapeID << "already exists in" << destinationDir.absolutePath() << "Its contents may be overwritten.";
1349+ }
1350+ else if(!destinationDir.mkdir(landscapeID))
1351+ {
1352+ qWarning() << "LandscapeMgr: Unable to install landscape. Unable to create" << landscapeID << "directory in" << destinationDir.absolutePath();
1353+ emit errorUnableToOpen(QDir::cleanPath(destinationDir.filePath(landscapeID)));
1354+ return QString();
1355+ }
1356+ destinationDir.cd(landscapeID);
1357+ QString destinationDirPath = destinationDir.absolutePath();
1358+ QStringList landscapeFileEntries = archiveTopDirectory->entries();
1359+ foreach (QString entry, landscapeFileEntries)
1360+ {
1361+ const KArchiveEntry * archEntry = archiveTopDirectory->entry(entry);
1362+ if(archEntry->isFile())
1363+ {
1364+ static_cast<const KZipFileEntry*>(archEntry)->copyTo(destinationDirPath);
1365+ }
1366+ }
1367+
1368+ sourceArchive.close();
1369+
1370+ //If necessary, make the new landscape the current landscape
1371+ if (display)
1372+ {
1373+ setCurrentLandscapeID(landscapeID);
1374+ }
1375+
1376+ //Make sure that everyone knows that the list of available landscapes has changed
1377+ emit landscapesChanged();
1378+
1379+ qDebug() << "LandscapeMgr: Successfully installed landscape directory" << landscapeID << "to" << destinationDir.absolutePath();
1380+ return landscapeID;
1381+}
1382+
1383+bool LandscapeMgr::removeLandscape(QString landscapeID)
1384+{
1385+ if (landscapeID.isEmpty())
1386+ {
1387+ qWarning() << "LandscapeMgr: Error! No landscape ID passed to removeLandscape().";
1388+ return false;
1389+ }
1390+
1391+ if (packagedLandscapeIDs.contains(landscapeID))
1392+ {
1393+ qWarning() << "LandscapeMgr: Landscapes that are part of the default installation cannot be removed.";
1394+ return false;
1395+ }
1396+
1397+ qDebug() << "LandscapeMgr: Trying to remove landscape" << landscapeID;
1398+
1399+ QString landscapePath = getLandscapePath(landscapeID);
1400+ if (landscapePath.isEmpty())
1401+ return false;
1402+
1403+ QDir landscapeDir(landscapePath);
1404+ foreach (QString fileName, landscapeDir.entryList(QDir::Files | QDir::NoDotAndDotDot))
1405+ {
1406+ if(!landscapeDir.remove(fileName))
1407+ {
1408+ qWarning() << "LandscapeMgr: Unable to remove" << fileName;
1409+ emit errorRemoveManually(landscapeDir.absolutePath());
1410+ return false;
1411+ }
1412+ }
1413+ landscapeDir.cdUp();
1414+ if(!landscapeDir.rmdir(landscapeID))
1415+ {
1416+ qWarning() << "LandscapeMgr: Error! Landscape" << landscapeID
1417+ << "could not be removed. "
1418+ << "Some files were deleted, but not all."
1419+ << endl
1420+ << "LandscapeMgr: You can delete manually" << QDir::cleanPath(landscapeDir.filePath(landscapeID));
1421+ emit errorRemoveManually(QDir::cleanPath(landscapeDir.filePath(landscapeID)));
1422+ return false;
1423+ }
1424+
1425+ qDebug() << "LandscapeMgr: Successfully removed" << landscapePath;
1426+
1427+ //If the landscape has been selected, revert to the default one
1428+ //TODO: Make this optional?
1429+ if (getCurrentLandscapeID() == landscapeID)
1430+ {
1431+ if(getDefaultLandscapeID() == landscapeID)
1432+ {
1433+ setDefaultLandscapeID(packagedLandscapeIDs.first());
1434+ //TODO: Find what happens if a missing landscape is specified in the configuration file
1435+ }
1436+
1437+ setCurrentLandscapeID(getDefaultLandscapeID());
1438+ }
1439+
1440+ //Make sure that everyone knows that the list of available landscapes has changed
1441+ emit landscapesChanged();
1442+
1443+ return true;
1444+}
1445+
1446+QString LandscapeMgr::getLandscapePath(QString landscapeID)
1447+{
1448+ QString result;
1449+ //Is this necessary? This function is private.
1450+ if (landscapeID.isEmpty())
1451+ return result;
1452+
1453+ try
1454+ {
1455+ result = StelFileMgr::findFile("landscapes/" + landscapeID, StelFileMgr::Directory);
1456+ }
1457+ catch (std::runtime_error &e)
1458+ {
1459+ qWarning() << "LandscapeMgr: Error! Unable to find" << landscapeID << ":" << e.what();
1460+ return result;
1461+ }
1462+
1463+ return result;
1464+}
1465+
1466+QString LandscapeMgr::loadLandscapeName(QString landscapeID)
1467+{
1468+ QString landscapeName;
1469+ if (landscapeID.isEmpty())
1470+ {
1471+ qWarning() << "LandscapeMgr: Error! No landscape ID passed to loadLandscapeName().";
1472+ return landscapeName;
1473+ }
1474+
1475+ QString landscapePath = getLandscapePath(landscapeID);
1476+ if (landscapePath.isEmpty())
1477+ return landscapeName;
1478+
1479+ QDir landscapeDir(landscapePath);
1480+ if (landscapeDir.exists("landscape.ini"))
1481+ {
1482+ QString landscapeSettingsPath = landscapeDir.filePath("landscape.ini");
1483+ QSettings landscapeSettings(landscapeSettingsPath, StelIniFormat);
1484+ landscapeName = landscapeSettings.value("landscape/name").toString();
1485+ }
1486+ else
1487+ {
1488+ qWarning() << "LandscapeMgr: Error! Landscape directory" << landscapePath << "does not contain a 'landscape.ini' file";
1489+ }
1490+
1491+ return landscapeName;
1492+}
1493+
1494+quint64 LandscapeMgr::loadLandscapeSize(QString landscapeID)
1495+{
1496+ quint64 landscapeSize = 0;
1497+ if (landscapeID.isEmpty())
1498+ {
1499+ qWarning() << "LandscapeMgr: Error! No landscape ID passed to loadLandscapeSize().";
1500+ return landscapeSize;
1501+ }
1502+
1503+ QString landscapePath = getLandscapePath(landscapeID);
1504+ if (landscapePath.isEmpty())
1505+ return landscapeSize;
1506+
1507+ QDir landscapeDir(landscapePath);
1508+ foreach (QFileInfo file, landscapeDir.entryInfoList(QDir::Files | QDir::NoDotAndDotDot))
1509+ {
1510+ //qDebug() << "name:" << file.baseName() << "size:" << file.size();
1511+ landscapeSize += file.size();
1512+ }
1513+
1514+ return landscapeSize;
1515+}
1516
1517=== modified file 'src/core/modules/LandscapeMgr.hpp'
1518--- src/core/modules/LandscapeMgr.hpp 2010-05-20 10:13:42 +0000
1519+++ src/core/modules/LandscapeMgr.hpp 2010-09-13 16:37:45 +0000
1520@@ -1,6 +1,7 @@
1521 /*
1522 * Stellarium
1523 * Copyright (C) 2006 Fabien Chereau
1524+ * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
1525 *
1526 * This program is free software; you can redistribute it and/or
1527 * modify it under the terms of the GNU General Public License
1528@@ -32,8 +33,8 @@
1529 class QSettings;
1530
1531 //! @class LandscapeMgr
1532-//! Manages all the rendering a the level of the observer's surrounding.
1533-//! This includes landscape textures, fog, atmosphere and cardinal points
1534+//! Manages all the rendering at the level of the observer's surroundings.
1535+//! This includes landscape textures, fog, atmosphere and cardinal points.
1536 //! I decided to put all these elements together in a single class because they are
1537 //! inherently linked, especially when we start moving the observer in altitude.
1538 class LandscapeMgr : public StelModule
1539@@ -95,16 +96,21 @@
1540 public slots:
1541 ///////////////////////////////////////////////////////////////////////////
1542 // Methods callable from script and GUI
1543- //! Retrieve list of the names of all the available landscape in the
1544- //! file search path sub-directories of the landscape area
1545+ //! Retrieve a list of the names of all the available landscapes in
1546+ //! the file search path sub-directories of the landscape area
1547 //! @return the names of the landscapes, which are the values of the name parameter in the landscape.ini files
1548 QStringList getAllLandscapeNames() const;
1549
1550- //! Retrieve list of the names of all the available landscape in the
1551- //! file search path sub-directories of the landscape area
1552- //! @return the names of the landscapes, which are the values of the name parameter in the landscape.ini files
1553+ //! Retrieve a list of the identifiers of all the available landscapes in
1554+ //! the file search path sub-directories of the landscape area
1555+ //! @return the identifiers of the landscapes, which are the names of the directories containing the landscapes' files
1556 QStringList getAllLandscapeIDs() const;
1557
1558+ //! Retrieve a list of the identifiers of all user-installed landscapes.
1559+ //! Effectively, this returns the results of getAllLandscapeIDs() without
1560+ //! the landscapes specified in the #packagedLandscapeIDs list.
1561+ QStringList getUserLandscapeIDs() const;
1562+
1563 //! Get the current landscape ID.
1564 const QString& getCurrentLandscapeID() const {return currentLandscapeID;}
1565 //! Change the current landscape to the landscape with the ID specified.
1566@@ -174,6 +180,106 @@
1567 //! @param d the rotation angle in degrees as an offset from the originally loaded value.
1568 void setZRotation(float d);
1569
1570+ //! Install a landscape from a ZIP archive.
1571+ //! This function searches for a file named "landscape.ini" in the root
1572+ //! directory of the archive. If it is not found there, the function
1573+ //! searches inside the topmost sub-directories (if any), but no deeper.
1574+ //! If a landscape configuration file is found:
1575+ //! - if a "landscapes" directory does not exist in the user data
1576+ //! directory, it is created;
1577+ //! - inside it, a sub-directory is created with the landscape identifier
1578+ //! for a name;
1579+ //! - all files in the archive directory that contains the "landscape.ini"
1580+ //! file are extracted to the new sub-directory of "landscapes";
1581+ //! - all sub-directories of that archive directory will be skipped along
1582+ //! with any other files or directories in the archive.
1583+ //!
1584+ //! The landscape identifier is either:
1585+ //! - the name of the folder in the archive that contains "landscape.ini",
1586+ //! - or the first 65 (or less) characters of the archive name, if the
1587+ //! "landscape.ini" file is in the nameless root directory of the archive.
1588+ //!
1589+ //! The landscape identifier must be unique.
1590+ //! @param pathToSourceArchive path to the source archive file.
1591+ //! @param display If true, the landscape will be set to be the current
1592+ //! landscape after installation.
1593+ //! @param forAllUsers If true, this function will try to install the
1594+ //! landscape in a way that meakes it is available to all users of this
1595+ //! computer. May require running Stellarium as an administrator (root)
1596+ //! on some Windows or *nix systems. (NOT IMPLEMENTED!)
1597+ //! @returns the installed landscape's identifier, or
1598+ //! an empty string on failure.
1599+ //! @todo Find a better way to pass error messages.
1600+ QString installLandscapeFromArchive(QString pathToSourceArchive, bool display = false, bool forAllUsers = false);
1601+
1602+ //! Install a landscape from a directory.
1603+ //! Expected directory structure: the name of the directory that contains
1604+ //! a landscape.ini file is assumed to be the landscape ID and should be
1605+ //! unique.
1606+ //! This directory and all files in it will be installed, but its
1607+ //! subdirectories will be skipped along with any other files or
1608+ //! directories in the archive.
1609+ //! @param pathToSourceLandscapeIni path to a landscape.ini file. Its parent
1610+ //! directory is assumed to be the landscape source directory.
1611+ //! @param display If true, the landscape will be set to be the current
1612+ //! landscape after installation.
1613+ //! @param forAllUsers If true, this function will try to install the
1614+ //! landscape in a way that meakes it is available to all users of this
1615+ //! computer. May require running Stellarium as an administrator (root)
1616+ //! on some Windows or *nix systems. (NOT IMPLEMENTED!)
1617+ //! @returns the installed landscape's identifier (the folder name), or
1618+ //! an empty string on failure.
1619+ //QString installLandscapeFromDirectory(QString pathToSourceLandscapeIni, bool display = false, bool forAllUsers = false);
1620+
1621+ //! This function removes a landscape from the user data directory.
1622+ //! It tries to recursively delete all files in the landscape directory
1623+ //! and then remove it from the list of available landscapes.
1624+ //! If the function encounters any file that can't be deleted
1625+ //! it aborts the operation (previously deleted files are not restored).
1626+ //! Landscapes that were packaged with Stellarium can't be removed,
1627+ //! thanks to the #packagedtLandscapeIDs list.
1628+ //! @param landscapeID an installed landscape's identifier (the folder name)
1629+ //! @todo Find a better way to pass error messages.
1630+ bool removeLandscape(QString landscapeID);
1631+
1632+ //! This function reads a landscape's name from its configuration file.
1633+ //! @param landscapeID an installed landscape's identifier (the folder name)
1634+ //! @returns an empty string if there is no such landscape or some other
1635+ //! error occurs
1636+ QString loadLandscapeName(QString landscapeID);
1637+
1638+ //! This function calculates and returns a landscape's disc size in bytes.
1639+ //! It adds up the sizes of all files in the landscape's folder. It assumes
1640+ //! that there are no sub-directories. (There shouldn't be any anyway.)
1641+ //! @param landscapeID an installed landscape's identifier (the folder name)
1642+ quint64 loadLandscapeSize(QString landscapeID);
1643+
1644+signals:
1645+ //! Emitted when a landscape has been installed or un-installed.
1646+ //! For example, it is used to update the list of landscapes in
1647+ //! the Sky and viewing options window (the ViewDialog class)
1648+ void landscapesChanged();
1649+
1650+ //! Emitted when installLandscapeFromArchive() can't read from, write to or
1651+ //! create a file or a directory.
1652+ //! (A way of moving the need for translatable error messages to the GUI.)
1653+ //! \param path path to the file or directory
1654+ void errorUnableToOpen(QString path);
1655+ //! Emitted when the file passed to installLandscapeFromArchive() is not a
1656+ //! ZIP archive or does not contain a valid landscape.
1657+ //! (A way of moving the need for translatable error messages to the GUI.)
1658+ void errorNotArchive();
1659+ //! Emitted when installLandscapeFromArchive() tries to install a landscape
1660+ //! with the same name or identifier as an already installed one.
1661+ //! (A way of moving the need for translatable error messages to the GUI.)
1662+ //! \param nameOrID the name or the identifier of the landscape
1663+ void errorNotUnique(QString nameOrID);
1664+ //! Emitted when removeLandscape() is unable to remove all the files of
1665+ //! a landscape.
1666+ //! (A way of moving the need for translatable error messages to the GUI.)
1667+ //! \param path the path to the landscape's directory
1668+ void errorRemoveManually(QString path);
1669+
1670 private:
1671 //! Get light pollution luminance level.
1672 float getAtmosphereLightPollutionLuminance() const;
1673@@ -188,6 +294,12 @@
1674 //! Return a map of landscape name to landscape ID (directory name).
1675 QMap<QString,QString> getNameToDirMap() const;
1676
1677+ //! Returns the path to an installed landscape's directory.
1678+ //! It uses StelFileMgr to look for it in the possible directories.
1679+ //! @param landscapeID an installed landscape's identifier (the folder name)
1680+ //! @returns an empty string, if no such landscape was found.
1681+ QString getLandscapePath(QString landscapeID);
1682+
1683 Atmosphere* atmosphere; // Atmosphere
1684 Cardinals* cardinalsPoints; // Cardinals points
1685 Landscape* landscape; // The landscape i.e. the fog, the ground and "decor"
1686@@ -200,6 +312,13 @@
1687
1688 // The ID of the default landscape
1689 QString defaultLandscapeID;
1690+
1691+ //! List of the IDs of the landscapes packaged by default with Stellarium.
1692+ //! (So that they can't be removed.)
1693+ //! It is populated in LandscapeMgr() and has to be updated
1694+ //! manually on changes.
1695+ //! @todo Find a way to update it automatically.
1696+ QStringList packagedLandscapeIDs;
1697 };
1698
1699 #endif // _LANDSCAPEMGR_HPP_
1700
1701=== added file 'src/gui/AddRemoveLandscapesDialog.cpp'
1702--- src/gui/AddRemoveLandscapesDialog.cpp 1970-01-01 00:00:00 +0000
1703+++ src/gui/AddRemoveLandscapesDialog.cpp 2010-09-13 16:37:45 +0000
1704@@ -0,0 +1,241 @@
1705+/*
1706+ * Stellarium
1707+ *
1708+ * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
1709+ *
1710+ * This program is free software; you can redistribute it and/or
1711+ * modify it under the terms of the GNU General Public License
1712+ * as published by the Free Software Foundation; either version 2
1713+ * of the License, or (at your option) any later version.
1714+ *
1715+ * This program is distributed in the hope that it will be useful,
1716+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1717+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1718+ * GNU General Public License for more details.
1719+ *
1720+ * You should have received a copy of the GNU General Public License
1721+ * along with this program; if not, write to the Free Software
1722+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1723+*/
1724+#include "AddRemoveLandscapesDialog.hpp"
1725+#include "ui_addRemoveLandscapesDialog.h"
1726+
1727+#include "Dialog.hpp"
1728+#include "LandscapeMgr.hpp"
1729+#include "StelApp.hpp"
1730+#include "StelModuleMgr.hpp"
1731+#include "StelLocaleMgr.hpp"
1732+
1733+#include <QDebug>
1734+#include <QFileDialog>
1735+#include <QString>
1736+
1737+AddRemoveLandscapesDialog::AddRemoveLandscapesDialog()
1738+{
1739+ ui = new Ui_addRemoveLandscapesDialogForm;
1740+
1741+ landscapeManager = GETSTELMODULE(LandscapeMgr);
1742+
1743+ lastUsedDirectoryPath = QDir::homePath();
1744+}
1745+
1746+AddRemoveLandscapesDialog::~AddRemoveLandscapesDialog()
1747+{
1748+ delete ui;
1749+}
1750+
1751+void AddRemoveLandscapesDialog::languageChanged()
1752+{
1753+ if (dialog)
1754+ ui->retranslateUi(dialog);
1755+}
1756+
1757+// Initialize the dialog widgets and connect the signals/slots
1758+void AddRemoveLandscapesDialog::createDialogContent()
1759+{
1760+ ui->setupUi(dialog);
1761+
1762+ //Signals and slots
1763+ connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
1764+
1765+ connect(ui->pushButtonBrowseForArchive, SIGNAL(clicked()), this, SLOT(browseForArchiveClicked()));
1766+ connect(ui->listWidgetUserLandscapes, SIGNAL(currentRowChanged(int)), this, SLOT(updateSidePane(int)));
1767+ connect(ui->pushButtonRemove, SIGNAL(clicked()), this, SLOT(removeClicked()));
1768+ connect(ui->pushButtonMessageOK, SIGNAL(clicked()), this, SLOT(messageAcknowledged()));
1769+
1770+ connect(landscapeManager, SIGNAL(landscapesChanged()), this, SLOT(populateLists()));
1771+ connect(landscapeManager, SIGNAL(errorUnableToOpen(QString)), this, SLOT(messageUnableToOpen(QString)));
1772+ connect(landscapeManager, SIGNAL(errorNotArchive()), this, SLOT(messageNotArchive()));
1773+ connect(landscapeManager, SIGNAL(errorNotUnique(QString)), this, SLOT(messageNotUnique(QString)));
1774+ connect(landscapeManager, SIGNAL(errorRemoveManually(QString)), this, SLOT(messageRemoveManually(QString)));
1775+
1776+ ui->groupBoxMessage->setVisible(false);
1777+
1778+ populateLists();
1779+}
1780+
1781+void AddRemoveLandscapesDialog::setVisible(bool v)
1782+{
1783+ StelDialog::setVisible(v);
1784+ //Make sure that every time when the dialog is displayed, the current
1785+ //landscape is selected in the list of user landscapes if it is in the list.
1786+ populateLists();
1787+}
1788+
1789+void AddRemoveLandscapesDialog::populateLists()
1790+{
1791+ ui->listWidgetUserLandscapes->clear();
1792+ QStringList landscapes = landscapeManager->getUserLandscapeIDs();
1793+ if (!landscapes.isEmpty())
1794+ {
1795+ landscapes.sort();
1796+ ui->listWidgetUserLandscapes->addItems(landscapes);
1797+ //If the current landscape is in the list of user landscapes, select its entry
1798+ if((ui->listWidgetUserLandscapes->findItems(landscapeManager->getCurrentLandscapeID(), Qt::MatchExactly).isEmpty()))
1799+ {
1800+ //If the current landscape is not in the list, simply select the first row
1801+ ui->listWidgetUserLandscapes->setCurrentRow(0);
1802+ }
1803+ else
1804+ {
1805+ ui->listWidgetUserLandscapes->setCurrentItem(ui->listWidgetUserLandscapes->findItems(landscapeManager->getCurrentLandscapeID(), Qt::MatchExactly).first());
1806+ }
1807+ }
1808+ else
1809+ {
1810+ //Force disabling the side pane
1811+ updateSidePane(-1);
1812+ }
1813+}
1814+
1815+void AddRemoveLandscapesDialog::browseForArchiveClicked()
1816+{
1817+ QString caption = q_("Select a ZIP archive that contains a Stellarium landscape");
1818+ // TRANSLATORS: This string is displayed in the "Files of type:" drop-down list in the standard file selection dialog.
1819+ QString filter = q_("ZIP archives");
1820+ filter += " (*.zip)";
1821+ QString sourceArchivePath = QFileDialog::getOpenFileName(NULL, caption, lastUsedDirectoryPath, filter);
1822+ bool useLandscape = ui->checkBoxUseLandscape->isChecked();
1823+ if (!sourceArchivePath.isEmpty() && QFile::exists(sourceArchivePath))
1824+ {
1825+ //Remember the last successfully used directory
1826+ lastUsedDirectoryPath = QFileInfo(sourceArchivePath).path();
1827+
1828+ QString newLandscapeID = landscapeManager->installLandscapeFromArchive(sourceArchivePath, useLandscape);
1829+ if(!newLandscapeID.isEmpty())
1830+ {
1831+ //Show a message
1832+ QString successMessage = QString(q_("Landscape \"%1\" has been installed successfully.")).arg(newLandscapeID);
1833+ displayMessage(q_("Success"), successMessage);
1834+
1835+ //Make the new landscape selected in the list
1836+ //populateLists(); //No longer needed after the migration to signals/slots
1837+ ui->listWidgetUserLandscapes->setCurrentItem((ui->listWidgetUserLandscapes->findItems(newLandscapeID, Qt::MatchExactly)).first());
1838+ }
1839+ else
1840+ {
1841+ //If no error message has been displayed by the signal/slot mechanism,
1842+ //display a generic message.
1843+ if (!ui->groupBoxMessage->isVisible())
1844+ {
1845+ //Show an error message
1846+ QString failureMessage = q_("No landscape was installed.");
1847+ displayMessage(q_("Error!"), failureMessage);
1848+ }
1849+ }
1850+ }
1851+}
1852+
1853+void AddRemoveLandscapesDialog::removeClicked()
1854+{
1855+ QString landscapeID = ui->listWidgetUserLandscapes->currentItem()->data(0).toString();
1856+ if(landscapeManager->removeLandscape(landscapeID))
1857+ {
1858+ //populateLists();//No longer needed after the migration to signals/slots
1859+ QString successMessage = QString(q_("Landscape \"%1\" has been removed successfully.")).arg(landscapeID);
1860+ displayMessage(q_("Success"), successMessage);
1861+ }
1862+ else
1863+ {
1864+ //If no error message has been displayed by the signal/slot mechanism,
1865+ //display a generic message.
1866+ if (!ui->groupBoxMessage->isVisible())
1867+ {
1868+ //Show an error message
1869+ //NB! This string is used elsewhere. Modify both to avoid two nearly identical translations.
1870+ QString failureMessage = q_("The selected landscape could not be (completely) removed.");
1871+ displayMessage(q_("Error!"), failureMessage);
1872+ }
1873+ }
1874+
1875+}
1876+
1877+void AddRemoveLandscapesDialog::updateSidePane(int newRow)
1878+{
1879+ bool displaySidePane = (newRow >= 0);
1880+ ui->labelLandscapeName->setVisible(displaySidePane);
1881+ ui->labelLandscapeSize->setVisible(displaySidePane);
1882+ ui->pushButtonRemove->setEnabled(displaySidePane);
1883+ ui->labelWarning->setEnabled(displaySidePane);
1884+ if (!displaySidePane)
1885+ return;
1886+
1887+ QString landscapeID = ui->listWidgetUserLandscapes->item(newRow)->data(0).toString();
1888+ //Name
1889+ ui->labelLandscapeName->setText("<h3>"+landscapeManager->loadLandscapeName(landscapeID)+"</h3>");
1890+ //Size in MiB
1891+ double landscapeSize = landscapeManager->loadLandscapeSize(landscapeID) / (double)(1024*1024);
1892+ // TRANSLATORS: MiB = mebibytes (IEC 60027-2 standard for 2^20 bytes)
1893+ ui->labelLandscapeSize->setText(QString(q_("Size on disk: %1 MiB")).arg(landscapeSize, 0, 'f', 2));
1894+}
1895+
1896+void AddRemoveLandscapesDialog::messageAcknowledged()
1897+{
1898+ ui->groupBoxMessage->setVisible(false);
1899+ ui->groupBoxAdd->setVisible(true);
1900+ ui->groupBoxRemove->setVisible(true);
1901+ ui->labelMessage->clear();
1902+ ui->groupBoxMessage->setTitle(QString());
1903+}
1904+
1905+void AddRemoveLandscapesDialog::displayMessage(QString title, QString message)
1906+{
1907+ ui->labelMessage->setText(message);
1908+ ui->groupBoxMessage->setTitle(title);
1909+ ui->groupBoxMessage->setVisible(true);
1910+ ui->groupBoxAdd->setVisible(false);
1911+ ui->groupBoxRemove->setVisible(false);
1912+}
1913+
1914+void AddRemoveLandscapesDialog::messageUnableToOpen(QString path)
1915+{
1916+ QString failureMessage = q_("No landscape was installed.");
1917+ failureMessage.append(" ");
1918+ // TRANSLATORS: The parameter is a file/directory path that may be quite long.
1919+ failureMessage.append(q_("Stellarium cannot open for reading or writing %1").arg(path));
1920+ displayMessage(q_("Error!"), failureMessage);
1921+}
1922+
1923+void AddRemoveLandscapesDialog::messageNotArchive()
1924+{
1925+ QString failureMessage = q_("No landscape was installed.") + " " + q_("The selected file is not a ZIP archive or does not contain a Stellarium landscape.");
1926+ displayMessage(q_("Error!"), failureMessage);
1927+}
1928+
1929+void AddRemoveLandscapesDialog::messageNotUnique(QString nameOrID)
1930+{
1931+ // TRANSLATORS: The parameter is the duplicate name or identifier.
1932+ QString nameMessage = q_("A landscape with the same name or identifier (%1) already exists.").arg(nameOrID);
1933+ QString failureMessage = q_("No landscape was installed.") + " " + nameMessage;
1934+ displayMessage(q_("Error!"), failureMessage);
1935+}
1936+
1937+void AddRemoveLandscapesDialog::messageRemoveManually(QString path)
1938+{
1939+ //NB! This string is used elsewhere. Modify both to avoid two nearly identical translations.
1940+ QString failureMessage = q_("The selected landscape could not be (completely) removed.");
1941+ failureMessage.append(" ");
1942+ // TRANSLATORS: The parameter is a file/directory path that may be quite long. "It" refers to a landscape that can't be removed.
1943+ failureMessage.append(q_("You can remove it manually by deleting the following directory: %1").arg(path));
1944+ displayMessage(q_("Error!"), failureMessage);
1945+}
1946
1947=== added file 'src/gui/AddRemoveLandscapesDialog.hpp'
1948--- src/gui/AddRemoveLandscapesDialog.hpp 1970-01-01 00:00:00 +0000
1949+++ src/gui/AddRemoveLandscapesDialog.hpp 2010-09-13 16:37:45 +0000
1950@@ -0,0 +1,81 @@
1951+/*
1952+ * Stellarium
1953+ *
1954+ * Copyright (C) 2010 Bogdan Marinov (add/remove landscapes feature)
1955+ *
1956+ * This program is free software; you can redistribute it and/or
1957+ * modify it under the terms of the GNU General Public License
1958+ * as published by the Free Software Foundation; either version 2
1959+ * of the License, or (at your option) any later version.
1960+ *
1961+ * This program is distributed in the hope that it will be useful,
1962+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1963+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1964+ * GNU General Public License for more details.
1965+ *
1966+ * You should have received a copy of the GNU General Public License
1967+ * along with this program; if not, write to the Free Software
1968+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
1969+*/
1970+
1971+#ifndef _ADDREMOVELANDSCAPESDIALOG_HPP_
1972+#define _ADDREMOVELANDSCAPESDIALOG_HPP_
1973+
1974+#include <QObject>
1975+#include <QStringList>
1976+
1977+#include "StelDialog.hpp"
1978+
1979+class Ui_addRemoveLandscapesDialogForm;
1980+class LandscapeMgr;
1981+
1982+//! @class AddRemoveLandscapesDialog
1983+class AddRemoveLandscapesDialog : public StelDialog
1984+{
1985+ Q_OBJECT
1986+public:
1987+ AddRemoveLandscapesDialog();
1988+ virtual ~AddRemoveLandscapesDialog();
1989+ void languageChanged();
1990+
1991+public slots:
1992+ //! This function overrides the non-virtual StelDialog::setVisible()
1993+ //! to allow the current landscape to be selected in the list of user
1994+ //! landscapes (if it is in the list) every time the dialog is displayed.
1995+ void setVisible(bool);
1996+ void populateLists();
1997+
1998+protected:
1999+ //! Initialize the dialog widgets and connect the signals/slots.
2000+ virtual void createDialogContent();
2001+ Ui_addRemoveLandscapesDialogForm* ui;
2002+
2003+private slots:
2004+ void browseForArchiveClicked();
2005+ void removeClicked();
2006+ void updateSidePane(int newRow);
2007+
2008+ //! Hides the message group box and returns to the "Add" group box.
2009+ //! Usually called by clicking the "OK" button in the message box.
2010+ void messageAcknowledged();
2011+
2012+ void messageUnableToOpen(QString path);
2013+ void messageNotArchive();
2014+ void messageNotUnique(QString nameOrID);
2015+ void messageRemoveManually(QString path);
2016+
2017+private:
2018+ LandscapeMgr* landscapeManager;
2019+
2020+ //! Path to the directory last used by QFileDialog in buttonAddClicked().
2021+ //! Initialized with QDir::homePath() in Landscape(). (DOESN'T WORK!)
2022+ QString lastUsedDirectoryPath;
2023+
2024+ //! Displays a message in place of the "Add" box.
2025+ //! Pressing the "OK" button in the message box calls messageAcknowledged().
2026+ //! @param title the title of the QGroupBox that contains the message
2027+ //! @param message the text of the message itself
2028+ void displayMessage(QString title, QString message);
2029+};
2030+
2031+#endif // _ADDREMOVELANDSCAPESDIALOG_
2032
2033=== modified file 'src/gui/ViewDialog.cpp'
2034--- src/gui/ViewDialog.cpp 2010-04-22 10:02:15 +0000
2035+++ src/gui/ViewDialog.cpp 2010-09-13 16:37:45 +0000
2036@@ -20,6 +20,7 @@
2037
2038 #include "ViewDialog.hpp"
2039 #include "ui_viewDialog.h"
2040+#include "AddRemoveLandscapesDialog.hpp"
2041 #include "StelApp.hpp"
2042 #include "StelCore.hpp"
2043 #include "StelSkyCultureMgr.hpp"
2044@@ -50,12 +51,15 @@
2045 ViewDialog::ViewDialog()
2046 {
2047 ui = new Ui_viewDialogForm;
2048+ addRemoveLandscapesDialog = NULL;
2049 }
2050
2051 ViewDialog::~ViewDialog()
2052 {
2053 delete ui;
2054 ui=NULL;
2055+ delete addRemoveLandscapesDialog;
2056+ addRemoveLandscapesDialog = NULL;
2057 }
2058
2059 void ViewDialog::languageChanged()
2060@@ -196,6 +200,9 @@
2061 ui->useAsDefaultLandscapeCheckBox->setEnabled(lmgr->getCurrentLandscapeID()!=lmgr->getDefaultLandscapeID());
2062 connect(ui->useAsDefaultLandscapeCheckBox, SIGNAL(clicked()), this, SLOT(setCurrentLandscapeAsDefault()));
2063
2064+ connect(GETSTELMODULE(LandscapeMgr), SIGNAL(landscapesChanged()), this, SLOT(populateLists()));
2065+ connect(ui->pushButtonAddRemoveLandscapes, SIGNAL(clicked()), this, SLOT(showAddRemoveLandscapesDialog()));
2066+
2067 // Grid and lines
2068 GridLinesMgr* glmgr = GETSTELMODULE(GridLinesMgr);
2069 ui->showEquatorLineCheckBox->setChecked(glmgr->getFlagEquatorLine());
2070@@ -312,7 +319,8 @@
2071 l->addItems(lmgr->getAllLandscapeNames());
2072 l->setCurrentItem(l->findItems(lmgr->getCurrentLandscapeName(), Qt::MatchExactly).at(0));
2073 l->blockSignals(false);
2074- ui->landscapeTextBrowser->setHtml(lmgr->getCurrentLandscapeHtmlDescription());
2075+ //ui->landscapeTextBrowser->setHtml(lmgr->getCurrentLandscapeHtmlDescription()); //Is there any reason not to reuse code?
2076+ landscapeChanged(l->currentItem());
2077 }
2078
2079 void ViewDialog::populateSkyLayersList()
2080@@ -420,6 +428,14 @@
2081 ui->useAsDefaultLandscapeCheckBox->setEnabled(lmgr->getDefaultLandscapeID()!=lmgr->getCurrentLandscapeID());
2082 }
2083
2084+void ViewDialog::showAddRemoveLandscapesDialog()
2085+{
2086+ if(addRemoveLandscapesDialog == NULL)
2087+ addRemoveLandscapesDialog = new AddRemoveLandscapesDialog();
2088+
2089+ addRemoveLandscapesDialog->setVisible(true);
2090+}
2091+
2092 void ViewDialog::shootingStarsZHRChanged()
2093 {
2094 MeteorMgr* mmgr = GETSTELMODULE(MeteorMgr);
2095
2096=== modified file 'src/gui/ViewDialog.hpp'
2097--- src/gui/ViewDialog.hpp 2009-05-25 15:24:19 +0000
2098+++ src/gui/ViewDialog.hpp 2010-09-13 16:37:45 +0000
2099@@ -26,6 +26,8 @@
2100 class Ui_viewDialogForm;
2101 class QListWidgetItem;
2102
2103+class AddRemoveLandscapesDialog;
2104+
2105 class ViewDialog : public StelDialog
2106 {
2107 Q_OBJECT
2108@@ -54,6 +56,8 @@
2109 //! This function should be called repeatidly with e.g. a timer
2110 void updateFromProgram();
2111
2112+ void showAddRemoveLandscapesDialog();
2113+
2114 void populateSkyLayersList();
2115 void skyLayersSelectionChanged(const QString&);
2116 void skyLayersEnabledChanged(int);
2117@@ -61,6 +65,8 @@
2118 void changePage(QListWidgetItem *current, QListWidgetItem *previous);
2119 private:
2120 void updateSkyCultureText();
2121+
2122+ AddRemoveLandscapesDialog * addRemoveLandscapesDialog;
2123 };
2124
2125 #endif // _VIEWDIALOG_HPP_
2126
2127=== added file 'src/gui/addRemoveLandscapesDialog.ui'
2128--- src/gui/addRemoveLandscapesDialog.ui 1970-01-01 00:00:00 +0000
2129+++ src/gui/addRemoveLandscapesDialog.ui 2010-09-13 16:37:45 +0000
2130@@ -0,0 +1,378 @@
2131+<?xml version="1.0" encoding="UTF-8"?>
2132+<ui version="4.0">
2133+ <class>addRemoveLandscapesDialogForm</class>
2134+ <widget class="QWidget" name="addRemoveLandscapesDialogForm">
2135+ <property name="geometry">
2136+ <rect>
2137+ <x>0</x>
2138+ <y>0</y>
2139+ <width>450</width>
2140+ <height>400</height>
2141+ </rect>
2142+ </property>
2143+ <property name="sizePolicy">
2144+ <sizepolicy hsizetype="Minimum" vsizetype="Maximum">
2145+ <horstretch>0</horstretch>
2146+ <verstretch>0</verstretch>
2147+ </sizepolicy>
2148+ </property>
2149+ <property name="minimumSize">
2150+ <size>
2151+ <width>400</width>
2152+ <height>400</height>
2153+ </size>
2154+ </property>
2155+ <layout class="QVBoxLayout" name="verticalLayout">
2156+ <property name="spacing">
2157+ <number>0</number>
2158+ </property>
2159+ <property name="margin">
2160+ <number>0</number>
2161+ </property>
2162+ <item>
2163+ <widget class="BarFrame" name="LocationBar">
2164+ <property name="sizePolicy">
2165+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
2166+ <horstretch>0</horstretch>
2167+ <verstretch>0</verstretch>
2168+ </sizepolicy>
2169+ </property>
2170+ <property name="minimumSize">
2171+ <size>
2172+ <width>400</width>
2173+ <height>25</height>
2174+ </size>
2175+ </property>
2176+ <property name="maximumSize">
2177+ <size>
2178+ <width>16777215</width>
2179+ <height>30</height>
2180+ </size>
2181+ </property>
2182+ <property name="focusPolicy">
2183+ <enum>Qt::NoFocus</enum>
2184+ </property>
2185+ <property name="autoFillBackground">
2186+ <bool>false</bool>
2187+ </property>
2188+ <property name="frameShape">
2189+ <enum>QFrame::StyledPanel</enum>
2190+ </property>
2191+ <layout class="QHBoxLayout">
2192+ <property name="spacing">
2193+ <number>6</number>
2194+ </property>
2195+ <property name="leftMargin">
2196+ <number>0</number>
2197+ </property>
2198+ <property name="topMargin">
2199+ <number>0</number>
2200+ </property>
2201+ <property name="rightMargin">
2202+ <number>4</number>
2203+ </property>
2204+ <property name="bottomMargin">
2205+ <number>0</number>
2206+ </property>
2207+ <item>
2208+ <spacer name="titleSpacerLeft">
2209+ <property name="orientation">
2210+ <enum>Qt::Horizontal</enum>
2211+ </property>
2212+ <property name="sizeHint" stdset="0">
2213+ <size>
2214+ <width>40</width>
2215+ <height>20</height>
2216+ </size>
2217+ </property>
2218+ </spacer>
2219+ </item>
2220+ <item>
2221+ <widget class="QLabel" name="stelWindowTitle">
2222+ <property name="text">
2223+ <string>Add/Remove Landscapes</string>
2224+ </property>
2225+ </widget>
2226+ </item>
2227+ <item>
2228+ <spacer name="titleSpacerRight">
2229+ <property name="orientation">
2230+ <enum>Qt::Horizontal</enum>
2231+ </property>
2232+ <property name="sizeHint" stdset="0">
2233+ <size>
2234+ <width>40</width>
2235+ <height>20</height>
2236+ </size>
2237+ </property>
2238+ </spacer>
2239+ </item>
2240+ <item>
2241+ <widget class="QPushButton" name="closeStelWindow">
2242+ <property name="minimumSize">
2243+ <size>
2244+ <width>16</width>
2245+ <height>16</height>
2246+ </size>
2247+ </property>
2248+ <property name="maximumSize">
2249+ <size>
2250+ <width>16</width>
2251+ <height>16</height>
2252+ </size>
2253+ </property>
2254+ <property name="focusPolicy">
2255+ <enum>Qt::NoFocus</enum>
2256+ </property>
2257+ <property name="text">
2258+ <string/>
2259+ </property>
2260+ </widget>
2261+ </item>
2262+ </layout>
2263+ </widget>
2264+ </item>
2265+ <item>
2266+ <widget class="QGroupBox" name="groupBoxAdd">
2267+ <property name="sizePolicy">
2268+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
2269+ <horstretch>0</horstretch>
2270+ <verstretch>0</verstretch>
2271+ </sizepolicy>
2272+ </property>
2273+ <property name="title">
2274+ <string>Add a new landscape</string>
2275+ </property>
2276+ <layout class="QGridLayout" name="gridLayout">
2277+ <property name="margin">
2278+ <number>0</number>
2279+ </property>
2280+ <item row="0" column="0" colspan="2">
2281+ <widget class="QPushButton" name="pushButtonBrowseForArchive">
2282+ <property name="sizePolicy">
2283+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
2284+ <horstretch>0</horstretch>
2285+ <verstretch>0</verstretch>
2286+ </sizepolicy>
2287+ </property>
2288+ <property name="text">
2289+ <string>Install a new landscape from a ZIP archive...</string>
2290+ </property>
2291+ </widget>
2292+ </item>
2293+ <item row="1" column="0" colspan="2">
2294+ <widget class="QCheckBox" name="checkBoxUseLandscape">
2295+ <property name="sizePolicy">
2296+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2297+ <horstretch>0</horstretch>
2298+ <verstretch>0</verstretch>
2299+ </sizepolicy>
2300+ </property>
2301+ <property name="text">
2302+ <string>Switch to the new landscape after installation</string>
2303+ </property>
2304+ <property name="checked">
2305+ <bool>true</bool>
2306+ </property>
2307+ </widget>
2308+ </item>
2309+ </layout>
2310+ </widget>
2311+ </item>
2312+ <item>
2313+ <widget class="QGroupBox" name="groupBoxMessage">
2314+ <property name="title">
2315+ <string notr="true">Message</string>
2316+ </property>
2317+ <layout class="QGridLayout" name="gridLayout_4">
2318+ <property name="margin">
2319+ <number>0</number>
2320+ </property>
2321+ <item row="0" column="0" colspan="2">
2322+ <widget class="QLabel" name="labelMessage">
2323+ <property name="sizePolicy">
2324+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
2325+ <horstretch>0</horstretch>
2326+ <verstretch>0</verstretch>
2327+ </sizepolicy>
2328+ </property>
2329+ <property name="font">
2330+ <font>
2331+ <family>DejaVu Sans</family>
2332+ <pointsize>12</pointsize>
2333+ </font>
2334+ </property>
2335+ <property name="text">
2336+ <string/>
2337+ </property>
2338+ <property name="wordWrap">
2339+ <bool>true</bool>
2340+ </property>
2341+ <property name="textInteractionFlags">
2342+ <set>Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
2343+ </property>
2344+ </widget>
2345+ </item>
2346+ <item row="1" column="1">
2347+ <widget class="QPushButton" name="pushButtonMessageOK">
2348+ <property name="sizePolicy">
2349+ <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
2350+ <horstretch>0</horstretch>
2351+ <verstretch>0</verstretch>
2352+ </sizepolicy>
2353+ </property>
2354+ <property name="text">
2355+ <string/>
2356+ </property>
2357+ <property name="icon">
2358+ <iconset resource="../../data/gui/guiRes.qrc">
2359+ <normaloff>:/graphicGui/closeButton-hover.png</normaloff>:/graphicGui/closeButton-hover.png</iconset>
2360+ </property>
2361+ </widget>
2362+ </item>
2363+ <item row="1" column="0">
2364+ <spacer name="horizontalSpacer">
2365+ <property name="orientation">
2366+ <enum>Qt::Horizontal</enum>
2367+ </property>
2368+ <property name="sizeHint" stdset="0">
2369+ <size>
2370+ <width>40</width>
2371+ <height>20</height>
2372+ </size>
2373+ </property>
2374+ </spacer>
2375+ </item>
2376+ </layout>
2377+ </widget>
2378+ </item>
2379+ <item>
2380+ <widget class="QGroupBox" name="groupBoxRemove">
2381+ <property name="sizePolicy">
2382+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
2383+ <horstretch>0</horstretch>
2384+ <verstretch>0</verstretch>
2385+ </sizepolicy>
2386+ </property>
2387+ <property name="title">
2388+ <string>Remove an installed landscape</string>
2389+ </property>
2390+ <layout class="QHBoxLayout" name="horizontalLayout">
2391+ <property name="margin">
2392+ <number>0</number>
2393+ </property>
2394+ <item>
2395+ <widget class="QListWidget" name="listWidgetUserLandscapes">
2396+ <property name="sizePolicy">
2397+ <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
2398+ <horstretch>0</horstretch>
2399+ <verstretch>0</verstretch>
2400+ </sizepolicy>
2401+ </property>
2402+ </widget>
2403+ </item>
2404+ <item>
2405+ <widget class="QFrame" name="frameSidePane">
2406+ <property name="sizePolicy">
2407+ <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
2408+ <horstretch>0</horstretch>
2409+ <verstretch>0</verstretch>
2410+ </sizepolicy>
2411+ </property>
2412+ <layout class="QVBoxLayout" name="verticalLayoutSidePane">
2413+ <property name="margin">
2414+ <number>0</number>
2415+ </property>
2416+ <item>
2417+ <widget class="QLabel" name="labelLandscapeName">
2418+ <property name="text">
2419+ <string notr="true"/>
2420+ </property>
2421+ </widget>
2422+ </item>
2423+ <item>
2424+ <widget class="QLabel" name="labelLandscapeSize">
2425+ <property name="sizePolicy">
2426+ <sizepolicy hsizetype="Expanding" vsizetype="Minimum">
2427+ <horstretch>0</horstretch>
2428+ <verstretch>0</verstretch>
2429+ </sizepolicy>
2430+ </property>
2431+ <property name="text">
2432+ <string/>
2433+ </property>
2434+ </widget>
2435+ </item>
2436+ <item>
2437+ <widget class="QPushButton" name="pushButtonRemove">
2438+ <property name="sizePolicy">
2439+ <sizepolicy hsizetype="Expanding" vsizetype="Fixed">
2440+ <horstretch>0</horstretch>
2441+ <verstretch>0</verstretch>
2442+ </sizepolicy>
2443+ </property>
2444+ <property name="text">
2445+ <string>Remove</string>
2446+ </property>
2447+ </widget>
2448+ </item>
2449+ <item>
2450+ <widget class="QLabel" name="labelWarning">
2451+ <property name="sizePolicy">
2452+ <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
2453+ <horstretch>0</horstretch>
2454+ <verstretch>0</verstretch>
2455+ </sizepolicy>
2456+ </property>
2457+ <property name="text">
2458+ <string>WARNING: Removing the selected landscape means deleting its files. This operation is irreversible.</string>
2459+ </property>
2460+ <property name="alignment">
2461+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
2462+ </property>
2463+ <property name="wordWrap">
2464+ <bool>true</bool>
2465+ </property>
2466+ </widget>
2467+ </item>
2468+ <item>
2469+ <spacer name="verticalSpacer">
2470+ <property name="orientation">
2471+ <enum>Qt::Vertical</enum>
2472+ </property>
2473+ <property name="sizeHint" stdset="0">
2474+ <size>
2475+ <width>20</width>
2476+ <height>40</height>
2477+ </size>
2478+ </property>
2479+ </spacer>
2480+ </item>
2481+ </layout>
2482+ </widget>
2483+ </item>
2484+ </layout>
2485+ </widget>
2486+ </item>
2487+ </layout>
2488+ </widget>
2489+ <customwidgets>
2490+ <customwidget>
2491+ <class>BarFrame</class>
2492+ <extends>QFrame</extends>
2493+ <header>Dialog.hpp</header>
2494+ <container>1</container>
2495+ </customwidget>
2496+ </customwidgets>
2497+ <tabstops>
2498+ <tabstop>checkBoxUseLandscape</tabstop>
2499+ <tabstop>pushButtonBrowseForArchive</tabstop>
2500+ <tabstop>pushButtonMessageOK</tabstop>
2501+ <tabstop>listWidgetUserLandscapes</tabstop>
2502+ <tabstop>pushButtonRemove</tabstop>
2503+ </tabstops>
2504+ <resources>
2505+ <include location="../../data/gui/guiRes.qrc"/>
2506+ </resources>
2507+ <connections/>
2508+</ui>
2509
2510=== modified file 'src/gui/viewDialog.ui'
2511--- src/gui/viewDialog.ui 2010-09-08 11:05:30 +0000
2512+++ src/gui/viewDialog.ui 2010-09-13 16:37:45 +0000
2513@@ -1228,7 +1228,7 @@
2514 <property name="spacing">
2515 <number>0</number>
2516 </property>
2517- <item row="0" column="0" rowspan="2">
2518+ <item row="0" column="0" rowspan="4">
2519 <widget class="QListWidget" name="landscapesListWidget">
2520 <property name="sizePolicy">
2521 <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
2522@@ -1292,6 +1292,22 @@
2523 </property>
2524 </widget>
2525 </item>
2526+ <item row="2" column="1">
2527+ <widget class="QPushButton" name="pushButtonAddRemoveLandscapes">
2528+ <property name="minimumSize">
2529+ <size>
2530+ <width>0</width>
2531+ <height>37</height>
2532+ </size>
2533+ </property>
2534+ <property name="styleSheet">
2535+ <string notr="true">margin-left: 10px; margin-right: 10px; margin-bottom:10px;</string>
2536+ </property>
2537+ <property name="text">
2538+ <string>Add/remove landscapes...</string>
2539+ </property>
2540+ </widget>
2541+ </item>
2542 <item row="1" column="1">
2543 <widget class="QGroupBox" name="landscapeOptionsGroupBox">
2544 <property name="sizePolicy">