LocationDialog.cpp   LocationDialog.cpp 
skipping to change at line 83 skipping to change at line 83
ui->longitudeSpinBox->setPrefixType(AngleSpinBox::Longitude); ui->longitudeSpinBox->setPrefixType(AngleSpinBox::Longitude);
ui->latitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols); ui->latitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols);
ui->latitudeSpinBox->setPrefixType(AngleSpinBox::Latitude); ui->latitudeSpinBox->setPrefixType(AngleSpinBox::Latitude);
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this); QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel((QAbstractItemModel*)StelApp::getInstance ().getLocationMgr().getModelAll()); proxyModel->setSourceModel((QAbstractItemModel*)StelApp::getInstance ().getLocationMgr().getModelAll());
proxyModel->sort(0, Qt::AscendingOrder); proxyModel->sort(0, Qt::AscendingOrder);
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive); proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->citiesListView->setModel(proxyModel); ui->citiesListView->setModel(proxyModel);
SolarSystem* ssystem = (SolarSystem*)GETSTELMODULE("SolarSystem"); SolarSystem* ssystem = GETSTELMODULE(SolarSystem);
ui->planetNameComboBox->insertItems(0, ssystem->getAllPlanetEnglishN ames()); ui->planetNameComboBox->insertItems(0, ssystem->getAllPlanetEnglishN ames());
ui->countryNameComboBox->insertItems(0, StelLocaleMgr::getAllCountry Names()); ui->countryNameComboBox->insertItems(0, StelLocaleMgr::getAllCountry Names());
connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&))); connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&)));
connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)), thi s, SLOT(listItemActivated(const QModelIndex&))); connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)), thi s, SLOT(listItemActivated(const QModelIndex&)));
// Connect all the QT signals // Connect all the QT signals
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ; connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close())) ;
connect(ui->mapLabel, SIGNAL(positionChanged(double, double)), this, SLOT(setPositionFromMap(double, double))); connect(ui->mapLabel, SIGNAL(positionChanged(double, double)), this, SLOT(setPositionFromMap(double, double)));
skipping to change at line 122 skipping to change at line 122
ui->citySearchLineEdit->setFocus(); ui->citySearchLineEdit->setFocus();
} }
// Update the widget to make sure it is synchrone if the location is change d programmatically // Update the widget to make sure it is synchrone if the location is change d programmatically
void LocationDialog::updateFromProgram() void LocationDialog::updateFromProgram()
{ {
if (!dialog->isVisible()) if (!dialog->isVisible())
return; return;
// Check that the use as default check box needs to be updated // Check that the use as default check box needs to be updated
const bool b = StelApp::getInstance().getCore()->getNavigator()->get const bool b = StelApp::getInstance().getCore()->getNavigator()->get
CurrentLocation().getID() CurrentLocation().getID() == StelApp::getInstance().getCore()->getNavigator
==StelApp::getInstance().getCore()->getNavigator()-> ()->getDefaultLocationID();
getDefaultLocationID();
if (b!=ui->useAsDefaultLocationCheckBox->isChecked()) if (b!=ui->useAsDefaultLocationCheckBox->isChecked())
{ {
ui->useAsDefaultLocationCheckBox->setChecked(b); ui->useAsDefaultLocationCheckBox->setChecked(b);
ui->useAsDefaultLocationCheckBox->setEnabled(!b); ui->useAsDefaultLocationCheckBox->setEnabled(!b);
} }
// removing this check and return... we might have the location chan ged // removing this check and return... we might have the location chan ged
// by a script or plugin, and as such we should update the map whene ver the // by a script or plugin, and as such we should update the map whene ver the
// location window is visible. // location window is visible.
//if (isEditingNew==true) if (isEditingNew==true)
// return; return;
const QString& key1 = StelApp::getInstance().getCore()->getNavigator ()->getCurrentLocation().getID(); const QString& key1 = StelApp::getInstance().getCore()->getNavigator ()->getCurrentLocation().getID();
const QString& key2 = locationFromFields().getID(); const QString& key2 = locationFromFields().getID();
if (key1!=key2) if (key1!=key2)
{ {
setFieldsFromLocation(StelApp::getInstance().getCore()->getN avigator()->getCurrentLocation()); setFieldsFromLocation(StelApp::getInstance().getCore()->getN avigator()->getCurrentLocation());
} }
} }
void LocationDialog::disconnectEditSignals() void LocationDialog::disconnectEditSignals()
skipping to change at line 227 skipping to change at line 226
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "ERROR - could not find planet map for " << loc.planetName << e.what(); qWarning() << "ERROR - could not find planet map for " << loc.planetName << e.what();
return; return;
} }
pixmap = QPixmap(path); pixmap = QPixmap(path);
} }
else else
{ {
SolarSystem* ssm = (SolarSystem*)GETSTELMODULE("SolarSystem" ); SolarSystem* ssm = GETSTELMODULE(SolarSystem);
Planet* p = ssm->searchByEnglishName(loc.planetName); Planet* p = ssm->searchByEnglishName(loc.planetName);
if (p) if (p)
{ {
try try
{ {
path = StelApp::getInstance().getFileMgr().f indFile("textures/"+p->getTextMapName()); path = StelApp::getInstance().getFileMgr().f indFile("textures/"+p->getTextMapName());
} }
catch (std::runtime_error& e) catch (std::runtime_error& e)
{ {
qWarning() << "ERROR - could not find planet map for " << loc.planetName << e.what(); qWarning() << "ERROR - could not find planet map for " << loc.planetName << e.what();
skipping to change at line 314 skipping to change at line 313
} }
void LocationDialog::spinBoxChanged(int i) void LocationDialog::spinBoxChanged(int i)
{ {
reportEdit(); reportEdit();
StelLocation loc = locationFromFields(); StelLocation loc = locationFromFields();
StelApp::getInstance().getCore()->getNavigator()->moveObserverTo(loc , 0.); StelApp::getInstance().getCore()->getNavigator()->moveObserverTo(loc , 0.);
} }
// Called when the location name is manually changed // Called when the location name is manually changed
void LocationDialog::locationNameChanged(const QString& text) void LocationDialog::locationNameChanged(const QString&)
{ {
reportEdit(); reportEdit();
} }
void LocationDialog::reportEdit() void LocationDialog::reportEdit()
{ {
if (isEditingNew==false) if (isEditingNew==false)
{ {
// The user starts editing manually a field, this creates au tomatically a new location // The user starts editing manually a field, this creates au tomatically a new location
// and allows to save it to the user locations list // and allows to save it to the user locations list
isEditingNew=true; isEditingNew=true;
} }
StelLocation loc = locationFromFields(); StelLocation loc = locationFromFields();
if (!StelApp::getInstance().getLocationMgr().canSaveUserLocation(loc )) if (!StelApp::getInstance().getLocationMgr().canSaveUserLocation(loc ))
{ {
ui->cityNameLineEdit->setText("New Location"); if (ui->cityNameLineEdit->hasFocus())
ui->cityNameLineEdit->selectAll(); {
loc = locationFromFields(); // The user is editing the location name: don't chan
ge it!
ui->addLocationToListPushButton->setEnabled(false);
ui->deleteLocationFromListPushButton->setEnabled(fal
se);
return;
}
else
{
ui->cityNameLineEdit->setText(q_("New Location"));
ui->cityNameLineEdit->selectAll();
loc = locationFromFields();
}
} }
ui->addLocationToListPushButton->setEnabled(isEditingNew && StelApp: :getInstance().getLocationMgr().canSaveUserLocation(loc)); ui->addLocationToListPushButton->setEnabled(isEditingNew && StelApp: :getInstance().getLocationMgr().canSaveUserLocation(loc));
ui->deleteLocationFromListPushButton->setEnabled(StelApp::getInstanc e().getLocationMgr().canDeleteUserLocation(loc.getID())); ui->deleteLocationFromListPushButton->setEnabled(StelApp::getInstanc e().getLocationMgr().canDeleteUserLocation(loc.getID()));
} }
// Called when the user clic on the save button // Called when the user clic on the save button
void LocationDialog::addCurrentLocationToList() void LocationDialog::addCurrentLocationToList()
{ {
const StelLocation& loc = locationFromFields(); const StelLocation& loc = locationFromFields();
ui->citySearchLineEdit->clear(); ui->citySearchLineEdit->clear();
 End of changes. 6 change blocks. 
12 lines changed or deleted 23 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/