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

Jason Harris kstars at 30doradus.org
Thu Aug 10 07:16:33 CEST 2006


SVN commit 571627 by harris:

ImageViewer: Don't show the window until the image is ready

DetailDialog: disable the Image widget when showing details for a star

SkyMapComposite::nearestObject(): made it easier to click on the desired 
object (bigger search areas overall, and better weighting between object 
types)

CCMAIL: kstars-devel at kde.org



 M  +11 -6     detaildialog.cpp  
 M  +11 -20    imageviewer.cpp  
 M  +3 -3      skycomponents/deepskycomponent.cpp  
 M  +13 -9     skycomponents/skymapcomposite.cpp  
 M  +1 -1      skymap.cpp  
 M  +1 -1      skymapevents.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/detaildialog.cpp #571626:571627
@@ -86,12 +86,6 @@
 	createLinksTab();
 	createAdvancedTab();
 	createLogTab();
-
-	//Connections
-	connect( Data->ObsListButton, SIGNAL( clicked() ), this, SLOT( addToObservingList() ) );
-	connect( Data->CenterButton, SIGNAL( clicked() ), this, SLOT( centerMap() ) );
-	connect( Data->ScopeButton, SIGNAL( clicked() ), this, SLOT( centerTelescope() ) );
-	connect( Data->Image, SIGNAL( clicked() ), this, SLOT( updateThumbnail() ) );
 }
 
 DetailDialog::~DetailDialog() {
@@ -109,6 +103,12 @@
 	Data->setPalette( detPalette );
 	addPage( Data, i18n("General") );
 
+	//Connections
+	connect( Data->ObsListButton, SIGNAL( clicked() ), this, SLOT( addToObservingList() ) );
+	connect( Data->CenterButton, SIGNAL( clicked() ), this, SLOT( centerMap() ) );
+	connect( Data->ScopeButton, SIGNAL( clicked() ), this, SLOT( centerTelescope() ) );
+	connect( Data->Image, SIGNAL( clicked() ), this, SLOT( updateThumbnail() ) );
+
 	//Show object thumbnail image
 	showThumbnail();
 
@@ -128,6 +128,11 @@
 		Data->Magnitude->setText( i18nc( "number in magnitudes", "%1 mag" ,
 				KGlobal::locale()->formatNumber( s->mag(), 1 ) ) );  //show to tenths place
 
+		//The thumbnail image is empty, and isn't clickable for stars
+		//Also, don't show the border around the Image QFrame.
+		Data->Image->setFrameStyle( QFrame::NoFrame );
+		disconnect( Data->Image, SIGNAL( clicked() ), this, SLOT( updateThumbnail() ) );
+
 		//distance
 		if ( s->distance() > 2000. || s->distance() < 0. )  // parallax < 0.5 mas
 			Data->Distance->setText( QString(i18nc("larger than 2000 parsecs", "> 2000 pc") ) );
--- trunk/KDE/kdeedu/kstars/kstars/imageviewer.cpp #571626:571627
@@ -63,9 +63,10 @@
 	setModal( false );
 	MainFrame = new QFrame( this );
 	setMainWidget( MainFrame );
-	setCaption( url.fileName() );
+	setCaption( i18n("KStars image viewer")+QString(" : ")+url.fileName() );
 	setButtons( KDialog::User1|KDialog::Close );
-	setButtonGuiItem( KDialog::User1, KGuiItem( i18n("Save"), "filesave" ) );
+	KGuiItem saveButton( i18n("Save"), "filesave", i18n("Save the image to disk") );
+	setButtonGuiItem( KDialog::User1, saveButton );
 
 	View = new ImageLabel( MainFrame );
 	Caption = new QLabel( MainFrame );
@@ -80,8 +81,14 @@
 	Caption->setPalette( p );
 	View->setPalette( p );
 
+	//If the caption is wider than the image, try to shrink the font a bit
+	QFont capFont = Caption->font();
+	capFont.setPointSize( capFont.pointSize() - 2 );
+	Caption->setFont( capFont );
+
 	vlay = new QVBoxLayout( MainFrame );
 	vlay->setSpacing( 0 );
+	vlay->setMargin( 0 );
 	vlay->addWidget( View );
 	vlay->addWidget( Caption );
 	vlay->addStretch();
@@ -116,12 +123,6 @@
 
 void ImageViewer::closeEvent (QCloseEvent *ev)
 {
-// 	if (ev)	// not if closeEvent (0) is called, because segfault
-// 		ev->accept();	// parent-widgets should not get this event, so it will be filtered
-
-	//DEBUG
-	kDebug() << k_funcinfo << endl;
-
 	ks->removeImageViewer( this );	
 }
 
@@ -195,18 +196,8 @@
 
 	View->setImage( image );
 	w = image.width();
-	//If the caption is wider than the image, try to shrink the font a bit
-	QFont capFont = Caption->font();
-	int originalSize = capFont.pointSize();
-	while ( Caption->width() > w 
-			&& capFont.pointSize() >= originalSize - 3 ) {
-		capFont.setPointSize( capFont.pointSize() - 1 );
-		Caption->setFont( capFont );
-		//DEBUG
-		kDebug() << "Font size: " << capFont.pointSize() << "  Caption width: " << Caption->width() << endl;
-	}
 
-	//If the caption is still wider than the image, set the window size 
+	//If the caption is wider than the image, set the window size 
 	//to fit the caption
 	if ( Caption->width() > w ) w = Caption->width();
 	View->setFixedSize( w, image.height() );
@@ -244,7 +235,7 @@
 }
 
 void ImageViewer::close() {
-	closeEvent (0);
+	closeEvent(0);
 }
 
 void ImageViewer::checkJob() {
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/deepskycomponent.cpp #571626:571627
@@ -363,7 +363,7 @@
 			oTry = o;
 		}
 	}
