Commit 83b44f4f authored by Artem Fedoskin's avatar Artem Fedoskin
Browse files

Added functions for saving config files upon exit. Added call to

markDirty() in set visibility functions in PlanetNode.
parent 13733e9d
......@@ -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();
}
......@@ -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();
......
......@@ -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) {
......
Supports Markdown
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