~peppujols/stellarium/printsky

« back to all changes in this revision

Viewing changes to plugins/TextUserInterface/src/TextUserInterface.cpp

  • Committer: Pep Pujols
  • Date: 2012-02-17 14:58:45 UTC
  • mfrom: (4722.1.5 printsky)
  • Revision ID: maslarocaxica@gmail.com-20120217145845-fo4jextrb9z83sbb
Merge from code refactoring

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
 *
14
14
 * You should have received a copy of the GNU General Public License
15
15
 * along with this program; if not, write to the Free Software
16
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
16
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
17
17
 */
18
18
 
19
19
#include "TextUserInterface.hpp"
47
47
#include "StelSkyCultureMgr.hpp"
48
48
#include "StelFileMgr.hpp"
49
49
#include "StelUtils.hpp"
 
50
#ifndef DISABLE_SCRIPTING
50
51
#include "StelScriptMgr.hpp"
 
52
#endif
 
53
#include "StelGui.hpp"
 
54
#include "StelGuiItems.hpp"// Funny thing to include in a TEXT user interface...
51
55
 
52
56
#include <QtOpenGL>
53
57
#include <QKeyEvent>
75
79
{
76
80
        StelPluginInfo info;
77
81
        info.id = "TextUserInterface";
78
 
        info.displayedName = q_("Text User Interface");
 
82
        info.displayedName = N_("Text User Interface");
79
83
        info.authors = "Matthew Gates";
80
84
        info.contact = "http://porpoisehead.net/";
81
 
        info.description = q_("Plugin implementation of 0.9.x series Text User Interface (TUI), used in planetarium systems");
 
85
        info.description = N_("Plugin implementation of 0.9.x series Text User Interface (TUI), used in planetarium systems");
82
86
        return info;
83
87
}
84
88
 
