7#include "wiequipsettings.h"
8#include "oal/equipmentwriter.h"
12#include <QListWidgetItem>
14WIEquipSettings::WIEquipSettings() :
QFrame(
KStars::Instance())
19 binoDetailsFrame->setEnabled(kcfg_BinocularsCheck->isChecked());
20 scopeFrame->setEnabled(kcfg_TelescopeCheck->isChecked());
22 connect(kcfg_TelescopeCheck, SIGNAL(toggled(
bool)),
this, SLOT(slotTelescopeCheck(
bool)));
23 connect(kcfg_BinocularsCheck, SIGNAL(toggled(
bool)),
this, SLOT(slotBinocularsCheck(
bool)));
24 connect(ScopeListWidget, SIGNAL(currentRowChanged(
int)),
this, SLOT(slotScopeSelected(
int)));
25 connect(saveNewScopeButton, SIGNAL(clicked()),
this, SLOT(slotAddNewScope()));
27 populateScopeListWidget();
32 ScopeListWidget->clear();
38 scopeItem->
setText(scope->vendor());
39 scopeItem->
setData(Vendor, scope->vendor());
40 scopeItem->
setData(Model, scope->model());
41 scopeItem->
setData(Aperture, scope->aperture());
42 scopeItem->
setData(FocalLength, scope->focalLength());
43 scopeItem->
setData(Type, scope->type());
45 ScopeListWidget->addItem(scopeItem);
47 if (ScopeListWidget->count() == 0)
50 vendorText->setText(ScopeListWidget->item(0)->data(Vendor).toString());
51 modelText->setText(ScopeListWidget->item(0)->data(Model).toString());
52 apertureText->setText(ScopeListWidget->item(0)->data(Aperture).toString().append(
" mm"));
54 ScopeListWidget->setCurrentRow(Options::scopeListIndex());
57void WIEquipSettings::slotTelescopeCheck(
bool on)
59 scopeFrame->setEnabled(on);
60 Options::setTelescopeCheck(on);
63void WIEquipSettings::slotBinocularsCheck(
bool on)
65 binoDetailsFrame->setEnabled(on);
66 Options::setBinocularsCheck(on);
69void WIEquipSettings::slotScopeSelected(
int row)
84 m_TelType = ObsConditions::Reflector;
86 m_TelType = ObsConditions::Refractor;
88 Options::setScopeListIndex(row);
91void WIEquipSettings::slotAddNewScope()
93 EquipmentWriter equipmentdlg;
94 equipmentdlg.loadEquipment();
102 double telAperture = INVALID_APERTURE;
103 double binoAperture = INVALID_APERTURE;
105 if (kcfg_TelescopeCheck->isChecked() && ScopeListWidget->selectedItems().isEmpty() ==
false)
106 telAperture = ScopeListWidget->currentItem()->data(Aperture).toDouble();
107 if (kcfg_BinocularsCheck->isChecked())
108 binoAperture = kcfg_BinocularsAperture->value();
109 m_Aperture = telAperture > binoAperture ? telAperture : binoAperture;
bool GetAllScopes(QList< OAL::Scope * > &m_scopeList)
updates the scope list with all scopes from database List is cleared and then filled with content.
This is the main window for KStars.
static KStars * Instance()
KStarsData * data() const
Information on telescope used in observation.
void populateScopeListWidget()
Populates scope list widget in UI with list of telescopes from KStars userdb.
void setAperture()
Set aperture to use.
void setText(const QString &text)
QString & append(QChar ch)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QString toString() const const