FOV.cpp   FOV.cpp 
skipping to change at line 28 skipping to change at line 28
*/ */
#include "FOV.hpp" #include "FOV.hpp"
#include "FOVWindow.hpp" #include "FOVWindow.hpp"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelCore.hpp" #include "StelCore.hpp"
#include "StelLocaleMgr.hpp" #include "StelLocaleMgr.hpp"
#include "StelModule.hpp" #include "StelModule.hpp"
#include "StelMovementMgr.hpp" #include "StelMovementMgr.hpp"
#include "StelActionMgr.hpp"
#include <QSettings> #include <QSettings>
#include <QSignalMapper>
StelModule* FOVStelPluginInterface::getStelModule() const StelModule* FOVStelPluginInterface::getStelModule() const
{ {
return new FOV(); return new FOV();
} }
StelPluginInfo FOVStelPluginInterface::getPluginInfo() const StelPluginInfo FOVStelPluginInterface::getPluginInfo() const
{ {
StelPluginInfo info; StelPluginInfo info;
info.id = "FOV"; info.id = "FOV";
skipping to change at line 78 skipping to change at line 80
if (!conf->childGroups().contains("FOV")) if (!conf->childGroups().contains("FOV"))
{ {
qDebug() << "FOV: no fov section exists in main config file - creating with defaults"; qDebug() << "FOV: no fov section exists in main config file - creating with defaults";
restoreDefaultConfigIni(); restoreDefaultConfigIni();
} }
// populate settings from main config file. // populate settings from main config file.
readSettingsFromConfig(); readSettingsFromConfig();
// key bindings // key bindings
QSignalMapper* mapper = new QSignalMapper(this);
QString section = N_("Field of View"); QString section = N_("Field of View");
for (int i=0; i<10; i++) for (int i=0; i<10; i++)
{ {
QString name = QString("actionSetFOV%1").arg(i); QString name = QString("actionSet_FOV_%1").arg(i);
QString shortcut = QString("Ctrl+Alt+%1").arg(i); QString shortcut = QString("Ctrl+Alt+%1").arg(i);
QString text = q_("Set FOV to %1%2").arg(getQuickFOV(i)).arg QString text = QString("%1 %2%3").arg(N_("Set FOV to")).arg(
(QChar(0x00B0)); getQuickFOV(i)).arg(QChar(0x00B0));
addAction(name, section, text, "setFOV()", shortcut); StelAction* action = addAction(name, section, text, mapper,
"map()", shortcut);
mapper->setMapping(action,i);
} }
connect(mapper,SIGNAL(mapped(int)),this,SLOT(setFOV(int)));
} }
void FOV::deinit() void FOV::deinit()
{ {
// //
} }
double FOV::getCallOrder(StelModuleActionName) const double FOV::getCallOrder(StelModuleActionName) const
{ {
return 0.; return 0.;
skipping to change at line 168 skipping to change at line 173
double FOV::getQuickFOV(const int item) const double FOV::getQuickFOV(const int item) const
{ {
return FOVitem.at(item); return FOVitem.at(item);
} }
void FOV::setQuickFOV(const double value, const int item) void FOV::setQuickFOV(const double value, const int item)
{ {
FOVitem[item] = value; FOVitem[item] = value;
} }
void FOV::setFOV() void FOV::setFOV(const int idx)
{ {
// Find out for which FOV is the command
if (sender() == NULL)
{
return;
}
// XXX: we could use a QSignalMapper instead of this trick.
int slotNumber = sender()->objectName().right(1).toInt();
StelMovementMgr *movementManager = StelApp::getInstance().getCore()- >getMovementMgr(); StelMovementMgr *movementManager = StelApp::getInstance().getCore()- >getMovementMgr();
movementManager->zoomTo(getQuickFOV(slotNumber), 1.f); // One second for zooming movementManager->zoomTo(getQuickFOV(idx), 1.f); // One second for zo oming
} }
 End of changes. 9 change blocks. 
14 lines changed or deleted 12 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/