[Kstars-devel] branches/kstars/summer/kdeedu/kstars

Akarsh Simha akarshsimha at gmail.com
Sun Jun 8 21:36:34 CEST 2008


SVN commit 818558 by asimha:

Porting changes from trunk to the 'summer' branch.

CCMAIL: kstars-devel at kde.org



 _M            . (directory)  
 M  +33 -1     kstars/finddialog.cpp  
 M  +9 -0      kstars/finddialog.h  
 M  +0 -3      kstars/kstars.cpp  
 M  +0 -4      kstars/kstars.desktop  
 M  +5 -3      kstars/kstarsdcop.cpp  
 M  +8 -0      kstars/skycomponents/starcomponent.cpp  
 M  +4 -0      kstars/skycomponents/starcomponent.h  
 M  +60 -9     kstars/skymapevents.cpp  
 M  +4 -5      kstars/tools/ksconjunct.cpp  
 M  +0 -1      kstars/tools/ksconjunct.h  


** branches/kstars/summer/kdeedu/kstars #property svnmerge-integrated
   - /trunk/KDE/kdeedu/kstars:1-814614
   + /trunk/KDE/kdeedu/kstars:1-818540
--- branches/kstars/summer/kdeedu/kstars/kstars/finddialog.cpp #818557:818558
@@ -251,10 +251,42 @@
     timer->start( 500 );
 }
 
+// Process the search box text to replace equivalent names like "m93" with "m 93"
+void FindDialog::processSearchText() {
+    QRegExp re;
+
+    // NOTE: The following function has been DEPRECATED. What should I use instead?
+    re.setCaseSensitive( false ); 
+
+    // If it is an NGC/IC/M catalog number, as in "M 76" or "NGC 5139", check for absence of the space
+    re.setPattern("^(m|ngc|ic)\\s*\\d*$");
+    if(ui->SearchBox->text().contains(re)) {
+	QString searchtext = ui->SearchBox->text();
+	re.setPattern("\\s*(\\d+)");
+	searchtext.replace( re, " \\1" );
+	re.setPattern("\\s*$");
+	searchtext.replace(re, "");
+	re.setPattern("^\\s*");
+	searchtext.replace(re, "");
+	ui->SearchBox->setText(searchtext);
+	return;
+    }
+
+    // TODO after KDE 4.1 release:
+    // If it is a IAU standard three letter abbreviation for a constellation, then go to that constellation
+    // Check for genetive names of stars. Example: alp CMa must go to alpha Canis Majoris
+}
+
 void FindDialog::slotOk() {
     //If no valid object selected, show a sorry-box.  Otherwise, emit accept()
-    if(!listFiltered)
+    if(!listFiltered) {
+	processSearchText();
         filterByName();
+    }
+    if(!selectedObject()) {
+	processSearchText();
+	filterByName();
+    }
     if ( selectedObject() == 0 ) {
         QString message = i18n( "No object named %1 found.", ui->SearchBox->text() );
         KMessageBox::sorry( 0, message, i18n( "Bad object name" ) );
--- branches/kstars/summer/kdeedu/kstars/kstars/finddialog.h #818557:818558
@@ -107,6 +107,15 @@
     void keyPressEvent( QKeyEvent *e );
 
 private:
+
+    /**
+     *
+     *@short Do some post processing on the search text to interpret what the user meant
+     *
+     * This could include replacing text like "m93" with "m 93"
+     */
+    void processSearchText();
+
     FindDialogUI* ui;
     SkyObject* currentitem;
     QStringListModel *fModel;
--- branches/kstars/summer/kdeedu/kstars/kstars/kstars.cpp #818557:818558
@@ -248,9 +248,6 @@
 }
 
 void KStars::removeImageViewer( ImageViewer *iv ) {
-    //DEBUG
-    kDebug() ;
-
     int i = m_ImageViewerList.indexOf( iv );
     if ( i != -1 )
         m_ImageViewerList.takeAt( i )->deleteLater();
--- branches/kstars/summer/kdeedu/kstars/kstars/kstars.desktop #818557:818558
@@ -53,8 +53,6 @@
 Comment[se]=Čállenbeavdeplánetaria
 Comment[sk]=Planetárium na vašej ploche
 Comment[sl]=Namizni planetarij
-Comment[sr]=Планетаријум на радној површини
-Comment[sr at latin]=Planetarijum na radnoj površini
 Comment[sv]=Skrivbordsplanetarium
 Comment[ta]= பணிமேடை கோளரங்கம்
 Comment[tg]=Планетариуми Мизи Корӣ
@@ -129,8 +127,6 @@
 GenericName[ru]=Настольный планетарий
 GenericName[sk]=Planetárium
 GenericName[sl]=Namizni planetarij
-GenericName[sr]=Планетаријум на радној површиниџ
-GenericName[sr at latin]=Planetarijum na radnoj površinidž
 GenericName[sv]=Skrivbordsplanetarium
 GenericName[ta]=பணிமேடை கோளரங்கம்
 GenericName[tg]=Планетариуми Мизи Корӣ
--- branches/kstars/summer/kdeedu/kstars/kstars/kstarsdcop.cpp #818557:818558
@@ -29,6 +29,7 @@
 #include <kmessagebox.h>
 //QPRINTER_FOR_NOW
 //#include <kprinter.h>
+#include <kdeprintdialog.h>
 #include <ktemporaryfile.h>
 #include <kurl.h>
 #include <kpushbutton.h>
@@ -491,10 +492,11 @@
     if ( usePrintDialog ) {
         //QPRINTER_FOR_NOW
 //        ok = printer.setup( this, i18n("Print Sky") );
-        QPrintDialog dialog( &printer, this );
-        dialog.setWindowTitle( i18n("Print Sky") );
-        if ( dialog.exec() == QDialog::Accepted )
+        QPrintDialog *dialog = KdePrint::createPrintDialog(&printer, this);
+        dialog->setWindowTitle( i18n("Print Sky") );
+        if ( dialog->exec() == QDialog::Accepted )
             ok = true;
+        delete dialog;
     } else {
         //QPRINTER_FOR_NOW
 //        ok = printer.autoConfigure();
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starcomponent.cpp #818557:818558
@@ -95,6 +95,14 @@
     StarObject::initImages();
 }
 
+//This function is empty for a reason; we override the normal 
+//update function in favor of JiT updates for stars.
+void StarComponent::update( KStarsData *data, KSNumbers *num )   
+{   
+    Q_UNUSED(data)   
+    Q_UNUSED(num)   
+}   
+
 // We use the update hook to re-index all the stars when the date has changed by
 // more than 150 years.
 
--- branches/kstars/summer/kdeedu/kstars/kstars/skycomponents/starcomponent.h #818557:818558
@@ -53,6 +53,10 @@
 
     virtual ~StarComponent();
 
+    //This function is empty; we need that so that the JiT update 
+    //is the only one beiong used.
+    void update( KStarsData *data, KSNumbers *num );
+
     bool selected();
 
     void reindex( KSNumbers *num );
--- branches/kstars/summer/kdeedu/kstars/kstars/skymapevents.cpp #818557:818558
@@ -279,41 +279,92 @@
         break;
 
     case Qt::Key_D: //Details window for Clicked/Centered object
-        if ( shiftPressed ) setClickedObject( focusObject() );
-        if ( clickedObject() ) slotDetail();
+    {
+        SkyObject *orig = 0;
+        if ( shiftPressed ) { 
+            orig = clickedObject();
+            setClickedObject( focusObject() );
+        }
+
+        if ( clickedObject() ) {
+            slotDetail();
+        }
+
+        if ( orig ) {
+            setClickedObject( orig );
+        }
         break;
+    }
 
     case Qt::Key_P: //Show Popup menu for Clicked/Centered object
-        if ( shiftPressed ) setClickedObject( focusObject() );
-        if ( clickedObject() )
-            clickedObject()->showPopupMenu( pmenu, QCursor::pos() );
+        if ( shiftPressed ) {
+            if ( focusObject() ) 
+                focusObject()->showPopupMenu( pmenu, QCursor::pos() );
+        } else {
+            if ( clickedObject() )
+                clickedObject()->showPopupMenu( pmenu, QCursor::pos() );
+        }
         break;
 
     case Qt::Key_O: //Add object to Observing List
-        if ( shiftPressed ) setClickedObject( focusObject() );
-        if ( clickedObject() )
+    {
+        SkyObject *orig = 0;
+        if ( shiftPressed ) {
+            orig = clickedObject();
+            setClickedObject( focusObject() );
+        }
+
+        if ( clickedObject() ) {
             ks->observingList()->slotAddObject();
+        }
+
+        if ( orig ) {
+            setClickedObject( orig );
+        }
         break;
+    }
 
     case Qt::Key_L: //Toggle User label on Clicked/Centered object
-        if ( shiftPressed ) setClickedObject( focusObject() );
+    {
+        SkyObject *orig = 0;
+        if ( shiftPressed ) {
+            orig = clickedObject();
+            setClickedObject( focusObject() );
+        }
+
         if ( clickedObject() ) {
             if ( isObjectLabeled( clickedObject() ) )
                 slotRemoveObjectLabel();
             else
                 slotAddObjectLabel();
         }
+
+        if ( orig ) {
+            setClickedObject( orig );
+        }
         break;
+    }
 
     case Qt::Key_T: //Toggle planet trail on Clicked/Centered object (if solsys)
-        if ( shiftPressed ) setClickedObject( focusObject() );
+    {
+        SkyObject *orig = 0;
+        if ( shiftPressed ) {
+            orig = clickedObject();
+            setClickedObject( focusObject() );
+        }
+
         if ( clickedObject() && clickedObject()->isSolarSystem() ) {
             if ( ((KSPlanetBase*)clickedObject())->hasTrail() )
                 slotRemovePlanetTrail();
             else
                 slotAddPlanetTrail();
         }
+
+        if ( orig ) {
+            setClickedObject( orig );
+        }
         break;
+    }
 
     //DEBUG_REFRACT
     case Qt::Key_Q:
--- branches/kstars/summer/kdeedu/kstars/kstars/tools/ksconjunct.cpp #818557:818558
@@ -1,4 +1,3 @@
-
 /***************************************************************************
                           ksconjunct.cpp  -  K Desktop Planetarium
                              -------------------
@@ -70,8 +69,8 @@
     if(Sign != prevSign && prevSign == 1) {   // The prevSign == 1 ensures that we pick up only minima and don't waste time finding maxima
       //      kDebug() << "Sign = " << Sign << " and " << "prevSign = " << prevSign << ": Entering findPrecise()\n";
       if(findPrecise(&extremum, &Object1, &Object2, jd, step, prevSign))
-	if(extremum.second.radians() < maxSeparation.radians())
-	  Separations.insert(extremum.first, extremum.second);
+        if(extremum.second.radians() < maxSeparation.radians())
+          Separations.insert(extremum.first, extremum.second);
     }
 
     prevDist = Dist;
@@ -126,9 +125,9 @@
       out -> first = jd - step / 2.0;
       out -> second = findDistance(jd - step/2.0, Object1, Object2);
       if(out -> second.radians() < findDistance(jd - 5.0, Object1, Object2).radians())
-	return true;
+        return true;
       else
-	return false;
+        return false;
     }
     Sign = sgn(Dist.Degrees() - prevDist.Degrees());
     if(Sign != prevSign) {
--- branches/kstars/summer/kdeedu/kstars/kstars/tools/ksconjunct.h #818557:818558
@@ -1,4 +1,3 @@
-
 /***************************************************************************
                           ksconjunct.h  -  K Desktop Planetarium
                              -------------------


More information about the Kstars-devel mailing list