OcularDialog.cpp   OcularDialog.cpp 
skipping to change at line 19 skipping to change at line 19
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, U SA.
*/ */
#include "Ocular.hpp"
#include "Oculars.hpp" #include "Oculars.hpp"
#include "OcularDialog.hpp" #include "OcularDialog.hpp"
#include "ui_ocularDialog.h" #include "ui_ocularDialog.h"
#include "StelApp.hpp" #include "StelApp.hpp"
#include "StelGui.hpp" #include "StelGui.hpp"
#include "StelFileMgr.hpp" #include "StelFileMgr.hpp"
#include "StelModuleMgr.hpp" #include "StelModuleMgr.hpp"
#include "StelMainGraphicsView.hpp" #include "StelMainGraphicsView.hpp"
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include <QAbstractItemModel>
#include <QAction>
#include <QDataWidgetMapper> #include <QDataWidgetMapper>
#include <QDebug> #include <QDebug>
#include <QFrame> #include <QFrame>
#include <QModelIndex> #include <QModelIndex>
#include <QSettings> #include <QSettings>
#include <QSqlError> #include <QStandardItemModel>
#include <QSqlField>
#include <QSqlDatabase>
#include <QSqlRecord>
#include <QSqlTableModel>
#include <limits> #include <limits>
OcularDialog::OcularDialog(QSqlTableModel *CCDsTableModel, QSqlTableModel * ocularsTableModel, QSqlTableModel *telescopesTableModel) OcularDialog::OcularDialog(QList<CCD *>* ccds, QList<Ocular *>* oculars, QL ist<Telescope *>* telescopes)
{ {
ui = new Ui_ocularDialogForm; ui = new Ui_ocularDialogForm;
this->CCDsTableModel = CCDsTableModel; this->ccds = ccds;
this->ocularsTableModel = ocularsTableModel; ccdTableModel = new PropertyBasedTableModel(this);
this->telescopesTableModel = telescopesTableModel; ccdTableModel->init(reinterpret_cast<QList<QObject *>* >(ccds),
CCD::ccdModel(),
CCD::ccdModel()->p
ropertyMap());
this->oculars = oculars;
ocularTableModel = new PropertyBasedTableModel(this);
ocularTableModel->init(reinterpret_cast<QList<QObject *>* >(oculars)
,
Ocular::oc
ularModel(), Ocular::ocularModel()->propertyMap());
this->telescopes = telescopes;
telescopeTableModel = new PropertyBasedTableModel(this);
telescopeTableModel->init(reinterpret_cast<QList<QObject *>* >(teles
copes),
Te
lescope::telescopeModel(),
Te
lescope::telescopeModel()->propertyMap());
validatorPositiveInt = new QIntValidator(0, std::numeric_limits<int> ::max(), this); validatorPositiveInt = new QIntValidator(0, std::numeric_limits<int> ::max(), this);
validatorPositiveDouble = new QDoubleValidator(.0, std::numeric_limi ts<double>::max(), 24, this); validatorPositiveDouble = new QDoubleValidator(.0, std::numeric_limi ts<double>::max(), 24, this);
validatorOcularAFOV = new QIntValidator(35, 100, this); validatorOcularAFOV = new QIntValidator(35, 120, this);
validatorOcularEFL = new QDoubleValidator(1.0, 60.0, 1, this); validatorOcularEFL = new QDoubleValidator(1.0, 60.0, 1, this);
validatorTelescopeDiameter = new QDoubleValidator(1.0, 1000.0, 1, th is); validatorTelescopeDiameter = new QDoubleValidator(1.0, 1000.0, 1, th is);
validatorTelescopeFL = new QDoubleValidator(1.0, 10000.0, 1, this); validatorTelescopeFL = new QDoubleValidator(1.0, 10000.0, 1, this);
QRegExp nameExp("^\\S.*"); QRegExp nameExp("^\\S.*");
validatorName = new QRegExpValidator(nameExp, this); validatorName = new QRegExpValidator(nameExp, this);
} }
OcularDialog::~OcularDialog() OcularDialog::~OcularDialog()
{ {
//These exist only if the window has been shown once: //These exist only if the window has been shown once:
if (dialog) if (dialog)
{ {
ui->ocularAFov->setValidator(0); ui->ocularAFov->setValidator(0);
ui->ocularFL->setValidator(0); ui->ocularFL->setValidator(0);
ui->telescopeFL->setValidator(0); ui->telescopeFL->setValidator(0);
ui->telescopeDiameter->setValidator(0); ui->telescopeDiameter->setValidator(0);
ui->ocularName->setValidator(0); ui->ocularName->setValidator(0);
ui->telescopeName->setValidator(0); ui->telescopeName->setValidator(0);
ui->ocularName->setValidator(0); ui->ocularName->setValidator(0);
ui->CCDName->setValidator(0); ui->ccdName->setValidator(0);
ui->CCDResX->setValidator(0); ui->ccdResX->setValidator(0);
ui->CCDResY->setValidator(0); ui->ccdResY->setValidator(0);
ui->CCDChipX->setValidator(0); ui->ccdChipX->setValidator(0);
ui->CCDChipY->setValidator(0); ui->ccdChipY->setValidator(0);
ui->CCDPixelX->setValidator(0); ui->ccdPixelX->setValidator(0);
ui->CCDPixelX->setValidator(0); ui->ccdPixelX->setValidator(0);
delete CCDMapper; delete ccdMapper;
CCDMapper = NULL; ccdMapper = NULL;
delete ocularMapper; delete ocularMapper;
ocularMapper = NULL; ocularMapper = NULL;
delete telescopeMapper; delete telescopeMapper;
telescopeMapper = NULL; telescopeMapper = NULL;
} }
delete ui; delete ui;
ui = NULL; ui = NULL;
delete validatorPositiveInt; delete validatorPositiveInt;
validatorPositiveInt = NULL; validatorPositiveInt = NULL;
delete validatorPositiveDouble; delete validatorPositiveDouble;
skipping to change at line 117 skipping to change at line 125
#pragma mark StelModule Methods #pragma mark StelModule Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void OcularDialog::languageChanged() void OcularDialog::languageChanged()
{ {
if (dialog) { if (dialog) {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
} }
} }
void OcularDialog::styleChanged()
{
// Nothing for now
}
void OcularDialog::updateStyle() void OcularDialog::updateStyle()
{ {
if(dialog) { if(dialog) {
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui()); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance() .getGui());
Q_ASSERT(gui); Q_ASSERT(gui);
const StelStyle pluginStyle = GETSTELMODULE(Oculars)->getMod uleStyleSheet(gui->getStelStyle()); const StelStyle pluginStyle = GETSTELMODULE(Oculars)->getMod uleStyleSheet(gui->getStelStyle());
dialog->setStyleSheet(pluginStyle.qtStyleSheet); dialog->setStyleSheet(pluginStyle.qtStyleSheet);
ui->textBrowser->document()->setDefaultStyleSheet(QString(pl uginStyle.htmlStyleSheet)); ui->textBrowser->document()->setDefaultStyleSheet(QString(pl uginStyle.htmlStyleSheet));
} }
} }
void OcularDialog::styleChanged()
{
// Nothing for now
}
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Slot Methods #pragma mark Slot Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void OcularDialog::closeWindow() void OcularDialog::closeWindow()
{ {
setVisible(false); setVisible(false);
StelMainGraphicsView::getInstance().scene()->setActiveWindow(0); StelMainGraphicsView::getInstance().scene()->setActiveWindow(0);
} }
void OcularDialog::deleteSelectedCCD() void OcularDialog::deleteSelectedCCD()
{ {
QModelIndex selection = ui->ccdListView->currentIndex(); ccdTableModel->removeRows(ui->ccdListView->currentIndex().row(), 1);
if (selection.row() != -1 && CCDsTableModel->rowCount() > 1) { ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1));
CCDsTableModel->removeRows(selection.row(), 1);
ui->ccdListView->setCurrentIndex(CCDsTableModel->index(0, 1)
);
}
} }
void OcularDialog::deleteSelectedOcular() void OcularDialog::deleteSelectedOcular()
{ {
QModelIndex selection = ui->ocularListView->currentIndex(); ocularTableModel->removeRows(ui->ocularListView->currentIndex().row(
if (selection.row() != -1 && ocularsTableModel->rowCount() > 1) { ), 1);
ocularsTableModel->removeRows(selection.row(), 1); ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1));
ui->ocularListView->setCurrentIndex(ocularsTableModel->index
(0, 1));
}
} }
void OcularDialog::deleteSelectedTelescope() void OcularDialog::deleteSelectedTelescope()
{ {
QModelIndex selection = ui->telescopeListView->currentIndex(); telescopeTableModel->removeRows(ui->telescopeListView->currentIndex(
if (selection.row() != -1 && telescopesTableModel->rowCount() > 1) { ).row(), 1);
telescopesTableModel->removeRows(selection.row(), 1); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0,
ui->telescopeListView->setCurrentIndex(telescopesTableModel- 1));
>index(0, 1));
}
} }
void OcularDialog::insertNewCCD() void OcularDialog::insertNewCCD()
{ {
QSqlField field1("name", QVariant::String); ccdTableModel->insertRows(ccdTableModel->rowCount(), 1);
QSqlField field2("resolution_x", QVariant::Int); ui->ccdListView->setCurrentIndex(ccdTableModel->index(ccdTableModel-
QSqlField field3("resolution_y", QVariant::Int); >rowCount() - 1, 1));
QSqlField field4("chip_width", QVariant::Double);
QSqlField field5("chip_height", QVariant::Double);
QSqlField field6("pixel_width", QVariant::Double);
QSqlField field7("pixel_height", QVariant::Double);
field1.setValue(QVariant("New Sensor"));
field2.setValue(QVariant(4096));
field3.setValue(QVariant(4096));
field4.setValue(QVariant(36.8));
field5.setValue(QVariant(36.8));
field6.setValue(QVariant(9));
field7.setValue(QVariant(9));
QSqlRecord newRecord = QSqlRecord();
newRecord.append(field1);
newRecord.append(field2);
newRecord.append(field3);
newRecord.append(field4);
newRecord.append(field5);
newRecord.append(field6);
newRecord.append(field7);
if (CCDsTableModel->insertRecord(-1, newRecord)) {
ui->ccdListView->setCurrentIndex(CCDsTableModel->index(CCDsT
ableModel->rowCount() - 1, 1));
} else {
qWarning() << "Oculars: could not insert new sensor. The er
ror is: " << CCDsTableModel->lastError();
}
} }
void OcularDialog::insertNewOcular() void OcularDialog::insertNewOcular()
{ {
QSqlField field1("name", QVariant::String); ocularTableModel->insertRows(ocularTableModel->rowCount(), 1);
QSqlField field2("afov", QVariant::Double); ui->ocularListView->setCurrentIndex(ocularTableModel->index(ocularTa
QSqlField field3("efl", QVariant::Double); bleModel->rowCount() - 1, 1));
QSqlField field4("fieldStop", QVariant::Double);
field1.setValue(QVariant("New Ocular"));
field2.setValue(QVariant(82));
field3.setValue(QVariant(32));
field4.setValue(QVariant(0));
QSqlRecord newRecord = QSqlRecord();
newRecord.append(field1);
newRecord.append(field2);
newRecord.append(field3);
newRecord.append(field4);
if (ocularsTableModel->insertRecord(-1, newRecord)) {
ui->ocularListView->setCurrentIndex(ocularsTableModel->index
(ocularsTableModel->rowCount() - 1, 1));
} else {
qWarning() << "Oculars: could not insert new ocular. The er
ror is: " << ocularsTableModel->lastError();
}
} }
void OcularDialog::insertNewTelescope() void OcularDialog::insertNewTelescope()
{ {
QSqlField field1("name", QVariant::String); telescopeTableModel->insertRows(ccdTableModel->rowCount(), 1);
QSqlField field2("focalLength", QVariant::Double); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(te
QSqlField field3("diameter", QVariant::Double); lescopeTableModel->rowCount() - 1, 1));
QSqlField field4("vFlip", QVariant::String);
QSqlField field5("hFlip", QVariant::String);
field1.setValue(QVariant("New Telescope"));
field2.setValue(QVariant(500));
field3.setValue(QVariant(80));
field4.setValue(QVariant("false"));
field5.setValue(QVariant("false"));
QSqlRecord newRecord = QSqlRecord();
newRecord.append(field1);
newRecord.append(field2);
newRecord.append(field3);
newRecord.append(field4);
newRecord.append(field5);
if (telescopesTableModel->insertRecord(-1, newRecord)) {
ui->telescopeListView->setCurrentIndex(telescopesTableModel-
>index(telescopesTableModel->rowCount() - 1, 1));
} else {
qWarning() << "Oculars: could not insert new telescope. The
error is: " << telescopesTableModel->lastError();
}
} }
void OcularDialog::CCDSelected(const QModelIndex &) /* ********************************************************************* */
#if 0
#pragma mark -
#pragma mark Private Slot Methods
#endif
/* ********************************************************************* */
void OcularDialog::keyBindingTextTogglePluginChanged(const QString& newStri
ng)
{ {
Oculars::appSettings()->setValue("bindings/toggle_oculars", newStrin
g);
this->updateActionMapping("toggle_oculars", newString);
} }
void OcularDialog::ocularSelected(const QModelIndex &) void OcularDialog::keyBindingTextTogglePluginConfigChanged(const QString& n ewString)
{ {
Oculars::appSettings()->setValue("bindings/toggle_config_dialog", ne
wString);
this->updateActionMapping("actionShow_Ocular_Window", newString);
} }
void OcularDialog::telescopeSelected(const QModelIndex &) void OcularDialog::keyBindingTextToggleCrosshairChanged(const QString& newS tring)
{ {
Oculars::appSettings()->setValue("bindings/toggle_crosshair", newStr
ing);
this->updateActionMapping("toggle_crosshair", newString);
} }
void OcularDialog::updateCCD() void OcularDialog::keyBindingTextToggleTelradChanged(const QString& newStri ng)
{ {
int selectionIndex = ui->ccdListView->currentIndex().row(); Oculars::appSettings()->setValue("bindings/toggle_telrad", newString
if (CCDMapper->submit()) { );
ui->ccdListView->setCurrentIndex(CCDsTableModel->index(selec this->updateActionMapping("actionShow_Ocular_Telrad", newString);
tionIndex, 1));
} else {
qWarning() << "Oculars: error saving modified sensor. Error
is: " << CCDsTableModel->lastError();
}
} }
void OcularDialog::updateOcular() void OcularDialog::keyBindingTextNextCCDChanged(const QString& newString)
{ {
int selectionIndex = ui->ocularListView->currentIndex().row(); Oculars::appSettings()->setValue("bindings/next_ccd", newString);
if (ocularMapper->submit()) { this->updateActionMapping("next_ccd", newString);
ui->ocularListView->setCurrentIndex(ocularsTableModel->index
(selectionIndex, 1));
} else {
qWarning() << "Oculars: error saving modified ocular. Error
is: " << ocularsTableModel->lastError();
}
} }
void OcularDialog::updateTelescope() void OcularDialog::keyBindingTextNextOcularChanged(const QString& newString )
{ {
int selectionIndex = ui->telescopeListView->currentIndex().row(); Oculars::appSettings()->setValue("bindings/next_ocular", newString);
if (telescopeMapper->submit()) { this->updateActionMapping("next_ocular", newString);
ui->telescopeListView->setCurrentIndex(telescopesTableModel- }
>index(selectionIndex, 1));
} else {
qWarning() << "Oculars: error saving modified telescope. Er
ror is: " << telescopesTableModel->lastError();
}
void OcularDialog::keyBindingTextNextTelescopeChanged(const QString& newStr
ing)
{
Oculars::appSettings()->setValue("bindings/next_telescope", newStrin
g);
this->updateActionMapping("next_telescope", newString);
}
void OcularDialog::keyBindingTextPreviousCCDChanged(const QString& newStrin
g)
{
Oculars::appSettings()->setValue("bindings/prev_ccd", newString);
this->updateActionMapping("perv_ccd", newString);
}
void OcularDialog::keyBindingTextPreviousOcularChanged(const QString& newSt
ring)
{
Oculars::appSettings()->setValue("bindings/prev_ocular", newString);
this->updateActionMapping("perv_ocular", newString);
}
void OcularDialog::keyBindingTextPreviousTelescopeChanged(const QString& ne
wString)
{
Oculars::appSettings()->setValue("bindings/prev_telescope", newStrin
g);
this->updateActionMapping("perv_telescope", newString);
} }
/* ********************************************************************* */
#if 0
#pragma mark -
#pragma mark Private Slot Methods
#endif
/* ********************************************************************* */
void OcularDialog::scaleImageCircleStateChanged(int state) void OcularDialog::scaleImageCircleStateChanged(int state)
{ {
bool shouldScale = (state == Qt::Checked); bool shouldScale = (state == Qt::Checked);
StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directo ry|StelFileMgr::Writable); StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directo ry|StelFileMgr::Writable);
QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", fl ags) + "ocular.ini"; QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", fl ags) + "ocular.ini";
QSettings settings(ocularIniPath, QSettings::IniFormat); QSettings settings(ocularIniPath, QSettings::IniFormat);
bool useMaxImageCircle = settings.value("use_max_exit_circle", 0.0). toBool(); bool useMaxImageCircle = settings.value("use_max_exit_circle", 0.0). toBool();
if (state != useMaxImageCircle) { if (state != useMaxImageCircle) {
settings.setValue("use_max_exit_circle", shouldScale); settings.setValue("use_max_exit_circle", shouldScale);
emit(scaleImageCircleChanged(shouldScale)); emit(scaleImageCircleChanged(shouldScale));
skipping to change at line 324 skipping to change at line 277
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Protected Methods #pragma mark Protected Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void OcularDialog::createDialogContent() void OcularDialog::createDialogContent()
{ {
ui->setupUi(dialog); ui->setupUi(dialog);
ui->ccdListView->setModel(ccdTableModel);
ui->ocularListView->setModel(ocularTableModel);
ui->telescopeListView->setModel(telescopeTableModel);
//Now the rest of the actions. //Now the rest of the actions.
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
connect(ui->updateCCDButton, SIGNAL(clicked()), this, SLOT(updateCCD
()));
connect(ui->updateOcularButton, SIGNAL(clicked()), this, SLOT(update
Ocular()));
connect(ui->updateTelescopeButton, SIGNAL(clicked()), this, SLOT(upd
ateTelescope()));
connect(ui->scaleImageCircleCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(scaleImageCircleStateChanged(int))); connect(ui->scaleImageCircleCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(scaleImageCircleStateChanged(int)));
// The add & delete buttons // The add & delete buttons
connect(ui->addCCD, SIGNAL(clicked()), this, SLOT(insertNewCCD())); connect(ui->addCCD, SIGNAL(clicked()), this, SLOT(insertNewCCD()));
connect(ui->deleteCCD, SIGNAL(clicked()), this, SLOT(deleteSelectedC CD())); connect(ui->deleteCCD, SIGNAL(clicked()), this, SLOT(deleteSelectedC CD()));
connect(ui->addOcular, SIGNAL(clicked()), this, SLOT(insertNewOcular ())); connect(ui->addOcular, SIGNAL(clicked()), this, SLOT(insertNewOcular ()));
connect(ui->deleteOcular, SIGNAL(clicked()), this, SLOT(deleteSelect edOcular())); connect(ui->deleteOcular, SIGNAL(clicked()), this, SLOT(deleteSelect edOcular()));
connect(ui->addTelescope, SIGNAL(clicked()), this, SLOT(insertNewTel escope())); connect(ui->addTelescope, SIGNAL(clicked()), this, SLOT(insertNewTel escope()));
connect(ui->deleteTelescope, SIGNAL(clicked()), this, SLOT(deleteSel ectedTelescope())); connect(ui->deleteTelescope, SIGNAL(clicked()), this, SLOT(deleteSel ectedTelescope()));
// Oculars model
ui->ccdListView->setModel(CCDsTableModel);
ui->ccdListView->setModelColumn(1);
connect(ui->ccdListView, SIGNAL(clicked(const QModelIndex &)), this,
SLOT(CCDSelected(const QModelIndex &)));
ui->ocularListView->setModel(ocularsTableModel);
ui->ocularListView->setModelColumn(1);
connect(ui->ocularListView, SIGNAL(clicked(const QModelIndex &)), th
is, SLOT(ocularSelected(const QModelIndex &)));
ui->telescopeListView->setModel(telescopesTableModel);
ui->telescopeListView->setModelColumn(1);
connect(ui->telescopeListView, SIGNAL(clicked(const QModelIndex &)),
this, SLOT(telescopeSelected(const QModelIndex &)));
// Validators // Validators
ui->CCDName->setValidator(validatorName); ui->ccdName->setValidator(validatorName);
ui->CCDResX->setValidator(validatorPositiveInt); ui->ccdResX->setValidator(validatorPositiveInt);
ui->CCDResY->setValidator(validatorPositiveInt); ui->ccdResY->setValidator(validatorPositiveInt);
ui->CCDChipX->setValidator(validatorPositiveDouble); ui->ccdChipX->setValidator(validatorPositiveDouble);
ui->CCDChipY->setValidator(validatorPositiveDouble); ui->ccdChipY->setValidator(validatorPositiveDouble);
ui->CCDPixelX->setValidator(validatorPositiveDouble); ui->ccdPixelX->setValidator(validatorPositiveDouble);
ui->CCDPixelY->setValidator(validatorPositiveDouble); ui->ccdPixelY->setValidator(validatorPositiveDouble);
ui->ocularAFov->setValidator(validatorOcularAFOV); ui->ocularAFov->setValidator(validatorOcularAFOV);
ui->ocularFL->setValidator(validatorOcularEFL); ui->ocularFL->setValidator(validatorOcularEFL);
ui->ocularFieldStop->setValidator(validatorOcularEFL); ui->ocularFieldStop->setValidator(validatorOcularEFL);
ui->telescopeFL->setValidator(validatorTelescopeFL); ui->telescopeFL->setValidator(validatorTelescopeFL);
ui->telescopeDiameter->setValidator(validatorTelescopeDiameter); ui->telescopeDiameter->setValidator(validatorTelescopeDiameter);
ui->ocularName->setValidator(validatorName); ui->ocularName->setValidator(validatorName);
ui->telescopeName->setValidator(validatorName); ui->telescopeName->setValidator(validatorName);
// The key bindings
ui->togglePluginLineEdit->setText(Oculars::appSettings()->value("bin
dings/toggle_oculars").toString());
ui->toggleConfigWindowLineEdit->setText(Oculars::appSettings()->valu
e("bindings/toggle_config_dialog").toString());
ui->toggleCrosshairLineEdit->setText(Oculars::appSettings()->value("
bindings/toggle_crosshair").toString());
ui->toggleTelradLineEdit->setText(Oculars::appSettings()->value("bin
dings/toggle_telrad").toString());
ui->nextCCDLineEdit->setText(Oculars::appSettings()->value("bindings
/next_ccd").toString());
ui->nextOcularLineEdit->setText(Oculars::appSettings()->value("bindi
ngs/next_ocular").toString());
ui->nextTelescopeLineEdit->setText(Oculars::appSettings()->value("bi
ndings/next_telescope").toString());
ui->previousCCDLineEdit->setText(Oculars::appSettings()->value("bind
ings/prev_ccd").toString());
ui->previousOcularLineEdit->setText(Oculars::appSettings()->value("b
indings/prev_ocular").toString());
ui->previousTelescopeLineEdit->setText(Oculars::appSettings()->value
("bindings/prev_telescope").toString());
connect(ui->togglePluginLineEdit, SIGNAL(textEdited(const QString&))
,
this, SLOT(keyBindingTextTogglePluginChanged(const Q
String&)));
connect(ui->toggleConfigWindowLineEdit, SIGNAL(textEdited(const QStr
ing&)),
this, SLOT(keyBindingTextTogglePluginConfigChanged(c
onst QString&)));
connect(ui->toggleCrosshairLineEdit, SIGNAL(textEdited(const QString
&)),
this, SLOT(keyBindingTextToggleCrosshairChanged(cons
t QString&)));
connect(ui->toggleTelradLineEdit, SIGNAL(textEdited(const QString&))
,
this, SLOT(keyBindingTextToggleTelradChanged(const Q
String&)));
connect(ui->nextCCDLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(keyBindingTextNextCCDChanged(const QStrin
g&)));
connect(ui->nextOcularLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(keyBindingTextNextOcularChanged(const QSt
ring&)));
connect(ui->nextTelescopeLineEdit, SIGNAL(textEdited(const QString&)
),
this, SLOT(keyBindingTextNextTelescopeChanged(const
QString&)));
connect(ui->previousCCDLineEdit, SIGNAL(textEdited(const QString&)),
this, SLOT(keyBindingTextPreviousCCDChanged(const QS
tring&)));
connect(ui->previousOcularLineEdit, SIGNAL(textEdited(const QString&
)),
this, SLOT(keyBindingTextPreviousOcularChanged(const
QString&)));
connect(ui->previousTelescopeLineEdit, SIGNAL(textEdited(const QStri
ng&)),
this, SLOT(keyBindingTextPreviousTelescopeChanged(co
nst QString&)));
// The CCD mapper // The CCD mapper
CCDMapper = new QDataWidgetMapper(); ccdMapper = new QDataWidgetMapper();
CCDMapper->setModel(CCDsTableModel); ccdMapper->setModel(ccdTableModel);
// CCDMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ccdMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
CCDMapper->addMapping(ui->CCDID, CCDsTableModel->fieldIndex("id"), " ccdMapper->addMapping(ui->ccdName, 0);
text"); ccdMapper->addMapping(ui->ccdChipY, 1);
CCDMapper->addMapping(ui->CCDName, CCDsTableModel->fieldIndex("name" ccdMapper->addMapping(ui->ccdChipX, 2);
)); ccdMapper->addMapping(ui->ccdPixelY, 3);
CCDMapper->addMapping(ui->CCDResX, CCDsTableModel->fieldIndex("resol ccdMapper->addMapping(ui->ccdPixelX, 4);
ution_x")); ccdMapper->addMapping(ui->ccdResX, 5);
CCDMapper->addMapping(ui->CCDResY, CCDsTableModel->fieldIndex("resol ccdMapper->addMapping(ui->ccdResY, 6);
ution_y")); ccdMapper->toFirst();
CCDMapper->addMapping(ui->CCDChipX, CCDsTableModel->fieldIndex("chip
_width"));
CCDMapper->addMapping(ui->CCDChipY, CCDsTableModel->fieldIndex("chip
_height"));
CCDMapper->addMapping(ui->CCDPixelX, CCDsTableModel->fieldIndex("pix
el_width"));
CCDMapper->addMapping(ui->CCDPixelY, CCDsTableModel->fieldIndex("pix
el_height"));
CCDMapper->toFirst();
connect(ui->ccdListView->selectionModel() , SIGNAL(currentRowChanged (QModelIndex, QModelIndex)), connect(ui->ccdListView->selectionModel() , SIGNAL(currentRowChanged (QModelIndex, QModelIndex)),
CCDMapper, SLOT(setCurrentModelIndex(QModelIndex))); ccdMapper, SLOT(setCurrentModelIndex(QModelIndex)));
ui->ccdListView->setCurrentIndex(CCDsTableModel->index(0, 1)); ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1));
// The ocular mapper // The ocular mapper
ocularMapper = new QDataWidgetMapper(); ocularMapper = new QDataWidgetMapper();
ocularMapper->setModel(ocularsTableModel); ocularMapper->setModel(ocularTableModel);
// ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
ocularMapper->addMapping(ui->ocularID, ocularsTableModel->fieldIndex ocularMapper->addMapping(ui->ocularName, 0);
("id"), "text"); ocularMapper->addMapping(ui->ocularAFov, 1);
ocularMapper->addMapping(ui->ocularName, ocularsTableModel->fieldInd ocularMapper->addMapping(ui->ocularFL, 2);
ex("name")); ocularMapper->addMapping(ui->ocularFieldStop, 3);
ocularMapper->addMapping(ui->ocularAFov, ocularsTableModel->fieldInd
ex("afov"));
ocularMapper->addMapping(ui->ocularFL, ocularsTableModel->fieldIndex
("efl"));
ocularMapper->addMapping(ui->ocularFieldStop, ocularsTableModel->fie
ldIndex("fieldStop"));
ocularMapper->toFirst(); ocularMapper->toFirst();
connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChan ged(QModelIndex, QModelIndex)), connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChan ged(QModelIndex, QModelIndex)),
ocularMapper, SLOT(setCurrentModelIndex(QModelIndex) ocularMapper, SLOT(setCurrentModelIndex(QModelInde
)); x)));
ui->ocularListView->setCurrentIndex(ocularsTableModel->index(0, 1)); ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1));
// The telescope mapper // The telescope mapper
telescopeMapper = new QDataWidgetMapper(); telescopeMapper = new QDataWidgetMapper();
telescopeMapper->setModel(telescopesTableModel); telescopeMapper->setModel(telescopeTableModel);
// telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
telescopeMapper->addMapping(ui->telescopeID, telescopesTableModel->f telescopeMapper->addMapping(ui->telescopeName, 0);
ieldIndex("id"), "text"); telescopeMapper->addMapping(ui->telescopeDiameter, 1);
telescopeMapper->addMapping(ui->telescopeName, telescopesTableModel- telescopeMapper->addMapping(ui->telescopeFL, 2);
>fieldIndex("name")); telescopeMapper->addMapping(ui->telescopeHFlip, 3, "checked");
telescopeMapper->addMapping(ui->telescopeDiameter, telescopesTableMo telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked");
del->fieldIndex("diameter"));
telescopeMapper->addMapping(ui->telescopeFL, telescopesTableModel->f
ieldIndex("focalLength"));
telescopeMapper->addMapping(ui->telescopeVFlip, telescopesTableModel
->fieldIndex("vFlip"), "checked");
telescopeMapper->addMapping(ui->telescopeHFlip, telescopesTableModel
->fieldIndex("hFlip"), "checked");
ocularMapper->toFirst(); ocularMapper->toFirst();
connect(ui->telescopeListView->selectionModel() , SIGNAL(currentRowC hanged(QModelIndex, QModelIndex)), connect(ui->telescopeListView->selectionModel() , SIGNAL(currentRowC hanged(QModelIndex, QModelIndex)),
telescopeMapper, SLOT(setCurrentModelIndex(QModelInd ex))); telescopeMapper, SLOT(setCurrentModelIndex(QModelInd ex)));
ui->telescopeListView->setCurrentIndex(telescopesTableModel->index(0 , 1)); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, 1));
// set the initial state // set the initial state
StelFileMgr::Flags flags = (StelFileMgr::Flags)(StelFileMgr::Directo if (Oculars::appSettings()->value("use_max_exit_circle", false).toBo
ry|StelFileMgr::Writable); ol()) {
QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", fl
ags) + "ocular.ini";
QSettings settings(ocularIniPath, QSettings::IniFormat);
bool useMaxImageCircle = settings.value("use_max_exit_circle", false
).toBool();
if (useMaxImageCircle) {
ui->scaleImageCircleCheckBox->setCheckState(Qt::Checked); ui->scaleImageCircleCheckBox->setCheckState(Qt::Checked);
} }
//Initialize the style //Initialize the style
updateStyle(); updateStyle();
} }
void OcularDialog::updateActionMapping(const QString& actionName, const QSt
ring& newMapping)
{
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui(
));
Q_ASSERT(gui);
QAction* action = gui->getGuiActions(actionName);
if (action != NULL) {
action->setShortcut(QKeySequence(newMapping.trimmed()));
}
}
 End of changes. 42 change blocks. 
243 lines changed or deleted 216 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/