[Kstars-devel] kdeedu/kstars/kstars

Jason Harris kstars at 30doradus.org
Sat Jan 31 23:22:58 CET 2004


CVS commit by harris: 

fixing bug #73905: Filter by type in FindDialog gives empty lists.

The symptoms described were actually caused by a few different bugs:
+ constellations recently moved from type 1 to type 11, and the FindDialog 
was not updated.
+ we incorrectly filtered out non-stellar objects which are fainter than 
the faint limit for stars (thus resulting in an empty "Planetary Nebula" 
list, and reduced lists in other nonstellar categories)
+ No objects in our database are classified as a "Supernova Remnant" 
(the SN remnants are simply called "nebulae"), so I removed this empty 
filter option.

Also, I changed one filter name from "Planets" to "Solar System" since the 
Moon and Sun are included in this filter.  This is still not perfect, 
since we have other filters for "Asteroids" and "Comets" (which are 
certainly part of the Solar System!), but it's still better than 
"Planets", IMO. 

CCMAIL: kstars-devel at kde.org
CCMAIL: 73905-done at bugs.kde.org


  M +15 -10    finddialog.cpp   1.20


--- kdeedu/kstars/kstars/finddialog.cpp  #1.19:1.20
@@ -44,16 +44,16 @@ FindDialog::FindDialog( QWidget* parent 
         filterType->setEditable( false );
         filterType->insertItem( i18n ("Any") );
-        filterType->insertItem( i18n ("Constellations") );
         filterType->insertItem( i18n ("Stars") );
-        filterType->insertItem( i18n ("Double Stars") );
-        filterType->insertItem( i18n ("Planets") );
+        //      filterType->insertItem( i18n ("Double Stars") );
+        filterType->insertItem( i18n ("Solar System") );
         filterType->insertItem( i18n ("Open Clusters") );
         filterType->insertItem( i18n ("Glob. Clusters") );
         filterType->insertItem( i18n ("Gas. Nebulae") );
         filterType->insertItem( i18n ("Plan. Nebulae") );
-        filterType->insertItem( i18n ("SN Remnants") );
+        //      filterType->insertItem( i18n ("SN Remnants") );
         filterType->insertItem( i18n ("Galaxies") );
         filterType->insertItem( i18n ("Comets") );
         filterType->insertItem( i18n ("Asteroids") );
+        filterType->insertItem( i18n ("Constellations") );
 
         SearchList = new QListBox( page, "SearchList" );
@@ -138,8 +138,9 @@ void FindDialog::filterByType() {
 
         for ( SkyObjectName *name = ObjNames.first( searchFor ); name; name = ObjNames.next() ) {
-                if ( name->skyObject()->type() + 2 == Filter ) {
+                //Special case: match SkyObject Type 0 with Filter==1 (stars)
+                if ( name->skyObject()->type() == Filter || (name->skyObject()->type() == 0 && Filter == 1 ) ) {
                         if ( name->text().lower().startsWith( searchFor ) ) {
-                                // show only visible objects
-                                if (name->skyObject()->mag() <= p->options()->currentMagLimitDrawStar()) {
+                                // for stars, don't show the ones below the faint limit
+                                if (Filter!=1 || name->skyObject()->mag() <= p->options()->currentMagLimitDrawStar()) {
                                         new SkyObjectNameListItem ( SearchList, name );
                                 }
@@ -168,7 +169,11 @@ void FindDialog::updateSelection (QListB
 
 void FindDialog::setFilter( int f ) {
+        // Translate the Listbox index to the correct SkyObject Type ID 
+        int f2( f ); // in most cases, they are the same number
+        if ( f >= 7 ) f2 = f + 1; //need to skip unused "Supernova Remnant" Type at position 7
+        
         // check if filter was changed or if filter is still the same
-        if ( Filter != f ) {
-                Filter = f;
+        if ( Filter != f2 ) {
+                Filter = f2;
                 if ( Filter == 0 ) {  // any type will shown
                 // delete old connections and create new connections




More information about the Kstars-devel mailing list