PointerCoordinatesWindow.cpp   PointerCoordinatesWindow.cpp 
skipping to change at line 47 skipping to change at line 47
delete ui; delete ui;
} }
void PointerCoordinatesWindow::retranslate() void PointerCoordinatesWindow::retranslate()
{ {
if (dialog) if (dialog)
{ {
ui->retranslateUi(dialog); ui->retranslateUi(dialog);
updateAboutText(); updateAboutText();
populateCoordinatesPlacesList(); populateCoordinatesPlacesList();
populateCoordinateSystemsList();
} }
} }
void PointerCoordinatesWindow::createDialogContent() void PointerCoordinatesWindow::createDialogContent()
{ {
coord = GETSTELMODULE(PointerCoordinates); coord = GETSTELMODULE(PointerCoordinates);
ui->setupUi(dialog); ui->setupUi(dialog);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate())); connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SL OT(retranslate()));
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
populateValues(); populateValues();
connect(ui->checkBoxEnableAtStartup, SIGNAL(clicked(bool)), coord, S LOT(setFlagEnableAtStartup(bool))); connect(ui->checkBoxEnableAtStartup, SIGNAL(clicked(bool)), coord, S LOT(setFlagEnableAtStartup(bool)));
connect(ui->spinBoxFontSize, SIGNAL(valueChanged(int)), coord, SLOT( setFontSize(int))); connect(ui->spinBoxFontSize, SIGNAL(valueChanged(int)), coord, SLOT( setFontSize(int)));
connect(ui->checkBoxShowButton, SIGNAL(clicked(bool)), coord, SLOT(s etFlagShowCoordinatesButton(bool))); connect(ui->checkBoxShowButton, SIGNAL(clicked(bool)), coord, SLOT(s etFlagShowCoordinatesButton(bool)));
// Place of the string with coordinates // Place of the string with coordinates
populateCoordinatesPlacesList(); populateCoordinatesPlacesList();
int idx = ui->placeComboBox->findData(coord->getCurrentCoordinatesPl QString currentPlaceKey = coord->getCurrentCoordinatesPlaceKey();
aceKey(), Qt::UserRole, Qt::MatchCaseSensitive); int idx = ui->placeComboBox->findData(currentPlaceKey, Qt::UserRole,
Qt::MatchCaseSensitive);
if (idx==-1) if (idx==-1)
{ {
// Use TopRight as default // Use TopRight as default
idx = ui->placeComboBox->findData(QVariant("TopRight"), Qt:: UserRole, Qt::MatchCaseSensitive); idx = ui->placeComboBox->findData(QVariant("TopRight"), Qt:: UserRole, Qt::MatchCaseSensitive);
} }
ui->placeComboBox->setCurrentIndex(idx); ui->placeComboBox->setCurrentIndex(idx);
setCustomCoordinatesAccess(currentPlaceKey);
connect(ui->placeComboBox, SIGNAL(currentIndexChanged(int)), this, S LOT(setCoordinatesPlace(int))); connect(ui->placeComboBox, SIGNAL(currentIndexChanged(int)), this, S LOT(setCoordinatesPlace(int)));
populateCoordinateSystemsList();
idx = ui->coordinateSystemComboBox->findData(coord->getCurrentCoordi
nateSystemKey(), Qt::UserRole, Qt::MatchCaseSensitive);
if (idx==-1)
{
// Use RaDecJ2000 as default
idx = ui->coordinateSystemComboBox->findData(QVariant("RaDec
J2000"), Qt::UserRole, Qt::MatchCaseSensitive);
}
ui->coordinateSystemComboBox->setCurrentIndex(idx);
connect(ui->coordinateSystemComboBox, SIGNAL(currentIndexChanged(int
)), this, SLOT(setCoordinateSystem(int)));
connect(ui->spinBoxX, SIGNAL(valueChanged(int)), this, SLOT(setCusto
mCoordinatesPlace()));
connect(ui->spinBoxY, SIGNAL(valueChanged(int)), this, SLOT(setCusto
mCoordinatesPlace()));
connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(saveCoordi natesSettings())); connect(ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(saveCoordi natesSettings()));
connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(resetCoor dinatesSettings())); connect(ui->pushButtonReset, SIGNAL(clicked()), this, SLOT(resetCoor dinatesSettings()));
updateAboutText(); updateAboutText();
} }
void PointerCoordinatesWindow::populateValues() void PointerCoordinatesWindow::populateValues()
{ {
ui->checkBoxEnableAtStartup->setChecked(coord->getFlagEnableAtStartu p()); ui->checkBoxEnableAtStartup->setChecked(coord->getFlagEnableAtStartu p());
ui->spinBoxFontSize->setValue(coord->getFontSize()); ui->spinBoxFontSize->setValue(coord->getFontSize());
ui->checkBoxShowButton->setChecked(coord->getFlagShowCoordinatesButt on()); ui->checkBoxShowButton->setChecked(coord->getFlagShowCoordinatesButt on());
QPair<int, int> cc = coord->getCustomCoordinatesPlace();
ui->spinBoxX->setValue(cc.first);
ui->spinBoxY->setValue(cc.second);
} }
void PointerCoordinatesWindow::updateAboutText() void PointerCoordinatesWindow::updateAboutText()
{ {
ui->labelTitle->setText(q_("Pointer Coordinates plug-in")); ui->labelTitle->setText(q_("Pointer Coordinates plug-in"));
QString version = QString(q_("Version %1")).arg(POINTERCOORDINATES_P LUGIN_VERSION); QString version = QString(q_("Version %1")).arg(POINTERCOORDINATES_P LUGIN_VERSION);
ui->labelVersion->setText(version); ui->labelVersion->setText(version);
} }
void PointerCoordinatesWindow::saveCoordinatesSettings() void PointerCoordinatesWindow::saveCoordinatesSettings()
skipping to change at line 122 skipping to change at line 141
//Save the current selection to be restored later //Save the current selection to be restored later
places->blockSignals(true); places->blockSignals(true);
int index = places->currentIndex(); int index = places->currentIndex();
QVariant selectedPlaceId = places->itemData(index); QVariant selectedPlaceId = places->itemData(index);
places->clear(); places->clear();
//For each algorithm, display the localized name and store the key a s user //For each algorithm, display the localized name and store the key a s user
//data. Unfortunately, there's no other way to do this than with a c ycle. //data. Unfortunately, there's no other way to do this than with a c ycle.
places->addItem(q_("The top center of the screen"), "TopCenter"); places->addItem(q_("The top center of the screen"), "TopCenter");
places->addItem(q_("In center of the top right half of the screen"), "TopRight"); places->addItem(q_("In center of the top right half of the screen"), "TopRight");
places->addItem(q_("The right bottom corner of the screen"), "RightB ottomCorner"); places->addItem(q_("The right bottom corner of the screen"), "RightB ottomCorner");
places->addItem(q_("Custom position"), "Custom");
//Restore the selection //Restore the selection
index = places->findData(selectedPlaceId, Qt::UserRole, Qt::MatchCas eSensitive); index = places->findData(selectedPlaceId, Qt::UserRole, Qt::MatchCas eSensitive);
places->setCurrentIndex(index); places->setCurrentIndex(index);
places->blockSignals(false); places->blockSignals(false);
} }
void PointerCoordinatesWindow::populateCoordinateSystemsList()
{
Q_ASSERT(ui->coordinateSystemComboBox);
QComboBox* csys = ui->coordinateSystemComboBox;
//Save the current selection to be restored later
csys->blockSignals(true);
int index = csys->currentIndex();
QVariant selectedSystemId = csys->itemData(index);
csys->clear();
//For each algorithm, display the localized name and store the key a
s user
//data. Unfortunately, there's no other way to do this than with a c
ycle.
csys->addItem(q_("Right ascension/Declination (J2000.0)"), "RaDecJ20
00");
csys->addItem(q_("Right ascension/Declination"), "RaDec");
csys->addItem(q_("Hour angle/Declination"), "HourAngle");
csys->addItem(q_("Ecliptic Longitude/Latitude (J2000.0)"), "Ecliptic
");
csys->addItem(q_("Altitude/Azimuth"), "AltAzi");
csys->addItem(q_("Galactic Longitude/Latitude"), "Galactic");
//Restore the selection
index = csys->findData(selectedSystemId, Qt::UserRole, Qt::MatchCase
Sensitive);
csys->setCurrentIndex(index);
csys->blockSignals(false);
}
void PointerCoordinatesWindow::setCoordinatesPlace(int placeID) void PointerCoordinatesWindow::setCoordinatesPlace(int placeID)
{ {
QString currentPlaceID = ui->placeComboBox->itemData(placeID).toStri ng(); QString currentPlaceID = ui->placeComboBox->itemData(placeID).toStri ng();
coord->setCurrentCoordinatesPlaceKey(currentPlaceID); coord->setCurrentCoordinatesPlaceKey(currentPlaceID);
setCustomCoordinatesAccess(currentPlaceID);
}
void PointerCoordinatesWindow::setCoordinateSystem(int csID)
{
QString currentCsId = ui->coordinateSystemComboBox->itemData(csID).t
oString();
coord->setCurrentCoordinateSystemKey(currentCsId);
}
void PointerCoordinatesWindow::setCustomCoordinatesPlace()
{
coord->setCustomCoordinatesPlace(ui->spinBoxX->value(), ui->spinBoxY
->value());
}
void PointerCoordinatesWindow::setCustomCoordinatesAccess(QString place)
{
if (place.contains("Custom"))
{
ui->labelCustomCoords->setText(q_("Coordinates of custom pos
ition:"));
ui->spinBoxX->setVisible(true);
ui->spinBoxY->setVisible(true);
}
else
{
ui->labelCustomCoords->setText("");
ui->spinBoxX->setVisible(false);
ui->spinBoxY->setVisible(false);
}
} }
 End of changes. 8 change blocks. 
2 lines changed or deleted 89 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/