Merge lp:~stellarium/stellarium/simplegles-qml-noqaction into lp:stellarium

Proposed by Guillaume Chereau
Status: Merged
Approved by: Alexander Wolf
Approved revision: 6299
Merged at revision: 6238
Proposed branch: lp:~stellarium/stellarium/simplegles-qml-noqaction
Merge into: lp:stellarium
Diff against target: 6078 lines (+993/-3337)
70 files modified
data/CMakeLists.txt (+1/-1)
data/default_shortcuts.json (+0/-1057)
plugins/AngleMeasure/src/AngleMeasure.cpp (+2/-4)
plugins/AngleMeasure/src/AngleMeasure.hpp (+2/-0)
plugins/CompassMarks/src/CompassMarks.cpp (+18/-31)
plugins/CompassMarks/src/CompassMarks.hpp (+4/-1)
plugins/Exoplanets/src/Exoplanets.cpp (+5/-12)
plugins/Exoplanets/src/Exoplanets.hpp (+1/-0)
plugins/Novae/src/Novae.cpp (+2/-10)
plugins/Observability/src/Observability.cpp (+4/-10)
plugins/Observability/src/Observability.hpp (+2/-1)
plugins/Oculars/src/Oculars.cpp (+13/-46)
plugins/Oculars/src/Oculars.hpp (+11/-11)
plugins/Oculars/src/gui/OcularDialog.cpp (+13/-13)
plugins/Oculars/src/gui/OcularsGuiPanel.cpp (+7/-7)
plugins/Pulsars/src/Pulsars.cpp (+4/-12)
plugins/Pulsars/src/Pulsars.hpp (+1/-0)
plugins/Quasars/src/Quasars.cpp (+4/-12)
plugins/Quasars/src/Quasars.hpp (+2/-1)
plugins/Satellites/src/Satellites.cpp (+5/-14)
plugins/Satellites/src/Satellites.hpp (+6/-0)
plugins/Satellites/src/gui/SatellitesDialog.cpp (+3/-3)
plugins/Supernovae/src/Supernovae.cpp (+2/-9)
plugins/TelescopeControl/src/TelescopeControl.cpp (+32/-38)
src/CMakeLists.txt (+2/-4)
src/StelMainView.cpp (+12/-0)
src/StelMainView.hpp (+3/-1)
src/core/StelActionMgr.cpp (+249/-0)
src/core/StelActionMgr.hpp (+120/-0)
src/core/StelApp.cpp (+16/-4)
src/core/StelApp.hpp (+6/-4)
src/core/StelCore.cpp (+48/-0)
src/core/StelCore.hpp (+2/-0)
src/core/StelModule.cpp (+11/-0)
src/core/StelModule.hpp (+14/-0)
src/core/StelMovementMgr.cpp (+7/-0)
src/core/StelMovementMgr.hpp (+7/-1)
src/core/StelShortcutGroup.cpp (+0/-274)
src/core/StelShortcutGroup.hpp (+0/-133)
src/core/StelShortcutMgr.cpp (+0/-424)
src/core/StelShortcutMgr.hpp (+0/-131)
src/core/StelSkyLayerMgr.cpp (+3/-0)
src/core/StelSkyLayerMgr.hpp (+4/-3)
src/core/modules/ConstellationMgr.cpp (+5/-0)
src/core/modules/GridLinesMgr.cpp (+11/-0)
src/core/modules/LandscapeMgr.cpp (+6/-0)
src/core/modules/NebulaMgr.cpp (+3/-0)
src/core/modules/NebulaMgr.hpp (+3/-0)
src/core/modules/SolarSystem.cpp (+4/-0)
src/core/modules/SolarSystem.hpp (+9/-0)
src/core/modules/StarMgr.cpp (+3/-0)
src/core/modules/StarMgr.hpp (+6/-0)
src/gui/ConfigurationDialog.cpp (+2/-5)
src/gui/HelpDialog.cpp (+16/-40)
src/gui/HelpDialog.hpp (+0/-6)
src/gui/ShortcutsDialog.cpp (+33/-45)
src/gui/ShortcutsDialog.hpp (+4/-7)
src/gui/SkyGui.cpp (+2/-4)
src/gui/StelDialog.cpp (+1/-2)
src/gui/StelDialog.hpp (+1/-0)
src/gui/StelGui.cpp (+91/-564)
src/gui/StelGui.hpp (+7/-32)
src/gui/StelGuiItems.cpp (+67/-85)
src/gui/StelGuiItems.hpp (+16/-5)
src/gui/ViewDialog.cpp (+31/-100)
src/gui/ViewDialog.hpp (+2/-0)
src/noGui/StelNoGui.hpp (+0/-1)
src/scripting/StelScriptMgr.cpp (+18/-0)
src/scripting/StelScriptMgr.hpp (+4/-0)
src/translations.h (+0/-169)
To merge this branch: bzr merge lp:~stellarium/stellarium/simplegles-qml-noqaction
Reviewer Review Type Date Requested Status
Alexander Wolf Approve
Review via email: mp+187679@code.launchpad.net

Description of the change

- Replace QAction with a custom type: StelAction.
- Replace StelShortcutMgr with StelActionMgr, with all actions defined in the modules code.

This branch simplifies the way we handle the actions in Stellarium. It makes the code smaller, and we don't need to keep a data file to specify the action names and types, instead each module register its own actions. Redefined shortcuts are only saved when they differ from the default ones. This also removes the dependency of Stellarium core to QWidgets.

To post a comment you must log in.
Revision history for this message
Alexander Wolf (alexwolf) wrote :

Guillaume, please add fixes for conflicts.

6298. By Guillaume Chereau

merge from trunk

6299. By Guillaume Chereau

update novae plugin to use StelAction

Revision history for this message
Guillaume Chereau (guillaume-chereau) wrote :

On Fri, Sep 27, 2013 at 11:11 AM, Alexander Wolf <email address hidden> wrote:
> Guillaume, please add fixes for conflicts.

OK, the branch should now merge with the current trunk at rev 6237.

    gui

--
Guillaume
<email address hidden>
+886 970422910

Revision history for this message
Alexander Wolf (alexwolf) wrote :

