Commit 9562237b authored by Jason Harris's avatar Jason Harris
Browse files

Added display of Az/Alt coordinates of cursor to the Statusbar (wish

#68579).  In addition, the status bar can now be hidden/shown from the

Settings|Statusbar menu, and you can also hide/show the "RA/Dec" and
"Az/Alt" fields.

Don't forget to run "make install", as I modified kstarsui.rc.

CCMAIL: kstars-devel@kde.org
CCMAIL: 68579-done@bugs.kde.org

svn path=/trunk/kdeedu/kstars/; revision=289909
parent c08bee5f
......@@ -95,6 +95,10 @@ void KStarsData::loadOptions()
options->showMainToolBar = conf->readBoolEntry( "ShowMainToolBar", true );
options->showViewToolBar = conf->readBoolEntry( "ShowViewToolBar", true );
options->showStatusBar = conf->readBoolEntry( "ShowStatusBar", true );
options->showRADecField = conf->readBoolEntry( "ShowRADecField", true );
options->showAzAltField = conf->readBoolEntry( "ShowAzAltField", true );
conf->setGroup( "View" );
options->colorScheme()->loadFromConfig( conf );
options->FOVName = conf->readEntry( "FOVName", "No FOV" );
......@@ -245,6 +249,9 @@ void KStarsData::saveOptions(KStars *ks) {
conf->writeEntry( "PositionGeoBox", options->posGeoBox );
conf->writeEntry( "ShowMainToolBar", options->showMainToolBar );
conf->writeEntry( "ShowViewToolBar", options->showViewToolBar );
conf->writeEntry( "ShowStatusBar", options->showStatusBar );
conf->writeEntry( "ShowAzAltField", options->showAzAltField );
conf->writeEntry( "ShowRADecField", options->showRADecField );
conf->setGroup( "View" );
options->colorScheme()->saveToConfig( conf );
......
......@@ -28,6 +28,7 @@
#include <ktip.h>
#include <kfiledialog.h>
#include <kpopupmenu.h>
#include <kstatusbar.h>
#include <kprocess.h>
#include <qpaintdevicemetrics.h>
#include <qradiobutton.h>
......@@ -855,6 +856,46 @@ void KStars::slotShowGUIItem( bool show ) {
else toolBar( "viewToolBar" )->hide();
}
if ( sender()->name() == QString( "show_statusBar" ) ) {
options()->showStatusBar = show;
if ( show ) statusBar()->show();
else statusBar()->hide();
}
if ( sender()->name() == QString( "show_sbAzAlt" ) ) {
options()->showAzAltField = show;
if ( show ) {
//To preserve the order (AzAlt before RADec), we have to remove
//the RADec field and then add both back.
if ( options()->showRADecField ) statusBar()->removeItem( 2 );
QString s = "000d 00m 00s, +00d 00\' 00\""; //only need this to set the width
statusBar()->insertFixedItem( s, 1, true );
statusBar()->setItemAlignment( 1, AlignRight | AlignVCenter );
statusBar()->changeItem( "", 1 );
if ( options()->showRADecField ) {
statusBar()->insertFixedItem( s, 2, true );
statusBar()->setItemAlignment( 2, AlignRight | AlignVCenter );
statusBar()->changeItem( "", 2 );
}
} else {
statusBar()->removeItem( 1 );
}
}
if ( sender()->name() == QString( "show_sbRADec" ) ) {
options()->showRADecField = show;
if ( show ) {
QString s = "000d 00m 00s, +00d 00\' 00\""; //only need this to set the width
statusBar()->insertFixedItem( s, 2, true );
statusBar()->setItemAlignment( 2, AlignRight | AlignVCenter );
statusBar()->changeItem( "", 2 );
} else {
statusBar()->removeItem( 2 );
}
}
//InfoBoxes: we only change options here; these are also connected to slots in
//InfoBoxes that actually toggle the display.
if ( sender()->name() == QString( "show_boxes" ) )
......
......@@ -44,7 +44,7 @@ void KStars::initActions() {
this, SLOT( slotExportImage() ), actionCollection(), "export_image" );
new KAction( i18n( "&Run Script..." ), "launch", KShortcut( "Ctrl+R" ),
this, SLOT( slotRunScript() ), actionCollection(), "run_script" );
KStdAction::print(this, SLOT( slotPrint() ), actionCollection(), "print" );
KStdAction::print(this, SLOT( slotPrint() ), actionCollection(), "print" );
KStdAction::quit(this, SLOT( close() ), actionCollection(), "quit" );
//Time Menu:
......@@ -145,6 +145,20 @@ void KStars::initActions() {
a->setChecked( options()->showViewToolBar );
QObject::connect(a, SIGNAL( toggled(bool) ), this, SLOT(slotShowGUIItem(bool)));
//Statusbar view options
a = new KToggleAction(i18n( "Show Statusbar" ),
0, 0, 0, actionCollection(), "show_statusBar");
QObject::connect(a, SIGNAL( toggled(bool) ), this, SLOT(slotShowGUIItem(bool)));
a->setChecked( options()->showStatusBar );
a = new KToggleAction(i18n( "Show Az/Alt Field" ),
0, 0, 0, actionCollection(), "show_sbAzAlt");
a->setChecked( options()->showAzAltField );
QObject::connect(a, SIGNAL( toggled(bool) ), this, SLOT(slotShowGUIItem(bool)));
a = new KToggleAction(i18n( "Show RA/Dec Field" ),
0, 0, 0, actionCollection(), "show_sbRADec");
a->setChecked( options()->showRADecField );
QObject::connect(a, SIGNAL( toggled(bool) ), this, SLOT(slotShowGUIItem(bool)));
//Color scheme actions. These are added to the "colorschemes" KActionMenu.
colorActionMenu = new KActionMenu( i18n( "C&olor Schemes" ), actionCollection(), "colorschemes" );
addColorMenuItem( i18n( "&Default" ), "cs_default" );
......@@ -408,11 +422,22 @@ void KStars::initFOV() {
void KStars::initStatusBar() {
statusBar()->insertItem( i18n( " Welcome to KStars " ), 0, 1, true );
statusBar()->setItemAlignment( 0, AlignLeft | AlignVCenter );
QString s = "00h 00m 00s, +00d 00\' 00\"";
statusBar()->insertItem( s, 1, 1, true );
statusBar()->setItemAlignment( 1, AlignRight | AlignVCenter );
statusBar()->setItemFixed( 1, -1 );
QString s = "000d 00m 00s, +00d 00\' 00\""; //only need this to set the width
if ( options()->showAzAltField ) {
statusBar()->insertFixedItem( s, 1, true );
statusBar()->setItemAlignment( 1, AlignRight | AlignVCenter );
statusBar()->changeItem( "", 1 );
}
if ( options()->showRADecField ) {
statusBar()->insertFixedItem( s, 2, true );
statusBar()->setItemAlignment( 2, AlignRight | AlignVCenter );
statusBar()->changeItem( "", 2 );
}
if ( ! options()->showStatusBar ) statusBar()->hide();
}
void KStars::datainitFinished(bool worked) {
......
......@@ -90,6 +90,9 @@ KStarsOptions::KStarsOptions(KStarsOptions& o) {
isTracking = o.isTracking;
showMainToolBar = o.showMainToolBar;
showViewToolBar = o.showViewToolBar;
showStatusBar = o.showStatusBar;
showAzAltField = o.showAzAltField;
showRADecField = o.showRADecField;
showInfoBoxes = o.showInfoBoxes;
showTimeBox = o.showTimeBox;
showFocusBox = o.showFocusBox;
......@@ -205,6 +208,9 @@ void KStarsOptions::setDefaultOptions() {
isTracking = false;
showMainToolBar = true;
showViewToolBar = true;
showStatusBar = true;
showAzAltField = true;
showRADecField = true;
showInfoBoxes = true;
showTimeBox = true;
showFocusBox = true;
......
......@@ -166,6 +166,7 @@ class KStarsOptions {
//GUI options
bool showMainToolBar, showViewToolBar;
bool showStatusBar, showAzAltField, showRADecField;
bool showInfoBoxes;
bool showTimeBox, showFocusBox, showGeoBox;
bool shadeTimeBox, shadeFocusBox, shadeGeoBox;
......
......@@ -77,15 +77,14 @@
<Action name="show_mainToolBar" />
<Action name="show_viewToolBar" />
</Menu>
<Menu name="statusbar"><text>&amp;Statusbar</text>
<Action name="show_statusBar" />
<Separator />
<Action name="show_sbAzAlt" />
<Action name="show_sbRADec" />
</Menu>
<Action name="colorschemes" /> <!--This is a KMenuAction-->
<Action name="fovsymbols" /> <!-- This is a KMenuAction-->
<!-- <Menu name="target"><text>Target &amp;Symbol</text>
<Action name="target_symbol_none" />
<Action name="target_symbol_circle" />
<Action name="target_symbol_crosshairs" />
<Action name="target_symbol_bullseye" />
<Action name="target_symbol_rectangle" />
</Menu>//-->
<Separator />
<Action name="geolocation" />
<Separator />
......
......@@ -438,6 +438,7 @@ void SkyMap::mouseMoveEvent( QMouseEvent *e ) {
//determine RA, Dec of mouse pointer
setMousePoint( dXdYToRaDec( dx, dy, data->options->useAltAz, data->LST, data->geo()->lat() ) );
mousePoint()->EquatorialToHorizontal( data->LST, data->geo()->lat() );
if ( midMouseButtonDown ) { //zoom according to y-offset
......@@ -506,11 +507,18 @@ void SkyMap::mouseMoveEvent( QMouseEvent *e ) {
forceUpdate(); // must be new computed
} else {
QString sRA, sDec, s;
sRA = mousePoint()->ra()->toHMSString();
sDec = mousePoint()->dec()->toDMSString(true); //true = force +/- symbol
s = sRA + ", " + sDec;
if ( ksw ) ksw->statusBar()->changeItem( s, 1 );
if ( ksw ) {
QString sX, sY, s;
sX = mousePoint()->az()->toDMSString(true); //true = force +/- symbol
sY = mousePoint()->alt()->toDMSString(true); //true = force +/- symbol
s = sX + ", " + sY;
ksw->statusBar()->changeItem( s, 1 );
sX = mousePoint()->ra()->toHMSString();
sY = mousePoint()->dec()->toDMSString(true); //true = force +/- symbol
s = sX + ", " + sY;
ksw->statusBar()->changeItem( s, 2 );
}
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment