Oculars.cpp   Oculars.cpp 
skipping to change at line 121 skipping to change at line 121
ready = false; ready = false;
requireSelection = true; requireSelection = true;
useMaxEyepieceAngle = true; useMaxEyepieceAngle = true;
font.setPixelSize(14); font.setPixelSize(14);
maxEyepieceAngle = 0.0; maxEyepieceAngle = 0.0;
ccds = QList<CCD *>(); ccds = QList<CCD *>();
oculars = QList<Ocular *>(); oculars = QList<Ocular *>();
telescopes = QList<Telescope *>(); telescopes = QList<Telescope *>();
lense = QList<Lens *> ();
ccdRotationSignalMapper = new QSignalMapper(this); ccdRotationSignalMapper = new QSignalMapper(this);
ccdsSignalMapper = new QSignalMapper(this); ccdsSignalMapper = new QSignalMapper(this);
ocularsSignalMapper = new QSignalMapper(this); ocularsSignalMapper = new QSignalMapper(this);
telescopesSignalMapper = new QSignalMapper(this); telescopesSignalMapper = new QSignalMapper(this);
lenseSignalMapper = new QSignalMapper(this);
selectedCCDIndex = -1; selectedCCDIndex = -1;
selectedOcularIndex = -1; selectedOcularIndex = -1;
selectedTelescopeIndex = -1; selectedTelescopeIndex = -1;
selectedLensIndex = -1;
usageMessageLabelID = -1; usageMessageLabelID = -1;
setObjectName("Oculars"); setObjectName("Oculars");
#ifdef Q_OS_MAC #ifdef Q_OS_MAC
qt_set_sequence_auto_mnemonic(true); qt_set_sequence_auto_mnemonic(true);
#endif #endif
} }
skipping to change at line 159 skipping to change at line 163
delete pxmapOnIcon; delete pxmapOnIcon;
if (pxmapOffIcon) if (pxmapOffIcon)
delete pxmapOffIcon; delete pxmapOffIcon;
qDeleteAll(ccds); qDeleteAll(ccds);
ccds.clear(); ccds.clear();
qDeleteAll(telescopes); qDeleteAll(telescopes);
telescopes.clear(); telescopes.clear();
qDeleteAll(oculars); qDeleteAll(oculars);
oculars.clear(); oculars.clear();
qDeleteAll(lense);
lense.clear();
} }
QSettings* Oculars::appSettings() QSettings* Oculars::appSettings()
{ {
return settings; return settings;
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
skipping to change at line 187 skipping to change at line 193
return ready; return ready;
} }
void Oculars::deinit() void Oculars::deinit()
{ {
// update the ini file. // update the ini file.
settings->remove("ccd"); settings->remove("ccd");
settings->remove("ocular"); settings->remove("ocular");
settings->remove("telescope"); settings->remove("telescope");
settings->remove("lens");
int index = 0; int index = 0;
foreach(CCD* ccd, ccds) { foreach(CCD* ccd, ccds) {
QString prefix = "ccd/" + QVariant(index).toString() + "/"; QString prefix = "ccd/" + QVariant(index).toString() + "/";
settings->setValue(prefix + "name", ccd->name()); settings->setValue(prefix + "name", ccd->name());
settings->setValue(prefix + "resolutionX", ccd->resolutionX( )); settings->setValue(prefix + "resolutionX", ccd->resolutionX( ));
settings->setValue(prefix + "resolutionY", ccd->resolutionY( )); settings->setValue(prefix + "resolutionY", ccd->resolutionY( ));
settings->setValue(prefix + "chip_width", ccd->chipWidth()); settings->setValue(prefix + "chip_width", ccd->chipWidth());
settings->setValue(prefix + "chip_height", ccd->chipHeight() ); settings->setValue(prefix + "chip_height", ccd->chipHeight() );
settings->setValue(prefix + "pixel_width", ccd->pixelWidth() ); settings->setValue(prefix + "pixel_width", ccd->pixelWidth() );
settings->setValue(prefix + "pixel_height", ccd->pixelWidth( )); settings->setValue(prefix + "pixel_height", ccd->pixelWidth( ));
skipping to change at line 219 skipping to change at line 226
index = 0; index = 0;
foreach(Telescope* telescope, telescopes){ foreach(Telescope* telescope, telescopes){
QString prefix = "telescope/" + QVariant(index).toString() + "/"; QString prefix = "telescope/" + QVariant(index).toString() + "/";
settings->setValue(prefix + "name", telescope->name()); settings->setValue(prefix + "name", telescope->name());
settings->setValue(prefix + "focalLength", telescope->focalL ength()); settings->setValue(prefix + "focalLength", telescope->focalL ength());
settings->setValue(prefix + "diameter", telescope->diameter( )); settings->setValue(prefix + "diameter", telescope->diameter( ));
settings->setValue(prefix + "hFlip", telescope->isHFlipped() ); settings->setValue(prefix + "hFlip", telescope->isHFlipped() );
settings->setValue(prefix + "vFlip", telescope->isVFlipped() ); settings->setValue(prefix + "vFlip", telescope->isVFlipped() );
index++; index++;
} }
index = 0;
foreach(Lens* lens, lense) {
QString prefix = "lens/" + QVariant(index).toString() + "/";
settings->setValue(prefix + "name", lens->name());
settings->setValue(prefix + "multipler", lens->multipler());
index++;
}
settings->setValue("ocular_count", oculars.count()); settings->setValue("ocular_count", oculars.count());
settings->setValue("telescope_count", telescopes.count()); settings->setValue("telescope_count", telescopes.count());
settings->setValue("ccd_count", ccds.count()); settings->setValue("ccd_count", ccds.count());
settings->setValue("lens_count", lense.count());
settings->sync(); settings->sync();
} }
//! Draw any parts on the screen which are for our module //! Draw any parts on the screen which are for our module
void Oculars::draw(StelCore* core, StelRenderer* renderer) void Oculars::draw(StelCore* core, StelRenderer* renderer)
{ {
if (flagShowTelrad) { if (flagShowTelrad) {
paintTelrad(renderer); paintTelrad(renderer);
} else if (flagShowOculars){ } else if (flagShowOculars){
// Ensure there is a selected ocular & telescope // Ensure there is a selected ocular & telescope
skipping to change at line 496 skipping to change at line 512
if (actualTelescopeCount < telescopeCount) { if (actualTelescopeCount < telescopeCount) {
qWarning() << "The Oculars ini file appears to be corrupt; delete it."; qWarning() << "The Oculars ini file appears to be corrupt; delete it.";
} else { } else {
qWarning() << "There are no telescopes defin ed for the Oculars plugin; plugin will be disabled."; qWarning() << "There are no telescopes defin ed for the Oculars plugin; plugin will be disabled.";
} }
ready = false; ready = false;
} else { } else {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
ocularDialog = new OcularDialog(this, &ccds, &oculars, &tele int lensCount = settings->value("lens_count", 0).toInt();
scopes); int actualLensCount = lensCount;
for (int index = 0; index<lensCount; index++) {
Lens *newLens = Lens::lensFromSettings(settings, ind
ex);
if (newLens != NULL) {
lense.append(newLens);
}
else {
actualLensCount--;
}
}
if (lensCount > 0 && actualLensCount < lensCount)
{
qWarning() << "The Oculars ini file appears to be co
rrupt; delete it.";
}
ocularDialog = new OcularDialog(this, &ccds, &oculars, &tele
scopes, &lense);
initializeActivationActions(); initializeActivationActions();
determineMaxEyepieceAngle(); determineMaxEyepieceAngle();
guiPanelEnabled = settings->value("enable_control_panel", fa lse).toBool(); guiPanelEnabled = settings->value("enable_control_panel", fa lse).toBool();
enableGuiPanel(guiPanelEnabled); enableGuiPanel(guiPanelEnabled);
setFlagDecimalDegrees(settings->value("use_decimal_degrees", false).toBool()); setFlagDecimalDegrees(settings->value("use_decimal_degrees", false).toBool());
} catch (std::runtime_error& e) { } catch (std::runtime_error& e) {
qWarning() << "WARNING: unable to locate ocular.ini file or create a default one for Ocular plugin: " << e.what(); qWarning() << "WARNING: unable to locate ocular.ini file or create a default one for Ocular plugin: " << e.what();
ready = false; ready = false;
skipping to change at line 823 skipping to change at line 855
void Oculars::decrementTelescopeIndex() void Oculars::decrementTelescopeIndex()
{ {
selectedTelescopeIndex--; selectedTelescopeIndex--;
if (selectedTelescopeIndex == -1) { if (selectedTelescopeIndex == -1) {
selectedTelescopeIndex = telescopes.count() - 1; selectedTelescopeIndex = telescopes.count() - 1;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::decrementLensIndex()
{
selectedLensIndex++;
if (selectedLensIndex == lense.count()) {
selectedLensIndex = -1;
}
emit(selectedLensChanged());
}
void Oculars::displayPopupMenu() void Oculars::displayPopupMenu()
{ {
QMenu* popup = new QMenu(&StelMainWindow::getInstance()); QMenu* popup = new QMenu(&StelMainWindow::getInstance());
if (flagShowOculars) if (flagShowOculars)
{ {
// We are in Oculars mode // We are in Oculars mode
// We want to show all of the Oculars, and if the current oc ular is not a binocular, // We want to show all of the Oculars, and if the current oc ular is not a binocular,
// we will also show the telescopes. // we will also show the telescopes.
if (!oculars.isEmpty()) if (!oculars.isEmpty())
skipping to change at line 878 skipping to change at line 919
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
// If there is more than one telescope, show the prev/next/l ist complex. // If there is more than one telescope, show the prev/next/l ist complex.
// If the selected ocular is a binoculars, show nothing. // If the selected ocular is a binoculars, show nothing.
if (telescopes.count() > 1 && (selectedOcularIndex > -1 && ! oculars[selectedOcularIndex]->isBinoculars())) if (telescopes.count() > 1 && (selectedOcularIndex > -1 && ! oculars[selectedOcularIndex]->isBinoculars()))
{ {
QMenu* submenu = addTelescopeSubmenu(popup); QMenu* submenu = addTelescopeSubmenu(popup);
popup->addMenu(submenu); popup->addMenu(submenu);
submenu = addLensSubmenu(popup);
popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
QAction* action = popup->addAction(q_("Toggle &crosshair")); QAction* action = popup->addAction(q_("Toggle &crosshair"));
action->setCheckable(true); action->setCheckable(true);
action->setChecked(flagShowCrosshairs); action->setChecked(flagShowCrosshairs);
connect(action, SIGNAL(toggled(bool)), connect(action, SIGNAL(toggled(bool)),
actionShowCrosshairs, SLOT(s etChecked(bool))); actionShowCrosshairs, SLOT(s etChecked(bool)));
} else { } else {
// We are not in ocular mode // We are not in ocular mode
skipping to change at line 1030 skipping to change at line 1073
void Oculars::incrementTelescopeIndex() void Oculars::incrementTelescopeIndex()
{ {
selectedTelescopeIndex++; selectedTelescopeIndex++;
if (selectedTelescopeIndex == telescopes.count()) { if (selectedTelescopeIndex == telescopes.count()) {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::incrementLensIndex()
{
selectedLensIndex++;
if (selectedLensIndex == lense.count()) {
selectedLensIndex = -1;
}
emit(selectedLensChanged());
}
void Oculars::disableLens()
{
selectedLensIndex = -1;
emit(selectedLensChanged());
}
void Oculars::rotateCCD(QString amount) void Oculars::rotateCCD(QString amount)
{ {
ccdRotationAngle += amount.toInt(); ccdRotationAngle += amount.toInt();
if (ccdRotationAngle >= 360) if (ccdRotationAngle >= 360)
ccdRotationAngle -= 360; ccdRotationAngle -= 360;
if (ccdRotationAngle <= -360) if (ccdRotationAngle <= -360)
ccdRotationAngle += 360; ccdRotationAngle += 360;
} }
void Oculars::selectCCDAtIndex(QString indexString) void Oculars::selectCCDAtIndex(QString indexString)
skipping to change at line 1078 skipping to change at line 1136
void Oculars::selectTelescopeAtIndex(QString indexString) void Oculars::selectTelescopeAtIndex(QString indexString)
{ {
int index = indexString.toInt(); int index = indexString.toInt();
if (index > -2 && index < telescopes.count()) { if (index > -2 && index < telescopes.count()) {
selectedTelescopeIndex = index; selectedTelescopeIndex = index;
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
} }
void Oculars::selectLensAtIndex(QString indexString)
{
int index = indexString.toInt();
if (index > -2 && index < lense.count()) {
selectedLensIndex = index;
emit(selectedLensChanged());
}
}
void Oculars::toggleCCD(bool show) void Oculars::toggleCCD(bool show)
{ {
//If there are no sensors... //If there are no sensors...
if (ccds.isEmpty() || telescopes.isEmpty()) if (ccds.isEmpty() || telescopes.isEmpty())
{ {
//TODO: BM: Make this an on-screen message and/or disable th e button //TODO: BM: Make this an on-screen message and/or disable th e button
//if there are no sensors. //if there are no sensors.
if (show) if (show)
qWarning() << "Oculars plugin: Unable to display a s ensor boundary:" qWarning() << "Oculars plugin: Unable to display a s ensor boundary:"
<< "No sens ors or telescopes are defined."; << "No sens ors or telescopes are defined.";
skipping to change at line 1240 skipping to change at line 1307
connect(actionConfiguration, SIGNAL(toggled(bool)), connect(actionConfiguration, SIGNAL(toggled(bool)),
ocularDialog, SLOT(setVisible(bool)) ); ocularDialog, SLOT(setVisible(bool)) );
connect(ocularDialog, SIGNAL(visibleChanged(bool)), connect(ocularDialog, SIGNAL(visibleChanged(bool)),
actionConfiguration, SLOT(setChecked (bool))); actionConfiguration, SLOT(setChecked (bool)));
connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(instrumentCha nged())); connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(instrumentCha nged()));
connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(setScreenFOVF orCCD())); connect(this, SIGNAL(selectedCCDChanged()), this, SLOT(setScreenFOVF orCCD()));
connect(this, SIGNAL(selectedOcularChanged()), this, SLOT(instrument Changed())); connect(this, SIGNAL(selectedOcularChanged()), this, SLOT(instrument Changed()));
connect(this, SIGNAL(selectedTelescopeChanged()), this, SLOT(instrum entChanged())); connect(this, SIGNAL(selectedTelescopeChanged()), this, SLOT(instrum entChanged()));
connect(this, SIGNAL(selectedTelescopeChanged()), this, SLOT(setScre enFOVForCCD())); connect(this, SIGNAL(selectedTelescopeChanged()), this, SLOT(setScre enFOVForCCD()));
connect(this, SIGNAL(selectedLensChanged()), this, SLOT(instrumentCh anged()));
connect(ocularDialog, SIGNAL(requireSelectionChanged(bool)), this, S LOT(setRequireSelection(bool))); connect(ocularDialog, SIGNAL(requireSelectionChanged(bool)), this, S LOT(setRequireSelection(bool)));
connect(ocularDialog, SIGNAL(scaleImageCircleChanged(bool)), this, S LOT(setScaleImageCircle(bool))); connect(ocularDialog, SIGNAL(scaleImageCircleChanged(bool)), this, S LOT(setScaleImageCircle(bool)));
connect(ccdRotationSignalMapper, SIGNAL(mapped(QString)), this, SLOT (rotateCCD(QString))); connect(ccdRotationSignalMapper, SIGNAL(mapped(QString)), this, SLOT (rotateCCD(QString)));
connect(ccdsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(select CCDAtIndex(QString))); connect(ccdsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(select CCDAtIndex(QString)));
connect(ccdsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(setScr eenFOVForCCD())); connect(ccdsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(setScr eenFOVForCCD()));
connect(ocularsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(sel ectOcularAtIndex(QString))); connect(ocularsSignalMapper, SIGNAL(mapped(QString)), this, SLOT(sel ectOcularAtIndex(QString)));
connect(telescopesSignalMapper, SIGNAL(mapped(QString)), this, SLOT( selectTelescopeAtIndex(QString))); connect(telescopesSignalMapper, SIGNAL(mapped(QString)), this, SLOT( selectTelescopeAtIndex(QString)));
connect(telescopesSignalMapper, SIGNAL(mapped(QString)), this, SLOT( setScreenFOVForCCD())); connect(telescopesSignalMapper, SIGNAL(mapped(QString)), this, SLOT( setScreenFOVForCCD()));
connect(lenseSignalMapper, SIGNAL(mapped(QString)), this, SLOT(selec tLensAtIndex(QString)));
} }
bool Oculars::isBinocularDefined() bool Oculars::isBinocularDefined()
{ {
bool binocularFound = false; bool binocularFound = false;
foreach (Ocular* ocular, oculars) { foreach (Ocular* ocular, oculars) {
if (ocular->isBinoculars()) { if (ocular->isBinoculars()) {
binocularFound = true; binocularFound = true;
break; break;
} }
skipping to change at line 1422 skipping to change at line 1491
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ; const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ;
// Get the current instruments // Get the current instruments
CCD *ccd = NULL; CCD *ccd = NULL;
if(selectedCCDIndex != -1) { if(selectedCCDIndex != -1) {
ccd = ccds[selectedCCDIndex]; ccd = ccds[selectedCCDIndex];
} }
Ocular *ocular = oculars[selectedOcularIndex]; Ocular *ocular = oculars[selectedOcularIndex];
Telescope *telescope = telescopes[selectedTelescopeIndex]; Telescope *telescope = telescopes[selectedTelescopeIndex];
Lens *lens = selectedLensIndex >=0 ? lense[selectedLensIndex] : NUL L;
// set up drawing // set up drawing
if (StelApp::getInstance().getVisionModeNight()) if (StelApp::getInstance().getVisionModeNight())
renderer->setGlobalColor(0.8f, 0.0f, 0.0f); renderer->setGlobalColor(0.8f, 0.0f, 0.0f);
else else
renderer->setGlobalColor(0.8f, 0.48f, 0.0f); renderer->setGlobalColor(0.8f, 0.48f, 0.0f);
renderer->setBlendMode(BlendMode_Alpha); renderer->setBlendMode(BlendMode_Alpha);
// Get the X & Y positions, and the line height // Get the X & Y positions, and the line height
renderer->setFont(font); renderer->setFont(font);
skipping to change at line 1478 skipping to change at line 1548
yPosition-=lineHeight; yPosition-=lineHeight;
QString ocularFov = QString::number(ocular->appearen tFOV()); QString ocularFov = QString::number(ocular->appearen tFOV());
ocularFov.append(QChar(0x00B0));//Degree sign ocularFov.append(QChar(0x00B0));//Degree sign
// TRANSLATORS: aFOV = apparent field of view // TRANSLATORS: aFOV = apparent field of view
QString ocularFOVLabel = QString(q_("Ocular aFOV: %1 ")) QString ocularFOVLabel = QString(q_("Ocular aFOV: %1 "))
.arg(ocularFov); .arg(ocularFov);
renderer->drawText(TextParams(xPosition, yPosition, ocularFOVLabel)); renderer->drawText(TextParams(xPosition, yPosition, ocularFOVLabel));
yPosition-=lineHeight; yPosition-=lineHeight;
QString lensNumberLabel;
// Barlow and Shapley lens
if (lens != NULL) // it's null if lens is not select
ed (lens index = -1)
{
QString lensName = lens->name();
if (lensName.isEmpty())
{
lensNumberLabel = QString(q_("Lens #
%1")).arg(selectedLensIndex);
}
else
{
lensNumberLabel = QString (q_("Lens
#%1: %2")).arg(selectedLensIndex).arg(lensName);
}
}
else
{
lensNumberLabel = QString (q_("Lens: none"))
; //FIXME
}
renderer->drawText(TextParams(xPosition, yPosition,
lensNumberLabel));
yPosition-=lineHeight;
// The telescope // The telescope
QString telescopeNumberLabel; QString telescopeNumberLabel;
QString telescopeName = telescope->name(); QString telescopeName = telescope->name();
if (telescopeName.isEmpty()) if (telescopeName.isEmpty())
{ {
telescopeNumberLabel = QString(q_("Telescope #%1")) telescopeNumberLabel = QString(q_("Telescope #%1"))
.arg(selectedTelescopeIndex) ; .arg(selectedTelescopeIndex) ;
} }
else else
{ {
telescopeNumberLabel = QString(q_("Telescope #%1: %2")) telescopeNumberLabel = QString(q_("Telescope #%1: %2"))
.arg(selectedTelescopeIndex) .arg(selectedTelescopeIndex)
.arg(telescopeName); .arg(telescopeName);
} }
renderer->drawText(TextParams(xPosition, yPosition, telescopeNumberLabel)); renderer->drawText(TextParams(xPosition, yPosition, telescopeNumberLabel));
yPosition-=lineHeight; yPosition-=lineHeight;
// General info // General info
double magnification = ((int)(ocular->magnification( telescope) * 10.0)) / 10.0; double magnification = ((int)(ocular->magnification( telescope, lens) * 10.0)) / 10.0;
QString magString = QString::number(magnification); QString magString = QString::number(magnification);
magString.append(QChar(0x00D7));//Multiplication sig n magString.append(QChar(0x00D7));//Multiplication sig n
QString magnificationLabel = QString(q_("Magnificati on: %1")) QString magnificationLabel = QString(q_("Magnificati on: %1"))
.arg(magString); .arg(magString);
renderer->drawText(TextParams(xPosition, yPosition, magnificationLabel)); renderer->drawText(TextParams(xPosition, yPosition, magnificationLabel));
yPosition-=lineHeight; yPosition-=lineHeight;
double fov = ((int)(ocular->actualFOV(telescope) * 1 0000.00)) / 10000.0; double fov = ((int)(ocular->actualFOV(telescope, len s) * 10000.00)) / 10000.0;
QString fovString = QString::number(fov); QString fovString = QString::number(fov);
fovString.append(QChar(0x00B0));//Degree sign fovString.append(QChar(0x00B0));//Degree sign
QString fovLabel = QString(q_("FOV: %1")).arg(fovStr ing); QString fovLabel = QString(q_("FOV: %1")).arg(fovStr ing);
renderer->drawText(TextParams(xPosition, yPosition, fovLabel)); renderer->drawText(TextParams(xPosition, yPosition, fovLabel));
} }
} }
// The CCD // The CCD
if (flagShowCCD) { if (flagShowCCD) {
QString ccdSensorLabel, ccdInfoLabel; QString ccdSensorLabel, ccdInfoLabel;
skipping to change at line 1699 skipping to change at line 1790
// We won't always have a selected object // We won't always have a selected object
if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) { if (StelApp::getInstance().getStelObjectMgr().getWasSelected()) {
StelObjectP selectedObject = StelApp::getInstance().getStelO bjectMgr().getSelectedObject()[0]; StelObjectP selectedObject = StelApp::getInstance().getStelO bjectMgr().getSelectedObject()[0];
movementManager->moveToJ2000(selectedObject->getEquinoxEquat orialPos(core), 0.0, 1); movementManager->moveToJ2000(selectedObject->getEquinoxEquat orialPos(core), 0.0, 1);
} }
// Set the screen display // Set the screen display
// core->setMaskType(StelProjector::MaskDisk); // core->setMaskType(StelProjector::MaskDisk);
Ocular *ocular = oculars[selectedOcularIndex]; Ocular *ocular = oculars[selectedOcularIndex];
Telescope *telescope = NULL; Telescope *telescope = NULL;
Lens *lens = NULL;
// Only consider flip is we're not binoculars // Only consider flip is we're not binoculars
if (ocular->isBinoculars()) if (ocular->isBinoculars())
{ {
core->setFlipHorz(false); core->setFlipHorz(false);
core->setFlipVert(false); core->setFlipVert(false);
} }
else else
{ {
if (selectedLensIndex >= 0)
lens = lense[selectedLensIndex];
telescope = telescopes[selectedTelescopeIndex]; telescope = telescopes[selectedTelescopeIndex];
core->setFlipHorz(telescope->isHFlipped()); core->setFlipHorz(telescope->isHFlipped());
core->setFlipVert(telescope->isVFlipped()); core->setFlipVert(telescope->isVFlipped());
} }
double actualFOV = ocular->actualFOV(telescope); double actualFOV = ocular->actualFOV(telescope, lens);
// See if the mask was scaled; if so, correct the actualFOV. // See if the mask was scaled; if so, correct the actualFOV.
if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0 && !ocular-> isBinoculars()) { if (useMaxEyepieceAngle && ocular->appearentFOV() > 0.0 && !ocular-> isBinoculars()) {
actualFOV = maxEyepieceAngle * actualFOV / ocular->appearent FOV(); actualFOV = maxEyepieceAngle * actualFOV / ocular->appearent FOV();
} }
movementManager->zoomTo(actualFOV, 0.0); movementManager->zoomTo(actualFOV, 0.0);
} }
void Oculars::hideUsageMessageIfDisplayed() void Oculars::hideUsageMessageIfDisplayed()
{ {
if (usageMessageLabelID > -1) if (usageMessageLabelID > -1)
{ {
LabelMgr *labelManager = GETSTELMODULE(LabelMgr); LabelMgr *labelManager = GETSTELMODULE(LabelMgr);
labelManager->setLabelShow(usageMessageLabelID, false); labelManager->setLabelShow(usageMessageLabelID, false);
labelManager->deleteLabel(usageMessageLabelID); labelManager->deleteLabel(usageMessageLabelID);
usageMessageLabelID = -1; usageMessageLabelID = -1;
} }
} }
Lens* Oculars::selectedLens()
{
if (selectedLensIndex >= 0 && selectedLensIndex < lense.count())
return lense[selectedLensIndex];
return NULL;
}
QMenu* Oculars::addLensSubmenu(QMenu* parent)
{
Q_ASSERT(parent);
QMenu *submenu = new QMenu(q_("&Lens"), parent);
submenu->addAction(q_("&Previous lens"), this, SLOT(decrementLensInd
ex()));
submenu->addAction(q_("&Next lens"), this, SLOT(incrementLensIndex()
));
submenu->addSeparator();
submenu->addAction(q_("None"), this, SLOT(disableLens()));
for (int index = 0; index < lense.count(); ++index)
{
QString label;
if (index < 10)
{
label = QString("&%1: %2").arg(index).arg(lense[inde
x]->name());
}
else
{
label = lense[index]->name();
}
QAction* action = submenu->addAction(label, lenseSignalMappe
r, SLOT(map()));
if (index == selectedLensIndex)
{
action->setCheckable(true);
action->setChecked(true);
}
lenseSignalMapper->setMapping(action, QString("%1").arg(inde
x));
}
return submenu;
}
QMenu* Oculars::addTelescopeSubmenu(QMenu *parent) QMenu* Oculars::addTelescopeSubmenu(QMenu *parent)
{ {
Q_ASSERT(parent); Q_ASSERT(parent);
QMenu* submenu = new QMenu(q_("&Telescope"), parent); QMenu* submenu = new QMenu(q_("&Telescope"), parent);
submenu->addAction(q_("&Previous telescope"), this, SLOT(decrementTe lescopeIndex())); submenu->addAction(q_("&Previous telescope"), this, SLOT(decrementTe lescopeIndex()));
submenu->addAction(q_("&Next telescope"), this, SLOT(incrementTelesc opeIndex())); submenu->addAction(q_("&Next telescope"), this, SLOT(incrementTelesc opeIndex()));
submenu->addSeparator(); submenu->addSeparator();
for (int index = 0; index < telescopes.count(); ++index) for (int index = 0; index < telescopes.count(); ++index)
{ {
 End of changes. 22 change blocks. 
5 lines changed or deleted 150 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/