[Kstars-devel] branches/kstars/summer/kstars/kstars/comast
Prakash Mohan
prak902000 at gmail.com
Tue Aug 11 20:24:37 CEST 2009
SVN commit 1010146 by prakash:
Displaying sensible strings in the combo boxes instead of just the id-s of the Scope element.
CCMAIL: kstars-devel at kde.org
M +7 -7 equipmentwriter.cpp
M +3 -3 execute.cpp
M +8 -1 log.cpp
M +2 -1 log.h
M +3 -3 scope.cpp
M +5 -4 scope.h
--- branches/kstars/summer/kstars/kstars/comast/equipmentwriter.cpp #1010145:1010146
@@ -71,7 +71,7 @@
}
void EquipmentWriter::slotAddScope() {
- while ( ks->data()->logObject()->findScopeByName( i18n("scope_") + QString::number( nextScope ) ) )
+ while ( ks->data()->logObject()->findScopeById( i18n("scope_") + QString::number( nextScope ) ) )
nextScope++;
Comast::Scope *s = new Comast::Scope( i18n( "scope_" ) + QString::number( nextScope++ ), ui.Model->text(), ui.Vendor->text(), ui.Type->currentText(), ui.FocalLength->value(), ui.Aperture->value() );
ks->data()->logObject()->scopeList()->append( s );
@@ -90,7 +90,7 @@
ui.FocalLength->setValue(0);
ui.ScopeList->clear();
foreach( Comast::Scope *s, *( ks->data()->logObject()->scopeList() ) )
- ui.ScopeList->addItem( s->id() );
+ ui.ScopeList->addItem( s->name() );
}
void EquipmentWriter::slotSaveScope() {
@@ -101,10 +101,10 @@
saveEquipment(); //Save the new list.
}
-void EquipmentWriter::slotSetScope( QString id) {
- Comast::Scope *s = ks->data()->logObject()->findScopeByName( id );
+void EquipmentWriter::slotSetScope( QString name) {
+ Comast::Scope *s = ks->data()->logObject()->findScopeByName( name );
if ( s ) {
- ui.Id->setText( s->id() ) ;
+ ui.Id->setText( s->name() ) ;
ui.Model->setText( s->model() );
ui.Vendor->setText( s->vendor() );
ui.Type->setCurrentIndex( ui.Type->findText( s->type() ) );
@@ -320,7 +320,7 @@
ui.LensList->clear();
ui.FilterList->clear();
foreach( Comast::Scope *s, *( ks->data()->logObject()->scopeList() ) )
- ui.ScopeList->addItem( s->id() );
+ ui.ScopeList->addItem( s->name() );
foreach( Comast::Eyepiece *e, *( ks->data()->logObject()->eyepieceList() ) )
ui.EyepieceList->addItem( e->id() );
foreach( Comast::Lens *l, *( ks->data()->logObject()->lensList() ) )
@@ -338,7 +338,7 @@
slotSaveScope();
ui.ScopeList->clear();
foreach( Comast::Scope *s, *( ks->data()->logObject()->scopeList() ) )
- ui.ScopeList->addItem( s->id() );
+ ui.ScopeList->addItem( s->name() );
break;
}
case 1: {
--- branches/kstars/summer/kstars/kstars/comast/execute.cpp #1010145:1010146
@@ -112,7 +112,7 @@
if( currentObserver )
ui.Observer->setCurrentIndex( ui.Observer->findText( currentObserver->name() + " " + currentObserver->surname() ) );
if( currentScope )
- ui.Scope->setCurrentIndex( ui.Scope->findText( currentScope->id()) );
+ ui.Scope->setCurrentIndex( ui.Scope->findText( currentScope->name()) );
if( currentEyepiece )
ui.Eyepiece->setCurrentIndex( ui.Eyepiece->findText( currentEyepiece->id()) );
if( currentLens )
@@ -194,7 +194,7 @@
ui.Lens->clear();
ui.Filter->clear();
foreach( Comast::Scope *s, *( logObject->scopeList() ) )
- ui.Scope->addItem( s->id() );
+ ui.Scope->addItem( s->name() );
foreach( Comast::Eyepiece *e, *( logObject->eyepieceList() ) )
ui.Eyepiece->addItem( e->id() );
foreach( Comast::Lens *l, *( logObject->lensList() ) )
@@ -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(), ui.Scope->currentText(), 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(), ui.Eyepiece->currentText(), ui.Lens->currentText(), ui.Filter->currentText(), ui.Description->toPlainText(), ui.Language->text() );
logObject->observationList()->append( o );
ui.Description->clear();
return true;
--- branches/kstars/summer/kstars/kstars/comast/log.cpp #1010145:1010146
@@ -917,13 +917,20 @@
return NULL;
}
-Comast::Scope* Comast::Log::findScopeByName( QString id ) {
+Comast::Scope* Comast::Log::findScopeById( QString id ) {
foreach( Comast::Scope *s, *scopeList() )
if( s->id() == id )
return s;
return NULL;
}
+Comast::Scope* Comast::Log::findScopeByName( QString name ) {
+ foreach( Comast::Scope *s, *scopeList() )
+ if( s->name() == name )
+ return s;
+ return NULL;
+}
+
Comast::Eyepiece* Comast::Log::findEyepieceByName( QString id ) {
foreach( Comast::Eyepiece *e, *eyepieceList() )
if( e->id() == id )
--- branches/kstars/summer/kstars/kstars/comast/log.h #1010145:1010146
@@ -101,7 +101,8 @@
Comast::Site* findSiteByName( QString name );
Comast::Site* findSiteById( QString id );
Comast::Session* findSessionByName( QString id );
- Comast::Scope* findScopeByName( 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 );
--- branches/kstars/summer/kstars/kstars/comast/scope.cpp #1010145:1010146
@@ -17,12 +17,12 @@
***************************************************************************/
#include "comast/scope.h"
-
-void Comast::Scope::setScope( QString _name, QString _model, QString _vendor, QString _type, double _focalLength, double _aperture ) {
- m_Name = _name;
+void Comast::Scope::setScope( QString _id, QString _model, QString _vendor, QString _type, double _focalLength, double _aperture ) {
+ m_Id = _id;
m_Model = _model;
m_Vendor = _vendor;
m_Type = _type;
m_FocalLength = _focalLength;
m_Aperture = _aperture;
+ m_Name.append ( _vendor + " " + _model + " " + QString::number( _aperture ) + "mm f/" + QString::number( (_focalLength/_aperture), 'g', 1 ) + " (" + _id + ")" ) ;
}
--- branches/kstars/summer/kstars/kstars/comast/scope.h #1010145:1010146
@@ -24,16 +24,17 @@
class Comast::Scope {
public:
- Scope( QString name, QString model, QString vendor, QString type, double focalLength, double aperture ) { setScope( name, model, vendor, type, focalLength, aperture ); }
- QString id() { return m_Name; }
+ Scope( QString id, QString model, QString vendor, QString type, double focalLength, double aperture ) { setScope( id, model, vendor, type, focalLength, aperture ); }
+ QString id() { return m_Id; }
QString model() { return m_Model; }
QString vendor() { return m_Vendor; }
QString type() { return m_Type; }
+ QString name() { return m_Name; }
double focalLength() { return m_FocalLength; }
double aperture() { return m_Aperture; }
- void setScope( QString _name, QString _model, QString _vendor, QString _type, double _focalLength, double _aperture );
+ void setScope( QString _id, QString _model, QString _vendor, QString _type, double _focalLength, double _aperture );
private:
- QString m_Name, m_Model, m_Vendor, m_Type;
+ QString m_Id, m_Model, m_Vendor, m_Type, m_Name;
double m_FocalLength, m_Aperture;
};
#endif
More information about the Kstars-devel
mailing list