Commit 2b4ee663 authored by Samikshan Bairagya's avatar Samikshan Bairagya

1. Enable settings icon in listview for sky-objects in QML UI.

2. Instead of disabling the settings and reload icons in the details-
view, do not show them at all.
3. Remember scope selected from list of scopes in the WI settings dialog
for every execution of KStars.
parent 36cb1de3
......@@ -1201,6 +1201,10 @@
<label>Aperture of available binocular</label>
<default>40.0</default>
</entry>
<entry name="ScopeListWidget" type="UInt">
<label>Index of selected scope from list of scopes</label>
<default>0</default>
</entry>
</group>
<group name="Ekos">
<entry name="TelescopeDriver" type="String">
......
......@@ -826,24 +826,22 @@ Rectangle {
PropertyChanges {
target: settingsMouseArea
opacity: 1
enabled: false
}
PropertyChanges {
target: settingsIcon
opacity: 0.200
opacity: 0
}
PropertyChanges {
target: reloadMouseArea
opacity: 1
enabled: false
}
PropertyChanges {
target: reloadIcon
opacity: 0.200
opacity: 0
}
when: skyObjView.flipped
......@@ -1400,17 +1398,6 @@ Rectangle {
target: backButton
x: container.width - 105
}
PropertyChanges {
target: settingsMouseArea
opacity: 1
enabled: false
}
PropertyChanges {
target: settingsIcon
opacity: 0.200
}
},
State {
name: "dsoTypeSelected"
......@@ -1506,17 +1493,6 @@ Rectangle {
target: nebText
color: "#e4800d"
}
PropertyChanges {
target: settingsMouseArea
opacity: 1
enabled: false
}
PropertyChanges {
target: settingsIcon
opacity: 0.200
}
}
]
......
......@@ -28,21 +28,21 @@ WIEquipSettings::WIEquipSettings(KStars* ks): QFrame(ks), m_Ks(ks)
{
setupUi(this);
populateScopeListWidget();
scopeListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
kcfg_ScopeListWidget->setSelectionMode(QAbstractItemView::SingleSelection);
binoDetailsFrame->setEnabled(kcfg_BinocularsCheck->isChecked());
scopeFrame->setEnabled(kcfg_TelescopeCheck->isChecked());
connect(kcfg_TelescopeCheck, SIGNAL(toggled(bool)), this, SLOT(slotTelescopeCheck(bool)));
connect(kcfg_BinocularsCheck, SIGNAL(toggled(bool)), this, SLOT(slotBinocularsCheck(bool)));
connect(kcfg_NoEquipCheck, SIGNAL(toggled(bool)), this, SLOT(slotNoEquipCheck(bool)));
connect(scopeListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this,
connect(kcfg_ScopeListWidget, SIGNAL(currentItemChanged(QListWidgetItem*,QListWidgetItem*)), this,
SLOT(slotScopeSelected(QListWidgetItem *)));
connect(saveNewScopeButton, SIGNAL(clicked()), this, SLOT(slotSaveNewScope()));
}
void WIEquipSettings::populateScopeListWidget()
{
scopeListWidget->clear();
kcfg_ScopeListWidget->clear();
///Get telescope list from KStars user database.
KStars::Instance()->data()->userdb()->GetAllScopes(m_ScopeList);
foreach(OAL::Scope *scope, m_ScopeList)
......@@ -55,14 +55,14 @@ void WIEquipSettings::populateScopeListWidget()
scopeItem->setData(FocalLength, scope->focalLength());
scopeItem->setData(Type, scope->type());
scopeListWidget->addItem(scopeItem);
kcfg_ScopeListWidget->addItem(scopeItem);
}
if (scopeListWidget->count() == 0) return;
if (kcfg_ScopeListWidget->count() == 0) return;
vendorText->setText(scopeListWidget->item(0)->data(Vendor).toString());
modelText->setText(scopeListWidget->item(0)->data(Model).toString());
apertureText->setText(scopeListWidget->item(0)->data(Aperture).toString().append(" mm"));
scopeListWidget->setCurrentItem(scopeListWidget->item(0));
vendorText->setText(kcfg_ScopeListWidget->item(0)->data(Vendor).toString());
modelText->setText(kcfg_ScopeListWidget->item(0)->data(Model).toString());
apertureText->setText(kcfg_ScopeListWidget->item(0)->data(Aperture).toString().append(" mm"));
kcfg_ScopeListWidget->setCurrentItem(kcfg_ScopeListWidget->item(Options::scopeListWidget()));
}
void WIEquipSettings::slotTelescopeCheck(bool on)
......@@ -125,7 +125,7 @@ void WIEquipSettings::slotSaveNewScope()
void WIEquipSettings::setAperture()
{
if (scopeListWidget->count() == 0)
if (kcfg_ScopeListWidget->count() == 0)
{
if (Options::binocularsCheck())
{
......@@ -149,23 +149,23 @@ void WIEquipSettings::setAperture()
}
else if (!Options::binocularsCheck()) //No binoculars available, but telescope available
{
if (scopeListWidget->count() == 0)
if (kcfg_ScopeListWidget->count() == 0)
{
m_Aperture = INVALID_APERTURE;
return;
}
else
m_Aperture = scopeListWidget->currentItem()->data(Aperture).toDouble();
m_Aperture = kcfg_ScopeListWidget->currentItem()->data(Aperture).toDouble();
}
else //Both Telescope and Binoculars available
{
if (scopeListWidget->count() == 0)
if (kcfg_ScopeListWidget->count() == 0)
{
m_Aperture = kcfg_BinocularsAperture->value();
return;
}
//If both Binoculars and Telescope available then select bigger aperture
double telAperture = scopeListWidget->currentItem()->data(Aperture).toDouble();
double telAperture = kcfg_ScopeListWidget->currentItem()->data(Aperture).toDouble();
double binoAperture = kcfg_BinocularsAperture->value();
m_Aperture = telAperture > binoAperture ? telAperture : binoAperture;
}
......
......@@ -68,7 +68,7 @@
<number>5</number>
</property>
<item>
<widget class="QListWidget" name="scopeListWidget">
<widget class="QListWidget" name="kcfg_ScopeListWidget">
<property name="minimumSize">
<size>
<width>160</width>
......
......@@ -138,8 +138,6 @@ void WIView::onSettingsIconClicked()
void WIView::onReloadIconClicked()
{
updateModels(m_Obs);
if (m_CurCategorySelected >=0 && m_CurCategorySelected <= 5)
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(m_CurCategorySelected));
}
void WIView::updateModels(ObsConditions* obs)
......@@ -152,6 +150,9 @@ void WIView::updateModels(ObsConditions* obs)
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(3));
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(4));
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(5));
if (m_CurCategorySelected >=0 && m_CurCategorySelected <= 5)
m_Ctxt->setContextProperty("soListModel", m_ModManager->returnModel(m_CurCategorySelected));
}
void WIView::loadDetailsView(SkyObjItem *soitem, int index)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment