TextUserInterface.cpp   TextUserInterface.cpp 
skipping to change at line 16 skipping to change at line 16
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "TextUserInterface.hpp" #include "TextUserInterface.hpp"
#include "TuiNode.hpp" #include "TuiNode.hpp"
#include "TuiNodeActivate.hpp" #include "TuiNodeActivate.hpp"
#include "TuiNodeBool.hpp" #include "TuiNodeBool.hpp"
#include "TuiNodeInt.hpp" #include "TuiNodeInt.hpp"
#include "TuiNodeDouble.hpp" #include "TuiNodeDouble.hpp"
#include "TuiNodeFloat.hpp" #include "TuiNodeFloat.hpp"
#include "TuiNodeDateTime.hpp" #include "TuiNodeDateTime.hpp"
skipping to change at line 50 skipping to change at line 50
#include "NebulaMgr.hpp" #include "NebulaMgr.hpp"
#include "SolarSystem.hpp" #include "SolarSystem.hpp"
#include "LandscapeMgr.hpp" #include "LandscapeMgr.hpp"
#include "GridLinesMgr.hpp" #include "GridLinesMgr.hpp"
#include "MilkyWay.hpp" #include "MilkyWay.hpp"
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainGraphicsView.hpp"
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#ifndef DISABLE_SCRIPTING
#include "StelScriptMgr.hpp" #include "StelScriptMgr.hpp"
#endif
#include "StelGui.hpp"
#include "StelGuiItems.hpp"// Funny thing to include in a TEXT user interfa
ce...
#include <QtOpenGL> #include <QtOpenGL>
#include <QKeyEvent> #include <QKeyEvent>
#include <QDebug> #include <QDebug>
#include <QLabel> #include <QLabel>
/************************************************************************* /*************************************************************************
Utility functions Utility functions
*************************************************************************/ *************************************************************************/
QString colToConf(const Vec3f& c) QString colToConf(const Vec3f& c)
skipping to change at line 78 skipping to change at line 82
*************************************************************************/ *************************************************************************/
StelModule* TextUserInterfaceStelPluginInterface::getStelModule() const StelModule* TextUserInterfaceStelPluginInterface::getStelModule() const
{ {
return new TextUserInterface(); return new TextUserInterface();
} }
StelPluginInfo TextUserInterfaceStelPluginInterface::getPluginInfo() const StelPluginInfo TextUserInterfaceStelPluginInterface::getPluginInfo() const
{ {
StelPluginInfo info; StelPluginInfo info;
info.id = "TextUserInterface"; info.id = "TextUserInterface";
info.displayedName = q_("Text User Interface"); info.displayedName = N_("Text User Interface");
info.authors = "Matthew Gates"; info.authors = "Matthew Gates";
info.contact = "http://porpoisehead.net/"; info.contact = "http://porpoisehead.net/";
info.description = q_("Plugin implementation of 0.9.x series Text Us er Interface (TUI), used in planetarium systems"); info.description = N_("Plugin implementation of 0.9.x series Text Us er Interface (TUI), used in planetarium systems");
return info; return info;
} }
Q_EXPORT_PLUGIN2(TextUserInterface, TextUserInterfaceStelPluginInterface) Q_EXPORT_PLUGIN2(TextUserInterface, TextUserInterfaceStelPluginInterface)
/************************************************************************* /*************************************************************************
Constructor Constructor
*************************************************************************/ *************************************************************************/
TextUserInterface::TextUserInterface() TextUserInterface::TextUserInterface()
: dummyDialog(this), tuiActive(false), currentNode(NULL) : dummyDialog(this), tuiActive(false), currentNode(NULL)
{ {
setObjectName("TextUserInterface"); setObjectName("TextUserInterface");
font.setPixelSize(15);
} }
/************************************************************************* /*************************************************************************
Destructor Destructor
*************************************************************************/ *************************************************************************/
TextUserInterface::~TextUserInterface() TextUserInterface::~TextUserInterface()
{ {
} }
/************************************************************************* /*************************************************************************
skipping to change at line 121 skipping to change at line 124
if (actionName==StelModule::ActionHandleKeys) if (actionName==StelModule::ActionHandleKeys)
return -1; return -1;
return 0; return 0;
} }
/************************************************************************* /*************************************************************************
Init our module Init our module
*************************************************************************/ *************************************************************************/
void TextUserInterface::init() void TextUserInterface::init()
{ {
qDebug() << "init called for TextUserInterface"; //Reusing translations: The translators will have to do less work if
TuiNode* m1 = new TuiNode("1. Set Location"); the
TuiNode* m1_1 = new TuiNodeDouble("1.1 Latitude", //strings used here match strings used elsewhere. Do not change stri
ngs
//unless you have a good reason. --BM
StelCore* core = StelApp::getInstance().getCore();
// Main config.
loadConfiguration();
//Reusing strings from the location dialog
TuiNode* m1 = new TuiNode(N_("Location"));
TuiNode* m1_1 = new TuiNodeDouble(N_("Latitude:"),
this, SLOT(setLatitude(double)), this, SLOT(setLatitude(double)),
getLatitude(), -180, 180, 0.5, m1) ; getLatitude(), -180, 180, 0.5, m1) ;
TuiNode* m1_2 = new TuiNodeDouble("1.2 Longitude", TuiNode* m1_2 = new TuiNodeDouble(N_("Longitude:"),
this, SLOT(setLongitude(double)), this, SLOT(setLongitude(double)),
getLongitude(), -180, 180, 0.5, m1 , m1_1); getLongitude(), -180, 180, 0.5, m1 , m1_1);
TuiNode* m1_3 = new TuiNodeInt("1.3 Altitude", TuiNode* m1_3 = new TuiNodeInt(N_("Altitude:"),
this, SLOT(setAltitude(int)), this, SLOT(setAltitude(int)),
StelApp:: getInstance().getCore()->getCurrentLocation().altitude, core->getCurrentLocation().altitude,
-200, 200000, 100, m1, m1_2); -200, 200000, 100, m1, m1_2);
TuiNode* m1_4 = new TuiNodeEnum("1.4 Solar System Body",
// TODO: Now new Solar System bodies can be added at runtime, so the
list
// needs to be populated every time this happens. --BM
SolarSystem* solarSystem = GETSTELMODULE(SolarSystem);
TuiNode* m1_4 = new TuiNodeEnum(N_("Solar System body"),
this, SLOT(setHomePlanet(QString)), this, SLOT(setHomePlanet(QString)),
GETSTELMODULE(SolarSystem)->getAllPl solarSystem->getAllPlanetEnglishName
anetEnglishNames(), s(),
Stel core->getCurrentLocation().planetNam
App::getInstance().getCore()->getCurrentLocation().planetName, e,
m1, m1_3); m1, m1_3);
m1_1->setPrevNode(m1_4);
m1_1->setNextNode(m1_2); m1_1->setNextNode(m1_2);
m1_2->setNextNode(m1_3); m1_2->setNextNode(m1_3);
m1_3->setNextNode(m1_4); m1_3->setNextNode(m1_4);
m1_4->setNextNode(m1_1); m1_4->setNextNode(m1_1);
m1_1->loopToTheLast();
m1->setChildNode(m1_1); m1->setChildNode(m1_1);
TuiNode* m2 = new TuiNode("2. Date & Time", NULL, m1); TuiNode* m2 = new TuiNode(N_("Date and Time"), NULL, m1);
m1->setNextNode(m2); m1->setNextNode(m2);
TuiNode* m2_1 = new TuiNodeDateTime("2.1 Sky Time", TuiNode* m2_1 = new TuiNodeDateTime(N_("Current date/time"),
core,
StelApp::getInstance().getCore(),
SLOT(setJDay(double)), SLOT(setJDay(double)),
StelApp::getInstance().getCore()->getJDay(), core->getJDay(),
m2); m2);
TuiNode* m2_2 = new TuiNode("2.2 Set Time Zone", m2, m2_1); TuiNode* m2_2 = new TuiNode(N_("Set time zone"), m2, m2_1);
TuiNode* m2_3 = new TuiNode("2.3 Day Keys", m2, m2_2); TuiNode* m2_3 = new TuiNode(N_("Day keys"), m2, m2_2);
TuiNode* m2_4 = new TuiNodeDateTime("2.4 Preset Sky Time", TuiNode* m2_4 = new TuiNodeDateTime(N_("Startup date/time preset"),
StelApp::getInstance().getCore(), core,
SLOT(setPresetSkyTime(double)), SLOT(setPresetSkyTime(double)),
StelApp::getInstance().getCore()->getPresetSkyTime(), core->getPresetSkyTime(),
m2, m2_3); m2, m2_3);
QStringList startupModes; QStringList startupModes;
startupModes << "system" << "preset"; // TRANSLATORS: The current system time is used at startup
TuiNode* m2_5 = new TuiNodeEnum("2.5 Sky Time at Startup", startupModes << N_("system");
this, SLOT(setStartupDateMode(QStrin // TRANSLATORS: A pre-set time is used at startup
g)), startupModes, startupModes << N_("preset");
Stel TuiNode* m2_5 = new TuiNodeEnum(N_("Startup date and time"),
App::getInstance().getCore()->getStartupTimeMode(), this, SLOT(setStartupDateMode(QStrin
g)),
startupModes,
core
->getStartupTimeMode(),
m2, m2_4); m2, m2_4);
StelLocaleMgr& localeMgr = StelApp::getInstance().getLocaleMgr();
QStringList dateFormats; QStringList dateFormats;
dateFormats << "system_default" << "mmddyyyy" << "ddmmyyyy" << "yyyy dateFormats << "system_default" << N_("mmddyyyy") << N_("ddmmyyyy")
mmdd"; << N_("yyyymmdd");
TuiNode* m2_6 = new TuiNodeEnum("2.6 Date Display Format", TuiNode* m2_6 = new TuiNodeEnum(N_("Date display format"), //Used in
this, SLOT(setDateFormat(QString)), Time Zone plugin
dateFormats, this, SLOT(setDateFormat(QString)),
StelApp::getInstance().getLocaleMgr( dateFormats,
).getDateFormatStr(), localeMgr.getDateFormatStr(),
m2, m2_5); m2, m2_5);
QStringList timeFormats; QStringList timeFormats;
timeFormats << "system_default" << "12h" << "24h"; timeFormats << "system_default";
TuiNode* m2_7 = new TuiNodeEnum("2.7 Time Display Format", // TRANSLATORS: 12-hour time format
this, SLOT(setTimeFormat(QString)), timeFormats << N_("12h");
timeFormats, // TRANSLATORS: 24-hour time format
StelApp::getInstance().getLocaleMgr( timeFormats << N_("24h");
).getTimeFormatStr(), TuiNode* m2_7 = new TuiNodeEnum(N_("Time display format"), //Used in
Time Zone plugin
this, SLOT(setTimeFormat(QString)),
timeFormats,
localeMgr.getTimeFormatStr(),
m2, m2_6); m2, m2_6);
m2_1->setPrevNode(m2_7);
m2_1->setNextNode(m2_2); m2_1->setNextNode(m2_2);
m2_2->setNextNode(m2_3); m2_2->setNextNode(m2_3);
m2_3->setNextNode(m2_4); m2_3->setNextNode(m2_4);
m2_4->setNextNode(m2_5); m2_4->setNextNode(m2_5);
m2_5->setNextNode(m2_6); m2_5->setNextNode(m2_6);
m2_6->setNextNode(m2_7); m2_6->setNextNode(m2_7);
m2_7->setNextNode(m2_1); m2_7->setNextNode(m2_1);
m2_1->loopToTheLast();
m2->setChildNode(m2_1); m2->setChildNode(m2_1);
TuiNode* m3 = new TuiNode("3. General", NULL, m2); TuiNode* m3 = new TuiNode(N_("General"), NULL, m2);
m2->setNextNode(m3); m2->setNextNode(m3);
TuiNode* m3_1 = new TuiNodeEnum("3.1 Sky Culture", StelSkyCultureMgr& skyCultureMgr = StelApp::getInstance().getSkyCult
ureMgr();
TuiNode* m3_1 = new TuiNodeEnum(N_("Starlore"),
this, this,
SLOT(setSkyCulture(QString)), SLOT(setSkyCulture(QString)),
StelApp::getInstance().getSkyCulture skyCultureMgr.getSkyCultureListI18()
Mgr().getSkyCultureListI18(), ,
StelApp::getInstance().getSkyCulture skyCultureMgr.getCurrentSkyCultureNa
Mgr().getCurrentSkyCultureNameI18(), meI18(),
m3); m3);
TuiNode* m3_2 = new TuiNodeEnum("3.2 Language", TuiNode* m3_2 = new TuiNodeEnum(N_("Language"),
this, this,
SLOT(setAppLanguage(QString)), SLOT(setAppLanguage(QString)),
Stel Translator::globalTranslator.getAvailableLanguagesNamesNative(StelFileMgr:: getLocaleDir()), Stel Translator::globalTranslator.getAvailableLanguagesNamesNative(StelFileMgr:: getLocaleDir()),
StelTranslator::iso639_1CodeToNative Name(StelApp::getInstance().getLocaleMgr().getAppLanguage()), StelTranslator::iso639_1CodeToNative Name(localeMgr.getAppLanguage()),
m3, m3_1); m3, m3_1);
m3_1->setPrevNode(m3_2);
m3_1->setNextNode(m3_2); m3_1->setNextNode(m3_2);
m3_2->setNextNode(m3_1); m3_2->setNextNode(m3_1);
m3_1->loopToTheLast();
m3->setChildNode(m3_1); m3->setChildNode(m3_1);
TuiNode* m4 = new TuiNode("4. Stars", NULL, m3); TuiNode* m4 = new TuiNode(N_("Stars"), NULL, m3);
m3->setNextNode(m4); m3->setNextNode(m4);
TuiNode* m4_1 = new TuiNodeBool("4.1 Show Stars", StarMgr* starMgr = GETSTELMODULE(StarMgr);
GETSTELMODULE(StarMgr), SLOT(setFlag TuiNode* m4_1 = new TuiNodeBool(N_("Show stars"),
Stars(bool)), starMgr, SLOT(setFlagStars(bool)),
GETSTELMODULE(StarMgr)->getFlagStars starMgr->getFlagStars(), m4);
(), m4); StelSkyDrawer* skyDrawer = core->getSkyDrawer();
TuiNode* m4_2 = new TuiNodeDouble("4.2 Star Relative Scale", TuiNode* m4_2 = new TuiNodeDouble(N_("Relative scale:"),
StelApp::getInstance().getCore()-> skyDrawer,
getSkyDrawer(), SLOT(setRelativeStarScale(double)), SLOT(setRelativeStarScale(double))
StelApp::getInstance().getCore()-> ,
getSkyDrawer()->getRelativeStarScale(), 0.0, 5., 0.15, skyDrawer->getRelativeStarScale(),
0.0, 5., 0.15,
m4, m4_1); m4, m4_1);
TuiNode* m4_3 = new TuiNodeDouble("4.3 Absolute Star Scale", TuiNode* m4_3 = new TuiNodeDouble(N_("Absolute scale:"),
StelApp::getInstance().getCore()-> skyDrawer,
getSkyDrawer(), SLOT(setAbsoluteStarScale(double)), SLOT(setAbsoluteStarScale(double))
StelApp::getInstance().getCore()-> ,
getSkyDrawer()->getAbsoluteStarScale(), 0.0, 9., 0.15, skyDrawer->getAbsoluteStarScale(),
0.0, 9., 0.15,
m4, m4_2); m4, m4_2);
TuiNode* m4_4 = new TuiNodeDouble("4.4 Twinkling", TuiNode* m4_4 = new TuiNodeDouble(N_("Twinkle:"),
StelApp::getInstance().getCore()-> skyDrawer, SLOT(setTwinkleAmount(d
getSkyDrawer(), SLOT(setTwinkleAmount(double)), ouble)),
StelApp::getInstance().getCore()-> skyDrawer->getTwinkleAmount(),
getSkyDrawer()->getTwinkleAmount(), 0.0, 1.5, 0.1, 0.0, 1.5, 0.1,
m4, m4_3); m4, m4_3);
m4_1->setPrevNode(m4_4);
m4_1->setNextNode(m4_2); m4_1->setNextNode(m4_2);
m4_2->setNextNode(m4_3); m4_2->setNextNode(m4_3);
m4_3->setNextNode(m4_4); m4_3->setNextNode(m4_4);
m4_4->setNextNode(m4_1); m4_4->setNextNode(m4_1);
m4_1->loopToTheLast();
m4->setChildNode(m4_1); m4->setChildNode(m4_1);
TuiNode* m5 = new TuiNode("5. Colors", NULL, m4); TuiNode* m5 = new TuiNode(N_("Colors"), NULL, m4);
m4->setNextNode(m5); m4->setNextNode(m5);
TuiNode* m5_1 = new TuiNodeColor("5.1 Constellation Lines", ConstellationMgr* constellationMgr = GETSTELMODULE(ConstellationMgr)
GETSTELMODULE(ConstellationMgr), SL ;
OT(setLinesColor(Vec3f)), TuiNode* m5_1 = new TuiNodeColor(N_("Constellation lines"),
GETSTELMODULE(ConstellationMgr)->ge constellationMgr,
tLinesColor(), SLOT(setLinesColor(Vec3f)),
constellationMgr->getLinesColor(),
m5); m5);
TuiNode* m5_2 = new TuiNodeColor("5.2 Constellation Names", TuiNode* m5_2 = new TuiNodeColor(N_("Constellation labels"),
GETSTELMODULE(ConstellationMgr), SL constellationMgr,
OT(setLabelsColor(Vec3f)), SLOT(setLabelsColor(Vec3f)),
GETSTELMODULE(ConstellationMgr)->ge constellationMgr->getLabelsColor(),
tLabelsColor(),
m5, m5_1); m5, m5_1);
TuiNode* m5_3 = new TuiNode("5.3 Constellation Art", m5, m5_2); TuiNode* m5_3 = new TuiNode(N_("Constellation art"), m5, m5_2);
TuiNode* m5_4 = new TuiNodeColor("5.4 Constellation Boundaries", TuiNode* m5_4 = new TuiNodeColor(N_("Constellation boundaries"),
GETSTELMODULE(ConstellationMgr), SL constellationMgr,
OT(setBoundariesColor(Vec3f)), SLOT(setBoundariesColor(Vec3f)),
GETSTELMODULE(ConstellationMgr)->ge constellationMgr->getBoundariesColo
tBoundariesColor(), r(),
m5, m5_3); m5, m5_3);
TuiNode* m5_5 = new TuiNodeDouble("5.5 Constellation Art Intensity", // TRANSLATORS: Refers to constellation art
GETSTELMODULE(ConstellationMgr), S TuiNode* m5_5 = new TuiNodeDouble(N_("Art brightness:"),
LOT(setArtIntensity(double)), constellationMgr,
GETSTELMODULE(ConstellationMgr)->g SLOT(setArtIntensity(double)),
etArtIntensity(), 0.0, 1.0, 0.05, constellationMgr->getArtIntensity(
),
0.0, 1.0, 0.05,
m5, m5_4); m5, m5_4);
TuiNode* m5_6 = new TuiNodeColor("5.6 Cardinal Points", LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
GETSTELMODULE(LandscapeMgr), SLOT(s TuiNode* m5_6 = new TuiNodeColor(N_("Cardinal points"),
etColorCardinalPoints(Vec3f)), landscapeMgr,
GETSTELMODULE(LandscapeMgr)->getCol SLOT(setColorCardinalPoints(Vec3f))
orCardinalPoints(), ,
landscapeMgr->getColorCardinalPoint
s(),
m5, m5_5); m5, m5_5);
TuiNode* m5_7 = new TuiNodeColor("5.7 Planet Names", TuiNode* m5_7 = new TuiNodeColor(N_("Planet labels"),
GETSTELMODULE(SolarSystem), SLOT(se solarSystem, SLOT(setLabelsColor(Ve
tLabelsColor(Vec3f)), c3f)),
GETSTELMODULE(SolarSystem)->getLabe solarSystem->getLabelsColor(),
lsColor(),
m5, m5_6); m5, m5_6);
TuiNode* m5_8 = new TuiNodeColor("5.8 Planet Orbits", TuiNode* m5_8 = new TuiNodeColor(N_("Planet orbits"),
GETSTELMODULE(SolarSystem), SLOT(se solarSystem, SLOT(setOrbitsColor(Ve
tOrbitsColor(Vec3f)), c3f)),
GETSTELMODULE(SolarSystem)->getOrbi solarSystem->getOrbitsColor(),
tsColor(),
m5, m5_7); m5, m5_7);
TuiNode* m5_9 = new TuiNodeColor("5.9 Planet Trails", TuiNode* m5_9 = new TuiNodeColor(N_("Planet trails"),
GETSTELMODULE(SolarSystem), SLOT(se solarSystem, SLOT(setTrailsColor(Ve
tTrailsColor(Vec3f)), c3f)),
GETSTELMODULE(SolarSystem)->getTrai solarSystem->getTrailsColor(),
lsColor(),
m5, m5_8); m5, m5_8);
TuiNode* m5_10 = new TuiNodeColor("5.10 Meridian Line", GridLinesMgr* gridLinesMgr = GETSTELMODULE(GridLinesMgr);
GETSTELMODULE(GridLinesMgr), SLOT(s TuiNode* m5_10 = new TuiNodeColor(N_("Meridian line"),
etColorMeridianLine(Vec3f)), gridLinesMgr,
GETSTELMODULE(GridLinesMgr)->getCol SLOT(setColorMeridianLine(Vec3f)),
orMeridianLine(), gridLinesMgr->getColorMeridianLine(
),
m5, m5_9); m5, m5_9);
TuiNode* m5_11 = new TuiNodeColor("5.11 Azimuthal Grid", TuiNode* m5_11 = new TuiNodeColor(N_("Azimuthal grid"),
GETSTELMODULE(GridLinesMgr), SLOT(s gridLinesMgr,
etColorAzimuthalGrid(Vec3f)), SLOT(setColorAzimuthalGrid(Vec3f)),
GETSTELMODULE(GridLinesMgr)->getCol gridLinesMgr->getColorAzimuthalGrid
orAzimuthalGrid(), (),
m5, m5_10); m5, m5_10);
TuiNode* m5_12 = new TuiNodeColor("5.12 Equatorial Grid", TuiNode* m5_12 = new TuiNodeColor(N_("Equatorial grid"),
GETSTELMODULE(GridLinesMgr), SLOT(s gridLinesMgr,
etColorEquatorGrid(Vec3f)), SLOT(setColorEquatorGrid(Vec3f)),
GETSTELMODULE(GridLinesMgr)->getCol gridLinesMgr->getColorEquatorGrid()
orEquatorGrid(), ,
m5, m5_11); m5, m5_11);
TuiNode* m5_13 = new TuiNodeColor("5.13 Equatorial J2000 Grid", TuiNode* m5_13 = new TuiNodeColor(N_("Equatorial J2000 grid"),
GETSTELMODULE(GridLinesMgr), SLOT(s gridLinesMgr,
etColorEquatorJ2000Grid(Vec3f)), SLOT(setColorEquatorJ2000Grid(Vec3f
GETSTELMODULE(GridLinesMgr)->getCol )),
orEquatorJ2000Grid(), gridLinesMgr->getColorEquatorJ2000G
rid(),
m5, m5_12); m5, m5_12);
TuiNode* m5_14 = new TuiNodeColor("5.14 Equator Line", TuiNode* m5_14 = new TuiNodeColor(N_("Equator line"),
GETSTELMODULE(GridLinesMgr), SLOT(s gridLinesMgr,
etColorEquatorLine(Vec3f)), SLOT(setColorEquatorLine(Vec3f)),
GETSTELMODULE(GridLinesMgr)->getCol gridLinesMgr->getColorEquatorLine()
orEquatorLine(), ,
m5, m5_13); m5, m5_13);
TuiNode* m5_15 = new TuiNodeColor("5.15 Ecliptic Line", TuiNode* m5_15 = new TuiNodeColor(N_("Ecliptic line"),
GETSTELMODULE(GridLinesMgr), SLOT(s gridLinesMgr,
etColorEclipticLine(Vec3f)), SLOT(setColorEclipticLine(Vec3f)),
GETSTELMODULE(GridLinesMgr)->getCol gridLinesMgr->getColorEclipticLine(
orEclipticLine(), ),
m5, m5_14); m5, m5_14);
TuiNode* m5_16 = new TuiNodeColor("5.16 Nebula Names", NebulaMgr* nebulaMgr = GETSTELMODULE(NebulaMgr);
GETSTELMODULE(NebulaMgr), SLOT(setL TuiNode* m5_16 = new TuiNodeColor(N_("Nebula names"),
abelsColor(Vec3f)), nebulaMgr, SLOT(setLabelsColor(Vec3
GETSTELMODULE(NebulaMgr)->getLabels f)),
Color(), nebulaMgr->getLabelsColor(),
m5, m5_15); m5, m5_15);
TuiNode* m5_17 = new TuiNodeColor("5.17 Nebubla Hints", TuiNode* m5_17 = new TuiNodeColor(N_("Nebula hints"),
GETSTELMODULE(NebulaMgr), SLOT(setC nebulaMgr, SLOT(setCirclesColor(Ve
irclesColor(Vec3f)), c3f)),
GETSTELMODULE(NebulaMgr)->getCircle nebulaMgr->getCirclesColor(),
sColor(), m5, m5_16);
m5, m5_16); TuiNode* m5_18 = new TuiNodeColor(N_("Horizon line"),
m5_1->setPrevNode(m5_17); gridLinesMgr,
SLOT(setColorHorizonLine(Vec3f)),
gridLinesMgr->getColorHorizonLine()
,
m5, m5_17);
TuiNode* m5_19 = new TuiNodeColor(N_("Galactic grid"),
gridLinesMgr,
SLOT(setColorGalacticGrid(Vec3f)),
gridLinesMgr->getColorGalacticGrid(
),
m5, m5_18);
TuiNode* m5_20 = new TuiNodeColor(N_("Galactic plane line"),
gridLinesMgr,
SLOT(setColorGalacticPlaneLine(Vec3
f)),
gridLinesMgr->getColorGalacticPlane
Line(),
m5, m5_19);
m5_1->setNextNode(m5_2); m5_1->setNextNode(m5_2);
m5_2->setNextNode(m5_3); m5_2->setNextNode(m5_3);
m5_3->setNextNode(m5_4); m5_3->setNextNode(m5_4);
m5_4->setNextNode(m5_5); m5_4->setNextNode(m5_5);
m5_5->setNextNode(m5_6); m5_5->setNextNode(m5_6);
m5_6->setNextNode(m5_7); m5_6->setNextNode(m5_7);
m5_7->setNextNode(m5_8); m5_7->setNextNode(m5_8);
m5_8->setNextNode(m5_9); m5_8->setNextNode(m5_9);
m5_9->setNextNode(m5_10); m5_9->setNextNode(m5_10);
m5_10->setNextNode(m5_11); m5_10->setNextNode(m5_11);
m5_11->setNextNode(m5_12); m5_11->setNextNode(m5_12);
m5_12->setNextNode(m5_13); m5_12->setNextNode(m5_13);
m5_13->setNextNode(m5_14); m5_13->setNextNode(m5_14);
m5_14->setNextNode(m5_15); m5_14->setNextNode(m5_15);
m5_15->setNextNode(m5_16); m5_15->setNextNode(m5_16);
m5_16->setNextNode(m5_17); m5_16->setNextNode(m5_17);
m5_17->setNextNode(m5_1); m5_17->setNextNode(m5_18);
m5_18->setNextNode(m5_19);
m5_19->setNextNode(m5_20);
m5_20->setNextNode(m5_1);
m5_1->loopToTheLast();
m5->setChildNode(m5_1); m5->setChildNode(m5_1);
TuiNode* m6 = new TuiNode("6. Effects", NULL, m5); TuiNode* m6 = new TuiNode(N_("Effects"), NULL, m5);
m5->setNextNode(m6); m5->setNextNode(m6);
TuiNode* m6_1 = new TuiNodeInt("6.1 Light Pollution Level", TuiNode* m6_1 = new TuiNodeInt(N_("Light pollution:"),
GETSTELMODULE(LandscapeMgr), SLOT(set landscapeMgr,
AtmosphereBortleLightPollution(int)), SLOT(setAtmosphereBortleLightPollutio
n(int)),
3, 1, 9, 1, 3, 1, 9, 1,
m6); m6);
TuiNode* m6_2 = new TuiNodeEnum("6.2 Landscape", TuiNode* m6_2 = new TuiNodeEnum(N_("Landscape"),
GETSTELMODULE(LandscapeMgr), landscapeMgr,
SLOT(setCurrentLandscapeName(QString )), SLOT(setCurrentLandscapeName(QString )),
GETSTELMODULE(LandscapeMgr)->getAllL landscapeMgr->getAllLandscapeNames()
andscapeNames(), ,
GETSTELMODULE(LandscapeMgr)->getCurr landscapeMgr->getCurrentLandscapeNam
entLandscapeName(), e(),
m6, m6_1); m6, m6_1);
TuiNode* m6_3 = new TuiNodeBool("6.3 Manual Zoom", StelMovementMgr* movementMgr = GETSTELMODULE(StelMovementMgr);
GETSTELMODULE(StelMovementMgr), SLOT TuiNode* m6_3 = new TuiNodeBool(N_("Manual zoom"),
(setFlagAutoZoomOutResetsDirection(bool)), movementMgr,
GETSTELMODULE(StelMovementMgr)->getF SLOT(setFlagAutoZoomOutResetsDirecti
lagAutoZoomOutResetsDirection(), on(bool)),
movementMgr->getFlagAutoZoomOutReset
sDirection(),
m6, m6_2); m6, m6_2);
TuiNode* m6_4 = new TuiNode("6.4 Magnitude Scaling Multiplier", m6, TuiNode* m6_4 = new TuiNode(N_("Magnitude scaling multiplier"),
m6_3); m6, m6_3);
TuiNode* m6_5 = new TuiNodeFloat("6.5 Milky Way Intensity", TuiNode* m6_5 = new TuiNodeFloat(N_("Milky Way intensity:"),
GETSTELMODULE(MilkyWay), SLOT(setIn GETSTELMODULE(MilkyWay),
tensity(float)), SLOT(setIntensity(float)),
GETSTELMODULE(MilkyWay)->getIntensi GETSTELMODULE(MilkyWay)->getIntensi
ty(), 0, 10.0, 0.1, ty(),
0, 10.0, 0.1,
m6, m6_4); m6, m6_4);
TuiNode* m6_6 = new TuiNode("6.6 Nebula Label Frequency", m6, m6_5); TuiNode* m6_6 = new TuiNode(N_("Nebula label frequency:"), m6, m6_5)
TuiNode* m6_7 = new TuiNodeFloat("6.7 Zoom Duration", ;
GETSTELMODULE(StelMovementMgr), SLO TuiNode* m6_7 = new TuiNodeFloat(N_("Zoom duration:"),
T(setAutoMoveDuration(float)), movementMgr,
GETSTELMODULE(StelMovementMgr)->get SLOT(setAutoMoveDuration(float)),
AutoMoveDuration(), 0, 20.0, 0.1, movementMgr->getAutoMoveDuration(),
0, 20.0, 0.1,
m6, m6_6); m6, m6_6);
TuiNode* m6_8 = new TuiNode("6.8 Cursor Timeout", m6, m6_7); TuiNode* m6_8 = new TuiNode(N_("Cursor timeout:"), m6, m6_7);
TuiNode* m6_9 = new TuiNodeBool("6.9 Setting Landscape Sets Location TuiNode* m6_9 = new TuiNodeBool(N_("Setting landscape sets location"
", ),
GETSTELMODULE(LandscapeMgr), SLOT(se landscapeMgr,
tFlagLandscapeSetsLocation(bool)), SLOT(setFlagLandscapeSetsLocation(bo
GETSTELMODULE(LandscapeMgr)->getFlag ol)),
LandscapeSetsLocation(), landscapeMgr->getFlagLandscapeSetsLo
cation(),
m6, m6_8); m6, m6_8);
m6_1->setPrevNode(m6_9);
m6_1->setNextNode(m6_2); m6_1->setNextNode(m6_2);
m6_2->setNextNode(m6_3); m6_2->setNextNode(m6_3);
m6_3->setNextNode(m6_4); m6_3->setNextNode(m6_4);
m6_4->setNextNode(m6_5); m6_4->setNextNode(m6_5);
m6_5->setNextNode(m6_6); m6_5->setNextNode(m6_6);
m6_6->setNextNode(m6_7); m6_6->setNextNode(m6_7);
m6_7->setNextNode(m6_8); m6_7->setNextNode(m6_8);
m6_8->setNextNode(m6_9); m6_8->setNextNode(m6_9);
m6_9->setNextNode(m6_1); m6_9->setNextNode(m6_1);
m6_1->loopToTheLast();
m6->setChildNode(m6_1); m6->setChildNode(m6_1);
TuiNode* m7 = new TuiNode("7. Scripts", NULL, m6); #ifndef DISABLE_SCRIPTING
TuiNode* m7 = new TuiNode(N_("Scripts"), NULL, m6);
m6->setNextNode(m7); m6->setNextNode(m7);
TuiNode* m7_1 = new TuiNodeEnum("7.1 Run Local Script", StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc
&Ste riptMgr();
lMainGraphicsView::getInstance().getScriptMgr(), TuiNode* m7_1 = new TuiNodeEnum(N_("Run local script"),
&scriptMgr,
SLOT(runScript(QString)), SLOT(runScript(QString)),
Stel MainGraphicsView::getInstance().getScriptMgr().getScriptList(), scriptMgr.getScriptList(),
"", "",
m7); m7);
TuiNode* m7_2 = new TuiNodeActivate("7.2 Stop Running Script", &Stel TuiNode* m7_2 = new TuiNodeActivate(N_("Stop running script"),
MainGraphicsView::getInstance().getScriptMgr(), SLOT(stopScript()), m7, m7_ &scriptMgr, SLOT(stopScript()),
1); m7, m7_1);
TuiNode* m7_3 = new TuiNode("7.3 CD/DVD Script", m7, m7_2); TuiNode* m7_3 = new TuiNode(N_("CD/DVD script"), m7, m7_2);
m7_1->setPrevNode(m7_2);
m7_1->setNextNode(m7_2); m7_1->setNextNode(m7_2);
m7_2->setNextNode(m7_3); m7_2->setNextNode(m7_3);
m7_3->setNextNode(m7_1); m7_3->setNextNode(m7_1);
m7_1->loopToTheLast();
m7->setChildNode(m7_1); m7->setChildNode(m7_1);
TuiNode* m8 = new TuiNode("8. Administration", NULL, m7); TuiNode* m8 = new TuiNode(N_("Administration"), NULL, m7);
m7->setNextNode(m8); m7->setNextNode(m8);
#endif
#ifdef DISABLE_SCRIPTING
TuiNode* m8 = new TuiNode(N_("Administration"), NULL, m6);
m6->setNextNode(m8);
#endif
m8->setNextNode(m1); m8->setNextNode(m1);
m1->setPrevNode(m8); m1->loopToTheLast();
TuiNode* m8_1 = new TuiNode("8.1 Load Default Configuration", m8); TuiNode* m8_1 = new TuiNode(N_("Load default configuration"), m8);
TuiNode* m8_2 = new TuiNodeActivate("8.2 Save Current Configuration" TuiNode* m8_2 = new TuiNodeActivate(N_("Save current configuration")
, this, SLOT(saveDefaultSettings()), m8, m8_1); ,
TuiNode* m8_3 = new TuiNode("8.3 Shut Down", m8, m8_2); this, SLOT(saveDefaultSettings()
m8_1->setPrevNode(m8_3); ),
m8, m8_1);
TuiNode* m8_3 = new TuiNode(N_("Shut down"), m8, m8_2);
m8_1->setNextNode(m8_2); m8_1->setNextNode(m8_2);
m8_2->setNextNode(m8_3); m8_2->setNextNode(m8_3);
m8_3->setNextNode(m8_1); m8_3->setNextNode(m8_1);
m8_1->loopToTheLast();
m8->setChildNode(m8_1); m8->setChildNode(m8_1);
currentNode = m1; currentNode = m1;
} }
/************************************************************************* /*************************************************************************
Load settings from configuration file.
*************************************************************************/
void TextUserInterface::loadConfiguration(void)
{
QSettings* conf = StelApp::getInstance().getSettings();
Q_ASSERT(conf);
font.setPixelSize(conf->value("tui/tui_font_size", 15).toInt());
}
/*************************************************************************
Draw our module. Draw our module.
*************************************************************************/ *************************************************************************/
void TextUserInterface::draw(StelCore* core) void TextUserInterface::draw(StelCore* core)
{ {
if (tuiActive) if (tuiActive)
{ {
QString tuiText = "[no TUI node]"; int x = 0, y = 0;
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance()
.getGui());
if (gui->getVisible())
{
QGraphicsItem* bottomBar = dynamic_cast<QGraphicsIte
m*>(gui->getButtonBar());
LeftStelBar* sideBar = gui->getWindowsButtonBar();
x = (sideBar) ? sideBar->boundingRectNoHelpLabel().r
ight() : 50;
y = (bottomBar) ? bottomBar->boundingRect().height()
: 50;
}
// Alternate x,y for Disk viewport
if (core->getProjection(StelCore::FrameJ2000)->getMaskType()
== StelProjector::MaskDisk)
{
StelProjector::StelProjectorParams projParams = core
->getCurrentStelProjectorParams();
x = projParams.viewportCenter[0] - projParams.viewpo
rtFovDiameter/2;
y = projParams.viewportCenter[1];
}
x += 20;
y += 15;
QString tuiText = q_("[no TUI node]");
if (currentNode!=NULL) if (currentNode!=NULL)
tuiText = currentNode->getDisplayText(); tuiText = currentNode->getDisplayText();
StelPainter painter(core->getProjection(StelCore::FrameAltAz )); StelPainter painter(core->getProjection(StelCore::FrameAltAz ));
painter.setFont(font); painter.setFont(font);
painter.setColor(0.3,1,0.3); painter.setColor(0.3,1,0.3);
painter.drawText(StelMainGraphicsView::getInstance().size(). painter.drawText(x, y, tuiText, 0, 0, 0, false);
width()*0.6,
50, tuiText, 0, 0, 0, false);
} }
} }
void TextUserInterface::handleKeys(QKeyEvent* event) void TextUserInterface::handleKeys(QKeyEvent* event)
{ {
if (currentNode == NULL) if (currentNode == NULL)
{ {
qWarning() << "WARNING: no current node in TextUserInterface plugin"; qWarning() << "WARNING: no current node in TextUserInterface plugin";
event->setAccepted(false); event->setAccepted(false);
return; return;
skipping to change at line 603 skipping to change at line 723
conf->setValue("color/meridian_color", colToConf(glmgr->getColorMeri dianLine())); conf->setValue("color/meridian_color", colToConf(glmgr->getColorMeri dianLine()));
conf->setValue("color/azimuthal_color", colToConf(glmgr->getColorAzi muthalGrid())); conf->setValue("color/azimuthal_color", colToConf(glmgr->getColorAzi muthalGrid()));
conf->setValue("color/equator_color", colToConf(glmgr->getColorEquat orGrid())); conf->setValue("color/equator_color", colToConf(glmgr->getColorEquat orGrid()));
conf->setValue("color/equatorial_J2000_color", colToConf(glmgr->getC olorEquatorJ2000Grid())); conf->setValue("color/equatorial_J2000_color", colToConf(glmgr->getC olorEquatorJ2000Grid()));
conf->setValue("color/equator_color", colToConf(glmgr->getColorEquat orLine())); conf->setValue("color/equator_color", colToConf(glmgr->getColorEquat orLine()));
conf->setValue("color/ecliptic_color", colToConf(glmgr->getColorEcli pticLine())); conf->setValue("color/ecliptic_color", colToConf(glmgr->getColorEcli pticLine()));
conf->setValue("color/nebula_label_color", colToConf(nmgr->getLabels Color())); conf->setValue("color/nebula_label_color", colToConf(nmgr->getLabels Color()));
conf->setValue("color/nebula_circle_color", colToConf(nmgr->getCircl esColor())); conf->setValue("color/nebula_circle_color", colToConf(nmgr->getCircl esColor()));
// sub-menu 6: effects // sub-menu 6: effects
// TODO enable this when we do the release after 0.10.2 - this plugi conf->setValue("stars/init_bortle_scale", lmgr->getAtmosphereBortleL
n will crash for 0.10.2 because ightPollution());
// getAtmosphereBortleLightPollution() was not defined in the 0.10.2
release.
// conf->setValue("stars/init_bortle_scale", lmgr->getAtmosphereBort
leLightPollution());
lmgr->setDefaultLandscapeID(lmgr->getCurrentLandscapeID()); lmgr->setDefaultLandscapeID(lmgr->getCurrentLandscapeID());
conf->setValue("navigation/auto_zoom_out_resets_direction", mvmgr->g etFlagAutoZoomOutResetsDirection()); conf->setValue("navigation/auto_zoom_out_resets_direction", mvmgr->g etFlagAutoZoomOutResetsDirection());
conf->setValue("astro/milky_way_intensity", milk->getIntensity()); conf->setValue("astro/milky_way_intensity", milk->getIntensity());
conf->setValue("navigation/auto_move_duration", mvmgr->getAutoMoveDu ration()); conf->setValue("navigation/auto_move_duration", mvmgr->getAutoMoveDu ration());
conf->setValue("landscape/flag_landscape_sets_location", lmgr->getFl agLandscapeSetsLocation()); conf->setValue("landscape/flag_landscape_sets_location", lmgr->getFl agLandscapeSetsLocation());
// GLOBAL DISPLAY SETTINGS // GLOBAL DISPLAY SETTINGS
// TODO // TODO
qDebug() << "TextUserInterface::saveDefaultSettings done"; qDebug() << "TextUserInterface::saveDefaultSettings done";
 End of changes. 77 change blocks. 
228 lines changed or deleted 332 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/