summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorg Zotti <Georg.Zotti@univie.ac.at>2023-05-18 17:54:25 +0200
committerGeorg Zotti <Georg.Zotti@univie.ac.at>2023-05-18 17:54:25 +0200
commit4b635c8b1e58269b961390e535c2739b910589d7 (patch)
tree8c01c303daff29e83c8b16f3a239351881b9af05
parente9237b216691f1a05c5cc7a0b318d22ccdc72c7b (diff)
Move 2 buttons into location dialogfix/location_signals
- also fix updating a list (select locations on current planet)
-rw-r--r--src/gui/ConfigurationDialog.cpp3
-rw-r--r--src/gui/LocationDialog.cpp21
-rw-r--r--src/gui/configurationDialog.ui20
-rw-r--r--src/gui/locationDialogGui.ui20
4 files changed, 39 insertions, 25 deletions
diff --git a/src/gui/ConfigurationDialog.cpp b/src/gui/ConfigurationDialog.cpp
index b67003a04c..5eb127f6f1 100644
--- a/src/gui/ConfigurationDialog.cpp
+++ b/src/gui/ConfigurationDialog.cpp
@@ -397,9 +397,6 @@ void ConfigurationDialog::createDialogContent()
connect(mainView, SIGNAL(sizeChanged(const QSize&)), this, SLOT(updateDpiTooltip()));
updateDpiTooltip();
- connectBoolProperty(ui->autoEnableEnvironmentCheckBox, "LandscapeMgr.flagEnvironmentAutoEnabling");
- connectBoolProperty(ui->autoChangeLandscapesCheckBox, "LandscapeMgr.flagLandscapeAutoSelection");
-
// script tab controls
#ifdef ENABLE_SCRIPTING
StelScriptMgr& scriptMgr = StelApp::getInstance().getScriptMgr();
diff --git a/src/gui/LocationDialog.cpp b/src/gui/LocationDialog.cpp
index fe59d4ba3a..f3bc7580c9 100644
--- a/src/gui/LocationDialog.cpp
+++ b/src/gui/LocationDialog.cpp
@@ -190,6 +190,8 @@ void LocationDialog::createDialogContent()
ui->timeZoneNameComboBox->setEnabled(core->getUseCustomTimeZone());
connect(ui->useCustomTimeZoneCheckBox, SIGNAL(clicked(bool)), this, SLOT(updateTimeZoneControls(bool)));
connect(core, SIGNAL(currentTimeZoneChanged(QString)), this, SLOT(setTimezone(QString)));
+ connectBoolProperty(ui->autoEnableEnvironmentCheckBox, "LandscapeMgr.flagEnvironmentAutoEnabling");
+ connectBoolProperty(ui->autoChangeLandscapesCheckBox, "LandscapeMgr.flagLandscapeAutoSelection");
connectEditSignals();
@@ -986,11 +988,26 @@ void LocationDialog::resetLocationList()
//reset search before setting model, prevents unnecessary search in full list
ui->citySearchLineEdit->setText(""); // https://wiki.qt.io/Technical_FAQ#Why_does_the_memory_keep_increasing_when_repeatedly_pasting_text_and_calling_clear.28.29_in_a_QLineEdit.3F
ui->citySearchLineEdit->setFocus();
- proxyModel->setSourceModel(allModel);
+
+ // populate site list with sites only from that planet, or full list for Earth (faster than removing the ~50 non-Earth positions...).
+ StelLocationMgr &locMgr=StelApp::getInstance().getLocationMgr();
+ StelLocation loc = locationFromFields();
+ if (loc.planetName == "Earth")
+ {
+ proxyModel->setSourceModel(allModel);
+ }
+ else
+ {
+ LocationMap results = locMgr.pickLocationsNearby(loc.planetName, 0.0f, 0.0f, 180.0f);
+ pickedModel->setStringList(results.keys());
+ proxyModel->setSourceModel(pickedModel);
+ ui->regionNameComboBox->setCurrentIndex(ui->regionNameComboBox->findData("", Qt::UserRole, Qt::MatchCaseSensitive));
+ }
+
proxyModel->sort(0, Qt::AscendingOrder);
}
-// called when user clicks in the country combobox and selects a country. The locations in the list are updated to select only sites in that country.
+// called when user clicks in the region combobox and selects a region. The locations in the list are updated to select only sites in that region.
void LocationDialog::filterSitesByRegion()
{
QString region=ui->regionNameComboBox->currentData(Qt::UserRole).toString();
diff --git a/src/gui/configurationDialog.ui b/src/gui/configurationDialog.ui
index 107c2b3374..7f78591aef 100644
--- a/src/gui/configurationDialog.ui
+++ b/src/gui/configurationDialog.ui
@@ -2037,16 +2037,6 @@
</item>
</layout>
</item>
- <item row="9" column="1">
- <widget class="QCheckBox" name="autoEnableEnvironmentCheckBox">
- <property name="toolTip">
- <string>Auto-enable atmosphere and landscape when selecting a celestial body in the location window.</string>
- </property>
- <property name="text">
- <string>Auto-enabling for the environment</string>
- </property>
- </widget>
- </item>
<item row="5" column="1">
<widget class="QCheckBox" name="autoZoomResetsDirectionCheckbox">
<property name="toolTip">
@@ -2125,16 +2115,6 @@
</property>
</widget>
</item>
- <item row="9" column="3">
- <widget class="QCheckBox" name="autoChangeLandscapesCheckBox">
- <property name="toolTip">
- <string>Automatic change of landscape when planet is changed</string>
- </property>
- <property name="text">
- <string>Auto select landscapes</string>
- </property>
- </widget>
- </item>
<item row="18" column="3">
<layout class="QHBoxLayout" name="horizontalLayout_14">
<item>
diff --git a/src/gui/locationDialogGui.ui b/src/gui/locationDialogGui.ui
index ea15a6976f..ca55ccd536 100644
--- a/src/gui/locationDialogGui.ui
+++ b/src/gui/locationDialogGui.ui
@@ -814,6 +814,26 @@
</property>
</widget>
</item>
+ <item row="6" column="0">
+ <widget class="QCheckBox" name="autoChangeLandscapesCheckBox">
+ <property name="toolTip">
+ <string>Automatic change of landscape when planet or location is changed</string>
+ </property>
+ <property name="text">
+ <string>Auto-select landscapes</string>
+ </property>
+ </widget>
+ </item>
+ <item row="6" column="1">
+ <widget class="QCheckBox" name="autoEnableEnvironmentCheckBox">
+ <property name="toolTip">
+ <string>Auto-enable atmosphere when planet is changed</string>
+ </property>
+ <property name="text">
+ <string>Auto-enable atmosphere</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>