[Kstars-devel] KDE/kdeedu/kstars/kstars
Jason Harris
kstars at 30doradus.org
Mon Nov 19 00:26:54 CET 2007
SVN commit 738465 by harris:
Fix toggling of Alt/Az and RA/Dec fields in the status bar. Instead
of removing and adding these statusbar items, I am now simply not
drawing the coordinate text when the option is selected off.
CCMAIL: kstars-devel at kde.org
M +2 -29 kstarsactions.cpp
M +13 -8 skymap.cpp
M +17 -13 skymapevents.cpp
--- trunk/KDE/kdeedu/kstars/kstars/kstarsactions.cpp #738464:738465
@@ -1016,39 +1016,12 @@
if ( sender() == actionCollection()->action( "show_sbAzAlt" ) ) {
Options::setShowAltAzField( show );
- if ( show ) {
- //To preserve the order (AzAlt before RADec), we have to remove
- //the RADec field and then add both back.
- if ( statusBar()->hasItem(1) ) statusBar()->removeItem( 1 );
- if ( statusBar()->hasItem(2) ) statusBar()->removeItem( 2 );
-
- QString s = "000d 00m 00s, +00d 00\' 00\""; //only need this to set the width
- statusBar()->insertPermanentFixedItem( s, 1 );
- statusBar()->setItemAlignment( 1, Qt::AlignRight | Qt::AlignVCenter );
- statusBar()->changeItem( QString(), 1 );
-
- if ( Options::showRADecField() ) {
- statusBar()->insertPermanentFixedItem( s, 2 );
- statusBar()->setItemAlignment( 2, Qt::AlignRight | Qt::AlignVCenter );
- statusBar()->changeItem( QString(), 2 );
- }
- } else {
- statusBar()->removeItem( 1 );
- }
+ if ( ! show ) { statusBar()->changeItem( QString(), 1 ); }
}
if ( sender() == actionCollection()->action( "show_sbRADec" ) ) {
Options::setShowRADecField( show );
- if ( show ) {
- QString s = "000d 00m 00s, +00d 00\' 00\""; //only need this to set the width
- if ( ! statusBar()->hasItem(2) ) {
- statusBar()->insertPermanentFixedItem( s, 2 );
- statusBar()->setItemAlignment( 2, Qt::AlignRight | Qt::AlignVCenter );
- }
- statusBar()->changeItem( QString(), 2 );
- } else {
- statusBar()->removeItem( 2 );
- }
+ if ( ! show ) { statusBar()->changeItem( QString(), 2 ); }
}
//InfoBoxes: we only change options here; these are also connected to slots in
--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #738464:738465
@@ -322,14 +322,19 @@
//display coordinates in statusBar
if ( ks ) {
- QString sX = focusPoint()->az()->toDMSString();
- QString sY = focusPoint()->alt()->toDMSString(true);
- if ( Options::useAltAz() && Options::useRefraction() )
- sY = refract( focusPoint()->alt(), true ).toDMSString(true);
- QString s = sX + ", " + sY;
- ks->statusBar()->changeItem( s, 1 );
- s = focusPoint()->ra()->toHMSString() + ", " + focusPoint()->dec()->toDMSString(true);
- ks->statusBar()->changeItem( s, 2 );
+ if ( Options::showAltAzField() ) {
+ QString sX = focusPoint()->az()->toDMSString();
+ QString sY = focusPoint()->alt()->toDMSString(true);
+ if ( Options::useAltAz() && Options::useRefraction() )
+ sY = refract( focusPoint()->alt(), true ).toDMSString(true);
+ QString s = sX + ", " + sY;
+ ks->statusBar()->changeItem( s, 1 );
+ }
+
+ if ( Options::showRADecField() ) {
+ QString s = focusPoint()->ra()->toHMSString() + ", " + focusPoint()->dec()->toDMSString(true);
+ ks->statusBar()->changeItem( s, 2 );
+ }
}
showFocusCoords(); //update FocusBox
--- trunk/KDE/kdeedu/kstars/kstars/skymapevents.cpp #738464:738465
@@ -568,24 +568,28 @@
setClickedPoint( mousePoint() );
forceUpdate(); // must be new computed
- } else {
+ } else { //mouse button not down
if ( ks ) {
QString sX, sY, s;
- sX = mousePoint()->az()->toDMSString(true); //true: force +/- symbol
- dms a( mousePoint()->alt()->Degrees() );
- if ( Options::useAltAz() && Options::useRefraction() )
- a = refract( mousePoint()->alt(), true ); //true: compute apparent alt from true alt
- sY = a.toDMSString(true); //true: force +/- symbol
+ if ( Options::showAltAzField() ) {
+ sX = mousePoint()->az()->toDMSString(true); //true: force +/- symbol
+ dms a( mousePoint()->alt()->Degrees() );
+ if ( Options::useAltAz() && Options::useRefraction() )
+ a = refract( mousePoint()->alt(), true ); //true: compute apparent alt from true alt
+ sY = a.toDMSString(true); //true: force +/- symbol
+
+ s = sX + ", " + sY;
+ ks->statusBar()->changeItem( s, 1 );
+ }
- s = sX + ", " + sY;
- ks->statusBar()->changeItem( s, 1 );
-
- sX = mousePoint()->ra()->toHMSString();
- sY = mousePoint()->dec()->toDMSString(true); //true: force +/- symbol
- s = sX + ", " + sY;
- ks->statusBar()->changeItem( s, 2 );
+ if ( Options::showRADecField() ) {
+ sX = mousePoint()->ra()->toHMSString();
+ sY = mousePoint()->dec()->toDMSString(true); //true: force +/- symbol
+ s = sX + ", " + sY;
+ ks->statusBar()->changeItem( s, 2 );
+ }
}
}
}
More information about the Kstars-devel
mailing list