Commit e893a64a authored by Robert Lancaster's avatar Robert Lancaster Committed by Jasem Mutlaq

For quite some time, I have known there was an issue with the SimClock in KStars.

Whenever you try to run it in hours or anything longer than that, the interface becomes much more unresponsive.  I figured it was an issue with an animation thread not sleeping long enough for the interface to have a chance to do other things.  I investigated that today and found that I was close.  There is a QTimer with a time interval that is used for the time simulation normally, but if you go beyond a certain speed, it just set the clock and didn't use a timer.  It seems to be called "manual tick."  Well the problem is that it needs to wait a moment before doing that so the interface can respond to any other commands.  I found the solution was very simple, a one shot timer, even one as short as 1 millisecond seems to solve the problem.
parent 88f75a0e
...@@ -536,6 +536,7 @@ void KStars::slotToggleWIView() ...@@ -536,6 +536,7 @@ void KStars::slotToggleWIView()
{ {
m_WIView = new WIView(0); m_WIView = new WIView(0);
m_wiDock = new QDockWidget(this); m_wiDock = new QDockWidget(this);
m_wiDock->setObjectName("What's Interesting"); m_wiDock->setObjectName("What's Interesting");
m_wiDock->setAllowedAreas(Qt::RightDockWidgetArea); m_wiDock->setAllowedAreas(Qt::RightDockWidgetArea);
QWidget * container = QWidget::createWindowContainer(m_WIView->getWIBaseView()); QWidget * container = QWidget::createWindowContainer(m_WIView->getWIBaseView());
...@@ -102,7 +102,11 @@ void SimClock::manualTick( bool force ) ...@@ -102,7 +102,11 @@ void SimClock::manualTick( bool force )
{ {
if ( force || (ManualMode && ManualActive) ) if ( force || (ManualMode && ManualActive) )
{ {
setUTC( UTC.addSecs( (long double)Scale ) ); //The single shot timer is needed because otherwise the animation is happening so frequently
//that the kstars interface becomes too unresponsive.
QTimer::singleShot(1, [this]{
setUTC( UTC.addSecs( (long double)Scale ) );
} }
else if ( ! ManualMode ) else if ( ! ManualMode )
tick(); tick();
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