OcularsGuiPanel.cpp   OcularsGuiPanel.cpp 
skipping to change at line 40 skipping to change at line 40
#include <QGraphicsPathItem> #include <QGraphicsPathItem>
#include <QGraphicsProxyWidget> #include <QGraphicsProxyWidget>
#include <QLabel> #include <QLabel>
#include <QPainter> #include <QPainter>
#include <QPen> #include <QPen>
#include <QPushButton> #include <QPushButton>
#include <QSignalMapper> #include <QSignalMapper>
#include <QWidget> #include <QWidget>
OcularsGuiPanel::OcularsGuiPanel(Oculars* plugin, OcularsGuiPanel::OcularsGuiPanel(Oculars* plugin,
QGraphicsWidget *parent, QGraphicsWidget *parent,
Qt::WindowFlags wFlags): Qt::WindowFlags wFlags):
QGraphicsWidget(parent, wFlags), QGraphicsWidget(parent, wFlags),
ocularsPlugin(plugin), ocularsPlugin(plugin),
parentWidget(parent), parentWidget(parent),
borderPath(0) borderPath(0)
{ {
setMaximumSize(300, 400); setMaximumSize(300, 400);
setContentsMargins(0, 0, 0, 0); setContentsMargins(0, 0, 0, 0);
//TODO: set font? //TODO: set font?
//First create the layout and populate it, then set it? //First create the layout and populate it, then set it?
mainLayout = new QGraphicsLinearLayout(Qt::Vertical); mainLayout = new QGraphicsLinearLayout(Qt::Vertical);
//Button bar //Button bar
buttonBar = new QGraphicsWidget(); buttonBar = new QGraphicsWidget();
mainLayout->addItem(buttonBar); mainLayout->addItem(buttonBar);
StelApp& stelApp = StelApp::getInstance(); StelApp& stelApp = StelApp::getInstance();
Q_ASSERT(ocularsPlugin->actionShowOcular); Q_ASSERT(ocularsPlugin->actionShowOcular);
buttonOcular = new StelButton(buttonBar, buttonOcular = new StelButton(buttonBar,
QPixmap(":/ocular/bt_ocular_on.png"), QPixmap(":/ocular/bt_ocular_on.png"),
QPixmap(":/ocular/bt_ocular_off.png"), QPixmap(":/ocular/bt_ocular_off.png"),
QPixmap(), QPixmap(),
ocularsPlugin->actionShowOcular, ocularsPlugin->actionShowOcular,
true); //No background true); //No background
buttonOcular->setToolTip(ocularsPlugin->actionShowOcular->getText()) ; buttonOcular->setToolTip(ocularsPlugin->actionShowOcular->getText()) ;
buttonOcular->setParentItem(buttonBar); buttonOcular->setParentItem(buttonBar);
//Hack to avoid buttonOcular being left "checked" if it has been tog
gled
//without any object selected.
disconnect(ocularsPlugin->actionShowOcular, SIGNAL(toggled(bool)),
ocularsPlugin, SLOT(enableOcular(bool)));
connect(ocularsPlugin->actionShowOcular, SIGNAL(toggled(bool)),
ocularsPlugin, SLOT(enableOcular(bool)));
Q_ASSERT(ocularsPlugin->actionShowCrosshairs); Q_ASSERT(ocularsPlugin->actionShowCrosshairs);
buttonCrosshairs = new StelButton(buttonBar, buttonCrosshairs = new StelButton(buttonBar,
QPixmap(":/ocular/bt_crosshairs_on QPixmap(":/ocular/bt_crosshairs_on
.png"), .png"),
QPixmap(":/ocular/bt_crosshairs_of QPixmap(":/ocular/bt_crosshairs_of
f.png"), f.png"),
QPixmap(), QPixmap(),
ocularsPlugin->actionShowCrosshair ocularsPlugin->actionShowCrosshair
s, s,
true); true);
buttonCrosshairs->setToolTip(ocularsPlugin->actionShowCrosshairs->ge tText()); buttonCrosshairs->setToolTip(ocularsPlugin->actionShowCrosshairs->ge tText());
buttonCrosshairs->setVisible(false); buttonCrosshairs->setVisible(false);
Q_ASSERT(ocularsPlugin->actionShowSensor); Q_ASSERT(ocularsPlugin->actionShowSensor);
buttonCcd = new StelButton(buttonBar, buttonCcd = new StelButton(buttonBar,
QPixmap(":/ocular/bt_sensor_on.png"), QPixmap(":/ocular/bt_sensor_on.png"),
QPixmap(":/ocular/bt_sensor_off.png"), QPixmap(":/ocular/bt_sensor_off.png"),
QPixmap(), QPixmap(),
ocularsPlugin->actionShowSensor, ocularsPlugin->actionShowSensor,
true); true);
buttonCcd->setToolTip(ocularsPlugin->actionShowSensor->getText()); buttonCcd->setToolTip(ocularsPlugin->actionShowSensor->getText());
Q_ASSERT(ocularsPlugin->actionShowTelrad); Q_ASSERT(ocularsPlugin->actionShowTelrad);
buttonTelrad = new StelButton(buttonBar, buttonTelrad = new StelButton(buttonBar,
QPixmap(":/ocular/bt_telrad_on.png"), QPixmap(":/ocular/bt_telrad_on.png"),
QPixmap(":/ocular/bt_telrad_off.png"), QPixmap(":/ocular/bt_telrad_off.png"),
QPixmap(), QPixmap(),
ocularsPlugin->actionShowTelrad, ocularsPlugin->actionShowTelrad,
true); true);
buttonTelrad->setToolTip(ocularsPlugin->actionShowTelrad->getText()) ; buttonTelrad->setToolTip(ocularsPlugin->actionShowTelrad->getText()) ;
Q_ASSERT(ocularsPlugin->actionConfiguration); Q_ASSERT(ocularsPlugin->actionConfiguration);
buttonConfiguration = new StelButton(buttonBar, buttonConfiguration = new StelButton(buttonBar,
QPixmap(":/ocular/bt_settings_o QPixmap(":/ocular/bt_settings_o
n.png"), n.png"),
QPixmap(":/ocular/bt_settings_o QPixmap(":/ocular/bt_settings_o
ff.png"), ff.png"),
QPixmap(), QPixmap(),
ocularsPlugin->actionConfigurat ocularsPlugin->actionConfigurat
ion, ion,
true); true);
buttonConfiguration->setToolTip(ocularsPlugin->actionConfiguration-> getText()); buttonConfiguration->setToolTip(ocularsPlugin->actionConfiguration-> getText());
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);
skipping to change at line 141 skipping to change at line 134
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);
fieldExitPupil = new QGraphicsTextItem(telescopeControls);
fieldFov = new QGraphicsTextItem(telescopeControls); fieldFov = new QGraphicsTextItem(telescopeControls);
fieldLensName = new QGraphicsTextItem(lensControls); fieldLensName = new QGraphicsTextItem(lensControls);
fieldLensMultipler = new QGraphicsTextItem(lensControls); fieldLensMultipler = new QGraphicsTextItem(lensControls);
QFont newFont = font(); QFont newFont = font();
// Font size is 12 // Font size is 12
newFont.setPixelSize(StelApp::getInstance().getBaseFontSize()-1); newFont.setPixelSize(StelApp::getInstance().getBaseFontSize()-1);
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));
skipping to change at line 165 skipping to change at line 159
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);
fieldExitPupil->setTextWidth(maxWidth);
fieldFov->setTextWidth(maxWidth); fieldFov->setTextWidth(maxWidth);
fieldLensName->setTextWidth(maxWidth); fieldLensName->setTextWidth(maxWidth);
fieldLensMultipler->setTextWidth(maxWidth); fieldLensMultipler->setTextWidth(maxWidth);
float scale = lineHeight*1.5; // TODO: change hardcoded 1.5 to edita ble value of scaling coefficient float scale = lineHeight*1.5; // TODO: change hardcoded 1.5 to edita ble value of scaling coefficient
QPixmap pa(":/graphicGui/btTimeRewind-on.png"); QPixmap pa(":/graphicGui/btTimeRewind-on.png");
QPixmap prevArrow = pa.scaledToHeight(scale, Qt::SmoothTransformatio n); QPixmap prevArrow = pa.scaledToHeight(scale, Qt::SmoothTransformatio n);
QPixmap paOff(":/graphicGui/btTimeRewind-off.png"); QPixmap paOff(":/graphicGui/btTimeRewind-off.png");
QPixmap prevArrowOff = paOff.scaledToHeight(scale, Qt::SmoothTransfo rmation); QPixmap prevArrowOff = paOff.scaledToHeight(scale, Qt::SmoothTransfo rmation);
QPixmap na(":/graphicGui/btTimeForward-on.png"); QPixmap na(":/graphicGui/btTimeForward-on.png");
QPixmap nextArrow = na.scaledToHeight(scale, Qt::SmoothTransformatio n); QPixmap nextArrow = na.scaledToHeight(scale, Qt::SmoothTransformatio n);
QPixmap naOff(":/graphicGui/btTimeForward-off.png"); QPixmap naOff(":/graphicGui/btTimeForward-off.png");
QPixmap nextArrowOff = naOff.scaledToHeight(scale, Qt::SmoothTransfo rmation); QPixmap nextArrowOff = naOff.scaledToHeight(scale, Qt::SmoothTransfo rmation);
StelAction* defaultAction = new StelAction(this);
defaultAction->setCheckable(false);
prevOcularButton = new StelButton(ocularControls, prevOcularButton = new StelButton(ocularControls,
prevArrow, prevArrow,
prevArrowOff, prevArrowOff,
QPixmap(), QPixmap());
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);
nextOcularButton->setToolTip(q_("Next ocular")); nextOcularButton->setToolTip(q_("Next ocular"));
prevLensButton = new StelButton(lensControls, prevLensButton = new StelButton(lensControls,
prevArrow, prevArrow,
prevArrowOff, prevArrowOff,
QPixmap(), QPixmap());
defaultAction);
prevLensButton->setToolTip(q_("Previous lens")); prevLensButton->setToolTip(q_("Previous lens"));
nextLensButton = new StelButton(lensControls, nextLensButton = new StelButton(lensControls,
nextArrow, nextArrow,
nextArrowOff, nextArrowOff,
QPixmap(), QPixmap());
defaultAction);
nextLensButton->setToolTip(q_("Next lens")); nextLensButton->setToolTip(q_("Next lens"));
prevCcdButton = new StelButton(ccdControls, prevCcdButton = new StelButton(ccdControls,
prevArrow, prevArrow,
prevArrowOff, prevArrowOff,
QPixmap(), QPixmap());
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());
defaultAction);
nextCcdButton->setToolTip(q_("Next CCD frame")); nextCcdButton->setToolTip(q_("Next CCD frame"));
prevTelescopeButton = new StelButton(telescopeControls, prevTelescopeButton = new StelButton(telescopeControls,
prevArrow, prevArrow,
prevArrowOff, prevArrowOff,
QPixmap(), QPixmap());
defaultAction);
prevTelescopeButton->setToolTip(q_("Previous telescope")); prevTelescopeButton->setToolTip(q_("Previous telescope"));
nextTelescopeButton = new StelButton(telescopeControls, nextTelescopeButton = new StelButton(telescopeControls,
nextArrow, nextArrow,
nextArrowOff, nextArrowOff,
QPixmap(), QPixmap());
defaultAction);
nextTelescopeButton->setToolTip(q_("Next telescope")); nextTelescopeButton->setToolTip(q_("Next telescope"));
connect(nextOcularButton, SIGNAL(triggered()), connect(nextOcularButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(incrementOcularIndex())); ocularsPlugin, SLOT(incrementOcularIndex()));
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()), connect(nextLensButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(incrementLensIndex())); ocularsPlugin, SLOT(incrementLensIndex()));
connect(prevLensButton, SIGNAL(triggered()), connect(prevLensButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(decrementLensIndex())); 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,
pOn, pOn,
pOff, pOff,
pHover, pHover,
defaultAction, NULL,
true); true);
rotateCcdMinus15Button->setToolTip(q_("Rotate the sensor frame 15 de grees counterclockwise")); rotateCcdMinus15Button->setToolTip(q_("Rotate the sensor frame 15 de grees counterclockwise"));
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, NULL,
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, NULL,
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, NULL,
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, NULL,
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, NULL,
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, NULL,
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"));
connect(rotateCcdMinus15Button, SIGNAL(triggered()), connect(rotateCcdMinus15Button, SIGNAL(triggered()),
sm, SLOT(map())); sm, SLOT(map()));
connect(rotateCcdMinus5Button, SIGNAL(triggered()), connect(rotateCcdMinus5Button, SIGNAL(triggered()),
sm, SLOT(map())); sm, SLOT(map()));
connect(rotateCcdMinus1Button, SIGNAL(triggered()), connect(rotateCcdMinus1Button, SIGNAL(triggered()),
sm, SLOT(map())); sm, SLOT(map()));
connect(rotateCcdPlus1Button, SIGNAL(triggered()), connect(rotateCcdPlus1Button, SIGNAL(triggered()),
sm, SLOT(map())); sm, SLOT(map()));
connect(rotateCcdPlus5Button, SIGNAL(triggered()), connect(rotateCcdPlus5Button, SIGNAL(triggered()),
sm, SLOT(map())); sm, SLOT(map()));
connect(rotateCcdPlus15Button, SIGNAL(triggered()), connect(rotateCcdPlus15Button, SIGNAL(triggered()),
sm, SLOT(map())); sm, SLOT(map()));
connect(resetCcdRotationButton, SIGNAL(triggered()), connect(resetCcdRotationButton, SIGNAL(triggered()),
ocularsPlugin, SLOT(ccdRotationReset())); ocularsPlugin, SLOT(ccdRotationReset()));
connect(rotateCcdMinus15Button, SIGNAL(triggered()), connect(rotateCcdMinus15Button, SIGNAL(triggered()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
connect(rotateCcdMinus5Button, SIGNAL(triggered()), connect(rotateCcdMinus5Button, SIGNAL(triggered()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
connect(rotateCcdMinus1Button, SIGNAL(triggered()), connect(rotateCcdMinus1Button, SIGNAL(triggered()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
connect(rotateCcdPlus1Button, SIGNAL(triggered()), connect(rotateCcdPlus1Button, SIGNAL(triggered()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
connect(rotateCcdPlus5Button, SIGNAL(triggered()), connect(rotateCcdPlus5Button, SIGNAL(triggered()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
connect(rotateCcdPlus15Button, SIGNAL(triggered()), connect(rotateCcdPlus15Button, SIGNAL(triggered()),
this, SLOT(updateCcdControls())); this, SLOT(updateCcdControls()));
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); lensControls->setMaximumWidth(width);
resize(width + left + right, 10); resize(width + left + right, 10);
skipping to change at line 404 skipping to change at line 389
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));
borderPen.setWidthF(1.); borderPen.setWidthF(1.);
borderPath->setPen(borderPen); borderPath->setPen(borderPen);
borderPath->setParentItem(parentWidget); borderPath->setParentItem(parentWidget);
updatePosition(); updatePosition();
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()), connect(ocularsPlugin, SIGNAL(selectedLensChanged()),
this, SLOT(updateTelescopeControls())); 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 478 skipping to change at line 463
qreal xPos = parentWidget->size().width() - size().width(); qreal xPos = parentWidget->size().width() - size().width();
qreal yPos = 0; qreal yPos = 0;
setPos(xPos, yPos); setPos(xPos, yPos);
//Update border/shading //Update border/shading
QPainterPath newBorderPath; QPainterPath newBorderPath;
double cornerRadius = 12.0; double cornerRadius = 12.0;
QPointF verticalBorderStart = geometry().topLeft(); QPointF verticalBorderStart = geometry().topLeft();
QPointF horizontalBorderEnd = geometry().bottomRight(); QPointF horizontalBorderEnd = geometry().bottomRight();
QPointF cornerArcStart(verticalBorderStart.x(), QPointF cornerArcStart(verticalBorderStart.x(),
horizontalBorderEnd.y() - cornerRadius); horizontalBorderEnd.y() - cornerRadius);
newBorderPath.moveTo(verticalBorderStart); newBorderPath.moveTo(verticalBorderStart);
newBorderPath.lineTo(cornerArcStart); newBorderPath.lineTo(cornerArcStart);
newBorderPath.arcTo(cornerArcStart.x(), cornerArcStart.y(), cornerRa dius, cornerRadius, 180, 90); newBorderPath.arcTo(cornerArcStart.x(), cornerArcStart.y(), cornerRa dius, cornerRadius, 180, 90);
newBorderPath.lineTo(horizontalBorderEnd); newBorderPath.lineTo(horizontalBorderEnd);
newBorderPath.lineTo(horizontalBorderEnd.x(), verticalBorderStart.y( )); newBorderPath.lineTo(horizontalBorderEnd.x(), verticalBorderStart.y( ));
borderPath->setPath(newBorderPath); borderPath->setPath(newBorderPath);
} }
void OcularsGuiPanel::updateOcularControls() void OcularsGuiPanel::updateOcularControls()
{ {
skipping to change at line 550 skipping to change at line 535
fieldOcularFl->setPlainText(focalLengthString); fieldOcularFl->setPlainText(focalLengthString);
fieldOcularFl->setToolTip(q_("Effective focal length of the ocular")); fieldOcularFl->setToolTip(q_("Effective focal length of the ocular"));
fieldOcularFl->setPos(posX, posY); fieldOcularFl->setPos(posX, posY);
posY += fieldOcularFl->boundingRect().height(); posY += fieldOcularFl->boundingRect().height();
widgetHeight += fieldOcularFl->boundingRect().height(); widgetHeight += fieldOcularFl->boundingRect().height();
double apparentFov = ocular->appearentFOV(); double apparentFov = ocular->appearentFOV();
QString apparentFovString = QString::number(apparentFov); QString apparentFovString = QString::number(apparentFov);
apparentFovString.append(QChar(0x00B0));// Degree sign apparentFovString.append(QChar(0x00B0));// Degree sign
QString apparentFovLabel = QString(q_("Ocular aFOV: %1")) QString apparentFovLabel = QString(q_("Ocular aFOV: %1"))
.arg(apparentFovString); .arg(apparentFovString);
fieldOcularAfov->setPlainText(apparentFovLabel); fieldOcularAfov->setPlainText(apparentFovLabel);
fieldOcularAfov->setToolTip(q_("Apparent field of view of th e ocular")); fieldOcularAfov->setToolTip(q_("Apparent field of view of th e ocular"));
fieldOcularAfov->setPos(posX, posY); fieldOcularAfov->setPos(posX, posY);
widgetHeight += fieldOcularAfov->boundingRect().height(); widgetHeight += fieldOcularAfov->boundingRect().height();
fieldOcularFl->setVisible(true); fieldOcularFl->setVisible(true);
fieldOcularAfov->setVisible(true); fieldOcularAfov->setVisible(true);
} }
ocularControls->setMinimumSize(widgetWidth, widgetHeight); ocularControls->setMinimumSize(widgetWidth, widgetHeight);
skipping to change at line 781 skipping to change at line 766
int index = ocularsPlugin->selectedCCDIndex; int index = ocularsPlugin->selectedCCDIndex;
CCD* ccd = ocularsPlugin->ccds[index]; CCD* ccd = ocularsPlugin->ccds[index];
Q_ASSERT(ccd); Q_ASSERT(ccd);
double fovX = ((int)(ccd->getActualFOVx(telescope, lens) * 1 000.0)) / 1000.0; double fovX = ((int)(ccd->getActualFOVx(telescope, lens) * 1 000.0)) / 1000.0;
double fovY = ((int)(ccd->getActualFOVy(telescope, lens) * 1 000.0)) / 1000.0; double fovY = ((int)(ccd->getActualFOVy(telescope, lens) * 1 000.0)) / 1000.0;
QString dimensionsLabel = QString(q_("Dimensions: %1")).arg( ocularsPlugin->getDimensionsString(fovX, fovY)); QString dimensionsLabel = QString(q_("Dimensions: %1")).arg( ocularsPlugin->getDimensionsString(fovX, fovY));
fieldCcdDimensions->setPlainText(dimensionsLabel); fieldCcdDimensions->setPlainText(dimensionsLabel);
fieldMagnification->setVisible(false); fieldMagnification->setVisible(false);
fieldExitPupil->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);
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"));
fieldExitPupil->setToolTip(q_("Exit pupil provided b y 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 vided by this ocular/lens/telescope combination")); fieldMagnification->setToolTip(q_("Magnification pro vided by this ocular/lens/telescope combination"));
fieldFov->setToolTip(q_("Actual field of view provid ed by this ocular/lens/telescope combination")); fieldFov->setToolTip(q_("Actual field of view provid ed by this ocular/lens/telescope combination"));
fieldExitPupil->setToolTip(q_("Exit pupil provided b y this ocular/lens/telescope combination"));
} }
//WTF? Rounding? //WTF? Rounding?
double magnification = ((int)(ocular->magnification(telescop e, lens) * 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 mag = ocular->magnification(telescope, lens);
if (mag>0)
{
double exitPupil = telescope->diameter()/mag;
QString exitPupilLabel = QString(q_("Exit pupil: %1
mm")).arg(QString::number(exitPupil, 'f', 2));
fieldExitPupil->setPlainText(exitPupilLabel);
fieldExitPupil->setPos(posX, posY);
posY += fieldExitPupil->boundingRect().height();
widgetHeight += fieldExitPupil->boundingRect().heigh
t();
}
double fov = ((int)(ocular->actualFOV(telescope, lens) * 100 00.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);
if (mag>0)
fieldExitPupil->setVisible(true);
else
fieldExitPupil->setVisible(false);
} }
else else
{ {
prevTelescopeButton->setVisible(true); prevTelescopeButton->setVisible(true);
nextTelescopeButton->setVisible(true); nextTelescopeButton->setVisible(true);
fieldTelescopeName->setVisible(true); fieldTelescopeName->setVisible(true);
fieldMagnification->setVisible(false); fieldMagnification->setVisible(false);
fieldFov->setVisible(false); fieldFov->setVisible(false);
fieldExitPupil->setVisible(false);
} }
telescopeControls->setMinimumSize(widgetWidth, widgetHeight); telescopeControls->setMinimumSize(widgetWidth, widgetHeight);
telescopeControls->resize(widgetWidth, widgetHeight); telescopeControls->resize(widgetWidth, widgetHeight);
setTelescopeControlsVisible(true); setTelescopeControlsVisible(true);
updateLensControls(); updateLensControls();
updatePosition(); updatePosition();
} }
skipping to change at line 964 skipping to change at line 967
qreal spacing = 0.; qreal spacing = 0.;
if (prevTelescopeButton) if (prevTelescopeButton)
{ {
width += 2 * prevTelescopeButton->getButtonPixmapWidth(); width += 2 * prevTelescopeButton->getButtonPixmapWidth();
posX = prevTelescopeButton->getButtonPixmapWidth(); posX = prevTelescopeButton->getButtonPixmapWidth();
} }
if (buttonOcular->parentItem()) if (buttonOcular->parentItem())
{ {
qreal parentWidth = buttonOcular->parentItem()->boundingRect ().width(); qreal parentWidth = buttonOcular->parentItem()->boundingRect ().width();
int nGaps = n - 1;//n buttons have n-1 gaps int nGaps = n - 1;//n buttons have n-1 gaps
spacing = qRound((parentWidth-width)/nGaps); spacing = qRound((parentWidth-width)/nGaps);
} }
buttonOcular->setPos(posX, posY); buttonOcular->setPos(posX, posY);
posX += buttonOcular->getButtonPixmapWidth() + spacing; posX += buttonOcular->getButtonPixmapWidth() + spacing;
if (buttonCrosshairs->isVisible()) if (buttonCrosshairs->isVisible())
{ {
buttonCrosshairs->setPos(posX, posY); buttonCrosshairs->setPos(posX, posY);
posX += buttonCrosshairs->getButtonPixmapWidth() + spacing; posX += buttonCrosshairs->getButtonPixmapWidth() + spacing;
} }
buttonCcd->setPos(posX, posY); buttonCcd->setPos(posX, posY);
posX += buttonCcd->getButtonPixmapWidth() + spacing; posX += buttonCcd->getButtonPixmapWidth() + spacing;
skipping to change at line 990 skipping to change at line 993
void OcularsGuiPanel::setControlsColor(const QColor& color) void OcularsGuiPanel::setControlsColor(const QColor& color)
{ {
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(fieldExitPupil);
Q_ASSERT(fieldFov); Q_ASSERT(fieldFov);
Q_ASSERT(fieldLensName); Q_ASSERT(fieldLensName);
Q_ASSERT(fieldLensMultipler); 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);
fieldExitPupil->setDefaultTextColor(color);
fieldLensName->setDefaultTextColor(color); fieldLensName->setDefaultTextColor(color);
fieldLensMultipler->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(fieldExitPupil);
Q_ASSERT(fieldFov); Q_ASSERT(fieldFov);
Q_ASSERT(fieldLensName); Q_ASSERT(fieldLensName);
Q_ASSERT(fieldLensMultipler); 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);
fieldExitPupil->setFont(font);
fieldLensName->setFont(font); fieldLensName->setFont(font);
fieldLensMultipler->setFont(font); fieldLensMultipler->setFont(font);
} }
void OcularsGuiPanel::setColorScheme(const QString &schemeName) void OcularsGuiPanel::setColorScheme(const QString &schemeName)
{ {
Q_UNUSED(schemeName); Q_UNUSED(schemeName);
borderPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5)); borderPath->setPen(QColor::fromRgbF(0.7,0.7,0.7,0.5));
borderPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2)); borderPath->setBrush(QColor::fromRgbF(0.15, 0.16, 0.19, 0.2));
setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9)); setControlsColor(QColor::fromRgbF(0.9, 0.91, 0.95, 0.9));
} }
QPixmap OcularsGuiPanel::createPixmapFromText(const QString& text, QPixmap OcularsGuiPanel::createPixmapFromText(const QString& text,
int width, int width,
int height, int height,
const QFont& font, const QFont& font,
const QColor& textColor, const QColor& textColor,
const QColor& backgroundColor const QColor& backgroundColor)
)
{ {
if (width <= 0 || height <=0) { if (width <= 0 || height <=0) {
return QPixmap(); return QPixmap();
} }
QPixmap pixmap(width, height); QPixmap pixmap(width, height);
pixmap.fill(backgroundColor); pixmap.fill(backgroundColor);
if (text.isEmpty()) { if (text.isEmpty()) {
return pixmap; return pixmap;
} }
QPainter painter(&pixmap); QPainter painter(&pixmap);
painter.setFont(font); painter.setFont(font);
painter.setPen(QPen(textColor)); painter.setPen(QPen(textColor));
painter.drawText(0, 0, width, height, painter.drawText(0, 0, width, height,
Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingl Qt::AlignHCenter | Qt::AlignVCenter | Qt::TextSingl
eLine, eLine,
text); text);
return pixmap; return pixmap;
} }
 End of changes. 68 change blocks. 
136 lines changed or deleted 143 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/