OcularDialog.cpp   OcularDialog.cpp 
skipping to change at line 70 skipping to change at line 70
validatorOcularAFOV = new QIntValidator(35, 120, 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:
if (dialog)
{
ui->ocularAFov->setValidator(0);
ui->ocularFL->setValidator(0);
ui->telescopeFL->setValidator(0);
ui->telescopeDiameter->setValidator(0);
ui->ocularName->setValidator(0);
ui->telescopeName->setValidator(0);
ui->ocularName->setValidator(0);
ui->ccdName->setValidator(0);
ui->ccdResX->setValidator(0);
ui->ccdResY->setValidator(0);
ui->ccdChipX->setValidator(0);
ui->ccdChipY->setValidator(0);
ui->ccdPixelX->setValidator(0);
ui->ccdPixelX->setValidator(0);
delete ccdMapper;
ccdMapper = NULL;
delete ocularMapper;
ocularMapper = NULL;
delete telescopeMapper;
telescopeMapper = NULL;
}
delete ui; delete ui;
ui = NULL; ui = NULL;
delete validatorPositiveInt;
validatorPositiveInt = NULL;
delete validatorPositiveDouble;
validatorPositiveDouble = NULL;
delete validatorOcularAFOV;
validatorOcularAFOV = NULL;
delete validatorOcularEFL;
validatorOcularEFL = NULL;
delete validatorTelescopeDiameter;
validatorTelescopeDiameter = NULL;
delete validatorTelescopeFL;
validatorTelescopeFL = NULL;
delete validatorName;
validatorName = NULL;
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark StelModule Methods #pragma mark StelModule Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void OcularDialog::languageChanged() void OcularDialog::languageChanged()
{ {
skipping to change at line 161 skipping to change at line 123
} }
void OcularDialog::deleteSelectedCCD() void OcularDialog::deleteSelectedCCD()
{ {
ccdTableModel->removeRows(ui->ccdListView->currentIndex().row(), 1); ccdTableModel->removeRows(ui->ccdListView->currentIndex().row(), 1);
ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1)); ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1));
} }
void OcularDialog::deleteSelectedOcular() void OcularDialog::deleteSelectedOcular()
{ {
ocularTableModel->removeRows(ui->ocularListView->currentIndex().row( if (ocularTableModel->rowCount() == 1) {
), 1); qDebug() << "Can not delete the last entry.";
ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1)); } else {
ocularTableModel->removeRows(ui->ocularListView->currentInde
x().row(), 1);
ui->ocularListView->setCurrentIndex(ocularTableModel->index(
0, 1));
}
} }
void OcularDialog::deleteSelectedTelescope() void OcularDialog::deleteSelectedTelescope()
{ {
telescopeTableModel->removeRows(ui->telescopeListView->currentIndex( if (telescopeTableModel->rowCount() == 1) {
).row(), 1); qDebug() << "Can not delete the last entry.";
ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, } else {
1)); telescopeTableModel->removeRows(ui->telescopeListView->curre
ntIndex().row(), 1);
ui->telescopeListView->setCurrentIndex(telescopeTableModel->
index(0, 1));
}
} }
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()
{ {
skipping to change at line 195 skipping to change at line 165
telescopeTableModel->insertRows(ccdTableModel->rowCount(), 1); telescopeTableModel->insertRows(ccdTableModel->rowCount(), 1);
ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(te lescopeTableModel->rowCount() - 1, 1)); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(te lescopeTableModel->rowCount() - 1, 1));
} }
/* ********************************************************************* */ /* ********************************************************************* */
#if 0 #if 0
#pragma mark - #pragma mark -
#pragma mark Private Slot Methods #pragma mark Private Slot Methods
#endif #endif
/* ********************************************************************* */ /* ********************************************************************* */
void OcularDialog::keyBindingTextTogglePluginChanged(const QString& newStri ng) void OcularDialog::keyBindingTogglePluginChanged(const QString& newString)
{ {
Oculars::appSettings()->setValue("bindings/toggle_oculars", newStrin g); Oculars::appSettings()->setValue("bindings/toggle_oculars", newStrin g);
this->updateActionMapping("toggle_oculars", newString); StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui(
} ));
Q_ASSERT(gui);
void OcularDialog::keyBindingTextTogglePluginConfigChanged(const QString& n QAction* action = gui->getGuiActions("toggle_oculars");
ewString) if (action != NULL) {
{ action->setShortcut(QKeySequence(newString.trimmed()));
Oculars::appSettings()->setValue("bindings/toggle_config_dialog", ne }
wString);
this->updateActionMapping("actionShow_Ocular_Window", newString);
}
void OcularDialog::keyBindingTextToggleCrosshairChanged(const QString& newS
tring)
{
Oculars::appSettings()->setValue("bindings/toggle_crosshair", newStr
ing);
this->updateActionMapping("toggle_crosshair", newString);
}
void OcularDialog::keyBindingTextToggleTelradChanged(const QString& newStri
ng)
{
Oculars::appSettings()->setValue("bindings/toggle_telrad", newString
);
this->updateActionMapping("actionShow_Ocular_Telrad", newString);
}
void OcularDialog::keyBindingTextNextCCDChanged(const QString& newString)
{
Oculars::appSettings()->setValue("bindings/next_ccd", newString);
this->updateActionMapping("next_ccd", newString);
}
void OcularDialog::keyBindingTextNextOcularChanged(const QString& newString
)
{
Oculars::appSettings()->setValue("bindings/next_ocular", newString);
this->updateActionMapping("next_ocular", newString);
}
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) void OcularDialog::keyBindingPopupNavigatorConfigChanged(const QString& new String)
{ {
Oculars::appSettings()->setValue("bindings/prev_ocular", newString); Oculars::appSettings()->setValue("bindings/popup_navigator", newStri
this->updateActionMapping("perv_ocular", newString); ng);
StelGui* gui = dynamic_cast<StelGui*>(StelApp::getInstance().getGui(
));
Q_ASSERT(gui);
QAction* action = gui->getGuiActions("actionShow_Ocular_Menu");
if (action != NULL) {
action->setShortcut(QKeySequence(newString.trimmed()));
}
} }
void OcularDialog::keyBindingTextPreviousTelescopeChanged(const QString& ne wString) void OcularDialog::requireSelectionStateChanged(int state)
{ {
Oculars::appSettings()->setValue("bindings/prev_telescope", newStrin bool requireSelection = (state == Qt::Checked);
g); bool requireSelectionToZoom = Oculars::appSettings()->value("require
this->updateActionMapping("perv_telescope", newString); _selection_to_zoom", 1.0).toBool();
if (requireSelection != requireSelectionToZoom) {
Oculars::appSettings()->setValue("require_selection_to_zoom"
, requireSelection);
Oculars::appSettings()->sync();\
emit(requireSelectionChanged(requireSelection));
}
} }
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 bool useMaxImageCircle = Oculars::appSettings()->value("use_max_exit
ry|StelFileMgr::Writable); _circle",01.0).toBool();
QString ocularIniPath = StelFileMgr::findFile("modules/Oculars/", fl if (shouldScale != useMaxImageCircle) {
ags) + "ocular.ini"; Oculars::appSettings()->setValue("use_max_exit_circle", shou
QSettings settings(ocularIniPath, QSettings::IniFormat); ldScale);
bool useMaxImageCircle = settings.value("use_max_exit_circle", 0.0). Oculars::appSettings()->sync();\
toBool();
if (state != useMaxImageCircle) {
settings.setValue("use_max_exit_circle", shouldScale);
emit(scaleImageCircleChanged(shouldScale)); emit(scaleImageCircleChanged(shouldScale));
} }
} }
/* ********************************************************************* */ /* ********************************************************************* */
#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);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(languageChanged()));
ui->ccdListView->setModel(ccdTableModel); ui->ccdListView->setModel(ccdTableModel);
ui->ocularListView->setModel(ocularTableModel); ui->ocularListView->setModel(ocularTableModel);
ui->telescopeListView->setModel(telescopeTableModel); 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->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)));
// 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()));
// Validators // Validators
ui->ccdName->setValidator(validatorName); ui->ccdName->setValidator(validatorName);
skipping to change at line 309 skipping to change at line 252
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 // The key bindings
ui->togglePluginLineEdit->setText(Oculars::appSettings()->value("bin QString bindingString = Oculars::appSettings()->value("bindings/togg
dings/toggle_oculars").toString()); le_oculars", "Ctrl+O").toString();
ui->toggleConfigWindowLineEdit->setText(Oculars::appSettings()->valu ui->togglePluginLineEdit->setText(bindingString);
e("bindings/toggle_config_dialog").toString()); bindingString = Oculars::appSettings()->value("bindings/popup_naviga
ui->toggleCrosshairLineEdit->setText(Oculars::appSettings()->value(" tor", "Alt+O").toString();
bindings/toggle_crosshair").toString()); ui->togglePopupNavigatorWindowLineEdit->setText(bindingString);
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&)) , connect(ui->togglePluginLineEdit, SIGNAL(textEdited(const QString&)) ,
this, SLOT(keyBindingTextTogglePluginChanged(const Q this, SLOT(keyBindingTogglePluginChanged(const QStri
String&))); ng&)));
connect(ui->toggleConfigWindowLineEdit, SIGNAL(textEdited(const QStr connect(ui->togglePopupNavigatorWindowLineEdit, SIGNAL(textEdited(co
ing&)), nst QString&)),
this, SLOT(keyBindingTextTogglePluginConfigChanged(c this, SLOT(keyBindingPopupNavigatorConfigChanged(con
onst QString&))); st 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(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 364 skipping to change at line 285
ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1)); ui->ccdListView->setCurrentIndex(ccdTableModel->index(0, 1));
// The ocular mapper // The ocular mapper
ocularMapper = new QDataWidgetMapper(); ocularMapper = new QDataWidgetMapper();
ocularMapper->setModel(ocularTableModel); ocularMapper->setModel(ocularTableModel);
ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit); ocularMapper->setSubmitPolicy(QDataWidgetMapper::AutoSubmit);
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->toFirst(); ocularMapper->toFirst();
connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChan ged(QModelIndex, QModelIndex)), connect(ui->ocularListView->selectionModel() , SIGNAL(currentRowChan ged(QModelIndex, QModelIndex)),
ocularMapper, SLOT(setCurrentModelIndex(QModelInde x))); ocularMapper, SLOT(setCurrentModelIndex(QModelInde x)));
ui->ocularListView->setCurrentIndex(ocularTableModel->index(0, 1)); ui->ocularListView->setCurrentIndex(ocularTableModel->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();
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(telescopeTableModel->index(0, 1)); ui->telescopeListView->setCurrentIndex(telescopeTableModel->index(0, 1));
// set the initial state // set the initial state
if (Oculars::appSettings()->value("use_max_exit_circle", false).toBo if (Oculars::appSettings()->value("require_selection_to_zoom", 1.0).
ol()) { toBool()) {
ui->requireSelectionCheckBox->setCheckState(Qt::Checked);
}
if (Oculars::appSettings()->value("use_max_exit_circle", 0.0).toBool
()) {
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. 18 change blocks. 
172 lines changed or deleted 71 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/