summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Fedoskin <afedoskin3@gmail.com>2016-05-07 22:17:55 (GMT)
committerArtem Fedoskin <afedoskin3@gmail.com>2016-05-07 22:17:55 (GMT)
commit83b44f4ff555ea513b80a9d5032c02ade2db6018 (patch)
tree00ed0ea51f6a9b070014a2de3a6c4d9e1a73b92b
parent13733e9d24da1d195cc27f954732b4750449bf6f (diff)
Added functions for saving config files upon exit. Added call to
markDirty() in set visibility functions in PlanetNode.
-rw-r--r--kstars/kstarslite.cpp27
-rw-r--r--kstars/kstarslite.h8
-rw-r--r--kstars/kstarslite/skyitems/nodes/planetnode.cpp30
3 files changed, 59 insertions, 6 deletions
diff --git a/kstars/kstarslite.cpp b/kstars/kstarslite.cpp
index 18165f2..8baeda5 100644
--- a/kstars/kstarslite.cpp
+++ b/kstars/kstarslite.cpp
@@ -63,6 +63,8 @@ KStarsLite::KStarsLite( bool doSplash, bool startClock, const QString &startDate
// Set pinstance to yourself
pinstance = this;
+ connect( qApp, SIGNAL( aboutToQuit() ), this, SLOT( slotAboutToQuit() ) );
+
//Initialize Time and Date
if (startDateString.isEmpty() == false)
{
@@ -141,3 +143,28 @@ void KStarsLite::updateTime( const bool automaticDSTchange ) {
QTimer::singleShot( 0, Data->clock(), SLOT( manualTick() ) );
}
}
+
+void KStarsLite::writeConfig() {
+ Options::self()->save();
+
+ //Store current simulation time
+ //Refer to // FIXME: Used in kstarsdcop.cpp only in kstarsdata.cpp
+ //data()->StoredDate = data()->lt();
+}
+
+void KStarsLite::slotAboutToQuit()
+{
+ // Delete skymap. This required to run destructors and save
+ // current state in the option.
+ delete m_SkyMapLite;
+
+ //Store Window geometry in Options object
+ //Options::setWindowWidth( m_RootObject->width() );
+ //Options::setWindowHeight( m_RootObject->height() );
+
+ //explicitly save the colorscheme data to the config file
+ data()->colorScheme()->saveToConfig();
+
+ //synch the config file with the Config object
+ writeConfig();
+}
diff --git a/kstars/kstarslite.h b/kstars/kstarslite.h
index 9d264c3..cacec20 100644
--- a/kstars/kstarslite.h
+++ b/kstars/kstarslite.h
@@ -98,11 +98,19 @@ public Q_SLOTS:
* @param automaticDSTchange change DST status automatically?
*/
void updateTime( const bool automaticDSTchange = true );
+
+ /** Write current settings to config file. Used to save config file upon exit
+ */
+ void writeConfig();
+
private slots:
/** finish setting up after the KStarsData has finished
*/
void datainitFinished();
+ /** Save data to config file before exiting.*/
+ void slotAboutToQuit();
+
private:
/** Initialize focus position */
void initFocus();
diff --git a/kstars/kstarslite/skyitems/nodes/planetnode.cpp b/kstars/kstarslite/skyitems/nodes/planetnode.cpp
index 0675910..ccca935 100644
--- a/kstars/kstarslite/skyitems/nodes/planetnode.cpp
+++ b/kstars/kstarslite/skyitems/nodes/planetnode.cpp
@@ -58,18 +58,36 @@ void PlanetNode::setPlanetPicSize(float size) {
}
void PlanetNode::showPoint() {
- m_planetOpacity->setOpacity(0);
- m_point->setOpacity(1);
+ if(m_planetOpacity->opacity()) {
+ m_planetOpacity->setOpacity(0);
+ m_planetOpacity->markDirty(QSGNode::DirtyOpacity);
+ }
+ if(!m_point->opacity()) {
+ m_point->setOpacity(1);
+ m_point->markDirty(QSGNode::DirtyOpacity);
+ }
}
void PlanetNode::showPlanetPic() {
- m_point->setOpacity(0);
- m_planetOpacity->setOpacity(1);
+ if(!m_planetOpacity->opacity()) {
+ m_planetOpacity->setOpacity(1);
+ m_planetOpacity->markDirty(QSGNode::DirtyOpacity);
+ }
+ if(m_point->opacity()) {
+ m_point->setOpacity(0);
+ m_point->markDirty(QSGNode::DirtyOpacity);
+ }
}
void PlanetNode::hide() {
- m_point->setOpacity(0);
- m_planetOpacity->setOpacity(0);
+ if(m_planetOpacity->opacity()) {
+ m_planetOpacity->setOpacity(0);
+ m_planetOpacity->markDirty(QSGNode::DirtyOpacity);
+ }
+ if(m_point->opacity()) {
+ m_point->setOpacity(0);
+ m_point->markDirty(QSGNode::DirtyOpacity);
+ }
}
void PlanetNode::changePos(QPointF pos) {