[Kstars-devel] branches/kstars/summer/kstars/kstars/comast

Prakash Mohan prak902000 at gmail.com
Tue Aug 11 14:18:07 CEST 2009


SVN commit 1010003 by prakash:

Make the type of the scope a combo box instead of a KLineEdit, save the scope type element in compliance with the OAL schema.

CCMAIL: kstars-devel at kde.org


 M  +3 -5      equipmentwriter.cpp  
 M  +34 -3     equipmentwriter.ui  
 M  +7 -1      log.cpp  


--- branches/kstars/summer/kstars/kstars/comast/equipmentwriter.cpp #1010002:1010003
@@ -69,18 +69,17 @@
 void EquipmentWriter::slotAddScope() {
     while ( ks->data()->logObject()->findScopeByName( 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->text(), ui.FocalLength->value(), ui.Aperture->value() ); 
+    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 );
     saveEquipment(); //Save the new list.
     ui.Model->clear();
     ui.Vendor->clear();
-    ui.Type->clear();
     ui.FocalLength->setValue(0);
 }
 void EquipmentWriter::slotSaveScope() {
     Comast::Scope *s = ks->data()->logObject()->findScopeByName( ui.Id->text() );
     if( s ) {
-        s->setScope( ui.Id->text(), ui.Model->text(), ui.Vendor->text(), ui.Type->text(), ui.FocalLength->value(), ui.Aperture->value() );
+        s->setScope( ui.Id->text(), ui.Model->text(), ui.Vendor->text(), ui.Type->currentText(), ui.FocalLength->value(), ui.Aperture->value() );
     }
     saveEquipment(); //Save the new list.
 }
@@ -91,7 +90,7 @@
         ui.Id->setText( s->id() ) ;
         ui.Model->setText( s->model() );
         ui.Vendor->setText( s->vendor() );
-        ui.Type->setText( s->type() );
+        ui.Type->setCurrentIndex( ui.Type->findText( s->type() ) );
         ui.FocalLength->setValue( s->focalLength() );
         newScope = false;
     }
@@ -100,7 +99,6 @@
     ui.Id->clear();
     ui.Model->clear();
     ui.Vendor->clear();
-    ui.Type->clear();
     ui.FocalLength->setValue(0);
     ui.ScopeList->selectionModel()->clear();
     newScope = true;
--- branches/kstars/summer/kstars/kstars/comast/equipmentwriter.ui #1010002:1010003
@@ -81,9 +81,6 @@
              </property>
             </widget>
            </item>
-           <item row="3" column="1">
-            <widget class="KLineEdit" name="Type"/>
-           </item>
            <item row="4" column="0">
             <widget class="QLabel" name="label_13">
              <property name="text">
@@ -126,6 +123,40 @@
              </item>
             </layout>
            </item>
+           <item row="3" column="1">
+            <widget class="KComboBox" name="Type">
+             <item>
+              <property name="text">
+               <string>Refractor</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Newtonian</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Maksutov</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Schmidt-Cassegrain</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Kutter (Schiefspiegler)</string>
+              </property>
+             </item>
+             <item>
+              <property name="text">
+               <string>Cassegrain</string>
+              </property>
+             </item>
+            </widget>
+           </item>
           </layout>
          </item>
          <item>
--- branches/kstars/summer/kstars/kstars/comast/log.cpp #1010002:1010003
@@ -243,7 +243,7 @@
     writer->writeCDATA( s->model() );
     writer->writeEndElement();
     writer->writeStartElement( "type" );
-    writer->writeCDATA( s->type() );
+    writer->writeCDATA( s->type().at(0) );
     writer->writeEndElement();
     writer->writeStartElement( "vendor" );
     writer->writeCDATA( s->vendor() );
@@ -686,6 +686,12 @@
                 vendor = reader->readElementText() ;
             } else if( reader->name() == "type" ) {
                 type = reader->readElementText() ;
+                if( type == "N" ) type = "Newtonian";
+                if( type == "R" ) type = "Refractor";
+                if( type == "M" ) type = "Maksutov";
+                if( type == "S" ) type = "Schmidt-Cassegrain";
+                if( type == "K" ) type = "Kutter (Schiefspiegler)";
+                if( type == "C" ) type = "Cassegrain";
             } else if( reader->name() == "focalLength" ) {
                 focalLength = reader->readElementText() ;
             } else if( reader->name() == "aperture" ) {


More information about the Kstars-devel mailing list