OcularDialog.cpp   OcularDialog.cpp 
skipping to change at line 41 skipping to change at line 41
#include <QAbstractItemModel> #include <QAbstractItemModel>
#include <QAction> #include <QAction>
#include <QDataWidgetMapper> #include <QDataWidgetMapper>
#include <QDebug> #include <QDebug>
#include <QFrame> #include <QFrame>
#include <QModelIndex> #include <QModelIndex>
#include <QSettings> #include <QSettings>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <limits> #include <limits>
OcularDialog::OcularDialog(Oculars* pluginPtr, QList<CCD *>* ccds, QList<Oc ular *>* oculars, QList<Telescope *>* telescopes) : OcularDialog::OcularDialog(Oculars* pluginPtr, QList<CCD *>* ccds, QList<Oc ular *>* oculars, QList<Telescope *>* telescopes, QList<Lens *> *lense) :
plugin(pluginPtr) plugin(pluginPtr)
{ {
ui = new Ui_ocularDialogForm; ui = new Ui_ocularDialogForm;
this->ccds = ccds; this->ccds = ccds;
ccdTableModel = new PropertyBasedTableModel(this); ccdTableModel = new PropertyBasedTableModel(this);
CCD* ccdModel = CCD::ccdModel(); CCD* ccdModel = CCD::ccdModel();
ccdTableModel->init(reinterpret_cast<QList<QObject *>* >(ccds), ccdTableModel->init(reinterpret_cast<QList<QObject *>* >(ccds),
ccdModel,
ccdModel, ccdModel->propertyMap());
ccdModel->propertyMap());
this->oculars = oculars; this->oculars = oculars;
ocularTableModel = new PropertyBasedTableModel(this); ocularTableModel = new PropertyBasedTableModel(this);
Ocular* ocularModel = Ocular::ocularModel(); Ocular* ocularModel = Ocular::ocularModel();
ocularTableModel->init(reinterpret_cast<QList<QObject *>* >(oculars) , ocularTableModel->init(reinterpret_cast<QList<QObject *>* >(oculars) ,
ocularModel,
ocularModel, ocularModel->propertyMap()); ocularModel->propertyMap());
this->telescopes = telescopes; this->telescopes = telescopes;
telescopeTableModel = new PropertyBasedTableModel(this); telescopeTableModel = new PropertyBasedTableModel(this);
Telescope* telescopeModel = Telescope::telescopeModel(); Telescope* telescopeModel = Telescope::telescopeModel();
telescopeTableModel->init(reinterpret_cast<QList<QObject *>* >(teles copes), telescopeTableModel->init(reinterpret_cast<QList<QObject *>* >(teles copes),
telescopeModel,
telescopeModel, telescopeModel->propertyMap());
telescopeModel->propertyMap()); this->lense = lense;
lensTableModel = new PropertyBasedTableModel(this);
Lens* lensModel = Lens::lensModel();
lensTableModel->init(reinterpret_cast<QList<QObject *>* >(lense),
lensModel,
lensModel->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 QDoubleValidator(1.0, 120.0, 1, this); validatorOcularAFOV = new QDoubleValidator(1.0, 120.0, 3, this);
validatorOcularEFL = new QDoubleValidator(1.0, 60.0, 1, this); validatorOcularEFL = new QDoubleValidator(1.0, 60.0, 3, 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);
validatorLensMultipler = new QDoubleValidator(1.0, 6.0, 4, this);
QRegExp nameExp("^\\S.*"); QRegExp nameExp("^\\S.*");
validatorName = new QRegExpValidator(nameExp, this); validatorName = new QRegExpValidator(nameExp, this);
} }
OcularDialog::~OcularDialog() OcularDialog::~OcularDialog()
{ {
ocularTableModel->disconnect(); ocularTableModel->disconnect();
telescopeTableModel->disconnect(); telescopeTableModel->disconnect();
ccdTableModel->disconnect(); ccdTableModel->disconnect();
lensTableModel->disconnect();
delete ui; delete ui;
ui = NULL; ui = NULL;
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark StelModule Methods #pragma mark StelModule Methods
#endif #endif
skipping to change at line 153 skipping to change at line 163
{ {
if (telescopeTableModel->rowCount() == 1) { if (telescopeTableModel->rowCount() == 1) {
qDebug() << "Can not delete the last entry."; qDebug() << "Can not delete the last entry.";
} else { } else {
telescopeTableModel->removeRows(ui->telescopeListView->curre ntIndex().row(), 1); telescopeTableModel->removeRows(ui->telescopeListView->curre ntIndex().row(), 1);
ui->telescopeListView->setCurrentIndex(telescopeTableModel-> index(0, 1)); ui->telescopeListView->setCurrentIndex(telescopeTableModel-> index(0, 1));
plugin->updateLists(); plugin->updateLists();
} }
} }
void OcularDialog::deleteSelectedLens()
{
if (lensTableModel->rowCount() > 0) {
lensTableModel->removeRows(ui->lensListView->currentIndex().row(), 1
);
if (lensTableModel->rowCount() > 0) {
ui->lensListView->setCurrentIndex(lensTableModel->index(0, 1));
}
plugin->updateLists();
}
}
void OcularDialog::insertNewCCD() void OcularDialog::insertNewCCD()
{ {
ccdTableModel->insertRows(ccdTableModel->rowCount(), 1); ccdTableModel->insertRows(ccdTableModel->rowCount(), 1);
ui->ccdListView->setCurrentIndex(ccdTableModel->index(ccdTableModel- >rowCount() - 1, 1)); ui->ccdListView->setCurrentIndex(ccdTableModel->index(ccdTableModel- >rowCount() - 1, 1));
} }
void OcularDialog::insertNewOcular() void OcularDialog::insertNewOcular()
{ {
ocularTableModel->insertRows(ocularTableModel->rowCount(), 1); ocularTableModel->insertRows(ocularTableModel->rowCount(), 1);
ui->ocularListView->setCurrentIndex(ocularTableModel->index(ocularTa bleModel->rowCount() - 1, 1)); ui->ocularListView->setCurrentIndex(ocularTableModel->index(ocularTa bleModel->rowCount() - 1, 1));
} }
void OcularDialog::insertNewTelescope() void OcularDialog::insertNewTelescope()
{ {
telescopeTableModel->insertRows(telescopeTableModel->rowCount(), 1); telescopeTableModel->insertRows(telescopeTableModel->rowCount(), 1);
ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(te lescopeTableModel->rowCount() - 1, 1)); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(te lescopeTableModel->rowCount() - 1, 1));
} }
void OcularDialog::insertNewLens()
{
lensTableModel->insertRows(lensTableModel->rowCount(), 1);
ui->lensListView->setCurrentIndex(lensTableModel->index(lensTableMod
el->rowCount() - 1, 1));
}
void OcularDialog::moveUpSelectedSensor() void OcularDialog::moveUpSelectedSensor()
{ {
int index = ui->ccdListView->currentIndex().row(); int index = ui->ccdListView->currentIndex().row();
if (index > 0) if (index > 0)
{ {
ccdTableModel->moveRowUp(index); ccdTableModel->moveRowUp(index);
plugin->updateLists(); plugin->updateLists();
} }
} }
skipping to change at line 201 skipping to change at line 228
void OcularDialog::moveUpSelectedTelescope() void OcularDialog::moveUpSelectedTelescope()
{ {
int index = ui->telescopeListView->currentIndex().row(); int index = ui->telescopeListView->currentIndex().row();
if (index > 0) if (index > 0)
{ {
telescopeTableModel->moveRowUp(index); telescopeTableModel->moveRowUp(index);
plugin->updateLists(); plugin->updateLists();
} }
} }
void OcularDialog::moveUpSelectedLens()
{
int index = ui->lensListView->currentIndex().row();
if (index > 0)
{
lensTableModel->moveRowUp(index);
plugin->updateLists();
}
}
void OcularDialog::moveDownSelectedSensor() void OcularDialog::moveDownSelectedSensor()
{ {
int index = ui->ccdListView->currentIndex().row(); int index = ui->ccdListView->currentIndex().row();
if (index >= 0 && index < ccdTableModel->rowCount() - 1) if (index >= 0 && index < ccdTableModel->rowCount() - 1)
{ {
ccdTableModel->moveRowDown(index); ccdTableModel->moveRowDown(index);
plugin->updateLists(); plugin->updateLists();
} }
} }
skipping to change at line 231 skipping to change at line 268
void OcularDialog::moveDownSelectedTelescope() void OcularDialog::moveDownSelectedTelescope()
{ {
int index = ui->telescopeListView->currentIndex().row(); int index = ui->telescopeListView->currentIndex().row();
if (index >= 0 && index < telescopeTableModel->rowCount() - 1) if (index >= 0 && index < telescopeTableModel->rowCount() - 1)
{ {
telescopeTableModel->moveRowDown(index); telescopeTableModel->moveRowDown(index);
plugin->updateLists(); plugin->updateLists();
} }
} }
void OcularDialog::moveDownSelectedLens()
{
int index = ui->lensListView->currentIndex().row();
if (index >= 0 && index < lensTableModel->rowCount() - 1)
{
lensTableModel->moveRowDown(index);
plugin->updateLists();
}
}
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Private Slot Methods #pragma mark Private Slot Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void OcularDialog::keyBindingTogglePluginChanged(const QString& newString) void OcularDialog::keyBindingTogglePluginChanged(const QString& newString)
{ {
Oculars::appSettings()->setValue("bindings/toggle_oculars", newStrin g); Oculars::appSettings()->setValue("bindings/toggle_oculars", newStrin g);
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( )); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui( ));
skipping to change at line 295 skipping to change at line 342
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void OcularDialog::createDialogContent() void OcularDialog::createDialogContent()
{ {
ui->setupUi(dialog); ui->setupUi(dialog);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), connect(&StelApp::getInstance(), SIGNAL(languageChanged()),
this, SLOT(retranslate())); this, SLOT(retranslate()));
ui->ccdListView->setModel(ccdTableModel); ui->ccdListView->setModel(ccdTableModel);
ui->ocularListView->setModel(ocularTableModel); ui->ocularListView->setModel(ocularTableModel);
ui->telescopeListView->setModel(telescopeTableModel); ui->telescopeListView->setModel(telescopeTableModel);
ui->lensListView->setModel(lensTableModel);
//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->scaleImageCircleCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(scaleImageCircleStateChanged(int))); connect(ui->scaleImageCircleCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(scaleImageCircleStateChanged(int)));
connect(ui->requireSelectionCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(requireSelectionStateChanged(int))); connect(ui->requireSelectionCheckBox, SIGNAL(stateChanged(int)), thi s, SLOT(requireSelectionStateChanged(int)));
connect(ui->checkBoxControlPanel, SIGNAL(clicked(bool)), plugin, SLO T(enableGuiPanel(bool))); connect(ui->checkBoxControlPanel, SIGNAL(clicked(bool)), plugin, SLO T(enableGuiPanel(bool)));
connect(ui->checkBoxDecimalDegrees, SIGNAL(clicked(bool)), plugin, S LOT(setFlagDecimalDegrees(bool))); connect(ui->checkBoxDecimalDegrees, SIGNAL(clicked(bool)), plugin, S LOT(setFlagDecimalDegrees(bool)));
// 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->addLens, SIGNAL(clicked()), this, SLOT(insertNewLens()))
;
connect(ui->deleteLens, SIGNAL(clicked()), this, SLOT(deleteSelected
Lens()));
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()));
// 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);
ui->lensName->setValidator(validatorName);
ui->lensMultipler->setValidator(validatorLensMultipler);
// The key bindings // The key bindings
QString bindingString = Oculars::appSettings()->value("bindings/togg le_oculars", "Ctrl+O").toString(); QString bindingString = Oculars::appSettings()->value("bindings/togg le_oculars", "Ctrl+O").toString();
ui->togglePluginLineEdit->setText(bindingString); ui->togglePluginLineEdit->setText(bindingString);
bindingString = Oculars::appSettings()->value("bindings/popup_naviga tor", "Alt+O").toString(); bindingString = Oculars::appSettings()->value("bindings/popup_naviga tor", "Alt+O").toString();
ui->togglePopupNavigatorWindowLineEdit->setText(bindingString); ui->togglePopupNavigatorWindowLineEdit->setText(bindingString);
connect(ui->togglePluginLineEdit, SIGNAL(textEdited(const QString&)) , connect(ui->togglePluginLineEdit, SIGNAL(textEdited(const QString&)) ,
this, SLOT(keyBindingTogglePluginCha nged(const QString&))); this, SLOT(keyBindingTogglePluginCha nged(const QString&)));
connect(ui->togglePopupNavigatorWindowLineEdit, SIGNAL(textEdited(co nst QString&)), connect(ui->togglePopupNavigatorWindowLineEdit, SIGNAL(textEdited(co nst QString&)),
this, SLOT(keyBindingPopupNavigatorC onfigChanged(const QString&))); this, SLOT(keyBindingPopupNavigatorC onfigChanged(const QString&)));
skipping to change at line 355 skipping to change at line 407
connect(ui->pushButtonMoveOcularDown, SIGNAL(pressed()), connect(ui->pushButtonMoveOcularDown, SIGNAL(pressed()),
this, SLOT(moveDownSelectedOcular()) ); this, SLOT(moveDownSelectedOcular()) );
connect(ui->pushButtonMoveSensorUp, SIGNAL(pressed()), connect(ui->pushButtonMoveSensorUp, SIGNAL(pressed()),
this, SLOT(moveUpSelectedSensor())); this, SLOT(moveUpSelectedSensor()));
connect(ui->pushButtonMoveSensorDown, SIGNAL(pressed()), connect(ui->pushButtonMoveSensorDown, SIGNAL(pressed()),
this, SLOT(moveDownSelectedSensor()) ); this, SLOT(moveDownSelectedSensor()) );
connect(ui->pushButtonMoveTelescopeUp, SIGNAL(pressed()), connect(ui->pushButtonMoveTelescopeUp, SIGNAL(pressed()),
this, SLOT(moveUpSelectedTelescope() )); this, SLOT(moveUpSelectedTelescope() ));
connect(ui->pushButtonMoveTelescopeDown, SIGNAL(pressed()), connect(ui->pushButtonMoveTelescopeDown, SIGNAL(pressed()),
this, SLOT(moveDownSelectedTelescope ())); this, SLOT(moveDownSelectedTelescope ()));
connect(ui->pushButtonMoveLensUp, SIGNAL(pressed()),
this, SLOT(moveUpSelectedLens()));
connect(ui->pushButtonMoveLensDown, SIGNAL(pressed()),
this, SLOT(moveDownSelectedLens()));
// The CCD mapper // The CCD mapper
ccdMapper = new QDataWidgetMapper(); ccdMapper = new QDataWidgetMapper();
ccdMapper->setModel(ccdTableModel); ccdMapper->setModel(ccdTableModel);
ccdMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ccdMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
ccdMapper->addMapping(ui->ccdName, 0); ccdMapper->addMapping(ui->ccdName, 0);
ccdMapper->addMapping(ui->ccdChipY, 1); ccdMapper->addMapping(ui->ccdChipY, 1);
ccdMapper->addMapping(ui->ccdChipX, 2); ccdMapper->addMapping(ui->ccdChipX, 2);
ccdMapper->addMapping(ui->ccdPixelY, 3); ccdMapper->addMapping(ui->ccdPixelY, 3);
ccdMapper->addMapping(ui->ccdPixelX, 4); ccdMapper->addMapping(ui->ccdPixelX, 4);
skipping to change at line 386 skipping to change at line 442
ocularMapper->addMapping(ui->ocularName, 0); ocularMapper->addMapping(ui->ocularName, 0);
ocularMapper->addMapping(ui->ocularAFov, 1); ocularMapper->addMapping(ui->ocularAFov, 1);
ocularMapper->addMapping(ui->ocularFL, 2); ocularMapper->addMapping(ui->ocularFL, 2);
ocularMapper->addMapping(ui->ocularFieldStop, 3); ocularMapper->addMapping(ui->ocularFieldStop, 3);
ocularMapper->addMapping(ui->binocularsCheckBox, 4, "checked"); ocularMapper->addMapping(ui->binocularsCheckBox, 4, "checked");
ocularMapper->toFirst(); ocularMapper->toFirst();
connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChan ged(QModelIndex, QModelIndex)), connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChan ged(QModelIndex, QModelIndex)),
ocularMapper, SLOT(setCurrentModelIn dex(QModelIndex))); ocularMapper, SLOT(setCurrentModelIn dex(QModelIndex)));
ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1)); ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1));
// The lens mapper
lensMapper = new QDataWidgetMapper();
lensMapper->setModel(lensTableModel);
lensMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
lensMapper->addMapping(ui->lensName, 0);
lensMapper->addMapping(ui->lensMultipler, 1);
lensMapper->toFirst();
connect(ui->lensListView->selectionModel(), SIGNAL(currentRowChanged
(QModelIndex, QModelIndex)),
lensMapper, SLOT(setCurrentModelIndex(QModelIndex)))
;
ui->lensListView->setCurrentIndex(lensTableModel->index(0, 1));
// The telescope mapper // The telescope mapper
telescopeMapper = new QDataWidgetMapper(); telescopeMapper = new QDataWidgetMapper();
telescopeMapper->setModel(telescopeTableModel); telescopeMapper->setModel(telescopeTableModel);
telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); telescopeMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
telescopeMapper->addMapping(ui->telescopeName, 0); telescopeMapper->addMapping(ui->telescopeName, 0);
telescopeMapper->addMapping(ui->telescopeDiameter, 1); telescopeMapper->addMapping(ui->telescopeDiameter, 1);
telescopeMapper->addMapping(ui->telescopeFL, 2); telescopeMapper->addMapping(ui->telescopeFL, 2);
telescopeMapper->addMapping(ui->telescopeHFlip, 3, "checked"); telescopeMapper->addMapping(ui->telescopeHFlip, 3, "checked");
telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked"); telescopeMapper->addMapping(ui->telescopeVFlip, 4, "checked");
ocularMapper->toFirst(); ocularMapper->toFirst();
 End of changes. 16 change blocks. 
13 lines changed or deleted 81 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/