TextUserInterface.cpp   TextUserInterface.cpp 
skipping to change at line 31 skipping to change at line 31
#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"
#include "TuiNodeColor.hpp" #include "TuiNodeColor.hpp"
#include "TuiNodeEnum.hpp" #include "TuiNodeEnum.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelPainter.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StarMgr.hpp" #include "StarMgr.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelSkyDrawer.hpp" #include "StelSkyDrawer.hpp"
#include "ConstellationMgr.hpp" #include "ConstellationMgr.hpp"
#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 "StelMainView.hpp"
#include "StelSkyCultureMgr.hpp" #include "StelSkyCultureMgr.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelUtils.hpp" #include "StelUtils.hpp"
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
#include "StelScriptMgr.hpp" #include "StelScriptMgr.hpp"
#endif #endif
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp"// Funny thing to include in a TEXT user interfa ce... #include "StelGuiItems.hpp"// Funny thing to include in a TEXT user interfa ce...
#include "renderer/StelRenderer.hpp"
#include <QKeyEvent> #include <QKeyEvent>
#include <QDebug> #include <QDebug>
#include <QLabel> #include <QLabel>
#include <QTime> #include <QTime>
#include <QProcess> #include <QProcess>
#include <QDir> #include <QDir>
#ifdef DISABLE_SCRIPTING #ifdef DISABLE_SCRIPTING
#include "QSettings" // WTF? #include "QSettings" // WTF?
#endif #endif
skipping to change at line 92 skipping to change at line 92
} }
StelPluginInfo TextUserInterfaceStelPluginInterface::getPluginInfo() const StelPluginInfo TextUserInterfaceStelPluginInterface::getPluginInfo() const
{ {
StelPluginInfo info; StelPluginInfo info;
info.id = "TextUserInterface"; info.id = "TextUserInterface";
info.displayedName = N_("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 = N_("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");
info.version = TUI_PLUGIN_VERSION;
return info; return info;
} }
Q_EXPORT_PLUGIN2(TextUserInterface, TextUserInterfaceStelPluginInterface)
/************************************************************************* /*************************************************************************
Constructor Constructor
*************************************************************************/ *************************************************************************/
TextUserInterface::TextUserInterface() TextUserInterface::TextUserInterface()
: dummyDialog(this), tuiActive(false), currentNode(NULL) : dummyDialog(this)
, tuiActive(false)
, tuiDateTime(false)
, tuiObjInfo(false)
, tuiGravityUi(false)
, currentNode(NULL)
{ {
setObjectName("TextUserInterface"); setObjectName("TextUserInterface");
} }
/************************************************************************* /*************************************************************************
Destructor Destructor
*************************************************************************/ *************************************************************************/
TextUserInterface::~TextUserInterface() TextUserInterface::~TextUserInterface()
{ {
} }
skipping to change at line 230 skipping to change at line 234
StelSkyCultureMgr& skyCultureMgr = StelApp::getInstance().getSkyCult ureMgr(); StelSkyCultureMgr& skyCultureMgr = StelApp::getInstance().getSkyCult ureMgr();
TuiNode* m3_1 = new TuiNodeEnum(N_("Starlore"), TuiNode* m3_1 = new TuiNodeEnum(N_("Starlore"),
this, this,
SLOT(setSkyCulture(QString)), SLOT(setSkyCulture(QString)),
skyCultureMgr.getSkyCultureListI18() , skyCultureMgr.getSkyCultureListI18() ,
skyCultureMgr.getCurrentSkyCultureNa meI18(), skyCultureMgr.getCurrentSkyCultureNa meI18(),
m3); m3);
TuiNode* m3_2 = new TuiNodeEnum(N_("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(localeMgr.getAppLanguage()), StelTranslator::iso639_1CodeToNative Name(localeMgr.getAppLanguage()),
m3, m3_1); m3, m3_1);
m3_1->setNextNode(m3_2); m3_1->setNextNode(m3_2);
m3_2->setNextNode(m3_1); m3_2->setNextNode(m3_1);
m3_1->loopToTheLast(); m3_1->loopToTheLast();
m3->setChildNode(m3_1); m3->setChildNode(m3_1);
TuiNode* m4 = new TuiNode(N_("Stars"), NULL, m3); TuiNode* m4 = new TuiNode(N_("Stars"), NULL, m3);
m3->setNextNode(m4); m3->setNextNode(m4);
StarMgr* starMgr = GETSTELMODULE(StarMgr); StarMgr* starMgr = GETSTELMODULE(StarMgr);
skipping to change at line 447 skipping to change at line 451
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_1->loopToTheLast();
m6->setChildNode(m6_1); m6->setChildNode(m6_1);
#ifndef DISABLE_SCRIPTING #ifndef DISABLE_SCRIPTING
TuiNode* m7 = new TuiNode(N_("Scripts"), NULL, m6); TuiNode* m7 = new TuiNode(N_("Scripts"), NULL, m6);
m6->setNextNode(m7); m6->setNextNode(m7);
StelScriptMgr& scriptMgr = StelMainGraphicsView::getInstance().getSc riptMgr(); StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();
TuiNode* m7_1 = new TuiNodeEnum(N_("Run local script"), TuiNode* m7_1 = new TuiNodeEnum(N_("Run local script"),
&scriptMgr, &scriptMgr,
SLOT(runScript(QString)), SLOT(runScript(QString)),
scriptMgr.getScriptList(), scriptMgr.getScriptList(),
"", "",
m7); m7);
TuiNode* m7_2 = new TuiNodeActivate(N_("Stop running script"), TuiNode* m7_2 = new TuiNodeActivate(N_("Stop running script"),
&scriptMgr, SLOT(stopScript()), &scriptMgr, SLOT(stopScript()),
m7, m7_1); m7, m7_1);
TuiNode* m7_3 = new TuiNode(N_("CD/DVD script"), m7, m7_2); TuiNode* m7_3 = new TuiNode(N_("CD/DVD script"), m7, m7_2);
skipping to change at line 505 skipping to change at line 509
font.setPixelSize(conf->value("tui/tui_font_size", 15).toInt()); font.setPixelSize(conf->value("tui/tui_font_size", 15).toInt());
tuiDateTime = conf->value("tui/flag_show_tui_datetime", false).toBoo l(); tuiDateTime = conf->value("tui/flag_show_tui_datetime", false).toBoo l();
tuiObjInfo = conf->value("tui/flag_show_tui_short_obj_info", false). toBool(); tuiObjInfo = conf->value("tui/flag_show_tui_short_obj_info", false). toBool();
tuiGravityUi = conf->value("tui/flag_show_gravity_ui", false).toBool (); tuiGravityUi = conf->value("tui/flag_show_gravity_ui", false).toBool ();
} }
/************************************************************************* /*************************************************************************
Draw our module. Draw our module.
*************************************************************************/ *************************************************************************/
void TextUserInterface::draw(StelCore* core, StelRenderer* renderer) void TextUserInterface::draw(StelCore* core)
{ {
if (!tuiActive && !tuiDateTime && !tuiObjInfo) if (!tuiActive && !tuiDateTime && !tuiObjInfo)
return; return;
int x = 0, y = 0; int x = 0, y = 0;
int xVc = 0, yVc = 0; int xVc = 0, yVc = 0;
int pixOffset = 15; int pixOffset = 15;
int fovOffsetX = 0, fovOffsetY=0; int fovOffsetX = 0, fovOffsetY=0;
bool fovMaskDisk = false; bool fovMaskDisk = false;
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
if (gui->getVisible()) if (gui!=NULL)
{ {
QGraphicsItem* bottomBar = dynamic_cast<QGraphicsItem*>(gui- if (gui->getVisible())
>getButtonBar()); {
LeftStelBar* sideBar = gui->getWindowsButtonBar(); QGraphicsItem* bottomBar = dynamic_cast<QGraphicsIte
x = (sideBar) ? sideBar->boundingRectNoHelpLabel().right() : m*>(gui->getButtonBar());
50; LeftStelBar* sideBar = gui->getWindowsButtonBar();
y = (bottomBar) ? bottomBar->boundingRect().height() : 50; x = (sideBar) ? sideBar->boundingRectNoHelpLabel().r
ight() : 50;
y = (bottomBar) ? bottomBar->boundingRect().height()
: 50;
}
} }
// Alternate x,y for Disk viewport // Alternate x,y for Disk viewport
if (core->getProjection(StelCore::FrameJ2000)->getMaskType() == Stel Projector::MaskDisk) if (core->getProjection(StelCore::FrameJ2000)->getMaskType() == Stel Projector::MaskDisk)
{ {
fovMaskDisk = true; fovMaskDisk = true;
StelProjector::StelProjectorParams projParams = core->getCur rentStelProjectorParams(); StelProjector::StelProjectorParams projParams = core->getCur rentStelProjectorParams();
xVc = projParams.viewportCenter[0]; xVc = projParams.viewportCenter[0];
yVc = projParams.viewportCenter[1]; yVc = projParams.viewportCenter[1];
fovOffsetX = projParams.viewportFovDiameter*std::sin(20)/2; fovOffsetX = projParams.viewportFovDiameter*std::sin(20.f)/2
fovOffsetY = projParams.viewportFovDiameter*std::cos(20)/2; ;
fovOffsetY = projParams.viewportFovDiameter*std::cos(20.f)/2
;
} }
else else
{ {
xVc = core->getProjection(StelCore::FrameJ2000)->getViewport Width()/2; xVc = core->getProjection(StelCore::FrameJ2000)->getViewport Width()/2;
} }
if (tuiActive) if (tuiActive)
{ {
int text_x = x + pixOffset, text_y = y + pixOffset; int text_x = x + pixOffset, text_y = y + pixOffset;
if (fovMaskDisk) { if (fovMaskDisk) {
text_x = xVc - fovOffsetX + pixOffset; text_x = xVc - fovOffsetX + pixOffset;
text_y = yVc - fovOffsetY + pixOffset; text_y = yVc - fovOffsetY + pixOffset;
} }
QString tuiText = q_("[no TUI node]"); QString tuiText = q_("[no TUI node]");
if (currentNode!=NULL) { if (currentNode!=NULL) {
tuiText = currentNode->getDisplayText(); tuiText = currentNode->getDisplayText();
} }
renderer->setFont(font); StelPainter painter(core->getProjection(StelCore::FrameJ2000
renderer->setGlobalColor(0.3f, 1.0f, 0.3f); ));
TextParams params = TextParams(text_x, text_y, tuiText) painter.setFont(font);
.projector(core->getProjection(StelCore: painter.setColor(0.3,1,0.3);
:FrameJ2000)); painter.drawText(text_x, text_y, tuiText, 0, 0, 0, !tuiGravi
if(tuiGravityUi){params.useGravity();} tyUi);
renderer->drawText(params);
} }
if (tuiDateTime) if (tuiDateTime)
{ {
double jd = core->getJDay(); double jd = core->getJDay();
int text_x = x + xVc*2/3, text_y = y + pixOffset; int text_x = x + xVc*2/3, text_y = y + pixOffset;
QString newDate = StelApp::getInstance().getLocaleMgr().getP rintableDateLocal(jd) + " " QString newDate = StelApp::getInstance().getLocaleMgr().getP rintableDateLocal(jd) + " "
+StelApp::getInstance().getLocaleMgr().getPrintableT imeLocal(jd); +StelApp::getInstance().getLocaleMgr().getPrintableT imeLocal(jd);
if (fovMaskDisk) { if (fovMaskDisk) {
text_x = xVc + fovOffsetY - pixOffset; text_x = xVc + fovOffsetY - pixOffset;
text_y = yVc - fovOffsetX + pixOffset; text_y = yVc - fovOffsetX + pixOffset;
} }
renderer->setFont(font); StelPainter painter(core->getProjection(StelCore::FrameAltAz
renderer->setGlobalColor(0.3f, 1.0f, 0.3f); ));
TextParams params = TextParams(text_x, text_y, newDate) painter.setFont(font);
.projector(core->getProjection(StelCore: painter.setColor(0.3,1,0.3);
:FrameAltAz)); painter.drawText(text_x, text_y, newDate, 0, 0, 0, !tuiGravi
if(tuiGravityUi){params.useGravity();} tyUi);
renderer->drawText(params);
} }
if (tuiObjInfo) if (tuiObjInfo)
{ {
QString objInfo = ""; QString objInfo = "";
StelObject::InfoStringGroup tuiInfo(StelObject::Name|StelObj ect::CatalogNumber StelObject::InfoStringGroup tuiInfo(StelObject::Name|StelObj ect::CatalogNumber
|StelObject::Distance|StelObject::PlainText) ; |StelObject::Distance|StelObject::PlainText) ;
int text_x = x + xVc*4/3, text_y = y + pixOffset; int text_x = x + xVc*4/3, text_y = y + pixOffset;
QList<StelObjectP> selectedObj = GETSTELMODULE(StelObjectMgr )->getSelectedObject(); QList<StelObjectP> selectedObj = GETSTELMODULE(StelObjectMgr )->getSelectedObject();
skipping to change at line 604 skipping to change at line 607
objInfo.replace("\n"," "); objInfo.replace("\n"," ");
objInfo.replace("Distance:"," "); objInfo.replace("Distance:"," ");
objInfo.replace("Light Years","ly"); objInfo.replace("Light Years","ly");
} }
if (fovMaskDisk) { if (fovMaskDisk) {
text_x = xVc + fovOffsetX - pixOffset; text_x = xVc + fovOffsetX - pixOffset;
text_y = yVc + fovOffsetY - pixOffset; text_y = yVc + fovOffsetY - pixOffset;
} }
renderer->setFont(font); StelPainter painter(core->getProjection(StelCore::FrameJ2000
renderer->setGlobalColor(0.3f, 1.0f, 0.3f); ));
TextParams params = TextParams(text_x, text_y, objInfo) painter.setFont(font);
.projector(core->getProjection(StelCore: painter.setColor(0.3,1,0.3);
:FrameJ2000)); painter.drawText(text_x, text_y, objInfo, 0, 0, 0, !tuiGravi
if(tuiGravityUi){params.useGravity();} tyUi);
renderer->drawText(params);
} }
} }
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 833 skipping to change at line 834
if (!(err = QProcess::execute(shutdownCmd))) { if (!(err = QProcess::execute(shutdownCmd))) {
qDebug() << "[TextUserInterface] shutdown error, QProcess::e xecute():" << err; qDebug() << "[TextUserInterface] shutdown error, QProcess::e xecute():" << err;
} }
} }
void TextUserInterface::setBortleScale(int bortle) void TextUserInterface::setBortleScale(int bortle)
{ {
LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr); LandscapeMgr* landscapeMgr = GETSTELMODULE(LandscapeMgr);
StelSkyDrawer* skyDrawer = StelApp::getInstance().getCore()->getSkyD rawer(); StelSkyDrawer* skyDrawer = StelApp::getInstance().getCore()->getSkyD rawer();
landscapeMgr->setAtmosphereBortleLightPollution(bortle); landscapeMgr->setAtmosphereBortleLightPollution(bortle);
skyDrawer->setBortleScale(bortle); skyDrawer->setBortleScaleIndex(bortle);
} }
 End of changes. 16 change blocks. 
39 lines changed or deleted 46 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/