[Kstars-devel] KDE/kdeedu/kstars/kstars
Médéric Boquien
mboquien at free.fr
Tue Mar 17 05:18:14 CET 2009
SVN commit 940267 by mboquien:
Make the initisalisation a bit less inefficient.
We had to set the color mode and the intensity separately which made things quite unefficient as it rebuilds the stars pixmaps twice in a row. I have added a function to set simultaneously the mode
and the intensity so the pixmaps are regenerated only once. I have modified the calls accordingly. However during startup the initImages() function is still called 3 times. Twice from
loadFromConfig() in colorscheme.cpp and the other time i am not sure where. Ideally it should be called only once. I have also removed two lines from skymapcomposite.h about functions declared but
never implemented which were a bit confusing in addition as they had the same name has the functions in colorscheme.cpp.
CCMAIL: kstars-devel at kde.org
M +10 -4 colorscheme.cpp
M +9 -0 colorscheme.h
M +0 -2 skycomponents/skymapcomposite.h
--- trunk/KDE/kdeedu/kstars/kstars/colorscheme.cpp #940266:940267
@@ -143,8 +143,7 @@
KeyName = cs.KeyName;
Name = cs.Name;
Default = cs.Default;
- setStarColorMode( cs.StarColorMode );
- setStarColorIntensity( cs.StarColorIntensity );
+ setStarColorModeIntensity( cs.StarColorMode, cs.StarColorIntensity );
Palette = cs.Palette;
FileName = cs.FileName;
}
@@ -327,8 +326,7 @@
for ( int i=0; i < KeyName.size(); ++i )
setColor( KeyName.at(i), cg.readEntry( KeyName.at(i).toUtf8().constData(), Default.at( i ) ) );
- setStarColorMode( cg.readEntry( "StarColorMode", 0 ) );
- setStarColorIntensity( cg.readEntry( "StarColorIntensity", 5 ) );
+ setStarColorModeIntensity( cg.readEntry( "StarColorMode", 0 ), cg.readEntry( "StarColorIntensity", 5 ) );
}
void ColorScheme::saveToConfig() {
@@ -353,3 +351,11 @@
Options::setStarColorIntensity( intens );
StarObject::initImages();
}
+
+void ColorScheme::setStarColorModeIntensity( int mode, int intens) {
+ StarColorMode = mode;
+ StarColorIntensity = intens;
+ Options::setStarColorMode( mode );
+ Options::setStarColorIntensity( intens );
+ StarObject::initImages();
+}
\ No newline at end of file
--- trunk/KDE/kdeedu/kstars/kstars/colorscheme.h #940266:940267
@@ -159,6 +159,15 @@
*/
void setStarColorIntensity( int intens);
+
+ /**
+ *Set the star color mode and intensity value used by the color scheme
+ *@p mode the star color mode to use
+ *@p intens The star color intensity value
+ */
+ void setStarColorModeIntensity( int mode, int intens);
+
+
private:
int StarColorMode, StarColorIntensity;
QString FileName;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.h #940266:940267
@@ -181,9 +181,7 @@
//Accessors for StarComponent
SkyObject* findStarByGenetiveName( const QString name );
float faintStarMagnitude() const;
- void setStarColorMode( int newMode );
int starColorMode() const;
- void setStarColorIntensity( int newIntensity );
int starColorIntensity() const;
virtual void emitProgressText( const QString &message );
More information about the Kstars-devel
mailing list