Oculars.cpp   Oculars.cpp 
/* /*
* Copyright (C) 2009 Timothy Reaves * Copyright (C) 2009 Timothy Reaves
* Copyright (C) 2011 Bogdan Marinov
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2 * as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version. * of the License, or (at your option) any later version.
* *
* This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#include "Oculars.hpp" #include "Oculars.hpp"
#include "OcularsGuiPanel.hpp"
#include "GridLinesMgr.hpp" #include "GridLinesMgr.hpp"
#include "LabelMgr.hpp" #include "LabelMgr.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelObjectMgr.hpp" #include "StelObjectMgr.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "StelProjector.hpp" #include "StelProjector.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelGuiItems.hpp" #include "StelGuiItems.hpp"
#include "StelMainWindow.hpp" #include "StelMainWindow.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "SkyGui.hpp"
#include <QAction> #include <QAction>
#include <QGraphicsWidget>
#include <QKeyEvent> #include <QKeyEvent>
#include <QDebug> #include <QDebug>
#include <QMenu> #include <QMenu>
#include <QMouseEvent> #include <QMouseEvent>
#include <QtNetwork> #include <QtNetwork>
#include <QPixmap> #include <QPixmap>
#include <QSignalMapper> #include <QSignalMapper>
#include <cmath> #include <cmath>
#if defined(__APPLE__) && defined(__MACH__) #if defined(__APPLE__) && defined(__MACH__)
#include <OpenGL/glu.h> /* Header File For The GLU Library */ #include <OpenGL/glu.h> /* Header File For The GLU Library */
#else #else
#include <GL/glu.h> /* Header File For The GLU Library */ #include <GL/glu.h> /* Header File For The GLU Library */
#endif #endif
#ifdef Q_WS_MAC
extern void qt_set_sequence_auto_mnemonic(bool b);
#endif
static QSettings *settings; //!< The settings as read in from the ini file. static QSettings *settings; //!< The settings as read in from the ini file.
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark StelModuleMgr Methods #pragma mark StelModuleMgr Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
//! This method is the one called automatically by the StelModuleMgr just //! This method is the one called automatically by the StelModuleMgr just
//! after loading the dynamic library //! after loading the dynamic library
skipping to change at line 76 skipping to change at line 84
return new Oculars(); return new Oculars();
} }
StelPluginInfo OcularsStelPluginInterface::getPluginInfo() const StelPluginInfo OcularsStelPluginInterface::getPluginInfo() const
{ {
// Allow to load the resources when used as a static plugin // Allow to load the resources when used as a static plugin
Q_INIT_RESOURCE(Oculars); Q_INIT_RESOURCE(Oculars);
StelPluginInfo info; StelPluginInfo info;
info.id = "Oculars"; info.id = "Oculars";
info.displayedName = q_("Oculars"); info.displayedName = N_("Oculars");
info.authors = "Timothy Reaves"; info.authors = "Timothy Reaves, Bogdan Marinov";
info.contact = "treaves@silverfieldstech.com"; info.contact = "treaves@silverfieldstech.com";
info.description = q_("Shows the sky as if looking through a telesco pe eyepiece"); info.description = N_("Shows the sky as if looking through a telesco pe eyepiece. (Only magnification and field of view are simulated.) It can a lso show a sensor frame and a Telrad sight.");
return info; return info;
} }
Q_EXPORT_PLUGIN2(Oculars, OcularsStelPluginInterface) Q_EXPORT_PLUGIN2(Oculars, OcularsStelPluginInterface)
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Instance Methods #pragma mark Instance Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
Oculars::Oculars() : pxmapGlow(NULL), pxmapOnIcon(NULL), pxmapOffIcon(NULL) Oculars::Oculars():
, toolbarButton(NULL) pxmapGlow(NULL),
pxmapOnIcon(NULL),
pxmapOffIcon(NULL),
toolbarButton(NULL),
actionShowOcular(0),
actionShowCrosshairs(0),
actionShowSensor(0),
actionShowTelrad(0),
guiPanel(0)
{ {
flagShowCCD = false; flagShowCCD = false;
flagShowOculars = false; flagShowOculars = false;
flagShowCrosshairs = false; flagShowCrosshairs = false;
flagShowTelrad = false; flagShowTelrad = false;
ready = false; ready = false;
requireSelection = true; requireSelection = true;
useMaxEyepieceAngle = true; useMaxEyepieceAngle = true;
font.setPixelSize(14); font.setPixelSize(14);
skipping to change at line 120 skipping to change at line 137
telescopesSignalMapper = new QSignalMapper(this); telescopesSignalMapper = new QSignalMapper(this);
selectedCCDIndex = -1; selectedCCDIndex = -1;
selectedOcularIndex = -1; selectedOcularIndex = -1;
selectedTelescopeIndex = -1; selectedTelescopeIndex = -1;
usageMessageLabelID = -1; usageMessageLabelID = -1;
setObjectName("Oculars"); setObjectName("Oculars");
#ifdef Q_WS_MAC
qt_set_sequence_auto_mnemonic(true);
#endif
} }
Oculars::~Oculars() Oculars::~Oculars()
{ {
delete ocularDialog; delete ocularDialog;
ocularDialog = NULL; ocularDialog = NULL;
if (guiPanel)
delete guiPanel;
if (pxmapGlow)
delete pxmapGlow;
if (pxmapOnIcon)
delete pxmapOnIcon;
if (pxmapOffIcon)
delete pxmapOffIcon;
qDeleteAll(ccds);
ccds.clear();
qDeleteAll(telescopes);
telescopes.clear();
qDeleteAll(oculars);
oculars.clear();
} }
QSettings* Oculars::appSettings() QSettings* Oculars::appSettings()
{ {
return settings; return settings;
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
skipping to change at line 198 skipping to change at line 234
settings->setValue("ccd_count", ccds.count()); settings->setValue("ccd_count", ccds.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) void Oculars::draw(StelCore* core)
{ {
if (flagShowTelrad) { if (flagShowTelrad) {
paintTelrad(); paintTelrad();
} else if (flagShowOculars){ } else if (flagShowOculars){
// Insure there is a selected ocular & telescope // Ensure there is a selected ocular & telescope
if (selectedCCDIndex > ccds.count()) { if (selectedCCDIndex > ccds.count()) {
qWarning() << "Oculars: the selected sensor index of " qWarning() << "Oculars: the selected sensor index of "
<< selectedCCDIndex << " i s greater than the sensor count of " << selectedCCDIndex << " i s greater than the sensor count of "
<< ccds.count() << ". Module disabled!"; << ccds.count() << ". Module disabled!";
ready = false; ready = false;
} }
if (selectedOcularIndex > oculars.count()) { if (selectedOcularIndex > oculars.count()) {
qWarning() << "Oculars: the selected ocular index of " qWarning() << "Oculars: the selected ocular index of "
<< selectedOcularIndex << " is greater than the ocular count of " << selectedOcularIndex << " is greater than the ocular count of "
<< oculars.count() << ". Module disabled!"; << oculars.count() << ". Module disabled!";
skipping to change at line 225 skipping to change at line 261
ready = false; ready = false;
} }
if (ready) { if (ready) {
if (selectedOcularIndex > -1) { if (selectedOcularIndex > -1) {
paintOcularMask(); paintOcularMask();
if (flagShowCrosshairs) { if (flagShowCrosshairs) {
paintCrosshairs(); paintCrosshairs();
} }
} }
// Paint the information in the upper-right hand cor if (guiPanelEnabled)
ner {
paintText(core); // Reset the state to allow the panel to be
painted normally
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_A
LPHA);
glEnable(GL_BLEND);
}
else
{
// Paint the information in the upper-right
hand corner
paintText(core);
}
} }
} else if (flagShowCCD) { } else if (flagShowCCD) {
paintCCDBounds(); paintCCDBounds();
// Paint the information in the upper-right hand corner if (guiPanelEnabled)
paintText(core); {
// Reset the state to allow the panel to be painted
normally
glDisable(GL_TEXTURE_2D);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);
}
else
{
// Paint the information in the upper-right hand cor
ner
paintText(core);
}
} }
} }
//! Determine which "layer" the plagin's drawing will happen on. //! Determine which "layer" the plugin's drawing will happen on.
double Oculars::getCallOrder(StelModuleActionName actionName) const double Oculars::getCallOrder(StelModuleActionName actionName) const
{ {
// TODO; this really doesn't seem to have any effect. I've tried ev erything from -100 to +100, // TODO; this really doesn't seem to have any effect. I've tried ev erything from -100 to +100,
// and a calculated value. It all seems to work the sa me regardless. // and a calculated value. It all seems to work the sa me regardless.
double order = 1000.0; double order = 1000.0;
if (actionName==StelModule::ActionHandleKeys || actionName==StelModu le::ActionHandleMouseMoves) if (actionName==StelModule::ActionHandleKeys || actionName==StelModu le::ActionHandleMouseMoves)
{ {
order = StelApp::getInstance().getModuleMgr().getModule("Ste lMovementMgr")->getCallOrder(actionName) - 1.0; order = StelApp::getInstance().getModuleMgr().getModule("Ste lMovementMgr")->getCallOrder(actionName) - 1.0;
} }
else if (actionName==StelModule::ActionDraw) else if (actionName==StelModule::ActionDraw)
skipping to change at line 274 skipping to change at line 330
void Oculars::handleMouseClicks(class QMouseEvent* event) void Oculars::handleMouseClicks(class QMouseEvent* event)
{ {
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr(); StelMovementMgr *movementManager = core->getMovementMgr();
if (StelApp::getInstance().getStelObjectMgr().getWasSelected()){ if (StelApp::getInstance().getStelObjectMgr().getWasSelected()){
if (flagShowOculars) { if (flagShowOculars) {
// center the selected object in the ocular, and tra ck. // center the selected object in the ocular, and tra ck.
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
} else { } else {
// remove the usage label if it is being displayed. // remove the usage label if it is being displayed.
if (usageMessageLabelID > -1) { hideUsageMessageIfDisplayed();
LabelMgr *labelManager = GETSTELMODULE(Label
Mgr);
labelManager->setLabelShow(usageMessageLabel
ID, false);
labelManager->deleteLabel(usageMessageLabelI
D);
usageMessageLabelID = -1;
}
} }
} else if(flagShowOculars) { } else if(flagShowOculars) {
//TODO: this is broke in Stellarium. //TODO: this is broke in Stellarium.
// The ocular is displayed, but no object is selected. So d on't track the stars. We may have locked // The ocular is displayed, but no object is selected. So d on't track the stars. We may have locked
// the position of the screen if the movement keys were used . so call this to be on the safe side. // the position of the screen if the movement keys were used . so call this to be on the safe side.
movementManager->setFlagLockEquPos(false); movementManager->setFlagLockEquPos(false);
// Do we need to set this? // Do we need to set this?
// movementManager->setFlagTracking(false); // movementManager->setFlagTracking(false);
} }
event->setAccepted(false); event->setAccepted(false);
skipping to change at line 452 skipping to change at line 503
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(&ccds, &oculars, &telescopes ); ocularDialog = new OcularDialog(this, &ccds, &oculars, &tele scopes);
initializeActivationActions(); initializeActivationActions();
determineMaxEyepieceAngle(); determineMaxEyepieceAngle();
guiPanelEnabled = settings->value("enable_control_panel", fa
lse).toBool();
enableGuiPanel(guiPanelEnabled);
} 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;
} }
//Load the module's custom style sheets //Load the module's custom style sheets
QFile styleSheetFile; QFile styleSheetFile;
styleSheetFile.setFileName(":/ocular/normalStyle.css"); styleSheetFile.setFileName(":/ocular/normalStyle.css");
if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) { if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) {
normalStyleSheet = styleSheetFile.readAll(); normalStyleSheet = styleSheetFile.readAll();
} }
styleSheetFile.close(); styleSheetFile.close();
styleSheetFile.setFileName(":/ocular/nightStyle.css"); styleSheetFile.setFileName(":/ocular/nightStyle.css");
if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) { if(styleSheetFile.open(QFile::ReadOnly|QFile::Text)) {
nightStyleSheet = styleSheetFile.readAll(); nightStyleSheet = styleSheetFile.readAll();
} }
styleSheetFile.close(); styleSheetFile.close();
connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QSt ring&)), connect(&StelApp::getInstance(), SIGNAL(colorSchemeChanged(const QSt ring&)),
this, SLOT(setStelStyle(const QString&))); this, SLOT(setStelStyle(const QString&)));
connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
this, SLOT(retranslateGui()));
} }
void Oculars::setStelStyle(const QString&) void Oculars::setStelStyle(const QString&)
{ {
if(ocularDialog) { if(ocularDialog) {
ocularDialog->updateStyle(); ocularDialog->updateStyle();
} }
} }
/* ********************************************************************* */ /* ********************************************************************* */
skipping to change at line 540 skipping to change at line 597
double actualFOVx = ccds[selectedCCDIndex]->getActualFOVx(te lescopes[selectedTelescopeIndex]); double actualFOVx = ccds[selectedCCDIndex]->getActualFOVx(te lescopes[selectedTelescopeIndex]);
double actualFOVy = ccds[selectedCCDIndex]->getActualFOVy(te lescopes[selectedTelescopeIndex]); double actualFOVy = ccds[selectedCCDIndex]->getActualFOVy(te lescopes[selectedTelescopeIndex]);
if (actualFOVx < actualFOVy) { if (actualFOVx < actualFOVy) {
actualFOVx = actualFOVy; actualFOVx = actualFOVy;
} }
movementManager->setFlagTracking(true); movementManager->setFlagTracking(true);
movementManager->zoomTo(actualFOVx * 3.0, 0.0); movementManager->zoomTo(actualFOVx * 3.0, 0.0);
} }
} }
void Oculars::enableGuiPanel(bool enable)
{
if (enable)
{
if (!guiPanel)
{
StelApp& app = StelApp::getInstance();
StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
Q_ASSERT(gui);
guiPanel = new OcularsGuiPanel(this, gui->getSkyGui(
));
if (flagShowOculars)
guiPanel->showOcularGui();
else if (flagShowCCD)
guiPanel->showCcdGui();
}
}
else
{
if (guiPanel)
{
guiPanel->hide();
delete guiPanel;
guiPanel = 0;
}
}
guiPanelEnabled = enable;
settings->setValue("enable_control_panel", enable);
settings->sync();
}
void Oculars::retranslateGui()
{
if (guiPanel)
{
// TODO: Fix this hack!
// Delete and re-create the panel to retranslate its trings
guiPanel->hide();
delete guiPanel;
guiPanel = 0;
StelApp& app = StelApp::getInstance();
StelGui* gui = dynamic_cast<StelGui*>(app.getGui());
Q_ASSERT(gui);
guiPanel = new OcularsGuiPanel(this, gui->getSkyGui());
if (flagShowOculars)
guiPanel->showOcularGui();
else if (flagShowCCD)
guiPanel->showCcdGui();
}
}
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Slots Methods #pragma mark Slots Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void Oculars::updateLists()
{
if (oculars.isEmpty())
{
selectedOcularIndex = -1;
actionShowOcular->setChecked(false);
}
else
{
if (selectedOcularIndex >= oculars.count())
selectedOcularIndex = oculars.count() - 1;
if (flagShowOculars)
emit selectedOcularChanged();
}
if (telescopes.isEmpty())
{
selectedTelescopeIndex = -1;
actionShowOcular->setChecked(false);
actionShowSensor->setChecked(false);
}
else
{
if (selectedTelescopeIndex >= telescopes.count())
selectedTelescopeIndex = telescopes.count() - 1;
if (flagShowOculars || flagShowCCD)
emit selectedTelescopeChanged();
}
if (ccds.isEmpty())
{
selectedCCDIndex = -1;
actionShowSensor->setChecked(false);
}
else
{
if (selectedCCDIndex >= ccds.count())
selectedCCDIndex = ccds.count() - 1;
if (flagShowCCD)
emit selectedCCDChanged();
}
}
void Oculars::ccdRotationReset() void Oculars::ccdRotationReset()
{ {
ccdRotationAngle = 0.0; ccdRotationAngle = 0.0;
} }
void Oculars::enableOcular(bool enableOcularMode) void Oculars::enableOcular(bool enableOcularMode)
{ {
// If showing a CCD, cancel it. if (enableOcularMode)
if (flagShowCCD) { {
flagShowCCD = false; // Close the sensor view if it's displayed
selectedCCDIndex = -1; if (flagShowCCD)
} {
if (actionShowSensor->isChecked())
actionShowSensor->setChecked(false);
flagShowCCD = false;
selectedCCDIndex = -1;
}
// Close the Telrad sight if it's displayed
if (flagShowTelrad)
{
if (actionShowTelrad->isChecked())
actionShowTelrad->setChecked(false);
}
if (enableOcularMode) { // Check to ensure that we have enough oculars & telescopes,
// Check to insure that we have enough oculars & telescopes, as they may have been edited in the config dialog
as they may have been edited in the config dialog
if (oculars.count() == 0) { if (oculars.count() == 0) {
selectedOcularIndex = -1; selectedOcularIndex = -1;
qWarning() << "No oculars found"; qWarning() << "No oculars found";
} else if (oculars.count() > 0 && selectedOcularIndex == -1) { } else if (oculars.count() > 0 && selectedOcularIndex == -1) {
selectedOcularIndex = 0; selectedOcularIndex = 0;
} }
if (telescopes.count() == 0) { if (telescopes.count() == 0) {
selectedTelescopeIndex = -1; selectedTelescopeIndex = -1;
qWarning() << "No telescopes found"; qWarning() << "No telescopes found";
} else if (telescopes.count() > 0 && selectedTelescopeIndex == -1) { } else if (telescopes.count() > 0 && selectedTelescopeIndex == -1) {
skipping to change at line 583 skipping to change at line 751
} }
if (!ready || selectedOcularIndex == -1 || (selectedTelescopeIndex == -1 && !isBinocularDefined())) { if (!ready || selectedOcularIndex == -1 || (selectedTelescopeIndex == -1 && !isBinocularDefined())) {
qWarning() << "The Oculars module has been disabled."; qWarning() << "The Oculars module has been disabled.";
return; return;
} }
StelCore *core = StelApp::getInstance().getCore(); StelCore *core = StelApp::getInstance().getCore();
LabelMgr* labelManager = GETSTELMODULE(LabelMgr); LabelMgr* labelManager = GETSTELMODULE(LabelMgr);
// Toggle the plugin on & off. To toggle on, we want to ensure ther e is a selected object. // Toggle the ocular view on & off. To toggle on, we want to ensure there is a selected object.
if (!flagShowOculars && requireSelection && !StelApp::getInstance(). getStelObjectMgr().getWasSelected() ) { if (!flagShowOculars && requireSelection && !StelApp::getInstance(). getStelObjectMgr().getWasSelected() ) {
if (usageMessageLabelID == -1) { if (usageMessageLabelID == -1) {
QFontMetrics metrics(font); QFontMetrics metrics(font);
QString labelText = "Please select an object before enabling Ocular."; QString labelText = q_("Please select an object befo re switching to ocular view.");
StelProjector::StelProjectorParams projectorParams = core->getCurrentStelProjectorParams(); StelProjector::StelProjectorParams projectorParams = core->getCurrentStelProjectorParams();
int xPosition = projectorParams.viewportCenter[0]; int xPosition = projectorParams.viewportCenter[0];
xPosition = xPosition - 0.5 * (metrics.width(labelTe xt)); xPosition = xPosition - 0.5 * (metrics.width(labelTe xt));
int yPosition = projectorParams.viewportCenter[1]; int yPosition = projectorParams.viewportCenter[1];
yPosition = yPosition - 0.5 * (metrics.height()); yPosition = yPosition - 0.5 * (metrics.height());
usageMessageLabelID = labelManager->labelScreen(labe lText, xPosition, yPosition, usageMessageLabelID = labelManager->labelScreen(labe lText, xPosition, yPosition,
true, font.pixelSize(), "#99FF99"); true, font.pixelSize(), "#99FF99");
} }
// we didn't accept the new status - make sure the toolbar b utton reflects this // we didn't accept the new status - make sure the toolbar b utton reflects this
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() disconnect(actionShowOcular, SIGNAL(toggled(bool)),
.getGui()); this, SLOT(enableOcular(bool)));
Q_ASSERT(gui); actionShowOcular->setChecked(false);
disconnect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(t connect(actionShowOcular, SIGNAL(toggled(bool)),
oggled(bool)), this, SLOT(enableOcular(bool))); this, SLOT(enableOcular(bool)));
gui->getGuiActions("actionShow_Ocular")->setChecked(false);
connect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(togg
led(bool)), this, SLOT(enableOcular(bool)));
} else { } else {
if (selectedOcularIndex != -1) { if (selectedOcularIndex != -1) {
// remove the usage label if it is being displayed. // remove the usage label if it is being displayed.
if (usageMessageLabelID > -1) { hideUsageMessageIfDisplayed();
labelManager->setLabelShow(usageMessageLabel
ID, false);
labelManager->deleteLabel(usageMessageLabelI
D);
usageMessageLabelID = -1;
}
flagShowOculars = enableOcularMode; flagShowOculars = enableOcularMode;
zoom(false); zoom(false);
//BM: I hope this is the right place...
if (guiPanel)
guiPanel->showOcularGui();
} }
} }
} }
void Oculars::decrementCCDIndex() void Oculars::decrementCCDIndex()
{ {
selectedCCDIndex--; selectedCCDIndex--;
if (selectedCCDIndex == -2) { if (selectedCCDIndex == -1) {
selectedCCDIndex = ccds.count() - 1; selectedCCDIndex = ccds.count() - 1;
} }
emit(selectedCCDChanged()); emit(selectedCCDChanged());
} }
void Oculars::decrementOcularIndex() void Oculars::decrementOcularIndex()
{ {
selectedOcularIndex--; selectedOcularIndex--;
if (selectedOcularIndex == -1) { if (selectedOcularIndex == -1) {
selectedOcularIndex = oculars.count() - 1; selectedOcularIndex = oculars.count() - 1;
skipping to change at line 658 skipping to change at line 825
{ {
selectedTelescopeIndex--; selectedTelescopeIndex--;
if (selectedTelescopeIndex == -1) { if (selectedTelescopeIndex == -1) {
selectedTelescopeIndex = telescopes.count() - 1; selectedTelescopeIndex = telescopes.count() - 1;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::displayPopupMenu() void Oculars::displayPopupMenu()
{ {
QMenu* popup = new QMenu(); 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.count() > 0) { if (!oculars.isEmpty())
popup->addAction("previous ocular", this, SLOT(decre {
mentOcularIndex()), Qt::Key_1); popup->addAction(q_("&Previous ocular"), this, SLOT(
popup->addAction("next ocular", this, SLOT(increment decrementOcularIndex()));
OcularIndex()), Qt::Key_2); popup->addAction(q_("&Next ocular"), this, SLOT(incr
QMenu* submenu = new QMenu("select ocular", popup); ementOcularIndex()));
QMenu* submenu = new QMenu(q_("Select &ocular"), pop
up);
int availableOcularCount = 0; int availableOcularCount = 0;
for (int index = 0; index < oculars.count(); ++index for (int index = 0; index < oculars.count(); ++index
) { )
{
QString label;
if (availableOcularCount < 10)
{
label = QString("&%1: %2").arg(avail
ableOcularCount).arg(oculars[index]->name());
}
else
{
label = oculars[index]->name();
}
//BM: Does this happen at all any more?
QAction* action = 0;
if (selectedTelescopeIndex == -1) { if (selectedTelescopeIndex == -1) {
if (oculars[index]->isBinoculars()) { if (oculars[index]->isBinoculars()) {
QAction* action = submenu->a action = submenu->addAction(
ddAction(oculars[index]->name(), ocularsSignalMapper, SLOT(map()), label, ocularsSignalMapper, SLOT(map()));
availableOcularCount++;
QKeySe
quence(QString("%1").arg(availableOcularCount++)));
ocularsSignalMapper->setMapp ing(action, QString("%1").arg(index)); ocularsSignalMapper->setMapp ing(action, QString("%1").arg(index));
} }
} else { } else {
QAction* action = submenu->addAction action = submenu->addAction(label, o
(oculars[index]->name(), ocularsSignalMapper, SLOT(map()), cularsSignalMapper, SLOT(map()));
availableOcularCount++;
QKeySequence(Q
String("%1").arg(availableOcularCount++)));
ocularsSignalMapper->setMapping(acti on, QString("%1").arg(index)); ocularsSignalMapper->setMapping(acti on, QString("%1").arg(index));
} }
if (action && index == selectedOcularIndex)
{
action->setCheckable(true);
action->setChecked(true);
}
} }
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
if (telescopes.count() > 0 && (selectedOcularIndex > -1 && ! // If there is more than one telescope, show the prev/next/l
oculars[selectedOcularIndex]->isBinoculars())) { ist complex.
popup->addAction("previous telescope", this, SLOT(de // If the selected ocular is a binoculars, show nothing.
crementTelescopeIndex()), Qt::Key_3); if (telescopes.count() > 1 && (selectedOcularIndex > -1 && !
popup->addAction("next telescope", this, SLOT(increm oculars[selectedOcularIndex]->isBinoculars()))
entTelescopeIndex()), Qt::Key_4); {
QMenu* submenu = new QMenu("select telescope", popup QMenu* submenu = addTelescopeSubmenu(popup);
);
for (int index = 0; index < telescopes.count(); ++in
dex) {
QAction* action = submenu->addAction(telesco
pes[index]->name(), telescopesSignalMapper, SLOT(map()),
QKeySequence(QString("
%1").arg(index)));
telescopesSignalMapper->setMapping(action, Q
String("%1").arg(index));
}
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
popup->addAction("toggle crosshair", this, SLOT(toggleCrossh QAction* action = popup->addAction(q_("Toggle &crosshair"));
air()), Qt::Key_5); action->setCheckable(true);
action->setChecked(flagShowCrosshairs);
connect(action, SIGNAL(toggled(bool)),
actionShowCrosshairs, SLOT(setChecked(bool)));
} else { } else {
int outerMenuLevel = 1; // We are not in ocular mode
// We are not in Oculars mode // We want to show the CCD's, and if a CCD is selected, the
// We want to show the CCD's, and if a CCD is selected, the telescopes
Telescopes (as a CCD requires a telescope), //(as a CCD requires a telescope) and the general menu items
// and the general menu items. .
QAction* action = new QAction("Configure Oculars", popup); QAction* action = new QAction(q_("Configure &Oculars"), popu
action->setCheckable(TRUE); p);
action->setShortcut(QString("%1").arg(outerMenuLevel++)); action->setCheckable(true);
connect(action, SIGNAL(toggled(bool)), ocularDialog, SLOT(se action->setChecked(ocularDialog->visible());
tVisible(bool))); connect(action, SIGNAL(triggered(bool)),
connect(ocularDialog, SIGNAL(visibleChanged(bool)), action, ocularDialog, SLOT(setVisible(bool)));
SLOT(setChecked(bool)));
popup->addAction(action); popup->addAction(action);
popup->addSeparator(); popup->addSeparator();
if (!flagShowTelrad) { if (!flagShowTelrad) {
popup->addAction("Toggle CCD", this, SLOT(toggleCCD( QAction* action = popup->addAction(q_("Toggle &CCD")
)), QKeySequence(QString("%1").arg(outerMenuLevel++))); );
action->setCheckable(true);
action->setChecked(flagShowCCD);
connect(action, SIGNAL(toggled(bool)),
actionShowSensor, SLOT(setChecked(bool)));
} }
if (!flagShowCCD) { if (!flagShowCCD) {
popup->addAction("Toggle Telrad", this, QAction* action = popup->addAction(q_("Toggle &Telra
SLOT(toggl d"));
eTelrad()), QKeySequence(QString("%1").arg(outerMenuLevel++))); action->setCheckable(true);
action->setChecked(flagShowTelrad);
connect(action, SIGNAL(toggled(bool)),
actionShowTelrad, SLOT(setChecked(bool)));
} }
popup->addSeparator(); popup->addSeparator();
if (selectedCCDIndex > -1 && selectedTelescopeIndex > -1) { if (flagShowCCD && selectedCCDIndex > -1 && selectedTelescop
popup->addAction("previous CCD", this, eIndex > -1)
SLOT(decre {
mentCCDIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++))); popup->addAction(q_("&Previous CCD"), this, SLOT(dec
popup->addAction("next CCD", this, rementCCDIndex()));
SLOT(incre popup->addAction(q_("&Next CCD"), this, SLOT(increme
mentCCDIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++))); ntCCDIndex()));
QMenu* submenu = new QMenu("select CCD", popup); QMenu* submenu = new QMenu(q_("&Select CCD"), popup)
for (int index = 0; index < ccds.count(); ++index) { ;
QAction* action = submenu->addAction(ccds[in for (int index = 0; index < ccds.count(); ++index)
dex]->name(), ccdsSignalMapper, SLOT(map()), {
QString label;
QKeySequence(QString(" if (index < 10)
%1").arg(index))); {
label = QString("&%1: %2").arg(index
).arg(ccds[index]->name());
}
else
{
label = ccds[index]->name();
}
QAction* action = submenu->addAction(label,
ccdsSignalMapper, SLOT(map()));
if (index == selectedCCDIndex)
{
action->setCheckable(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("Rotate CCD", popup); submenu = new QMenu(q_("&Rotate CCD"), popup);
QAction* rotateAction = NULL; QAction* rotateAction = NULL;
rotateAction = submenu->addAction(QString("-90") + Q rotateAction = submenu->addAction(QString("&1: -90")
Char(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_1);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-90")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-90"));
rotateAction = submenu->addAction(QString("-45") + Q rotateAction = submenu->addAction(QString("&2: -45")
Char(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_2);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-45")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-45"));
rotateAction = submenu->addAction(QString("-15") + Q rotateAction = submenu->addAction(QString("&3: -15")
Char(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_3);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-15")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-15"));
rotateAction = submenu->addAction(QString("-5") + QC rotateAction = submenu->addAction(QString("&4: -5")
har(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_4);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-5")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-5"));
rotateAction = submenu->addAction(QString("-1") + QC rotateAction = submenu->addAction(QString("&5: -1")
har(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_5);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-1")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("-1"));
rotateAction = submenu->addAction(QString("+1") + QC rotateAction = submenu->addAction(QString("&6: +1")
har(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_6);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("1")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("1"));
rotateAction = submenu->addAction(QString("+5") + QC rotateAction = submenu->addAction(QString("&7: +5")
har(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_7);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("5")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("5"));
rotateAction = submenu->addAction(QString("+15") + Q rotateAction = submenu->addAction(QString("&8: +15")
Char(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_8);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("15")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("15"));
rotateAction = submenu->addAction(QString("+45") + Q rotateAction = submenu->addAction(QString("&9: +45")
Char(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_9);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("45")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("45"));
rotateAction = submenu->addAction(QString("+90") + Q rotateAction = submenu->addAction(QString("&0: +90")
Char(0x00B0), + QChar(0x00B0),
ccdRotationSignalMapper, SLOT(map()), ccdRotationSignalMapper, SLOT(map()));
Qt::Key_0);
ccdRotationSignalMapper->setMapping(rotateAction, QS tring("90")); ccdRotationSignalMapper->setMapping(rotateAction, QS tring("90"));
rotateAction = submenu->addAction("Reset", this, SLO T(ccdRotationReset()), Qt::Key_R); rotateAction = submenu->addAction(q_("&Reset rotatio n"), this, SLOT(ccdRotationReset()));
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
if (selectedCCDIndex > -1 && telescopes.count() > 0) { if (flagShowCCD && selectedCCDIndex > -1 && telescopes.count
popup->addAction("previous telescope", this, () > 1)
SLOT(decre {
mentTelescopeIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++))); QMenu* submenu = addTelescopeSubmenu(popup);
popup->addAction("next telescope", this,
SLOT(incre
mentTelescopeIndex()), QKeySequence(QString("%1").arg(outerMenuLevel++)));
QMenu* submenu = new QMenu("select telescope", popup
);
for (int index = 0; index < telescopes.count(); ++in
dex) {
QAction* action = submenu->addAction(telesco
pes[index]->name(), telescopesSignalMapper, SLOT(map()),
QKeySequence(QString("
%1").arg(index)));
telescopesSignalMapper->setMapping(action, Q
String("%1").arg(index));
}
popup->addMenu(submenu); popup->addMenu(submenu);
popup->addSeparator(); popup->addSeparator();
} }
} }
popup->exec(QCursor::pos()); popup->exec(QCursor::pos());
delete popup; delete popup;
} }
void Oculars::incrementCCDIndex() void Oculars::incrementCCDIndex()
{ {
selectedCCDIndex++; selectedCCDIndex++;
if (selectedCCDIndex == ccds.count()) { if (selectedCCDIndex == ccds.count()) {
selectedCCDIndex = -1; selectedCCDIndex = 0;
} }
emit(selectedCCDChanged()); emit(selectedCCDChanged());
} }
void Oculars::incrementOcularIndex() void Oculars::incrementOcularIndex()
{ {
selectedOcularIndex++; selectedOcularIndex++;
if (selectedOcularIndex == oculars.count()) { if (selectedOcularIndex == oculars.count()) {
selectedOcularIndex = 0; selectedOcularIndex = 0;
} }
skipping to change at line 837 skipping to change at line 1033
selectedTelescopeIndex++; selectedTelescopeIndex++;
if (selectedTelescopeIndex == telescopes.count()) { if (selectedTelescopeIndex == telescopes.count()) {
selectedTelescopeIndex = 0; selectedTelescopeIndex = 0;
} }
emit(selectedTelescopeChanged()); emit(selectedTelescopeChanged());
} }
void Oculars::rotateCCD(QString amount) void Oculars::rotateCCD(QString amount)
{ {
ccdRotationAngle += amount.toInt(); ccdRotationAngle += amount.toInt();
if (ccdRotationAngle >= 360)
ccdRotationAngle -= 360;
if (ccdRotationAngle <= -360)
ccdRotationAngle += 360;
} }
void Oculars::selectCCDAtIndex(QString indexString) void Oculars::selectCCDAtIndex(QString indexString)
{ {
int index = indexString.toInt(); int index = indexString.toInt();
if (index > -2 && index < ccds.count()) { if (index > -2 && index < ccds.count()) {
selectedCCDIndex = index; selectedCCDIndex = index;
emit(selectedCCDChanged()); emit(selectedCCDChanged());
} }
} }
skipping to change at line 878 skipping to change at line 1078
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::toggleCCD() void Oculars::toggleCCD(bool show)
{ {
StelCore *core = StelApp::getInstance().getCore(); //If there are no sensors...
StelMovementMgr *movementManager = core->getMovementMgr(); if (ccds.isEmpty() || telescopes.isEmpty())
if (flagShowCCD) { {
//TODO: BM: Make this an on-screen message and/or disable th
e button
//if there are no sensors.
if (show)
qWarning() << "Oculars plugin: Unable to display a s
ensor boundary:"
<< "No sensors or telescopes are defined.
";
flagShowCCD = false; flagShowCCD = false;
selectedCCDIndex = -1; selectedCCDIndex = -1;
movementManager->zoomTo(movementManager->getInitFov()); show = false;
movementManager->setFlagTracking(false); if (actionShowSensor->isChecked())
} else { actionShowSensor->setChecked(false);
// Check to insure that we have enough CCDs & telescopes, as }
they may have been edited in the config dialog
if (ccds.count() == 0) { if (show)
selectedCCDIndex = -1; {
qDebug() << "No CCDs found"; //Mutually exclusive with the ocular mode
} else if (ccds.count() > 0 && selectedCCDIndex == -1) { hideUsageMessageIfDisplayed();
selectedCCDIndex = 0; if (flagShowOculars)
} {
if (telescopes.count() == 0) { if (actionShowOcular->isChecked())
selectedTelescopeIndex = -1; actionShowOcular->setChecked(false);
qDebug() << "No telescopes found";
} else if (telescopes.count() > 0 && selectedTelescopeIndex
== -1) {
selectedTelescopeIndex = 0;
} }
if (!ready || selectedCCDIndex == -1 || selectedTelescopeIn
dex == -1 ) { if (flagShowTelrad)
qDebug() << "The Oculars module has been disabled."; {
return; if (actionShowTelrad->isChecked())
actionShowTelrad->setChecked(false);
} }
if (selectedTelescopeIndex < 0)
selectedTelescopeIndex = 0;
if (selectedCCDIndex < 0)
selectedCCDIndex = 0;
flagShowCCD = true; flagShowCCD = true;
setScreenFOVForCCD(); setScreenFOVForCCD();
if (guiPanel)
guiPanel->showCcdGui();
}
else
{
flagShowCCD = false;
//Zoom out
StelCore *core = StelApp::getInstance().getCore();
StelMovementMgr *movementManager = core->getMovementMgr();
movementManager->zoomTo(movementManager->getInitFov());
movementManager->setFlagTracking(false);
if (guiPanel)
guiPanel->foldGui();
}
}
void Oculars::toggleCCD()
{
if (flagShowCCD)
toggleCCD(false);
else
toggleCCD(true);
}
void Oculars::toggleCrosshairs(bool show)
{
if (show && flagShowOculars)
{
flagShowCrosshairs = true;
}
else
{
flagShowCrosshairs = false;
} }
} }
void Oculars::toggleCrosshair() void Oculars::toggleTelrad(bool show)
{ {
flagShowCrosshairs = !flagShowCrosshairs; if (show)
{
hideUsageMessageIfDisplayed();
if (actionShowOcular->isChecked())
actionShowOcular->setChecked(false);
if (actionShowSensor->isChecked())
actionShowSensor->setChecked(false);
}
flagShowTelrad = show;
} }
void Oculars::toggleTelrad() void Oculars::toggleTelrad()
{ {
flagShowTelrad = !flagShowTelrad; if (flagShowTelrad)
toggleTelrad(false);
else
toggleTelrad(true);
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Private Methods #pragma mark Private Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void Oculars::initializeActivationActions() void Oculars::initializeActivationActions()
{ {
skipping to change at line 940 skipping to change at line 1197
//Bogdan: Temporary, for consistency and to avoid confusing the tran slators //Bogdan: Temporary, for consistency and to avoid confusing the tran slators
//TODO: Fix this when the key bindings feature is implemented //TODO: Fix this when the key bindings feature is implemented
//QString group = N_("Oculars Plugin"); //QString group = N_("Oculars Plugin");
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
Q_ASSERT(gui); Q_ASSERT(gui);
//This action needs to be connected to the enableOcular() slot after //This action needs to be connected to the enableOcular() slot after
//the necessary button is created to prevent the button from being c hecked //the necessary button is created to prevent the button from being c hecked
//the first time this action is checked. See: //the first time this action is checked. See:
//http://doc.qt.nokia.com/4.7/signalsandslots.html#signals //http://doc.qt.nokia.com/4.7/signalsandslots.html#signals
gui->addGuiActions("actionShow_Ocular", QString shortcutStr = settings->value("bindings/toggle_oculars", "Ct
N_("Ocular view"), rl+O").toString();
settings->value("bi actionShowOcular = gui->addGuiActions("actionShow_Ocular",
ndings/toggle_oculars", "Ctrl+O").toString(), N_("Ocular view"),
N_("Plugin Key Bind shortcutStr,
ings"), group,
true); true);
gui->getGuiActions("actionShow_Ocular")->setChecked(flagShowOculars) actionShowOcular->setChecked(flagShowOculars);
;
// 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, toolbarButton = new StelButton(NULL,
*pxmapOnIcon, *pxmapOnIcon,
*pxmapOffIcon, *pxmapOffIcon,
*pxmapGlow, *pxmapGlow,
gui->getGuiActions("actionShow_Ocular")); actionShowOcular);
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();
} }
connect(gui->getGuiActions("actionShow_Ocular"), SIGNAL(toggled(bool connect(actionShowOcular, SIGNAL(toggled(bool)),
)), this, SLOT(enableOcular(bool))); this, SLOT(enableOcular(bool)));
gui->addGuiActions("actionShow_Ocular_Menu", shortcutStr = settings->value("bindings/popup_navigator", "Alt+O").t
N_("Oculars popup m oString();
enu"), actionMenu = gui->addGuiActions("actionShow_Ocular_Menu",
settings->value("bi N_("Oculars popup menu"),
ndings/popup_navigator", "Alt+O").toString(), shortcutStr,
group, group,
true); true);
connect(gui->getGuiActions("actionShow_Ocular_Menu"), SIGNAL(toggled connect(actionMenu, SIGNAL(toggled(bool)),
(bool)), this, SLOT(displayPopupMenu())); this, SLOT(displayPopupMenu()));
actionShowCrosshairs = gui->addGuiActions("actionShow_Ocular_Crossha
irs",
N_("Crosshairs"),
QString(),
group,
true);
connect(actionShowCrosshairs, SIGNAL(toggled(bool)),
this, SLOT(toggleCrosshairs(bool)));
actionShowSensor = gui->addGuiActions("actionShow_Sensor",
N_("Image sensor frame"),
QString(),
group,
true);
connect(actionShowSensor, SIGNAL(toggled(bool)),
this, SLOT(toggleCCD(bool)));
actionShowTelrad = gui->addGuiActions("actionShow_Telrad",
N_("Telrad sight"),
QString(),
group,
true);
connect(actionShowTelrad, SIGNAL(toggled(bool)),
this, SLOT(toggleTelrad(bool)));
actionConfiguration = gui->addGuiActions("actionOpen_Oculars_Configu
ration",
N_("Oculars plugin configur
ation"),
QString(),
group,
true);
connect(actionConfiguration, SIGNAL(toggled(bool)),
ocularDialog, SLOT(setVisible(bool)));
connect(ocularDialog, SIGNAL(visibleChanged(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(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)));
skipping to change at line 1067 skipping to change at line 1362
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] + length); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] + length);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] - length); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] , centerScreen[1] - length);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] + length, centerScreen[1]); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] + length, centerScreen[1]);
painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] - length, centerScreen[1]); painter.drawLine2d(centerScreen[0], centerScreen[1], centerScreen[0] - length, centerScreen[1]);
} }
void Oculars::paintTelrad() void Oculars::paintTelrad()
{ {
if (!flagShowOculars) { if (!flagShowOculars) {
const StelProjectorP projector = StelApp::getInstance().getC ore()->getProjection(StelCore::FrameEquinoxEqu); const StelProjectorP projector = StelApp::getInstance().getC ore()->getProjection(StelCore::FrameEquinoxEqu);
StelCore *core = StelApp::getInstance().getCore(); // prevent unused warnings -MNG
StelProjector::StelProjectorParams params = core->getCurrent // StelCore *core = StelApp::getInstance().getCore();
StelProjectorParams(); // StelProjector::StelProjectorParams params = core->getCurr
entStelProjectorParams();
// StelPainter drawing // StelPainter drawing
StelPainter painter(projector); StelPainter painter(projector);
painter.setColor(0.77, 0.14, 0.16, 1.0); painter.setColor(0.77, 0.14, 0.16, 1.0);
Vec2i centerScreen(projector->getViewportPosX()+projector->g etViewportWidth()/2, Vec2i centerScreen(projector->getViewportPosX()+projector->g etViewportWidth()/2,
projector->getViewportPos Y()+projector->getViewportHeight()/2); projector->getViewportPos Y()+projector->getViewportHeight()/2);
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p rojector->getPixelPerRadAtCenter() * (M_PI/180) * (0.5)); painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p rojector->getPixelPerRadAtCenter() * (M_PI/180) * (0.5));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p rojector->getPixelPerRadAtCenter() * (M_PI/180) * (2.0)); painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p rojector->getPixelPerRadAtCenter() * (M_PI/180) * (2.0));
painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p rojector->getPixelPerRadAtCenter() * (M_PI/180) * (4.0)); painter.drawCircle(centerScreen[0], centerScreen[1], 0.5 * p rojector->getPixelPerRadAtCenter() * (M_PI/180) * (4.0));
skipping to change at line 1142 skipping to change at line 1438
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]; int xPosition = projectorParams.viewportXywh[2];
xPosition -= insetFromRHS; xPosition -= insetFromRHS;
int yPosition = projectorParams.viewportXywh[3]; int yPosition = projectorParams.viewportXywh[3];
yPosition -= 40; yPosition -= 40;
const int lineHeight = painter.getFontMetrics().height(); const int lineHeight = painter.getFontMetrics().height();
// The Ocular // The Ocular
if (flagShowOculars) { if (flagShowOculars) {
QString ocularNumberLabel = "Ocular #" + QVariant(selectedOc QString ocularNumberLabel;
ularIndex).toString(); QString name = ocular->name();
if (ocular->name() != QString("")) { if (name.isEmpty())
ocularNumberLabel.append(" : ").append(ocular->name( {
)); ocularNumberLabel = QString(q_("Ocular #%1"))
.arg(selectedOcularIndex);
}
else
{
ocularNumberLabel = QString(q_("Ocular #%1: %2"))
.arg(selectedOcularIndex)
.arg(name);
} }
// The name of the ocular could be really long. // The name of the ocular could be really long.
if (ocular->name().length() > widthString.length()) { if (name.length() > widthString.length()) {
xPosition -= (insetFromRHS / 2.0); xPosition -= (insetFromRHS / 2.0);
} }
painter.drawText(xPosition, yPosition, ocularNumberLabel); painter.drawText(xPosition, yPosition, ocularNumberLabel);
yPosition-=lineHeight; yPosition-=lineHeight;
if (!ocular->isBinoculars()) { if (!ocular->isBinoculars()) {
QString ocularFLLabel = "Ocular FL: " + QVariant(ocu QString eFocalLength = QVariant(ocular->effectiveFoc
lar->effectiveFocalLength()).toString() + "mm"; alLength()).toString();
painter.drawText(xPosition, yPosition, ocularFLLabel // TRANSLATORS: FL = Focal length
); QString eFocalLengthLabel = QString(q_("Ocular FL: %
1 mm")).arg(eFocalLength);
painter.drawText(xPosition, yPosition, eFocalLengthL
abel);
yPosition-=lineHeight; yPosition-=lineHeight;
QString ocularFOVLabel = "Ocular aFOV: " + QVariant( QString ocularFov = QString::number(ocular->appearen
ocular->appearentFOV()).toString() + QChar(0x00B0); tFOV());
ocularFov.append(QChar(0x00B0));//Degree sign
// TRANSLATORS: aFOV = apparent field of view
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;
// The telescope // The telescope
QString telescopeNumberLabel = "Telescope #" + QVari QString telescopeNumberLabel;
ant(selectedTelescopeIndex).toString(); QString telescopeName = telescope->name();
if (telescope->name() != QString("")) { if (telescopeName.isEmpty())
telescopeNumberLabel.append(" : ").append(te {
lescope->name()); telescopeNumberLabel = QString(q_("Telescope
#%1"))
.arg(selectedTelescop
eIndex);
}
else
{
telescopeNumberLabel = QString(q_("Telescope
#%1: %2"))
.arg(selectedTelescop
eIndex)
.arg(telescopeName);
} }
painter.drawText(xPosition, yPosition, telescopeNumb erLabel); painter.drawText(xPosition, yPosition, telescopeNumb erLabel);
yPosition-=lineHeight; yPosition-=lineHeight;
// General info // General info
QString magnificationLabel = "Magnification: " + QVa double magnification = ((int)(ocular->magnification(
riant(((int)(ocular->magnification(telescope) * 10.0)) / 10.0).toString()+ telescope) * 10.0)) / 10.0;
"x"; QString magString = QString::number(magnification);
magString.append(QChar(0x00D7));//Multiplication sig
n
QString magnificationLabel = QString(q_("Magnificati
on: %1"))
.arg(magString);
painter.drawText(xPosition, yPosition, magnification Label); painter.drawText(xPosition, yPosition, magnification Label);
yPosition-=lineHeight; yPosition-=lineHeight;
QString fovLabel = "FOV: " + QVariant(((int)(ocular- double fov = ((int)(ocular->actualFOV(telescope) * 1
>actualFOV(telescope) * 10000.00)) / 10000.0).toString() + QChar(0x00B0); 0000.00)) / 10000.0;
QString fovString = QString::number(fov);
fovString.append(QChar(0x00B0));//Degree sign
QString fovLabel = QString(q_("FOV: %1")).append(fov
String);
painter.drawText(xPosition, yPosition, fovLabel); painter.drawText(xPosition, yPosition, fovLabel);
} }
} }
// The CCD // The CCD
if (flagShowCCD) { if (flagShowCCD) {
QString ccdsensorLabel, ccdInfoLabel; QString ccdSensorLabel, ccdInfoLabel;
double fovX = ((int)(ccd->getActualFOVx(telescope) * 1000.0) ) / 1000.0; double fovX = ((int)(ccd->getActualFOVx(telescope) * 1000.0) ) / 1000.0;
double fovY = ((int)(ccd->getActualFOVy(telescope) * 1000.0) ) / 1000.0; double fovY = ((int)(ccd->getActualFOVy(telescope) * 1000.0) ) / 1000.0;
ccdInfoLabel = "Dimension : " + QVariant(fovX).toString() + QString stringFovX = QString::number(fovX);
QChar(0x00B0) + "x" + QVariant(fovY).toString() + QChar(0x00B0); stringFovX.append(QChar(0x00B0));//Degree sign
if (ccd->name() != QString("")) { QString stringFovY = QString::number(fovY);
ccdsensorLabel = "Sensor #" + QVariant(selectedCCDIn stringFovY.append(QChar(0x00B0));//Degree sign
dex).toString(); QString fovDimensions = stringFovX + QChar(0x00D7) + stringF
ccdsensorLabel.append(" : ").append(ccd->name()); ovY;
ccdInfoLabel = QString(q_("Dimensions: %1")).arg(fovDimensio
ns);
QString name = ccd->name();
if (name.isEmpty())
{
ccdSensorLabel = QString(q_("Sensor #%1")).arg(selec
tedCCDIndex);
}
else
{
ccdSensorLabel = QString(q_("Sensor #%1: %2"))
.arg(selectedCCDIndex)
.arg(name);
} }
painter.drawText(xPosition, yPosition, ccdsensorLabel); painter.drawText(xPosition, yPosition, ccdSensorLabel);
yPosition-=lineHeight; yPosition-=lineHeight;
painter.drawText(xPosition, yPosition, ccdInfoLabel); painter.drawText(xPosition, yPosition, ccdInfoLabel);
yPosition-=lineHeight; yPosition-=lineHeight;
// The telescope // The telescope
QString telescopeNumberLabel = "Telescope #" + QVariant(sele QString telescopeNumberLabel;
ctedTelescopeIndex).toString(); QString telescopeName = telescope->name();
if (telescope->name() != QString("")) { if (telescopeName.isEmpty())
telescopeNumberLabel.append(" : ").append(telescope- {
>name()); telescopeNumberLabel = QString(q_("Telescope #%1"))
.arg(selectedTelescopeIndex);
}
else
{
telescopeNumberLabel = QString(q_("Telescope #%1: %2
"))
.arg(selectedTelescopeIndex)
.arg(telescopeName);
} }
painter.drawText(xPosition, yPosition, telescopeNumberLabel) ; painter.drawText(xPosition, yPosition, telescopeNumberLabel) ;
yPosition-=lineHeight; yPosition-=lineHeight;
} }
} }
void Oculars::validateAndLoadIniFile() void Oculars::validateAndLoadIniFile()
{ {
// Insure the module directory exists // Insure the module directory exists
skipping to change at line 1267 skipping to change at line 1616
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();
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInstance().g etModuleMgr().getModule("GridLinesMgr"); GridLinesMgr *gridManager = (GridLinesMgr *)StelApp::getInstance().g etModuleMgr().getModule("GridLinesMgr");
gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid); gridManager->setFlagAzimuthalGrid(flagAzimuthalGrid);
gridManager->setFlagGalacticGrid(flagGalacticGrid);
gridManager->setFlagEquatorGrid(flagEquatorGrid); gridManager->setFlagEquatorGrid(flagEquatorGrid);
gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid); gridManager->setFlagEquatorJ2000Grid(flagEquatorJ2000Grid);
gridManager->setFlagEquatorLine(flagEquatorLine); gridManager->setFlagEquatorLine(flagEquatorLine);
gridManager->setFlagEclipticLine(flagEclipticLine); gridManager->setFlagEclipticLine(flagEclipticLine);
gridManager->setFlagMeridianLine(flagMeridianLine); gridManager->setFlagMeridianLine(flagMeridianLine);
gridManager->setFlagHorizonLine(flagHorizonLine);
gridManager->setFlagGalacticPlaneLine(flagGalacticPlaneLine);
movementManager->setFlagTracking(false); movementManager->setFlagTracking(false);
movementManager->setFlagEnableZoomKeys(true); movementManager->setFlagEnableZoomKeys(true);
movementManager->setFlagEnableMouseNavigation(true); movementManager->setFlagEnableMouseNavigation(true);
// Set the screen display // Set the screen display
// core->setMaskType(StelProjector::MaskNone); // core->setMaskType(StelProjector::MaskNone);
core->setFlipHorz(false); core->setFlipHorz(false);
core->setFlipVert(false); core->setFlipVert(false);
movementManager->zoomTo(movementManager->getInitFov()); movementManager->zoomTo(movementManager->getInitFov());
skipping to change at line 1296 skipping to change at line 1648
if (flagShowOculars && selectedOcularIndex == -1) { if (flagShowOculars && selectedOcularIndex == -1) {
// The user cycled out the selected ocular // The user cycled out the selected ocular
flagShowOculars = false; flagShowOculars = false;
} }
if (flagShowOculars) { if (flagShowOculars) {
if (!zoomedIn) { if (!zoomedIn) {
GridLinesMgr *gridManager = (GridLinesMgr *)StelApp: :getInstance().getModuleMgr().getModule("GridLinesMgr"); GridLinesMgr *gridManager = (GridLinesMgr *)StelApp: :getInstance().getModuleMgr().getModule("GridLinesMgr");
// Current state // Current state
flagAzimuthalGrid = gridManager->getFlagAzimuthalGri d(); flagAzimuthalGrid = gridManager->getFlagAzimuthalGri d();
flagGalacticGrid = gridManager->getFlagGalacticGrid( );
flagEquatorGrid = gridManager->getFlagEquatorGrid(); flagEquatorGrid = gridManager->getFlagEquatorGrid();
flagEquatorJ2000Grid = gridManager->getFlagEquatorJ2 000Grid(); flagEquatorJ2000Grid = gridManager->getFlagEquatorJ2 000Grid();
flagEquatorLine = gridManager->getFlagEquatorLine(); flagEquatorLine = gridManager->getFlagEquatorLine();
flagEclipticLine = gridManager->getFlagEclipticLine( ); flagEclipticLine = gridManager->getFlagEclipticLine( );
flagMeridianLine = gridManager->getFlagMeridianLine( ); flagMeridianLine = gridManager->getFlagMeridianLine( );
flagHorizonLine = gridManager->getFlagHorizonLine();
flagGalacticPlaneLine = gridManager->getFlagGalactic
PlaneLine();
} }
// set new state // set new state
zoomOcular(); zoomOcular();
} else { } else {
//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();
GridLinesMgr *gridManager = GridLinesMgr *gridManager =
(GridLinesMgr *)StelApp::getInstance().getModuleMgr().getMod ule("GridLinesMgr"); (GridLinesMgr *)StelApp::getInstance().getModuleMgr().getMod ule("GridLinesMgr");
gridManager->setFlagAzimuthalGrid(false); gridManager->setFlagAzimuthalGrid(false);
gridManager->setFlagGalacticGrid(false);
gridManager->setFlagEquatorGrid(false); gridManager->setFlagEquatorGrid(false);
gridManager->setFlagEquatorJ2000Grid(false); gridManager->setFlagEquatorJ2000Grid(false);
gridManager->setFlagEquatorLine(false); gridManager->setFlagEquatorLine(false);
gridManager->setFlagEclipticLine(false); gridManager->setFlagEclipticLine(false);
gridManager->setFlagMeridianLine(false); gridManager->setFlagMeridianLine(false);
gridManager->setFlagHorizonLine(false);
gridManager->setFlagGalacticPlaneLine(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), 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;
// 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->setFlipVert(false);
}
else
{
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);
// 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()
{
if (usageMessageLabelID > -1)
{
LabelMgr *labelManager = GETSTELMODULE(LabelMgr);
labelManager->setLabelShow(usageMessageLabelID, false);
labelManager->deleteLabel(usageMessageLabelID);
usageMessageLabelID = -1;
}
}
QMenu* Oculars::addTelescopeSubmenu(QMenu *parent)
{
Q_ASSERT(parent);
QMenu* submenu = new QMenu(q_("&Telescope"), parent);
submenu->addAction(q_("&Previous telescope"), this, SLOT(decrementTe
lescopeIndex()));
submenu->addAction(q_("&Next telescope"), this, SLOT(incrementTelesc
opeIndex()));
submenu->addSeparator();
for (int index = 0; index < telescopes.count(); ++index)
{
QString label;
if (index < 10)
{
label = QString("&%1: %2").arg(index).arg(telescopes
[index]->name());
}
else
{
label = telescopes[index]->name();
}
QAction* action = submenu->addAction(label, telescopesSignal
Mapper, SLOT(map()));
if (index == selectedTelescopeIndex)
{
action->setCheckable(true);
action->setChecked(true);
}
telescopesSignalMapper->setMapping(action, QString("%1").arg
(index));
}
return submenu;
}
 End of changes. 91 change blocks. 
281 lines changed or deleted 619 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/