Commit 7be00e53 authored by Jason Harris's avatar Jason Harris
Browse files

Implemented Manual stepping of the clock (wish #65476).

Press the "." / ">" key to advance one step forward; press the "," / "<"
key to advance one step backward.  The stepsize is set by the TimeStep
widget in the toolbar.

If the clock is running, it will be automatically stopped when one of the
manual-step keys is pressed.

On my keyboard, "," and "<" appear together on the same key, and "." and
">" are on another key; is that generally true for all keyboards?

At this point, there is no GUI way to do the manual-stepping.  It would
make sense to add these buttons to the TimeStep widget, but it is already
pretty complicated.  What do you think?

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

svn path=/trunk/kdeedu/kstars/; revision=289610
parent 21db0b2f
......@@ -102,8 +102,8 @@ void SimClock::setManualMode( bool on ) {
}
}
void SimClock::manualTick() {
if ( ManualMode && ManualActive ) {
void SimClock::manualTick( bool force ) {
if ( force || (ManualMode && ManualActive) ) {
setUTC( UTC().addSecs( int( Scale ) ) );
julian += Scale / ( 24.*3600. );
} else if ( ! ManualMode ) tick();
......
......@@ -106,7 +106,7 @@ class SimClock : public QObject, public SimClockInterface {
*(we may want to modify this slightly...e.g., the number of seconds in a
*year is not constant (leap years), so it is better to increment the
*year, instead of adding 31 million seconds. */
void manualTick();
void manualTick( bool force=false );
signals:
......
......@@ -234,6 +234,21 @@ void SkyMap::keyPressEvent( QKeyEvent *e ) {
}
break;
case Key_Comma: //advance one step backward in time
case Key_Less:
if ( data->clock()->isActive() ) data->clock()->stop();
data->clock()->setScale( -1.0 * data->clock()->scale() ); //temporarily need negative time step
data->clock()->manualTick( true );
data->clock()->setScale( -1.0 * data->clock()->scale() ); //reset original sign of time step
update();
break;
case Key_Period: //advance one step forward in time
if ( data->clock()->isActive() ) data->clock()->stop();
data->clock()->manualTick( true );
update();
break;
//DUMP_HORIZON
/*
case Key_X: //Spit out coords of horizon polygon
......
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