120
124
*************************************************************************/
121
125
void TextUserInterface::init()
122
126
{
123
 
        qDebug() << "init called for TextUserInterface";
124
 
        TuiNode* m1 = new TuiNode("1. Set Location");
125
 
        TuiNode* m1_1 = new TuiNodeDouble("1.1 Latitude", 
 
127
        //Reusing translations: The translators will have to do less work if the
 
128
        //strings used here match strings used elsewhere. Do not change strings
 
129
        //unless you have a good reason. --BM
 
130
        
 
131
        StelCore* core = StelApp::getInstance().getCore();
 
132
        //Reusing strings from the location dialog
 
133
        TuiNode* m1 = new TuiNode(N_("Location"));
 
134
        TuiNode* m1_1 = new TuiNodeDouble(N_("Latitude:"),
126
135
                                          this, SLOT(setLatitude(double)),
127
136
                                          getLatitude(), -180, 180, 0.5, m1);
128
 
        TuiNode* m1_2 = new TuiNodeDouble("1.2 Longitude", 
 
137
        TuiNode* m1_2 = new TuiNodeDouble(N_("Longitude:"),
129
138
                                          this, SLOT(setLongitude(double)),
130
139
                                          getLongitude(), -180, 180, 0.5, m1, m1_1);
131
 
        TuiNode* m1_3 = new TuiNodeInt("1.3 Altitude", 
 
140
        TuiNode* m1_3 = new TuiNodeInt(N_("Altitude:"),
132
141
                                       this, SLOT(setAltitude(int)),
133
 
                                                                   StelApp::getInstance().getCore()->getCurrentLocation().altitude,
 
142
                                       core->getCurrentLocation().altitude,
134
143
                                       -200, 200000, 100, m1, m1_2);
135
 
        TuiNode* m1_4 = new TuiNodeEnum("1.4 Solar System Body", 
 
144
        
 
145
        // TODO: Now new Solar System bodies can be added at runtime, so the list
 
146
        // needs to be populated every time this happens. --BM
 
147
        SolarSystem* solarSystem = GETSTELMODULE(SolarSystem);
 
148
        TuiNode* m1_4 = new TuiNodeEnum(N_("Solar System body"),
136
149
                                        this, SLOT(setHomePlanet(QString)),
137
 
                                        GETSTELMODULE(SolarSystem)->getAllPlanetEnglishNames(),
138
 
                                                                        StelApp::getInstance().getCore()->getCurrentLocation().planetName,
 
150
                                        solarSystem->getAllPlanetEnglishNames(),
 
151
                                        core->getCurrentLocation().planetName,
139
152
                                        m1, m1_3);
140
 
        m1_1->setPrevNode(m1_4);
141
153
        m1_1->setNextNode(m1_2);
142
154
        m1_2->setNextNode(m1_3);
143
155
        m1_3->setNextNode(m1_4);
144
156
        m1_4->setNextNode(m1_1);
 
157
        m1_1->loopToTheLast();
145
158
        m1->setChildNode(m1_1);
146
159
 
147
 
        TuiNode* m2 = new TuiNode("2. Date & Time", NULL, m1);
 
160
        TuiNode* m2 = new TuiNode(N_("Date and Time"), NULL, m1);
148
161
        m1->setNextNode(m2);
149
 
        TuiNode* m2_1 = new TuiNodeDateTime("2.1 Sky Time", 
150
 
                                                                                StelApp::getInstance().getCore(),
 
162
        TuiNode* m2_1 = new TuiNodeDateTime(N_("Current date/time"),
 
163
                                            core,
151
164
                                            SLOT(setJDay(double)),  
152
 
                                                                                StelApp::getInstance().getCore()->getJDay(),
 
165
                                            core->getJDay(),
153
166
                                            m2);
154
 
        TuiNode* m2_2 = new TuiNode("2.2 Set Time Zone", m2, m2_1);
155
 
        TuiNode* m2_3 = new TuiNode("2.3 Day Keys", m2, m2_2);
156
 
        TuiNode* m2_4 = new TuiNodeDateTime("2.4 Preset Sky Time", 
157
 
                                                                                StelApp::getInstance().getCore(),
 
167
        TuiNode* m2_2 = new TuiNode(N_("Set time zone"), m2, m2_1);
 
168
        TuiNode* m2_3 = new TuiNode(N_("Day keys"), m2, m2_2);
 
169
        TuiNode* m2_4 = new TuiNodeDateTime(N_("Startup date/time preset"),
 
170
                                                                                core,
158
171
                                            SLOT(setPresetSkyTime(double)), 
159
 
                                                                                StelApp::getInstance().getCore()->getPresetSkyTime(),
 
172
                                                                                core->getPresetSkyTime(),
160
173
                                            m2, m2_3);
161
174
        QStringList startupModes;
162
 
        startupModes << "system" << "preset";
163
 
        TuiNode* m2_5 = new TuiNodeEnum("2.5 Sky Time at Startup", 
164
 
                                        this, SLOT(setStartupDateMode(QString)), startupModes,
165
 
                                                                        StelApp::getInstance().getCore()->getStartupTimeMode(),
 
175
        // TRANSLATORS: The current system time is used at startup
 
176
        startupModes << N_("system");
 
177
        // TRANSLATORS: A pre-set time is used at startup
 
178
        startupModes << N_("preset");
 
179
        TuiNode* m2_5 = new TuiNodeEnum(N_("Startup date and time"),
 
180
                                        this, SLOT(setStartupDateMode(QString)),
 
181
                                        startupModes,
 
182
                                                                        core->getStartupTimeMode(),
166
183
                                        m2, m2_4);
 
184
        StelLocaleMgr& localeMgr = StelApp::getInstance().getLocaleMgr();
167
185
        QStringList dateFormats;
168
 
        dateFormats << "system_default" << "mmddyyyy" << "ddmmyyyy" << "yyyymmdd";
169
 
        TuiNode* m2_6 = new TuiNodeEnum("2.6 Date Display Format", 
170
 
                                        this, SLOT(setDateFormat(QString)), dateFormats,
171
 
                                        StelApp::getInstance().getLocaleMgr().getDateFormatStr(),
 
186
        dateFormats << "system_default" << N_("mmddyyyy") << N_("ddmmyyyy") << N_("yyyymmdd");
 
187
        TuiNode* m2_6 = new TuiNodeEnum(N_("Date display format"), //Used in Time Zone plugin
 
188
                                        this, SLOT(setDateFormat(QString)),
 
189
                                        dateFormats,
 
190
                                        localeMgr.getDateFormatStr(),
172
191
                                        m2, m2_5);
173
192
        QStringList timeFormats;
174
 
        timeFormats << "system_default" << "12h" << "24h";
175
 
        TuiNode* m2_7 = new TuiNodeEnum("2.7 Time Display Format", 
176
 
                                        this, SLOT(setTimeFormat(QString)), timeFormats,
177
 
                                        StelApp::getInstance().getLocaleMgr().getTimeFormatStr(),
 
193
        timeFormats << "system_default";
 
194
        // TRANSLATORS: 12-hour time format
 
195
        timeFormats << N_("12h");
 
196
        // TRANSLATORS: 24-hour time format
 
197
        timeFormats << N_("24h");
 
198
        TuiNode* m2_7 = new TuiNodeEnum(N_("Time display format"), //Used in Time Zone plugin
 
199
                                        this, SLOT(setTimeFormat(QString)),
 
200
                                        timeFormats,
 
201
                                        localeMgr.getTimeFormatStr(),
178
202
                                        m2, m2_6);
179
 
        m2_1->setPrevNode(m2_7);
180
203
        m2_1->setNextNode(m2_2);
181
204
        m2_2->setNextNode(m2_3);
182
205
        m2_3->setNextNode(m2_4);
184
207
        m2_5->setNextNode(m2_6);
185
208
        m2_6->setNextNode(m2_7);
186
209
        m2_7->setNextNode(m2_1);
 
210
        m2_1->loopToTheLast();
187
211
        m2->setChildNode(m2_1);
188
212
 
189
 
        TuiNode* m3 = new TuiNode("3. General", NULL, m2);
 
213
        TuiNode* m3 = new TuiNode(N_("General"), NULL, m2);
190
214
        m2->setNextNode(m3);
191
 
        TuiNode* m3_1 = new TuiNodeEnum("3.1 Sky Culture", 
 
215
        StelSkyCultureMgr& skyCultureMgr = StelApp::getInstance().getSkyCultureMgr();
 
216
        TuiNode* m3_1 = new TuiNodeEnum(N_("Starlore"),
192
217
                                        this, 
193
218
                                        SLOT(setSkyCulture(QString)), 
194
 
                                        StelApp::getInstance().getSkyCultureMgr().getSkyCultureListI18(),
195
 
                                        StelApp::getInstance().getSkyCultureMgr().getCurrentSkyCultureNameI18(),
 
219
                                        skyCultureMgr.getSkyCultureListI18(),
 
220
                                        skyCultureMgr.getCurrentSkyCultureNameI18(),
196
221
                                        m3);
197
 
        TuiNode* m3_2 = new TuiNodeEnum("3.2 Language", 
 
222
        TuiNode* m3_2 = new TuiNodeEnum(N_("Language"),
198
223
                                        this, 
199
224
                                        SLOT(setAppLanguage(QString)), 
200
225
                                                                        StelTranslator::globalTranslator.getAvailableLanguagesNamesNative(StelFileMgr::getLocaleDir()),
201
 
                                        StelTranslator::iso639_1CodeToNativeName(StelApp::getInstance().getLocaleMgr().getAppLanguage()),
 
226
                                        StelTranslator::iso639_1CodeToNativeName(localeMgr.getAppLanguage()),
202
227
                                        m3, m3_1);
203
 
        m3_1->setPrevNode(m3_2);
204
228
        m3_1->setNextNode(m3_2);
205
229
        m3_2->setNextNode(m3_1);
 
230
        m3_1->loopToTheLast();
206
231
        m3->setChildNode(m3_1);
207
232
 
208
 
        TuiNode* m4 = new TuiNode("4. Stars", NULL, m3);
 
233
        TuiNode* m4 = new TuiNode(N_("Stars"), NULL, m3);
209
234
        m3->setNextNode(m4);
210
 
        TuiNode* m4_1 = new TuiNodeBool("4.1 Show Stars", 
211
 
                                        GETSTELMODULE(StarMgr), SLOT(setFlagStars(bool)), 
212
 
                                        GETSTELMODULE(StarMgr)->getFlagStars(), m4); 
213
 
        TuiNode* m4_2 = new TuiNodeDouble("4.2 Star Relative Scale", 
214
 
                                          StelApp::getInstance().getCore()->getSkyDrawer(), SLOT(setRelativeStarScale(double)),
215
 
                                          StelApp::getInstance().getCore()->getSkyDrawer()->getRelativeStarScale(), 0.0, 5., 0.15,
 
235
        StarMgr* starMgr = GETSTELMODULE(StarMgr);
 
236
        TuiNode* m4_1 = new TuiNodeBool(N_("Show stars"),
 
237
                                        starMgr, SLOT(setFlagStars(bool)), 
 
238
                                        starMgr->getFlagStars(), m4);
 
239
        StelSkyDrawer* skyDrawer = core->getSkyDrawer();
 
240
        TuiNode* m4_2 = new TuiNodeDouble(N_("Relative scale:"),
 
241
                                          skyDrawer,
 
242
                                          SLOT(setRelativeStarScale(double)),
 
243
                                          skyDrawer->getRelativeStarScale(),
 
244
                                          0.0, 5., 0.15,
216
245
                                          m4, m4_1);
217
 
        TuiNode* m4_3 = new TuiNodeDouble("4.3 Absolute Star Scale", 
218
 
                                          StelApp::getInstance().getCore()->getSkyDrawer(), SLOT(setAbsoluteStarScale(double)),
219
 
                                          StelApp::getInstance().getCore()->getSkyDrawer()->getAbsoluteStarScale(), 0.0, 9., 0.15,
 
246
        TuiNode* m4_3 = new TuiNodeDouble(N_("Absolute scale:"),
 
247
                                          skyDrawer,
 
248
                                          SLOT(setAbsoluteStarScale(double)),
 
249
                                          skyDrawer->getAbsoluteStarScale(),
 
250
                                          0.0, 9., 0.15,
220
251
                                          m4, m4_2);
221
 
        TuiNode* m4_4 = new TuiNodeDouble("4.4 Twinkling", 
222
 
                                          StelApp::getInstance().getCore()->getSkyDrawer(), SLOT(setTwinkleAmount(double)),
223
 
                                          StelApp::getInstance().getCore()->getSkyDrawer()->getTwinkleAmount(), 0.0, 1.5, 0.1,
 
252
        TuiNode* m4_4 = new TuiNodeDouble(N_("Twinkle:"),
 
253
                                          skyDrawer, SLOT(setTwinkleAmount(double)),
 
254
                                          skyDrawer->getTwinkleAmount(),
 
255
                                          0.0, 1.5, 0.1,
224
256
                                          m4, m4_3);
225
 
        m4_1->setPrevNode(m4_4);
226
257
        m4_1->setNextNode(m4_2);
227
258
        m4_2->setNextNode(m4_3);
228
259
        m4_3->setNextNode(m4_4);
229
260
        m4_4->setNextNode(m4_1);
 
261
        m4_1->loopToTheLast();
230
262
        m4->setChildNode(m4_1);
231
263
 
232
 
        TuiNode* m5 = new TuiNode("5. Colors", NULL, m4);
 
264
        TuiNode* m5 = new TuiNode(N_("Colors"), NULL, m4);
233
265
        m4->setNextNode(m5);
234
 
        TuiNode* m5_1 = new TuiNodeColor("5.1 Constellation Lines", 
235
 
                                         GETSTELMODULE(ConstellationMgr), SLOT(setLinesColor(Vec3f)),
236
 
                                         GETSTELMODULE(ConstellationMgr)->getLinesColor(), 
 
266
        ConstellationMgr* constellationMgr = GETSTELMODULE(ConstellationMgr);
 
267
        TuiNode* m5_1 = new TuiNodeColor(N_("Constellation lines"),
 
268
                                         constellationMgr,
 
269
                                         SLOT(setLinesColor(Vec3f)),
 
270
                                         constellationMgr->getLinesColor(), 
237
271
                                         m5);
238
 
        TuiNode* m5_2 = new TuiNodeColor("5.2 Constellation Names", 
239
 
                                         GETSTELMODULE(ConstellationMgr), SLOT(setLabelsColor(Vec3f)),
240
 
                                         GETSTELMODULE(ConstellationMgr)->getLabelsColor(), 
 
272
        TuiNode* m5_2 = new TuiNodeColor(N_("Constellation labels"),
 
273
                                         constellationMgr,
 
274
                                                                         SLOT(setNamesColor(Vec3f)),
 
275
                                         constellationMgr->getNamesColor(), 
241
276
                                         m5, m5_1);
242
 
        TuiNode* m5_3 = new TuiNode("5.3 Constellation Art", m5, m5_2);
243
 
        TuiNode* m5_4 = new TuiNodeColor("5.4 Constellation Boundaries", 
244
 
                                         GETSTELMODULE(ConstellationMgr), SLOT(setBoundariesColor(Vec3f)),
245
 
                                         GETSTELMODULE(ConstellationMgr)->getBoundariesColor(), 
 
277
        TuiNode* m5_3 = new TuiNode(N_("Constellation art"), m5, m5_2);
 
278
        TuiNode* m5_4 = new TuiNodeColor(N_("Constellation boundaries"),
 
279
                                         constellationMgr,
 
280
                                         SLOT(setBoundariesColor(Vec3f)),
 
281
                                         constellationMgr->getBoundariesColor(), 
246
282
                                         m5, m5_3);
247
 
        TuiNode* m5_5 = new TuiNodeDouble("5.5 Constellation Art Intensity", 
248
 
                                          GETSTELMODULE(ConstellationMgr), SLOT(setArtIntensity(double)),
249
 
                                          GETSTELMODULE(ConstellationMgr)->getArtIntensity(), 0.0, 1.0, 0.05,
 
283
        // TRANSLATORS: Refers to constellation art
 
284
        TuiNode* m5_5 = new TuiNodeDouble(N_("Art brightness:"),
 
285
                                          constellationMgr,
 
286
                                          SLOT(setArtIntensity(double)),
 
287
                                          constellationMgr->getArtIntensity(),
 
288
                                          0.0, 1.0, 0.05,
250
289
                                          m5, m5_4);
251
 
        TuiNode* m5_6 = new TuiNodeColor("5.6 Cardinal Points", 
252
 
                                         GETSTELMODULE(LandscapeMgr), SLOT(setColorCardinalPoints(Vec3f)),
253
 
                                         GETSTELMODULE(LandscapeMgr)->getColorCardinalPoints(), 
 
290
        LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
 
291
        TuiNode* m5_6 = new TuiNodeColor(N_("Cardinal points"),
 
292
                                         landscapeMgr,
 
293
                                         SLOT(setColorCardinalPoints(Vec3f)),
 
294
                                         landscapeMgr->getColorCardinalPoints(), 
254
295
                                         m5, m5_5);
255
 
        TuiNode* m5_7 = new TuiNodeColor("5.7 Planet Names", 
256
 
                                         GETSTELMODULE(SolarSystem), SLOT(setLabelsColor(Vec3f)),
257
 
                                         GETSTELMODULE(SolarSystem)->getLabelsColor(), 
 
296
        TuiNode* m5_7 = new TuiNodeColor(N_("Planet labels"),
 
297
                                         solarSystem, SLOT(setLabelsColor(Vec3f)),
 
298
                                         solarSystem->getLabelsColor(), 
258
299
                                         m5, m5_6);
259
 
        TuiNode* m5_8 = new TuiNodeColor("5.8 Planet Orbits", 
260
 
                                         GETSTELMODULE(SolarSystem), SLOT(setOrbitsColor(Vec3f)),
261
 
                                         GETSTELMODULE(SolarSystem)->getOrbitsColor(), 
 
300
        TuiNode* m5_8 = new TuiNodeColor(N_("Planet orbits"),
 
301
                                         solarSystem, SLOT(setOrbitsColor(Vec3f)),
 
302
                                         solarSystem->getOrbitsColor(), 
262
303
                                         m5, m5_7);
263
 
        TuiNode* m5_9 = new TuiNodeColor("5.9 Planet Trails", 
264
 
                                         GETSTELMODULE(SolarSystem), SLOT(setTrailsColor(Vec3f)),
265
 
                                         GETSTELMODULE(SolarSystem)->getTrailsColor(), 
 
304
        TuiNode* m5_9 = new TuiNodeColor(N_("Planet trails"),
 
305
                                         solarSystem, SLOT(setTrailsColor(Vec3f)),
 
306
                                         solarSystem->getTrailsColor(), 
266
307
                                         m5, m5_8);
267
 
        TuiNode* m5_10 = new TuiNodeColor("5.10 Meridian Line", 
268
 
                                         GETSTELMODULE(GridLinesMgr), SLOT(setColorMeridianLine(Vec3f)),
269
 
                                         GETSTELMODULE(GridLinesMgr)->getColorMeridianLine(), 
 
308
        GridLinesMgr* gridLinesMgr = GETSTELMODULE(GridLinesMgr);
 
309
        TuiNode* m5_10 = new TuiNodeColor(N_("Meridian line"),
 
310
                                         gridLinesMgr,
 
311
                                                                         SLOT(setMeridianLineColor(Vec3f)),
 
312
                                         gridLinesMgr->getMeridianLineColor(), 
270
313
                                         m5, m5_9);
271
 
        TuiNode* m5_11 = new TuiNodeColor("5.11 Azimuthal Grid", 
272
 
                                         GETSTELMODULE(GridLinesMgr), SLOT(setColorAzimuthalGrid(Vec3f)),
273
 
                                         GETSTELMODULE(GridLinesMgr)->getColorAzimuthalGrid(), 
 
314
        TuiNode* m5_11 = new TuiNodeColor(N_("Azimuthal grid"),
 
315
                                         gridLinesMgr,
 
316
                                                                         SLOT(setAzimuthalGridColor(Vec3f)),
 
317
                                         gridLinesMgr->getAzimuthalGridColor(), 
274
318
                                         m5, m5_10);
275
 
        TuiNode* m5_12 = new TuiNodeColor("5.12 Equatorial Grid", 
276
 
                                         GETSTELMODULE(GridLinesMgr), SLOT(setColorEquatorGrid(Vec3f)),
277
 
                                         GETSTELMODULE(GridLinesMgr)->getColorEquatorGrid(), 
 
319
        TuiNode* m5_12 = new TuiNodeColor(N_("Equatorial grid"),
 
320
                                         gridLinesMgr,
 
321
                                                                         SLOT(setEquatorGridColor(Vec3f)),
 
322
                                         gridLinesMgr->getEquatorGridColor(), 
278
323
                                         m5, m5_11);
279
 
        TuiNode* m5_13 = new TuiNodeColor("5.13 Equatorial J2000 Grid", 
280
 
                                         GETSTELMODULE(GridLinesMgr), SLOT(setColorEquatorJ2000Grid(Vec3f)),
281
 
                                         GETSTELMODULE(GridLinesMgr)->getColorEquatorJ2000Grid(), 
 
324
        TuiNode* m5_13 = new TuiNodeColor(N_("Equatorial J2000 grid"),
 
325
                                         gridLinesMgr,
 
326
                                                                         SLOT(setEquatorJ2000GridColor(Vec3f)),
 
327
                                         gridLinesMgr->getEquatorJ2000GridColor(), 
282
328
                                         m5, m5_12);
283
 
        TuiNode* m5_14 = new TuiNodeColor("5.14 Equator Line", 
284
 
                                         GETSTELMODULE(GridLinesMgr), SLOT(setColorEquatorLine(Vec3f)),
285
 
                                         GETSTELMODULE(GridLinesMgr)->getColorEquatorLine(), 
 
329
        TuiNode* m5_14 = new TuiNodeColor(N_("Equator line"),
 
330
                                         gridLinesMgr,
 
331
                                                                         SLOT(setEquatorLineColor(Vec3f)),
 
332
                                         gridLinesMgr->getEquatorLineColor(), 
286
333
                                         m5, m5_13);
287
 
        TuiNode* m5_15 = new TuiNodeColor("5.15 Ecliptic Line", 
288
 
                                         GETSTELMODULE(GridLinesMgr), SLOT(setColorEclipticLine(Vec3f)),
289
 
                                         GETSTELMODULE(GridLinesMgr)->getColorEclipticLine(), 
290
 
                                         m5, m5_14);
291
 
        TuiNode* m5_16 = new TuiNodeColor("5.16 Nebula Names", 
292
 
                                         GETSTELMODULE(NebulaMgr), SLOT(setLabelsColor(Vec3f)),
293
 
                                         GETSTELMODULE(NebulaMgr)->getLabelsColor(), 
294
 
                                         m5, m5_15);
295
 
        TuiNode* m5_17 = new TuiNodeColor("5.17 Nebubla Hints", 
296
 
                                         GETSTELMODULE(NebulaMgr), SLOT(setCirclesColor(Vec3f)),
297
 
                                         GETSTELMODULE(NebulaMgr)->getCirclesColor(), 
298
 
                                         m5, m5_16);
299
 
        m5_1->setPrevNode(m5_17);
 
334
        TuiNode* m5_15 = new TuiNodeColor(N_("Ecliptic line"),
 
335
                                         gridLinesMgr,
 
336
                                                                         SLOT(setEclipticLineColor(Vec3f)),
 
337
                                         gridLinesMgr->getEclipticLineColor(), 
 
338
                                         m5, m5_14);
 
339
        NebulaMgr* nebulaMgr = GETSTELMODULE(NebulaMgr);
 
340
        TuiNode* m5_16 = new TuiNodeColor(N_("Nebula names"),
 
341
                                         nebulaMgr, SLOT(setLabelsColor(Vec3f)),
 
342
                                         nebulaMgr->getLabelsColor(), 
 
343
                                         m5, m5_15);
 
344
        TuiNode* m5_17 = new TuiNodeColor(N_("Nebula hints"),
 
345
                                          nebulaMgr, SLOT(setCirclesColor(Vec3f)),
 
346
                                          nebulaMgr->getCirclesColor(), 
 
347
                                          m5, m5_16);
 
348
        TuiNode* m5_18 = new TuiNodeColor(N_("Horizon line"),
 
349
                                         gridLinesMgr,
 
350
                                         SLOT(setHorizonLineColor(Vec3f)),
 
351
                                         gridLinesMgr->getHorizonLineColor(),
 
352
                                         m5, m5_17);
 
353
        TuiNode* m5_19 = new TuiNodeColor(N_("Galactic grid"),
 
354
                                         gridLinesMgr,
 
355
                                         SLOT(setGalacticGridColor(Vec3f)),
 
356
                                         gridLinesMgr->getGalacticGridColor(),
 
357
                                         m5, m5_18);
 
358
        TuiNode* m5_20 = new TuiNodeColor(N_("Galactic plane line"),
 
359
                                         gridLinesMgr,
 
360
                                         SLOT(setGalacticPlaneLineColor(Vec3f)),
 
361
                                         gridLinesMgr->getGalacticPlaneLineColor(),
 
362
                                         m5, m5_19);
 
363
 
300
364
        m5_1->setNextNode(m5_2);
301
365
        m5_2->setNextNode(m5_3);
302
366
        m5_3->setNextNode(m5_4);
313
377
        m5_14->setNextNode(m5_15);
314
378
        m5_15->setNextNode(m5_16);
315
379
        m5_16->setNextNode(m5_17);
316
 
        m5_17->setNextNode(m5_1);
 
380
        m5_17->setNextNode(m5_18);
 
381
        m5_18->setNextNode(m5_19);
 
382
        m5_19->setNextNode(m5_20);
 
383
        m5_20->setNextNode(m5_1);
 
384
        m5_1->loopToTheLast();
317
385
        m5->setChildNode(m5_1);
318
386
 
319
 
        TuiNode* m6 = new TuiNode("6. Effects", NULL, m5);
 
387
        TuiNode* m6 = new TuiNode(N_("Effects"), NULL, m5);
320
388
        m5->setNextNode(m6);
321
 
        TuiNode* m6_1 = new TuiNodeInt("6.1 Light Pollution Level", 
322
 
                                       GETSTELMODULE(LandscapeMgr), SLOT(setAtmosphereBortleLightPollution(int)),
 
389
        TuiNode* m6_1 = new TuiNodeInt(N_("Light pollution:"),
 
390
                                       landscapeMgr,
 
391
                                       SLOT(setAtmosphereBortleLightPollution(int)),
323
392
                                       3, 1, 9, 1,
324
393
                                       m6);
325
 
        TuiNode* m6_2 = new TuiNodeEnum("6.2 Landscape",
326
 
                                        GETSTELMODULE(LandscapeMgr),
 
394
        TuiNode* m6_2 = new TuiNodeEnum(N_("Landscape"),
 
395
                                        landscapeMgr,
327
396
                                        SLOT(setCurrentLandscapeName(QString)),
328
 
                                        GETSTELMODULE(LandscapeMgr)->getAllLandscapeNames(),
329
 
                                        GETSTELMODULE(LandscapeMgr)->getCurrentLandscapeName(),
 
397
                                        landscapeMgr->getAllLandscapeNames(),
 
398
                                        landscapeMgr->getCurrentLandscapeName(),
330
399
                                        m6, m6_1);
331
 
        TuiNode* m6_3 = new TuiNodeBool("6.3 Manual Zoom", 
332
 
                                        GETSTELMODULE(StelMovementMgr), SLOT(setFlagAutoZoomOutResetsDirection(bool)), 
333
 
                                        GETSTELMODULE(StelMovementMgr)->getFlagAutoZoomOutResetsDirection(), 
 
400
        StelMovementMgr* movementMgr = GETSTELMODULE(StelMovementMgr);
 
401
        TuiNode* m6_3 = new TuiNodeBool(N_("Manual zoom"),
 
402
                                        movementMgr,
 
403
                                        SLOT(setFlagAutoZoomOutResetsDirection(bool)), 
 
404
                                        movementMgr->getFlagAutoZoomOutResetsDirection(), 
334
405
                                        m6, m6_2);
335
 
        TuiNode* m6_4 = new TuiNode("6.4 Magnitude Scaling Multiplier", m6, m6_3);
336
 
        TuiNode* m6_5 = new TuiNodeFloat("6.5 Milky Way Intensity",
337
 
                                         GETSTELMODULE(MilkyWay), SLOT(setIntensity(float)),
338
 
                                         GETSTELMODULE(MilkyWay)->getIntensity(), 0, 10.0, 0.1, 
 
406
        TuiNode* m6_4 = new TuiNode(N_("Magnitude scaling multiplier"),
 
407
                                            m6, m6_3);
 
408
        TuiNode* m6_5 = new TuiNodeFloat(N_("Milky Way intensity:"),
 
409
                                         GETSTELMODULE(MilkyWay),
 
410
                                         SLOT(setIntensity(float)),
 
411
                                         GETSTELMODULE(MilkyWay)->getIntensity(),
 
412
                                         0, 10.0, 0.1, 
339
413
                                         m6, m6_4);
340
 
        TuiNode* m6_6 = new TuiNode("6.6 Nebula Label Frequency", m6, m6_5);
341
 
        TuiNode* m6_7 = new TuiNodeFloat("6.7 Zoom Duration", 
342
 
                                         GETSTELMODULE(StelMovementMgr), SLOT(setAutoMoveDuration(float)), 
343
 
                                         GETSTELMODULE(StelMovementMgr)->getAutoMoveDuration(), 0, 20.0, 0.1,
 
414
        TuiNode* m6_6 = new TuiNode(N_("Nebula label frequency:"), m6, m6_5);
 
415
        TuiNode* m6_7 = new TuiNodeFloat(N_("Zoom duration:"),
 
416
                                         movementMgr,
 
417
                                         SLOT(setAutoMoveDuration(float)), 
 
418
                                         movementMgr->getAutoMoveDuration(),
 
419
                                         0, 20.0, 0.1,
344
420
                                         m6, m6_6);
345
 
        TuiNode* m6_8 = new TuiNode("6.8 Cursor Timeout", m6, m6_7);
346
 
        TuiNode* m6_9 = new TuiNodeBool("6.9 Setting Landscape Sets Location", 
347
 
                                        GETSTELMODULE(LandscapeMgr), SLOT(setFlagLandscapeSetsLocation(bool)), 
348
 
                                        GETSTELMODULE(LandscapeMgr)->getFlagLandscapeSetsLocation(), 
 
421
        TuiNode* m6_8 = new TuiNode(N_("Cursor timeout:"), m6, m6_7);
 
422
        TuiNode* m6_9 = new TuiNodeBool(N_("Setting landscape sets location"),
 
423
                                        landscapeMgr,
 
424
                                        SLOT(setFlagLandscapeSetsLocation(bool)), 
 
425
                                        landscapeMgr->getFlagLandscapeSetsLocation(), 
349
426
                                        m6, m6_8);
350
 
        m6_1->setPrevNode(m6_9);
351
427
        m6_1->setNextNode(m6_2);
352
428
        m6_2->setNextNode(m6_3);
353
429
        m6_3->setNextNode(m6_4);
357
433
        m6_7->setNextNode(m6_8);
358
434
        m6_8->setNextNode(m6_9);
359
435
        m6_9->setNextNode(m6_1);
 
436
        m6_1->loopToTheLast();
360
437
        m6->setChildNode(m6_1);
361
438
 
362
 
        TuiNode* m7 = new TuiNode("7. Scripts", NULL, m6);
363
 
        m6->setNextNode(m7);
364
 
        TuiNode* m7_1 = new TuiNodeEnum("7.1 Run Local Script", 
365
 
                                                                        &StelMainGraphicsView::getInstance().getScriptMgr(),
 
439
        #ifndef DISABLE_SCRIPTING
 
440
        TuiNode* m7 = new TuiNode(N_("Scripts"), NULL, m6);
 
441
        m6->setNextNode(m7);    
 
442
        StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getScriptMgr();
 
443
        TuiNode* m7_1 = new TuiNodeEnum(N_("Run local script"),
 
444
                                        &scriptMgr,
366
445
                                        SLOT(runScript(QString)),
367
 
                                                                        StelMainGraphicsView::getInstance().getScriptMgr().getScriptList(),
 
446
                                        scriptMgr.getScriptList(),
368
447
                                        "",
369
448
                                        m7);
370
 
        TuiNode* m7_2 = new TuiNodeActivate("7.2 Stop Running Script", &StelMainGraphicsView::getInstance().getScriptMgr(), SLOT(stopScript()), m7, m7_1);
371
 
        TuiNode* m7_3 = new TuiNode("7.3 CD/DVD Script", m7, m7_2);
372
 
        m7_1->setPrevNode(m7_2);
 
449
        TuiNode* m7_2 = new TuiNodeActivate(N_("Stop running script"),
 
450
                                            &scriptMgr, SLOT(stopScript()),
 
451
                                            m7, m7_1);
 
452
        TuiNode* m7_3 = new TuiNode(N_("CD/DVD script"), m7, m7_2);
373
453
        m7_1->setNextNode(m7_2);
374
454
        m7_2->setNextNode(m7_3);
375
455
        m7_3->setNextNode(m7_1);
 
456
        m7_1->loopToTheLast();
376
457
        m7->setChildNode(m7_1);
377
458
 
378
 
        TuiNode* m8 = new TuiNode("8. Administration", NULL, m7);
 
459
 
 
460
        TuiNode* m8 = new TuiNode(N_("Administration"), NULL, m7);
379
461
        m7->setNextNode(m8);
 
462
        #endif
 
463
        #ifdef DISABLE_SCRIPTING
 
464
        TuiNode* m8 = new TuiNode(N_("Administration"), NULL, m6);
 
465
        m6->setNextNode(m8);
 
466
        #endif
380
467
        m8->setNextNode(m1);
381
 
        m1->setPrevNode(m8);
382
 
        TuiNode* m8_1 = new TuiNode("8.1 Load Default Configuration", m8);
383
 
        TuiNode* m8_2 = new TuiNodeActivate("8.2 Save Current Configuration", this, SLOT(saveDefaultSettings()), m8, m8_1);
384
 
        TuiNode* m8_3 = new TuiNode("8.3 Shut Down", m8, m8_2);
385
 
        m8_1->setPrevNode(m8_3);
 
468
        m1->loopToTheLast();
 
469
        TuiNode* m8_1 = new TuiNode(N_("Load default configuration"), m8);
 
470
        TuiNode* m8_2 = new TuiNodeActivate(N_("Save current configuration"),
 
471
                                            this, SLOT(saveDefaultSettings()),
 
472
                                            m8, m8_1);
 
473
        TuiNode* m8_3 = new TuiNode(N_("Shut down"), m8, m8_2);
386
474
        m8_1->setNextNode(m8_2);
387
475
        m8_2->setNextNode(m8_3);
388
476
        m8_3->setNextNode(m8_1);
 
477
        m8_1->loopToTheLast();
389
478
        m8->setChildNode(m8_1);
390
479
 
391
480
 
399
488
{
400
489
        if (tuiActive)
401
490
        {
402
 
                QString tuiText = "[no TUI node]";
 
491
                int x = 0, y = 0;
 
492
                StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui());
 
493
                if (gui->getVisible())
 
494
                {
 
495
                        QGraphicsItem* bottomBar = dynamic_cast<QGraphicsItem*>(gui->getButtonBar());
 
496
                        LeftStelBar* sideBar = gui->getWindowsButtonBar();                      
 
497
                        x = (sideBar) ? sideBar->boundingRectNoHelpLabel().right() : 50;
 
498
                        y = (bottomBar) ? bottomBar->boundingRect().height() : 50;
 
499
                }
 
500
                
 
501
                x += 20;
 
502
                y += 15;
 
503
 
 
504
                QString tuiText = q_("[no TUI node]");
403
505
                if (currentNode!=NULL)
404
506
                        tuiText = currentNode->getDisplayText();
405
507
 
406
508
                StelPainter painter(core->getProjection(StelCore::FrameAltAz));
407
509
                painter.setFont(font);
408
510
                painter.setColor(0.3,1,0.3);
409
 
                painter.drawText(StelMainGraphicsView::getInstance().size().width()*0.6,
410
 
                                 50, tuiText, 0, 0, 0, false);
 
511
                painter.drawText(x, y, tuiText, 0, 0, 0, false);
411
512
        }
412
513
}
413
514
 
588
689
 
589
690
        // sub-menu 5: colors
590
691
        conf->setValue("color/const_lines_color", colToConf(cmgr->getLinesColor()));
591
 
        conf->setValue("color/const_names_color", colToConf(cmgr->getLabelsColor()));
 
692
        conf->setValue("color/const_names_color", colToConf(cmgr->getNamesColor()));
592
693
        conf->setValue("color/const_boundary_color", colToConf(cmgr->getBoundariesColor()));
593
694
        conf->setValue("viewing/constellation_art_intensity", cmgr->getArtIntensity());
594
695
        conf->setValue("color/cardinal_color", colToConf(lmgr->getColorCardinalPoints()) );
595
696
        conf->setValue("color/planet_names_color", colToConf(ssmgr->getLabelsColor()));
596
697
        conf->setValue("color/planet_orbits_color", colToConf(ssmgr->getOrbitsColor()));
597
698
        conf->setValue("color/object_trails_color", colToConf(ssmgr->getTrailsColor()));
598
 
        conf->setValue("color/meridian_color", colToConf(glmgr->getColorMeridianLine()));
599
 
        conf->setValue("color/azimuthal_color", colToConf(glmgr->getColorAzimuthalGrid()));
600
 
        conf->setValue("color/equator_color", colToConf(glmgr->getColorEquatorGrid()));
601
 
        conf->setValue("color/equatorial_J2000_color", colToConf(glmgr->getColorEquatorJ2000Grid()));
602
 
        conf->setValue("color/equator_color", colToConf(glmgr->getColorEquatorLine()));
603
 
        conf->setValue("color/ecliptic_color", colToConf(glmgr->getColorEclipticLine()));
 
699
        conf->setValue("color/meridian_color", colToConf(glmgr->getMeridianLineColor()));
 
700
        conf->setValue("color/azimuthal_color", colToConf(glmgr->getAzimuthalGridColor()));
 
701
        conf->setValue("color/equator_color", colToConf(glmgr->getEquatorGridColor()));
 
702
        conf->setValue("color/equatorial_J2000_color", colToConf(glmgr->getEquatorJ2000GridColor()));
 
703
        conf->setValue("color/equator_color", colToConf(glmgr->getEquatorLineColor()));
 
704
        conf->setValue("color/ecliptic_color", colToConf(glmgr->getEclipticLineColor()));
604
705
        conf->setValue("color/nebula_label_color", colToConf(nmgr->getLabelsColor()));
605
706
        conf->setValue("color/nebula_circle_color", colToConf(nmgr->getCirclesColor()));
606
707
 
607
708
        // sub-menu 6: effects
608
 
        // TODO enable this when we do the release after 0.10.2 - this plugin will crash for 0.10.2 because
609
 
        // getAtmosphereBortleLightPollution() was not defined in the 0.10.2 release.
610
 
        // conf->setValue("stars/init_bortle_scale", lmgr->getAtmosphereBortleLightPollution());
 
709
        conf->setValue("stars/init_bortle_scale", lmgr->getAtmosphereBortleLightPollution());
611
710
        lmgr->setDefaultLandscapeID(lmgr->getCurrentLandscapeID());
612
711
        conf->setValue("navigation/auto_zoom_out_resets_direction", mvmgr->getFlagAutoZoomOutResetsDirection());
613
712
        conf->setValue("astro/milky_way_intensity", milk->getIntensity());