[Kstars-devel] KDE/kdeedu/kstars/kstars

Akarsh Simha akarshsimha at gmail.com
Tue Jul 27 01:14:59 CEST 2010


SVN commit 1155112 by asimha:

+ Draw the horizon line if the ground is selected.

+ Disable the horizon line checkbox if the Opaque Ground checkbox is
  checked.

Earlier, the ground was drawn only if Options::showHorizon() was
true, irrespective of Options::showGround().

While it would be more appropriate to gray out the Show Opaque Ground
checkbox if Horizon Line is turned off, that would be programmatically
more complicated. Hence the not-so-intuitive approach of graying out
Horizon Line if Show Ground is turned on.

I invite suggestions on how this can be made more intuitive.

+ Invoke the slots that disable the appropriate options from the
  constructor, in the Guides section of the Options dialog. Earlier,
  the options were not disabled on frame load.

CCMAIL: kstars-devel at kde.org



 M  +21 -9     options/opsguides.cpp  
 M  +3 -2      options/opsguides.h  
 M  +5 -3      skycomponents/horizoncomponent.cpp  
 M  +3 -3      skymap.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/options/opsguides.cpp #1155111:1155112
@@ -19,31 +19,43 @@
 #include "kstars.h"
 #include "kstarsdata.h"
 #include "skycomponents/skymapcomposite.h"
+#include "Options.h"
 
 OpsGuides::OpsGuides( KStars *_ks )
         : QFrame( _ks ), ksw(_ks)
 {
     setupUi( this );
+    connect( kcfg_ShowCNames, SIGNAL( toggled( bool ) ),
+             this, SLOT( slotToggleConstellOptions( bool ) ) );
+    connect( kcfg_ShowMilkyWay, SIGNAL( toggled( bool ) ),
+             this, SLOT( slotToggleMilkyWayOptions( bool ) ) );
+    connect( kcfg_ShowGround, SIGNAL( toggled( bool ) ),
+             this, SLOT( slotToggleOpaqueGround( bool ) ) );
 
-    connect( kcfg_ShowCNames, SIGNAL( clicked() ),
-             this, SLOT( slotToggleConstellOptions() ) );
-    connect( kcfg_ShowMilkyWay, SIGNAL( clicked() ),
-             this, SLOT( slotToggleMilkyWayOptions() ) );
-
     foreach( QString item,  ksw->data()->skyComposite()->getCultureNames() )
         kcfg_SkyCulture->addItem( i18nc("Sky Culture", item.toUtf8().constData() ) );
 
+    // When setting up the widget, update the enabled status of the
+    // checkboxes depending on the options.
+    slotToggleOpaqueGround( Options::showGround() ); 
+    slotToggleConstellOptions( Options::showCNames() );
+    slotToggleMilkyWayOptions( Options::showMilkyWay() );
+
 }
 
 OpsGuides::~OpsGuides()
 {}
 
-void OpsGuides::slotToggleConstellOptions() {
-    ConstellOptions->setEnabled( kcfg_ShowCNames->isChecked() );
+void OpsGuides::slotToggleConstellOptions( bool state ) {
+    ConstellOptions->setEnabled( state );
 }
 
-void OpsGuides::slotToggleMilkyWayOptions() {
-    kcfg_FillMilkyWay->setEnabled( kcfg_ShowMilkyWay->isChecked() );
+void OpsGuides::slotToggleMilkyWayOptions( bool state ) {
+    kcfg_FillMilkyWay->setEnabled( state );
 }
 
+void OpsGuides::slotToggleOpaqueGround( bool state ) {
+    kcfg_ShowHorizon->setEnabled( !state );
+}
+
 #include "opsguides.moc"
--- trunk/KDE/kdeedu/kstars/kstars/options/opsguides.h #1155111:1155112
@@ -30,8 +30,9 @@
     ~OpsGuides();
 
 private slots:
-    void slotToggleConstellOptions();
-    void slotToggleMilkyWayOptions();
+    void slotToggleConstellOptions( bool state );
+    void slotToggleMilkyWayOptions( bool state );
+    void slotToggleOpaqueGround( bool state ); 
 
 private:
     KStars *ksw;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/horizoncomponent.cpp #1155111:1155112
@@ -53,7 +53,7 @@
 
 bool HorizonComponent::selected()
 {
-    return Options::showHorizon();
+    return ( Options::showHorizon() || Options::showGround() );
 }
 
 void HorizonComponent::update( KSNumbers * )
@@ -89,10 +89,12 @@
 
     psky.setPen( QPen( QColor( data->colorScheme()->colorNamed( "HorzColor" ) ), 2, Qt::SolidLine ) );
 
-    if ( Options::useAltAz() && Options::showGround() )
+    if ( Options::useAltAz() && Options::showGround() ) {
         psky.setBrush( QColor ( data->colorScheme()->colorNamed( "HorzColor" ) ) );
-    else
+    }
+    else {
         psky.setBrush( Qt::NoBrush );
+    }
 
     double daz = 90.;
     if ( Options::useAltAz() ) {
--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #1155111:1155112
@@ -294,7 +294,7 @@
     //
     //Do not show a transient label if the map is in motion, or if the mouse
     //pointer is below the opaque horizon, or if the object has a permanent label
-    if ( ! slewing && ! ( Options::useAltAz() && Options::showHorizon() && Options::showGround() &&
+    if ( ! slewing && ! ( Options::useAltAz() && Options::showGround() &&
                           SkyPoint::refract(mousePoint()->alt()).Degrees() < 0.0 ) ) {
         double maxrad = 1000.0/Options::zoomFactor();
         SkyObject *so = data->skyComposite()->objectNearest( mousePoint(), maxrad );
@@ -364,7 +364,7 @@
 
     //If the requested object is below the opaque horizon, issue a warning message
     //(unless user is already pointed below the horizon)
-    if ( Options::useAltAz() && Options::showHorizon() && Options::showGround() &&
+    if ( Options::useAltAz() && Options::showGround() &&
             focus()->alt().Degrees() > -1.0 && focusPoint()->alt().Degrees() < -1.0 ) {
 
         QString caption = i18n( "Requested Position Below Horizon" );
@@ -1144,7 +1144,7 @@
 
     //Skip objects below the horizon if using Horizontal coords,
     //and the ground is drawn
-    if( useAltAz && Options::showHorizon() && Options::showGround() && p->alt().Degrees() < -1.0 )
+    if( useAltAz && Options::showGround() && p->alt().Degrees() < -1.0 )
         return false;
 
     if ( useAltAz ) {


More information about the Kstars-devel mailing list