Bug 73905 - Filter by type: Constellation in kstars Find Object gives empty list
Summary: Filter by type: Constellation in kstars Find Object gives empty list
Status: RESOLVED FIXED
Alias: None
Product: kstars
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kstars
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-01-31 19:04 UTC by Roger Larsson
Modified: 2004-01-31 23:23 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roger Larsson 2004-01-31 19:04:45 UTC
Version:           1.0 (using KDE 3.2.90 (CVS >= 20040117), compiled sources)
Compiler:          gcc version 3.3.1 (SuSE Linux)
OS:          Linux (i686) release 2.4.21-166-default

Something is strange here:
My daughter, using Swedish, not only have contellation
empty but also
 Double Stars, Gas. Nebulae, Plan. Nebulae, SN Remnants

This points toward a configuration problem but I can not
directly see it. Constellation names does show up...
Comment 1 kstars 2004-01-31 23:23:03 UTC
Subject: kdeedu/kstars/kstars

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@kde.org
CCMAIL: 73905-done@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