StelGuiItems.cpp   StelGuiItems.cpp 
skipping to change at line 51 skipping to change at line 51
#include <QTimeLine> #include <QTimeLine>
#include <QMouseEvent> #include <QMouseEvent>
#include <QRegExp> #include <QRegExp>
#include <QPixmapCache> #include <QPixmapCache>
#include <QProgressBar> #include <QProgressBar>
#include <QGraphicsWidget> #include <QGraphicsWidget>
#include <QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
#include <QGraphicsLinearLayout> #include <QGraphicsLinearLayout>
#include <QSettings> #include <QSettings>
#ifdef _MSC_BUILD
#define round(dbl) dbl >= 0.0 ? (int)(dbl + 0.5) : ((dbl - (double)(int)dbl
) <= -0.5 ? (int)dbl : (int)(dbl - 0.5))
#endif
void StelButton::initCtor(const QPixmap& apixOn, void StelButton::initCtor(const QPixmap& apixOn,
const QPixmap& apixOff, const QPixmap& apixOff,
const QPixmap& apixNoChange, const QPixmap& apixNoChange,
const QPixmap& apixHover, const QPixmap& apixHover,
StelAction* aaction, StelAction* aaction,
bool noBackground, bool noBackground,
bool isTristate) bool isTristate)
{ {
pixOn = apixOn; pixOn = apixOn;
pixOff = apixOff; pixOff = apixOff;
skipping to change at line 247 skipping to change at line 243
void LeftStelBar::addButton(StelButton* button) void LeftStelBar::addButton(StelButton* button)
{ {
double posY = 0; double posY = 0;
if (QGraphicsItem::childItems().size()!=0) if (QGraphicsItem::childItems().size()!=0)
{ {
const QRectF& r = childrenBoundingRect(); const QRectF& r = childrenBoundingRect();
posY += r.bottom()-1; posY += r.bottom()-1;
} }
button->setParentItem(this); button->setParentItem(this);
button->prepareGeometryChange(); // could possibly be removed when q t 4.6 become stable button->prepareGeometryChange(); // could possibly be removed when q t 4.6 become stable
button->setPos(0., round(posY+10.5)); button->setPos(0., qRound(posY+10.5));
connect(button, SIGNAL(hoverChanged(bool)), this, SLOT(buttonHoverCh anged(bool))); connect(button, SIGNAL(hoverChanged(bool)), this, SLOT(buttonHoverCh anged(bool)));
} }
void LeftStelBar::paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget *) void LeftStelBar::paint(QPainter*, const QStyleOptionGraphicsItem*, QWidget *)
{ {
} }
QRectF LeftStelBar::boundingRect() const QRectF LeftStelBar::boundingRect() const
{ {
skipping to change at line 295 skipping to change at line 291
QString tip(button->action->getText()); QString tip(button->action->getText());
QString shortcut(button->action->getShortcut().toStr ing(QKeySequence::NativeText)); QString shortcut(button->action->getShortcut().toStr ing(QKeySequence::NativeText));
if (!shortcut.isEmpty()) if (!shortcut.isEmpty())
{ {
//XXX: this should be unnecessary since we u sed NativeText. //XXX: this should be unnecessary since we u sed NativeText.
if (shortcut == "Space") if (shortcut == "Space")
shortcut = q_("Space"); shortcut = q_("Space");
tip += " [" + shortcut + "]"; tip += " [" + shortcut + "]";
} }
helpLabel->setText(tip); helpLabel->setText(tip);
helpLabel->setPos(round(boundingRectNoHelpLabel().wi dth()+15.5),round(button->pos().y()+button->pixmap().size().height()/2-8)); helpLabel->setPos(qRound(boundingRectNoHelpLabel().width()+15.5 ),qRound(button->pos().y()+button->pixmap().size().height()/2-8));
} }
} }
else else
{ {
helpLabel->setText(""); helpLabel->setText("");
} }
// Update the screen as soon as possible. // Update the screen as soon as possible.
StelMainView::getInstance().thereWasAnEvent(); StelMainView::getInstance().thereWasAnEvent();
} }
skipping to change at line 350 skipping to change at line 346
fov->font().setPixelSize(baseFontSize); fov->font().setPixelSize(baseFontSize);
fps->font().setPixelSize(baseFontSize); fps->font().setPixelSize(baseFontSize);
QSettings* confSettings = StelApp::getInstance().getSettings(); QSettings* confSettings = StelApp::getInstance().getSettings();
setFlagShowTime(confSettings->value("gui/flag_show_datetime", true). toBool()); setFlagShowTime(confSettings->value("gui/flag_show_datetime", true). toBool());
setFlagShowLocation(confSettings->value("gui/flag_show_location", tr ue).toBool()); setFlagShowLocation(confSettings->value("gui/flag_show_location", tr ue).toBool());
setFlagShowFov(confSettings->value("gui/flag_show_fov", true).toBool ()); setFlagShowFov(confSettings->value("gui/flag_show_fov", true).toBool ());
setFlagShowFps(confSettings->value("gui/flag_show_fps", true).toBool ()); setFlagShowFps(confSettings->value("gui/flag_show_fps", true).toBool ());
setFlagTimeJd(confSettings->value("gui/flag_time_jd", false).toBool( )); setFlagTimeJd(confSettings->value("gui/flag_time_jd", false).toBool( ));
setFlagFovDms(confSettings->value("gui/flag_fov_dms", false).toBool( )); setFlagFovDms(confSettings->value("gui/flag_fov_dms", false).toBool( ));
setFlagShowTz(confSettings->value("gui/flag_show_tz", true).toBool() );
} }
BottomStelBar::~BottomStelBar() BottomStelBar::~BottomStelBar()
{ {
// Remove currently hidden buttons which are not delete by a parent element // Remove currently hidden buttons which are not delete by a parent element
for (QMap<QString, ButtonGroup>::iterator iter=buttonGroups.begin(); iter!=buttonGroups.end();++iter) for (QMap<QString, ButtonGroup>::iterator iter=buttonGroups.begin(); iter!=buttonGroups.end();++iter)
{ {
foreach (StelButton* b, iter.value().elems) foreach (StelButton* b, iter.value().elems)
{ {
if (b->parentItem()==0) if (b->parentItem()==0)
skipping to change at line 558 skipping to change at line 555
QString validRangeInfo = ""; QString validRangeInfo = "";
bool displayDeltaT = false; bool displayDeltaT = false;
if (core->getCurrentLocation().planetName.contains("Earth")) if (core->getCurrentLocation().planetName.contains("Earth"))
{ {
deltaT = core->getDeltaT(jd); deltaT = core->getDeltaT(jd);
displayDeltaT = true; displayDeltaT = true;
sigma = StelUtils::getDeltaTStandardError(jd); sigma = StelUtils::getDeltaTStandardError(jd);
core->getCurrentDeltaTAlgorithmValidRange(jd, &validRangeInf o); core->getCurrentDeltaTAlgorithmValidRange(jd, &validRangeInf o);
} }
// Add in a DeltaT correction. Divide DeltaT by 86400 to convert fro const StelLocaleMgr& locmgr = StelApp::getInstance().getLocaleMgr();
m seconds to days. double dt = deltaT/86400.; // A DeltaT correction. Divide DeltaT by
QString newDate = getFlagShowTime() ? StelApp::getInstance().getLoca 86400 to convert from seconds to days.
leMgr().getPrintableDateLocal(jd-deltaT/86400.) +" " QString tz = locmgr.getPrintableTimeZoneLocal(jd-dt);
+StelApp::getInstance().getLocaleMgr().getPrintableT QString newDateInfo = " ";
imeLocal(jd-deltaT/86400.) : " "; if (getFlagShowTime())
{
if (getFlagShowTz())
newDateInfo = QString("%1 %2 %3").arg(locmgr.getPr
intableDateLocal(jd-dt)).arg(locmgr.getPrintableTimeLocal(jd-dt)).arg(tz);
else
newDateInfo = QString("%1 %2").arg(locmgr.getPrint
ableDateLocal(jd-dt)).arg(locmgr.getPrintableTimeLocal(jd-dt));
}
QString newDateAppx = QString("JD %1").arg(jd-dt, 0, 'f', 5);
if (getFlagTimeJd()) if (getFlagTimeJd())
{ {
newDate = QString("%1").arg(jd+StelApp::getInstance().getLoc newDateAppx = newDateInfo;
aleMgr().getGMTShift(jd)/24.-deltaT/86400., 0, 'f', 5); // UTC -> local tz newDateInfo = QString("JD %1").arg(jd-dt, 0, 'f', 5);
} }
if (datetime->text()!=newDate) if (datetime->text()!=newDateInfo)
{ {
updatePos = true; updatePos = true;
datetime->setText(newDate); datetime->setText(newDateInfo);
if (displayDeltaT && core->getCurrentDeltaTAlgorithm()!=Stel Core::WithoutCorrection) if (displayDeltaT && core->getCurrentDeltaTAlgorithm()!=Stel Core::WithoutCorrection)
{ {
if (sigma>0) if (sigma>0)
sigmaInfo = QString("; %1(%2T) = %3s").arg(Q Char(0x03c3)).arg(QChar(0x0394)).arg(sigma, 3, 'f', 1); sigmaInfo = QString("; %1(%2T) = %3s").arg(Q Char(0x03c3)).arg(QChar(0x0394)).arg(sigma, 3, 'f', 1);
if (std::abs(deltaT)>60.) QString deltaTInfo = "";
datetime->setToolTip(QString("%1T = %2 (%3s) if (qAbs(deltaT)>60.)
%6 [n-dot @ -23.8946\"/cy%4%5]").arg(QChar(0x0394)).arg(StelUtils::hoursToH deltaTInfo = QString("%1 (%2s)%3").arg(StelU
msStr(deltaT/3600.)).arg(deltaT, 5, 'f', 2).arg(QChar(0x00B2)).arg(sigmaInf tils::hoursToHmsStr(deltaT/3600.)).arg(deltaT, 5, 'f', 2).arg(validRangeInf
o).arg(validRangeInfo)); o);
else else
datetime->setToolTip(QString("%1T = %2s%5 [n deltaTInfo = QString("%1s%2").arg(deltaT, 3,
-dot @ -23.8946\"/cy%3%4]").arg(QChar(0x0394)).arg(deltaT, 3, 'f', 3).arg(Q 'f', 3).arg(validRangeInfo);
Char(0x00B2)).arg(sigmaInfo).arg(validRangeInfo));
datetime->setToolTip(QString("<p style='white-space:
pre'>%1T = %2 [n-dot @ -23.8946\"/cy%3%4]<br>%5</p>").arg(QChar(0x0394)).ar
g(deltaTInfo).arg(QChar(0x00B2)).arg(sigmaInfo).arg(newDateAppx));
} }
else else
datetime->setToolTip(""); datetime->setToolTip(QString("%1").arg(newDateAppx)) ;
} }
QString newLocation = ""; QString newLocation = "";
const StelLocation* loc = &core->getCurrentLocation(); const StelLocation* loc = &core->getCurrentLocation();
const StelTranslator& trans = locmgr.getSkyTranslator();
if (getFlagShowLocation() && !loc->name.isEmpty()) if (getFlagShowLocation() && !loc->name.isEmpty())
{ {
newLocation = q_(loc->planetName) +", "+loc->name + ", "+q_( "%1m").arg(loc->altitude); newLocation = trans.qtranslate(loc->planetName) +", "+loc->n ame + ", "+q_("%1m").arg(loc->altitude);
} }
if (getFlagShowLocation() && loc->name.isEmpty()) if (getFlagShowLocation() && loc->name.isEmpty())
{ {
newLocation = q_(loc->planetName)+", "+StelUtils::decDegToDm sStr(loc->latitude)+", "+StelUtils::decDegToDmsStr(loc->longitude); newLocation = trans.qtranslate(loc->planetName)+", "+StelUti ls::decDegToDmsStr(loc->latitude)+", "+StelUtils::decDegToDmsStr(loc->longi tude);
} }
if (location->text()!=newLocation) if (location->text()!=newLocation)
{ {
updatePos = true; updatePos = true;
location->setText(newLocation); location->setText(newLocation);
float lat = core->getCurrentLocation().latitude; float lat = core->getCurrentLocation().latitude;
float lon = core->getCurrentLocation().longitude; float lon = core->getCurrentLocation().longitude;
QString latStr, lonStr, pm; QString latStr, lonStr, pm;
if (lat >= 0) if (lat >= 0)
pm = "N"; pm = "N";
 End of changes. 14 change blocks. 
28 lines changed or deleted 37 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/