Summary: | Filter by type: Constellation in kstars Find Object gives empty list | ||
---|---|---|---|
Product: | [Applications] kstars | Reporter: | Roger Larsson <roger.larsson> |
Component: | general | Assignee: | kstars |
Status: | RESOLVED FIXED | ||
Severity: | normal | ||
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
Roger Larsson
2004-01-31 19:04:45 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 |