[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdeedu/kstars/kstars/skycomponents
From:       Alexey Khudyakov <alexey.skladnoy () gmail ! com>
Date:       2010-02-09 22:33:16
Message-ID: 1265754796.210230.2117.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 1087978 by khudyakov:

* Remove init from ConstellataionNamesCompoenent
* Pass list of cultures as parameter to constructor of
  ConstellataionNamesCompoenent

 M  +16 -17    constellationnamescomponent.cpp  
 M  +12 -15    constellationnamescomponent.h  
 M  +2 -2      skymapcomposite.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/constellationnamescomponent.cpp #1087977:1087978
@@ -22,33 +22,22 @@
 #include "kstarsdata.h"
 #include "skymap.h"
 #include "skyobjects/skyobject.h"
-#include "skycomponents/skymapcomposite.h"
+#include "skycomponents/culturelist.h"
 #include "Options.h"
 
 #include "ksfilereader.h"
 #include "skylabeler.h"
 
-ConstellationNamesComponent::ConstellationNamesComponent(SkyComposite *parent )
+ConstellationNamesComponent::ConstellationNamesComponent(SkyComposite *parent, CultureList* cultures )
         : ListComponent(parent )
-{}
-
-ConstellationNamesComponent::~ConstellationNamesComponent()
-{}
-
-bool ConstellationNamesComponent::selected()
 {
-    return Options::showCNames() &&
-           !( Options::hideOnSlew() && Options::hideCNames() && SkyMap::IsSlewing() );
-}
-
-void ConstellationNamesComponent::init()
-{
     uint i = 0;
     bool culture = false;
     KSFileReader fileReader;
     QString cultureName;
 
-    if ( ! fileReader.open( "cnames.dat" ) ) return;
+    if ( ! fileReader.open( "cnames.dat" ) )
+        return;
 
     emitProgressText( i18n("Loading constellation names" ) );
     
@@ -64,7 +53,7 @@
         mode = line.at( 0 );
         if ( mode == 'C') {
             cultureName = line.mid( 2 ).trimmed();
-            culture     = cultureName == KStarsData::Instance()->skyComposite()->currentCulture();
+            culture     = cultureName == cultures->current();
             i++;
             continue;
         }
@@ -88,7 +77,8 @@
             dms r; r.setH( rah, ram, ras );
             dms d( dd, dm,  ds );
 
-            if ( sgn == '-' ) { d.setD( -1.0*d.Degrees() ); }
+            if ( sgn == '-' )
+                d.setD( -1.0*d.Degrees() );
 
             SkyObject *o = new SkyObject( SkyObject::CONSTELLATION, r, d, 0.0, name, abbrev );
             m_ObjectList.append( o );
@@ -99,6 +89,15 @@
     }
 }
 
+ConstellationNamesComponent::~ConstellationNamesComponent()
+{}
+
+bool ConstellationNamesComponent::selected()
+{
+    return Options::showCNames() &&
+           !( Options::hideOnSlew() && Options::hideCNames() && SkyMap::IsSlewing() );
+}
+
 // Don't precess the location of the names
 void ConstellationNamesComponent::update( KSNumbers* )
 {
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/constellationnamescomponent.h #1087977:1087978
@@ -18,11 +18,11 @@
 #ifndef CONSTELLATIONNAMESCOMPONENT_H
 #define CONSTELLATIONNAMESCOMPONENT_H
 
-#include "listcomponent.h"
 #include <QList>
-#include "skyobjects/skyobject.h"
+#include "listcomponent.h"
 
 class SkyLabeler;
+class CultureList;
 
 /**
  * @class ConstellationNamesComponent
@@ -36,18 +36,7 @@
 public:
     /**@short Constructor
      * @p parent Pointer to the parent SkyComposite object
-     */
-    ConstellationNamesComponent(SkyComposite *parent );
-
-    /** @short Destructor.  Delete list members */
-    virtual ~ConstellationNamesComponent();
-
-    /**@short Draw constellation names on the sky map.
-     * @p psky Reference to the QPainter on which to paint
-     */
-    virtual void draw( QPainter& psky );
-
-    /**@short Initialize the Constellation names component
+     *
      * Reads the constellation names data from cnames.dat
      * Each line in the file is parsed according to column position:
      * @li 0-1     RA hours [int]
@@ -60,8 +49,16 @@
      * @li 13-15   IAU Abbreviation [string]  e.g., 'Ori' == Orion
      * @li 17-     Constellation name [string]
      */
-    virtual void init();
+    ConstellationNamesComponent(SkyComposite *parent, CultureList* cultures);
 
+    /** @short Destructor.  Delete list members */
+    virtual ~ConstellationNamesComponent();
+
+    /**@short Draw constellation names on the sky map.
+     * @p psky Reference to the QPainter on which to paint
+     */
+    virtual void draw( QPainter& psky );
+
     /**@short we need a custom routine (for now) so we don't
      * precess the locations of the names.
      */
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #1087977:1087978
@@ -70,7 +70,7 @@
     addComponent( m_CBoundLines = new ConstellationBoundaryLines( this ));
     m_Cultures = new CultureList();
     addComponent( m_CLines     = new ConstellationLines( this ));
-    addComponent( m_CNames     = new ConstellationNamesComponent( this ));
+    addComponent( m_CNames     = new ConstellationNamesComponent( this, m_Cultures ));
     addComponent( m_Equator    = new Equator( this ));
     addComponent( m_Ecliptic   = new Ecliptic( this ));
     addComponent( m_Horizon    = new HorizonComponent( this ));
@@ -442,7 +442,7 @@
     objectNames(SkyObject::CONSTELLATION).clear();
     if( m_CNames )
         delete m_CNames;
-    m_CNames = new ConstellationNamesComponent( this );
+    m_CNames = new ConstellationNamesComponent( this, m_Cultures );
     m_CNames->init();
 }
 
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic