[Kstars-devel] KDE/kdeedu/kstars/kstars

Jason Harris jharris at 30doradus.org
Thu Aug 16 23:46:51 CEST 2007


Hi James,

What do you think about embedding a progressbar temporarily in the main window 
status bar, rather than showing a splash window for this?

regards,
Jason

On Thursday 16 August 2007 14:36, James Bowlin wrote:
> SVN commit 700965 by jbowlin:
>
> Am now generating a KStarsSplash window when re-loading faint stars
> (which can take many seconds). You can see it be simply increasing
> the "faint limit zoomed in" in the catalogs setup menu and then hit
> "okay" or "apply".
>
> I slightly modified KStarsSplash to let the constructor accept an
> optional custom message that will replace "Welcome to KStars [...]"
> message.
>
> The window is generated from within StarComponent::draw().  The first
> time we recognize a need to reload the data, we just create the splash
> screen but we don't reload the data.  This allows us to complete the
> first draw which will repaint the SkyMap and fill any voids created by
> the setup menu window.
>
> I don't trigger a second draw but it always seems to come.  You can
> see when because I am printing out to the console "reading data ..."
> followed by "Done!" before and after I re-read the data file.
>
> Known bugs:
>
> Sometimes the KStarsSplash window comes up blank.  I think this has to
> do with where the mouse is when it opens.  We used to have this some
> problem with the original KStarsSplash window.
>
> If we are only loading a few stars, we shouldn't bother displaying the
> splash window.
>
> Ideally we would update the splash window with the % of new stars
> loaded.
>
> CCMAIL: kstars-devel at kde.org
>
>
>  M  +12 -6     kstarssplash.cpp
>  M  +3 -2      kstarssplash.h
>  M  +19 -3     skycomponents/starcomponent.cpp
>  M  +3 -0      skycomponents/starcomponent.h
>
>
> --- trunk/KDE/kdeedu/kstars/kstars/kstarssplash.cpp #700964:700965
> @@ -35,13 +35,18 @@
>  //FIXME: program was crashing with KStarsSplash derived from KDialog,
>  //so I am temporarily using QDialog.  Try switching back to KDialog
>  //later on (this message added 20-June-2006)
> -KStarsSplash::KStarsSplash( QWidget *parent )
> +KStarsSplash::KStarsSplash( QWidget *parent, const QString& customMessage)
>
>  	: QDialog( parent )
>
>  {
> -        QPalette p = palette();
> -        p.setColor( QPalette::Window, Qt::black );
> -        setPalette( p );
>
> +	QString message = customMessage.isEmpty() ?
> +		i18n( "Welcome to KStars. Please stand by while loading..." ) :
> +		customMessage;
> +
> +	QPalette p = palette();
> +	p.setColor( QPalette::Window, Qt::black );
> +	setPalette( p );
> +
>  	//Set up widgets for splashscreen.
>  // KDialog stuff:
>  //	QFrame *page = new QFrame( this );
> @@ -78,7 +83,7 @@
>  	pal.setColor( QPalette::Inactive, QPalette::WindowText, QColor( "White" )
> ); label->setPalette( pal );
>  	label->setAlignment( Qt::AlignHCenter );
> -	label->setText( i18n( "Welcome to KStars. Please stand by while
> loading..." ) ); +	label->setText( message );
>  	topLayout->addWidget( label );
>
>  //initialize the progress message label
> @@ -86,7 +91,8 @@
>  	textCurrentStatus->setObjectName( "label2" );
>  	textCurrentStatus->setPalette( pal );
>  	textCurrentStatus->setAlignment( Qt::AlignHCenter );
> -	topLayout->addWidget( textCurrentStatus );
> +	if ( customMessage.isEmpty() )
> +		topLayout->addWidget( textCurrentStatus );
>
>  	setMessage(QString());  // force repaint of widget with no text
>  }
> --- trunk/KDE/kdeedu/kstars/kstars/kstarssplash.h #700964:700965
> @@ -42,8 +42,9 @@
>
>  	public:
>  	/**Constructor. Create widgets.  Load KStars logo.  Start load timer.
> -		*/
> -		KStarsSplash( QWidget *parent );
> +	 * A non-empty customMessage will replace "Welcome to KStars [...]".
> +	*/
> +		KStarsSplash( QWidget *parent, const QString& customMessage="" );
>
>  	/**Destructor
>  		*/
> --- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp
> #700964:700965 @@ -34,8 +34,8 @@
>  #include "skymesh.h"
>  #include "skylabel.h"
>  #include "skylabeler.h"
> +#include "kstarssplash.h"
>
> -
>  StarComponent::StarComponent(SkyComponent *parent )
>
>  : ListComponent(parent), m_reindexNum(J2000), m_FaintMagnitude(-5.0)
>
>  {
> @@ -51,6 +51,7 @@
>
>      lastFilePos = 0;
>  	m_zoomMagLimit = 0.0;
> +	m_splash = 0;
>  }
>
>  StarComponent::~StarComponent()
> @@ -144,10 +145,25 @@
>  	bool hideFaintStars( checkSlewing && Options::hideStars() );
>  	float maglim = Options::magLimitDrawStar();
>
> -    if ( ! hideFaintStars && ( m_FaintMagnitude < maglim ) ) {        //
> -jbb -        setFaintMagnitude( maglim );
> +	// First show a splash screen but don't load any data so we can present
> +	// a pretty face.  Then load data the next time through and finally erase
> +	// the splash screen.
> +    if ( ! hideFaintStars && ( m_FaintMagnitude < maglim ) ) {
> +		if ( ! m_splash ) {
> +			m_splash = new KStarsSplash(0, i18n("Please wait while loading faint
> stars ...") ); +			m_splash->show();
> +			m_splash->raise();
> +		}
> +		else {
> +			printf("reading data ...\n");
> +        	setFaintMagnitude( maglim );
> +			printf("Done!\n");
> +			delete m_splash;
> +			m_splash = 0;
> +		}
>      }
>
> +
>  	//adjust maglimit for ZoomLevel
>  	double lgmin = log10(MINZOOM);
>  	double lgmax = log10(MAXZOOM);
> --- trunk/KDE/kdeedu/kstars/kstars/skycomponents/starcomponent.h
> #700964:700965 @@ -43,6 +43,7 @@
>  class StarObject;
>  class SkyLabeler;
>
> +class KStarsSplash;
>
>  //typedef QVector< StarList* > StarIndex;
>
> @@ -153,6 +154,8 @@
>  		float m_FaintMagnitude;
>  		float m_zoomMagLimit;
>  		int m_ColorMode, m_ColorIntensity;
> +
> +		KStarsSplash* m_splash;
>  };
>
>  #endif
> _______________________________________________
> Kstars-devel mailing list
> Kstars-devel at kde.org
> https://mail.kde.org/mailman/listinfo/kstars-devel

-- 
Jason Harris
jharris at 30doradus.org


More information about the Kstars-devel mailing list