I think this branch ready for merging. Some regress can be fixed in trunk later.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'data/CMakeLists.txt'
2--- data/CMakeLists.txt 2012-12-09 12:01:44 +0000
3+++ data/CMakeLists.txt 2013-09-27 03:38:50 +0000
4@@ -1,6 +1,6 @@
5 ########### install files ###############
6
7-INSTALL(FILES stellarium.ico ssystem.ini default_shortcuts.json base_locations.bin.gz DejaVuSans.ttf default_config.ini DejaVuSansMono.ttf iso639-1.utf8 iso3166-1-alpha-2.utf8 countryCodes.dat DESTINATION share/${PACKAGE}/data)
8+INSTALL(FILES stellarium.ico ssystem.ini base_locations.bin.gz DejaVuSans.ttf default_config.ini DejaVuSansMono.ttf iso639-1.utf8 iso3166-1-alpha-2.utf8 countryCodes.dat DESTINATION share/${PACKAGE}/data)
9
10 IF (BUILD_FOR_MAEMO)
11 INSTALL(FILES maemo/stellarium.desktop DESTINATION /usr/share/applications/hildon)
12
13=== removed file 'data/default_shortcuts.json'
14--- data/default_shortcuts.json 2013-09-23 20:24:50 +0000
15+++ data/default_shortcuts.json 1970-01-01 00:00:00 +0000
16@@ -1,1057 +0,0 @@
17-{
18- "groups":
19- {
20- "DisplayOptions":
21- {
22- "text" : "Display Options",
23- "actions":
24- {
25- "actionShow_Constellation_Lines":
26- {
27- "text": "Constellation lines",
28- "primaryKey": "C",
29- "checkable": "1",
30- "autorepeat": "0",
31- "global": "1"
32- },
33- "actionShow_Constellation_Art":
34- {
35- "text": "Constellation art",
36- "primaryKey": "R",
37- "checkable": "1",
38- "autorepeat": "0",
39- "global": "1"
40- },
41- "actionShow_Constellation_Labels":
42- {
43- "text": "Constellation labels",
44- "primaryKey": "V",
45- "checkable": "1",
46- "autorepeat": "0",
47- "global": "1"
48- },
49- "actionShow_Constellation_Boundaries":
50- {
51- "text": "Constellation boundaries",
52- "primaryKey": "B",
53- "checkable": "1",
54- "autorepeat": "0",
55- "global": "1"
56- },
57- "actionShow_Azimuthal_Grid":
58- {
59- "text": "Azimuthal grid",
60- "primaryKey": "Z",
61- "checkable": "1",
62- "autorepeat": "0",
63- "global": "1"
64- },
65- "actionShow_Equatorial_Grid":
66- {
67- "text": "Equatorial grid",
68- "primaryKey": "E",
69- "checkable": "1",
70- "autorepeat": "0",
71- "global": "1"
72- },
73- "actionShow_Equatorial_J2000_Grid":
74- {
75- "text": "Equatorial J2000 grid",
76- "primaryKey": "",
77- "checkable": "1",
78- "autorepeat": "0",
79- "global": "1"
80- },
81- "actionShow_Ecliptic_J2000_Grid":
82- {
83- "text": "Ecliptic J2000 grid",
84- "primaryKey": "",
85- "checkable": "1",
86- "autorepeat": "0",
87- "global": "1"
88- },
89- "actionShow_Galactic_Grid":
90- {
91- "text": "Galactic grid",
92- "primaryKey": "",
93- "checkable": "1",
94- "autorepeat": "0",
95- "global": "1"
96- },
97- "actionShow_Galactic_Plane_Line":
98- {
99- "text": "Galactic plane",
100- "primaryKey": "",
101- "checkable": "1",
102- "autorepeat": "0",
103- "global": "1"
104- },
105- "actionShow_Ecliptic_Line":
106- {
107- "text": "Ecliptic line",
108- "primaryKey": ",",
109- "checkable": "1",
110- "autorepeat": "0",
111- "global": "1"
112- },
113- "actionShow_Equator_Line":
114- {
115- "text": "Equator line",
116- "primaryKey": ".",
117- "checkable": "1",
118- "autorepeat": "0",
119- "global": "1"
120- },
121- "actionShow_Meridian_Line":
122- {
123- "text": "Meridian line",
124- "primaryKey": ";",
125- "checkable": "1",
126- "autorepeat": "0",
127- "global": "1"
128- },
129- "actionShow_Horizon_Line":
130- {
131- "text": "Horizon line",
132- "primaryKey": "",
133- "checkable": "1",
134- "autorepeat": "0",
135- "global": "1"
136- },
137- "actionShow_Cardinal_Points":
138- {
139- "text": "Cardinal points",
140- "primaryKey": "Q",
141- "checkable": "1",
142- "autorepeat": "0",
143- "global": "1"
144- },
145- "actionShow_Ground":
146- {
147- "text": "Ground",
148- "primaryKey": "G",
149- "checkable": "1",
150- "autorepeat": "0",
151- "global": "1"
152- },
153- "actionShow_Atmosphere":
154- {
155- "text": "Atmosphere",
156- "primaryKey": "A",
157- "checkable": "1",
158- "autorepeat": "0",
159- "global": "1"
160- },
161- "actionShow_Fog":
162- {
163- "text": "Fog",
164- "primaryKey": "F",
165- "checkable": "1",
166- "autorepeat": "0",
167- "global": "1"
168- },
169- "actionShow_Nebulas":
170- {
171- "text": "Deep-sky objects",
172- "primaryKey": "D",
173- "altKey": "N",
174- "checkable": "1",
175- "autorepeat": "0",
176- "global": "1"
177- },
178- "actionShow_DSS":
179- {
180- "text": "Deep-sky objects background images",
181- "primaryKey": "I",
182- "checkable": "1",
183- "autorepeat": "0",
184- "global": "1"
185- },
186- "actionShow_Stars":
187- {
188- "text": "Stars",
189- "primaryKey": "S",
190- "checkable": "1",
191- "autorepeat": "0",
192- "global": "1"
193- },
194- "actionShow_Stars_Labels":
195- {
196- "text": "Stars labels",
197- "primaryKey": "Alt+S",
198- "checkable": true,
199- "autorepeat": false,
200- "global": true
201- },
202- "actionShow_Planets_Labels":
203- {
204- "text": "Planet labels",
205- "primaryKey": "P",
206- "checkable": "1",
207- "autorepeat": "0",
208- "global": "1"
209- },
210- "actionShow_Planets_Orbits":
211- {
212- "text": "Planet orbits",
213- "primaryKey": "O",
214- "checkable": "1",
215- "autorepeat": "0",
216- "global": "1"
217- },
218- "actionShow_Planets_Trails":
219- {
220- "text": "Planet trails",
221- "primaryKey": "Shift+T",
222- "checkable": "1",
223- "autorepeat": "0",
224- "global": "1"
225- },
226- "actionShow_Night_Mode":
227- {
228- "text": "Night mode",
229- "primaryKey": "",
230- "checkable": "1",
231- "autorepeat": "0",
232- "global": "1"
233- },
234- "actionSet_Full_Screen_Global":
235- {
236- "text": "Full-screen mode",
237- "primaryKey": "F11",
238- "checkable": "1",
239- "autorepeat": "0",
240- "global": "1"
241- },
242- "actionHorizontal_Flip":
243- {
244- "text": "Flip scene horizontally",
245- "primaryKey": "Ctrl+Shift+H",
246- "checkable": "1",
247- "autorepeat": "0",
248- "global": "1"
249- },
250- "actionVertical_Flip":
251- {
252- "text": "Flip scene vertically",
253- "primaryKey": "Ctrl+Shift+V",
254- "checkable": "1",
255- "autorepeat": "0",
256- "global": "1"
257- }
258- }
259- },
260- "Windows":
261- {
262- "text" : "Windows",
263- "actions":
264- {
265- "actionShow_Help_Window_Global":
266- {
267- "text": "Help window",
268- "primaryKey": "F1",
269- "checkable": "1",
270- "autorepeat": "0",
271- "global": "1"
272- },
273- "actionShow_Shortcuts_Window_Global":
274- {
275- "text": "Shortcuts window",
276- "primaryKey": "F7",
277- "checkable": "1",
278- "autorepeat": "0",
279- "global": "1"
280- },
281- "actionShow_Configuration_Window_Global":
282- {
283- "text": "Configuration window",
284- "primaryKey": "F2",
285- "checkable": "1",
286- "autorepeat": "0",
287- "global": "1"
288- },
289- "actionShow_Search_Window_Global":
290- {
291- "text": "Search window",
292- "primaryKey": "F3",
293- "altKey": "Ctrl+F",
294- "checkable": "1",
295- "autorepeat": "0",
296- "global": "1"
297- },
298- "actionShow_SkyView_Window_Global":
299- {
300- "text": "Sky and viewing options window",
301- "primaryKey": "F4",
302- "checkable": "1",
303- "autorepeat": "0",
304- "global": "1"
305- },
306- "actionShow_DateTime_Window_Global":
307- {
308- "text": "Date/time window",
309- "primaryKey": "F5",
310- "checkable": "1",
311- "autorepeat": "0",
312- "global": "1"
313- },
314- "actionShow_Location_Window_Global":
315- {
316- "text": "Location window",
317- "primaryKey": "F6",
318- "checkable": "1",
319- "autorepeat": "0",
320- "global": "1"
321- }
322- }
323- },
324- "DateAndTime":
325- {
326- "text" : "Date and Time",
327- "actions":
328- {
329- "actionDecrease_Script_Speed":
330- {
331- "text": "Slow down the script execution rate",
332- "primaryKey": "",
333- "checkable": "0",
334- "autorepeat": "0",
335- "global": "0"
336- },
337- "actionIncrease_Script_Speed":
338- {
339- "text": "Speed up the script execution rate",
340- "primaryKey": "",
341- "checkable": "0",
342- "autorepeat": "0",
343- "global": "0"
344- },
345- "actionSet_Real_Script_Speed":
346- {
347- "text": "Set the normal script execution rate",
348- "primaryKey": "",
349- "checkable": "0",
350- "autorepeat": "0",
351- "global": "0"
352- },
353- "actionStop_Script":
354- {
355- "text": "Stop script execution",
356- "primaryKey": "Ctrl+D, S",
357- "checkable": "0",
358- "autorepeat": "0",
359- "global": "0"
360- },
361- "actionPause_Script":
362- {
363- "text": "Pause script execution",
364- "primaryKey": "Ctrl+D, P",
365- "checkable": "0",
366- "autorepeat": "0",
367- "global": "0"
368- },
369- "actionResume_Script":
370- {
371- "text": "Resume script execution",
372- "primaryKey": "Ctrl+D, R",
373- "checkable": "0",
374- "autorepeat": "0",
375- "global": "0"
376- },
377- "actionDecrease_Time_Speed":
378- {
379- "text": "Decrease time speed",
380- "primaryKey": "J",
381- "checkable": "0",
382- "autorepeat": "0",
383- "global": "0"
384- },
385- "actionIncrease_Time_Speed":
386- {
387- "text": "Increase time speed",
388- "primaryKey": "L",
389- "checkable": "0",
390- "autorepeat": "0",
391- "global": "0"
392- },
393- "actionSet_Real_Time_Speed":
394- {
395- "text": "Set normal time rate",
396- "primaryKey": "K",
397- "checkable": "0",
398- "autorepeat": "0",
399- "global": "0"
400- },
401- "actionDecrease_Time_Speed_Less":
402- {
403- "text": "Decrease time speed (a little)",
404- "primaryKey": "Shift+J",
405- "checkable": "0",
406- "autorepeat": "0",
407- "global": "0"
408- },
409- "actionIncrease_Time_Speed_Less":
410- {
411- "text": "Increase time speed (a little)",
412- "primaryKey": "Shift+L",
413- "checkable": "0",
414- "autorepeat": "0",
415- "global": "0"
416- },
417- "actionSet_Time_Rate_Zero":
418- {
419- "text": "Set time rate to zero",
420- "primaryKey": "7",
421- "checkable": "0",
422- "autorepeat": "0",
423- "global": "0"
424- },
425- "actionReturn_To_Current_Time":
426- {
427- "text": "Set time to now",
428- "primaryKey": "8",
429- "checkable": "0",
430- "autorepeat": "0",
431- "global": "0"
432- },
433- "actionAdd_Solar_Hour":
434- {
435- "text": "Add 1 solar hour",
436- "primaryKey": "Ctrl+=",
437- "checkable": "0",
438- "autorepeat": "1",
439- "global": "0"
440- },
441- "actionSubtract_Solar_Hour":
442- {
443- "text": "Subtract 1 solar hour",
444- "primaryKey": "Ctrl+-",
445- "checkable": "0",
446- "autorepeat": "1",
447- "global": "0"
448- },
449- "actionAdd_Solar_Day":
450- {
451- "text": "Add 1 solar day",
452- "primaryKey": "=",
453- "checkable": "0",
454- "autorepeat": "1",
455- "global": "0"
456- },
457- "actionSubtract_Solar_Day":
458- {
459- "text": "Subtract 1 solar day",
460- "primaryKey": "-",
461- "checkable": "0",
462- "autorepeat": "1",
463- "global": "0"
464- },
465- "actionAdd_Solar_Week":
466- {
467- "text": "Add 1 solar week",
468- "primaryKey": "]",
469- "checkable": "0",
470- "autorepeat": "1",
471- "global": "0"
472- },
473- "actionSubtract_Solar_Week":
474- {
475- "text": "Subtract 1 solar week",
476- "primaryKey": "[",
477- "checkable": "0",
478- "autorepeat": "1",
479- "global": "0"
480- },
481- "actionAdd_Sidereal_Day":
482- {
483- "text": "Add 1 sidereal day",
484- "primaryKey": "Alt+=",
485- "checkable": "0",
486- "autorepeat": "1",
487- "global": "0"
488- },
489- "actionSubtract_Sidereal_Day":
490- {
491- "text": "Subtract 1 sidereal day",
492- "primaryKey": "Alt+-",
493- "checkable": "0",
494- "autorepeat": "1",
495- "global": "0"
496- },
497- "actionAdd_Sidereal_Week":
498- {
499- "text": "Add 1 sidereal week",
500- "primaryKey": "Alt+]",
501- "checkable": "0",
502- "autorepeat": "1",
503- "global": "0"
504- },
505- "actionSubtract_Sidereal_Week":
506- {
507- "text": "Subtract 1 sidereal week",
508- "primaryKey": "Alt+[",
509- "checkable": "0",
510- "autorepeat": "1",
511- "global": "0"
512- },
513- "actionAdd_Sidereal_Month":
514- {
515- "text": "Add 1 sidereal month",
516- "primaryKey": "Alt+Shift+]",
517- "checkable": false,
518- "autorepeat": true
519- },
520- "actionSubtract_Sidereal_Month":
521- {
522- "text": "Subtract 1 sidereal month",
523- "primaryKey": "Alt+Shift+[",
524- "checkable": false,
525- "autorepeat": true
526- },
527- "actionSubtract_Sidereal_Month":
528- {
529- "text": "Subtract 1 sidereal month",
530- "primaryKey": "Alt+Shift+[",
531- "checkable": false,
532- "autorepeat": true
533- },
534- "actionAdd_Sidereal_Year":
535- {
536- "text": "Add 1 sidereal year",
537- "primaryKey": "Ctrl+Alt+Shift+]",
538- "checkable": false,
539- "autorepeat": true
540- },
541- "actionSubtract_Sidereal_Year":
542- {
543- "text": "Subtract 1 sidereal year",
544- "primaryKey": "Ctrl+Alt+Shift+[",
545- "checkable": false,
546- "autorepeat": true
547- },
548- "actionAdd_Sidereal_Century":
549- {
550- "text": "Add 1 sidereal century",
551- "primaryKey": "",
552- "checkable": false,
553- "autorepeat": true
554- },
555- "actionSubtract_Sidereal_Century":
556- {
557- "text": "Subtract 1 sidereal century",
558- "primaryKey": "",
559- "checkable": false,
560- "autorepeat": true
561- },
562- "actionAdd_Synodic_Month":
563- {
564- "text": "Add 1 synodic month",
565- "primaryKey": "",
566- "checkable": false,
567- "autorepeat": true
568- },
569- "actionSubtract_Synodic_Month":
570- {
571- "text": "Subtract 1 synodic month",
572- "primaryKey": "",
573- "checkable": false,
574- "autorepeat": true
575- },
576- "actionAdd_Draconic_Month":
577- {
578- "text": "Add 1 draconic month",
579- "primaryKey": "",
580- "checkable": false,
581- "autorepeat": true
582- },
583- "actionSubtract_Draconic_Month":
584- {
585- "text": "Subtract 1 draconic month",
586- "primaryKey": "",
587- "checkable": false,
588- "autorepeat": true
589- },
590- "actionAdd_Tropical_Month":
591- {
592- "text": "Add 1 mean tropical month",
593- "primaryKey": "",
594- "checkable": false,
595- "autorepeat": true
596- },
597- "actionSubtract_Tropical_Month":
598- {
599- "text": "Subtract 1 mean tropical month",
600- "primaryKey": "",
601- "checkable": false,
602- "autorepeat": true
603- },
604- "actionAdd_Anomalistic_Month":
605- {
606- "text": "Add 1 anomalistic month",
607- "primaryKey": "",
608- "checkable": false,
609- "autorepeat": true
610- },
611- "actionSubtract_Anomalistic_Month":
612- {
613- "text": "Subtract 1 anomalistic month",
614- "primaryKey": "",
615- "checkable": false,
616- "autorepeat": true
617- },
618- "actionAdd_Draconic_Year":
619- {
620- "text": "Add 1 draconic year",
621- "primaryKey": "",
622- "checkable": false,
623- "autorepeat": true
624- },
625- "actionSubtract_Draconic_Year":
626- {
627- "text": "Subtract 1 draconic year",
628- "primaryKey": "",
629- "checkable": false,
630- "autorepeat": true
631- },
632- "actionAdd_Tropical_Year":
633- {
634- "text": "Add 1 mean tropical year",
635- "primaryKey": "",
636- "checkable": false,
637- "autorepeat": true
638- },
639- "actionSubtract_Tropical_Year":
640- {
641- "text": "Subtract 1 mean tropical year",
642- "primaryKey": "",
643- "checkable": false,
644- "autorepeat": true
645- },
646- "actionAdd_Tropical_Century":
647- {
648- "text": "Add 1 mean tropical century",
649- "primaryKey": "",
650- "checkable": false,
651- "autorepeat": true
652- },
653- "actionSubtract_Tropical_Century":
654- {
655- "text": "Subtract 1 mean tropical century",
656- "primaryKey": "",
657- "checkable": false,
658- "autorepeat": true
659- }
660- }
661- },
662- "MovementAndSelection":
663- {
664- "text" : "Movement and Selection",
665- "actions":
666- {
667- "actionGoto_Selected_Object":
668- {
669- "text": "Center on selected object",
670- "primaryKey": "Space",
671- "checkable": "0",
672- "autorepeat": "0",
673- "global": "0"
674- },
675- "actionSet_Tracking":
676- {
677- "text": "Track object",
678- "primaryKey": "T",
679- "checkable": "1",
680- "autorepeat": "0",
681- "global": "0"
682- },
683- "actionZoom_In_Auto":
684- {
685- "text": "Zoom in on selected object",
686- "primaryKey": "/",
687- "checkable": "0",
688- "autorepeat": "0",
689- "global": "0"
690- },
691- "actionZoom_Out_Auto":
692- {
693- "text": "Zoom out",
694- "primaryKey": "\\",
695- "checkable": "0",
696- "autorepeat": "0",
697- "global": "0"
698- },
699- "actionSet_Home_Planet_To_Selected":
700- {
701- "text": "Set home planet to selected planet",
702- "primaryKey": "Ctrl+G",
703- "checkable": "0",
704- "autorepeat": "0",
705- "global": "0"
706- }
707- }
708- },
709- "Miscellaneous":
710- {
711- "text": "Miscellaneous",
712- "actions":
713- {
714- "actionSwitch_Equatorial_Mount":
715- {
716- "text": "Switch between equatorial and azimuthal mount",
717- "primaryKey": "Ctrl+M",
718- "checkable": "1",
719- "autorepeat": "0",
720- "global": "0"
721- },
722- "actionQuit_Global":
723- {
724- "text": "Quit",
725- "primaryKey": "Ctrl+Q",
726- "checkable": "0",
727- "autorepeat": "0",
728- "global": "1"
729- },
730- "actionSave_Screenshot_Global":
731- {
732- "text": "Save screenshot",
733- "primaryKey": "Ctrl+S",
734- "checkable": "0",
735- "autorepeat": "0",
736- "global": "1"
737- },
738- "actionSave_Copy_Object_Information_Global":
739- {
740- "text": "Copy selected object information to clipboard",
741- "primaryKey": "Ctrl+C",
742- "checkable": "0",
743- "autorepeat": "0",
744- "global": "1"
745- },
746- "actionAutoHideHorizontalButtonBar":
747- {
748- "text": "Auto hide horizontal button bar",
749- "primaryKey": "",
750- "checkable": "1",
751- "autorepeat": "0",
752- "global": "0"
753- },
754- "actionAutoHideVerticalButtonBar":
755- {
756- "text": "Auto hide vertical button bar",
757- "primaryKey": "",
758- "checkable": "1",
759- "autorepeat": "0",
760- "global": "0"
761- },
762- "actionToggle_GuiHidden_Global":
763- {
764- "text": "Toggle visibility of GUI",
765- "primaryKey": "Ctrl+T",
766- "checkable": "1",
767- "autorepeat": "0",
768- "global": "1"
769- },
770- "actionGo_Home_Global":
771- {
772- "text": "Go to home",
773- "primaryKey": "Ctrl+H",
774- "checkable": false,
775- "autorepeat": false,
776- "global": true
777- }
778- }
779- },
780- "Scripts":
781- {
782- "text" : "Scripts",
783- "actions":
784- {
785- "scriptShowMoon":
786- {
787- "text" : "Show and zoom Moon",
788- "primaryKey" : "Ctrl+U, 1",
789- "script" : "core.wait(1);
790- core.clear(\"natural\");
791- LandscapeMgr.setFlagLandscape(false);
792- LandscapeMgr.setFlagAtmosphere(false);
793- LandscapeMgr.setFlagFog(false);
794- core.wait(1);
795- core.setDate(\"2004:05:04T17:51:00\");
796- core.selectObjectByName(\"Moon\", false);
797- StelMovementMgr.setFlagTracking(true);
798- core.wait(2);
799- StelMovementMgr.autoZoomIn(2);
800- core.wait(2);
801- core.setTimeRate(250);",
802- "checkable" : "0",
803- "autorepeat" : "0",
804- "global" : "0"
805- },
806- "scriptLandscapes":
807- {
808- "text" : "Run landscapes script from file",
809- "primaryKey" : "Ctrl+U, 2",
810- "scriptFile" : "scripts/landscapes.ssc",
811- "checkable" : "0",
812- "autorepeat" : "0",
813- "global" : "0"
814- }
815- }
816- },
817- "PluginAngleMeasure":
818- {
819- "pluginId" : "AngleMeasure",
820- "actions" :
821- {
822- "actionShow_Angle_Measure":
823- {
824- "text" : "Angle measure",
825- "primaryKey" : "Ctrl+A",
826- "checkable" : "1",
827- "autorepeat" : "0"
828- }
829- }
830- },
831- "PluginExoplanets":
832- {
833- "pluginId" : "Exoplanets",
834- "actions" :
835- {
836- "actionShow_Exoplanets_ConfigDialog":
837- {
838- "text" : "Exoplanets configuration window",
839- "primaryKey" : "",
840- "checkable" : "1",
841- "autorepeat" : "0",
842- "global" : "0"
843- },
844- "actionShow_Exoplanets":
845- {
846- "text" : "Show exoplanets",
847- "primaryKey" : "Ctrl+Alt+E",
848- "checkable" : "1",
849- "autorepeat" : "0",
850- "global" : "0"
851- }
852- }
853- },
854- "PluginPulsars":
855- {
856- "pluginId" : "Pulsars",
857- "actions":
858- {
859- "actionShow_Pulsars_ConfigDialog":
860- {
861- "text" : "Pulsars configuration window",
862- "primaryKey" : "",
863- "checkable" : "1",
864- "autorepeat" : "0",
865- "global" : "0"
866- },
867- "actionShow_Pulsars":
868- {
869- "text" : "Show pulsars",
870- "primaryKey" : "Ctrl+Alt+P",
871- "checkable" : "1",
872- "autorepeat" : "0",
873- "global" : "0"
874- }
875- }
876- },
877- "PluginSupernovae" :
878- {
879- "pluginId" : "Supernovae",
880- "actions" :
881- {
882- "actionShow_Supernovae_ConfigDialog":
883- {
884- "text" : "Historical Supernovae configuration window",
885- "primaryKey" : "",
886- "checkable": "1"
887- }
888- }
889- },
890- "PluginNovae" :
891- {
892- "pluginId" : "Novae",
893- "actions" :
894- {
895- "actionShow_Novae_ConfigDialog":
896- {
897- "text" : "Bright Novae configuration window",
898- "primaryKey" : "",
899- "checkable": "1"
900- }
901- }
902- },
903- "PluginQuasars" :
904- {
905- "pluginId" : "Quasars",
906- "actions":
907- {
908- "actionShow_Quasars_ConfigDialog":
909- {
910- "text" : "Quasars configuration window",
911- "primaryKey" : "",
912- "checkable" : "1",
913- "autorepeat" : "0",
914- "global" : "0"
915- },
916- "actionShow_Quasars":
917- {
918- "text" : "Show quasars",
919- "primaryKey" : "Ctrl+Alt+Q",
920- "checkable" : "1",
921- "autorepeat" : "0",
922- "global" : "0"
923- }
924- }
925- },
926- "PluginCompassMarks":
927- {
928- "pluginId" : "CompassMarks",
929- "actions" :
930- {
931- "actionShow_Compass_Marks":
932- {
933- "text" : "Compass marks",
934- "primaryKey" : "",
935- "checkable" : "1",
936- "autorepeat" : "0"
937- }
938- }
939- },
940- "PluginOculars":
941- {
942- "pluginId" : "Oculars",
943- "actions" :
944- {
945- "actionShow_Ocular":
946- {
947- "text" : "Ocular view",
948- "primaryKey" : "Ctrl+O",
949- "checkable" : "1"
950- },
951- "actionShow_Ocular_Menu":
952- {
953- "text": "Oculars popup menu",
954- "primaryKey" : "Alt+O",
955- "checkable" : "1"
956- },
957- "actionShow_Ocular_Crosshairs":
958- {
959- "text": "Show crosshairs",
960- "primaryKey": "Alt+C",
961- "checkable": true
962- },
963- "actionShow_Sensor":
964- {
965- "text": "Image sensor frame",
966- "primaryKey": "",
967- "checkable": true
968- },
969- "actionShow_Telrad":
970- {
971- "text": "Telrad sight",
972- "primaryKey": "Ctrl+B",
973- "checkable": true
974- },
975- "actionShow_Telescope_Increment":
976- {
977- "text": "Select next telescope",
978- "primaryKey": "Shift+PgUp",
979- "checkable": true
980- },
981- "actionShow_Telescope_Decrement":
982- {
983- "text": "Select previous telescope",
984- "primaryKey": "Shift+PgDown",
985- "checkable": true
986- },
987- "actionShow_Ocular_Increment":
988- {
989- "text": "Select next eyepiece",
990- "primaryKey": "Ctrl+PgUp",
991- "checkable": true
992- },
993- "actionShow_Ocular_Decrement":
994- {
995- "text": "Select previous eyepiece",
996- "primaryKey": "Ctrl+PgDown",
997- "checkable": true
998- },
999- "actionOpen_Oculars_Configuration":
1000- {
1001- "text": "Oculars plugin configuration",
1002- "primaryKey": "",
1003- "checkable": true
1004- }
1005- }
1006- },
1007- "PluginObservability":
1008- {
1009- "pluginId": "Observability",
1010- "actions":
1011- {
1012- "actionShow_Observability":
1013- {
1014- "text": "Observability",
1015- "primaryKey": "",
1016- "checkable": true,
1017- "autorepeat": false
1018- },
1019- "actionShow_Observability_ConfigDialog":
1020- {
1021- "text": "Observability configuration window",
1022- "primaryKey": "",
1023- "checkable": true
1024- }
1025- }
1026- },
1027- "PluginSatellites":
1028- {
1029- "pluginId" : "Satellites",
1030- "actions" :
1031- {
1032- "actionShow_Satellite_ConfigDialog_Global":
1033- {
1034- "text" : "Satellites configuration window",
1035- "primaryKey" : "Alt+Z",
1036- "checkable" : "1",
1037- "autorepeat" : "0",
1038- "global" : "1"
1039- },
1040- "actionShow_Satellite_Hints":
1041- {
1042- "text" : "Satellite hints",
1043- "primaryKey" : "Ctrl+Z",
1044- "checkable" : "1",
1045- "autorepeat" : "0",
1046- "global" : "0"
1047- },
1048- "actionShow_Satellite_Labels":
1049- {
1050- "text" : "Satellite labels",
1051- "primaryKey" : "Shift+Z",
1052- "checkable" : "1",
1053- "autorepeat" : "0",
1054- "global" : "0"
1055- }
1056- }
1057- },
1058- "PluginTelescopeControl":
1059- {
1060- "pluginId" : "TelescopeControl",
1061- "actions" :
1062- {
1063- "actionShow_Slew_Window":
1064- {
1065- "text": "Move a telescope to a given set of coordinates",
1066- "primaryKey": "Ctrl+0",
1067- "checkable": true,
1068- "autorepeat": false
1069- }
1070- }
1071- }
1072- }
1073-}
1074
1075=== modified file 'plugins/AngleMeasure/src/AngleMeasure.cpp'
1076--- plugins/AngleMeasure/src/AngleMeasure.cpp 2013-09-23 20:24:50 +0000
1077+++ plugins/AngleMeasure/src/AngleMeasure.cpp 2013-09-27 03:38:50 +0000
1078@@ -117,9 +117,7 @@
1079 // Create action for enable/disable & hook up signals
1080 StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
1081 Q_ASSERT(gui);
1082- QAction* action = gui->getGuiAction("actionShow_Angle_Measure");
1083- action->setChecked(flagShowAngleMeasure);
1084- connect(action, SIGNAL(toggled(bool)), this, SLOT(enableAngleMeasure(bool)));
1085+ addAction("actionShow_Angle_Measure", N_("Angle Measure"), N_("Angle measure"), "enabled", "Ctrl+A");
1086
1087 // Initialize the message strings and make sure they are translated when
1088 // the language changes.
1089@@ -130,7 +128,7 @@
1090 try
1091 {
1092 toolbarButton = new StelButton(NULL, QPixmap(":/angleMeasure/bt_anglemeasure_on.png"), QPixmap(":/angleMeasure/bt_anglemeasure_off.png"),
1093- QPixmap(":/graphicGui/glow32x32.png"), gui->getGuiAction("actionShow_Angle_Measure"));
1094+ QPixmap(":/graphicGui/glow32x32.png"), "actionShow_Angle_Measure");
1095 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1096 }
1097 catch (std::runtime_error& e)
1098
1099=== modified file 'plugins/AngleMeasure/src/AngleMeasure.hpp'
1100--- plugins/AngleMeasure/src/AngleMeasure.hpp 2013-08-26 21:12:42 +0000
1101+++ plugins/AngleMeasure/src/AngleMeasure.hpp 2013-09-27 03:38:50 +0000
1102@@ -32,6 +32,7 @@
1103 class AngleMeasure : public StelModule
1104 {
1105 Q_OBJECT
1106+ Q_PROPERTY(bool enabled READ isEnabled WRITE enableAngleMeasure)
1107 public:
1108 AngleMeasure();
1109 virtual ~AngleMeasure();
1110@@ -45,6 +46,7 @@
1111 virtual void handleKeys(class QKeyEvent* event);
1112 virtual void handleMouseClicks(class QMouseEvent* event);
1113 virtual bool handleMouseMoves(int x, int y, Qt::MouseButtons b);
1114+ bool isEnabled() const {return flagShowAngleMeasure;}
1115
1116 public slots:
1117 void enableAngleMeasure(bool b);
1118
1119=== modified file 'plugins/CompassMarks/src/CompassMarks.cpp'
1120--- plugins/CompassMarks/src/CompassMarks.cpp 2013-09-12 07:11:14 +0000
1121+++ plugins/CompassMarks/src/CompassMarks.cpp 2013-09-27 03:38:50 +0000
1122@@ -120,18 +120,14 @@
1123 pxmapOnIcon = new QPixmap(":/compassMarks/bt_compass_on.png");
1124 pxmapOffIcon = new QPixmap(":/compassMarks/bt_compass_off.png");
1125
1126- QAction *showCompassAction = gui->getGuiAction("actionShow_Compass_Marks");
1127- //showCompassAction->setChecked(markFader);
1128- toolbarButton = new StelButton(NULL, *pxmapOnIcon, *pxmapOffIcon, *pxmapGlow, showCompassAction);
1129+ addAction("actionShow_Compass_Marks", "CompassMarks", N_("Compass marks"), "marksVisible");
1130+ toolbarButton = new StelButton(NULL, *pxmapOnIcon, *pxmapOffIcon, *pxmapGlow, "actionShow_Compass_Marks");
1131 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1132- connect(showCompassAction, SIGNAL(toggled(bool)), this, SLOT(setCompassMarks(bool)));
1133- connect(gui->getGuiAction("actionShow_Cardinal_Points"), SIGNAL(toggled(bool)), this, SLOT(cardinalPointsChanged(bool)));
1134+ connect(GETSTELMODULE(LandscapeMgr), SIGNAL(cardinalsPointsDisplayedChanged(bool)), this, SLOT(cardinalPointsChanged(bool)));
1135 cardinalPointsState = false;
1136
1137 QSettings* conf = StelApp::getInstance().getSettings();
1138 setCompassMarks(conf->value("CompassMarks/enable_at_startup", false).toBool());
1139- // GZ: This must go here, else button may show wrong state
1140- gui->getGuiAction("actionShow_Compass_Marks")->setChecked(markFader);
1141 }
1142 catch (std::runtime_error& e)
1143 {
1144@@ -200,34 +196,25 @@
1145
1146 void CompassMarks::setCompassMarks(bool b)
1147 {
1148+ if (b == markFader)
1149+ return;
1150+ if (b)
1151+ {
1152+ // Save the display state of the cardinal points and hide them.
1153+ cardinalPointsState = GETSTELMODULE(LandscapeMgr)->getFlagCardinalsPoints();
1154+ GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(false);
1155+ } else {
1156+ // Restore the cardinal points state.
1157+ GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(cardinalPointsState);
1158+ }
1159 markFader = b;
1160- if (markFader)
1161- {
1162- // Save the display state of the cardinal points
1163- cardinalPointsState = GETSTELMODULE(LandscapeMgr)->getFlagCardinalsPoints();
1164- }
1165- else
1166- {
1167- }
1168-
1169- if(cardinalPointsState)
1170- {
1171- // Using QActions instead of directly calling
1172- // setFlagCardinalsPoints() in order to sync with the buttons
1173- dynamic_cast<StelGui*>(StelApp::getInstance().getGui())->getGuiAction("actionShow_Cardinal_Points")->trigger();
1174- }
1175+ emit compassMarksChanged(b);
1176 }
1177
1178 void CompassMarks::cardinalPointsChanged(bool b)
1179 {
1180- if(b)
1181- {
1182- // If the compass marks are displayed when cardinal points
1183- // are about to be shown, hide the compass marks
1184- if(markFader)
1185- {
1186- cardinalPointsState = false; // actionShow_Cardinal_Points should not be triggered again
1187- dynamic_cast<StelGui*>(StelApp::getInstance().getGui())->getGuiAction("actionShow_Compass_Marks")->trigger();
1188- }
1189+ if (b && getCompassMarks()) {
1190+ cardinalPointsState = true;
1191+ setCompassMarks(false);
1192 }
1193 }
1194
1195=== modified file 'plugins/CompassMarks/src/CompassMarks.hpp'
1196--- plugins/CompassMarks/src/CompassMarks.hpp 2013-08-26 21:12:42 +0000
1197+++ plugins/CompassMarks/src/CompassMarks.hpp 2013-09-27 03:38:50 +0000
1198@@ -31,6 +31,7 @@
1199 class CompassMarks : public StelModule
1200 {
1201 Q_OBJECT
1202+ Q_PROPERTY(bool marksVisible READ getCompassMarks WRITE setCompassMarks NOTIFY compassMarksChanged)
1203 public:
1204 CompassMarks();
1205 virtual ~CompassMarks();
1206@@ -42,9 +43,11 @@
1207 virtual void draw(StelCore* core);
1208 virtual double getCallOrder(StelModuleActionName actionName) const;
1209
1210+ bool getCompassMarks() const {return markFader;}
1211 public slots:
1212 void setCompassMarks(bool b);
1213-
1214+signals:
1215+ void compassMarksChanged(bool);
1216 private slots:
1217 void cardinalPointsChanged(bool b);
1218
1219
1220=== modified file 'plugins/Exoplanets/src/Exoplanets.cpp'
1221--- plugins/Exoplanets/src/Exoplanets.cpp 2013-09-23 20:24:50 +0000
1222+++ plugins/Exoplanets/src/Exoplanets.cpp 2013-09-27 03:38:50 +0000
1223@@ -34,6 +34,7 @@
1224 #include "Exoplanets.hpp"
1225 #include "Exoplanet.hpp"
1226 #include "ExoplanetsDialog.hpp"
1227+#include "StelActionMgr.hpp"
1228 #include "StelProgressController.hpp"
1229
1230 #include <QNetworkAccessManager>
1231@@ -158,7 +159,8 @@
1232 Exoplanet::markerTexture = StelApp::getInstance().getTextureManager().createTexture(":/Exoplanets/exoplanet.png");
1233
1234 // key bindings and other actions
1235- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1236+ addAction("actionShow_Exoplanets", N_("Exoplanets"), N_("Show exoplanets"), "showExoplanets", "Ctrl+Alt+E");
1237+ addAction("actionShow_Exoplanets_ConfigDialog", N_("Exoplanets"), N_("Exoplanets configuration window"), exoplanetsConfigDialog, "visible");
1238
1239 GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png");
1240 OnIcon = new QPixmap(":/Exoplanets/btExoplanets-on.png");
1241@@ -166,10 +168,6 @@
1242
1243 setFlagShowExoplanets(getEnableAtStartup());
1244 setFlagShowExoplanetsButton(flagShowExoplanetsButton);
1245-
1246- connect(gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SIGNAL(toggled(bool)), exoplanetsConfigDialog, SLOT(setVisible(bool)));
1247- connect(exoplanetsConfigDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Exoplanets_ConfigDialog"), SLOT(setChecked(bool)));
1248- connect(gui->getGuiAction("actionShow_Exoplanets"), SIGNAL(toggled(bool)), this, SLOT(setFlagShowExoplanets(bool)));
1249 }
1250 catch (std::runtime_error &e)
1251 {
1252@@ -587,11 +585,7 @@
1253 bool Exoplanets::configureGui(bool show)
1254 {
1255 if (show)
1256- {
1257- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1258- gui->getGuiAction("actionShow_Exoplanets_ConfigDialog")->setChecked(true);
1259- }
1260-
1261+ exoplanetsConfigDialog->setVisible(true);
1262 return true;
1263 }
1264
1265@@ -767,8 +761,7 @@
1266 if (b==true) {
1267 if (toolbarButton==NULL) {
1268 // Create the exoplanets button
1269- gui->getGuiAction("actionShow_Exoplanets")->setChecked(flagShowExoplanets);
1270- toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, gui->getGuiAction("actionShow_Exoplanets"));
1271+ toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, "actionShow_Exoplanets");
1272 }
1273 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1274 } else {
1275
1276=== modified file 'plugins/Exoplanets/src/Exoplanets.hpp'
1277--- plugins/Exoplanets/src/Exoplanets.hpp 2013-09-23 20:24:50 +0000
1278+++ plugins/Exoplanets/src/Exoplanets.hpp 2013-09-27 03:38:50 +0000
1279@@ -46,6 +46,7 @@
1280 class Exoplanets : public StelObjectModule
1281 {
1282 Q_OBJECT
1283+ Q_PROPERTY(bool showExoplanets READ getFlagShowExoplanets WRITE setFlagShowExoplanets)
1284 public:
1285 //! @enum UpdateState
1286 //! Used for keeping for track of the download/update status
1287
1288=== modified file 'plugins/Novae/src/Novae.cpp'
1289--- plugins/Novae/src/Novae.cpp 2013-09-25 17:59:56 +0000
1290+++ plugins/Novae/src/Novae.cpp 2013-09-27 03:38:50 +0000
1291@@ -133,11 +133,7 @@
1292 return;
1293
1294 texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png");
1295- // key bindings and other actions
1296- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1297-
1298- connect(gui->getGuiAction("actionShow_Novae_ConfigDialog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
1299- connect(configDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Novae_ConfigDialog"), SLOT(setChecked(bool)));
1300+ addAction("actionShow_Novae_ConfigDialog", N_("Novae"), N_("Bright Novae configuration window"), configDialog, "visible");
1301 }
1302 catch (std::runtime_error &e)
1303 {
1304@@ -557,11 +553,7 @@
1305 bool Novae::configureGui(bool show)
1306 {
1307 if (show)
1308- {
1309- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1310- gui->getGuiAction("actionShow_Novae_ConfigDialog")->setChecked(true);
1311- }
1312-
1313+ configDialog->setVisible(true);
1314 return true;
1315 }
1316
1317
1318=== modified file 'plugins/Observability/src/Observability.cpp'
1319--- plugins/Observability/src/Observability.cpp 2013-08-30 22:42:40 +0000
1320+++ plugins/Observability/src/Observability.cpp 2013-09-27 03:38:50 +0000
1321@@ -261,12 +261,10 @@
1322 OnIcon = new QPixmap(":/observability/bt_observab_on.png");
1323 OffIcon = new QPixmap(":/observability/bt_observab_off.png");
1324
1325- gui->getGuiAction("actionShow_Observability")->setChecked(flagShowObservability);
1326- toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, gui->getGuiAction("actionShow_Observability"));
1327+ addAction("actionShow_Observability", "Observability", N_("Observability"), "enabled");
1328+ addAction("actionShow_Observability_ConfigDialog", "Observability", N_("Observability configuration window"), configDialog, "visible");
1329+ toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, "actionShow_Observability");
1330 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1331- connect(gui->getGuiAction("actionShow_Observability"), SIGNAL(toggled(bool)), this, SLOT(enableObservability(bool)));
1332- connect(gui->getGuiAction("actionShow_Observability_ConfigDialog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
1333- connect(configDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Observability_ConfigDialog"), SLOT(setChecked(bool)));
1334 }
1335 catch (std::exception &e)
1336 {
1337@@ -1587,11 +1585,7 @@
1338 bool Observability::configureGui(bool show)
1339 {
1340 if (show)
1341- {
1342- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1343- gui->getGuiAction("actionShow_Observability_ConfigDialog")->setChecked(true);
1344- }
1345-
1346+ configDialog->setVisible(true);
1347 return true;
1348 }
1349
1350
1351=== modified file 'plugins/Observability/src/Observability.hpp'
1352--- plugins/Observability/src/Observability.hpp 2013-08-26 21:12:42 +0000
1353+++ plugins/Observability/src/Observability.hpp 2013-09-27 03:38:50 +0000
1354@@ -33,6 +33,7 @@
1355 class Observability : public StelModule
1356 {
1357 Q_OBJECT
1358+ Q_PROPERTY(bool enabled READ getEnableObservability WRITE enableObservability)
1359 public:
1360 Observability();
1361 virtual ~Observability();
1362@@ -90,7 +91,7 @@
1363 //! get current Horizon altitude:
1364 int getHorizAltitude(void);
1365
1366-
1367+ bool getEnableObservability() const {return flagShowObservability;}
1368 public slots:
1369 //! Set whether observability will execute or not:
1370 void enableObservability(bool b);
1371
1372=== modified file 'plugins/Oculars/src/Oculars.cpp'
1373--- plugins/Oculars/src/Oculars.cpp 2013-09-26 16:59:43 +0000
1374+++ plugins/Oculars/src/Oculars.cpp 2013-09-27 03:38:50 +0000
1375@@ -30,7 +30,7 @@
1376 #include "StelObjectMgr.hpp"
1377 #include "StelLocaleMgr.hpp"
1378 #include "StelPainter.hpp"
1379-#include "StelShortcutMgr.hpp"
1380+#include "StelActionMgr.hpp"
1381 #include "StelProjector.hpp"
1382 #include "StelGui.hpp"
1383 #include "StelGuiItems.hpp"
1384@@ -1266,13 +1266,7 @@
1385 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1386 Q_ASSERT(gui);
1387
1388- StelShortcutMgr* shMgr = StelApp::getInstance().getStelShortcutManager();
1389-
1390- //This action needs to be connected to the enableOcular() slot after
1391- //the necessary button is created to prevent the button from being checked
1392- //the first time this action is checked. See:
1393- //http://doc.qt.nokia.com/4.7/signalsandslots.html#signals
1394- actionShowOcular = shMgr->getGuiAction("actionShow_Ocular");
1395+ actionShowOcular = addAction("actionShow_Ocular", "Oculars", N_("Ocular view"), "enableOcular(bool)", "Ctrl+O");
1396 actionShowOcular->setChecked(flagShowOculars);
1397 // Make a toolbar button
1398 try {
1399@@ -1283,52 +1277,25 @@
1400 *pxmapOnIcon,
1401 *pxmapOffIcon,
1402 *pxmapGlow,
1403- actionShowOcular);
1404+ "actionShow_Ocular");
1405 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1406 } catch (std::runtime_error& e) {
1407 qWarning() << "WARNING: unable create toolbar button for Oculars plugin: " << e.what();
1408 }
1409- connect(actionShowOcular, SIGNAL(toggled(bool)),
1410- this, SLOT(enableOcular(bool)));
1411-
1412- actionMenu = shMgr->getGuiAction("actionShow_Ocular_Menu");
1413- connect(actionMenu, SIGNAL(toggled(bool)),
1414- this, SLOT(displayPopupMenu()));
1415-
1416- actionShowCrosshairs = shMgr->getGuiAction("actionShow_Ocular_Crosshairs");
1417- connect(actionShowCrosshairs, SIGNAL(toggled(bool)),
1418- this, SLOT(toggleCrosshairs(bool)));
1419-
1420- actionShowSensor = shMgr->getGuiAction("actionShow_Sensor");
1421- connect(actionShowSensor, SIGNAL(toggled(bool)),
1422- this, SLOT(toggleCCD(bool)));
1423-
1424- actionShowTelrad = shMgr->getGuiAction("actionShow_Telrad");
1425- connect(actionShowTelrad, SIGNAL(toggled(bool)),
1426- this, SLOT(toggleTelrad(bool)));
1427-
1428- actionConfiguration = shMgr->getGuiAction("actionOpen_Oculars_Configuration");
1429- connect(actionConfiguration, SIGNAL(toggled(bool)),
1430- ocularDialog, SLOT(setVisible(bool)));
1431- connect(ocularDialog, SIGNAL(visibleChanged(bool)),
1432- actionConfiguration, SLOT(setChecked(bool)));
1433-
1434+
1435+ actionMenu = addAction("actionShow_Ocular_Menu", "Oculars", N_("Oculars popup menu"), "displayPopupMenu()", "Alt+O");
1436+ actionShowCrosshairs = addAction("actionShow_Ocular_Crosshairs", "Oculars", N_("Show crosshairs"), "toggleCrosshairs(bool)", "Alt+C");
1437+ actionShowSensor = addAction("actionShow_Sensor", "Oculars", N_("Image sensor frame"), "toggleCCD(bool)");
1438+ actionShowTelrad = addAction("actionShow_Telrad", "Oculars", N_("Telrad sight"), "toggleTelrad(bool)", "Ctrl+B");
1439+ actionConfiguration = addAction("actionOpen_Oculars_Configuration", "Oculars", N_("Oculars plugin configuration"), ocularDialog, "visible");
1440 // Select next telescope via keyboard
1441- actionTelescopeIncrement = shMgr->getGuiAction("actionShow_Telescope_Increment");
1442- connect(actionTelescopeIncrement, SIGNAL(toggled(bool)), this, SLOT(incrementTelescopeIndex()));
1443-
1444+ addAction("actionShow_Telescope_Increment", "Oculars", N_("Select next telescope"), "incrementTelescopeIndex()", "Shift+PgUp");
1445 // Select previous telescope via keyboard
1446- actionTelescopeDecrement = shMgr->getGuiAction("actionShow_Telescope_Decrement");
1447- connect(actionTelescopeDecrement, SIGNAL(toggled(bool)), this, SLOT(decrementTelescopeIndex()));
1448-
1449+ addAction("actionShow_Telescope_Decrement", "Oculars", N_("Select previous telescope"), "decrementTelescopeIndex()", "Shift+PgDown");
1450 // Select next eyepiece via keyboard
1451- actionOcularIncrement = shMgr->getGuiAction("actionShow_Ocular_Increment");
1452- connect(actionOcularIncrement, SIGNAL(toggled(bool)), this, SLOT(incrementOcularIndex()));
1453-
1454+ addAction("actionShow_Ocular_Increment", "Oculars", N_("Select next eyepiece"), "incrementOcularIndex()", "Ctrl+PgUp");
1455 // Select previous eyepiece via keyboard
1456- actionOcularDecrement = shMgr->getGuiAction("actionShow_Ocular_Decrement");
1457- connect(actionOcularDecrement, SIGNAL(toggled(bool)), this, SLOT(decrementOcularIndex()));
1458-
1459+ addAction("actionShow_Ocular_Decrement", "Oculars", N_("Select previous eyepiece"), "decrementOcularIndex()", "Ctrl+PgDown");
1460 connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(instrumentChanged()));
1461 connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(setScreenFOVForCCD()));
1462 connect(this, SIGNAL(selectedOcularChanged()), this, SLOT(instrumentChanged()));
1463
1464=== modified file 'plugins/Oculars/src/Oculars.hpp'
1465--- plugins/Oculars/src/Oculars.hpp 2013-08-26 21:12:42 +0000
1466+++ plugins/Oculars/src/Oculars.hpp 2013-09-27 03:38:50 +0000
1467@@ -34,7 +34,6 @@
1468 #define MIN_OCULARS_INI_VERSION 0.12
1469
1470 QT_BEGIN_NAMESPACE
1471-class QAction;
1472 class QKeyEvent;
1473 class QMenu;
1474 class QMouseEvent;
1475@@ -44,6 +43,7 @@
1476 QT_END_NAMESPACE
1477
1478 class StelButton;
1479+class StelAction;
1480
1481 //! Main class of the Oculars plug-in.
1482 class Oculars : public StelModule
1483@@ -245,16 +245,16 @@
1484 OcularDialog *ocularDialog;
1485 bool ready; //!< A flag that determines that this module is usable. If false, we won't open.
1486
1487- QAction* actionShowOcular;
1488- QAction* actionShowCrosshairs;
1489- QAction* actionShowSensor;
1490- QAction* actionShowTelrad;
1491- QAction* actionConfiguration;
1492- QAction* actionMenu;
1493- QAction* actionTelescopeIncrement;
1494- QAction* actionTelescopeDecrement;
1495- QAction* actionOcularIncrement;
1496- QAction* actionOcularDecrement;
1497+ StelAction* actionShowOcular;
1498+ StelAction* actionShowCrosshairs;
1499+ StelAction* actionShowSensor;
1500+ StelAction* actionShowTelrad;
1501+ StelAction* actionConfiguration;
1502+ StelAction* actionMenu;
1503+ StelAction* actionTelescopeIncrement;
1504+ StelAction* actionTelescopeDecrement;
1505+ StelAction* actionOcularIncrement;
1506+ StelAction* actionOcularDecrement;
1507
1508 class OcularsGuiPanel* guiPanel;
1509
1510
1511=== modified file 'plugins/Oculars/src/gui/OcularDialog.cpp'
1512--- plugins/Oculars/src/gui/OcularDialog.cpp 2013-09-02 13:58:06 +0000
1513+++ plugins/Oculars/src/gui/OcularDialog.cpp 2013-09-27 03:38:50 +0000
1514@@ -27,9 +27,9 @@
1515 #include "StelModuleMgr.hpp"
1516 #include "StelMainView.hpp"
1517 #include "StelTranslator.hpp"
1518+#include "StelActionMgr.hpp"
1519
1520 #include <QAbstractItemModel>
1521-#include <QAction>
1522 #include <QDataWidgetMapper>
1523 #include <QDebug>
1524 #include <QFrame>
1525@@ -284,22 +284,20 @@
1526 void OcularDialog::keyBindingTogglePluginChanged(const QString& newString)
1527 {
1528 Oculars::appSettings()->setValue("bindings/toggle_oculars", newString);
1529- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1530- Q_ASSERT(gui);
1531- QAction* action = gui->getGuiAction("actionShow_Ocular");
1532+ StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
1533+ StelAction* action = actionMgr->findAction("actionShow_Ocular");
1534 if (action != NULL) {
1535- action->setShortcut(QKeySequence(newString.trimmed()));
1536+ action->setShortcut(newString.trimmed());
1537 }
1538 }
1539
1540 void OcularDialog::keyBindingPopupNavigatorConfigChanged(const QString& newString)
1541 {
1542 Oculars::appSettings()->setValue("bindings/popup_navigator", newString);
1543- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1544- Q_ASSERT(gui);
1545- QAction* action = gui->getGuiAction("actionShow_Ocular_Menu");
1546+ StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
1547+ StelAction* action = actionMgr->findAction("actionShow_Ocular_Menu");
1548 if (action != NULL) {
1549- action->setShortcut(QKeySequence(newString.trimmed()));
1550+ action->setShortcut(newString.trimmed());
1551 }
1552 }
1553
1554@@ -515,16 +513,18 @@
1555
1556 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1557 Q_ASSERT(gui);
1558- QAction* actionOcular = gui->getGuiAction("actionShow_Ocular");
1559+ StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
1560+ Q_ASSERT(actionMgr);
1561+ StelAction* actionOcular = actionMgr->findAction("actionShow_Ocular");
1562 Q_ASSERT(actionOcular);
1563- QAction* actionMenu = gui->getGuiAction("actionShow_Ocular_Menu");
1564+ StelAction* actionMenu = actionMgr->findAction("actionShow_Ocular_Menu");
1565 Q_ASSERT(actionMenu);
1566- QKeySequence ocularShortcut = actionOcular->shortcut();
1567+ QKeySequence ocularShortcut = actionOcular->getShortcut();
1568 QString ocularString = ocularShortcut.toString(QKeySequence::NativeText);
1569 ocularString = ocularString.toHtmlEscaped();
1570 if (ocularString.isEmpty())
1571 ocularString = q_("[no key defined]");
1572- QKeySequence menuShortcut = actionMenu->shortcut();
1573+ QKeySequence menuShortcut = actionMenu->getShortcut();
1574 QString menuString = menuShortcut.toString(QKeySequence::NativeText);
1575 menuString = menuString.toHtmlEscaped();
1576 if (menuString.isEmpty())
1577
1578=== modified file 'plugins/Oculars/src/gui/OcularsGuiPanel.cpp'
1579--- plugins/Oculars/src/gui/OcularsGuiPanel.cpp 2013-09-26 02:35:58 +0000
1580+++ plugins/Oculars/src/gui/OcularsGuiPanel.cpp 2013-09-27 03:38:50 +0000
1581@@ -23,8 +23,8 @@
1582 #include "StelGui.hpp"
1583 #include "StelGuiItems.hpp"
1584 #include "StelTranslator.hpp"
1585+#include "StelActionMgr.hpp"
1586
1587-#include <QAction>
1588 #include <QGridLayout>
1589 #include <QGraphicsLinearLayout>
1590 #include <QGraphicsPathItem>
1591@@ -63,7 +63,7 @@
1592 QPixmap(),
1593 ocularsPlugin->actionShowOcular,
1594 true); //No background
1595- buttonOcular->setToolTip(ocularsPlugin->actionShowOcular->text());
1596+ buttonOcular->setToolTip(ocularsPlugin->actionShowOcular->getText());
1597 buttonOcular->setParentItem(buttonBar);
1598
1599 //Hack to avoid buttonOcular being left "checked" if it has been toggled
1600@@ -80,7 +80,7 @@
1601 QPixmap(),
1602 ocularsPlugin->actionShowCrosshairs,
1603 true);
1604- buttonCrosshairs->setToolTip(ocularsPlugin->actionShowCrosshairs->text());
1605+ buttonCrosshairs->setToolTip(ocularsPlugin->actionShowCrosshairs->getText());
1606 buttonCrosshairs->setVisible(false);
1607
1608 Q_ASSERT(ocularsPlugin->actionShowSensor);
1609@@ -90,7 +90,7 @@
1610 QPixmap(),
1611 ocularsPlugin->actionShowSensor,
1612 true);
1613- buttonCcd->setToolTip(ocularsPlugin->actionShowSensor->text());
1614+ buttonCcd->setToolTip(ocularsPlugin->actionShowSensor->getText());
1615
1616 Q_ASSERT(ocularsPlugin->actionShowTelrad);
1617 buttonTelrad = new StelButton(buttonBar,
1618@@ -99,7 +99,7 @@
1619 QPixmap(),
1620 ocularsPlugin->actionShowTelrad,
1621 true);
1622- buttonTelrad->setToolTip(ocularsPlugin->actionShowTelrad->text());
1623+ buttonTelrad->setToolTip(ocularsPlugin->actionShowTelrad->getText());
1624
1625 Q_ASSERT(ocularsPlugin->actionConfiguration);
1626 buttonConfiguration = new StelButton(buttonBar,
1627@@ -108,7 +108,7 @@
1628 QPixmap(),
1629 ocularsPlugin->actionConfiguration,
1630 true);
1631- buttonConfiguration->setToolTip(ocularsPlugin->actionConfiguration->text());
1632+ buttonConfiguration->setToolTip(ocularsPlugin->actionConfiguration->getText());
1633
1634 qreal buttonHeight = buttonOcular->boundingRect().height();
1635 buttonBar->setMinimumHeight(buttonHeight);
1636@@ -175,7 +175,7 @@
1637 QPixmap naOff(":/graphicGui/btTimeForward-off.png");
1638 QPixmap nextArrowOff = naOff.scaledToHeight(lineHeight, Qt::SmoothTransformation);
1639
1640- QAction* defaultAction = new QAction(this);
1641+ StelAction* defaultAction = new StelAction(this);
1642 defaultAction->setCheckable(false);
1643 prevOcularButton = new StelButton(ocularControls,
1644 prevArrow,
1645
1646=== modified file 'plugins/Pulsars/src/Pulsars.cpp'
1647--- plugins/Pulsars/src/Pulsars.cpp 2013-09-23 20:24:50 +0000
1648+++ plugins/Pulsars/src/Pulsars.cpp 2013-09-27 03:38:50 +0000
1649@@ -155,7 +155,8 @@
1650 Pulsar::markerTexture = StelApp::getInstance().getTextureManager().createTexture(":/Pulsars/pulsar.png");
1651
1652 // key bindings and other actions
1653- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1654+ addAction("actionShow_Pulsars", N_("Pulsars"), N_("Show pulsars"), "pulsarsVisible", "Ctrl+Alt+P");
1655+ addAction("actionShow_Pulsars_ConfigDialog", N_("Pulsars"), N_("Pulsars configuration window"), configDialog, "visible");
1656
1657 GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png");
1658 OnIcon = new QPixmap(":/Pulsars/btPulsars-on.png");
1659@@ -163,10 +164,6 @@
1660
1661 setFlagShowPulsars(getEnableAtStartup());
1662 setFlagShowPulsarsButton(flagShowPulsarsButton);
1663-
1664- connect(gui->getGuiAction("actionShow_Pulsars_ConfigDialog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
1665- connect(configDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Pulsars_ConfigDialog"), SLOT(setChecked(bool)));
1666- connect(gui->getGuiAction("actionShow_Pulsars"), SIGNAL(toggled(bool)), this, SLOT(setFlagShowPulsars(bool)));
1667 }
1668 catch (std::runtime_error &e)
1669 {
1670@@ -583,11 +580,7 @@
1671 bool Pulsars::configureGui(bool show)
1672 {
1673 if (show)
1674- {
1675- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1676- gui->getGuiAction("actionShow_Pulsars_ConfigDialog")->setChecked(true);
1677- }
1678-
1679+ configDialog->setVisible(true);
1680 return true;
1681 }
1682
1683@@ -757,8 +750,7 @@
1684 if (b==true) {
1685 if (toolbarButton==NULL) {
1686 // Create the pulsars button
1687- gui->getGuiAction("actionShow_Pulsars")->setChecked(flagShowPulsars);
1688- toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, gui->getGuiAction("actionShow_Pulsars"));
1689+ toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, "actionShow_Pulsars");
1690 }
1691 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1692 } else {
1693
1694=== modified file 'plugins/Pulsars/src/Pulsars.hpp'
1695--- plugins/Pulsars/src/Pulsars.hpp 2013-09-23 20:24:50 +0000
1696+++ plugins/Pulsars/src/Pulsars.hpp 2013-09-27 03:38:50 +0000
1697@@ -47,6 +47,7 @@
1698 class Pulsars : public StelObjectModule
1699 {
1700 Q_OBJECT
1701+ Q_PROPERTY(bool pulsarsVisible READ getFlagShowPulsars WRITE setFlagShowPulsars)
1702 public:
1703 //! @enum UpdateState
1704 //! Used for keeping for track of the download/update status
1705
1706=== modified file 'plugins/Quasars/src/Quasars.cpp'
1707--- plugins/Quasars/src/Quasars.cpp 2013-09-23 20:24:50 +0000
1708+++ plugins/Quasars/src/Quasars.cpp 2013-09-27 03:38:50 +0000
1709@@ -155,7 +155,8 @@
1710 Quasar::markerTexture = StelApp::getInstance().getTextureManager().createTexture(":/Quasars/quasar.png");
1711
1712 // key bindings and other actions
1713- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1714+ addAction("actionShow_Quasars", N_("Quasars"), N_("Show quasars"), "quasarsVisible", "Ctrl+Alt+Q");
1715+ addAction("actionShow_Quasars_ConfigDialog", N_("Quasars"), N_("Quasars configuration window"), configDialog, "visible");
1716
1717 GlowIcon = new QPixmap(":/graphicsGui/glow32x32.png");
1718 OnIcon = new QPixmap(":/Quasars/btQuasars-on.png");
1719@@ -163,10 +164,6 @@
1720
1721 setFlagShowQuasars(getEnableAtStartup());
1722 setFlagShowQuasarsButton(flagShowQuasarsButton);
1723-
1724- connect(gui->getGuiAction("actionShow_Quasars_ConfigDialog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
1725- connect(configDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Quasars_ConfigDialog"), SLOT(setChecked(bool)));
1726- connect(gui->getGuiAction("actionShow_Quasars"), SIGNAL(toggled(bool)), this, SLOT(setFlagShowQuasars(bool)));
1727 }
1728 catch (std::runtime_error &e)
1729 {
1730@@ -585,11 +582,7 @@
1731 bool Quasars::configureGui(bool show)
1732 {
1733 if (show)
1734- {
1735- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1736- gui->getGuiAction("actionShow_Quasars_ConfigDialog")->setChecked(true);
1737- }
1738-
1739+ configDialog->setVisible(true);
1740 return true;
1741 }
1742
1743@@ -759,8 +752,7 @@
1744 if (b==true) {
1745 if (toolbarButton==NULL) {
1746 // Create the quasars button
1747- gui->getGuiAction("actionShow_Quasars")->setChecked(flagShowQuasars);
1748- toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, gui->getGuiAction("actionShow_Quasars"));
1749+ toolbarButton = new StelButton(NULL, *OnIcon, *OffIcon, *GlowIcon, "actionShow_Quasars");
1750 }
1751 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1752 } else {
1753
1754=== modified file 'plugins/Quasars/src/Quasars.hpp'
1755--- plugins/Quasars/src/Quasars.hpp 2013-09-23 20:24:50 +0000
1756+++ plugins/Quasars/src/Quasars.hpp 2013-09-27 03:38:50 +0000
1757@@ -46,7 +46,8 @@
1758 class Quasars : public StelObjectModule
1759 {
1760 Q_OBJECT
1761-public:
1762+ Q_PROPERTY(bool quasarsVisible READ getFlagShowQuasars WRITE setFlagShowQuasars)
1763+public:
1764 //! @enum UpdateState
1765 //! Used for keeping for track of the download/update status
1766 enum UpdateState {
1767
1768=== modified file 'plugins/Satellites/src/Satellites.cpp'
1769--- plugins/Satellites/src/Satellites.cpp 2013-09-22 20:28:42 +0000
1770+++ plugins/Satellites/src/Satellites.cpp 2013-09-27 03:38:50 +0000
1771@@ -130,21 +130,16 @@
1772
1773 // key bindings and other actions
1774 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1775- gui->getGuiAction("actionShow_Satellite_Hints")->setChecked(getFlagHints());
1776- gui->getGuiAction("actionShow_Satellite_Labels")->setChecked(Satellite::showLabels);
1777+ addAction("actionShow_Satellite_Hints", "Satellites", N_("Satellite hints"), "hintsVisible", "Ctrl+Z");
1778+ addAction("actionShow_Satellite_Labels", "Satellites", N_("Satellite labels"), "labelsVisible", "Shift+Z");
1779+ addAction("actionShow_Satellite_ConfigDialog_Global", "Satellites", N_("Satellites configuration window"), configDialog, "visible", "Alt+Z");
1780
1781 // Gui toolbar button
1782 pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png");
1783 pxmapOnIcon = new QPixmap(":/satellites/bt_satellites_on.png");
1784 pxmapOffIcon = new QPixmap(":/satellites/bt_satellites_off.png");
1785- toolbarButton = new StelButton(NULL, *pxmapOnIcon, *pxmapOffIcon, *pxmapGlow, gui->getGuiAction("actionShow_Satellite_Hints"));
1786+ toolbarButton = new StelButton(NULL, *pxmapOnIcon, *pxmapOffIcon, *pxmapGlow, "actionShow_Satellite_Hints");
1787 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1788-
1789- connect(gui->getGuiAction("actionShow_Satellite_ConfigDialog_Global"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
1790- connect(configDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Satellite_ConfigDialog_Global"), SLOT(setChecked(bool)));
1791- connect(gui->getGuiAction("actionShow_Satellite_Hints"), SIGNAL(toggled(bool)), this, SLOT(setFlagHints(bool)));
1792- connect(gui->getGuiAction("actionShow_Satellite_Labels"), SIGNAL(toggled(bool)), this, SLOT(setFlagLabels(bool)));
1793-
1794 }
1795 catch (std::runtime_error &e)
1796 {
1797@@ -514,11 +509,7 @@
1798 bool Satellites::configureGui(bool show)
1799 {
1800 if (show)
1801- {
1802- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1803- gui->getGuiAction("actionShow_Satellite_ConfigDialog_Global")->setChecked(true);
1804- }
1805-
1806+ configDialog->setVisible(true);
1807 return true;
1808 }
1809
1810
1811=== modified file 'plugins/Satellites/src/Satellites.hpp'
1812--- plugins/Satellites/src/Satellites.hpp 2013-09-09 23:21:42 +0000
1813+++ plugins/Satellites/src/Satellites.hpp 2013-09-27 03:38:50 +0000
1814@@ -123,6 +123,12 @@
1815 class Satellites : public StelObjectModule
1816 {
1817 Q_OBJECT
1818+ Q_PROPERTY(bool hintsVisible
1819+ READ getFlagHints
1820+ WRITE setFlagHints)
1821+ Q_PROPERTY(bool labelsVisible
1822+ READ getFlagLabels
1823+ WRITE setFlagLabels)
1824 Q_PROPERTY(bool autoAddEnabled
1825 READ isAutoAddEnabled
1826 WRITE enableAutoAdd
1827
1828=== modified file 'plugins/Satellites/src/gui/SatellitesDialog.cpp'
1829--- plugins/Satellites/src/gui/SatellitesDialog.cpp 2013-09-02 13:58:06 +0000
1830+++ plugins/Satellites/src/gui/SatellitesDialog.cpp 2013-09-27 03:38:50 +0000
1831@@ -41,6 +41,7 @@
1832 #include "StelMainView.hpp"
1833 #include "StelFileMgr.hpp"
1834 #include "StelTranslator.hpp"
1835+#include "StelActionMgr.hpp"
1836
1837 SatellitesDialog::SatellitesDialog() :
1838 updateTimer(0),
1839@@ -117,7 +118,7 @@
1840
1841 // Settings tab / General settings group
1842 // This does call Satellites::setFlagLabels() indirectly.
1843- QAction* action = dynamic_cast<StelGui*>(StelApp::getInstance().getGui())->getGuiAction("actionShow_Satellite_Labels");
1844+ StelAction* action = StelApp::getInstance().getStelActionManager()->findAction("actionShow_Satellite_Labels");
1845 connect(ui->labelsGroup, SIGNAL(clicked(bool)),
1846 action, SLOT(setChecked(bool)));
1847 connect(ui->fontSizeSpinBox, SIGNAL(valueChanged(int)),
1848@@ -859,8 +860,7 @@
1849 // If Satellites are not currently displayed, make them visible.
1850 if (!SatellitesMgr->getFlagHints())
1851 {
1852- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1853- QAction* setHintsAction = gui->getGuiAction("actionShow_Satellite_Hints");
1854+ StelAction* setHintsAction = StelApp::getInstance().getStelActionManager()->findAction("actionShow_Satellite_Hints");
1855 Q_ASSERT(setHintsAction);
1856 setHintsAction->setChecked(true);
1857 }
1858
1859=== modified file 'plugins/Supernovae/src/Supernovae.cpp'
1860--- plugins/Supernovae/src/Supernovae.cpp 2013-09-25 17:59:56 +0000
1861+++ plugins/Supernovae/src/Supernovae.cpp 2013-09-27 03:38:50 +0000
1862@@ -138,10 +138,7 @@
1863 texPointer = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png");
1864
1865 // key bindings and other actions
1866- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1867-
1868- connect(gui->getGuiAction("actionShow_Supernovae_ConfigDialog"), SIGNAL(toggled(bool)), configDialog, SLOT(setVisible(bool)));
1869- connect(configDialog, SIGNAL(visibleChanged(bool)), gui->getGuiAction("actionShow_Supernovae_ConfigDialog"), SLOT(setChecked(bool)));
1870+ addAction("actionShow_Supernovae_ConfigDialog", N_("Historical Supernovae"), N_("Historical Supernovae configuration window"), configDialog, "visible");
1871 }
1872 catch (std::runtime_error &e)
1873 {
1874@@ -562,11 +559,7 @@
1875 bool Supernovae::configureGui(bool show)
1876 {
1877 if (show)
1878- {
1879- StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1880- gui->getGuiAction("actionShow_Supernovae_ConfigDialog")->setChecked(true);
1881- }
1882-
1883+ configDialog->setVisible(true);
1884 return true;
1885 }
1886
1887
1888=== modified file 'plugins/TelescopeControl/src/TelescopeControl.cpp'
1889--- plugins/TelescopeControl/src/TelescopeControl.cpp 2013-09-22 20:28:42 +0000
1890+++ plugins/TelescopeControl/src/TelescopeControl.cpp 2013-09-27 03:38:50 +0000
1891@@ -45,9 +45,9 @@
1892 #include "StelObjectMgr.hpp"
1893 #include "StelPainter.hpp"
1894 #include "StelProjector.hpp"
1895-#include "StelShortcutMgr.hpp"
1896 #include "StelStyle.hpp"
1897 #include "StelTextureMgr.hpp"
1898+#include "StelActionMgr.hpp"
1899
1900 #include <QAction>
1901 #include <QDateTime>
1902@@ -58,6 +58,7 @@
1903 #include <QString>
1904 #include <QStringList>
1905 #include <QDir>
1906+#include <QSignalMapper>
1907
1908 #include <QDebug>
1909
1910@@ -145,7 +146,6 @@
1911 selectionTexture = StelApp::getInstance().getTextureManager().createTexture(StelFileMgr::getInstallationDir()+"/textures/pointeur2.png");
1912
1913 StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
1914- StelShortcutMgr* shMgr = StelApp::getInstance().getStelShortcutManager();
1915
1916 //Create telescope key bindings
1917 /* QAction-s with these key bindings existed in Stellarium prior to
1918@@ -155,38 +155,30 @@
1919 // "Slew to object" commands
1920 QString name = moveToSelectedActionId.arg(i);
1921 QString shortcut = QString("Ctrl+%1").arg(i);
1922- QAction* action = shMgr->addGuiAction(name, true, "",
1923- shortcut, "", actionGroupId,
1924- false);
1925- connect(action, SIGNAL(triggered()),
1926- this, SLOT(slewTelescopeToSelectedObject()));
1927+ QString text;
1928+ text = q_("Move telescope #%1 to selected object").arg(i);
1929+ addAction(name, N_("Telescope Control"), text, "slewTelescopeToSelectedObject()", shortcut);
1930
1931 // "Slew to the center of the screen" commands
1932 name = moveToCenterActionId.arg(i);
1933 shortcut = QString("Alt+%1").arg(i);
1934- action = shMgr->addGuiAction(name, true, "",
1935- shortcut, "", actionGroupId,
1936- false, false);
1937- connect(action, SIGNAL(triggered()), this,
1938- SLOT(slewTelescopeToViewDirection()));
1939+ text = q_("Move telescope #%1 to the point currently in the center of the screen").arg(i);
1940+ addAction(name, "Telescope Control", text, "slewTelescopeToViewDirection()", shortcut);
1941 }
1942- // Also updates descriptions if the actions have been loaded from file
1943- translateActionDescriptions();
1944 connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
1945 this, SLOT(translateActionDescriptions()));
1946
1947 //Create and initialize dialog windows
1948 telescopeDialog = new TelescopeDialog();
1949 slewDialog = new SlewDialog();
1950-
1951- connect(shMgr->getGuiAction("actionShow_Slew_Window"), SIGNAL(toggled(bool)), slewDialog, SLOT(setVisible(bool)));
1952- connect(slewDialog, SIGNAL(visibleChanged(bool)), shMgr->getGuiAction("actionShow_Slew_Window"), SLOT(setChecked(bool)));
1953-
1954+
1955+ addAction("actionShow_Slew_Window", N_("Telescope Control"), N_("Move a telescope to a given set of coordinates"), slewDialog, "visible", "Ctrl+0");
1956+
1957 //Create toolbar button
1958 pixmapHover = new QPixmap(":/graphicGui/glow32x32.png");
1959 pixmapOnIcon = new QPixmap(":/telescopeControl/button_Slew_Dialog_on.png");
1960 pixmapOffIcon = new QPixmap(":/telescopeControl/button_Slew_Dialog_off.png");
1961- toolbarButton = new StelButton(NULL, *pixmapOnIcon, *pixmapOffIcon, *pixmapHover, gui->getGuiAction("actionShow_Slew_Window"));
1962+ toolbarButton = new StelButton(NULL, *pixmapOnIcon, *pixmapOffIcon, *pixmapHover, "actionShow_Slew_Window");
1963 gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGroup");
1964 }
1965 catch (std::runtime_error &e)
1966@@ -203,6 +195,26 @@
1967 connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&)));
1968 }
1969
1970+void TelescopeControl::translateActionDescriptions()
1971+{
1972+ StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
1973+
1974+ for (int i = MIN_SLOT_NUMBER; i <= MAX_SLOT_NUMBER; i++)
1975+ {
1976+ QString name;
1977+ QString description;
1978+
1979+ name = moveToSelectedActionId.arg(i);
1980+ description = q_("Move telescope #%1 to selected object").arg(i);
1981+ actionMgr->findAction(name)->setText(description);
1982+
1983+ name = moveToCenterActionId.arg(i);
1984+ description = q_("Move telescope #%1 to the point currently in the center of the screen").arg(i);
1985+ actionMgr->findAction(name)->setText(description);
1986+ }
1987+}
1988+
1989+
1990 void TelescopeControl::deinit()
1991 {
1992 //Destroy all clients first in order to avoid displaying a TCP error
1993@@ -470,6 +482,7 @@
1994 // Find out for which telescope is the command
1995 if (sender() == NULL)
1996 return;
1997+ // XXX: we could use a QSignalMapper instead of this trick.
1998 int slotNumber = sender()->objectName().right(1).toInt();
1999
2000 // Find out the coordinates of the target
2001@@ -1631,22 +1644,3 @@
2002 log_file = telescopeServerLogStreams.value(slot);
2003 }
2004
2005-
2006-void TelescopeControl::translateActionDescriptions()
2007-{
2008- StelShortcutMgr* shMgr = StelApp::getInstance().getStelShortcutManager();
2009- if (!shMgr)
2010- return;
2011-
2012- for (int i = MIN_SLOT_NUMBER; i <= MAX_SLOT_NUMBER; i++)
2013- {
2014- QString name = moveToSelectedActionId.arg(i);
2015- QString description = q_("Move telescope #%1 to selected object")
2016- .arg(i);
2017- shMgr->setShortcutText(name, actionGroupId, description);
2018-
2019- name = moveToCenterActionId.arg(i);
2020- description = q_("Move telescope #%1 to the point currently in the center of the screen").arg(i);
2021- shMgr->setShortcutText(name, actionGroupId, description);
2022- }
2023-}
2024
2025=== modified file 'src/CMakeLists.txt'
2026--- src/CMakeLists.txt 2013-09-26 16:59:43 +0000
2027+++ src/CMakeLists.txt 2013-09-27 03:38:50 +0000
2028@@ -121,10 +121,8 @@
2029 core/TrailGroup.cpp
2030 core/RefractionExtinction.hpp
2031 core/RefractionExtinction.cpp
2032- core/StelShortcutMgr.hpp
2033- core/StelShortcutMgr.cpp
2034- core/StelShortcutGroup.cpp
2035- core/StelShortcutGroup.hpp
2036+ core/StelActionMgr.hpp
2037+ core/StelActionMgr.cpp
2038 core/StelProgressController.hpp
2039
2040 ${gl_lib_SRCS}
2041
2042=== modified file 'src/StelMainView.cpp'
2043--- src/StelMainView.cpp 2013-09-23 20:24:50 +0000
2044+++ src/StelMainView.cpp 2013-09-27 03:38:50 +0000
2045@@ -27,6 +27,7 @@
2046 #include "StelGuiBase.hpp"
2047 #include "StelTranslator.hpp"
2048 #include "StelUtils.hpp"
2049+#include "StelActionMgr.hpp"
2050
2051 #include <QGLWidget>
2052 #include <QDesktopWidget>
2053@@ -280,6 +281,11 @@
2054 stelApp= new StelApp();
2055 stelApp->setGui(gui);
2056 stelApp->init(conf);
2057+ StelActionMgr *actionMgr = stelApp->getStelActionManager();
2058+ actionMgr->addAction("actionSave_Screenshot_Global", "Miscellaneous", N_("Save screenshot"), this, "saveScreenShot()", "Ctrl+S");
2059+ actionMgr->addAction("actionSet_Full_Screen_Global", "Display Options", N_("Full-screen mode"), this, "fullScreen", "F11");
2060+
2061+
2062 StelPainter::initGLShaders();
2063
2064 setViewportUpdateMode(QGraphicsView::FullViewportUpdate);
2065@@ -427,6 +433,12 @@
2066 void StelMainView::keyPressEvent(QKeyEvent* event)
2067 {
2068 thereWasAnEvent(); // Refresh screen ASAP
2069+ // Try to trigger a gobal shortcut.
2070+ StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
2071+ if (actionMgr->pushKey(event->key() + event->modifiers(), true)) {
2072+ event->setAccepted(true);
2073+ return;
2074+ }
2075 QDeclarativeView::keyPressEvent(event);
2076 }
2077
2078
2079=== modified file 'src/StelMainView.hpp'
2080--- src/StelMainView.hpp 2013-09-21 20:07:35 +0000
2081+++ src/StelMainView.hpp 2013-09-27 03:38:50 +0000
2082@@ -35,7 +35,9 @@
2083 //! It is the class creating the singleton GL Widget, the main StelApp instance as well as the main GUI.
2084 class StelMainView : public QDeclarativeView
2085 {
2086-Q_OBJECT
2087+ Q_OBJECT
2088+ Q_PROPERTY(bool fullScreen READ isFullScreen WRITE setFullScreen)
2089+
2090 public:
2091 StelMainView(QWidget* parent = NULL);
2092 virtual ~StelMainView();
2093
2094=== added file 'src/core/StelActionMgr.cpp'
2095--- src/core/StelActionMgr.cpp 1970-01-01 00:00:00 +0000
2096+++ src/core/StelActionMgr.cpp 2013-09-27 03:38:50 +0000
2097@@ -0,0 +1,249 @@
2098+/*
2099+ * Stellarium
2100+ * Copyright (C) 2013 Guillaume Chereau
2101+ *
2102+ * This program is free software; you can redistribute it and/or
2103+ * modify it under the terms of the GNU General Public License
2104+ * as published by the Free Software Foundation; either version 2
2105+ * of the License, or (at your option) any later version.
2106+ *
2107+ * This program is distributed in the hope that it will be useful,
2108+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2109+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2110+ * GNU General Public License for more details.
2111+ *
2112+ * You should have received a copy of the GNU General Public License
2113+ * along with this program; if not, write to the Free Software
2114+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
2115+ */
2116+
2117+#include "StelActionMgr.hpp"
2118+#include "StelApp.hpp"
2119+
2120+#include <QVariant>
2121+#include <QDebug>
2122+#include <QMetaProperty>
2123+#include <QStringList>
2124+#include <QSettings>
2125+
2126+StelAction::StelAction(const QString& actionId,
2127+ const QString& groupId,
2128+ const QString& text,
2129+ const QString& primaryKey,
2130+ const QString& altKey,
2131+ bool global):
2132+ QObject(StelApp::getInstance().getStelActionManager()),
2133+ checkable(false),
2134+ checked(false),
2135+ group(groupId),
2136+ text(text),
2137+ global(global),
2138+ keySequence(primaryKey),
2139+ altKeySequence(altKey),
2140+ defaultKeySequence(primaryKey),
2141+ defaultAltKeySequence(altKey),
2142+ target(NULL),
2143+ property(NULL)
2144+{
2145+ setObjectName(actionId);
2146+ // Check the global conf for custom shortcuts.
2147+ QSettings* conf = StelApp::getInstance().getSettings();
2148+ QString confShortcut = conf->value("shortcuts/" + actionId).toString();
2149+ if (!confShortcut.isEmpty())
2150+ {
2151+ QStringList shortcuts = confShortcut.split(" ");
2152+ if (shortcuts.size() > 2)
2153+ qWarning() << actionId << ": does not support more than two shortcuts per action";
2154+ setShortcut(shortcuts[0]);
2155+ if (shortcuts.size() > 1)
2156+ setAltShortcut(shortcuts[1]);
2157+ }
2158+}
2159+
2160+void StelAction::setShortcut(const QString& key)
2161+{
2162+ keySequence = QKeySequence(key);
2163+}
2164+
2165+void StelAction::setAltShortcut(const QString& key)
2166+{
2167+ altKeySequence = QKeySequence(key);
2168+}
2169+
2170+void StelAction::setChecked(bool value)
2171+{
2172+ Q_ASSERT(checkable);
2173+ if (value == checked)
2174+ return;
2175+ checked = value;
2176+ if (target)
2177+ target->setProperty(property, checked);
2178+ emit toggled(checked);
2179+}
2180+
2181+void StelAction::toggle()
2182+{
2183+ setChecked(!checked);
2184+}
2185+
2186+void StelAction::trigger()
2187+{
2188+ if (checkable)
2189+ toggle();
2190+ else
2191+ emit triggered();
2192+}
2193+
2194+void StelAction::connectToObject(QObject* obj, const char* slot)
2195+{
2196+ QVariant prop = obj->property(slot);
2197+ if (prop.isValid()) // Connect to a property.
2198+ {
2199+ checkable = true;
2200+ target = obj;
2201+ property = slot;
2202+ checked = prop.toBool();
2203+ // Listen to the property notified signal if there is one.
2204+ int propIndex = obj->metaObject()->indexOfProperty(slot);
2205+ QMetaProperty metaProp = obj->metaObject()->property(propIndex);
2206+ int slotIndex = metaObject()->indexOfMethod("propertyChanged(bool)");
2207+ if (metaProp.hasNotifySignal())
2208+ connect(obj, metaProp.notifySignal(), this, metaObject()->method(slotIndex));
2209+ return;
2210+ }
2211+ int slotIndex = obj->metaObject()->indexOfMethod(slot);
2212+ if (obj->metaObject()->method(slotIndex).parameterCount() == 1)
2213+ {
2214+ // connect to a boolean slot.
2215+ Q_ASSERT(obj->metaObject()->method(slotIndex).parameterType(0) == QMetaType::Bool);
2216+ checkable = true;
2217+ int signalIndex = metaObject()->indexOfMethod("toggled(bool)");
2218+ connect(this, metaObject()->method(signalIndex), obj, obj->metaObject()->method(slotIndex));
2219+ }
2220+ else
2221+ {
2222+ // connect to a slot.
2223+ Q_ASSERT(obj->metaObject()->method(slotIndex).parameterCount() == 0);
2224+ checkable = false;
2225+ int signalIndex = metaObject()->indexOfMethod("triggered()");
2226+ connect(this, metaObject()->method(signalIndex), obj, obj->metaObject()->method(slotIndex));
2227+ }
2228+}
2229+
2230+void StelAction::propertyChanged(bool value)
2231+{
2232+ if (value == checked)
2233+ return;
2234+ checked = value;
2235+ emit toggled(checked);
2236+}
2237+
2238+QKeySequence::SequenceMatch StelAction::matches(const QKeySequence& seq) const
2239+{
2240+ Q_ASSERT(QKeySequence::PartialMatch > QKeySequence::NoMatch);
2241+ Q_ASSERT(QKeySequence::ExactMatch > QKeySequence::PartialMatch);
2242+ return qMax((!keySequence.isEmpty() ? keySequence.matches(seq) : QKeySequence::NoMatch),
2243+ (!altKeySequence.isEmpty() ? altKeySequence.matches(seq) : QKeySequence::NoMatch));
2244+}
2245+
2246+StelActionMgr::StelActionMgr() :
2247+ actionsEnabled(true)
2248+{
2249+}
2250+
2251+StelActionMgr::~StelActionMgr()
2252+{
2253+
2254+}
2255+
2256+StelAction* StelActionMgr::addAction(const QString& id, const QString& groupId, const QString& text,
2257+ QObject* target, const char* slot,
2258+ const QString& shortcut, const QString& altShortcut,
2259+ bool global)
2260+{
2261+ StelAction* action = new StelAction(id, groupId, text, shortcut, altShortcut, global);
2262+ action->connectToObject(target, slot);
2263+ return action;
2264+}
2265+
2266+StelAction* StelActionMgr::findAction(const QString& id)
2267+{
2268+ return findChild<StelAction*>(id);
2269+}
2270+
2271+bool StelActionMgr::pushKey(int key, bool global)
2272+{
2273+ if (!actionsEnabled)
2274+ return false;
2275+ keySequence << key;
2276+ QKeySequence sequence(keySequence.size() > 0 ? keySequence[0] : 0,
2277+ keySequence.size() > 1 ? keySequence[1] : 0,
2278+ keySequence.size() > 2 ? keySequence[2] : 0,
2279+ keySequence.size() > 3 ? keySequence[3] : 0);
2280+ bool hasPartialMatch = false;
2281+ foreach(StelAction* action, findChildren<StelAction*>())
2282+ {
2283+ if (global && !action->global) continue;
2284+ QKeySequence::SequenceMatch match = action->matches(sequence);
2285+ if (match == QKeySequence::ExactMatch)
2286+ {
2287+ keySequence.clear();
2288+ action->trigger();
2289+ return true;
2290+ }
2291+ hasPartialMatch = hasPartialMatch || match == QKeySequence::PartialMatch;
2292+ }
2293+ if (!hasPartialMatch)
2294+ keySequence.clear();
2295+ return false;
2296+}
2297+
2298+QStringList StelActionMgr::getGroupList() const
2299+{
2300+ QStringList ret;
2301+ foreach(StelAction* action, findChildren<StelAction*>())
2302+ {
2303+ if (!ret.contains(action->group))
2304+ ret.append(action->group);
2305+ }
2306+ return ret;
2307+}
2308+
2309+QList<StelAction*> StelActionMgr::getActionList(const QString& group) const
2310+{
2311+ QList<StelAction*> ret;
2312+ foreach(StelAction* action, findChildren<StelAction*>())
2313+ {
2314+ if (action->group == group)
2315+ ret.append(action);
2316+ }
2317+ return ret;
2318+}
2319+
2320+void StelActionMgr::saveShortcuts()
2321+{
2322+ QSettings* conf = StelApp::getInstance().getSettings();
2323+ conf->beginGroup("shortcuts");
2324+ conf->remove("");
2325+ foreach(StelAction* action, findChildren<StelAction*>())
2326+ {
2327+ if ( action->keySequence == action->defaultKeySequence &&
2328+ action->altKeySequence == action->defaultAltKeySequence)
2329+ continue;
2330+ QString seq = action->keySequence.toString();
2331+ if (action->altKeySequence != action->defaultAltKeySequence)
2332+ seq += " " + action->altKeySequence.toString();
2333+ conf->setValue(action->objectName(), seq);
2334+ }
2335+ conf->endGroup();
2336+}
2337+
2338+void StelActionMgr::restoreDefaultShortcuts()
2339+{
2340+ foreach(StelAction* action, findChildren<StelAction*>())
2341+ {
2342+ action->keySequence = action->defaultKeySequence;
2343+ action->altKeySequence = action->defaultAltKeySequence;
2344+ }
2345+ saveShortcuts();
2346+}
2347
2348=== added file 'src/core/StelActionMgr.hpp'
2349--- src/core/StelActionMgr.hpp 1970-01-01 00:00:00 +0000
2350+++ src/core/StelActionMgr.hpp 2013-09-27 03:38:50 +0000
2351@@ -0,0 +1,120 @@
2352+/*
2353+ * Stellarium
2354+ * Copyright (C) 2013 Guillaume Chereau
2355+ *
2356+ * This program is free software; you can redistribute it and/or
2357+ * modify it under the terms of the GNU General Public License
2358+ * as published by the Free Software Foundation; either version 2
2359+ * of the License, or (at your option) any later version.
2360+ *
2361+ * This program is distributed in the hope that it will be useful,
2362+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2363+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2364+ * GNU General Public License for more details.
2365+ *
2366+ * You should have received a copy of the GNU General Public License
2367+ * along with this program; if not, write to the Free Software
2368+ * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
2369+ */
2370+
2371+#include <QObject>
2372+#include <QKeySequence>
2373+#include <QList>
2374+
2375+class StelAction : public QObject
2376+{
2377+ Q_OBJECT
2378+public:
2379+ friend class StelActionMgr;
2380+ Q_PROPERTY(bool checked READ isChecked WRITE setChecked NOTIFY toggled)
2381+
2382+ //! Don't use this constructor, this is just there to ease the migration from QAction.
2383+ StelAction(QObject *parent): QObject(parent) {}
2384+
2385+ StelAction(const QString& actionId,
2386+ const QString& groupId,
2387+ const QString& text,
2388+ const QString& primaryKey="",
2389+ const QString& altKey="",
2390+ bool global=false);
2391+ //! Connect the action to an object property or slot.
2392+ //! @param slot A property or a slot name. The slot can either have the signature `func()`, and in that
2393+ //! case the action is made not checkable, either have the signature `func(bool)` and in that case the action
2394+ //! is made checkable. When linked to a property the action is always made checkable.
2395+ void connectToObject(QObject* obj, const char* slot);
2396+ //! Don't use setCheckable, connectToObject can automatically determine if the action is checkable or not.
2397+ //! This is just there to ease the migration from QAction.
2398+ void setCheckable(bool value) {checkable = value;}
2399+ bool isCheckable() const {return checkable;}
2400+ bool isChecked() const {return checked;}
2401+ void setShortcut(const QString& key);
2402+ void setAltShortcut(const QString& key);
2403+ QKeySequence::SequenceMatch matches(const QKeySequence& seq) const;
2404+
2405+ QString getId() const {return objectName();}
2406+ QString getGroup() const {return group;}
2407+ const QKeySequence getShortcut() const {return keySequence;}
2408+ const QKeySequence getAltShortcut() const {return altKeySequence;}
2409+ const QString& getText() const {return text;}
2410+ void setText(const QString& value) {text = value;}
2411+signals:
2412+ void toggled(bool);
2413+ void triggered();
2414+public slots:
2415+ void setChecked(bool);
2416+ void trigger();
2417+ void toggle();
2418+private slots:
2419+ void propertyChanged(bool);
2420+private:
2421+ bool checkable;
2422+ bool checked;
2423+ QString group;
2424+ QString text;
2425+ bool global;
2426+ QKeySequence keySequence;
2427+ QKeySequence altKeySequence;
2428+ const QKeySequence defaultKeySequence;
2429+ const QKeySequence defaultAltKeySequence;
2430+ QObject* target;
2431+ const char* property;
2432+};
2433+
2434+class StelActionMgr : public QObject
2435+{
2436+ Q_OBJECT
2437+public:
2438+ StelActionMgr();
2439+ ~StelActionMgr();
2440+ //! Create and add a new StelAction, connected to an object property or slot.
2441+ //! @param id Global identifier.
2442+ //! @param groupId Group identifier.
2443+ //! @param text Short human-readable description in English.
2444+ //! @param shortcut Default shortcut.
2445+ //! @param target The QObject the action is linked to.
2446+ //! @param slot Either a slot name, in that case the action is not checkable,
2447+ //! either a property name, in that case the action is checkable.
2448+ StelAction* addAction(const QString& id, const QString& groupId, const QString& text,
2449+ QObject* target, const char* slot,
2450+ const QString& shortcut="", const QString& altShortcut="",
2451+ bool global=false);
2452+ StelAction* findAction(const QString& id);
2453+ bool pushKey(int key, bool global=false);
2454+
2455+ QStringList getGroupList() const;
2456+ QList<StelAction*> getActionList(const QString& group) const;
2457+
2458+ //! Save current shortcuts to file.
2459+ void saveShortcuts();
2460+ //! Restore the default shortcuts combinations
2461+ void restoreDefaultShortcuts();
2462+
2463+public slots:
2464+ //! Enable/disable all actions of application.
2465+ //! need for editing shortcuts without trigging any actions
2466+ //! @todo find out if this is really necessary and why.
2467+ void setAllActionsEnabled(bool value) {actionsEnabled = value;}
2468+private:
2469+ bool actionsEnabled;
2470+ QList<int> keySequence;
2471+};
2472
2473=== modified file 'src/core/StelApp.cpp'
2474--- src/core/StelApp.cpp 2013-09-23 20:24:50 +0000
2475+++ src/core/StelApp.cpp 2013-09-27 03:38:50 +0000
2476@@ -36,13 +36,13 @@
2477 #include "StelIniParser.hpp"
2478 #include "StelProjector.hpp"
2479 #include "StelLocationMgr.hpp"
2480+#include "StelActionMgr.hpp"
2481
2482 #include "StelProgressController.hpp"
2483 #include "StelModuleMgr.hpp"
2484 #include "StelLocaleMgr.hpp"
2485 #include "StelSkyCultureMgr.hpp"
2486 #include "StelFileMgr.hpp"
2487-#include "StelShortcutMgr.hpp"
2488 #include "StelJsonParser.hpp"
2489 #include "StelSkyLayerMgr.hpp"
2490 #include "StelAudioMgr.hpp"
2491@@ -195,7 +195,7 @@
2492 textureMgr=NULL;
2493 moduleMgr=NULL;
2494 networkAccessManager=NULL;
2495- shortcutMgr = NULL;
2496+ actionMgr = NULL;
2497
2498 // Can't create 2 StelApp instances
2499 Q_ASSERT(!singleton);
2500@@ -231,7 +231,7 @@
2501 delete textureMgr; textureMgr=NULL;
2502 delete planetLocationMgr; planetLocationMgr=NULL;
2503 delete moduleMgr; moduleMgr=NULL; // Delete the secondary instance
2504- delete shortcutMgr; shortcutMgr = NULL;
2505+ delete actionMgr; actionMgr = NULL;
2506
2507 Q_ASSERT(singleton);
2508 singleton = NULL;
2509@@ -355,7 +355,7 @@
2510 localeMgr = new StelLocaleMgr();
2511 skyCultureMgr = new StelSkyCultureMgr();
2512 planetLocationMgr = new StelLocationMgr();
2513- shortcutMgr = new StelShortcutMgr();
2514+ actionMgr = new StelActionMgr();
2515
2516 localeMgr->init();
2517
2518@@ -432,6 +432,9 @@
2519 setupHttpProxy();
2520 updateI18n();
2521
2522+ // Init actions.
2523+ actionMgr->addAction("actionShow_Night_Mode", "Display Options", "Night mode", this, "nightMode");
2524+
2525 initialized = true;
2526 }
2527
2528@@ -620,6 +623,15 @@
2529 void StelApp::handleKeys(QKeyEvent* event)
2530 {
2531 event->setAccepted(false);
2532+ // First try to trigger a shortcut.
2533+ if (event->type() == QEvent::KeyPress)
2534+ {
2535+ if (getStelActionManager()->pushKey(event->key() + event->modifiers()))
2536+ {
2537+ event->setAccepted(true);
2538+ return;
2539+ }
2540+ }
2541 // Send the event to every StelModule
2542 foreach (StelModule* i, moduleMgr->getCallOrders(StelModule::ActionHandleKeys))
2543 {
2544
2545=== modified file 'src/core/StelApp.hpp'
2546--- src/core/StelApp.hpp 2013-09-09 23:21:42 +0000
2547+++ src/core/StelApp.hpp 2013-09-27 03:38:50 +0000
2548@@ -43,6 +43,7 @@
2549 class StelGuiBase;
2550 class StelMainScriptAPIProxy;
2551 class StelScriptMgr;
2552+class StelActionMgr;
2553 class StelProgressController;
2554
2555 //! @class StelApp
2556@@ -59,6 +60,7 @@
2557 class StelApp : public QObject
2558 {
2559 Q_OBJECT
2560+ Q_PROPERTY(bool nightMode READ getVisionModeNight WRITE setVisionModeNight)
2561
2562 public:
2563 friend class StelAppGraphicsWidget;
2564@@ -115,8 +117,8 @@
2565 //! Get the audio manager
2566 StelAudioMgr* getStelAudioMgr() {return audioMgr;}
2567
2568- //! Get the shortcuts manager to use for managing and editing shortcuts
2569- StelShortcutMgr* getStelShortcutManager() {return shortcutMgr;}
2570+ //! Get the actions manager to use for managing and editing actions
2571+ StelActionMgr* getStelActionManager() {return actionMgr;}
2572
2573 //! Get the video manager
2574 StelVideoMgr* getStelVideoMgr() {return videoMgr;}
2575@@ -237,8 +239,8 @@
2576 // Sky cultures manager for the application
2577 StelSkyCultureMgr* skyCultureMgr;
2578
2579- //Shortcuts manager for the application
2580- StelShortcutMgr* shortcutMgr;
2581+ //Actions manager fot the application. Will replace shortcutMgr.
2582+ StelActionMgr* actionMgr;
2583
2584 // Textures manager for the application
2585 StelTextureMgr* textureMgr;
2586
2587=== modified file 'src/core/StelCore.cpp'
2588--- src/core/StelCore.cpp 2013-09-07 14:40:59 +0000
2589+++ src/core/StelCore.cpp 2013-09-27 03:38:50 +0000
2590@@ -36,6 +36,7 @@
2591 #include "SolarSystem.hpp"
2592 #include "LandscapeMgr.hpp"
2593 #include "StelTranslator.hpp"
2594+#include "StelActionMgr.hpp"
2595
2596 #include <QSettings>
2597 #include <QDebug>
2598@@ -150,6 +151,53 @@
2599
2600 QString tmpstr = conf->value("projection/type", "ProjectionStereographic").toString();
2601 setCurrentProjectionTypeKey(tmpstr);
2602+
2603+ // Register all the core actions.
2604+ QString timeGroup = N_("Date and Time");
2605+ StelActionMgr* actionsMgr = StelApp::getInstance().getStelActionManager();
2606+ actionsMgr->addAction("actionIncrease_Time_Speed", timeGroup, N_("Increase time speed"), this, "increaseTimeSpeed()", "L");
2607+ actionsMgr->addAction("actionDecrease_Time_Speed", timeGroup, N_("Decrease time speed"), this, "decreaseTimeSpeed()", "J");
2608+ actionsMgr->addAction("actionIncrease_Time_Speed_Less", timeGroup, N_("Increase time speed (a little)"), this, "increaseTimeSpeedLess()", "Shift+L");
2609+ actionsMgr->addAction("actionDecrease_Time_Speed_Less", timeGroup, N_("Decrease time speed (a little)"), this, "decreaseTimeSpeedLess()", "Shift+J");
2610+ actionsMgr->addAction("actionSet_Real_Time_Speed", timeGroup, N_("Set normal time rate"), this, "toggleRealTimeSpeed()", "K");
2611+ actionsMgr->addAction("actionSet_Time_Rate_Zero", timeGroup, N_("Set time rate to zero"), this, "setZeroTimeSpeed()", "7");
2612+ actionsMgr->addAction("actionReturn_To_Current_Time", timeGroup, N_("Set time to now"), this, "setTimeNow()", "8");
2613+ actionsMgr->addAction("actionAdd_Solar_Hour", timeGroup, N_("Add 1 solar hour"), this, "addHour()", "Ctrl+=");
2614+ actionsMgr->addAction("actionAdd_Solar_Day", timeGroup, N_("Add 1 solar day"), this, "addDay()", "=");
2615+ actionsMgr->addAction("actionAdd_Solar_Week", timeGroup, N_("Add 1 solar week"), this, "addWeek()", "]");
2616+ actionsMgr->addAction("actionSubtract_Solar_Hour", timeGroup, N_("Subtract 1 solar hour"), this, "subtractHour()", "Ctrl+-");
2617+ actionsMgr->addAction("actionSubtract_Solar_Day", timeGroup, N_("Subtract 1 solar day"), this, "subtractDay()", "-");
2618+ actionsMgr->addAction("actionSubtract_Solar_Week", timeGroup, N_("Subtract 1 solar week"), this, "subtractWeek()", "[");
2619+ actionsMgr->addAction("actionAdd_Sidereal_Day", timeGroup, N_("Add 1 sidereal day"), this, "addSiderealDay()", "Alt+=");
2620+ actionsMgr->addAction("actionAdd_Sidereal_Week", timeGroup, N_("Add 1 sidereal week"), this, "addSiderealWeek()", "Alt+]");
2621+ actionsMgr->addAction("actionAdd_Sidereal_Month", timeGroup, N_("Add 1 sidereal month"), this, "addSiderealMonth()", "Alt+Shift+]");
2622+ actionsMgr->addAction("actionAdd_Sidereal_Year", timeGroup, N_("Add 1 sidereal year"), this, "addSiderealYear()", "Ctrl+Alt+Shift+]");
2623+ actionsMgr->addAction("actionAdd_Sidereal_Century", timeGroup, N_("Add 1 sidereal century"), this, "addSiderealCentury()");
2624+ actionsMgr->addAction("actionAdd_Synodic_Month", timeGroup, N_("Add 1 synodic month"), this, "addSynodicMonth()");
2625+ actionsMgr->addAction("actionAdd_Draconic_Month", timeGroup, N_("Add 1 draconic month"), this, "addDraconicMonth()");
2626+ actionsMgr->addAction("actionAdd_Draconic_Year", timeGroup, N_("Add 1 draconic year"), this, "addDraconicYear()");
2627+ actionsMgr->addAction("actionAdd_Anomalistic_Month", timeGroup, N_("Add 1 anomalistic month"), this, "addAnomalisticMonth()");
2628+ actionsMgr->addAction("actionAdd_Tropical_Month", timeGroup, N_("Add 1 mean tropical month"), this, "addTropicalMonth()");
2629+ actionsMgr->addAction("actionAdd_Tropical_Year", timeGroup, N_("Add 1 mean tropical year"), this, "addTropicalYear()");
2630+ actionsMgr->addAction("actionAdd_Tropical_Century", timeGroup, N_("Add 1 mean tropical century"), this, "addTropicalCentury()");
2631+ actionsMgr->addAction("actionSubtract_Sidereal_Day", timeGroup, N_("Subtract 1 sidereal day"), this, "subtractSiderealDay()", "Alt+-");
2632+ actionsMgr->addAction("actionSubtract_Sidereal_Week", timeGroup, N_("Subtract 1 sidereal week"), this, "subtractSiderealWeek()", "Alt+[");
2633+ actionsMgr->addAction("actionSubtract_Sidereal_Month", timeGroup, N_("Subtract 1 sidereal month"), this, "subtractSiderealMonth()", "Alt+Shift+[");
2634+ actionsMgr->addAction("actionSubtract_Sidereal_Year", timeGroup, N_("Subtract 1 sidereal year"), this, "subtractSiderealYear()", "Ctrl+Alt+Shift+[");
2635+ actionsMgr->addAction("actionSubtract_Sidereal_Century", timeGroup, N_("Subtract 1 sidereal century"), this, "subtractSiderealCentury()");
2636+ actionsMgr->addAction("actionSubtract_Synodic_Month", timeGroup, N_("Subtract 1 synodic month"), this, "subtractSynodicMonth()");
2637+ actionsMgr->addAction("actionSubtract_Draconic_Month", timeGroup, N_("Subtract 1 draconic month"), this, "subtractDraconicMonth()");
2638+ actionsMgr->addAction("actionSubtract_Draconic_Year", timeGroup, N_("Subtract 1 draconic year"), this, "subtractDraconicYear()");
2639+ actionsMgr->addAction("actionSubtract_Anomalistic_Month", timeGroup, N_("Subtract 1 anomalistic month"), this, "subtractAnomalisticMonth()");
2640+ actionsMgr->addAction("actionSubtract_Tropical_Month", timeGroup, N_("Subtract 1 mean tropical month"), this, "subtractTropicalMonth()");
2641+ actionsMgr->addAction("actionSubtract_Tropical_Year", timeGroup, N_("Subtract 1 mean tropical year"), this, "subtractTropicalYear()");
2642+ actionsMgr->addAction("actionSubtract_Tropical_Century", timeGroup, N_("Subtract 1 mean tropical century"), this, "subtractTropicalCentury()");
2643+
2644+ actionsMgr->addAction("actionSet_Home_Planet_To_Selected", N_("Movement and Selection"), N_("Set home planet to selected planet"), this, "moveObserverToSelected()", "Ctrl+G");
2645+ actionsMgr->addAction("actionGo_Home_Global", N_("Movement and Selection"), N_("Go to home"), this, "returnToHome()", "Ctrl+H");
2646+ actionsMgr->addAction("actionHorizontal_Flip", N_("Display Options"), N_("Flip scene horizontally"), this, "flipHorz", "Ctrl+Shift+H", "", true);
2647+ actionsMgr->addAction("actionVertical_Flip", N_("Display Options"), N_("Flip scene vertically"), this, "flipVert", "Ctrl+Shift+V", "", true);
2648+
2649 }
2650
2651
2652
2653=== modified file 'src/core/StelCore.hpp'
2654--- src/core/StelCore.hpp 2013-09-07 14:40:59 +0000
2655+++ src/core/StelCore.hpp 2013-09-27 03:38:50 +0000
2656@@ -48,6 +48,8 @@
2657 Q_OBJECT
2658 Q_ENUMS(ProjectionType)
2659 Q_ENUMS(DeltaTAlgorithm)
2660+ Q_PROPERTY(bool flipHorz READ getFlipHorz WRITE setFlipHorz)
2661+ Q_PROPERTY(bool flipVert READ getFlipVert WRITE setFlipVert)
2662
2663 public:
2664 //! @enum FrameType
2665
2666=== modified file 'src/core/StelModule.cpp'
2667--- src/core/StelModule.cpp 2013-08-24 21:33:23 +0000
2668+++ src/core/StelModule.cpp 2013-09-27 03:38:50 +0000
2669@@ -18,6 +18,8 @@
2670 */
2671
2672 #include "StelModule.hpp"
2673+#include "StelApp.hpp"
2674+#include "StelActionMgr.hpp"
2675
2676 /*************************************************************************
2677 Get the version of the module, default is stellarium main version
2678@@ -32,3 +34,12 @@
2679 draw(core);
2680 return false;
2681 }
2682+
2683+class StelAction* StelModule::addAction(const QString& id, const QString& groupId, const QString& text,
2684+ QObject* target, const char* slot,
2685+ const QString& shortcut, const QString& altShortcut)
2686+{
2687+ StelActionMgr* mgr = StelApp::getInstance().getStelActionManager();
2688+ return mgr->addAction(id, groupId, text, target, slot, shortcut, altShortcut);
2689+}
2690+
2691
2692=== modified file 'src/core/StelModule.hpp'
2693--- src/core/StelModule.hpp 2013-09-02 13:48:13 +0000
2694+++ src/core/StelModule.hpp 2013-09-27 03:38:50 +0000
2695@@ -136,6 +136,20 @@
2696 //! @param show if true, make the configuration GUI visible. If false, hide the config GUI if there is one.
2697 //! @return true if the module has a configuration GUI, else false.
2698 virtual bool configureGui(bool show=true) {Q_UNUSED(show); return false;}
2699+
2700+protected:
2701+
2702+ //! convenience methods to add an action to the StelActionMgr object.
2703+ class StelAction* addAction(const QString& id, const QString& groupId, const QString& text,
2704+ QObject* target, const char* slot,
2705+ const QString& shortcut="", const QString& altShortcut="");
2706+
2707+ //! convenience methods to add an action to the StelActionMgr object.
2708+ class StelAction* addAction(const QString& id, const QString& groupId, const QString& text,
2709+ const char* slot,
2710+ const QString& shortcut="", const QString& altShortcut="") {
2711+ return addAction(id, groupId, text, this, slot, shortcut, altShortcut);
2712+ }
2713 };
2714
2715 Q_DECLARE_METATYPE(StelModule::StelModuleSelectAction)
2716
2717=== modified file 'src/core/StelMovementMgr.cpp'
2718--- src/core/StelMovementMgr.cpp 2012-04-10 23:00:24 +0000
2719+++ src/core/StelMovementMgr.cpp 2013-09-27 03:38:50 +0000
2720@@ -23,6 +23,7 @@
2721 #include "StelApp.hpp"
2722 #include "StelCore.hpp"
2723 #include "StelUtils.hpp"
2724+#include "StelTranslator.hpp"
2725
2726 #include <QString>
2727 #include <QTextStream>
2728@@ -100,6 +101,12 @@
2729 setMountMode(StelMovementMgr::MountEquinoxEquatorial);
2730 }
2731 }
2732+
2733+ addAction("actionSwitch_Equatorial_Mount", N_("Miscellaneous"), N_("Switch between equatorial and azimuthal mount"), "equatorialMount", "Ctrl+M");
2734+ addAction("actionGoto_Selected_Object", N_("Movement and Selection"), N_("Center on selected object"), "setFlagTracking()", "Space");
2735+ addAction("actionZoom_In_Auto", N_("Movement and Selection"), N_("Zoom in on selected object"), "autoZoomIn()", "/");
2736+ addAction("actionZoom_Out_Auto", N_("Movement and Selection"), N_("Zoom out"), "autoZoomOut()", "\\");
2737+ addAction("actionSet_Tracking", N_("Movement and Selection"), N_("Track object"), "tracking", "T");
2738 }
2739
2740 void StelMovementMgr::setMountMode(MountMode m)
2741
2742=== modified file 'src/core/StelMovementMgr.hpp'
2743--- src/core/StelMovementMgr.hpp 2013-08-24 21:33:23 +0000
2744+++ src/core/StelMovementMgr.hpp 2013-09-27 03:38:50 +0000
2745@@ -29,7 +29,12 @@
2746 class StelMovementMgr : public StelModule
2747 {
2748 Q_OBJECT
2749-
2750+ Q_PROPERTY(bool equatorialMount
2751+ READ getEquatorialMount
2752+ WRITE setEquatorialMount)
2753+ Q_PROPERTY(bool tracking
2754+ READ getFlagTracking
2755+ WRITE setFlagTracking)
2756 public:
2757
2758 //! Possible mount modes defining the reference frame in which head movements occur.
2759@@ -194,6 +199,7 @@
2760 void setMountMode(MountMode m);
2761 //! Get current mount type defining the reference frame in which head movements occur.
2762 MountMode getMountMode(void) const {return mountMode;}
2763+ bool getEquatorialMount(void) const {return mountMode == MountEquinoxEquatorial;}
2764
2765 void setDragTimeMode(bool b) {dragTimeMode=b;}
2766 bool getDragTimeMode() const {return dragTimeMode;}
2767
2768=== removed file 'src/core/StelShortcutGroup.cpp'
2769--- src/core/StelShortcutGroup.cpp 2013-09-02 13:58:06 +0000
2770+++ src/core/StelShortcutGroup.cpp 1970-01-01 00:00:00 +0000
2771@@ -1,274 +0,0 @@
2772-/*
2773- * Stellarium
2774- * Copyright (C) 2012 Anton Samoylov
2775- *
2776- * This program is free software; you can redistribute it and/or
2777- * modify it under the terms of the GNU General Public License
2778- * as published by the Free Software Foundation; either version 2
2779- * of the License, or (at your option) any later version.
2780- *
2781- * This program is distributed in the hope that it will be useful,
2782- * but WITHOUT ANY WARRANTY; without even the implied warranty of
2783- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2784- * GNU General Public License for more details.
2785- *
2786- * You should have received a copy of the GNU General Public License
2787- * along with this program; if not, write to the Free Software
2788- * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
2789- */
2790-
2791-#include "StelApp.hpp"
2792-#include "StelShortcutGroup.hpp"
2793-#include "StelMainView.hpp"
2794-#include "StelTranslator.hpp"
2795-#ifndef DISABLE_SCRIPTING
2796-#include "StelScriptMgr.hpp"
2797-#endif
2798-#include "StelFileMgr.hpp"
2799-
2800-#include <QDebug>
2801-
2802-
2803-StelShortcut::StelShortcut(const QString &id,
2804- StelShortcutGroup* group,
2805- const QString &text,
2806- const QString &primaryKey,
2807- const QString &altKey,
2808- bool checkable,
2809- bool autoRepeat,
2810- bool global,
2811- QWidget *parent) :
2812- m_id(id), m_temporary(false)
2813-{
2814- parent = parent ?: &StelMainView::getInstance();
2815- m_action = new QAction(parent);
2816- m_action->setObjectName(id);
2817- m_group = group;
2818-
2819- setText(text);
2820- setPrimaryKey(primaryKey);
2821- setAltKey(altKey);
2822- setCheckable(checkable);
2823- setAutoRepeat(autoRepeat);
2824- setGlobal(global);
2825-
2826- parent->addAction(m_action);
2827-}
2828-
2829-StelShortcut::~StelShortcut()
2830-{
2831- delete m_action; m_action = NULL;
2832-}
2833-
2834-QVariant StelShortcut::toQVariant() const
2835-{
2836- QVariantMap resMap;
2837- resMap["text"] = QVariant(m_text);
2838- resMap["primaryKey"] = QVariant(m_primaryKey.toString());
2839- resMap["altKey"] = QVariant(m_altKey.toString());
2840- resMap["checkable"] = QVariant(m_checkable);
2841- resMap["autorepeat"] = QVariant(m_autoRepeat);
2842- resMap["global"] = QVariant(m_global);
2843- if (!m_scriptFile.isEmpty())
2844- {
2845- resMap["scriptFile"] = QVariant(m_scriptFile);
2846- }
2847- // store script text only if no script filepath specified
2848- else if (!m_script.isEmpty())
2849- {
2850- resMap["script"] = QVariant(m_script);
2851- }
2852- return QVariant(resMap);
2853-}
2854-
2855-void StelShortcut::setText(const QString &text)
2856-{
2857- m_text = text;
2858- m_action->setText(text);
2859- m_action->setProperty("englishText", QVariant(text));
2860- emit shortcutChanged(this);
2861-}
2862-
2863-void StelShortcut::setPrimaryKey(const QKeySequence &key)
2864-{
2865- m_primaryKey = key;
2866- updateActionShortcuts();
2867- emit shortcutChanged(this);
2868-}
2869-
2870-void StelShortcut::setAltKey(const QKeySequence &key)
2871-{
2872- m_altKey = key;
2873- updateActionShortcuts();
2874- emit shortcutChanged(this);
2875-}
2876-
2877-void StelShortcut::setCheckable(bool c)
2878-{
2879- m_checkable = c;
2880- m_action->setCheckable(c);
2881- emit shortcutChanged(this);
2882-}
2883-
2884-void StelShortcut::setAutoRepeat(bool ar)
2885-{
2886- m_autoRepeat = ar;
2887- m_action->setAutoRepeat(ar);
2888- emit shortcutChanged(this);
2889-}
2890-
2891-void StelShortcut::setGlobal(bool g)
2892-{
2893- m_global = g;
2894- if (g)
2895- {
2896- m_action->setShortcutContext(Qt::ApplicationShortcut);
2897- }
2898- else
2899- {
2900- m_action->setShortcutContext(Qt::WidgetShortcut);
2901- }
2902- emit shortcutChanged(this);
2903-}
2904-
2905-void StelShortcut::setTemporary(bool temp)
2906-{
2907- m_temporary = temp;
2908- emit shortcutChanged(this);
2909-}
2910-
2911-#ifndef DISABLE_SCRIPTING
2912-void StelShortcut::setScript(const QString &scriptText)
2913-{
2914- QString scriptsDir = StelFileMgr::findFile("scripts/", StelFileMgr::Directory);
2915- QString preprocessedScript;
2916- if (!StelApp::getInstance().getScriptMgr().preprocessScript(
2917- scriptText, preprocessedScript, scriptsDir))
2918- {
2919- qWarning() << "Failed to preprocess script " << m_script;
2920- return;
2921- }
2922- m_script = preprocessedScript;
2923- connect(m_action, SIGNAL(triggered()), this, SLOT(runScript()));
2924- emit shortcutChanged(this);
2925-}
2926-
2927-void StelShortcut::setScriptPath(const QString &scriptPath)
2928-{
2929- m_scriptFile = scriptPath;
2930- emit shortcutChanged(this);
2931-}
2932-
2933-void StelShortcut::runScript() const
2934-{
2935- StelApp::getInstance().getScriptMgr().runPreprocessedScript(m_script);
2936-}
2937-#endif
2938-
2939-void StelShortcut::updateActionShortcuts()
2940-{
2941- QList<QKeySequence> list;
2942- list << m_primaryKey << m_altKey;
2943- m_action->setShortcuts(list);
2944-}
2945-
2946-
2947-StelShortcutGroup::StelShortcutGroup(QString id, QString text) :
2948- m_id(id), m_text(text), m_enabled(true)
2949-{
2950-}
2951-
2952-StelShortcutGroup::~StelShortcutGroup()
2953-{
2954- foreach (StelShortcut* sh, m_shortcuts)
2955- {
2956- delete sh; sh = NULL;
2957- }
2958- m_shortcuts.clear();
2959-}
2960-
2961-QAction* StelShortcutGroup::registerAction(const QString &actionId, bool temporary, const QString &text, const QString &primaryKey,
2962- const QString &altKey, bool checkable, bool autoRepeat, bool global, QWidget *parent)
2963-{
2964- if (m_shortcuts.contains(actionId))
2965- {
2966- StelShortcut *shortcut = getShortcut(actionId);
2967- shortcut->setTemporary(temporary);
2968- shortcut->setText(text);
2969- shortcut->setPrimaryKey(primaryKey);
2970- shortcut->setAltKey(altKey);
2971- shortcut->setCheckable(checkable);
2972- shortcut->setAutoRepeat(autoRepeat);
2973- shortcut->setGlobal(global);
2974- return shortcut->getAction();
2975- }
2976- StelShortcut* newShortcut = new StelShortcut(actionId, this, text, primaryKey, altKey, checkable, autoRepeat, global, parent);
2977- connect(newShortcut, SIGNAL(shortcutChanged(StelShortcut*)), this, SIGNAL(shortcutChanged(StelShortcut*)));
2978- m_shortcuts[actionId] = newShortcut;
2979- return newShortcut->getAction();
2980-}
2981-
2982-QAction *StelShortcutGroup::getAction(const QString &actionId)
2983-{
2984- if (!m_shortcuts.contains(actionId))
2985- {
2986- //qDebug() << "Attempt to get non-existing shortcut by id: " << actionId << endl;
2987- return NULL;
2988- }
2989- return m_shortcuts[actionId]->getAction();
2990-}
2991-
2992-StelShortcut* StelShortcutGroup::getShortcut(const QString &id)
2993-{
2994- if (!m_shortcuts.contains(id))
2995- {
2996- qDebug() << "Attempt to get non-existing shortcut by id: " << id << endl;
2997- return NULL;
2998- }
2999- return m_shortcuts[id];
3000-}
3001-
3002-QList<StelShortcut *> StelShortcutGroup::getActionList() const
3003-{
3004- QList<StelShortcut*> res;
3005- foreach (StelShortcut* action, m_shortcuts)
3006- {
3007- res << action;
3008- }
3009- return res;
3010-}
3011-
3012-QVariant StelShortcutGroup::toQVariant() const
3013-{
3014- QVariantMap resMap;
3015- resMap["text"] = QVariant(m_text);
3016- resMap["pluginId"] = QVariant(m_pluginId);
3017- QVariantMap actionsMap;
3018- for (QMap<QString, StelShortcut*>::const_iterator it = m_shortcuts.begin(); it != m_shortcuts.end(); ++it)
3019- {
3020- StelShortcut* sc = it.value();
3021- if (!sc->isTemporary())
3022- {
3023- actionsMap[it.key()] = sc->toQVariant();
3024- }
3025-// else
3026-// qDebug() << shortcut->getGroup() << shortcut->getId()
3027-// << "is not added as temporary.";
3028- }
3029- resMap["actions"] = QVariant(actionsMap);
3030- return resMap;
3031-}
3032-
3033-void StelShortcutGroup::setEnabled(bool enable)
3034-{
3035- foreach (StelShortcut* sh, m_shortcuts)
3036- {
3037- sh->getAction()->setEnabled(enable);
3038- }
3039- m_enabled = enable;
3040-}
3041-
3042-void StelShortcutGroup::setPluginId(const QString &pluginId)
3043-{
3044- m_pluginId = pluginId;
3045-}
3046
3047=== removed file 'src/core/StelShortcutGroup.hpp'
3048--- src/core/StelShortcutGroup.hpp 2013-08-28 14:15:53 +0000
3049+++ src/core/StelShortcutGroup.hpp 1970-01-01 00:00:00 +0000
3050@@ -1,133 +0,0 @@
3051-/*
3052- * Stellarium
3053- * Copyright (C) 2012 Anton Samoylov
3054- *
3055- * This program is free software; you can redistribute it and/or
3056- * modify it under the terms of the GNU General Public License
3057- * as published by the Free Software Foundation; either version 2
3058- * of the License, or (at your option) any later version.
3059- *
3060- * This program is distributed in the hope that it will be useful,
3061- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3062- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3063- * GNU General Public License for more details.
3064- *
3065- * You should have received a copy of the GNU General Public License
3066- * along with this program; if not, write to the Free Software
3067- * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
3068- */
3069-
3070-#ifndef STELSHORTCUT_HPP
3071-#define STELSHORTCUT_HPP
3072-
3073-#include <QObject>
3074-#include <QMap>
3075-#include <QAction>
3076-
3077-QT_FORWARD_DECLARE_CLASS(StelShortcutGroup)
3078-
3079-class StelShortcut : public QObject
3080-{
3081- Q_OBJECT
3082-public:
3083- StelShortcut(const QString& id, StelShortcutGroup* group, const QString& text,
3084- const QString& primaryKey, const QString& altKey,
3085- bool checkable, bool autoRepeat = true, bool global = false, QWidget *parent = NULL);
3086-
3087- ~StelShortcut();
3088-
3089- QAction* getAction() const { return m_action; }
3090- StelShortcutGroup* getGroup() const { return m_group; }
3091-
3092- QString getId() const { return m_id; }
3093- QString getText() const { return m_text; }
3094- QKeySequence getPrimaryKey() const { return m_primaryKey; }
3095- QKeySequence getAltKey() const { return m_altKey; }
3096- bool isTemporary() const { return m_temporary; }
3097-
3098- QVariant toQVariant() const;
3099-
3100- void setText(const QString& text);
3101- void setPrimaryKey(const QKeySequence& key);
3102- void setAltKey(const QKeySequence& key);
3103- void setCheckable(bool c);
3104- void setAutoRepeat(bool ar);
3105- void setGlobal(bool g);
3106- void setTemporary(bool temp);
3107-#ifndef DISABLE_SCRIPTING
3108- void setScript(const QString& scriptText);
3109- void setScriptPath(const QString& scriptPath);
3110-#endif
3111-
3112-signals:
3113- void shortcutChanged(StelShortcut* shortcut);
3114-
3115-#ifndef DISABLE_SCRIPTING
3116-public slots:
3117- void runScript() const;
3118-#endif
3119-
3120-protected slots:
3121- void updateActionShortcuts();
3122-
3123-private:
3124- QAction* m_action;
3125- StelShortcutGroup* m_group;
3126-
3127- QString m_id;
3128- QString m_text;
3129- QKeySequence m_primaryKey;
3130- QKeySequence m_altKey;
3131- bool m_checkable;
3132- bool m_autoRepeat;
3133- bool m_global;
3134- // defines whether shortcut exists only in current session
3135- bool m_temporary;
3136- QString m_script;
3137- QString m_scriptFile;
3138-};
3139-
3140-
3141-
3142-class StelShortcutGroup : public QObject
3143-{
3144- Q_OBJECT
3145-public:
3146- StelShortcutGroup(QString id, QString text = "");
3147-
3148- ~StelShortcutGroup();
3149-
3150- QAction* registerAction(const QString& actionId, bool temporary, const QString& text, const QString& primaryKey,
3151- const QString& altKey, bool checkable, bool autoRepeat = true,
3152- bool global = false, QWidget *parent = 0);
3153-
3154- QAction* getAction(const QString &actionId);
3155- StelShortcut* getShortcut(const QString& id);
3156- QList<StelShortcut*> getActionList() const;
3157-
3158- QString getId() const { return m_id; }
3159- QString getText() const { return m_text; }
3160- QString getPluginId() const {return m_pluginId; }
3161- bool isEnabled() const { return m_enabled; }
3162-
3163- QVariant toQVariant() const;
3164-
3165-signals:
3166- void shortcutChanged(StelShortcut* shortcut);
3167-
3168-public slots:
3169- // enable/disable all actions of the group
3170- // need for editing shortcuts without trigging any actions
3171- void setEnabled(bool enable);
3172- void setPluginId(const QString& pluginId);
3173- // clear and delete all shortuts
3174-
3175-private:
3176- QString m_id;
3177- QString m_text;
3178- QString m_pluginId;
3179- bool m_enabled;
3180- QMap<QString, StelShortcut*> m_shortcuts;
3181-};
3182-
3183-#endif // STELSHORTCUT_HPP
3184
3185=== removed file 'src/core/StelShortcutMgr.cpp'
3186--- src/core/StelShortcutMgr.cpp 2013-09-22 19:42:45 +0000
3187+++ src/core/StelShortcutMgr.cpp 1970-01-01 00:00:00 +0000
3188@@ -1,424 +0,0 @@
3189-/*
3190- * Stellarium
3191- * Copyright (C) 2012 Anton Samoylov
3192- * Copyright (C) 2012 Bogdan Marinov
3193- *
3194- * This program is free software; you can redistribute it and/or
3195- * modify it under the terms of the GNU General Public License
3196- * as published by the Free Software Foundation; either version 2
3197- * of the License, or (at your option) any later version.
3198- *
3199- * This program is distributed in the hope that it will be useful,
3200- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3201- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3202- * GNU General Public License for more details.
3203- *
3204- * You should have received a copy of the GNU General Public License
3205- * along with this program; if not, write to the Free Software
3206- * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
3207- */
3208-
3209-#include "StelShortcutMgr.hpp"
3210-#include "StelJsonParser.hpp"
3211-#include "StelApp.hpp"
3212-#include "StelModuleMgr.hpp"
3213-#include "StelFileMgr.hpp"
3214-#include "StelMainView.hpp"
3215-#include "StelTranslator.hpp"
3216-#include "StelShortcutGroup.hpp"
3217-
3218-#include <QDateTime>
3219-#include <QAction>
3220-#include <QDebug>
3221-#include <QFileInfo>
3222-#include <QDir>
3223-
3224-StelShortcutMgr::StelShortcutMgr()
3225-{
3226-}
3227-
3228-StelShortcutMgr::~StelShortcutMgr()
3229-{
3230- foreach (StelShortcutGroup* group, shGroups)
3231- {
3232- delete group;
3233- group=NULL;
3234- }
3235-}
3236-
3237-QAction* StelShortcutMgr::addGuiAction(const QString& actionId,
3238- bool temporary,
3239- const QString& text,
3240- const QString& primaryKey,
3241- const QString& altKey,
3242- const QString& groupId,
3243- bool checkable,
3244- bool autoRepeat,
3245- bool global)
3246-{
3247- if (!shGroups.contains(groupId))
3248- {
3249- qWarning() << "Implicitly creating group " << groupId
3250- << "for action " << actionId << "; group text is empty";
3251- shGroups[groupId] = new StelShortcutGroup(groupId);
3252- }
3253- return shGroups[groupId]->registerAction(actionId,
3254- temporary,
3255- text,
3256- primaryKey,
3257- altKey,
3258- checkable,
3259- autoRepeat,
3260- global,
3261- NULL);
3262-}
3263-
3264-void StelShortcutMgr::changeActionPrimaryKey(const QString& actionId, const QString& groupId, QKeySequence newKey)
3265-{
3266- StelShortcut* shortcut = getShortcut(groupId, actionId);
3267- if (shortcut)
3268- shortcut->setPrimaryKey(newKey);
3269-}
3270-
3271-void StelShortcutMgr::changeActionAltKey(const QString& actionId, const QString& groupId, QKeySequence newKey)
3272-{
3273- StelShortcut* shortcut = getShortcut(groupId, actionId);
3274- if (shortcut)
3275- shortcut->setAltKey(newKey);
3276-}
3277-
3278-void StelShortcutMgr::setShortcutText(const QString &actionId, const QString &groupId, const QString &description)
3279-{
3280- StelShortcut* shortcut = getShortcut(groupId, actionId);
3281- if (shortcut)
3282- shortcut->setText(description);
3283-}
3284-
3285-QAction* StelShortcutMgr::getGuiAction(const QString& actionName)
3286-{
3287- QAction* a = StelMainView::getInstance().findChild<QAction*>(actionName);
3288- if (!a)
3289- {
3290- qWarning() << "Can't find action " << actionName;
3291- return NULL;
3292- }
3293- return a;
3294-}
3295-
3296-QAction* StelShortcutMgr::getAction(const QString& groupId,
3297- const QString& actionId)
3298-{
3299- StelShortcutGroup* group = shGroups.value(groupId, 0);
3300- if (group)
3301- return group->getAction(actionId);
3302- else
3303- return 0;
3304-}
3305-
3306-#ifndef DISABLE_SCRIPTING
3307-QAction *StelShortcutMgr::addScriptToAction(const QString &actionId, const QString &script, const QString& scriptPath)
3308-{
3309- StelShortcut* sc = 0;
3310- // firstly search in "Scripts" group, all the scripts actions should be there
3311- if (shGroups.contains("Scripts"))
3312- {
3313- sc = shGroups["Scripts"]->getShortcut(actionId);
3314- }
3315- // if required action not found in "Scripts" group, iterate over map of all groups, searching
3316- if (!sc)
3317- {
3318- for (QMap<QString, StelShortcutGroup*>::const_iterator it = shGroups.begin(); it != shGroups.end(); ++it)
3319- {
3320- sc = it.value()->getShortcut(actionId);
3321- }
3322- }
3323- if (sc)
3324- {
3325- sc->setScript(script);
3326- if (!scriptPath.isEmpty())
3327- {
3328- sc->setScriptPath(scriptPath);
3329- }
3330- return sc->getAction();
3331- }
3332- // else
3333- qWarning() << "Attempt to set script to non-existing action"
3334- << actionId;
3335- return NULL;
3336-}
3337-#endif
3338-
3339-QList<StelShortcutGroup *> StelShortcutMgr::getGroupList() const
3340-{
3341- return shGroups.values();
3342-}
3343-
3344-void StelShortcutMgr::setAllActionsEnabled(bool enable)
3345-{
3346- foreach (StelShortcutGroup* group, shGroups)
3347- {
3348- group->setEnabled(enable);
3349- }
3350-}
3351-
3352-StelShortcut* StelShortcutMgr::getShortcut(const QString& groupId,
3353- const QString& shId)
3354-{
3355- StelShortcutGroup* group = shGroups.value(groupId, 0);
3356- if (group)
3357- {
3358- StelShortcut* shortcut = group->getShortcut(shId);
3359- if (!shortcut)
3360- {
3361- qWarning() << "Can't find shortcut" << shId
3362- << "in group" << groupId;
3363- return 0;
3364- }
3365- return shortcut;
3366- }
3367- qWarning() << "Action group" << groupId << "does not exist: "
3368- << "Unable to find shortcut" << shId;
3369- return 0;
3370-}
3371-
3372-void StelShortcutMgr::addGroup(const QString &id, QString text, const QString &pluginId)
3373-{
3374- bool enabled = true;
3375- if (!pluginId.isEmpty())
3376- {
3377- // search for plugin
3378- StelModuleMgr::PluginDescriptor pluginDescriptor;
3379- bool found = false;
3380- foreach (StelModuleMgr::PluginDescriptor desc, StelApp::getInstance().getModuleMgr().getPluginsList())
3381- {
3382- if (desc.info.id == pluginId)
3383- {
3384- pluginDescriptor = desc;
3385- found = true;
3386- }
3387- }
3388- if (!found)
3389- {
3390- qWarning() << "Can't find plugin with id" << pluginId;
3391- }
3392- else
3393- {
3394- // if no text provided in file, get text from plugin descriptor
3395- if (text.isEmpty())
3396- {
3397- text = pluginDescriptor.info.displayedName;
3398- }
3399- // enable group only when plugin is enabled
3400- enabled = pluginDescriptor.loadAtStartup;
3401- }
3402- }
3403-
3404- // create group
3405- if (!shGroups.contains(id))
3406- {
3407- StelShortcutGroup* newGroup = new StelShortcutGroup(id, text);
3408- shGroups[id] = newGroup;
3409- connect(newGroup, SIGNAL(shortcutChanged(StelShortcut*)),
3410- this, SIGNAL(shortcutChanged(StelShortcut*)));
3411- }
3412-
3413- // applying group properties
3414- shGroups[id]->setEnabled(enabled);
3415- shGroups[id]->setPluginId(pluginId);
3416-}
3417-
3418-bool StelShortcutMgr::copyDefaultFile()
3419-{
3420- try
3421- {
3422- StelFileMgr::makeSureDirExistsAndIsWritable(StelFileMgr::getUserDir() + "/data/");
3423- QString shortcutsFileFullPath = StelFileMgr::getUserDir() + "/data/shortcuts.json";
3424- qDebug() << "Creating file" << QDir::toNativeSeparators(shortcutsFileFullPath);
3425- QString defaultPath = StelFileMgr::findFile("data/default_shortcuts.json");
3426- if (defaultPath.isEmpty())
3427- {
3428- qWarning() << "Could not create shortcuts file data/shortcuts.json.";
3429- return false;
3430- }
3431- QFile::copy(defaultPath, shortcutsFileFullPath);
3432- }
3433- catch (std::runtime_error& e)
3434- {
3435- qWarning() << "Could not create shortcuts file data/shortcuts.json. Error: " << e.what();
3436- return false;
3437- }
3438- return true;
3439-}
3440-
3441-bool StelShortcutMgr::loadShortcuts(const QString& filePath, bool overload)
3442-{
3443- QVariantMap groups;
3444- try
3445- {
3446- QFile* jsonFile = new QFile(filePath);
3447- jsonFile->open(QIODevice::ReadOnly);
3448- groups = StelJsonParser::parse(jsonFile->readAll()).toMap()["groups"].toMap();
3449- jsonFile->close();
3450- delete jsonFile;
3451- }
3452- catch (std::runtime_error& e)
3453- {
3454- qWarning() << "Error while parsing shortcuts file. Error: " << e.what();
3455- return false;
3456- }
3457- // parsing shortcuts groups from file
3458- for (QVariantMap::const_iterator group = groups.begin(); group != groups.end(); ++group)
3459- {
3460- QVariantMap groupMap = group.value().toMap();
3461- // parsing shortcuts' group properties
3462- QString groupId = group.key();
3463- // If no such keys exist, value() will return empty strings.
3464- QString groupText = groupMap.value("text").toString();
3465- QString pluginId = groupMap.value("pluginId").toString();
3466- // add group to map, if it doesn't exist
3467- if (!groupMap.contains(groupId))
3468- {
3469- addGroup(groupId, groupText, pluginId);
3470- }
3471- // parsing group's actions (shortcuts)
3472- QVariantMap actions = groupMap["actions"].toMap();
3473- for (QVariantMap::const_iterator action = actions.begin(); action != actions.end(); ++action)
3474- {
3475- QString actionId = action.key();
3476- // Skip exisiting actions if overloading is disabled
3477- if (!overload && getAction(groupId, actionId))
3478- {
3479- continue;
3480- }
3481-
3482- QVariantMap actionMap = action.value().toMap();
3483- QString text = actionMap.value("text").toString();
3484- QString primaryKey = actionMap["primaryKey"].toString();
3485- QString altKey = actionMap["altKey"].toString();
3486-
3487- // get behavior properties of shortcut
3488- // TODO: Why are actions considered checkable by default? --BM
3489- bool checkable = actionMap.value("checkable", true).toBool();
3490- bool autorepeat = actionMap.value("autorepeat", false).toBool();
3491- bool global = actionMap.value("global", true).toBool();
3492-
3493- // create & init shortcut
3494- addGuiAction(actionId, false, text, primaryKey, altKey,
3495- groupId, checkable, autorepeat, global);
3496-#ifndef DISABLE_SCRIPTING
3497- // set script if it exist
3498- QString script = actionMap.value("script").toString();
3499- if (!script.isEmpty())
3500- {
3501- addScriptToAction(actionId, script);
3502- }
3503- QString filePath = actionMap.value("scriptFile").toString();
3504- if (!filePath.isEmpty())
3505- {
3506- QString scriptFilePath = StelFileMgr::findFile(filePath);
3507- if (!QFileInfo(scriptFilePath).exists())
3508- {
3509- qWarning() << "Couldn't find script file" << QDir::toNativeSeparators(scriptFilePath)
3510- << "for shortcut" << actionId;
3511- }
3512- else
3513- {
3514- QFile scriptFile(scriptFilePath);
3515- if (scriptFile.open(QIODevice::ReadOnly))
3516- {
3517- QString code = QString(scriptFile.readAll());
3518- addScriptToAction(actionId, code, filePath);
3519- scriptFile.close();
3520- }
3521- }
3522- }
3523-#endif
3524- }
3525- }
3526- return true;
3527-}
3528-
3529-void StelShortcutMgr::loadShortcuts()
3530-{
3531- qDebug() << "Loading shortcuts...";
3532- QString shortcutsFilePath = StelFileMgr::getUserDir() + "/data/shortcuts.json";
3533- if (!StelFileMgr::exists(shortcutsFilePath))
3534- {
3535- qWarning() << "shortcuts.json doesn't exist, copying default...";
3536- if (!copyDefaultFile())
3537- {
3538- qWarning() << "Couldn't copy default shortcuts file, shortcuts aren't loaded";
3539- return;
3540- }
3541- }
3542- if (!loadShortcuts(shortcutsFilePath))
3543- {
3544- qWarning() << "Invalid shortcuts file, no shortcuts were loaded.";
3545- return;
3546- }
3547-
3548- // merge with default for getting actual shortcuts info
3549- QString defaultFilePath = StelFileMgr::getInstallationDir() + "/data/default_shortcuts.json";
3550- loadShortcuts(defaultFilePath);
3551-}
3552-
3553-void StelShortcutMgr::restoreDefaultShortcuts()
3554-{
3555- QString defaultPath = StelFileMgr::getInstallationDir() + "/data/default_shortcuts.json";
3556- if (!QFileInfo(defaultPath).exists())
3557- {
3558- qWarning() << "Default shortcuts file (" << QDir::toNativeSeparators(defaultPath)
3559- << ") doesn't exist, restore defaults failed.";
3560- return;
3561- }
3562-
3563- // Reload default shortcuts
3564- loadShortcuts(defaultPath, true);
3565-
3566- // save shortcuts to actual file
3567- saveShortcuts();
3568-}
3569-
3570-void StelShortcutMgr::saveShortcuts()
3571-{
3572- QString shortcutsFilePath = StelFileMgr::findFile(StelFileMgr::getUserDir() + "/data/shortcuts.json", StelFileMgr::Flags(StelFileMgr::File | StelFileMgr::Writable));
3573- if (shortcutsFilePath.isEmpty())
3574- {
3575- qWarning() << "Creating a new shortcuts.json file...";
3576- QString userDataPath = StelFileMgr::getUserDir() + "/data";
3577- if (!StelFileMgr::exists(userDataPath))
3578- {
3579- if (!StelFileMgr::mkDir(userDataPath))
3580- {
3581- qWarning() << "ERROR - cannot create non-existent data directory"
3582- << QDir::toNativeSeparators(userDataPath);
3583- qWarning() << "Shortcuts aren't' saved";
3584- return;
3585- }
3586- }
3587- }
3588-
3589- QFile shortcutsFile(shortcutsFilePath);
3590- if (!shortcutsFile.open(QIODevice::WriteOnly | QIODevice::Text))
3591- {
3592- qWarning() << "ERROR: Could not save shortcuts file"
3593- << QDir::toNativeSeparators(shortcutsFilePath);
3594- return;
3595- }
3596-
3597-// QTextStream stream(&shortcutsFile);
3598- saveShortcuts(&shortcutsFile);
3599- shortcutsFile.close();
3600- qDebug() << "New shortcuts file saved to" << QDir::toNativeSeparators(shortcutsFilePath);
3601-}
3602-
3603-void StelShortcutMgr::saveShortcuts(QIODevice* output) const
3604-{
3605- QVariantMap resMap, groupsMap;
3606- for(QMap<QString, StelShortcutGroup*>::const_iterator it = shGroups.begin(); it != shGroups.end(); ++it)
3607- {
3608- groupsMap[it.key()] = it.value()->toQVariant();
3609- }
3610- resMap["groups"] = QVariant(groupsMap);
3611- StelJsonParser::write(QVariant(resMap), output);
3612-}
3613
3614=== removed file 'src/core/StelShortcutMgr.hpp'
3615--- src/core/StelShortcutMgr.hpp 2013-08-31 15:34:40 +0000
3616+++ src/core/StelShortcutMgr.hpp 1970-01-01 00:00:00 +0000
3617@@ -1,131 +0,0 @@
3618-/*
3619- * Stellarium
3620- * Copyright (C) 2012 Anton Samoylov
3621- *
3622- * This program is free software; you can redistribute it and/or
3623- * modify it under the terms of the GNU General Public License
3624- * as published by the Free Software Foundation; either version 2
3625- * of the License, or (at your option) any later version.
3626- *
3627- * This program is distributed in the hope that it will be useful,
3628- * but WITHOUT ANY WARRANTY; without even the implied warranty of
3629- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3630- * GNU General Public License for more details.
3631- *
3632- * You should have received a copy of the GNU General Public License
3633- * along with this program; if not, write to the Free Software
3634- * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
3635- */
3636-
3637-#ifndef STELSHORTCUTMGR_HPP
3638-#define STELSHORTCUTMGR_HPP
3639-
3640-#include <QObject>
3641-#include <QAction>
3642-
3643-class StelShortcutGroup;
3644-class StelShortcut;
3645-class StelAppGraphicsWidget;
3646-
3647-//! Manager of the keyboard shortcuts tied to different features.
3648-//! At the moment, the vast majority of QActions used in Stellarium are
3649-//! defined in a JSON file copied to the user data directory on the first
3650-//! run, similar to the configuration file.
3651-class StelShortcutMgr : public QObject
3652-{
3653- Q_OBJECT
3654-public:
3655- StelShortcutMgr();
3656- ~StelShortcutMgr();
3657-
3658- //! Load shortcuts from an existing file.
3659- //! @param filePath full path to the file.
3660- //! @param overload if true, if a shortcut in the file already exists,
3661- //! replace its keys with the ones in the file.
3662- bool loadShortcuts(const QString& filePath, bool overload = false);
3663- //! Search for file with shortcuts, load shortcuts from it.
3664- void loadShortcuts();
3665-
3666- //! Save current shortcuts to file.
3667- void saveShortcuts();
3668-
3669- void saveShortcuts(QIODevice* output) const;
3670-
3671- //! Add a new action managed by the GUI.
3672- //! This method should be used to add new shortcuts to the program.
3673- //! @param text Short human-readable description in English.
3674- //! \ref translation_sec "Mark the string for translation"
3675- //! with the N_() macro and it will be translated when displayed
3676- //! in ShortcutsDialog or HelpDialog.
3677- //! @todo Add explanation of parameters.
3678- QAction* addGuiAction(const QString& actionId,
3679- bool temporary,
3680- const QString& text,
3681- const QString& primaryKey,
3682- const QString& altKey,
3683- const QString &groupId,
3684- bool checkable = true,
3685- bool autoRepeat = false,
3686- bool global = false);
3687-
3688- void changeActionPrimaryKey(const QString& actionId, const QString& groupId, QKeySequence newKey);
3689- void changeActionAltKey(const QString& actionId, const QString& groupId, QKeySequence newKey);
3690- void setShortcutText(const QString& actionId,
3691- const QString& groupId,
3692- const QString& description);
3693-
3694- //! Get a pointer to an action managed by the GUI.
3695- //! Directly queryies the StelAppGraphicsWidget instance
3696- //! for a child with the given name.
3697- //! @param actionName Qt object name for this action
3698- //! @return a pointer to the QAction object or NULL if doesn't exist
3699- QAction* getGuiAction(const QString& actionName);
3700-
3701-#ifndef DISABLE_SCRIPTING
3702- //! Bind script evaluation to given action.
3703- QAction* addScriptToAction(const QString& actionId, const QString& script, const QString& scriptAction = QString());
3704-#endif
3705-
3706- //! Get a list of all shortcut groups.
3707- QList<StelShortcutGroup*> getGroupList() const;
3708-
3709-signals:
3710- void shortcutChanged(StelShortcut* shortcut);
3711-
3712-public slots:
3713- //! Enable/disable all actions of application.
3714- //! need for editing shortcuts without trigging any actions
3715- //! @todo find out if this is really necessary and why.
3716- void setAllActionsEnabled(bool enable);
3717-
3718- //! Restore the default combinations by reloading and resaving.
3719- void restoreDefaultShortcuts();
3720-
3721-private:
3722- //! Copy the default shortcuts file to the user data directory.
3723- //! @returns true on success.
3724- bool copyDefaultFile();
3725-
3726- //! Get a QAction managed by this class.
3727- //! Searches shGroups.
3728- //! @returns null pointer if no such action is found.
3729- QAction* getAction(const QString& groupId, const QString& actionId);
3730- //! Get a StelShortcut managed by this class.
3731- //! Searches shGroups.
3732- //! @returns null pointer if no such shortcut is found.
3733- StelShortcut* getShortcut(const QString& groupId, const QString& shId);
3734- //! Create a new shortcut group.
3735- //! If the group name has been \ref translation_sec
3736- //! "marked for translation" (for example, with the N_() macro),
3737- //! it will be translated when displayed.
3738- //! @param id Group identifier.
3739- //! @param text Human-readable group name (in English).
3740- //! @param pluginId Plugin identifier if the group belongs to a plugin.
3741- void addGroup(const QString& id,
3742- QString text,
3743- const QString& pluginId = QString());
3744- //! Map of shortcut groups by ID.
3745- QMap<QString, StelShortcutGroup*> shGroups;
3746-};
3747-
3748-#endif // STELSHORTCUTMGR_HPP
3749
3750=== modified file 'src/core/StelSkyLayerMgr.cpp'
3751--- src/core/StelSkyLayerMgr.cpp 2013-09-22 19:42:45 +0000
3752+++ src/core/StelSkyLayerMgr.cpp 2013-09-27 03:38:50 +0000
3753@@ -28,6 +28,7 @@
3754 #include "MilkyWay.hpp"
3755 #include "StelGuiBase.hpp"
3756 #include "StelSkyDrawer.hpp"
3757+#include "StelTranslator.hpp"
3758 #include "StelProgressController.hpp"
3759
3760 #include <QNetworkAccessManager>
3761@@ -82,6 +83,8 @@
3762 }
3763 }
3764 conf->endGroup();
3765+
3766+ addAction("actionShow_DSS", "Display Options", N_("Deep-sky objects background images"), "visible", "I");
3767 }
3768
3769 QString StelSkyLayerMgr::insertSkyLayer(StelSkyLayerP tile, const QString& keyHint, bool ashow)
3770
3771=== modified file 'src/core/StelSkyLayerMgr.hpp'
3772--- src/core/StelSkyLayerMgr.hpp 2013-09-09 23:21:42 +0000
3773+++ src/core/StelSkyLayerMgr.hpp 2013-09-27 03:38:50 +0000
3774@@ -33,6 +33,7 @@
3775 class StelSkyLayerMgr : public StelModule
3776 {
3777 Q_OBJECT
3778+ Q_PROPERTY(bool visible READ getFlagShow WRITE setFlagShow)
3779
3780 public:
3781 StelSkyLayerMgr();
3782@@ -69,14 +70,14 @@
3783
3784 StelSkyLayerP getSkyLayer(const QString& key) const;
3785
3786+ //! Get whether Sky Background should be displayed
3787+ bool getFlagShow() const {return flagShow;}
3788+
3789 public slots:
3790 ///////////////////////////////////////////////////////////////////////////
3791 // Properties setters and getters
3792 //! Set whether Sky Background should be displayed
3793 void setFlagShow(bool b) {flagShow = b;}
3794- //! Get whether Sky Background should be displayed
3795- bool getFlagShow() const {return flagShow;}
3796-
3797 //! Load an image from a file. This should not be called directly from
3798 //! scripts because it is not thread safe. Instead use the simiarly
3799 //! named function in the core scripting object.
3800
3801=== modified file 'src/core/modules/ConstellationMgr.cpp'
3802--- src/core/modules/ConstellationMgr.cpp 2013-09-22 19:42:45 +0000
3803+++ src/core/modules/ConstellationMgr.cpp 2013-09-27 03:38:50 +0000
3804@@ -102,6 +102,11 @@
3805 connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
3806 connect(app, SIGNAL(skyCultureChanged(const QString&)), this, SLOT(updateSkyCulture(const QString&)));
3807 connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&)));
3808+
3809+ addAction("actionShow_Constellation_Lines", "Display Options", N_("Constellation lines"), "linesDisplayed", "C");
3810+ addAction("actionShow_Constellation_Art", "Display Options", N_("Constellation art"), "artDisplayed", "R");
3811+ addAction("actionShow_Constellation_Labels", "Display Options", N_("Constellation labels"), "namesDisplayed", "V");
3812+ addAction("actionShow_Constellation_Boundaries", "Display Options", N_("Constellation boundaries"), "boundariesDisplayed", "B");
3813 }
3814
3815 /*************************************************************************
3816
3817=== modified file 'src/core/modules/GridLinesMgr.cpp'
3818--- src/core/modules/GridLinesMgr.cpp 2013-09-06 05:25:05 +0000
3819+++ src/core/modules/GridLinesMgr.cpp 2013-09-27 03:38:50 +0000
3820@@ -688,6 +688,17 @@
3821 StelApp& app = StelApp::getInstance();
3822 connect(&app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&)));
3823 connect(&app, SIGNAL(languageChanged()), this, SLOT(updateLineLabels()));
3824+
3825+ addAction("actionShow_Equatorial_Grid", "Display Options", N_("Equatorial grid"), "equatorGridDisplayed", "E");
3826+ addAction("actionShow_Azimuthal_Grid", "Display Options", N_("Azimuthal grid"), "azimuthalGridDisplayed", "Z");
3827+ addAction("actionShow_Ecliptic_Line", "Display Options", N_("Ecliptic line"), "eclipticLineDisplayed", ",");
3828+ addAction("actionShow_Equator_Line", "Display Options", N_("Equator line"), "equatorLineDisplayed", ".");
3829+ addAction("actionShow_Meridian_Line", "Display Options", N_("Meridian line"), "meridianLineDisplayed", ";");
3830+ addAction("actionShow_Horizon_Line", "Display Options", N_("Horizon line"), "horizonLineDisplayed");
3831+ addAction("actionShow_Equatorial_J2000_Grid", "Display Options", N_("Equatorial J2000 grid"), "equatorJ2000GridDisplayed");
3832+ addAction("actionShow_Ecliptic_J2000_Grid", "Display Options", N_("Ecliptic J2000 grid"), "eclipticJ2000GridDisplayed");
3833+ addAction("actionShow_Galactic_Grid", "Display Options", N_("Galactic grid"), "galacticGridDisplayed");
3834+ addAction("actionShow_Galactic_Plane_Line", "Display Options", N_("Galactic plane"), "galacticPlaneLineDisplayed");
3835 }
3836
3837 void GridLinesMgr::update(double deltaTime)
3838
3839=== modified file 'src/core/modules/LandscapeMgr.cpp'
3840--- src/core/modules/LandscapeMgr.cpp 2013-09-23 20:24:50 +0000
3841+++ src/core/modules/LandscapeMgr.cpp 2013-09-27 03:38:50 +0000
3842@@ -29,6 +29,7 @@
3843
3844 #include <stdexcept>
3845
3846+#include "StelActionMgr.hpp"
3847 #include "LandscapeMgr.hpp"
3848 #include "Landscape.hpp"
3849 #include "Atmosphere.hpp"
3850@@ -309,6 +310,11 @@
3851 StelApp *app = &StelApp::getInstance();
3852 connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
3853 connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&)));
3854+
3855+ addAction("actionShow_Atmosphere", "Display Options", N_("Atmosphere"), "atmosphereDisplayed", "A");
3856+ addAction("actionShow_Fog", "Display Options", N_("Fog"), "fogDisplayed", "F");
3857+ addAction("actionShow_Cardinal_Points", "Display Options", N_("Cardinal points"), "cardinalsPointsDisplayed", "Q");
3858+ addAction("actionShow_Ground", "Display Options", N_("Ground"), "landscapeDisplayed", "G");
3859 }
3860
3861 void LandscapeMgr::setStelStyle(const QString& section)
3862
3863=== modified file 'src/core/modules/NebulaMgr.cpp'
3864--- src/core/modules/NebulaMgr.cpp 2013-09-22 20:28:42 +0000
3865+++ src/core/modules/NebulaMgr.cpp 2013-09-27 03:38:50 +0000
3866@@ -46,6 +46,7 @@
3867 #include "StelSkyImageTile.hpp"
3868 #include "StelPainter.hpp"
3869 #include "RefractionExtinction.hpp"
3870+#include "StelActionMgr.hpp"
3871
3872 void NebulaMgr::setLabelsColor(const Vec3f& c) {Nebula::labelColor = c;}
3873 const Vec3f &NebulaMgr::getLabelsColor(void) const {return Nebula::labelColor;}
3874@@ -118,6 +119,8 @@
3875 connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
3876 connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&)));
3877 GETSTELMODULE(StelObjectMgr)->registerStelObjectMgr(this);
3878+
3879+ addAction("actionShow_Nebulas", "Display Options", N_("Deep-sky objects"), "flagHintDisplayed", "D", "N");
3880 }
3881
3882 struct DrawNebulaFuncObject
3883
3884=== modified file 'src/core/modules/NebulaMgr.hpp'
3885--- src/core/modules/NebulaMgr.hpp 2013-08-24 21:33:23 +0000
3886+++ src/core/modules/NebulaMgr.hpp 2013-09-27 03:38:50 +0000
3887@@ -46,6 +46,9 @@
3888 class NebulaMgr : public StelObjectModule
3889 {
3890 Q_OBJECT
3891+ Q_PROPERTY(bool flagHintDisplayed
3892+ READ getFlagHints
3893+ WRITE setFlagHints)
3894
3895 public:
3896 NebulaMgr();
3897
3898=== modified file 'src/core/modules/SolarSystem.cpp'
3899--- src/core/modules/SolarSystem.cpp 2013-09-25 18:35:42 +0000
3900+++ src/core/modules/SolarSystem.cpp 2013-09-27 03:38:50 +0000
3901@@ -141,6 +141,10 @@
3902 StelApp *app = &StelApp::getInstance();
3903 connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
3904 connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&)));
3905+
3906+ addAction("actionShow_Planets_Labels", "Display Options", N_("Planet labels"), "labelsDisplayed", "P");
3907+ addAction("actionShow_Planets_Orbits", "Display Options", N_("Planet orbits"), "orbitsDisplayed", "O");
3908+ addAction("actionShow_Planets_Trails", "Display Options", N_("Planet trails"), "trailsDisplayed", "Shift+T");
3909 }
3910
3911 void SolarSystem::recreateTrails()
3912
3913=== modified file 'src/core/modules/SolarSystem.hpp'
3914--- src/core/modules/SolarSystem.hpp 2013-09-07 13:01:20 +0000
3915+++ src/core/modules/SolarSystem.hpp 2013-09-27 03:38:50 +0000
3916@@ -45,6 +45,15 @@
3917 class SolarSystem : public StelObjectModule
3918 {
3919 Q_OBJECT
3920+ Q_PROPERTY(bool labelsDisplayed
3921+ READ getFlagLabels
3922+ WRITE setFlagLabels)
3923+ Q_PROPERTY(bool orbitsDisplayed
3924+ READ getFlagOrbits
3925+ WRITE setFlagOrbits)
3926+ Q_PROPERTY(bool trailsDisplayed
3927+ READ getFlagTrails
3928+ WRITE setFlagTrails)
3929
3930 public:
3931 SolarSystem();
3932
3933=== modified file 'src/core/modules/StarMgr.cpp'
3934--- src/core/modules/StarMgr.cpp 2013-09-22 20:28:42 +0000
3935+++ src/core/modules/StarMgr.cpp 2013-09-27 03:38:50 +0000
3936@@ -333,6 +333,9 @@
3937 connect(app, SIGNAL(languageChanged()), this, SLOT(updateI18n()));
3938 connect(app, SIGNAL(skyCultureChanged(const QString&)), this, SLOT(updateSkyCulture(const QString&)));
3939 connect(app, SIGNAL(colorSchemeChanged(const QString&)), this, SLOT(setStelStyle(const QString&)));
3940+
3941+ addAction("actionShow_Stars", "Display Options", N_("Stars"), "flagStarsDisplayed", "S");
3942+ addAction("actionShow_Stars_Labels", "Display Options", N_("Stars labels"), "flagLabelsDisplayed", "Alt+S");
3943 }
3944
3945
3946
3947=== modified file 'src/core/modules/StarMgr.hpp'
3948--- src/core/modules/StarMgr.hpp 2013-09-02 14:00:25 +0000
3949+++ src/core/modules/StarMgr.hpp 2013-09-27 03:38:50 +0000
3950@@ -80,6 +80,12 @@
3951 class StarMgr : public StelObjectModule
3952 {
3953 Q_OBJECT
3954+ Q_PROPERTY(bool flagStarsDisplayed
3955+ READ getFlagStars
3956+ WRITE setFlagStars)
3957+ Q_PROPERTY(bool flagLabelsDisplayed
3958+ READ getFlagLabels
3959+ WRITE setFlagLabels)
3960
3961 public:
3962 StarMgr(void);
3963
3964=== modified file 'src/gui/ConfigurationDialog.cpp'
3965--- src/gui/ConfigurationDialog.cpp 2013-09-23 20:24:50 +0000
3966+++ src/gui/ConfigurationDialog.cpp 2013-09-27 03:38:50 +0000
3967@@ -30,6 +30,7 @@
3968 #include "StelLocaleMgr.hpp"
3969 #include "StelProjector.hpp"
3970 #include "StelObjectMgr.hpp"
3971+#include "StelActionMgr.hpp"
3972 #include "StelProgressController.hpp"
3973
3974 #include "StelCore.hpp"
3975@@ -328,13 +329,9 @@
3976
3977 void ConfigurationDialog::showShortcutsWindow()
3978 {
3979- QAction* action = gui->getGuiAction("actionShow_Shortcuts_Window_Global");
3980+ StelAction* action = StelApp::getInstance().getStelActionManager()->findAction("actionShow_Shortcuts_Window_Global");
3981 if (action)
3982- {
3983- if (action->isChecked())
3984- action->setChecked(false);
3985 action->setChecked(true);
3986- }
3987 }
3988
3989 void ConfigurationDialog::setDiskViewport(bool b)
3990
3991=== modified file 'src/gui/HelpDialog.cpp'
3992--- src/gui/HelpDialog.cpp 2013-08-30 22:42:40 +0000
3993+++ src/gui/HelpDialog.cpp 2013-09-27 03:38:50 +0000
3994@@ -42,15 +42,12 @@
3995 #include "StelGuiItems.hpp"
3996 #include "StelLocaleMgr.hpp"
3997 #include "StelLogger.hpp"
3998-#include "StelShortcutGroup.hpp"
3999-#include "StelShortcutMgr.hpp"
4000 #include "StelStyle.hpp"
4001+#include "StelActionMgr.hpp"
4002
4003-HelpDialog::HelpDialog() : keyMgr(0)
4004+HelpDialog::HelpDialog()
4005 {
4006 ui = new Ui_helpDialogForm;
4007- keyMgr = StelApp::getInstance().getStelShortcutManager();
4008- Q_ASSERT(keyMgr);
4009 }
4010
4011 HelpDialog::~HelpDialog()
4012@@ -121,14 +118,9 @@
4013
4014 void HelpDialog::showShortcutsWindow()
4015 {
4016- QAction* action =
4017- keyMgr->getGuiAction("actionShow_Shortcuts_Window_Global");
4018+ StelAction* action = StelApp::getInstance().getStelActionManager()->findAction("actionShow_Shortcuts_Window_Global");
4019 if (action)
4020- {
4021- if (action->isChecked())
4022- action->setChecked(false);
4023 action->setChecked(true);
4024- }
4025 }
4026
4027 void HelpDialog::updateLog(int)
4028@@ -190,39 +182,23 @@
4029 q_("Below are listed only the actions with assigned keys. Further actions may be available via the \"%1\" button.")
4030 .arg(ui->editShortcutsButton->text()).toHtmlEscaped() +
4031 "</p><table cellpadding=\"10%\">\n";
4032-
4033- QList<StelShortcutGroup*> groups = keyMgr->getGroupList();
4034- foreach (const StelShortcutGroup* group, groups)
4035+
4036+ // Append all StelAction shortcuts.
4037+ StelActionMgr* actionMgr = StelApp::getInstance().getStelActionManager();
4038+ typedef QPair<QString, QString> KeyDescription;
4039+ foreach (QString group, actionMgr->getGroupList())
4040 {
4041- QString groupName= group->getText();
4042- if (groupName.isEmpty())
4043- groupName = group->getId();
4044-
4045- QList< KeyDescription > descriptions;
4046- QList<StelShortcut*> shortcuts = group->getActionList();
4047- if (shortcuts.isEmpty())
4048- continue;
4049-
4050- foreach (const StelShortcut* shortcut, shortcuts)
4051+ QList<KeyDescription> descriptions;
4052+ foreach (StelAction* action, actionMgr->getActionList(group))
4053 {
4054- QString text = q_(shortcut->getText());
4055- QKeySequence primary = shortcut->getPrimaryKey();
4056- if (primary.isEmpty())
4057- {
4058- // TODO: Decide whether to display undefined actions.
4059+ if (action->getShortcut().isEmpty())
4060 continue;
4061- }
4062- QString keyString = primary.toString(QKeySequence::NativeText);
4063- descriptions.append(KeyDescription(text, keyString));
4064+ QString text = action->getText();
4065+ QString key = action->getShortcut().toString(QKeySequence::NativeText);
4066+ descriptions.append(KeyDescription(text, key));
4067 }
4068- if (descriptions.isEmpty())
4069- continue;
4070- // Sort by translated description:
4071- // - on one hand, pre-determined order is lost
4072- // - on the other, easier for the users
4073 qSort(descriptions);
4074-
4075- htmlText += "<tr></tr><tr><td><b><u>" + E(groupName) +
4076+ htmlText += "<tr></tr><tr><td><b><u>" + E(group) +
4077 ":</u></b></td></tr>\n";
4078 foreach (const KeyDescription& desc, descriptions)
4079 {
4080@@ -231,7 +207,7 @@
4081 "</b></td></tr>\n";
4082 }
4083 }
4084-
4085+
4086 // edit shortcuts
4087 // htmlText += "<tr><td><b>" + Qt::escape(q_("F7")) + "</b></td>";
4088 // htmlText += "<td>" + Qt::escape(q_("Show and edit all keyboard shortcuts")) + "</td></tr>\n";
4089
4090=== modified file 'src/gui/HelpDialog.hpp'
4091--- src/gui/HelpDialog.hpp 2012-10-30 16:12:04 +0000
4092+++ src/gui/HelpDialog.hpp 2013-09-27 03:38:50 +0000
4093@@ -22,15 +22,11 @@
4094
4095 #include <QString>
4096 #include <QObject>
4097-#include <QPair>
4098
4099 #include "StelDialog.hpp"
4100
4101 class Ui_helpDialogForm;
4102 class QListWidgetItem;
4103-class StelShortcutMgr;
4104-
4105-typedef QPair<QString, QString> KeyDescription;
4106
4107 class HelpDialog : public StelDialog
4108 {
4109@@ -71,8 +67,6 @@
4110 //! This function concatenates the header, key codes and footer to build
4111 //! up the help text.
4112 void updateText(void);
4113-
4114- StelShortcutMgr* keyMgr;
4115 };
4116
4117 #endif /*_HELPDIALOG_HPP_*/
4118
4119=== modified file 'src/gui/ShortcutsDialog.cpp'
4120--- src/gui/ShortcutsDialog.cpp 2013-08-25 09:08:37 +0000
4121+++ src/gui/ShortcutsDialog.cpp 2013-09-27 03:38:50 +0000
4122@@ -19,19 +19,16 @@
4123
4124 #include <QDialog>
4125 #include <QStandardItemModel>
4126+#include <QDebug>
4127
4128 #include "StelApp.hpp"
4129-#include "StelShortcutMgr.hpp"
4130 #include "StelTranslator.hpp"
4131-#include "StelShortcutGroup.hpp"
4132-
4133+#include "StelActionMgr.hpp"
4134 #include "ShortcutLineEdit.hpp"
4135 #include "ShortcutsDialog.hpp"
4136 #include "ui_shortcutsDialog.h"
4137
4138
4139-
4140-
4141 ShortcutsFilterModel::ShortcutsFilterModel(QObject* parent) :
4142 QSortFilterProxyModel(parent)
4143 {
4144@@ -67,7 +64,7 @@
4145 filterModel(new ShortcutsFilterModel(this)),
4146 mainModel(new QStandardItemModel(this))
4147 {
4148- shortcutMgr = StelApp::getInstance().getStelShortcutManager();
4149+ actionMgr = StelApp::getInstance().getStelActionManager();
4150 }
4151
4152 ShortcutsDialog::~ShortcutsDialog()
4153@@ -246,7 +243,7 @@
4154 polish();
4155 }
4156
4157-void ShortcutsDialog::applyChanges() const
4158+void ShortcutsDialog::applyChanges()
4159 {
4160 // get ids stored in tree
4161 QModelIndex index =
4162@@ -256,14 +253,14 @@
4163 index = index.sibling(index.row(), 0);
4164 QStandardItem* currentItem = mainModel->itemFromIndex(index);
4165 QString actionId = currentItem->data(Qt::UserRole).toString();
4166- QString groupId = currentItem->parent()->data(Qt::UserRole).toString();
4167- // changing keys in shortcuts
4168- shortcutMgr->changeActionPrimaryKey(actionId, groupId, ui->primaryShortcutEdit->getKeySequence());
4169- shortcutMgr->changeActionAltKey(actionId, groupId, ui->altShortcutEdit->getKeySequence());
4170- // no need to change displaying information, as it changed in mgr, and will be updated in connected slot
4171+
4172+ StelAction* action = actionMgr->findAction(actionId);
4173+ action->setShortcut(ui->primaryShortcutEdit->getKeySequence().toString());
4174+ action->setAltShortcut(ui->altShortcutEdit->getKeySequence().toString());
4175+ updateShortcutsItem(action);
4176
4177 // save shortcuts to file
4178- shortcutMgr->saveShortcuts();
4179+ actionMgr->saveShortcuts();
4180
4181 // nothing to apply until edits' content changes
4182 ui->applyButton->setEnabled(false);
4183@@ -310,14 +307,12 @@
4184 // restore defaults button logic
4185 connect(ui->restoreDefaultsButton, SIGNAL(clicked()), this, SLOT(restoreDefaultShortcuts()));
4186 // we need to disable all shortcut actions, so we can enter shortcuts without activating any actions
4187- connect(ui->primaryShortcutEdit, SIGNAL(focusChanged(bool)), shortcutMgr, SLOT(setAllActionsEnabled(bool)));
4188- connect(ui->altShortcutEdit, SIGNAL(focusChanged(bool)), shortcutMgr, SLOT(setAllActionsEnabled(bool)));
4189+ connect(ui->primaryShortcutEdit, SIGNAL(focusChanged(bool)), actionMgr, SLOT(setAllActionsEnabled(bool)));
4190+ connect(ui->altShortcutEdit, SIGNAL(focusChanged(bool)), actionMgr, SLOT(setAllActionsEnabled(bool)));
4191 // handling changes in editors
4192 connect(ui->primaryShortcutEdit, SIGNAL(contentsChanged()), this, SLOT(handleChanges()));
4193 connect(ui->altShortcutEdit, SIGNAL(contentsChanged()), this, SLOT(handleChanges()));
4194- // handle outer shortcuts changes
4195- connect(shortcutMgr, SIGNAL(shortcutChanged(StelShortcut*)), this, SLOT(updateShortcutsItem(StelShortcut*)));
4196-
4197+
4198 QString backspaceChar;
4199 backspaceChar.append(QChar(0x232B)); // Erase left
4200 //test.append(QChar(0x2672));
4201@@ -343,10 +338,9 @@
4202 ui->altShortcutEdit->style()->polish(ui->altShortcutEdit);
4203 }
4204
4205-QStandardItem* ShortcutsDialog::updateGroup(StelShortcutGroup* group)
4206+QStandardItem* ShortcutsDialog::updateGroup(const QString& group)
4207 {
4208- QString groupId = group->getId();
4209- QStandardItem* groupItem = findItemByData(QVariant(groupId),
4210+ QStandardItem* groupItem = findItemByData(QVariant(group),
4211 Qt::UserRole);
4212 bool isNew = false;
4213 if (!groupItem)
4214@@ -359,11 +353,9 @@
4215 groupItem->setFlags(Qt::ItemIsEnabled);
4216
4217 // setup displayed text
4218- QString groupText = group->getText();
4219- QString text(q_(groupText.isEmpty() ? groupId : groupText));
4220- groupItem->setText(text);
4221+ groupItem->setText(q_(group));
4222 // store id
4223- groupItem->setData(groupId, Qt::UserRole);
4224+ groupItem->setData(group, Qt::UserRole);
4225 groupItem->setColumnCount(3);
4226 // setup bold font for group lines
4227 QFont rootFont = groupItem->font();
4228@@ -373,17 +365,13 @@
4229 if (isNew)
4230 mainModel->appendRow(groupItem);
4231
4232- // expand only enabled group
4233- bool enabled = group->isEnabled();
4234+
4235 QModelIndex index = filterModel->mapFromSource(groupItem->index());
4236- if (enabled)
4237- ui->shortcutsTreeView->expand(index);
4238- else
4239- ui->shortcutsTreeView->collapse(index);
4240+ ui->shortcutsTreeView->expand(index);
4241 ui->shortcutsTreeView->setFirstColumnSpanned(index.row(),
4242 QModelIndex(),
4243 true);
4244- ui->shortcutsTreeView->setRowHidden(index.row(), QModelIndex(), !enabled);
4245+ ui->shortcutsTreeView->setRowHidden(index.row(), QModelIndex(), false);
4246
4247 return groupItem;
4248 }
4249@@ -411,10 +399,10 @@
4250 return 0;
4251 }
4252
4253-void ShortcutsDialog::updateShortcutsItem(StelShortcut *shortcut,
4254+void ShortcutsDialog::updateShortcutsItem(StelAction *action,
4255 QStandardItem *shortcutItem)
4256 {
4257- QVariant shortcutId(shortcut->getId());
4258+ QVariant shortcutId(action->getId());
4259 if (shortcutItem == NULL)
4260 {
4261 // search for item
4262@@ -425,12 +413,12 @@
4263 if (shortcutItem == NULL)
4264 {
4265 // firstly search for group
4266- QVariant groupId(shortcut->getGroup()->getId());
4267+ QVariant groupId(action->getGroup());
4268 groupItem = findItemByData(groupId, Qt::UserRole, 0);
4269 if (groupItem == NULL)
4270 {
4271 // create and add new group to treeWidget
4272- groupItem = updateGroup(shortcut->getGroup());
4273+ groupItem = updateGroup(action->getGroup());
4274 }
4275 // create shortcut item
4276 shortcutItem = new QStandardItem();
4277@@ -446,18 +434,18 @@
4278 groupItem->setChild(shortcutItem->row(), 2, secondaryItem);
4279 }
4280 // setup properties of item
4281- shortcutItem->setText(q_(shortcut->getText()));
4282+ shortcutItem->setText(q_(action->getText()));
4283 QModelIndex index = shortcutItem->index();
4284 mainModel->setData(index.sibling(index.row(), 1),
4285- shortcut->getPrimaryKey(), Qt::DisplayRole);
4286+ action->getShortcut(), Qt::DisplayRole);
4287 mainModel->setData(index.sibling(index.row(), 2),
4288- shortcut->getAltKey(), Qt::DisplayRole);
4289+ action->getAltShortcut(), Qt::DisplayRole);
4290 }
4291
4292 void ShortcutsDialog::restoreDefaultShortcuts()
4293 {
4294 resetModel();
4295- shortcutMgr->restoreDefaultShortcuts();
4296+ actionMgr->restoreDefaultShortcuts();
4297 updateTreeData();
4298 initEditors();
4299 }
4300@@ -465,15 +453,15 @@
4301 void ShortcutsDialog::updateTreeData()
4302 {
4303 // Create shortcuts tree
4304- QList<StelShortcutGroup*> groups = shortcutMgr->getGroupList();
4305- foreach (StelShortcutGroup* group, groups)
4306+ QStringList groups = actionMgr->getGroupList();
4307+ foreach (const QString& group, groups)
4308 {
4309 updateGroup(group);
4310 // display group's shortcuts
4311- QList<StelShortcut*> shortcuts = group->getActionList();
4312- foreach (StelShortcut* shortcut, shortcuts)
4313+ QList<StelAction*> actions = actionMgr->getActionList(group);
4314+ foreach (StelAction* action, actions)
4315 {
4316- updateShortcutsItem(shortcut);
4317+ updateShortcutsItem(action);
4318 }
4319 }
4320 updateText();
4321
4322=== modified file 'src/gui/ShortcutsDialog.hpp'
4323--- src/gui/ShortcutsDialog.hpp 2012-11-12 13:48:34 +0000
4324+++ src/gui/ShortcutsDialog.hpp 2013-09-27 03:38:50 +0000
4325@@ -29,9 +29,6 @@
4326
4327 class Ui_shortcutsDialogForm;
4328 class ShortcutLineEdit;
4329-class StelShortcut;
4330-class StelShortcutGroup;
4331-class StelShortcutMgr;
4332
4333 class QStandardItemModel;
4334 class QStandardItem;
4335@@ -79,12 +76,12 @@
4336 //! called when editors' state changed.
4337 void handleChanges();
4338 //! called when apply button clicked.
4339- void applyChanges() const;
4340+ void applyChanges();
4341 //! called by doubleclick; if click is on editable item, switch to editors
4342 void switchToEditors(const QModelIndex& index);
4343 //! update shortcut representation in tree correspondingly to its actual contents.
4344 //! if no item is specified, search for it in tree, if no items found, create new item
4345- void updateShortcutsItem(StelShortcut* shortcut, QStandardItem* shortcutItem = NULL);
4346+ void updateShortcutsItem(class StelAction* action, QStandardItem* shortcutItem = NULL);
4347 void restoreDefaultShortcuts();
4348 void updateTreeData();
4349
4350@@ -104,13 +101,13 @@
4351 //! See http://qt-project.org/faq/answer/how_can_my_stylesheet_account_for_custom_properties
4352 void polish();
4353
4354- QStandardItem* updateGroup(StelShortcutGroup* group);
4355+ QStandardItem* updateGroup(const QString& group);
4356
4357 //! search for first appearence of item with requested data.
4358 QStandardItem* findItemByData(QVariant value, int role, int column = 0);
4359
4360 //! pointer to mgr, for not getting it from stelapp every time.
4361- StelShortcutMgr* shortcutMgr;
4362+ class StelActionMgr* actionMgr;
4363
4364 //! list for storing collisions items, so we can easy restore their colors.
4365 QList<QStandardItem*> collisionItems;
4366
4367=== modified file 'src/gui/SkyGui.cpp'
4368--- src/gui/SkyGui.cpp 2013-09-09 23:21:42 +0000
4369+++ src/gui/SkyGui.cpp 2013-09-27 03:38:50 +0000
4370@@ -161,12 +161,10 @@
4371 autoHidebts = new CornerButtons();
4372 QPixmap pxmapOn = QPixmap(":/graphicGui/HorizontalAutoHideOn.png");
4373 QPixmap pxmapOff = QPixmap(":/graphicGui/HorizontalAutoHideOff.png");
4374- btHorizAutoHide = new StelButton(autoHidebts, pxmapOn, pxmapOff, QPixmap(), stelGui->getGuiAction("actionAutoHideHorizontalButtonBar"), true);
4375- btHorizAutoHide->setChecked(autoHideHorizontalButtonBar);
4376+ btHorizAutoHide = new StelButton(autoHidebts, pxmapOn, pxmapOff, QPixmap(), "actionAutoHideHorizontalButtonBar", true);
4377 pxmapOn = QPixmap(":/graphicGui/VerticalAutoHideOn.png");
4378 pxmapOff = QPixmap(":/graphicGui/VerticalAutoHideOff.png");
4379- btVertAutoHide = new StelButton(autoHidebts, pxmapOn, pxmapOff, QPixmap(), stelGui->getGuiAction("actionAutoHideVerticalButtonBar"), true);
4380- btVertAutoHide->setChecked(autoHideVerticalButtonBar);
4381+ btVertAutoHide = new StelButton(autoHidebts, pxmapOn, pxmapOff, QPixmap(), "actionAutoHideVerticalButtonBar", true);
4382
4383 btHorizAutoHide->setPos(1,btVertAutoHide->pixmap().height()-btHorizAutoHide->pixmap().height()+1);
4384 btVertAutoHide->setPos(0,0);
4385
4386=== modified file 'src/gui/StelDialog.cpp'
4387--- src/gui/StelDialog.cpp 2013-09-10 20:39:14 +0000
4388+++ src/gui/StelDialog.cpp 2013-09-27 03:38:50 +0000
4389@@ -72,7 +72,6 @@
4390 void StelDialog::close()
4391 {
4392 setVisible(false);
4393- StelMainView::getInstance().focusSky();
4394 }
4395
4396 bool StelDialog::visible() const
4397@@ -139,6 +138,6 @@
4398 dialog->hide();
4399 emit visibleChanged(false);
4400 //proxy->clearFocus();
4401- StelMainView::getInstance().scene()->setActiveWindow(0);
4402+ StelMainView::getInstance().focusSky();
4403 }
4404 }
4405
4406=== modified file 'src/gui/StelDialog.hpp'
4407--- src/gui/StelDialog.hpp 2013-09-02 13:58:06 +0000
4408+++ src/gui/StelDialog.hpp 2013-09-27 03:38:50 +0000
4409@@ -44,6 +44,7 @@
4410 class StelDialog : public QObject
4411 {
4412 Q_OBJECT
4413+ Q_PROPERTY(bool visible READ visible WRITE setVisible NOTIFY visibleChanged)
4414 public:
4415 StelDialog(QObject* parent=NULL);
4416 virtual ~StelDialog();
4417
4418=== modified file 'src/gui/StelGui.cpp'
4419--- src/gui/StelGui.cpp 2013-09-10 20:39:14 +0000
4420+++ src/gui/StelGui.cpp 2013-09-27 03:38:50 +0000
4421@@ -36,7 +36,7 @@
4422 #include "GridLinesMgr.hpp"
4423 #include "NebulaMgr.hpp"
4424 #include "StelLocaleMgr.hpp"
4425-#include "StelShortcutMgr.hpp"
4426+#include "StelActionMgr.hpp"
4427
4428 #include "StelObjectType.hpp"
4429 #include "StelObject.hpp"
4430@@ -167,179 +167,40 @@
4431
4432 ///////////////////////////////////////////////////////////////////////
4433 // Create all the main actions of the program, associated with shortcuts
4434- StelApp::getInstance().getStelShortcutManager()->loadShortcuts();
4435
4436-#ifdef ENABLE_SCRIPT_CONSOLE
4437- StelApp::getInstance().getStelShortcutManager()->
4438- addGuiAction("actionShow_ScriptConsole_Window_Global", true, N_("Script console window"), "F12", "", N_("Windows"), true, false, true);
4439-#endif
4440 ///////////////////////////////////////////////////////////////////////
4441 // Connect all the GUI actions signals with the Core of Stellarium
4442- connect(getGuiAction("actionQuit_Global"), SIGNAL(triggered()), this, SLOT(quit()));
4443-
4444- initConstellationMgr();
4445- initGrindLineMgr();
4446- initLandscapeMgr();
4447-
4448- NebulaMgr* nmgr = GETSTELMODULE(NebulaMgr);
4449- connect(getGuiAction("actionShow_Nebulas"), SIGNAL(toggled(bool)), nmgr, SLOT(setFlagHints(bool)));
4450- getGuiAction("actionShow_Nebulas")->setChecked(nmgr->getFlagHints());
4451-
4452- StelSkyLayerMgr* imgr = GETSTELMODULE(StelSkyLayerMgr);
4453- connect(getGuiAction("actionShow_DSS"), SIGNAL(toggled(bool)), imgr, SLOT(setFlagShow(bool)));
4454- getGuiAction("actionShow_DSS")->setChecked(imgr->getFlagShow());
4455-
4456-
4457- StelCore* core = StelApp::getInstance().getCore();
4458- StelMovementMgr* mmgr = GETSTELMODULE(StelMovementMgr);
4459- connect(getGuiAction("actionIncrease_Script_Speed"), SIGNAL(triggered()), this, SLOT(increaseScriptSpeed()));
4460- connect(getGuiAction("actionDecrease_Script_Speed"), SIGNAL(triggered()), this, SLOT(decreaseScriptSpeed()));
4461- connect(getGuiAction("actionSet_Real_Script_Speed"), SIGNAL(triggered()), this, SLOT(setRealScriptSpeed()));
4462- connect(getGuiAction("actionStop_Script"), SIGNAL(triggered()), this, SLOT(stopScript()));
4463- connect(getGuiAction("actionPause_Script"), SIGNAL(triggered()), this, SLOT(pauseScript()));
4464- connect(getGuiAction("actionResume_Script"), SIGNAL(triggered()), this, SLOT(resumeScript()));
4465- connect(getGuiAction("actionIncrease_Time_Speed"), SIGNAL(triggered()), core, SLOT(increaseTimeSpeed()));
4466- connect(getGuiAction("actionDecrease_Time_Speed"), SIGNAL(triggered()), core, SLOT(decreaseTimeSpeed()));
4467- connect(getGuiAction("actionIncrease_Time_Speed_Less"), SIGNAL(triggered()), core, SLOT(increaseTimeSpeedLess()));
4468- connect(getGuiAction("actionDecrease_Time_Speed_Less"), SIGNAL(triggered()), core, SLOT(decreaseTimeSpeedLess()));
4469- connect(getGuiAction("actionSet_Real_Time_Speed"), SIGNAL(triggered()), core, SLOT(toggleRealTimeSpeed()));
4470- connect(getGuiAction("actionSet_Time_Rate_Zero"), SIGNAL(triggered()), core, SLOT(setZeroTimeSpeed()));
4471- connect(getGuiAction("actionReturn_To_Current_Time"), SIGNAL(triggered()), core, SLOT(setTimeNow()));
4472- connect(getGuiAction("actionSwitch_Equatorial_Mount"), SIGNAL(toggled(bool)), mmgr, SLOT(setEquatorialMount(bool)));
4473- getGuiAction("actionSwitch_Equatorial_Mount")->setChecked(mmgr->getMountMode() != StelMovementMgr::MountAltAzimuthal);
4474- connect(getGuiAction("actionAdd_Solar_Hour"), SIGNAL(triggered()), core, SLOT(addHour()));
4475- connect(getGuiAction("actionAdd_Solar_Day"), SIGNAL(triggered()), core, SLOT(addDay()));
4476- connect(getGuiAction("actionAdd_Solar_Week"), SIGNAL(triggered()), core, SLOT(addWeek()));
4477- connect(getGuiAction("actionSubtract_Solar_Hour"), SIGNAL(triggered()), core, SLOT(subtractHour()));
4478- connect(getGuiAction("actionSubtract_Solar_Day"), SIGNAL(triggered()), core, SLOT(subtractDay()));
4479- connect(getGuiAction("actionSubtract_Solar_Week"), SIGNAL(triggered()), core, SLOT(subtractWeek()));
4480- connect(getGuiAction("actionAdd_Sidereal_Day"), SIGNAL(triggered()), core, SLOT(addSiderealDay()));
4481- connect(getGuiAction("actionAdd_Sidereal_Week"), SIGNAL(triggered()), core, SLOT(addSiderealWeek()));
4482- connect(getGuiAction("actionAdd_Sidereal_Month"), SIGNAL(triggered()), core, SLOT(addSiderealMonth()));
4483- connect(getGuiAction("actionAdd_Sidereal_Year"), SIGNAL(triggered()), core, SLOT(addSiderealYear()));
4484- connect(getGuiAction("actionAdd_Sidereal_Century"), SIGNAL(triggered()), core, SLOT(addSiderealCentury()));
4485- connect(getGuiAction("actionAdd_Synodic_Month"), SIGNAL(triggered()), core, SLOT(addSynodicMonth()));
4486- connect(getGuiAction("actionAdd_Draconic_Month"), SIGNAL(triggered()), core, SLOT(addDraconicMonth()));
4487- connect(getGuiAction("actionAdd_Draconic_Year"), SIGNAL(triggered()), core, SLOT(addDraconicYear()));
4488- connect(getGuiAction("actionAdd_Anomalistic_Month"), SIGNAL(triggered()), core, SLOT(addAnomalisticMonth()));
4489- connect(getGuiAction("actionAdd_Tropical_Month"), SIGNAL(triggered()), core, SLOT(addTropicalMonth()));
4490- connect(getGuiAction("actionAdd_Tropical_Year"), SIGNAL(triggered()), core, SLOT(addTropicalYear()));
4491- connect(getGuiAction("actionAdd_Tropical_Century"), SIGNAL(triggered()), core, SLOT(addTropicalCentury()));
4492- connect(getGuiAction("actionSubtract_Sidereal_Day"), SIGNAL(triggered()), core, SLOT(subtractSiderealDay()));
4493- connect(getGuiAction("actionSubtract_Sidereal_Week"), SIGNAL(triggered()), core, SLOT(subtractSiderealWeek()));
4494- connect(getGuiAction("actionSubtract_Sidereal_Month"), SIGNAL(triggered()), core, SLOT(subtractSiderealMonth()));
4495- connect(getGuiAction("actionSubtract_Sidereal_Year"), SIGNAL(triggered()), core, SLOT(subtractSiderealYear()));
4496- connect(getGuiAction("actionSubtract_Sidereal_Century"), SIGNAL(triggered()), core, SLOT(subtractSiderealCentury()));
4497- connect(getGuiAction("actionSubtract_Synodic_Month"), SIGNAL(triggered()), core, SLOT(subtractSynodicMonth()));
4498- connect(getGuiAction("actionSubtract_Draconic_Month"), SIGNAL(triggered()), core, SLOT(subtractDraconicMonth()));
4499- connect(getGuiAction("actionSubtract_Draconic_Year"), SIGNAL(triggered()), core, SLOT(subtractDraconicYear()));
4500- connect(getGuiAction("actionSubtract_Anomalistic_Month"), SIGNAL(triggered()), core, SLOT(subtractAnomalisticMonth()));
4501- connect(getGuiAction("actionSubtract_Tropical_Month"), SIGNAL(triggered()), core, SLOT(subtractTropicalMonth()));
4502- connect(getGuiAction("actionSubtract_Tropical_Year"), SIGNAL(triggered()), core, SLOT(subtractTropicalYear()));
4503- connect(getGuiAction("actionSubtract_Tropical_Century"), SIGNAL(triggered()), core, SLOT(subtractTropicalCentury()));
4504- connect(getGuiAction("actionSet_Home_Planet_To_Selected"), SIGNAL(triggered()), core, SLOT(moveObserverToSelected()));
4505- connect(getGuiAction("actionGo_Home_Global"), SIGNAL(triggered()), core, SLOT(returnToHome()));
4506-
4507- // connect the actor after setting the nightmode.
4508- // StelApp::init() already set flagNightMode for us, don't do it twice!
4509- getGuiAction("actionShow_Night_Mode")->setChecked(StelApp::getInstance().getVisionModeNight());
4510- connect(getGuiAction("actionShow_Night_Mode"), SIGNAL(toggled(bool)), &StelApp::getInstance(), SLOT(setVisionModeNight(bool)));
4511-
4512- connect(getGuiAction("actionGoto_Selected_Object"), SIGNAL(triggered()), mmgr, SLOT(setFlagTracking()));
4513- connect(getGuiAction("actionZoom_In_Auto"), SIGNAL(triggered()), mmgr, SLOT(autoZoomIn()));
4514- connect(getGuiAction("actionZoom_Out_Auto"), SIGNAL(triggered()), mmgr, SLOT(autoZoomOut()));
4515- connect(getGuiAction("actionSet_Tracking"), SIGNAL(toggled(bool)), mmgr, SLOT(setFlagTracking(bool)));
4516- getGuiAction("actionSet_Tracking")->setChecked(mmgr->getFlagTracking());
4517-
4518- connect(getGuiAction("actionSet_Full_Screen_Global"), SIGNAL(toggled(bool)), &StelMainView::getInstance(), SLOT(setFullScreen(bool)));
4519- getGuiAction("actionSet_Full_Screen_Global")->setChecked(StelMainView::getInstance().isFullScreen());
4520-
4521- QAction* tempAction = getGuiAction("actionShow_Location_Window_Global");
4522- connect(tempAction, SIGNAL(toggled(bool)),
4523- locationDialog, SLOT(setVisible(bool)));
4524- connect(locationDialog, SIGNAL(visibleChanged(bool)),
4525- tempAction, SLOT(setChecked(bool)));
4526+ StelActionMgr* actionsMgr = StelApp::getInstance().getStelActionManager();
4527+
4528+ // XXX: this should probably go into the script manager.
4529+ actionsMgr->addAction("actionQuit_Global", "Miscellaneous", N_("Quit"), this, "quit()", "Ctrl+Q");
4530+ actionsMgr->addAction("actionIncrease_Script_Speed", "Date and Time", N_("Speed up the script execution rate"), this, "increaseScriptSpeed()");
4531+ actionsMgr->addAction("actionDecrease_Script_Speed", "Date and Time", N_("Slow down the script execution rate"), this, "decreaseScriptSpeed()");
4532+ actionsMgr->addAction("actionSet_Real_Script_Speed", "Date and Time", N_("Set the normal script execution rate"), this, "setRealScriptSpeed()");
4533+ actionsMgr->addAction("actionStop_Script", "Date and Time", N_("Stop script execution"), this, "stopScript()", "Ctrl+D, S");
4534+ actionsMgr->addAction("actionPause_Script", "Date and Time", N_("Pause script execution"), this, "pauseScript()", "Ctrl+D, P");
4535+ actionsMgr->addAction("actionResume_Script", "Date and Time", N_("Resume script execution"), this, "resumeScript()", "Ctrl+D, R");
4536
4537 #ifdef ENABLE_SCRIPT_CONSOLE
4538- tempAction = getGuiAction("actionShow_ScriptConsole_Window_Global");
4539- connect(tempAction, SIGNAL(toggled(bool)),
4540- scriptConsole, SLOT(setVisible(bool)));
4541- connect(scriptConsole, SIGNAL(visibleChanged(bool)),
4542- tempAction, SLOT(setChecked(bool)));
4543+ actionsMgr->addAction("actionShow_ScriptConsole_Window_Global", "Windows", N_("Script console window"), scriptConsole, "visible", "F12", "", true);
4544 #endif
4545
4546- tempAction = getGuiAction("actionShow_Configuration_Window_Global");
4547- connect(tempAction, SIGNAL(toggled(bool)),
4548- configurationDialog, SLOT(setVisible(bool)));
4549- connect(configurationDialog, SIGNAL(visibleChanged(bool)),
4550- tempAction, SLOT(setChecked(bool)));
4551-
4552- tempAction = getGuiAction("actionShow_SkyView_Window_Global");
4553- connect(tempAction, SIGNAL(toggled(bool)),
4554- viewDialog, SLOT(setVisible(bool)));
4555- connect(viewDialog, SIGNAL(visibleChanged(bool)),
4556- tempAction, SLOT(setChecked(bool)));
4557-
4558- tempAction = getGuiAction("actionShow_Help_Window_Global");
4559- connect(tempAction, SIGNAL(toggled(bool)),
4560- helpDialog, SLOT(setVisible(bool)));
4561- connect(helpDialog, SIGNAL(visibleChanged(bool)),
4562- tempAction, SLOT(setChecked(bool)));
4563-
4564- tempAction = getGuiAction("actionShow_DateTime_Window_Global");
4565- connect(tempAction, SIGNAL(toggled(bool)),
4566- dateTimeDialog, SLOT(setVisible(bool)));
4567- connect(dateTimeDialog, SIGNAL(visibleChanged(bool)),
4568- tempAction, SLOT(setChecked(bool)));
4569-
4570- tempAction = getGuiAction("actionShow_Search_Window_Global");
4571- connect(tempAction, SIGNAL(toggled(bool)),
4572- searchDialog, SLOT(setVisible(bool)));
4573- connect(searchDialog, SIGNAL(visibleChanged(bool)),
4574- tempAction, SLOT(setChecked(bool)));
4575-
4576- tempAction = getGuiAction("actionShow_Shortcuts_Window_Global");
4577- connect(tempAction, SIGNAL(toggled(bool)),
4578- shortcutsDialog, SLOT(setVisible(bool)));
4579- connect(shortcutsDialog, SIGNAL(visibleChanged(bool)),
4580- tempAction, SLOT(setChecked(bool)));
4581-
4582- connect(getGuiAction("actionSave_Screenshot_Global"), SIGNAL(triggered()), &StelMainView::getInstance(), SLOT(saveScreenShot()));
4583- connect(getGuiAction("actionSave_Copy_Object_Information_Global"), SIGNAL(triggered()), this, SLOT(copySelectedObjectInfo()));
4584-
4585- getGuiAction("actionToggle_GuiHidden_Global")->setChecked(true);
4586- connect(getGuiAction("actionToggle_GuiHidden_Global"), SIGNAL(toggled(bool)), this, SLOT(setGuiVisible(bool)));
4587-
4588- connect(getGuiAction("actionHorizontal_Flip"), SIGNAL(toggled(bool)), StelApp::getInstance().getCore(), SLOT(setFlipHorz(bool)));
4589- getGuiAction("actionHorizontal_Flip")->setChecked(StelApp::getInstance().getCore()->getFlipHorz());
4590- connect(getGuiAction("actionVertical_Flip"), SIGNAL(toggled(bool)), StelApp::getInstance().getCore(), SLOT(setFlipVert(bool)));
4591- getGuiAction("actionVertical_Flip")->setChecked(StelApp::getInstance().getCore()->getFlipVert());
4592-
4593- StarMgr* smgr = GETSTELMODULE(StarMgr);
4594- connect(getGuiAction("actionShow_Stars"), SIGNAL(toggled(bool)), smgr, SLOT(setFlagStars(bool)));
4595- getGuiAction("actionShow_Stars")->setChecked(smgr->getFlagStars());
4596-
4597- connect(getGuiAction("actionShow_Stars_Labels"), SIGNAL(toggled(bool)), smgr, SLOT(setFlagLabels(bool)));
4598- getGuiAction("actionShow_Stars_Labels")->setChecked(smgr->getFlagLabels());
4599-
4600- SolarSystem* ssmgr = GETSTELMODULE(SolarSystem);
4601- connect(getGuiAction("actionShow_Planets_Labels"), SIGNAL(toggled(bool)), ssmgr, SLOT(setFlagLabels(bool)));
4602- getGuiAction("actionShow_Planets_Labels")->setChecked(ssmgr->getFlagLabels());
4603-
4604- connect(getGuiAction("actionShow_Planets_Orbits"), SIGNAL(toggled(bool)), ssmgr, SLOT(setFlagOrbits(bool)));
4605- getGuiAction("actionShow_Planets_Orbits")->setChecked(ssmgr->getFlagOrbits());
4606-
4607- connect(getGuiAction("actionShow_Planets_Trails"), SIGNAL(toggled(bool)), ssmgr, SLOT(setFlagTrails(bool)));
4608- getGuiAction("actionShow_Planets_Trails")->setChecked(ssmgr->getFlagTrails());
4609+ actionsMgr->addAction("actionShow_Help_Window_Global", "Windows", N_("Help window"), helpDialog, "visible", "F1", "", true);
4610+ actionsMgr->addAction("actionShow_Configuration_Window_Global", "Windows", N_("Configuration window"), configurationDialog, "visible", "F2", "", true);
4611+ actionsMgr->addAction("actionShow_Search_Window_Global", "Windows", N_("Search window"), searchDialog, "visible", "F3", "Ctrl+F", true);
4612+ actionsMgr->addAction("actionShow_SkyView_Window_Global", "Windows", N_("Sky and viewing options window"), viewDialog, "visible", "F4", "", true);
4613+ actionsMgr->addAction("actionShow_DateTime_Window_Global", "Windows", N_("Date/time window"), dateTimeDialog, "visible", "F5", "", true);
4614+ actionsMgr->addAction("actionShow_Location_Window_Global", "Windows", N_("Location window"), locationDialog, "visible", "F6", "", true);
4615+ actionsMgr->addAction("actionShow_Shortcuts_Window_Global", "Windows", N_("Shortcuts window"), shortcutsDialog, "visible", "F7", "", true);
4616+ actionsMgr->addAction("actionSave_Copy_Object_Information_Global", "Miscellaneous", N_("Copy selected object information to clipboard"), this, "copySelectedObjectInfo()", "Ctrl+C", "", true);
4617+ actionsMgr->addAction("actionToggle_GuiHidden_Global", "Miscellaneous", N_("Toggle visibility of GUI"), this, "visible", "Ctrl+T", "", true);
4618
4619 QSettings* conf = StelApp::getInstance().getSettings();
4620 Q_ASSERT(conf);
4621 setAutoHideHorizontalButtonBar(conf->value("gui/auto_hide_horizontal_toolbar", true).toBool());
4622 setAutoHideVerticalButtonBar(conf->value("gui/auto_hide_vertical_toolbar", true).toBool());
4623- connect(getGuiAction("actionAutoHideHorizontalButtonBar"), SIGNAL(toggled(bool)), this, SLOT(setAutoHideHorizontalButtonBar(bool)));
4624- getGuiAction("actionAutoHideHorizontalButtonBar")->setChecked(getAutoHideHorizontalButtonBar());
4625- connect(getGuiAction("actionAutoHideVerticalButtonBar"), SIGNAL(toggled(bool)), this, SLOT(setAutoHideVerticalButtonBar(bool)));
4626- getGuiAction("actionAutoHideVerticalButtonBar")->setChecked(getAutoHideVerticalButtonBar());
4627+ actionsMgr->addAction("actionAutoHideHorizontalButtonBar", "Miscellaneous", N_("Auto hide horizontal button bar"), this, "autoHideHorizontalButtonBar");
4628+ actionsMgr->addAction("actionAutoHideVerticalButtonBar", "Miscellaneous", N_("Auto hide vertical button bar"), this, "autoHideVerticalButtonBar");
4629
4630 #ifndef DISABLE_SCRIPTING
4631 StelScriptMgr* scriptMgr = &StelApp::getInstance().getScriptMgr();
4632@@ -356,132 +217,131 @@
4633 QPixmap pxmapGlow(":/graphicGui/glow.png");
4634 QPixmap pxmapOn(":/graphicGui/2-on-location.png");
4635 QPixmap pxmapOff(":/graphicGui/2-off-location.png");
4636- StelButton* b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Location_Window_Global"));
4637+ StelButton* b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, "actionShow_Location_Window_Global");
4638 skyGui->winBar->addButton(b);
4639
4640 pxmapOn = QPixmap(":/graphicGui/1-on-time.png");
4641 pxmapOff = QPixmap(":/graphicGui/1-off-time.png");
4642- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_DateTime_Window_Global"));
4643+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, "actionShow_DateTime_Window_Global");
4644 skyGui->winBar->addButton(b);
4645
4646 pxmapOn = QPixmap(":/graphicGui/5-on-labels.png");
4647 pxmapOff = QPixmap(":/graphicGui/5-off-labels.png");
4648- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_SkyView_Window_Global"));
4649+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, "actionShow_SkyView_Window_Global");
4650 skyGui->winBar->addButton(b);
4651
4652 pxmapOn = QPixmap(":/graphicGui/6-on-search.png");
4653 pxmapOff = QPixmap(":/graphicGui/6-off-search.png");
4654- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Search_Window_Global"));
4655+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, "actionShow_Search_Window_Global");
4656 skyGui->winBar->addButton(b);
4657
4658 pxmapOn = QPixmap(":/graphicGui/8-on-settings.png");
4659 pxmapOff = QPixmap(":/graphicGui/8-off-settings.png");
4660- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Configuration_Window_Global"));
4661+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, "actionShow_Configuration_Window_Global");
4662 skyGui->winBar->addButton(b);
4663
4664 pxmapOn = QPixmap(":/graphicGui/9-on-help.png");
4665 pxmapOff = QPixmap(":/graphicGui/9-off-help.png");
4666- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, getGuiAction("actionShow_Help_Window_Global"));
4667+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow, "actionShow_Help_Window_Global");
4668 skyGui->winBar->addButton(b);
4669
4670 QPixmap pxmapGlow32x32(":/graphicGui/glow32x32.png");
4671
4672 pxmapOn = QPixmap(":/graphicGui/btConstellationLines-on.png");
4673 pxmapOff = QPixmap(":/graphicGui/btConstellationLines-off.png");
4674- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Constellation_Lines"));
4675+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Constellation_Lines");
4676 skyGui->buttonBar->addButton(b, "010-constellationsGroup");
4677
4678 pxmapOn = QPixmap(":/graphicGui/btConstellationLabels-on.png");
4679 pxmapOff = QPixmap(":/graphicGui/btConstellationLabels-off.png");
4680- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Constellation_Labels"));
4681+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Constellation_Labels");
4682 skyGui->buttonBar->addButton(b, "010-constellationsGroup");
4683
4684 pxmapOn = QPixmap(":/graphicGui/btConstellationArt-on.png");
4685 pxmapOff = QPixmap(":/graphicGui/btConstellationArt-off.png");
4686- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Constellation_Art"));
4687+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Constellation_Art");
4688 skyGui->buttonBar->addButton(b, "010-constellationsGroup");
4689
4690 pxmapOn = QPixmap(":/graphicGui/btEquatorialGrid-on.png");
4691 pxmapOff = QPixmap(":/graphicGui/btEquatorialGrid-off.png");
4692- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Equatorial_Grid"));
4693+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Equatorial_Grid");
4694 skyGui->buttonBar->addButton(b, "020-gridsGroup");
4695
4696 pxmapOn = QPixmap(":/graphicGui/btAzimuthalGrid-on.png");
4697 pxmapOff = QPixmap(":/graphicGui/btAzimuthalGrid-off.png");
4698- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Azimuthal_Grid"));
4699+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Azimuthal_Grid");
4700 skyGui->buttonBar->addButton(b, "020-gridsGroup");
4701
4702 pxmapOn = QPixmap(":/graphicGui/btGround-on.png");
4703 pxmapOff = QPixmap(":/graphicGui/btGround-off.png");
4704- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Ground"));
4705+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Ground");
4706 skyGui->buttonBar->addButton(b, "030-landscapeGroup");
4707
4708 pxmapOn = QPixmap(":/graphicGui/btCardinalPoints-on.png");
4709 pxmapOff = QPixmap(":/graphicGui/btCardinalPoints-off.png");
4710- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Cardinal_Points"));
4711+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Cardinal_Points");
4712 skyGui->buttonBar->addButton(b, "030-landscapeGroup");
4713
4714 pxmapOn = QPixmap(":/graphicGui/btAtmosphere-on.png");
4715 pxmapOff = QPixmap(":/graphicGui/btAtmosphere-off.png");
4716- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Atmosphere"));
4717+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Atmosphere");
4718 skyGui->buttonBar->addButton(b, "030-landscapeGroup");
4719
4720 pxmapOn = QPixmap(":/graphicGui/btNebula-on.png");
4721 pxmapOff = QPixmap(":/graphicGui/btNebula-off.png");
4722- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Nebulas"));
4723+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Nebulas");
4724 skyGui->buttonBar->addButton(b, "040-nebulaeGroup");
4725
4726 pxmapOn = QPixmap(":/graphicGui/btPlanets-on.png");
4727 pxmapOff = QPixmap(":/graphicGui/btPlanets-off.png");
4728- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Planets_Labels"));
4729+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Planets_Labels");
4730 skyGui->buttonBar->addButton(b, "040-nebulaeGroup");
4731
4732 pxmapOn = QPixmap(":/graphicGui/btEquatorialMount-on.png");
4733 pxmapOff = QPixmap(":/graphicGui/btEquatorialMount-off.png");
4734- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionSwitch_Equatorial_Mount"));
4735- b->setChecked(getGuiAction("actionSwitch_Equatorial_Mount")->isChecked());
4736+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionSwitch_Equatorial_Mount");
4737 skyGui->buttonBar->addButton(b, "060-othersGroup");
4738
4739 pxmapOn = QPixmap(":/graphicGui/btGotoSelectedObject-on.png");
4740 pxmapOff = QPixmap(":/graphicGui/btGotoSelectedObject-off.png");
4741- buttonGotoSelectedObject = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionGoto_Selected_Object"));
4742+ buttonGotoSelectedObject = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionGoto_Selected_Object");
4743 skyGui->buttonBar->addButton(buttonGotoSelectedObject, "060-othersGroup");
4744
4745 pxmapOn = QPixmap(":/graphicGui/btNightView-on.png");
4746 pxmapOff = QPixmap(":/graphicGui/btNightView-off.png");
4747- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionShow_Night_Mode"));
4748+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionShow_Night_Mode");
4749 skyGui->buttonBar->addButton(b, "060-othersGroup");
4750
4751 pxmapOn = QPixmap(":/graphicGui/btFullScreen-on.png");
4752 pxmapOff = QPixmap(":/graphicGui/btFullScreen-off.png");
4753- b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionSet_Full_Screen_Global"));
4754+ b = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionSet_Full_Screen_Global");
4755 skyGui->buttonBar->addButton(b, "060-othersGroup");
4756
4757 pxmapOn = QPixmap(":/graphicGui/btTimeRewind-on.png");
4758 pxmapOff = QPixmap(":/graphicGui/btTimeRewind-off.png");
4759- buttonTimeRewind = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionDecrease_Time_Speed"));
4760+ buttonTimeRewind = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionDecrease_Time_Speed");
4761 skyGui->buttonBar->addButton(buttonTimeRewind, "070-timeGroup");
4762
4763 pxmapOn = QPixmap(":/graphicGui/btTimeRealtime-on.png");
4764 pxmapOff = QPixmap(":/graphicGui/btTimeRealtime-off.png");
4765 pxmapDefault = QPixmap(":/graphicGui/btTimePause-on.png");
4766- buttonTimeRealTimeSpeed = new StelButton(NULL, pxmapOn, pxmapOff, pxmapDefault, pxmapGlow32x32, getGuiAction("actionSet_Real_Time_Speed"));
4767+ buttonTimeRealTimeSpeed = new StelButton(NULL, pxmapOn, pxmapOff, pxmapDefault, pxmapGlow32x32, "actionSet_Real_Time_Speed");
4768 skyGui->buttonBar->addButton(buttonTimeRealTimeSpeed, "070-timeGroup");
4769
4770 pxmapOn = QPixmap(":/graphicGui/btTimeNow-on.png");
4771 pxmapOff = QPixmap(":/graphicGui/btTimeNow-off.png");
4772- buttonTimeCurrent = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionReturn_To_Current_Time"));
4773+ buttonTimeCurrent = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionReturn_To_Current_Time");
4774 skyGui->buttonBar->addButton(buttonTimeCurrent, "070-timeGroup");
4775
4776 pxmapOn = QPixmap(":/graphicGui/btTimeForward-on.png");
4777 pxmapOff = QPixmap(":/graphicGui/btTimeForward-off.png");
4778- buttonTimeForward = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, getGuiAction("actionIncrease_Time_Speed"));
4779+ buttonTimeForward = new StelButton(NULL, pxmapOn, pxmapOff, pxmapGlow32x32, "actionIncrease_Time_Speed");
4780 skyGui->buttonBar->addButton(buttonTimeForward, "070-timeGroup");
4781
4782 skyGui->buttonBar->setGroupMargin("070-timeGroup", 32, 0);
4783
4784 pxmapOn = QPixmap(":/graphicGui/btQuit.png");
4785- b = new StelButton(NULL, pxmapOn, pxmapOn, pxmapGlow32x32, getGuiAction("actionQuit_Global"));
4786+ b = new StelButton(NULL, pxmapOn, pxmapOn, pxmapGlow32x32, "actionQuit_Global");
4787 skyGui->buttonBar->addButton(b, "080-quitGroup");
4788
4789 // add the flip buttons if requested in the config
4790@@ -521,199 +381,6 @@
4791 initDone = true;
4792 }
4793
4794-void StelGui::initConstellationMgr()
4795-{
4796- ConstellationMgr* constellationMgr = GETSTELMODULE(ConstellationMgr);
4797- getGuiAction("actionShow_Constellation_Lines")->setChecked(constellationMgr->getFlagLines());
4798- connect(getGuiAction("actionShow_Constellation_Lines"),
4799- SIGNAL(toggled(bool)),
4800- constellationMgr,
4801- SLOT(setFlagLines(bool)));
4802- connect(constellationMgr,
4803- SIGNAL(linesDisplayedChanged(const bool)),
4804- this,
4805- SLOT(linesDisplayedUpdated(const bool)));
4806-
4807- getGuiAction("actionShow_Constellation_Art")->setChecked(constellationMgr->getFlagArt());
4808- connect(getGuiAction("actionShow_Constellation_Art"),
4809- SIGNAL(toggled(bool)),
4810- constellationMgr,
4811- SLOT(setFlagArt(bool)));
4812- connect(constellationMgr,
4813- SIGNAL(artDisplayedChanged(const bool)),
4814- this,
4815- SLOT(artDisplayedUpdated(const bool)));
4816-
4817- getGuiAction("actionShow_Constellation_Labels")->setChecked(constellationMgr->getFlagLabels());
4818- connect(getGuiAction("actionShow_Constellation_Labels"),
4819- SIGNAL(toggled(bool)),
4820- constellationMgr,
4821- SLOT(setFlagLabels(bool)));
4822- connect(constellationMgr,
4823- SIGNAL(namesDisplayedChanged(const bool)),
4824- this,
4825- SLOT(namesDisplayedUpdated(const bool)));
4826-
4827- getGuiAction("actionShow_Constellation_Boundaries")->setChecked(constellationMgr->getFlagBoundaries());
4828- connect(getGuiAction("actionShow_Constellation_Boundaries"),
4829- SIGNAL(toggled(bool)),
4830- constellationMgr,
4831- SLOT(setFlagBoundaries(bool)));
4832- connect(constellationMgr,
4833- SIGNAL(boundariesDisplayedChanged(const bool)),
4834- this,
4835- SLOT(boundariesDisplayedUpdated(const bool)));
4836-}
4837-
4838-void StelGui::initGrindLineMgr()
4839-{
4840- GridLinesMgr* gridLineManager = GETSTELMODULE(GridLinesMgr);
4841- getGuiAction("actionShow_Equatorial_Grid")->setChecked(gridLineManager->getFlagEquatorGrid());
4842- connect(getGuiAction("actionShow_Equatorial_Grid"),
4843- SIGNAL(toggled(bool)),
4844- gridLineManager,
4845- SLOT(setFlagEquatorGrid(bool)));
4846- connect(gridLineManager,
4847- SIGNAL(equatorGridDisplayedChanged(const bool)),
4848- this,
4849- SLOT(equatorGridDisplayedUpdated(const bool)));
4850-
4851- getGuiAction("actionShow_Azimuthal_Grid")->setChecked(gridLineManager->getFlagAzimuthalGrid());
4852- connect(getGuiAction("actionShow_Azimuthal_Grid"),
4853- SIGNAL(toggled(bool)),
4854- gridLineManager,
4855- SLOT(setFlagAzimuthalGrid(bool)));
4856- connect(gridLineManager,
4857- SIGNAL(azimuthalGridDisplayedChanged(const bool)),
4858- this,
4859- SLOT(azimuthalGridDisplayedUpdated(const bool)));
4860-
4861- getGuiAction("actionShow_Ecliptic_Line")->setChecked(gridLineManager->getFlagEclipticLine());
4862- connect(getGuiAction("actionShow_Ecliptic_Line"),
4863- SIGNAL(toggled(bool)),
4864- gridLineManager,
4865- SLOT(setFlagEclipticLine(bool)));
4866- connect(gridLineManager,
4867- SIGNAL(eclipticLineDisplayedChanged(const bool)),
4868- this,
4869- SLOT(eclipticLineDisplayedUpdated(const bool)));
4870-
4871- getGuiAction("actionShow_Equator_Line")->setChecked(gridLineManager->getFlagEquatorLine());
4872- connect(getGuiAction("actionShow_Equator_Line"),
4873- SIGNAL(toggled(bool)),
4874- gridLineManager,
4875- SLOT(setFlagEquatorLine(bool)));
4876- connect(gridLineManager,
4877- SIGNAL(equatorLineDisplayedChanged(const bool)),
4878- this,
4879- SLOT(equatorLineDisplayedUpdated(const bool)));
4880-
4881- getGuiAction("actionShow_Meridian_Line")->setChecked(gridLineManager->getFlagMeridianLine());
4882- connect(getGuiAction("actionShow_Meridian_Line"),
4883- SIGNAL(toggled(bool)),
4884- gridLineManager,
4885- SLOT(setFlagMeridianLine(bool)));
4886- connect(gridLineManager,
4887- SIGNAL(meridianLineDisplayedChanged(const bool)),
4888- this,
4889- SLOT(meridianLineDisplayedUpdated(const bool)));
4890-
4891- getGuiAction("actionShow_Horizon_Line")->setChecked(gridLineManager->getFlagHorizonLine());
4892- connect(getGuiAction("actionShow_Horizon_Line"),
4893- SIGNAL(toggled(bool)),
4894- gridLineManager,
4895- SLOT(setFlagHorizonLine(bool)));
4896- connect(gridLineManager,
4897- SIGNAL(horizonLineDisplayedChanged(const bool)),
4898- this,
4899- SLOT(horizonLineDisplayedUpdated(const bool)));
4900-
4901- getGuiAction("actionShow_Equatorial_J2000_Grid")->setChecked(gridLineManager->getFlagEquatorJ2000Grid());
4902- connect(getGuiAction("actionShow_Equatorial_J2000_Grid"),
4903- SIGNAL(toggled(bool)),
4904- gridLineManager,
4905- SLOT(setFlagEquatorJ2000Grid(bool)));
4906- connect(gridLineManager,
4907- SIGNAL(equatorJ2000GridDisplayedChanged(const bool)),
4908- this,
4909- SLOT(equatorJ2000GridDisplayedUpdated(const bool)));
4910-
4911- getGuiAction("actionShow_Ecliptic_J2000_Grid")->setChecked(gridLineManager->getFlagEclipticJ2000Grid());
4912- connect(getGuiAction("actionShow_Ecliptic_J2000_Grid"),
4913- SIGNAL(toggled(bool)),
4914- gridLineManager,
4915- SLOT(setFlagEclipticJ2000Grid(bool)));
4916- connect(gridLineManager,
4917- SIGNAL(eclipticJ2000GridDisplayedChanged(const bool)),
4918- this,
4919- SLOT(eclipticJ2000GridDisplayedUpdated(const bool)));
4920-
4921- getGuiAction("actionShow_Galactic_Grid")->setChecked(gridLineManager->getFlagGalacticGrid());
4922- connect(getGuiAction("actionShow_Galactic_Grid"),
4923- SIGNAL(toggled(bool)),
4924- gridLineManager,
4925- SLOT(setFlagGalacticGrid(bool)));
4926- connect(gridLineManager,
4927- SIGNAL(galacticGridDisplayedChanged(const bool)),
4928- this,
4929- SLOT(galacticGridDisplayedUpdated(const bool)));
4930-
4931- getGuiAction("actionShow_Galactic_Plane_Line")->setChecked(gridLineManager->getFlagGalacticPlaneLine());
4932- connect(getGuiAction("actionShow_Galactic_Plane_Line"),
4933- SIGNAL(toggled(bool)),
4934- gridLineManager,
4935- SLOT(setFlagGalacticPlaneLine(bool)));
4936- connect(gridLineManager,
4937- SIGNAL(galacticPlaneLineDisplayedChanged(const bool)),
4938- this,
4939- SLOT(galacticPlaneLineDisplayedUpdated(const bool)));
4940-
4941-}
4942-
4943-void StelGui::initLandscapeMgr()
4944-{
4945- LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
4946- getGuiAction("actionShow_Ground")->setChecked(landscapeMgr->getFlagLandscape());
4947- connect(getGuiAction("actionShow_Ground"),
4948- SIGNAL(toggled(bool)),
4949- landscapeMgr,
4950- SLOT(setFlagLandscape(bool)));
4951- connect(landscapeMgr,
4952- SIGNAL(landscapeDisplayedChanged(const bool)),
4953- this,
4954- SLOT(landscapeDisplayedUpdated(const bool)));
4955-
4956- getGuiAction("actionShow_Cardinal_Points")->setChecked(landscapeMgr->getFlagCardinalsPoints());
4957- connect(getGuiAction("actionShow_Cardinal_Points"),
4958- SIGNAL(toggled(bool)),
4959- landscapeMgr,
4960- SLOT(setFlagCardinalsPoints(bool)));
4961- connect(landscapeMgr,
4962- SIGNAL(cardinalsPointsDisplayedChanged(const bool)),
4963- this,
4964- SLOT(cardinalsPointsDisplayedUpdated(const bool)));
4965-
4966- getGuiAction("actionShow_Atmosphere")->setChecked(landscapeMgr->getFlagAtmosphere());
4967- connect(getGuiAction("actionShow_Atmosphere"),
4968- SIGNAL(toggled(bool)),
4969- landscapeMgr,
4970- SLOT(setFlagAtmosphere(bool)));
4971- connect(landscapeMgr,
4972- SIGNAL(atmosphereDisplayedChanged(const bool)),
4973- this,
4974- SLOT(atmosphereDisplayedUpdated(const bool)));
4975-
4976- getGuiAction("actionShow_Fog")->setChecked(landscapeMgr->getFlagFog());
4977- connect(getGuiAction("actionShow_Fog"),
4978- SIGNAL(toggled(bool)),
4979- landscapeMgr,
4980- SLOT(setFlagFog(bool)));
4981- connect(landscapeMgr,
4982- SIGNAL(fogDisplayedChanged(const bool)),
4983- this,
4984- SLOT(fogDisplayedUpdated(const bool)));
4985-}
4986-
4987 void StelGui::quit()
4988 {
4989 #ifndef DISABLE_SCRIPTING
4990@@ -813,39 +480,20 @@
4991 buttonGotoSelectedObject->setChecked(b);
4992 }
4993
4994- bool flag = GETSTELMODULE(StarMgr)->getFlagStars();
4995- if (getGuiAction("actionShow_Stars")->isChecked() != flag) {
4996- getGuiAction("actionShow_Stars")->setChecked(flag);
4997- }
4998-
4999- flag = GETSTELMODULE(NebulaMgr)->getFlagHints();
5000- if (getGuiAction("actionShow_Nebulas")->isChecked() != flag)
The diff has been truncated for viewing.