20 #include "ui_equipmentwriter.h"
24 #include <kstandarddirs.h>
33 #include <config-kstars.h>
42 ui.tabWidget->setCurrentIndex(0);
43 setMainWidget( widget );
44 setCaption( i18n(
"Define Equipment" ) );
45 setButtons( KDialog::Close );
63 connect(
this, SIGNAL( closeClicked() ),
this, SLOT( slotClose() ) );
64 connect( ui.NewScope, SIGNAL( clicked() ),
this, SLOT( slotNewScope() ) );
65 connect( ui.NewEyepiece, SIGNAL( clicked() ),
this, SLOT( slotNewEyepiece() ) );
66 connect( ui.NewLens, SIGNAL( clicked() ),
this, SLOT( slotNewLens() ) );
67 connect( ui.NewFilter, SIGNAL( clicked() ),
this, SLOT( slotNewFilter() ) );
68 connect( ui.AddScope, SIGNAL( clicked() ),
this, SLOT( slotSave() ) );
69 connect( ui.AddEyepiece, SIGNAL( clicked() ),
this, SLOT( slotSave() ) );
70 connect( ui.AddLens, SIGNAL( clicked() ),
this, SLOT( slotSave() ) );
71 connect( ui.AddFilter, SIGNAL( clicked() ),
this, SLOT( slotSave() ) );
72 connect( ui.ScopeList, SIGNAL( currentTextChanged(
const QString) ),
73 this, SLOT( slotSetScope(QString) ) );
74 connect( ui.EyepieceList, SIGNAL( currentTextChanged(
const QString) ),
75 this, SLOT( slotSetEyepiece(QString) ) );
76 connect( ui.LensList, SIGNAL( currentTextChanged(
const QString) ),
77 this, SLOT( slotSetLens(QString) ) );
78 connect( ui.FilterList, SIGNAL( currentTextChanged(
const QString) ),
79 this, SLOT( slotSetFilter(QString) ) );
80 connect( ui.RemoveScope, SIGNAL( clicked() ),
this, SLOT( slotRemoveScope() ) );
81 connect( ui.RemoveEyepiece, SIGNAL( clicked() ),
this, SLOT( slotRemoveEyepiece() ) );
82 connect( ui.RemoveLens, SIGNAL( clicked() ),
this, SLOT( slotRemoveLens() ) );
83 connect( ui.RemoveFilter, SIGNAL( clicked() ),
this, SLOT( slotRemoveFilter() ) );
87 ks->data()->userdb()->AddScope(ui.Model->text(), ui.Vendor->text(), ui.driverComboBox->currentText(),
88 ui.Type->currentText(), ui.FocalLength->value(), ui.Aperture->value());
92 ui.FocalLength->setValue(0);
93 ui.Aperture->setValue(0);
94 ui.driverComboBox->setCurrentIndex(0);
98 ks->data()->userdb()->EraseEquipment(
"telescope",ui.Id->text().toInt());
101 ui.FocalLength->setValue(0);
102 ui.Aperture->setValue(0);
107 ks->data()->userdb()->AddScope(ui.Model->text(), ui.Vendor->text(), ui.driverComboBox->currentText(),
108 ui.Type->currentText(), ui.FocalLength->value(), ui.Aperture->value(),
116 OAL::Scope *s = ks->data()->logObject()->findScopeByName( name );
118 ui.Id->setText( s->
id() ) ;
119 ui.Model->setText( s->
model() );
120 ui.Vendor->setText( s->
vendor() );
121 ui.Type->setCurrentIndex( ui.Type->findText( s->
type() ) );
123 ui.Aperture->setValue( s->
aperture() );
124 ui.driverComboBox->setCurrentIndex(ui.driverComboBox->findText(s->
driver()));
132 ui.FocalLength->setValue(0);
133 ui.driverComboBox->setCurrentIndex(0);
134 ui.ScopeList->selectionModel()->clear();
139 ks->data()->userdb()->AddEyepiece(ui.e_Vendor->text(), ui.e_Model->text(),
140 ui.e_focalLength->value(), ui.Fov->value(),
141 ui.FovUnit->currentText());
145 ui.e_Vendor->clear();
147 ui.e_focalLength->setValue(0);
151 ks->data()->userdb()->EraseEquipment(
"eyepiece",ui.e_Id->text().toInt());
155 ui.e_Vendor->clear();
157 ui.e_focalLength->setValue(0);
158 ui.EyepieceList->clear();
159 foreach(
OAL::Eyepiece *e, *( ks->data()->logObject()->eyepieceList() ) )
160 ui.EyepieceList->addItem( e->
name() );
163 ks->data()->userdb()->AddEyepiece(ui.e_Vendor->text(), ui.e_Model->text(),
164 ui.e_focalLength->value(), ui.Fov->value(),
165 ui.FovUnit->currentText(), ui.e_Id->text());
172 e = ks->data()->logObject()->findEyepieceByName( name );
174 ui.e_Id->setText( e->
id() );
175 ui.e_Model->setText( e->
model() );
176 ui.e_Vendor->setText( e->
vendor() );
177 ui.Fov->setValue( e->
appFov() );
186 ui.e_Vendor->clear();
188 ui.e_focalLength->setValue(0);
189 ui.EyepieceList->selectionModel()->clear();
194 ks->data()->userdb()->AddLens(ui.l_Vendor->text(), ui.l_Model->text(), ui.l_Factor->value() );
198 ui.l_Vendor->clear();
199 ui.l_Factor->setValue(0);
203 ks->data()->userdb()->EraseEquipment(
"lens",ui.l_Id->text().toInt());
207 ui.l_Vendor->clear();
208 ui.l_Factor->setValue(0);
209 ui.LensList->clear();
210 foreach(
OAL::Lens *l, *( ks->data()->logObject()->lensList() ) )
211 ui.LensList->addItem( l->
name() );
214 ks->data()->userdb()->AddLens(ui.l_Vendor->text(), ui.l_Model->text(),
215 ui.l_Factor->value(), ui.l_Id->text());
221 l = ks->data()->logObject()->findLensByName( name );
223 ui.l_Id->setText( l->
id() );
224 ui.l_Model->setText( l->
model() );
225 ui.l_Vendor->setText( l->
vendor() );
226 ui.l_Factor->setValue( l->
factor() );
234 ui.l_Vendor->clear();
235 ui.l_Factor->setValue(0);
236 ui.LensList->selectionModel()->clear();
241 ks->data()->userdb()->AddFilter( ui.f_Vendor->text(), ui.f_Model->text(),
242 ui.f_Type->text(), ui.f_Color->text());
246 ui.f_Vendor->clear();
252 ks->data()->userdb()->EraseEquipment(
"filter",ui.f_Id->text().toInt());
256 ui.f_Vendor->clear();
259 ui.FilterList->clear();
260 foreach(
OAL::Filter *
f, *( ks->data()->logObject()->filterList() ) )
261 ui.FilterList->addItem( f->
name() );
265 ks->data()->userdb()->AddFilter( ui.f_Vendor->text(), ui.f_Model->text(),
266 ui.f_Type->text(), ui.f_Color->text(),
273 f = ks->data()->logObject()->findFilterByName( name );
275 ui.f_Id->setText( f->
id() );
276 ui.f_Model->setText( f->
model() );
277 ui.f_Vendor->setText( f->
vendor() );
278 ui.f_Type->setText( f->
type() );
279 ui.f_Color->setText( f->
color() );
287 ui.f_Vendor->clear();
290 ui.FilterList->selectionModel()->clear();
295 ks->data()->logObject()->readScopes();
296 ks->data()->logObject()->readEyepieces();
297 ks->data()->logObject()->readLenses();
298 ks->data()->logObject()->readFilters();
299 ui.ScopeList->clear();
300 ui.EyepieceList->clear();
301 ui.LensList->clear();
302 ui.FilterList->clear();
303 foreach(
OAL::Scope *s, *( ks->data()->logObject()->scopeList() ) )
304 ui.ScopeList->addItem( s->
name() );
305 foreach(
OAL::Eyepiece *e, *( ks->data()->logObject()->eyepieceList() ) )
306 ui.EyepieceList->addItem( e->
name() );
307 foreach(
OAL::Lens *l, *( ks->data()->logObject()->lensList() ) )
308 ui.LensList->addItem( l->
name() );
309 foreach(
OAL::Filter *
f, *( ks->data()->logObject()->filterList() ) )
310 ui.FilterList->addItem( f->
name() );
319 switch( ui.tabWidget->currentIndex() ) {
325 ui.ScopeList->clear();
326 foreach(
OAL::Scope *s, *( ks->data()->logObject()->scopeList() ) )
327 ui.ScopeList->addItem( s->
name() );
335 ui.EyepieceList->clear();
336 foreach(
OAL::Eyepiece *e, *( ks->data()->logObject()->eyepieceList() ) )
337 ui.EyepieceList->addItem( e->
name() );
345 ui.LensList->clear();
346 foreach(
OAL::Lens *l, *( ks->data()->logObject()->lensList() ) )
347 ui.LensList->addItem( l->
name() );
355 ui.FilterList->clear();
356 foreach(
OAL::Filter *
f, *( ks->data()->logObject()->filterList() ) )
357 ui.FilterList->addItem( f->
name() );
368 #include "equipmentwriter.moc"
void slotSetEyepiece(QString)
static KStars * Instance()
void slotSetFilter(QString)
void slotRemoveEyepiece()
double focalLength() const
void slotSetScope(QString)
double focalLength() const
void slotSetLens(QString)
static DriverManager * Instance()