Oculars.cpp   Oculars.cpp 
skipping to change at line 106 skipping to change at line 106
Oculars::Oculars(): Oculars::Oculars():
selectedCCDIndex(-1), selectedCCDIndex(-1),
selectedOcularIndex(-1), selectedOcularIndex(-1),
selectedTelescopeIndex(-1), selectedTelescopeIndex(-1),
selectedLensIndex(-1), selectedLensIndex(-1),
flagShowCCD(false), flagShowCCD(false),
flagShowOculars(false), flagShowOculars(false),
flagShowCrosshairs(false), flagShowCrosshairs(false),
flagShowTelrad(false), flagShowTelrad(false),
usageMessageLabelID(-1), usageMessageLabelID(-1),
flagAzimuthalGrid(false),
flagGalacticGrid(false),
flagSupergalacticGrid(false),
flagEquatorJ2000Grid(false),
flagEquatorGrid(false),
flagEquatorJ2000Line(false),
flagEquatorLine(false),
flagEclipticJ2000Line(false),
flagEclipticLine(false),
flagEclipticJ2000Grid(false),
flagEclipticGrid(false),
flagMeridianLine(false),
flagLongitudeLine(false),
flagHorizonLine(false),
flagGalacticEquatorLine(false),
flagSupergalacticEquatorLine(false),
flagPrimeVerticalLine(false),
flagColureLines(false),
flagCircumpolarCircles(false),
flagPrecessionCircles(false),
flagCardinalPoints(false), flagCardinalPoints(false),
flagCelestialJ2000Poles(false),
flagCelestialPoles(false),
flagZenithNadirPoints(false),
flagEclipticJ2000Poles(false),
flagEclipticPoles(false),
flagGalacticPoles(false),
flagSupergalacticPoles(false),
flagEquinoxJ2000Points(false),
flagEquinoxPoints(false),
flagSolsticeJ2000Points(false),
flagSolsticePoints(false),
flagAdaptation(false), flagAdaptation(false),
flagLimitStars(false), flagLimitStars(false),
magLimitStars(0.0), magLimitStars(0.0),
flagLimitDSOs(false), flagLimitDSOs(false),
magLimitDSOs(0.0), magLimitDSOs(0.0),
flagLimitPlanets(false), flagLimitPlanets(false),
magLimitPlanets(0.0), magLimitPlanets(0.0),
relativeStarScaleMain(1.0),
absoluteStarScaleMain(1.0),
relativeStarScaleOculars(1.0),
absoluteStarScaleOculars(1.0),
relativeStarScaleCCD(1.0),
absoluteStarScaleCCD(1.0),
flagMoonScale(false), flagMoonScale(false),
maxEyepieceAngle(0.0), maxEyepieceAngle(0.0),
requireSelection(true), requireSelection(true),
flagLimitMagnitude(false), flagLimitMagnitude(false),
useMaxEyepieceAngle(true), useMaxEyepieceAngle(true),
guiPanelEnabled(false), guiPanelEnabled(false),
flagDecimalDegrees(false), flagDecimalDegrees(false),
flagSemiTransporency(false), flagSemiTransparency(false),
flagHideGridsLines(false), flagHideGridsLines(false),
flagGridlinesDisplayedMain(true),
flipVert(false), flipVert(false),
flipHorz(false), flipHorz(false),
ccdRotationSignalMapper(0), ccdRotationSignalMapper(Q_NULLPTR),
ccdsSignalMapper(0), ccdsSignalMapper(Q_NULLPTR),
ocularsSignalMapper(0), ocularsSignalMapper(Q_NULLPTR),
telescopesSignalMapper(0), telescopesSignalMapper(Q_NULLPTR),
lenseSignalMapper(0), lensesSignalMapper(Q_NULLPTR),
pxmapGlow(NULL), pxmapGlow(Q_NULLPTR),
pxmapOnIcon(NULL), pxmapOnIcon(Q_NULLPTR),
pxmapOffIcon(NULL), pxmapOffIcon(Q_NULLPTR),
toolbarButton(NULL), toolbarButton(Q_NULLPTR),
ocularDialog(NULL), ocularDialog(Q_NULLPTR),
ready(false), ready(false),
actionShowOcular(0), actionShowOcular(Q_NULLPTR),
actionShowCrosshairs(0), actionShowCrosshairs(Q_NULLPTR),
actionShowSensor(0), actionShowSensor(Q_NULLPTR),
actionShowTelrad(0), actionShowTelrad(Q_NULLPTR),
actionConfiguration(0), actionConfiguration(Q_NULLPTR),
actionMenu(0), actionMenu(Q_NULLPTR),
actionTelescopeIncrement(0), actionTelescopeIncrement(Q_NULLPTR),
actionTelescopeDecrement(0), actionTelescopeDecrement(Q_NULLPTR),
actionOcularIncrement(0), actionOcularIncrement(Q_NULLPTR),
actionOcularDecrement(0), actionOcularDecrement(Q_NULLPTR),
guiPanel(0), guiPanel(Q_NULLPTR),
actualFOV(0), actualFOV(0.),
initialFOV(0), initialFOV(0.),
flagInitFOVUsage(false), flagInitFOVUsage(false),
flagInitDirectionUsage(false), flagInitDirectionUsage(false),
flagAutosetMountForCCD(false), flagAutosetMountForCCD(false),
equatorialMountEnabled(false), equatorialMountEnabled(false),
reticleRotation(0) reticleRotation(0.)
{ {
// Font size is 14 // Font size is 14
font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1); font.setPixelSize(StelApp::getInstance().getBaseFontSize()+1);
ccds = QList<CCD *>(); ccds = QList<CCD *>();
oculars = QList<Ocular *>(); oculars = QList<Ocular *>();
telescopes = QList<Telescope *>(); telescopes = QList<Telescope *>();
lense = QList<Lens *> (); lenses = 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); lensesSignalMapper = new QSignalMapper(this);
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
} }
Oculars::~Oculars() Oculars::~Oculars()
{ {
delete ocularDialog; delete ocularDialog;
ocularDialog = NULL; ocularDialog = Q_NULLPTR;
if (guiPanel) if (guiPanel)
delete guiPanel; delete guiPanel;
if (pxmapGlow) if (pxmapGlow)
delete pxmapGlow; delete pxmapGlow;
if (pxmapOnIcon) if (pxmapOnIcon)
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); qDeleteAll(lenses);
lense.clear(); lenses.clear();
} }
QSettings* Oculars::appSettings() QSettings* Oculars::appSettings()
{ {
return settings; return settings;
} }
/* ************************************************************************ ****************************************** */ /* ************************************************************************ ****************************************** */
#if 0 #if 0
#pragma mark - #pragma mark -
skipping to change at line 277 skipping to change at line 253
ocular->writeToSettings(settings, index); ocular->writeToSettings(settings, index);
index++; index++;
} }
index = 0; index = 0;
foreach(Telescope* telescope, telescopes) foreach(Telescope* telescope, telescopes)
{ {
telescope->writeToSettings(settings, index); telescope->writeToSettings(settings, index);
index++; index++;
} }
index = 0; index = 0;
foreach(Lens* lens, lense) foreach(Lens* lens, lenses)
{ {
lens->writeToSettings(settings, index); lens->writeToSettings(settings, index);
index++; 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->setValue("lens_count", lenses.count());
StelCore *core = StelApp::getInstance().getCore();
StelSkyDrawer *skyDrawer = core->getSkyDrawer();
if (flagShowCCD)
{
// Retrieve and restore star scales
relativeStarScaleCCD=skyDrawer->getRelativeStarScale();
absoluteStarScaleCCD=skyDrawer->getAbsoluteStarScale();
skyDrawer->setRelativeStarScale(relativeStarScaleMain);
skyDrawer->setAbsoluteStarScale(absoluteStarScaleMain);
}
else if (flagShowOculars)
{
// Retrieve and restore star scales
relativeStarScaleOculars=skyDrawer->getRelativeStarScale();
absoluteStarScaleOculars=skyDrawer->getAbsoluteStarScale();
skyDrawer->setRelativeStarScale(relativeStarScaleMain);
skyDrawer->setAbsoluteStarScale(absoluteStarScaleMain);
}
settings->setValue("stars_scale_relative", QString::number(relativeS
tarScaleOculars, 'f', 2));
settings->setValue("stars_scale_absolute", QString::number(absoluteS
tarScaleOculars, 'f', 2));
settings->setValue("stars_scale_relative_ccd", QString::number(relat
iveStarScaleCCD, 'f', 2));
settings->setValue("stars_scale_absolute_ccd", QString::number(absol
uteStarScaleCCD, 'f', 2));
settings->sync(); settings->sync();
disconnect(this, SIGNAL(selectedOcularChanged()), this, SLOT(updateO cularReticle())); disconnect(this, SIGNAL(selectedOcularChanged()), this, SLOT(updateO cularReticle()));
//disconnect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(cons t QString&)), this, SLOT(setStelStyle(const QString&))); //disconnect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(cons t QString&)), this, SLOT(setStelStyle(const QString&)));
disconnect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslateGui())); disconnect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslateGui()));
} }
//! 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) void Oculars::draw(StelCore* core)
{ {
skipping to change at line 542 skipping to change at line 542
// assume all is well // assume all is well
ready = true; ready = true;
requireSelection = settings->value("require_selection_to_zoo m", 1.0).toBool(); requireSelection = settings->value("require_selection_to_zoo m", 1.0).toBool();
useMaxEyepieceAngle = settings->value("use_max_exit_circle", 0.0).toBool(); useMaxEyepieceAngle = settings->value("use_max_exit_circle", 0.0).toBool();
int ocularCount = settings->value("ocular_count", 0).toInt() ; int ocularCount = settings->value("ocular_count", 0).toInt() ;
int actualOcularCount = ocularCount; int actualOcularCount = ocularCount;
for (int index = 0; index < ocularCount; index++) for (int index = 0; index < ocularCount; index++)
{ {
Ocular *newOcular = Ocular::ocularFromSettings(setti ngs, index); Ocular *newOcular = Ocular::ocularFromSettings(setti ngs, index);
if (newOcular != NULL) if (newOcular != Q_NULLPTR)
{ {
oculars.append(newOcular); oculars.append(newOcular);
} }
else else
{ {
actualOcularCount--; actualOcularCount--;
} }
} }
if (actualOcularCount < 1) if (actualOcularCount < 1)
{ {
skipping to change at line 573 skipping to change at line 573
else else
{ {
selectedOcularIndex = 0; selectedOcularIndex = 0;
} }
int ccdCount = settings->value("ccd_count", 0).toInt(); int ccdCount = settings->value("ccd_count", 0).toInt();
int actualCcdCount = ccdCount; int actualCcdCount = ccdCount;
for (int index = 0; index < ccdCount; index++) for (int index = 0; index < ccdCount; index++)
{ {
CCD *newCCD = CCD::ccdFromSettings(settings, index); CCD *newCCD = CCD::ccdFromSettings(settings, index);
if (newCCD != NULL) if (newCCD != Q_NULLPTR)
{ {
ccds.append(newCCD); ccds.append(newCCD);
} }
else else
{ {
actualCcdCount--; actualCcdCount--;
} }
} }
if (actualCcdCount < ccdCount) if (actualCcdCount < ccdCount)
{ {
qWarning() << "The Oculars ini file appears to be co rrupt; delete it."; qWarning() << "The Oculars ini file appears to be co rrupt; delete it.";
ready = false; ready = false;
} }
int telescopeCount = settings->value("telescope_count", 0).t oInt(); int telescopeCount = settings->value("telescope_count", 0).t oInt();
int actualTelescopeCount = telescopeCount; int actualTelescopeCount = telescopeCount;
for (int index = 0; index < telescopeCount; index++) for (int index = 0; index < telescopeCount; index++)
{ {
Telescope *newTelescope = Telescope::telescopeFromSe ttings(settings, index); Telescope *newTelescope = Telescope::telescopeFromSe ttings(settings, index);
if (newTelescope != NULL) if (newTelescope != Q_NULLPTR)
{ {
telescopes.append(newTelescope); telescopes.append(newTelescope);
} }
else else
{ {
actualTelescopeCount--; actualTelescopeCount--;
} }
} }
if (actualTelescopeCount < 1) if (actualTelescopeCount < 1)
{ {
skipping to change at line 624 skipping to change at line 624
else else
{ {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
int lensCount = settings->value("lens_count", 0).toInt(); int lensCount = settings->value("lens_count", 0).toInt();
int actualLensCount = lensCount; int actualLensCount = lensCount;
for (int index = 0; index<lensCount; index++) for (int index = 0; index<lensCount; index++)
{ {
Lens *newLens = Lens::lensFromSettings(settings, ind ex); Lens *newLens = Lens::lensFromSettings(settings, ind ex);
if (newLens != NULL) if (newLens != Q_NULLPTR)
{ {
lense.append(newLens); lenses.append(newLens);
} }
else else
{ {
actualLensCount--; actualLensCount--;
} }
} }
if (lensCount > 0 && actualLensCount < lensCount) if (lensCount > 0 && actualLensCount < lensCount)
{ {
qWarning() << "The Oculars ini file appears to be co rrupt; delete it."; qWarning() << "The Oculars ini file appears to be co rrupt; delete it.";
} }
ocularDialog = new OcularDialog(this, &ccds, &oculars, &tele scopes, &lense); ocularDialog = new OcularDialog(this, &ccds, &oculars, &tele scopes, &lenses);
initializeActivationActions(); initializeActivationActions();
determineMaxEyepieceAngle(); determineMaxEyepieceAngle();
guiPanelEnabled = settings->value("enable_control_panel", tr ue).toBool(); guiPanelEnabled = settings->value("enable_control_panel", tr ue).toBool();
enableGuiPanel(guiPanelEnabled); enableGuiPanel(guiPanelEnabled);
setFlagDecimalDegrees(settings->value("use_decimal_degrees", false).toBool()); setFlagDecimalDegrees(settings->value("use_decimal_degrees", false).toBool());
setFlagLimitMagnitude(settings->value("limit_stellar_magnitu de", true).toBool()); setFlagLimitMagnitude(settings->value("limit_stellar_magnitu de", true).toBool());
setFlagInitFovUsage(settings->value("use_initial_fov", false ).toBool()); setFlagInitFovUsage(settings->value("use_initial_fov", false ).toBool());
setFlagInitDirectionUsage(settings->value("use_initial_direc tion", false).toBool()); setFlagInitDirectionUsage(settings->value("use_initial_direc tion", false).toBool());
setFlagUseSemiTransparency(settings->value("use_semi_transpa rency", false).toBool()); setFlagUseSemiTransparency(settings->value("use_semi_transpa rency", false).toBool());
setFlagHideGridsLines(settings->value("hide_grids_and_lines" , true).toBool()); setFlagHideGridsLines(settings->value("hide_grids_and_lines" , true).toBool());
setFlagAutosetMountForCCD(settings->value("use_mount_autoset ", false).toBool()); setFlagAutosetMountForCCD(settings->value("use_mount_autoset ", false).toBool());
relativeStarScaleOculars=settings->value("stars_scale_relati
ve", 1.0).toDouble();
absoluteStarScaleOculars=settings->value("stars_scale_absolu
te", 1.0).toDouble();
relativeStarScaleCCD=settings->value("stars_scale_relative_c
cd", 1.0).toDouble();
absoluteStarScaleCCD=settings->value("stars_scale_absolute_c
cd", 1.0).toDouble();
StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope rtyManager(); StelPropertyMgr* propMgr=StelApp::getInstance().getStelPrope rtyManager();
equatorialMountEnabled = propMgr->getStelPropertyValue("acti onSwitch_Equatorial_Mount").toBool(); equatorialMountEnabled = propMgr->getStelPropertyValue("acti onSwitch_Equatorial_Mount").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 696 skipping to change at line 700
{ {
maxEyepieceAngle = 1.0; maxEyepieceAngle = 1.0;
} }
} }
void Oculars::instrumentChanged() void Oculars::instrumentChanged()
{ {
// We only zoom if in ocular mode. // We only zoom if in ocular mode.
if (flagShowOculars) if (flagShowOculars)
{ {
// If we are already in Ocular mode, we must reset scalings
because zoom() also resets.
StelSkyDrawer *skyDrawer = StelApp::getInstance().getCore()-
>getSkyDrawer();
skyDrawer->setRelativeStarScale(relativeStarScaleMain);
skyDrawer->setAbsoluteStarScale(absoluteStarScaleMain);
zoom(true); zoom(true);
} }
} }
void Oculars::setRequireSelection(bool state) void Oculars::setRequireSelection(bool state)
{ {
requireSelection = state; requireSelection = state;
} }
void Oculars::setScaleImageCircle(bool state) void Oculars::setScaleImageCircle(bool state)
{ {
if (state) if (state)
{ {
determineMaxEyepieceAngle(); determineMaxEyepieceAngle();
} }
useMaxEyepieceAngle = state; useMaxEyepieceAngle = state;
} }
void Oculars::setScreenFOVForCCD() void Oculars::setScreenFOVForCCD()
{ {
Lens * lens = selectedLensIndex >=0 ? lense[selectedLensIndex] : NU LL; Lens * lens = selectedLensIndex >=0 ? lenses[selectedLensIndex] : Q _NULLPTR;
if (selectedCCDIndex > -1 && selectedTelescopeIndex > -1) if (selectedCCDIndex > -1 && selectedTelescopeIndex > -1)
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
double actualFOVx = ccds[selectedCCDIndex]->getActualFOVx(te lescopes[selectedTelescopeIndex], lens); double actualFOVx = ccds[selectedCCDIndex]->getActualFOVx(te lescopes[selectedTelescopeIndex], lens);
double actualFOVy = ccds[selectedCCDIndex]->getActualFOVy(te lescopes[selectedTelescopeIndex], lens); double actualFOVy = ccds[selectedCCDIndex]->getActualFOVy(te lescopes[selectedTelescopeIndex], lens);
if (actualFOVx < actualFOVy) if (actualFOVx < actualFOVy)
{ {
actualFOVx = actualFOVy; actualFOVx = actualFOVy;
} }
skipping to change at line 990 skipping to change at line 998
if (selectedTelescopeIndex == -1) if (selectedTelescopeIndex == -1)
{ {
selectedTelescopeIndex = telescopes.count() - 1; selectedTelescopeIndex = telescopes.count() - 1;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::decrementLensIndex() void Oculars::decrementLensIndex()
{ {
selectedLensIndex--; selectedLensIndex--;
if (selectedLensIndex == lense.count()) if (selectedLensIndex == lenses.count())
{ {
selectedLensIndex = -1; selectedLensIndex = -1;
} }
if (selectedLensIndex == -2) if (selectedLensIndex == -2)
{ {
selectedLensIndex = lense.count() - 1; selectedLensIndex = lenses.count() - 1;
} }
emit(selectedLensChanged()); emit(selectedLensChanged());
} }
void Oculars::displayPopupMenu() void Oculars::displayPopupMenu()
{ {
QMenu * popup = new QMenu(&StelMainView::getInstance()); QMenu * popup = new QMenu(&StelMainView::getInstance());
if (flagShowOculars) if (flagShowOculars)
{ {
skipping to change at line 1028 skipping to change at line 1036
QString label; QString label;
if (availableOcularCount < 10) if (availableOcularCount < 10)
{ {
label = QString("&%1: %2").arg(avail ableOcularCount).arg(oculars[index]->name()); label = QString("&%1: %2").arg(avail ableOcularCount).arg(oculars[index]->name());
} }
else else
{ {
label = oculars[index]->name(); label = oculars[index]->name();
} }
//BM: Does this happen at all any more? //BM: Does this happen at all any more?
QAction* action = 0; QAction* action = Q_NULLPTR;
if (selectedTelescopeIndex != -1 || oculars[ index]->isBinoculars()) if (selectedTelescopeIndex != -1 || oculars[ index]->isBinoculars())
{ {
action = submenu->addAction( label, ocularsSignalMapper, SLOT(map())); action = submenu->addAction( label, ocularsSignalMapper, SLOT(map()));
availableOcularCount++; availableOcularCount++;
ocularsSignalMapper->setMapp ing(action, QString("%1").arg(index)); ocularsSignalMapper->setMapp ing(action, QString("%1").arg(index));
} }
if (action && index == selectedOcularIndex) if (action && index == selectedOcularIndex)
{ {
action->setCheckable(true); action->setCheckable(true);
skipping to change at line 1118 skipping to change at line 1126
if (index == selectedCCDIndex) if (index == selectedCCDIndex)
{ {
action->setCheckable(true); action->setCheckable(true);
action->setChecked(true); action->setChecked(true);
} }
ccdsSignalMapper->setMapping(action, QString ("%1").arg(index)); ccdsSignalMapper->setMapping(action, QString ("%1").arg(index));
} }
popup->addMenu(submenu); popup->addMenu(submenu);
submenu = new QMenu(q_("&Rotate CCD"), popup); submenu = new QMenu(q_("&Rotate CCD"), popup);
QAction* rotateAction = NULL; QAction* rotateAction = Q_NULLPTR;
rotateAction = submenu->addAction(QString("&1: -90") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&1: -90") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-90")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-90"));
rotateAction = submenu->addAction(QString("&2: -45") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&2: -45") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-45")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-45"));
rotateAction = submenu->addAction(QString("&3: -15") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&3: -15") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-15")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-15"));
rotateAction = submenu->addAction(QString("&4: -5") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&4: -5") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-5")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-5"));
rotateAction = submenu->addAction(QString("&5: -1") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map())); rotateAction = submenu->addAction(QString("&5: -1") + QChar(0x00B0), ccdRotationSignalMapper, SLOT(map()));
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-1")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-1"));
skipping to change at line 1203 skipping to change at line 1211
if (selectedTelescopeIndex == telescopes.count()) if (selectedTelescopeIndex == telescopes.count())
{ {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::incrementLensIndex() void Oculars::incrementLensIndex()
{ {
selectedLensIndex++; selectedLensIndex++;
if (selectedLensIndex == lense.count()) if (selectedLensIndex == lenses.count())
{ {
selectedLensIndex = -1; selectedLensIndex = -1;
} }
emit(selectedLensChanged()); emit(selectedLensChanged());
} }
void Oculars::disableLens() void Oculars::disableLens()
{ {
selectedLensIndex = -1; selectedLensIndex = -1;
emit(selectedLensChanged()); emit(selectedLensChanged());
skipping to change at line 1271 skipping to change at line 1279
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) void Oculars::selectLensAtIndex(QString indexString)
{ {
int index = indexString.toInt(); int index = indexString.toInt();
if (index > -2 && index < lense.count()) if (index > -2 && index < lenses.count())
{ {
selectedLensIndex = index; selectedLensIndex = index;
emit(selectedLensChanged()); 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())
skipping to change at line 1294 skipping to change at line 1302
//if there are no sensors. //if there are no sensors.
if (show) if (show)
qWarning() << "Oculars plugin: Unable to display a s ensor boundary: No sensors or telescopes are defined."; qWarning() << "Oculars plugin: Unable to display a s ensor boundary: No sensors or telescopes are defined.";
flagShowCCD = false; flagShowCCD = false;
selectedCCDIndex = -1; selectedCCDIndex = -1;
show = false; show = false;
} }
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
StelSkyDrawer *skyDrawer = core->getSkyDrawer();
if (show) if (show)
{ {
initialFOV = movementManager->getCurrentFov(); initialFOV = movementManager->getCurrentFov();
//Mutually exclusive with the ocular mode //Mutually exclusive with the ocular mode
hideUsageMessageIfDisplayed(); hideUsageMessageIfDisplayed();
if (flagShowOculars) if (flagShowOculars)
enableOcular(false); enableOcular(false);
if (flagShowTelrad) { if (flagShowTelrad) {
toggleTelrad(false); toggleTelrad(false);
skipping to change at line 1317 skipping to change at line 1326
{ {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
if (selectedCCDIndex < 0) if (selectedCCDIndex < 0)
{ {
selectedCCDIndex = 0; selectedCCDIndex = 0;
} }
flagShowCCD = true; flagShowCCD = true;
setScreenFOVForCCD(); setScreenFOVForCCD();
// Change scales for stars. (Even restoring from ocular view
has restored main program's values at this point.)
relativeStarScaleMain=skyDrawer->getRelativeStarScale();
absoluteStarScaleMain=skyDrawer->getAbsoluteStarScale();
skyDrawer->setRelativeStarScale(relativeStarScaleCCD);
skyDrawer->setAbsoluteStarScale(absoluteStarScaleCCD);
if (guiPanel) if (guiPanel)
{ {
guiPanel->showCcdGui(); guiPanel->showCcdGui();
} }
} }
else else
{ {
flagShowCCD = false; flagShowCCD = false;
// Restore star scales
relativeStarScaleCCD=skyDrawer->getRelativeStarScale();
absoluteStarScaleCCD=skyDrawer->getAbsoluteStarScale();
skyDrawer->setRelativeStarScale(relativeStarScaleMain);
skyDrawer->setAbsoluteStarScale(absoluteStarScaleMain);
movementManager->setFlagTracking(false); movementManager->setFlagTracking(false);
//Zoom out //Zoom out
if (getFlagInitFovUsage()) if (getFlagInitFovUsage())
movementManager->zoomTo(movementManager->getInitFov( )); movementManager->zoomTo(movementManager->getInitFov( ));
else else
movementManager->zoomTo(initialFOV); movementManager->zoomTo(initialFOV);
if (getFlagInitDirectionUsage()) if (getFlagInitDirectionUsage())
movementManager->setViewDirectionJ2000(core->altAzTo J2000(movementManager->getInitViewingDirection(), StelCore::RefractionOff)) ; movementManager->setViewDirectionJ2000(core->altAzTo J2000(movementManager->getInitViewingDirection(), StelCore::RefractionOff)) ;
skipping to change at line 1414 skipping to change at line 1434
Q_ASSERT(gui); Q_ASSERT(gui);
QString ocularsGroup = N_("Oculars"); QString ocularsGroup = N_("Oculars");
actionShowOcular = addAction("actionShow_Ocular", ocularsGroup, N_(" Ocular view"), "enableOcular", "Ctrl+O"); actionShowOcular = addAction("actionShow_Ocular", ocularsGroup, N_(" Ocular view"), "enableOcular", "Ctrl+O");
// Make a toolbar button // Make a toolbar button
try try
{ {
pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png"); pxmapGlow = new QPixmap(":/graphicGui/glow32x32.png");
pxmapOnIcon = new QPixmap(":/ocular/bt_ocular_on.png"); pxmapOnIcon = new QPixmap(":/ocular/bt_ocular_on.png");
pxmapOffIcon = new QPixmap(":/ocular/bt_ocular_off.png"); pxmapOffIcon = new QPixmap(":/ocular/bt_ocular_off.png");
toolbarButton = new StelButton(NULL, *pxmapOnIcon, *pxmapOff Icon, *pxmapGlow, "actionShow_Ocular"); toolbarButton = new StelButton(Q_NULLPTR, *pxmapOnIcon, *pxm apOffIcon, *pxmapGlow, "actionShow_Ocular");
gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup"); gui->getButtonBar()->addButton(toolbarButton, "065-pluginsGr oup");
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "WARNING: unable create toolbar button for Ocu lars plugin: " << e.what(); qWarning() << "WARNING: unable create toolbar button for Ocu lars plugin: " << e.what();
} }
actionMenu = addAction("actionShow_Ocular_Menu", ocularsGroup, N_("O culars popup menu"), "displayPopupMenu()", "Alt+O"); actionMenu = addAction("actionShow_Ocular_Menu", ocularsGroup, N_("O culars popup menu"), "displayPopupMenu()", "Alt+O");
actionShowCrosshairs = addAction("actionShow_Ocular_Crosshairs", ocu larsGroup, N_("Show crosshairs"), "enableCrosshairs", "Alt+C"); actionShowCrosshairs = addAction("actionShow_Ocular_Crosshairs", ocu larsGroup, N_("Show crosshairs"), "enableCrosshairs", "Alt+C");
actionShowSensor = addAction("actionShow_Sensor", ocularsGroup, N_(" Image sensor frame"), "enableCCD"); actionShowSensor = addAction("actionShow_Sensor", ocularsGroup, N_(" Image sensor frame"), "enableCCD");
skipping to change at line 1450 skipping to change at line 1470
connect(this, SIGNAL(selectedLensChanged()), this, SLOT(instrumentCh anged())); 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))); connect(lensesSignalMapper, SIGNAL(mapped(QString)), this, SLOT(sele ctLensAtIndex(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;
skipping to change at line 1472 skipping to change at line 1492
} }
} }
return binocularFound; return binocularFound;
} }
void Oculars::paintCCDBounds() void Oculars::paintCCDBounds()
{ {
int fontSize = StelApp::getInstance().getBaseFontSize(); int fontSize = StelApp::getInstance().getBaseFontSize();
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams(); StelProjector::StelProjectorParams params = core->getCurrentStelProj ectorParams();
Lens *lens = selectedLensIndex >=0 ? lense[selectedLensIndex] : NUL L; Lens *lens = selectedLensIndex >=0 ? lenses[selectedLensIndex] : Q_ NULLPTR;
const StelProjectorP projector = core->getProjection(StelCore::Frame EquinoxEqu); const StelProjectorP projector = core->getProjection(StelCore::Frame EquinoxEqu);
double screenFOV = params.fov; double screenFOV = params.fov;
Vec2i centerScreen(projector->getViewportPosX() + projector->getView portWidth() / 2, Vec2i centerScreen(projector->getViewportPosX() + projector->getView portWidth() / 2,
projector->getViewportPosY() + projector->getView portHeight() / 2); projector->getViewportPosY() + projector->getView portHeight() / 2);
// draw sensor rectangle // draw sensor rectangle
if(selectedCCDIndex != -1) if(selectedCCDIndex != -1)
{ {
skipping to change at line 1776 skipping to change at line 1796
painter.drawFromArray(StelPainter::TriangleStrip, (slices+1)*2, 0, f alse); painter.drawFromArray(StelPainter::TriangleStrip, (slices+1)*2, 0, f alse);
painter.enableClientStates(false); painter.enableClientStates(false);
} }
void Oculars::paintText(const StelCore* core) void Oculars::paintText(const StelCore* core)
{ {
const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ; const StelProjectorP prj = core->getProjection(StelCore::FrameAltAz) ;
StelPainter painter(prj); StelPainter painter(prj);
// Get the current instruments // Get the current instruments
CCD *ccd = NULL; CCD *ccd = Q_NULLPTR;
if(selectedCCDIndex != -1) if(selectedCCDIndex != -1)
{ {
ccd = ccds[selectedCCDIndex]; ccd = ccds[selectedCCDIndex];
} }
Ocular *ocular = NULL; Ocular *ocular = Q_NULLPTR;
if(selectedOcularIndex !=-1) if(selectedOcularIndex !=-1)
{ {
ocular = oculars[selectedOcularIndex]; ocular = oculars[selectedOcularIndex];
} }
Telescope *telescope = NULL; Telescope *telescope = Q_NULLPTR;
if(selectedTelescopeIndex != -1) if(selectedTelescopeIndex != -1)
{ {
telescope = telescopes[selectedTelescopeIndex]; telescope = telescopes[selectedTelescopeIndex];
} }
Lens *lens = selectedLens(); Lens *lens = selectedLens();
// set up the color and the GL state // set up the color and the GL state
painter.setColor(0.8f, 0.48f, 0.f, 1.f); painter.setColor(0.8f, 0.48f, 0.f, 1.f);
painter.setBlending(true); painter.setBlending(true);
skipping to change at line 1809 skipping to change at line 1829
QString widthString = "MMMMMMMMMMMMMMMMMMM"; QString widthString = "MMMMMMMMMMMMMMMMMMM";
float insetFromRHS = painter.getFontMetrics().width(widthString); float insetFromRHS = painter.getFontMetrics().width(widthString);
StelProjector::StelProjectorParams projectorParams = core->getCurren tStelProjectorParams(); StelProjector::StelProjectorParams projectorParams = core->getCurren tStelProjectorParams();
int xPosition = projectorParams.viewportXywh[2] - projectorParams.vi ewportCenterOffset[0]; int xPosition = projectorParams.viewportXywh[2] - projectorParams.vi ewportCenterOffset[0];
xPosition -= insetFromRHS; xPosition -= insetFromRHS;
int yPosition = projectorParams.viewportXywh[3] - projectorParams.vi ewportCenterOffset[1]; int yPosition = projectorParams.viewportXywh[3] - projectorParams.vi ewportCenterOffset[1];
yPosition -= 40; yPosition -= 40;
const int lineHeight = painter.getFontMetrics().height(); const int lineHeight = painter.getFontMetrics().height();
// The Ocular // The Ocular
if (flagShowOculars && ocular!=NULL) if (flagShowOculars && ocular!=Q_NULLPTR)
{ {
QString ocularNumberLabel; QString ocularNumberLabel;
QString name = ocular->name(); QString name = ocular->name();
if (name.isEmpty()) if (name.isEmpty())
{ {
ocularNumberLabel = QString(q_("Ocular #%1")).arg(se lectedOcularIndex); ocularNumberLabel = QString(q_("Ocular #%1")).arg(se lectedOcularIndex);
} }
else else
{ {
ocularNumberLabel = QString(q_("Ocular #%1: %2")).ar g(selectedOcularIndex).arg(name); ocularNumberLabel = QString(q_("Ocular #%1: %2")).ar g(selectedOcularIndex).arg(name);
skipping to change at line 1845 skipping to change at line 1865
QString ocularFov = QString::number(ocular->appearen tFOV(), 'f', 2); QString ocularFov = QString::number(ocular->appearen tFOV(), 'f', 2);
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 ")).arg(ocularFov); QString ocularFOVLabel = QString(q_("Ocular aFOV: %1 ")).arg(ocularFov);
painter.drawText(xPosition, yPosition, ocularFOVLabe l); painter.drawText(xPosition, yPosition, ocularFOVLabe l);
yPosition-=lineHeight; yPosition-=lineHeight;
QString lensNumberLabel; QString lensNumberLabel;
// Barlow and Shapley lens // Barlow and Shapley lens
if (lens != NULL) // it's null if lens is not select ed (lens index = -1) if (lens != Q_NULLPTR) // it's null if lens is not s elected (lens index = -1)
{ {
QString lensName = lens->getName(); QString lensName = lens->getName();
if (lensName.isEmpty()) if (lensName.isEmpty())
{ {
lensNumberLabel = QString(q_("Lens # %1")).arg(selectedLensIndex); lensNumberLabel = QString(q_("Lens # %1")).arg(selectedLensIndex);
} }
else else
{ {
lensNumberLabel = QString (q_("Lens #%1: %2")).arg(selectedLensIndex).arg(lensName); lensNumberLabel = QString (q_("Lens #%1: %2")).arg(selectedLensIndex).arg(lensName);
} }
} }
else else
{ {
lensNumberLabel = QString (q_("Lens: none")) ; lensNumberLabel = QString (q_("Lens: none")) ;
} }
painter.drawText(xPosition, yPosition, lensNumberLab el); painter.drawText(xPosition, yPosition, lensNumberLab el);
yPosition-=lineHeight; yPosition-=lineHeight;
if (telescope!=NULL) if (telescope!=Q_NULLPTR)
{ {
QString telescopeName = telescope->name(); QString telescopeName = telescope->name();
QString telescopeString = ""; QString telescopeString = "";
if (telescopeName.isEmpty()) if (telescopeName.isEmpty())
telescopeString = QString("%1").arg( selectedTelescopeIndex); telescopeString = QString("%1").arg( selectedTelescopeIndex);
else else
telescopeString = QString("%1: %2"). arg(selectedTelescopeIndex).arg(telescopeName); telescopeString = QString("%1: %2"). arg(selectedTelescopeIndex).arg(telescopeName);
painter.drawText(xPosition, yPosition, QStri ng(q_("Telescope #%1")).arg(telescopeString)); painter.drawText(xPosition, yPosition, QStri ng(q_("Telescope #%1")).arg(telescopeString));
yPosition-=lineHeight; yPosition-=lineHeight;
// General info // General info
double mag = ocular->magnification(telescope , lens); double mag = ocular->magnification(telescope , lens);
QString magString = QString::number(mag, 'f' , 1); QString magString = QString::number(mag, 'f' , 1);
magString.append(QChar(0x00D7));//Multiplica magString.append(QChar(0x02E3)); // Was 0x00
tion sign D7
magString.append(QString(" (%1D)").arg(QStri
ng::number(mag/telescope->diameter(), 'f', 2)));
painter.drawText(xPosition, yPosition, QStri ng(q_("Magnification: %1")).arg(magString)); painter.drawText(xPosition, yPosition, QStri ng(q_("Magnification: %1")).arg(magString));
yPosition-=lineHeight; yPosition-=lineHeight;
if (mag>0) if (mag>0)
{ {
QString exitPupil = QString::number( telescope->diameter()/mag, 'f', 2); QString exitPupil = QString::number( telescope->diameter()/mag, 'f', 2);
painter.drawText(xPosition, yPositio n, QString(q_("Exit pupil: %1 mm")).arg(exitPupil)); painter.drawText(xPosition, yPositio n, QString(q_("Exit pupil: %1 mm")).arg(exitPupil));
yPosition-=lineHeight; yPosition-=lineHeight;
skipping to change at line 1902 skipping to change at line 1923
QString fovString = QString::number(ocular-> actualFOV(telescope, lens), 'f', 5); QString fovString = QString::number(ocular-> actualFOV(telescope, lens), 'f', 5);
fovString.append(QChar(0x00B0));//Degree sig n fovString.append(QChar(0x00B0));//Degree sig n
painter.drawText(xPosition, yPosition, QStri ng(q_("FOV: %1")).arg(fovString)); painter.drawText(xPosition, yPosition, QStri ng(q_("FOV: %1")).arg(fovString));
} }
} }
} }
// The CCD // The CCD
if (flagShowCCD && ccd!=NULL) if (flagShowCCD && ccd!=Q_NULLPTR)
{ {
QString ccdSensorLabel, ccdInfoLabel; QString ccdSensorLabel, ccdInfoLabel;
QString name = ""; QString name = "";
QString telescopeName = ""; QString telescopeName = "";
double fovX = 0.0; double fovX = 0.0;
double fovY = 0.0; double fovY = 0.0;
if (telescope!=NULL) if (telescope!=Q_NULLPTR)
{ {
fovX = ccd->getActualFOVx(telescope, lens); fovX = ccd->getActualFOVx(telescope, lens);
fovY = ccd->getActualFOVy(telescope, lens); fovY = ccd->getActualFOVy(telescope, lens);
name = ccd->name(); name = ccd->name();
telescopeName = telescope->name(); telescopeName = telescope->name();
} }
ccdInfoLabel = QString(q_("Dimensions: %1")).arg(getDimensio nsString(fovX, fovY)); ccdInfoLabel = QString(q_("Dimensions: %1")).arg(getDimensio nsString(fovX, fovY));
if (name.isEmpty()) if (name.isEmpty())
skipping to change at line 2024 skipping to change at line 2045
} }
} }
} }
settings = new QSettings(ocularIniPath, QSettings::IniFormat, this); settings = new QSettings(ocularIniPath, QSettings::IniFormat, this);
} }
void Oculars::unzoomOcular() void Oculars::unzoomOcular()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
StelSkyDrawer *skyManager = core->getSkyDrawer(); StelSkyDrawer *skyDrawer = core->getSkyDrawer();
if (flagHideGridsLines) if (flagHideGridsLines)
{ {
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInst GETSTELMODULE(GridLinesMgr)->setFlagGridlines(flagGridlinesD
ance().getModuleMgr().getModule("GridLinesMgr"); isplayedMain);
gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid);
gridManager->setFlagGalacticGrid(flagGalacticGrid);
gridManager->setFlagSupergalacticGrid(flagSupergalacticGrid)
;
gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid);
gridManager->setFlagEquatorGrid(flagEquatorGrid);
gridManager->setFlagEquatorJ2000Line(flagEquatorJ2000Line);
gridManager->setFlagEquatorLine(flagEquatorLine);
gridManager->setFlagEclipticJ2000Line(flagEclipticJ2000Line)
;
gridManager->setFlagEclipticLine(flagEclipticLine);
gridManager->setFlagEclipticJ2000Grid(flagEclipticJ2000Grid)
;
gridManager->setFlagEclipticGrid(flagEclipticGrid);
gridManager->setFlagMeridianLine(flagMeridianLine);
gridManager->setFlagLongitudeLine(flagLongitudeLine);
gridManager->setFlagHorizonLine(flagHorizonLine);
gridManager->setFlagGalacticEquatorLine(flagGalacticEquatorL
ine);
gridManager->setFlagSupergalacticEquatorLine(flagSupergalact
icEquatorLine);
gridManager->setFlagPrimeVerticalLine(flagPrimeVerticalLine)
;
gridManager->setFlagColureLines(flagColureLines);
gridManager->setFlagCircumpolarCircles(flagCircumpolarCircle
s);
gridManager->setFlagPrecessionCircles(flagPrecessionCircles)
;
gridManager->setFlagCelestialJ2000Poles(flagCelestialJ2000Po
les);
gridManager->setFlagCelestialPoles(flagCelestialPoles);
gridManager->setFlagZenithNadir(flagZenithNadirPoints);
gridManager->setFlagEclipticJ2000Poles(flagEclipticJ2000Pole
s);
gridManager->setFlagEclipticPoles(flagEclipticPoles);
gridManager->setFlagGalacticPoles(flagGalacticPoles);
gridManager->setFlagSupergalacticPoles(flagSupergalacticPole
s);
gridManager->setFlagEquinoxJ2000Points(flagEquinoxJ2000Point
s);
gridManager->setFlagEquinoxPoints(flagEquinoxPoints);
gridManager->setFlagSolsticeJ2000Points(flagSolsticeJ2000Poi
nts);
gridManager->setFlagSolsticePoints(flagSolsticePoints);
GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(flagCard inalPoints); GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(flagCard inalPoints);
} }
skyManager->setFlagLuminanceAdaptation(flagAdaptation); skyDrawer->setFlagLuminanceAdaptation(flagAdaptation);
skyManager->setFlagStarMagnitudeLimit(flagLimitStars); skyDrawer->setFlagStarMagnitudeLimit(flagLimitStars);
skyManager->setFlagPlanetMagnitudeLimit(flagLimitPlanets); skyDrawer->setFlagPlanetMagnitudeLimit(flagLimitPlanets);
skyManager->setFlagNebulaMagnitudeLimit(flagLimitDSOs); skyDrawer->setFlagNebulaMagnitudeLimit(flagLimitDSOs);
skyManager->setCustomStarMagnitudeLimit(magLimitStars); skyDrawer->setCustomStarMagnitudeLimit(magLimitStars);
skyManager->setCustomPlanetMagnitudeLimit(magLimitPlanets); skyDrawer->setCustomPlanetMagnitudeLimit(magLimitPlanets);
skyManager->setCustomNebulaMagnitudeLimit(magLimitDSOs); skyDrawer->setCustomNebulaMagnitudeLimit(magLimitDSOs);
// restore values, but keep current to enable toggling
relativeStarScaleOculars=skyDrawer->getRelativeStarScale();
absoluteStarScaleOculars=skyDrawer->getAbsoluteStarScale();
skyDrawer->setRelativeStarScale(relativeStarScaleMain);
skyDrawer->setAbsoluteStarScale(absoluteStarScaleMain);
movementManager->setFlagTracking(false); movementManager->setFlagTracking(false);
movementManager->setFlagEnableZoomKeys(true); movementManager->setFlagEnableZoomKeys(true);
movementManager->setFlagEnableMouseNavigation(true); movementManager->setFlagEnableMouseNavigation(true);
GETSTELMODULE(SolarSystem)->setFlagMoonScale(flagMoonScale); GETSTELMODULE(SolarSystem)->setFlagMoonScale(flagMoonScale);
// Set the screen display // Set the screen display
core->setFlipHorz(flipHorz); core->setFlipHorz(flipHorz);
core->setFlipVert(flipVert); core->setFlipVert(flipVert);
skipping to change at line 2107 skipping to change at line 2100
} }
if (flagShowOculars) if (flagShowOculars)
{ {
if (!zoomedIn) if (!zoomedIn)
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
if (flagHideGridsLines) if (flagHideGridsLines)
{ {
GridLinesMgr *gridManager = (GridLinesMgr *) // Store current state for later resetting
StelApp::getInstance().getModuleMgr().getModule("GridLinesMgr"); flagGridlinesDisplayedMain=GETSTELMODULE(Gri
// Current state dLinesMgr)->getFlagGridlines();
flagAzimuthalGrid = gridManager->getFlagAzim
uthalGrid();
flagGalacticGrid = gridManager->getFlagGalac
ticGrid();
flagSupergalacticGrid = gridManager->getFlag
SupergalacticGrid();
flagEquatorJ2000Grid = gridManager->getFlagE
quatorJ2000Grid();
flagEquatorGrid = gridManager->getFlagEquato
rGrid();
flagEquatorJ2000Line = gridManager->getFlagE
quatorJ2000Line();
flagEquatorLine = gridManager->getFlagEquato
rLine();
flagEclipticJ2000Line = gridManager->getFlag
EclipticJ2000Line();
flagEclipticLine = gridManager->getFlagEclip
ticLine();
flagEclipticJ2000Grid = gridManager->getFlag
EclipticJ2000Grid();
flagEclipticGrid = gridManager->getFlagEclip
ticGrid();
flagMeridianLine = gridManager->getFlagMerid
ianLine();
flagLongitudeLine = gridManager->getFlagLong
itudeLine();
flagHorizonLine = gridManager->getFlagHorizo
nLine();
flagGalacticEquatorLine = gridManager->getFl
agGalacticEquatorLine();
flagSupergalacticEquatorLine = gridManager->
getFlagSupergalacticEquatorLine();
flagPrimeVerticalLine = gridManager->getFlag
PrimeVerticalLine();
flagColureLines = gridManager->getFlagColure
Lines();
flagCircumpolarCircles = gridManager->getFla
gCircumpolarCircles();
flagPrecessionCircles = gridManager->getFlag
PrecessionCircles();
flagCelestialJ2000Poles = gridManager->getFl
agCelestialJ2000Poles();
flagCelestialPoles = gridManager->getFlagCel
estialPoles();
flagZenithNadirPoints = gridManager->getFlag
ZenithNadir();
flagEclipticJ2000Poles = gridManager->getFla
gEclipticJ2000Poles();
flagEclipticPoles = gridManager->getFlagEcli
pticPoles();
flagGalacticPoles = gridManager->getFlagGala
cticPoles();
flagSupergalacticPoles = gridManager->getFla
gSupergalacticPoles();
flagEquinoxJ2000Points = gridManager->getFla
gEquinoxJ2000Points();
flagEquinoxPoints = gridManager->getFlagEqui
noxPoints();
flagSolsticeJ2000Points = gridManager->getFl
agSolsticeJ2000Points();
flagSolsticePoints = gridManager->getFlagSol
sticePoints();
flagCardinalPoints = GETSTELMODULE(Landscape Mgr)->getFlagCardinalsPoints(); flagCardinalPoints = GETSTELMODULE(Landscape Mgr)->getFlagCardinalsPoints();
} }
StelSkyDrawer *skyManager = core->getSkyDrawer(); StelSkyDrawer *skyDrawer = core->getSkyDrawer();
// Current state // Current state
flagAdaptation = skyManager->getFlagLuminanceAdaptat flagAdaptation = skyDrawer->getFlagLuminanceAdaptati
ion(); on();
flagLimitStars = skyManager->getFlagStarMagnitudeLim flagLimitStars = skyDrawer->getFlagStarMagnitudeLimi
it(); t();
flagLimitPlanets = skyManager->getFlagPlanetMagnitud flagLimitPlanets = skyDrawer->getFlagPlanetMagnitude
eLimit(); Limit();
flagLimitDSOs = skyManager->getFlagNebulaMagnitudeLi flagLimitDSOs = skyDrawer->getFlagNebulaMagnitudeLim
mit(); it();
magLimitStars = skyManager->getCustomStarMagnitudeLi magLimitStars = skyDrawer->getCustomStarMagnitudeLim
mit(); it();
magLimitPlanets = skyManager->getCustomPlanetMagnitu magLimitPlanets = skyDrawer->getCustomPlanetMagnitud
deLimit(); eLimit();
magLimitDSOs = skyManager->getCustomNebulaMagnitudeL magLimitDSOs = skyDrawer->getCustomNebulaMagnitudeLi
imit(); mit();
relativeStarScaleMain = skyDrawer->getRelativeStarSc
ale();
absoluteStarScaleMain = skyDrawer->getAbsoluteStarSc
ale();
flagMoonScale = GETSTELMODULE(SolarSystem)->getFlagM oonScale(); flagMoonScale = GETSTELMODULE(SolarSystem)->getFlagM oonScale();
flipHorz = core->getFlipHorz(); flipHorz = core->getFlipHorz();
flipVert = core->getFlipVert(); flipVert = core->getFlipVert();
StelMovementMgr *movementManager = core->getMovement Mgr(); StelMovementMgr *movementManager = core->getMovement Mgr();
initialFOV = movementManager->getCurrentFov(); initialFOV = movementManager->getCurrentFov();
} }
skipping to change at line 2176 skipping to change at line 2140
{ {
//reset to original state //reset to original state
unzoomOcular(); unzoomOcular();
} }
} }
void Oculars::zoomOcular() void Oculars::zoomOcular()
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
StelSkyDrawer *skyManager = core->getSkyDrawer(); StelSkyDrawer *skyDrawer = core->getSkyDrawer();
if (flagHideGridsLines) if (flagHideGridsLines)
{ {
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInst GETSTELMODULE(GridLinesMgr)->setFlagGridlines(false);
ance().getModuleMgr().getModule("GridLinesMgr");
gridManager->setFlagAzimuthalGrid(false);
gridManager->setFlagGalacticGrid(false);
gridManager->setFlagSupergalacticGrid(false);
gridManager->setFlagEquatorJ2000Grid(false);
gridManager->setFlagEquatorGrid(false);
gridManager->setFlagEquatorJ2000Line(false);
gridManager->setFlagEquatorLine(false);
gridManager->setFlagEclipticJ2000Line(false);
gridManager->setFlagEclipticLine(false);
gridManager->setFlagEclipticJ2000Grid(false);
gridManager->setFlagEclipticGrid(false);
gridManager->setFlagMeridianLine(false);
gridManager->setFlagLongitudeLine(false);
gridManager->setFlagHorizonLine(false);
gridManager->setFlagGalacticEquatorLine(false);
gridManager->setFlagSupergalacticEquatorLine(false);
gridManager->setFlagPrimeVerticalLine(false);
gridManager->setFlagColureLines(false);
gridManager->setFlagCircumpolarCircles(false);
gridManager->setFlagPrecessionCircles(false);
gridManager->setFlagCelestialJ2000Poles(false);
gridManager->setFlagCelestialPoles(false);
gridManager->setFlagZenithNadir(false);
gridManager->setFlagEclipticJ2000Poles(false);
gridManager->setFlagEclipticPoles(false);
gridManager->setFlagGalacticPoles(false);
gridManager->setFlagSupergalacticPoles(false);
gridManager->setFlagEquinoxJ2000Points(false);
gridManager->setFlagEquinoxPoints(false);
gridManager->setFlagSolsticeJ2000Points(false);
gridManager->setFlagSolsticePoints(false);
GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(false); GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(false);
} }
skyManager->setFlagLuminanceAdaptation(false); skyDrawer->setFlagLuminanceAdaptation(false);
GETSTELMODULE(SolarSystem)->setFlagMoonScale(false); GETSTELMODULE(SolarSystem)->setFlagMoonScale(false);
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
movementManager->setFlagEnableZoomKeys(false); movementManager->setFlagEnableZoomKeys(false);
movementManager->setFlagEnableMouseNavigation(false); movementManager->setFlagEnableMouseNavigation(false);
// 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), movementManager->mountFrameToJ2000(Vec3d(0., 0., 1.)), 0.0, StelMovementMgr::ZoomIn); movementManager->moveToJ2000(selectedObject->getEquinoxEquat orialPos(core), movementManager->mountFrameToJ2000(Vec3d(0., 0., 1.)), 0.0, StelMovementMgr::ZoomIn);
} }
// Set the screen display // Set the screen display
Ocular * ocular = oculars[selectedOcularIndex]; Ocular * ocular = oculars[selectedOcularIndex];
Telescope * telescope = NULL; Telescope * telescope = Q_NULLPTR;
Lens * lens = NULL; Lens * lens = Q_NULLPTR;
// 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) if (selectedLensIndex >= 0)
{ {
lens = lense[selectedLensIndex]; lens = lenses[selectedLensIndex];
} }
telescope = telescopes[selectedTelescopeIndex]; telescope = telescopes[selectedTelescopeIndex];
core->setFlipHorz(telescope->isHFlipped()); core->setFlipHorz(telescope->isHFlipped());
core->setFlipVert(telescope->isVFlipped()); core->setFlipVert(telescope->isVFlipped());
} }
// Limit stars and DSOs if it enable and it's telescope + eyepiece c // Change relative and absolute scales for stars
ombination relativeStarScaleMain=skyDrawer->getRelativeStarScale();
skyDrawer->setRelativeStarScale(relativeStarScaleOculars);
absoluteStarScaleMain=skyDrawer->getAbsoluteStarScale();
skyDrawer->setAbsoluteStarScale(absoluteStarScaleOculars);
// Limit stars and DSOs if enabled and it's telescope + eyepiece com
bination
if (getFlagLimitMagnitude()) if (getFlagLimitMagnitude())
{ {
// Simplified calculation of the penetrating power of the te lescope // Simplified calculation of the penetrating power of the te lescope
double diameter = 0.; double diameter = 0.;
if (ocular->isBinoculars()) if (ocular->isBinoculars())
diameter = ocular->fieldStop(); diameter = ocular->fieldStop();
else else
diameter = telescope!=NULL ? telescope->diameter() : diameter = telescope!=Q_NULLPTR ? telescope->diamete
0.; // Avoid a potential call of null pointer r() : 0.; // Avoid a potential call of null pointer
double limitMag = 2.1 + 5*std::log10(diameter); double limitMag = 2.1 + 5*std::log10(diameter); // TODO: doc
ument source of this formula!
skyManager->setFlagStarMagnitudeLimit(true); skyDrawer->setFlagStarMagnitudeLimit(true);
skyManager->setFlagNebulaMagnitudeLimit(true); skyDrawer->setFlagNebulaMagnitudeLimit(true);
skyManager->setCustomStarMagnitudeLimit(limitMag); skyDrawer->setCustomStarMagnitudeLimit(limitMag);
skyManager->setCustomNebulaMagnitudeLimit(limitMag); skyDrawer->setCustomNebulaMagnitudeLimit(limitMag);
} }
actualFOV = ocular->actualFOV(telescope, lens); 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);
} }
skipping to change at line 2292 skipping to change at line 2229
{ {
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() Lens* Oculars::selectedLens()
{ {
if (selectedLensIndex >= 0 && selectedLensIndex < lense.count()) if (selectedLensIndex >= 0 && selectedLensIndex < lenses.count())
{ {
return lense[selectedLensIndex]; return lenses[selectedLensIndex];
} }
return NULL; return Q_NULLPTR;
} }
QMenu* Oculars::addLensSubmenu(QMenu* parent) QMenu* Oculars::addLensSubmenu(QMenu* parent)
{ {
Q_ASSERT(parent); Q_ASSERT(parent);
QMenu *submenu = new QMenu(q_("&Lens"), parent); QMenu *submenu = new QMenu(q_("&Lens"), parent);
submenu->addAction(q_("&Previous lens"), this, SLOT(decrementLensInd ex())); submenu->addAction(q_("&Previous lens"), this, SLOT(decrementLensInd ex()));
submenu->addAction(q_("&Next lens"), this, SLOT(incrementLensIndex() )); submenu->addAction(q_("&Next lens"), this, SLOT(incrementLensIndex() ));
submenu->addSeparator(); submenu->addSeparator();
submenu->addAction(q_("None"), this, SLOT(disableLens())); submenu->addAction(q_("None"), this, SLOT(disableLens()));
for (int index = 0; index < lense.count(); ++index) for (int index = 0; index < lenses.count(); ++index)
{ {
QString label; QString label;
if (index < 10) if (index < 10)
{ {
label = QString("&%1: %2").arg(index).arg(lense[inde x]->getName()); label = QString("&%1: %2").arg(index).arg(lenses[ind ex]->getName());
} }
else else
{ {
label = lense[index]->getName(); label = lenses[index]->getName();
} }
QAction* action = submenu->addAction(label, lenseSignalMappe r, SLOT(map())); QAction* action = submenu->addAction(label, lensesSignalMapp er, SLOT(map()));
if (index == selectedLensIndex) if (index == selectedLensIndex)
{ {
action->setCheckable(true); action->setCheckable(true);
action->setChecked(true); action->setChecked(true);
} }
lenseSignalMapper->setMapping(action, QString("%1").arg(inde x)); lensesSignalMapper->setMapping(action, QString("%1").arg(ind ex));
} }
return submenu; 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()));
skipping to change at line 2430 skipping to change at line 2367
} }
} }
bool Oculars::getFlagAutosetMountForCCD() const bool Oculars::getFlagAutosetMountForCCD() const
{ {
return flagAutosetMountForCCD; return flagAutosetMountForCCD;
} }
void Oculars::setFlagUseSemiTransparency(const bool b) void Oculars::setFlagUseSemiTransparency(const bool b)
{ {
flagSemiTransporency = b; flagSemiTransparency = b;
settings->setValue("use_semi_transparency", b); settings->setValue("use_semi_transparency", b);
settings->sync(); settings->sync();
} }
bool Oculars::getFlagUseSemiTransparency() const bool Oculars::getFlagUseSemiTransparency() const
{ {
return flagSemiTransporency; return flagSemiTransparency;
} }
void Oculars::setFlagHideGridsLines(const bool b) void Oculars::setFlagHideGridsLines(const bool b)
{ {
flagHideGridsLines = b; if (b != flagHideGridsLines)
settings->setValue("hide_grids_and_lines", b); {
settings->sync(); flagHideGridsLines = b;
settings->setValue("hide_grids_and_lines", b);
settings->sync();
emit hideGridsLinesChanged(b);
if (b && flagShowOculars)
{
// Store current state for later resetting
flagGridlinesDisplayedMain=GETSTELMODULE(GridLinesMg
r)->getFlagGridlines();
flagCardinalPoints = GETSTELMODULE(LandscapeMgr)->ge
tFlagCardinalsPoints();
GETSTELMODULE(GridLinesMgr)->setFlagGridlines(false)
;
GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(
false);
}
else if (!b && flagShowOculars)
{
// Restore main program state
GETSTELMODULE(GridLinesMgr)->setFlagGridlines(flagGr
idlinesDisplayedMain);
GETSTELMODULE(LandscapeMgr)->setFlagCardinalsPoints(
flagCardinalPoints);
}
}
} }
bool Oculars::getFlagHideGridsLines() const bool Oculars::getFlagHideGridsLines() const
{ {
return flagHideGridsLines; return flagHideGridsLines;
} }
QString Oculars::getDimensionsString(double fovX, double fovY) const QString Oculars::getDimensionsString(double fovX, double fovY) const
{ {
QString stringFovX, stringFovY; QString stringFovX, stringFovY;
 End of changes. 69 change blocks. 
287 lines changed or deleted 219 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/