[Kstars-devel] branches/kstars/summer/kstars/kstars/comast
Prakash Mohan
prak902000 at gmail.com
Thu Aug 13 14:47:25 CEST 2009
SVN commit 1010785 by prakash:
Using descriptive names instead of just the ids for the display of the eyepiece, filter and barlow/focal-reducer lenses.
CCMAIL: kstars-devel at kde.org
M +19 -19 equipmentwriter.cpp
M +7 -7 execute.cpp
M +3 -2 eyepiece.cpp
M +4 -3 eyepiece.h
M +3 -2 filter.cpp
M +5 -4 filter.h
M +6 -2 lens.cpp
M +4 -3 lens.h
M +27 -6 log.cpp
M +7 -4 log.h
--- branches/kstars/summer/kstars/kstars/comast/equipmentwriter.cpp #1010784:1010785
@@ -104,7 +104,7 @@
void EquipmentWriter::slotSetScope( QString name) {
Comast::Scope *s = ks->data()->logObject()->findScopeByName( name );
if ( s ) {
- ui.Id->setText( s->name() ) ;
+ ui.Id->setText( s->id() ) ;
ui.Model->setText( s->model() );
ui.Vendor->setText( s->vendor() );
ui.Type->setCurrentIndex( ui.Type->findText( s->type() ) );
@@ -122,7 +122,7 @@
}
void EquipmentWriter::slotAddEyepiece() {
- while ( ks->data()->logObject()->findEyepieceByName( i18n("eyepiece_") + QString::number( nextEyepiece ) ) )
+ while ( ks->data()->logObject()->findEyepieceById( i18n("eyepiece_") + QString::number( nextEyepiece ) ) )
nextEyepiece++;
Comast::Eyepiece *e = new Comast::Eyepiece( i18n("eyepiece_") + QString::number( nextEyepiece++ ), ui.e_Model->text(), ui.e_Vendor->text(), ui.Fov->value(), ui.FovUnit->currentText(), ui.e_focalLength->value() );
ks->data()->logObject()->eyepieceList()->append( e );
@@ -145,7 +145,7 @@
ui.e_focalLength->setValue(0);
ui.EyepieceList->clear();
foreach( Comast::Eyepiece *e, *( ks->data()->logObject()->eyepieceList() ) )
- ui.EyepieceList->addItem( e->id() );
+ ui.EyepieceList->addItem( e->name() );
}
void EquipmentWriter::slotSaveEyepiece() {
Comast::Eyepiece *e = ks->data()->logObject()->findEyepieceByName( ui.e_Id->text() );
@@ -155,9 +155,9 @@
saveEquipment(); //Save the new list.
}
-void EquipmentWriter::slotSetEyepiece( QString id ) {
+void EquipmentWriter::slotSetEyepiece( QString name ) {
Comast::Eyepiece *e;
- e = ks->data()->logObject()->findEyepieceByName( id );
+ e = ks->data()->logObject()->findEyepieceByName( name );
if( e ) {
ui.e_Id->setText( e->id() );
ui.e_Model->setText( e->model() );
@@ -179,7 +179,7 @@
}
void EquipmentWriter::slotAddLens() {
- while ( ks->data()->logObject()->findLensByName( i18n("lens_") + QString::number( nextLens ) ) )
+ while ( ks->data()->logObject()->findLensById( i18n("lens_") + QString::number( nextLens ) ) )
nextLens++;
Comast::Lens *l = new Comast::Lens( i18n("lens_") + QString::number( nextLens++ ), ui.l_Model->text(), ui.l_Vendor->text(), ui.l_Factor->value() );
ks->data()->logObject()->lensList()->append( l );
@@ -200,7 +200,7 @@
ui.l_Factor->setValue(0);
ui.LensList->clear();
foreach( Comast::Lens *l, *( ks->data()->logObject()->lensList() ) )
- ui.LensList->addItem( l->id() );
+ ui.LensList->addItem( l->name() );
}
void EquipmentWriter::slotSaveLens() {
Comast::Lens *l = ks->data()->logObject()->findLensByName( ui.l_Id->text() );
@@ -210,9 +210,9 @@
saveEquipment(); //Save the new list.
}
-void EquipmentWriter::slotSetLens( QString id ) {
+void EquipmentWriter::slotSetLens( QString name ) {
Comast::Lens *l;
- l = ks->data()->logObject()->findLensByName( id );
+ l = ks->data()->logObject()->findLensByName( name );
if( l ) {
ui.l_Id->setText( l->id() );
ui.l_Model->setText( l->model() );
@@ -232,7 +232,7 @@
}
void EquipmentWriter::slotAddFilter() {
- while ( ks->data()->logObject()->findFilterByName( i18n("filter_") + QString::number( nextFilter ) ) )
+ while ( ks->data()->logObject()->findFilterById( i18n("filter_") + QString::number( nextFilter ) ) )
nextFilter++;
Comast::Filter *f = new Comast::Filter( i18n("filter_") + QString::number( nextFilter++ ), ui.f_Model->text(), ui.f_Vendor->text(), ui.f_Type->text(), ui.f_Color->text() );
ks->data()->logObject()->filterList()->append( f );
@@ -255,7 +255,7 @@
ui.f_Color->clear();
ui.FilterList->clear();
foreach( Comast::Filter *f, *( ks->data()->logObject()->filterList() ) )
- ui.FilterList->addItem( f->id() );
+ ui.FilterList->addItem( f->name() );
}
void EquipmentWriter::slotSaveFilter() {
@@ -266,9 +266,9 @@
saveEquipment(); //Save the new list.
}
-void EquipmentWriter::slotSetFilter( QString id ) {
+void EquipmentWriter::slotSetFilter( QString name ) {
Comast::Filter *f;
- f = ks->data()->logObject()->findFilterByName( id );
+ f = ks->data()->logObject()->findFilterByName( name );
if( f ) {
ui.f_Id->setText( f->id() );
ui.f_Model->setText( f->model() );
@@ -322,11 +322,11 @@
foreach( Comast::Scope *s, *( ks->data()->logObject()->scopeList() ) )
ui.ScopeList->addItem( s->name() );
foreach( Comast::Eyepiece *e, *( ks->data()->logObject()->eyepieceList() ) )
- ui.EyepieceList->addItem( e->id() );
+ ui.EyepieceList->addItem( e->name() );
foreach( Comast::Lens *l, *( ks->data()->logObject()->lensList() ) )
- ui.LensList->addItem( l->id() );
+ ui.LensList->addItem( l->name() );
foreach( Comast::Filter *f, *( ks->data()->logObject()->filterList() ) )
- ui.FilterList->addItem( f->id() );
+ ui.FilterList->addItem( f->name() );
}
void EquipmentWriter::slotSave() {
@@ -348,7 +348,7 @@
slotSaveEyepiece();
ui.EyepieceList->clear();
foreach( Comast::Eyepiece *e, *( ks->data()->logObject()->eyepieceList() ) )
- ui.EyepieceList->addItem( e->id() );
+ ui.EyepieceList->addItem( e->name() );
break;
}
case 2: {
@@ -358,7 +358,7 @@
slotSaveLens();
ui.LensList->clear();
foreach( Comast::Lens *l, *( ks->data()->logObject()->lensList() ) )
- ui.LensList->addItem( l->id() );
+ ui.LensList->addItem( l->name() );
break;
}
case 3: {
@@ -368,7 +368,7 @@
slotSaveFilter();
ui.FilterList->clear();
foreach( Comast::Filter *f, *( ks->data()->logObject()->filterList() ) )
- ui.FilterList->addItem( f->id() );
+ ui.FilterList->addItem( f->name() );
break;
}
}
--- branches/kstars/summer/kstars/kstars/comast/execute.cpp #1010784:1010785
@@ -114,11 +114,11 @@
if( currentScope )
ui.Scope->setCurrentIndex( ui.Scope->findText( currentScope->name()) );
if( currentEyepiece )
- ui.Eyepiece->setCurrentIndex( ui.Eyepiece->findText( currentEyepiece->id()) );
+ ui.Eyepiece->setCurrentIndex( ui.Eyepiece->findText( currentEyepiece->name()) );
if( currentLens )
- ui.Lens->setCurrentIndex( ui.Lens->findText( currentLens->id()) );
+ ui.Lens->setCurrentIndex( ui.Lens->findText( currentLens->name()) );
if( currentFilter )
- ui.Filter->setCurrentIndex( ui.Filter->findText( currentFilter->id()) );
+ ui.Filter->setCurrentIndex( ui.Filter->findText( currentFilter->name()) );
}
int Execute::findIndexOfTarget( QString name ) {
@@ -196,11 +196,11 @@
foreach( Comast::Scope *s, *( logObject->scopeList() ) )
ui.Scope->addItem( s->name() );
foreach( Comast::Eyepiece *e, *( logObject->eyepieceList() ) )
- ui.Eyepiece->addItem( e->id() );
+ ui.Eyepiece->addItem( e->name() );
foreach( Comast::Lens *l, *( logObject->lensList() ) )
- ui.Lens->addItem( l->id() );
+ ui.Lens->addItem( l->name() );
foreach( Comast::Filter *f, *( logObject->filterList() ) )
- ui.Filter->addItem( f->id() );
+ ui.Filter->addItem( f->name() );
}
void Execute::loadObservers() {
@@ -253,7 +253,7 @@
QString observer = "";
if( currentObserver )
observer = currentObserver->id();
- Comast::Observation *o = new Comast::Observation( i18n( "observation_" ) + QString::number( nextObservation++ ) , observer, currentSession->site(), currentSession->id(), currentTarget->name(), dt, ui.FaintestStar->value(), ui.Seeing->value(), currentScope->id(), ui.Eyepiece->currentText(), ui.Lens->currentText(), ui.Filter->currentText(), ui.Description->toPlainText(), ui.Language->text() );
+ Comast::Observation *o = new Comast::Observation( i18n( "observation_" ) + QString::number( nextObservation++ ) , observer, currentSession->site(), currentSession->id(), currentTarget->name(), dt, ui.FaintestStar->value(), ui.Seeing->value(), currentScope->id(), currentEyepiece->id(), currentLens->id(), currentFilter->id(), ui.Description->toPlainText(), ui.Language->text() );
logObject->observationList()->append( o );
ui.Description->clear();
return true;
--- branches/kstars/summer/kstars/kstars/comast/eyepiece.cpp #1010784:1010785
@@ -18,11 +18,12 @@
#include "comast/eyepiece.h"
-void Comast::Eyepiece::setEyepiece( QString _name, QString _model, QString _vendor, double _fov, QString _fovUnit, double _focalLength ) {
- m_Name = _name;
+void Comast::Eyepiece::setEyepiece( QString _id, QString _model, QString _vendor, double _fov, QString _fovUnit, double _focalLength ) {
+ m_Id = _id;
m_Model = _model;
m_Vendor = _vendor;
m_AppFovUnit = _fovUnit;
m_AppFOV = _fov;
m_FocalLength = _focalLength;
+ m_Name = _vendor + " " + _model + " " + QString::number( _focalLength ) + "mm (" + _id + ")";
}
--- branches/kstars/summer/kstars/kstars/comast/eyepiece.h #1010784:1010785
@@ -25,15 +25,16 @@
class Comast::Eyepiece {
public:
Eyepiece( QString id, QString model, QString vendor, double fov, QString fovUnit, double focalLength ) { setEyepiece( id, model, vendor, fov, fovUnit, focalLength ); }
- QString id() { return m_Name; }
+ QString id() { return m_Id; }
+ QString name() { return m_Name; }
QString model() { return m_Model; }
QString vendor() { return m_Vendor; }
QString fovUnit() { return m_AppFovUnit; }
double appFov() { return m_AppFOV; }
double focalLength() { return m_FocalLength; }
- void setEyepiece( QString _name, QString _model, QString _vendor, double _fov, QString _fovUnit, double _focalLength );
+ void setEyepiece( QString _id, QString _model, QString _vendor, double _fov, QString _fovUnit, double _focalLength );
private:
- QString m_Name, m_Model, m_AppFovUnit, m_Vendor;
+ QString m_Id, m_Model, m_AppFovUnit, m_Vendor, m_Name;
double m_AppFOV, m_FocalLength;
};
#endif
--- branches/kstars/summer/kstars/kstars/comast/filter.cpp #1010784:1010785
@@ -18,10 +18,11 @@
#include "comast/filter.h"
-void Comast::Filter::setFilter( QString _name, QString _model, QString _vendor, QString _type, QString _color ){
- m_Name = _name;
+void Comast::Filter::setFilter( QString _id, QString _model, QString _vendor, QString _type, QString _color ){
+ m_Id = _id;
m_Model = _model;
m_Vendor = _vendor;
m_Type = _type;
m_Color = _color;
+ m_Name = _vendor + " " + _model + " - " + _type + " " + _color + " (" + _id + ")";
}
--- branches/kstars/summer/kstars/kstars/comast/filter.h #1010784:1010785
@@ -24,14 +24,15 @@
class Comast::Filter {
public:
- Filter( QString name, QString model, QString vendor, QString type, QString color ) { setFilter( name, model, vendor, type, color ); }
- QString id() { return m_Name; }
+ Filter( QString id, QString model, QString vendor, QString type, QString color ) { setFilter( id, model, vendor, type, color ); }
+ QString id() { return m_Id; }
+ QString name() { return m_Name; }
QString model() { return m_Model; }
QString vendor() { return m_Vendor; }
QString type() { return m_Type; }
QString color() { return m_Color; }
- void setFilter( QString _name, QString _model, QString _vendor, QString _type, QString _color );
+ void setFilter( QString _id, QString _model, QString _vendor, QString _type, QString _color );
private:
- QString m_Name, m_Model, m_Vendor, m_Type, m_Color;
+ QString m_Id, m_Model, m_Vendor, m_Type, m_Color, m_Name;
};
#endif
--- branches/kstars/summer/kstars/kstars/comast/lens.cpp #1010784:1010785
@@ -18,9 +18,13 @@
#include "comast/lens.h"
-void Comast::Lens::setLens( QString _name, QString _model, QString _vendor, double _factor ){
- m_Name = _name;
+void Comast::Lens::setLens( QString _id, QString _model, QString _vendor, double _factor ){
+ m_Id = _id;
m_Model = _model;
m_Vendor = _vendor;
m_Factor = _factor;
+ if( _factor > 1 )
+ m_Name = _vendor + " " + _model + " - " + QString::number( _factor ) + "x Barlow (" + _id + ")";
+ else
+ m_Name = _vendor + " " + _model + " - " + QString::number( _factor ) + "x Focal Reducer (" + _id + ")";
}
--- branches/kstars/summer/kstars/kstars/comast/lens.h #1010784:1010785
@@ -25,13 +25,14 @@
class Comast::Lens {
public:
Lens( QString id, QString model, QString vendor, double factor ) { setLens( id, model, vendor, factor ); }
- QString id() { return m_Name; }
+ QString id() { return m_Id; }
+ QString name() { return m_Name; }
QString model() { return m_Model; }
QString vendor() { return m_Vendor; }
double factor() { return m_Factor; }
- void setLens( QString _name, QString _model, QString _vendor, double _factor );
+ void setLens( QString _id, QString _model, QString _vendor, double _factor );
private:
- QString m_Name, m_Model, m_Vendor;
+ QString m_Id, m_Model, m_Vendor, m_Name;
double m_Factor;
};
#endif
--- branches/kstars/summer/kstars/kstars/comast/log.cpp #1010784:1010785
@@ -924,6 +924,27 @@
return NULL;
}
+Comast::Eyepiece* Comast::Log::findEyepieceById( QString id ) {
+ foreach( Comast::Eyepiece *e, *eyepieceList() )
+ if( e->id() == id )
+ return e;
+ return NULL;
+}
+
+Comast::Lens* Comast::Log::findLensById( QString id ) {
+ foreach( Comast::Lens *l, *lensList() )
+ if( l->id() == id )
+ return l;
+ return NULL;
+}
+
+Comast::Filter* Comast::Log::findFilterById( QString id ) {
+ foreach( Comast::Filter *f, *filterList() )
+ if( f->id() == id )
+ return f;
+ return NULL;
+}
+
Comast::Scope* Comast::Log::findScopeByName( QString name ) {
foreach( Comast::Scope *s, *scopeList() )
if( s->name() == name )
@@ -931,23 +952,23 @@
return NULL;
}
-Comast::Eyepiece* Comast::Log::findEyepieceByName( QString id ) {
+Comast::Eyepiece* Comast::Log::findEyepieceByName( QString name ) {
foreach( Comast::Eyepiece *e, *eyepieceList() )
- if( e->id() == id )
+ if( e->name() == name )
return e;
return NULL;
}
-Comast::Filter* Comast::Log::findFilterByName( QString id ) {
+Comast::Filter* Comast::Log::findFilterByName( QString name ) {
foreach( Comast::Filter *f, *filterList() )
- if( f->id() == id )
+ if( f->name() == name )
return f;
return NULL;
}
-Comast::Lens* Comast::Log::findLensByName( QString id ) {
+Comast::Lens* Comast::Log::findLensByName( QString name ) {
foreach( Comast::Lens *l, *lensList() )
- if( l->id() == id )
+ if( l->name() == name )
return l;
return NULL;
}
--- branches/kstars/summer/kstars/kstars/comast/log.h #1010784:1010785
@@ -103,10 +103,13 @@
Comast::Session* findSessionByName( QString id );
Comast::Scope* findScopeByName( QString name );
Comast::Scope* findScopeById( QString id );
- Comast::Eyepiece* findEyepieceByName( QString id );
- Comast::Lens* findLensByName( QString id );
- Comast::Filter* findFilterByName( QString id );
- Comast::Observation* findObservationByName( QString id );
+ Comast::Eyepiece* findEyepieceById( QString id );
+ Comast::Lens* findLensById( QString id );
+ Comast::Filter* findFilterById( QString id );
+ Comast::Eyepiece* findEyepieceByName( QString name );
+ Comast::Lens* findLensByName( QString name );
+ Comast::Filter* findFilterByName( QString name );
+ Comast::Observation* findObservationByName( QString name );
QHash<QString, QTime> timeHash() { return TimeHash; }
KStarsDateTime dateTime() { return dt; }
GeoLocation* geoLocation() { return geo; }
More information about the Kstars-devel
mailing list