OcularsGuiPanel.cpp   OcularsGuiPanel.cpp 
skipping to change at line 133 skipping to change at line 133
qreal buttonHeight = buttonOcular->boundingRect().height(); qreal buttonHeight = buttonOcular->boundingRect().height();
buttonBar->setMinimumHeight(buttonHeight); buttonBar->setMinimumHeight(buttonHeight);
buttonBar->setMaximumHeight(buttonHeight); buttonBar->setMaximumHeight(buttonHeight);
setLayout(mainLayout); setLayout(mainLayout);
//Widgets with control and information fields //Widgets with control and information fields
ocularControls = new QGraphicsWidget(this); ocularControls = new QGraphicsWidget(this);
ocularControls->setParentItem(this); ocularControls->setParentItem(this);
ocularControls->setVisible(false); ocularControls->setVisible(false);
lensControls = new QGraphicsWidget(this);
lensControls->setParentItem(this);
lensControls->setVisible(false);
ccdControls = new QGraphicsWidget(this); ccdControls = new QGraphicsWidget(this);
ccdControls->setParentItem(this); ccdControls->setParentItem(this);
ccdControls->setVisible(false); ccdControls->setVisible(false);
telescopeControls = new QGraphicsWidget(this); telescopeControls = new QGraphicsWidget(this);
telescopeControls->setParentItem(this); telescopeControls->setParentItem(this);
telescopeControls->setVisible(false); telescopeControls->setVisible(false);
fieldOcularName = new QGraphicsTextItem(ocularControls); fieldOcularName = new QGraphicsTextItem(ocularControls);
fieldOcularFl = new QGraphicsTextItem(ocularControls); fieldOcularFl = new QGraphicsTextItem(ocularControls);
fieldOcularAfov = new QGraphicsTextItem(ocularControls); fieldOcularAfov = new QGraphicsTextItem(ocularControls);
fieldCcdName = new QGraphicsTextItem(ccdControls); fieldCcdName = new QGraphicsTextItem(ccdControls);
fieldCcdDimensions = new QGraphicsTextItem(ccdControls); fieldCcdDimensions = new QGraphicsTextItem(ccdControls);
fieldCcdRotation = new QGraphicsTextItem(ccdControls); fieldCcdRotation = new QGraphicsTextItem(ccdControls);
fieldTelescopeName = new QGraphicsTextItem(telescopeControls); fieldTelescopeName = new QGraphicsTextItem(telescopeControls);
fieldMagnification = new QGraphicsTextItem(telescopeControls); fieldMagnification = new QGraphicsTextItem(telescopeControls);
fieldFov = new QGraphicsTextItem(telescopeControls); fieldFov = new QGraphicsTextItem(telescopeControls);
fieldLensName = new QGraphicsTextItem(lensControls);
fieldLensMultipler = new QGraphicsTextItem(lensControls);
QFont newFont = font(); QFont newFont = font();
newFont.setPixelSize(12); newFont.setPixelSize(12);
setControlsFont(newFont); setControlsFont(newFont);
//setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); //setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
//Traditional field width from Ocular ;) //Traditional field width from Ocular ;)
QFontMetrics fm(fieldOcularName->font()); QFontMetrics fm(fieldOcularName->font());
int maxWidth = fm.width(QString("MMMMMMMMMMMMMMMMMMM")); int maxWidth = fm.width(QString("MMMMMMMMMMMMMMMMMMM"));
int lineHeight = fm.height(); int lineHeight = fm.height();
fieldOcularName->setTextWidth(maxWidth); fieldOcularName->setTextWidth(maxWidth);
fieldOcularFl->setTextWidth(maxWidth); fieldOcularFl->setTextWidth(maxWidth);
fieldOcularAfov->setTextWidth(maxWidth); fieldOcularAfov->setTextWidth(maxWidth);
fieldCcdName->setTextWidth(maxWidth); fieldCcdName->setTextWidth(maxWidth);
fieldCcdDimensions->setTextWidth(maxWidth); fieldCcdDimensions->setTextWidth(maxWidth);
fieldCcdRotation->setTextWidth(maxWidth); fieldCcdRotation->setTextWidth(maxWidth);
fieldTelescopeName->setTextWidth(maxWidth); fieldTelescopeName->setTextWidth(maxWidth);
fieldMagnification->setTextWidth(maxWidth); fieldMagnification->setTextWidth(maxWidth);
fieldFov->setTextWidth(maxWidth); fieldFov->setTextWidth(maxWidth);
fieldLensName->setTextWidth(maxWidth);
fieldLensMultipler->setTextWidth(maxWidth);
QPixmap pa(":/graphicGui/btTimeRewind-on.png"); QPixmap pa(":/graphicGui/btTimeRewind-on.png");
QPixmap prevArrow = pa.scaledToHeight(lineHeight, Qt::SmoothTransfor mation); QPixmap prevArrow = pa.scaledToHeight(lineHeight, Qt::SmoothTransfor mation);
QPixmap paOff(":/graphicGui/btTimeRewind-off.png"); QPixmap paOff(":/graphicGui/btTimeRewind-off.png");
QPixmap prevArrowOff = paOff.scaledToHeight(lineHeight, Qt::SmoothTr ansformation); QPixmap prevArrowOff = paOff.scaledToHeight(lineHeight, Qt::SmoothTr ansformation);
QPixmap na(":/graphicGui/btTimeForward-on.png"); QPixmap na(":/graphicGui/btTimeForward-on.png");
QPixmap nextArrow = na.scaledToHeight(lineHeight, Qt::SmoothTransfor mation); QPixmap nextArrow = na.scaledToHeight(lineHeight, Qt::SmoothTransfor mation);
QPixmap naOff(":/graphicGui/btTimeForward-off.png"); QPixmap naOff(":/graphicGui/btTimeForward-off.png");
QPixmap nextArrowOff = naOff.scaledToHeight(lineHeight, Qt::SmoothTr ansformation); QPixmap nextArrowOff = naOff.scaledToHeight(lineHeight, Qt::SmoothTr ansformation);
QAction* defaultAction = new QAction(this); QAction* defaultAction = new QAction(this);
skipping to change at line 193 skipping to change at line 202
prevArrowOff, prevArrowOff,
QPixmap(), QPixmap(),
defaultAction); defaultAction);
prevOcularButton->setToolTip(q_("Previous ocular")); prevOcularButton->setToolTip(q_("Previous ocular"));
nextOcularButton = new StelButton(ocularControls, nextOcularButton = new StelButton(ocularControls,
nextArrow, nextArrow,
nextArrowOff, nextArrowOff,
QPixmap(), QPixmap(),
defaultAction); defaultAction);
nextOcularButton->setToolTip(q_("Next ocular")); nextOcularButton->setToolTip(q_("Next ocular"));
prevLensButton = new StelButton(lensControls,
prevArrow,
prevArrowOff,
QPixmap(),
defaultAction);
prevLensButton->setToolTip(q_("Previous lens"));
nextLensButton = new StelButton(lensControls,
nextArrow,
nextArrowOff,
QPixmap(),
defaultAction);
nextLensButton->setToolTip(q_("Next lens"));
prevCcdButton = new StelButton(ccdControls, prevCcdButton = new StelButton(ccdControls,
prevArrow, prevArrow,
prevArrowOff, prevArrowOff,
QPixmap(), QPixmap(),
defaultAction); defaultAction);
prevCcdButton->setToolTip(q_("Previous CCD frame")); prevCcdButton->setToolTip(q_("Previous CCD frame"));
nextCcdButton = new StelButton(ccdControls, nextCcdButton = new StelButton(ccdControls,
nextArrow, nextArrow,
nextArrowOff, nextArrowOff,
QPixmap(), QPixmap(),
skipping to change at line 230 skipping to change at line 251
connect(nextCcdButton, SIGNAL(triggered()), connect(nextCcdButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(incrementCCDIndex())); ocularsPlugin, SLOT(incrementCCDIndex()));
connect(nextTelescopeButton, SIGNAL(triggered()), connect(nextTelescopeButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(incrementTelescopeIndex())); ocularsPlugin, SLOT(incrementTelescopeIndex()));
connect(prevOcularButton, SIGNAL(triggered()), connect(prevOcularButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(decrementOcularIndex())); ocularsPlugin, SLOT(decrementOcularIndex()));
connect(prevCcdButton, SIGNAL(triggered()), connect(prevCcdButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(decrementCCDIndex())); ocularsPlugin, SLOT(decrementCCDIndex()));
connect(prevTelescopeButton, SIGNAL(triggered()), connect(prevTelescopeButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(decrementTelescopeIndex())); ocularsPlugin, SLOT(decrementTelescopeIndex()));
connect(nextLensButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(incrementLensIndex()));
connect(prevLensButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(decrementLensIndex()));
QColor cOn(255, 255, 255); QColor cOn(255, 255, 255);
QColor cOff(102, 102, 102); QColor cOff(102, 102, 102);
QColor cHover(162, 162, 162); QColor cHover(162, 162, 162);
QString degrees = QString("-15%1").arg(QChar(0x00B0)); QString degrees = QString("-15%1").arg(QChar(0x00B0));
int degreesW = fm.width(degrees); int degreesW = fm.width(degrees);
QPixmap pOn = createPixmapFromText(degrees, degreesW, lineHeight, ne wFont, cOn); QPixmap pOn = createPixmapFromText(degrees, degreesW, lineHeight, ne wFont, cOn);
QPixmap pOff = createPixmapFromText(degrees, degreesW, lineHeight, n ewFont, cOff); QPixmap pOff = createPixmapFromText(degrees, degreesW, lineHeight, n ewFont, cOff);
QPixmap pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cHover); QPixmap pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cHover);
rotateCcdMinus15Button = new StelButton(ccdControls, rotateCcdMinus15Button = new StelButton(ccdControls,
skipping to change at line 256 skipping to change at line 281
degrees = QString("-5%1").arg(QChar(0x00B0)); degrees = QString("-5%1").arg(QChar(0x00B0));
degreesW = fm.width(degrees); degreesW = fm.width(degrees);
pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On); pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On);
pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff); pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff);
pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover); pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover);
rotateCcdMinus5Button = new StelButton(ccdControls, rotateCcdMinus5Button = new StelButton(ccdControls,
pOn, pOn,
pOff, pOff,
pHover, pHover,
defaultAction, defaultAction,
true); true);
rotateCcdMinus5Button->setToolTip(q_("Rotate the sensor frame 5 degr ees counterclockwise")); rotateCcdMinus5Button->setToolTip(q_("Rotate the sensor frame 5 degr ees counterclockwise"));
degrees = QString("-1%1").arg(QChar(0x00B0)); degrees = QString("-1%1").arg(QChar(0x00B0));
degreesW = fm.width(degrees); degreesW = fm.width(degrees);
pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On); pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On);
pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff); pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff);
pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover); pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover);
rotateCcdMinus1Button = new StelButton(ccdControls, rotateCcdMinus1Button = new StelButton(ccdControls,
pOn, pOn,
pOff, pOff,
pHover, pHover,
defaultAction, defaultAction,
true); true);
rotateCcdMinus1Button->setToolTip(q_("Rotate the sensor frame 1 degr ee counterclockwise")); rotateCcdMinus1Button->setToolTip(q_("Rotate the sensor frame 1 degr ee counterclockwise"));
degrees = QString("0%1").arg(QChar(0x00B0)); degrees = QString("0%1").arg(QChar(0x00B0));
degreesW = fm.width(degrees); degreesW = fm.width(degrees);
pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On); pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On);
pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff); pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff);
pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover); pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover);
resetCcdRotationButton = new StelButton(ccdControls, resetCcdRotationButton = new StelButton(ccdControls,
pOn, pOn,
pOff, pOff,
pHover, pHover,
defaultAction, defaultAction,
true); true);
resetCcdRotationButton->setToolTip(q_("Reset the sensor frame rotati on")); resetCcdRotationButton->setToolTip(q_("Reset the sensor frame rotati on"));
degrees = QString("+1%1").arg(QChar(0x00B0)); degrees = QString("+1%1").arg(QChar(0x00B0));
degreesW = fm.width(degrees); degreesW = fm.width(degrees);
pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On); pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On);
pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff); pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff);
pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover); pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover);
rotateCcdPlus1Button = new StelButton(ccdControls, rotateCcdPlus1Button = new StelButton(ccdControls,
pOn, pOn,
pOff, pOff,
pHover, pHover,
defaultAction, defaultAction,
true); true);
rotateCcdPlus1Button->setToolTip(q_("Rotate the sensor frame 1 degre e clockwise")); rotateCcdPlus1Button->setToolTip(q_("Rotate the sensor frame 1 degre e clockwise"));
degrees = QString("+5%1").arg(QChar(0x00B0)); degrees = QString("+5%1").arg(QChar(0x00B0));
degreesW = fm.width(degrees); degreesW = fm.width(degrees);
pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On); pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On);
pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff); pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff);
pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover); pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover);
rotateCcdPlus5Button = new StelButton(ccdControls, rotateCcdPlus5Button = new StelButton(ccdControls,
pOn, pOn,
pOff, pOff,
pHover, pHover,
defaultAction, defaultAction,
true); true);
rotateCcdPlus5Button->setToolTip(q_("Rotate the sensor frame 5 degre es clockwise")); rotateCcdPlus5Button->setToolTip(q_("Rotate the sensor frame 5 degre es clockwise"));
degrees = QString("+15%1").arg(QChar(0x00B0)); degrees = QString("+15%1").arg(QChar(0x00B0));
degreesW = fm.width(degrees); degreesW = fm.width(degrees);
pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On); pOn = createPixmapFromText(degrees, degreesW, lineHeight, newFont, c On);
pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff); pOff = createPixmapFromText(degrees, degreesW, lineHeight, newFont, cOff);
pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover); pHover = createPixmapFromText(degrees, degreesW, lineHeight, newFont , cHover);
rotateCcdPlus15Button = new StelButton(ccdControls, rotateCcdPlus15Button = new StelButton(ccdControls,
pOn, pOn,
pOff, pOff,
pHover, pHover,
defaultAction, defaultAction,
true); true);
rotateCcdPlus15Button->setToolTip(q_("Rotate the sensor frame 15 deg rees clockwise")); rotateCcdPlus15Button->setToolTip(q_("Rotate the sensor frame 15 deg rees clockwise"));
QSignalMapper* sm = ocularsPlugin->ccdRotationSignalMapper; QSignalMapper* sm = ocularsPlugin->ccdRotationSignalMapper;
sm->setMapping(rotateCcdMinus15Button, QString("-15")); sm->setMapping(rotateCcdMinus15Button, QString("-15"));
sm->setMapping(rotateCcdMinus5Button, QString("-5")); sm->setMapping(rotateCcdMinus5Button, QString("-5"));
sm->setMapping(rotateCcdMinus1Button, QString("-1")); sm->setMapping(rotateCcdMinus1Button, QString("-1"));
sm->setMapping(rotateCcdPlus1Button, QString("1")); sm->setMapping(rotateCcdPlus1Button, QString("1"));
sm->setMapping(rotateCcdPlus5Button, QString("5")); sm->setMapping(rotateCcdPlus5Button, QString("5"));
sm->setMapping(rotateCcdPlus15Button, QString("15")); sm->setMapping(rotateCcdPlus15Button, QString("15"));
skipping to change at line 370 skipping to change at line 395
connect(resetCcdRotationButton, SIGNAL(triggered()), connect(resetCcdRotationButton, SIGNAL(triggered()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
//Set the layout and update the size //Set the layout and update the size
qreal width = 2*prevOcularButton->boundingRect().width() + maxWidth; qreal width = 2*prevOcularButton->boundingRect().width() + maxWidth;
qreal left, right, top, bottom; qreal left, right, top, bottom;
mainLayout->getContentsMargins(&left, &top, &right, &bottom); mainLayout->getContentsMargins(&left, &top, &right, &bottom);
ocularControls->setMaximumWidth(width); ocularControls->setMaximumWidth(width);
ccdControls->setMaximumWidth(width); ccdControls->setMaximumWidth(width);
telescopeControls->setMaximumWidth(width); telescopeControls->setMaximumWidth(width);
lensControls->setMaximumWidth(width);
resize(width + left + right, 10); resize(width + left + right, 10);
buttonBar->resize(width, size().height()); buttonBar->resize(width, size().height());
updateMainButtonsPositions(); updateMainButtonsPositions();
//Border/background for the widget //Border/background for the widget
borderPath = new QGraphicsPathItem(); borderPath = new QGraphicsPathItem();
borderPath->setZValue(100); borderPath->setZValue(100);
QBrush borderBrush(QColor::fromRgbF(0.22, 0.22, 0.23, 0.2)); QBrush borderBrush(QColor::fromRgbF(0.22, 0.22, 0.23, 0.2));
borderPath->setBrush(borderBrush); borderPath->setBrush(borderBrush);
QPen borderPen = QPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); QPen borderPen = QPen(QColor::fromRgbF(0.7,0.7,0.7,0.5));
skipping to change at line 395 skipping to change at line 421
connect (parentWidget, SIGNAL(geometryChanged()), connect (parentWidget, SIGNAL(geometryChanged()),
this, SLOT(updatePosition())); this, SLOT(updatePosition()));
//Connecting other slots //Connecting other slots
connect(ocularsPlugin, SIGNAL(selectedOcularChanged()), connect(ocularsPlugin, SIGNAL(selectedOcularChanged()),
this, SLOT(updateOcularControls())); this, SLOT(updateOcularControls()));
connect(ocularsPlugin, SIGNAL(selectedCCDChanged()), connect(ocularsPlugin, SIGNAL(selectedCCDChanged()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
connect(ocularsPlugin, SIGNAL(selectedTelescopeChanged()), connect(ocularsPlugin, SIGNAL(selectedTelescopeChanged()),
this, SLOT(updateTelescopeControls())); this, SLOT(updateTelescopeControls()));
connect(ocularsPlugin, SIGNAL(selectedLensChanged()),
this, SLOT(updateTelescopeControls()));
//Night mode //Night mode
connect(&stelApp, SIGNAL(colorSchemeChanged(const QString&)), connect(&stelApp, SIGNAL(colorSchemeChanged(const QString&)),
this, SLOT(setColorScheme(const QString&))); this, SLOT(setColorScheme(const QString&)));
setColorScheme(stelApp.getCurrentStelStyle()); setColorScheme(stelApp.getCurrentStelStyle());
} }
OcularsGuiPanel::~OcularsGuiPanel() OcularsGuiPanel::~OcularsGuiPanel()
{ {
if (borderPath) if (borderPath)
skipping to change at line 419 skipping to change at line 447
{ {
setPreferredHeight(0);//WTF? setPreferredHeight(0);//WTF?
if (ocularsPlugin->flagShowOculars) if (ocularsPlugin->flagShowOculars)
{ {
updateOcularControls(); updateOcularControls();
} }
else else
{ {
setOcularControlsVisible(false); setOcularControlsVisible(false);
setTelescopeControlsVisible(false); setTelescopeControlsVisible(false);
setLensControlsVisible(false);
updatePosition(); updatePosition();
} }
} }
void OcularsGuiPanel::showCcdGui() void OcularsGuiPanel::showCcdGui()
{ {
updateCcdControls(); updateCcdControls();
} }
void OcularsGuiPanel::foldGui() void OcularsGuiPanel::foldGui()
{ {
//qDebug() << "hidePanel()"; //qDebug() << "hidePanel()";
setOcularControlsVisible(false); setOcularControlsVisible(false);
setCcdControlsVisible(false); setCcdControlsVisible(false);
setTelescopeControlsVisible(false); setTelescopeControlsVisible(false);
setLensControlsVisible(false);
updatePosition(); updatePosition();
} }
void OcularsGuiPanel::updatePosition() void OcularsGuiPanel::updatePosition()
{ {
updateGeometry(); updateGeometry();
/*qDebug() << "Widget:" << size() /*qDebug() << "Widget:" << size()
<< "Buttonbar:" << buttonBar->size() << "Buttonbar:" << buttonBar->size()
<< "Ocular" << ocularControls->size() << "Ocular" << ocularControls->size()
<< "CCD" << ccdControls->size() << "CCD" << ccdControls->size()
skipping to change at line 545 skipping to change at line 575
fieldOcularAfov->setVisible(true); fieldOcularAfov->setVisible(true);
} }
ocularControls->setMinimumSize(widgetWidth, widgetHeight); ocularControls->setMinimumSize(widgetWidth, widgetHeight);
ocularControls->resize(widgetWidth, widgetHeight); ocularControls->resize(widgetWidth, widgetHeight);
setOcularControlsVisible(true); setOcularControlsVisible(true);
updateTelescopeControls();//Contains a call to updatePosition() updateTelescopeControls();//Contains a call to updatePosition()
} }
void OcularsGuiPanel::updateLensControls()
{
if (ocularsPlugin->flagShowCCD)
{
setLensControlsVisible(false);
return;
}
int index = ocularsPlugin->selectedOcularIndex;
//Ocular* ocular = ocularsPlugin->oculars[index];
Lens* lens = ocularsPlugin->selectedLens();
index = ocularsPlugin->selectedLensIndex;
QString fullName;
QString multiplerString;
if (lens != NULL)
{
QString name = lens->name();
if (name.isEmpty())
{
fullName = QString(q_("Lens #%1")).arg(index);
}
else
{
fullName = QString(q_("Lens #%1: %2")).arg(index).ar
g(name);
}
multiplerString = QString(q_("Multiplicity: %1")).arg(lens->
multipler());
multiplerString.append(QChar(0x00D7));
}
else
{
fullName = QString(q_("Lens: None"));
multiplerString = QString(q_("Multiplicity: N/A"));
}
fieldLensName->setPlainText(fullName);
fieldLensMultipler->setPlainText(multiplerString);
fieldOcularFl->setToolTip(q_("Multiplicity of lens"));
qreal posX = 0.;
qreal posY = 0.;
qreal widgetWidth = 0.;
qreal widgetHeight = 0.;
//Prev button
qreal heightAdjustment = (fieldLensName->boundingRect().height() - p
revLensButton->boundingRect().height()) / 2.;
prevLensButton->setPos(posX, round(posY + heightAdjustment));
posX += prevLensButton->boundingRect().width();
widgetWidth += prevLensButton->boundingRect().width();
//Name field
fieldLensName->setPos(posX, posY);
posX += fieldLensName->boundingRect().width();
widgetWidth += fieldLensName->boundingRect().width();
widgetHeight += fieldLensName->boundingRect().height();
//Next button
nextLensButton->setPos(posX, posY + heightAdjustment);
widgetWidth += nextLensButton->boundingRect().width();
posX = prevLensButton->boundingRect().width();
posY += fieldLensName->boundingRect().height();
fieldLensMultipler->setPos(posX, posY);
widgetHeight += fieldLensMultipler->boundingRect().height();
lensControls->setMinimumSize(widgetWidth, widgetHeight);
lensControls->resize(widgetWidth, widgetHeight);
setLensControlsVisible(true);
}
void OcularsGuiPanel::updateCcdControls() void OcularsGuiPanel::updateCcdControls()
{ {
setOcularControlsVisible(false); setOcularControlsVisible(false);
//Get the name //Get the name
int index = ocularsPlugin->selectedCCDIndex; int index = ocularsPlugin->selectedCCDIndex;
CCD* ccd = ocularsPlugin->ccds[index]; CCD* ccd = ocularsPlugin->ccds[index];
Q_ASSERT(ccd); Q_ASSERT(ccd);
QString name = ccd->name(); QString name = ccd->name();
QString fullName; QString fullName;
skipping to change at line 703 skipping to change at line 803
fieldMagnification->setVisible(false); fieldMagnification->setVisible(false);
fieldFov->setVisible(false); fieldFov->setVisible(false);
} }
else if (ocularsPlugin->flagShowOculars) else if (ocularsPlugin->flagShowOculars)
{ {
//We need the current ocular //We need the current ocular
int index = ocularsPlugin->selectedOcularIndex; int index = ocularsPlugin->selectedOcularIndex;
Ocular* ocular = ocularsPlugin->oculars[index]; Ocular* ocular = ocularsPlugin->oculars[index];
Q_ASSERT(ocular); Q_ASSERT(ocular);
Lens *lens = ocularsPlugin->selectedLens();
if (ocular->isBinoculars()) if (ocular->isBinoculars())
{ {
prevTelescopeButton->setVisible(false); prevTelescopeButton->setVisible(false);
nextTelescopeButton->setVisible(false); nextTelescopeButton->setVisible(false);
fieldTelescopeName->setVisible(false); fieldTelescopeName->setVisible(false);
posY = 0.; posY = 0.;
widgetHeight = 0.; widgetHeight = 0.;
fieldMagnification->setToolTip(q_("Magnification pro vided by these binoculars")); fieldMagnification->setToolTip(q_("Magnification pro vided by these binoculars"));
fieldFov->setToolTip(q_("Actual field of view provid ed by these binoculars")); fieldFov->setToolTip(q_("Actual field of view provid ed by these binoculars"));
} }
else else
{ {
prevTelescopeButton->setVisible(true); prevTelescopeButton->setVisible(true);
nextTelescopeButton->setVisible(true); nextTelescopeButton->setVisible(true);
fieldTelescopeName->setVisible(true); fieldTelescopeName->setVisible(true);
fieldMagnification->setToolTip(q_("Magnification pro fieldMagnification->setToolTip(q_("Magnification pro
vided by this ocular/telescope combination")); vided by this ocular/lens/telescope combination"));
fieldFov->setToolTip(q_("Actual field of view provid fieldFov->setToolTip(q_("Actual field of view provid
ed by this ocular/telescope combination")); ed by this ocular/lens/telescope combination"));
} }
//WTF? Rounding? //WTF? Rounding?
double magnification = ((int)(ocular->magnification(telescop e) * 10.0)) / 10.0; double magnification = ((int)(ocular->magnification(telescop e, lens) * 10.0)) / 10.0;
QString magnificationString = QString::number(magnification) ; QString magnificationString = QString::number(magnification) ;
magnificationString.append(QChar(0x00D7)); magnificationString.append(QChar(0x00D7));
QString magnificationLabel = QString(q_("Magnification: %1") ) QString magnificationLabel = QString(q_("Magnification: %1") )
.arg(magnificationString); .arg(magnificationString);
fieldMagnification->setPlainText(magnificationLabel); fieldMagnification->setPlainText(magnificationLabel);
fieldMagnification->setPos(posX, posY); fieldMagnification->setPos(posX, posY);
posY += fieldMagnification->boundingRect().height(); posY += fieldMagnification->boundingRect().height();
widgetHeight += fieldMagnification->boundingRect().height(); widgetHeight += fieldMagnification->boundingRect().height();
double fov = ((int)(ocular->actualFOV(telescope) * 10000.00) ) / 10000.0; double fov = ((int)(ocular->actualFOV(telescope, lens) * 100 00.00)) / 10000.0;
QString fovString = QString::number(fov) + QChar(0x00B0); QString fovString = QString::number(fov) + QChar(0x00B0);
QString fovLabel = QString(q_("FOV: %1")).arg(fovString); QString fovLabel = QString(q_("FOV: %1")).arg(fovString);
fieldFov->setPlainText(fovLabel); fieldFov->setPlainText(fovLabel);
fieldFov->setPos(posX, posY); fieldFov->setPos(posX, posY);
widgetHeight += fieldFov->boundingRect().height(); widgetHeight += fieldFov->boundingRect().height();
fieldMagnification->setVisible(true); fieldMagnification->setVisible(true);
fieldFov->setVisible(true); fieldFov->setVisible(true);
} }
else else
skipping to change at line 759 skipping to change at line 861
fieldTelescopeName->setVisible(true); fieldTelescopeName->setVisible(true);
fieldMagnification->setVisible(false); fieldMagnification->setVisible(false);
fieldFov->setVisible(false); fieldFov->setVisible(false);
} }
telescopeControls->setMinimumSize(widgetWidth, widgetHeight); telescopeControls->setMinimumSize(widgetWidth, widgetHeight);
telescopeControls->resize(widgetWidth, widgetHeight); telescopeControls->resize(widgetWidth, widgetHeight);
setTelescopeControlsVisible(true); setTelescopeControlsVisible(true);
updateLensControls();
updatePosition(); updatePosition();
} }
void OcularsGuiPanel::setLensControlsVisible(bool show)
{
if (show)
{
if (!lensControls->isVisible())
{
lensControls->setVisible(true);
mainLayout->insertItem(2, lensControls);
}
}
else
{
if (lensControls->isVisible())
{
mainLayout->removeItem(lensControls);
lensControls->setVisible(false);
}
}
mainLayout->invalidate();
mainLayout->activate();
resize(mainLayout->geometry().width(),
mainLayout->geometry().height());
}
void OcularsGuiPanel::setOcularControlsVisible(bool show) void OcularsGuiPanel::setOcularControlsVisible(bool show)
{ {
if (show) if (show)
{ {
if (!ocularControls->isVisible()) if (!ocularControls->isVisible())
{ {
ocularControls->setVisible(true); ocularControls->setVisible(true);
mainLayout->insertItem(0, ocularControls); mainLayout->insertItem(0, ocularControls);
} }
} }
skipping to change at line 832 skipping to change at line 959
mainLayout->invalidate(); mainLayout->invalidate();
mainLayout->activate(); mainLayout->activate();
resize(mainLayout->geometry().width(), resize(mainLayout->geometry().width(),
mainLayout->geometry().height()); mainLayout->geometry().height());
} }
void OcularsGuiPanel::updateMainButtonsPositions() void OcularsGuiPanel::updateMainButtonsPositions()
{ {
Q_ASSERT(buttonOcular); Q_ASSERT(buttonOcular);
Q_ASSERT(buttonCrosshairs); Q_ASSERT(buttonCrosshairs);
Q_ASSERT(buttonCrosshairs);
Q_ASSERT(buttonCcd); Q_ASSERT(buttonCcd);
Q_ASSERT(buttonTelrad); Q_ASSERT(buttonTelrad);
Q_ASSERT(buttonConfiguration); Q_ASSERT(buttonConfiguration);
int n = buttonCrosshairs->isVisible() ? 5 : 4; int n = buttonCrosshairs->isVisible() ? 5 : 4;
qreal width = n * buttonOcular->getButtonPixmapWidth(); qreal width = n * buttonOcular->getButtonPixmapWidth();
//Relative position inside the parent widget //Relative position inside the parent widget
qreal posX = 0.; qreal posX = 0.;
qreal posY = 0.; qreal posY = 0.;
skipping to change at line 881 skipping to change at line 1007
{ {
Q_ASSERT(fieldOcularName); Q_ASSERT(fieldOcularName);
Q_ASSERT(fieldOcularFl); Q_ASSERT(fieldOcularFl);
Q_ASSERT(fieldOcularAfov); Q_ASSERT(fieldOcularAfov);
Q_ASSERT(fieldCcdName); Q_ASSERT(fieldCcdName);
Q_ASSERT(fieldCcdDimensions); Q_ASSERT(fieldCcdDimensions);
Q_ASSERT(fieldCcdRotation); Q_ASSERT(fieldCcdRotation);
Q_ASSERT(fieldTelescopeName); Q_ASSERT(fieldTelescopeName);
Q_ASSERT(fieldMagnification); Q_ASSERT(fieldMagnification);
Q_ASSERT(fieldFov); Q_ASSERT(fieldFov);
Q_ASSERT(fieldLensName);
Q_ASSERT(fieldLensMultipler);
fieldOcularName->setDefaultTextColor(color); fieldOcularName->setDefaultTextColor(color);
fieldOcularFl->setDefaultTextColor(color); fieldOcularFl->setDefaultTextColor(color);
fieldOcularAfov->setDefaultTextColor(color); fieldOcularAfov->setDefaultTextColor(color);
fieldCcdName->setDefaultTextColor(color); fieldCcdName->setDefaultTextColor(color);
fieldCcdDimensions->setDefaultTextColor(color); fieldCcdDimensions->setDefaultTextColor(color);
fieldCcdRotation->setDefaultTextColor(color); fieldCcdRotation->setDefaultTextColor(color);
fieldTelescopeName->setDefaultTextColor(color); fieldTelescopeName->setDefaultTextColor(color);
fieldMagnification->setDefaultTextColor(color); fieldMagnification->setDefaultTextColor(color);
fieldFov->setDefaultTextColor(color); fieldFov->setDefaultTextColor(color);
fieldLensName->setDefaultTextColor(color);
fieldLensMultipler->setDefaultTextColor(color);
} }
void OcularsGuiPanel::setControlsFont(const QFont& font) void OcularsGuiPanel::setControlsFont(const QFont& font)
{ {
Q_ASSERT(fieldOcularName); Q_ASSERT(fieldOcularName);
Q_ASSERT(fieldOcularFl); Q_ASSERT(fieldOcularFl);
Q_ASSERT(fieldOcularAfov); Q_ASSERT(fieldOcularAfov);
Q_ASSERT(fieldCcdName); Q_ASSERT(fieldCcdName);
Q_ASSERT(fieldCcdDimensions); Q_ASSERT(fieldCcdDimensions);
Q_ASSERT(fieldCcdRotation); Q_ASSERT(fieldCcdRotation);
Q_ASSERT(fieldTelescopeName); Q_ASSERT(fieldTelescopeName);
Q_ASSERT(fieldMagnification); Q_ASSERT(fieldMagnification);
Q_ASSERT(fieldFov); Q_ASSERT(fieldFov);
Q_ASSERT(fieldLensName);
Q_ASSERT(fieldLensMultipler);
fieldOcularName->setFont(font); fieldOcularName->setFont(font);
fieldOcularFl->setFont(font); fieldOcularFl->setFont(font);
fieldOcularAfov->setFont(font); fieldOcularAfov->setFont(font);
fieldCcdName->setFont(font); fieldCcdName->setFont(font);
fieldCcdDimensions->setFont(font); fieldCcdDimensions->setFont(font);
fieldCcdRotation->setFont(font); fieldCcdRotation->setFont(font);
fieldTelescopeName->setFont(font); fieldTelescopeName->setFont(font);
fieldMagnification->setFont(font); fieldMagnification->setFont(font);
fieldFov->setFont(font); fieldFov->setFont(font);
fieldLensName->setFont(font);
fieldLensMultipler->setFont(font);
} }
void OcularsGuiPanel::setButtonsNightMode(bool nightMode) void OcularsGuiPanel::setButtonsNightMode(bool nightMode)
{ {
//Reused from SkyGui, with modifications //Reused from SkyGui, with modifications
foreach (QGraphicsItem *child, QGraphicsItem::children()) foreach (QGraphicsItem *child, QGraphicsItem::children())
{ {
foreach (QGraphicsItem *grandchild, child->children()) foreach (QGraphicsItem *grandchild, child->children())
{ {
StelButton* button = qgraphicsitem_cast<StelButton*> (grandchild); StelButton* button = qgraphicsitem_cast<StelButton*> (grandchild);
 End of changes. 29 change blocks. 
29 lines changed or deleted 166 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/