[Kstars-devel] kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Sat Sep 13 01:39:08 CEST 2003
CVS commit by harris:
Bug #64015 reported that non-integer time zone (TZ) offsets did not
function at all in KStars (for example, some locations in AU have TZ=9.5,
but the Local Time in KStars was always UT+9:00). However, looking at my
local working copy, the TZ offset appears to be working correctly, so it
must have been fixed at some point :)
However, there was still a related usability problem in the "Set Location"
dialog: the TimeZone combobox showed only integer TZ values between -12
and 12. So if you selected a location with, say, TZ=9.5 it would be
displayed in the combobox as "9". For existing locations, this is just
a cosmetic issue, but it also makes it impossible to add a new location
with a non-integer TZ offset.
The combobox is now editable (so you can enter any value you want, or
select from the list). In addition, the TZ box is initially populated
with all unique TZ values present in the Cities.dat database (including
any already-defined custom locations).
CCMAIL: 64015-done at bugs.kde.org, kstars-devel at kde.org
M +14 -2 locationdialog.cpp 1.32
--- kdeedu/kstars/kstars/locationdialog.cpp #1.31:1.32
@@ -97,7 +97,9 @@ LocationDialog::LocationDialog( QWidget*
TZBox->setMinimumWidth( 16 );
TZRuleBox->setMinimumWidth( 16 );
+ TZBox->setEditable( true );
+ TZBox->setDuplicatesEnabled( false );
for ( int i=0; i<25; ++i )
- TZBox->insertItem( QString("%1").arg( i-12 ) );
+ TZBox->insertItem( QString("%1").arg( (double)(i-12), 0, 'f', 2 ) );
QMap<QString, TimeZoneRule>::Iterator it;
@@ -218,4 +220,14 @@ void LocationDialog::initCityList( void
GeoBox->insertItem( s );
GeoID[GeoBox->count() - 1] = p->data()->geoList.at();
+
+ //If TZ is not even integer value, add it to listbox (don't worry about dupes, they are excluded)
+ if ( loc->TZ0() - int( loc->TZ0() ) ) { //&& ! TZBox->listBox()->findItem( QString("%1").arg( loc->TZ0(), 0, 'f', 2 ) ) ) {
+ for ( unsigned int i=0; i<TZBox->count(); ++i ) {
+ if ( TZBox->text( i ).toDouble() > loc->TZ0() ) {
+ TZBox->insertItem( QString("%1").arg( loc->TZ0(), 0, 'f', 2 ), i-1 );
+ break;
+ }
+ }
+ }
}
@@ -302,5 +314,5 @@ void LocationDialog::changeCity( void )
NewLong->showInDegrees( c.lng() );
NewLat->showInDegrees( c.lat() );
- TZBox->setCurrentItem( int( c.TZ0() ) + 12 );
+ TZBox->setCurrentText( QString("%1").arg( c.TZ0(), 0, 'f', 2 ) );
//Pick the City's rule from the rulebook
More information about the Kstars-devel
mailing list