-	rTry *= 0.5;
+	rTry *= 0.6;
 	if ( rTry < rBest ) {
 		rBest = rTry;
 		oBest = oTry;
@@ -377,7 +377,7 @@
 			oTry = o;
 		}
 	}
-	rTry *= 0.4;
+	rTry *= 0.6;
 	if ( rTry < rBest ) {
 		rBest = rTry;
 		oBest = oTry;
@@ -391,7 +391,7 @@
 			oTry = o;
 		}
 	}
-	rTry *= 0.25;
+	rTry *= 0.5;
 	if ( rTry < rBest ) {
 		rBest = rTry;
 		oBest = oTry;
--- trunk/KDE/kdeedu/kstars/kstars/skycomponents/skymapcomposite.cpp #571626:571627
@@ -196,13 +196,14 @@
 //to certain object types.
 //we multiply each object type's smallest angular distance by the 
 //following factors before selecting the final nearest object:
-// stars = 1.0 (not weighted)
+// faint stars = 1.0 (not weighted)
+// stars brighter than 4th mag = 0.75
 // IC catalog = 0.8
-// NGC catalog = 0.5
-// "other" catalog = 0.4
-// Messier object = 0.25
-// custom object = 0.2
-// Solar system = 0.1
+// NGC catalog = 0.6
+// "other" catalog = 0.6
+// Messier object = 0.5
+// custom object = 0.5
+// Solar system = 0.25
 SkyObject* SkyMapComposite::objectNearest( SkyPoint *p, double &maxrad ) {
 	double rTry = maxrad;
 	double rBest = maxrad;
@@ -210,8 +211,11 @@
 	SkyObject *oBest = 0;
 
 	oBest = m_Stars->objectNearest( p, rBest );
+	//reduce rBest by 0.75 for stars brighter than 4th mag
+	if ( oBest && oBest->mag() < 4.0 ) rBest *= 0.75;
+
 	//m_DeepSky internally discriminates among deepsky catalogs
-	//and remormalizes rTry
+	//and renormalizes rTry
 	oTry = m_DeepSky->objectNearest( p, rTry ); 
 	if ( rTry < rBest ) {
 		rBest = rTry;
@@ -220,7 +224,7 @@
 
 	rTry = maxrad;
 	oTry = m_CustomCatalogs->objectNearest( p, rTry );
-	rTry *= 0.2;
+	rTry *= 0.5;
 	if ( rTry < rBest ) {
 		rBest = rTry;
 		oBest = oTry;
@@ -228,7 +232,7 @@
 
 	rTry = maxrad;
 	oTry = m_SolarSystem->objectNearest( p, rTry );
-	rTry *= 0.1;
+	rTry *= 0.25;
 	if ( rTry < rBest ) {
 		rBest = rTry;
 		oBest = oTry;
--- trunk/KDE/kdeedu/kstars/kstars/skymap.cpp #571626:571627
@@ -451,7 +451,7 @@
 	if ( url.isEmpty() ) return;
 
 	ImageViewer *iv = ks->addImageViewer( url, clickedObject()->messageFromTitle(message) );
-	iv->show();
+//	iv->show();
 }
 
 void SkyMap::slotInfo() {
--- trunk/KDE/kdeedu/kstars/kstars/skymapevents.cpp #571626:571627
@@ -615,7 +615,7 @@
 		setClickedPoint( mousePoint() );
 
 		//Find object nearest to clickedPoint()
-		double maxrad = 1000.0/Options::zoomFactor();
+		double maxrad = 2500.0/Options::zoomFactor();
 		setClickedObject( data->skyComposite()->objectNearest( clickedPoint(), maxrad ) );
 
 		if ( clickedObject() ) {


More information about the Kstars-devel mailing list