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

Victor Carbune victor.carbune at gmail.com
Sun Dec 5 09:45:49 CET 2010


SVN commit 1203704 by vcarbune:

A second Google Code-in task by Valery Kharitonov: removes KDE/Qt 3 support libs
dependency from KStars and implicitly from KDE Edu. Yay!

No bugs, clean code, but would be great everyone to further test this change.

CCMAIL: kstars-devel at kde.org, kharvd at gmail.com



 M  +0 -3      CMakeLists.txt  
 M  +14 -15    dialogs/locationdialog.cpp  
 M  +1 -6      dialogs/locationdialog.ui  
 M  +1 -6      dialogs/wizlocation.ui  
 M  +10 -9     kswizard.cpp  
 M  +1 -10     tools/argloadcolorscheme.ui  
 M  +8 -8      tools/scriptbuilder.cpp  


--- trunk/KDE/kdeedu/kstars/kstars/CMakeLists.txt #1203703:1203704
@@ -69,8 +69,6 @@
     ${OPENGL_INCLUDE_DIRS}
 )
 
-add_definitions (-DQT3_SUPPORT -DQT3_SUPPORT_WARNINGS)
-
 ########### next target ###############
 set(libkstarstools_SRCS 
 	tools/altvstime.cpp
@@ -363,7 +361,6 @@
 target_link_libraries(kstars
     ${KDE4_KDECORE_LIBS}
 	${KDE4_KNEWSTUFF3_LIBS}
-	${KDE4_KDE3SUPPORT_LIBS}
 	SatLib
 	htmesh
 	${ZLIB_LIBRARIES}
--- trunk/KDE/kdeedu/kstars/kstars/dialogs/locationdialog.cpp #1203703:1203704
@@ -62,7 +62,7 @@
     connect( ui->NewLat, SIGNAL( textChanged( const QString & ) ), this, SLOT( dataChanged() ) );
     connect( ui->TZBox, SIGNAL( activated(int) ), this, SLOT( dataChanged() ) );
     connect( ui->DSTRuleBox, SIGNAL( activated(int) ), this, SLOT( dataChanged() ) );
-    connect( ui->GeoBox, SIGNAL( selectionChanged() ), this, SLOT( changeCity() ) );
+    connect( ui->GeoBox, SIGNAL( itemSelectionChanged () ), this, SLOT( changeCity() ) );
     connect( ui->AddCityButton, SIGNAL( clicked() ), this, SLOT( addCity() ) );
     connect( ui->ClearFieldsButton, SIGNAL( clicked() ), this, SLOT( clearFields() ) );
 
@@ -94,7 +94,7 @@
     KStarsData* data = KStarsData::Instance();
     foreach ( GeoLocation *loc, data->getGeoList() )
     {
-        ui->GeoBox->insertItem( loc->fullName() );
+        ui->GeoBox->addItem( loc->fullName() );
         filteredCityList.append( loc );
 
         //If TZ is not an even integer value, add it to listbox
@@ -109,7 +109,7 @@
     }
 
     //Sort the list of Cities alphabetically...note that filteredCityList may now have a different ordering!
-    ui->GeoBox->sort();
+    ui->GeoBox->sortItems();
 
     ui->CountLabel->setText( i18np("One city matches search criteria","%1 cities match search criteria", ui->GeoBox->count()) );
 
@@ -117,7 +117,7 @@
     ui->GeoBox->setCurrentItem( 0 );
     for( uint i=0; i < ui->GeoBox->count(); i++ ) {
         if ( ui->GeoBox->item(i)->text() == data->geo()->fullName() ) {
-            ui->GeoBox->setCurrentItem( i );
+            ui->GeoBox->setCurrentRow( i );
             break;
         }
     }
@@ -134,7 +134,6 @@
     timer->start( 500 );
 }
 
-
 void LocationDialog::filterCity() {
     KStarsData* data = KStarsData::Instance();
     ui->GeoBox->clear();
@@ -157,17 +156,17 @@
                 sp.toLower().startsWith( ui->ProvinceFilter->text().toLower() ) &&
                 ss.toLower().startsWith( ui->CountryFilter->text().toLower() ) ) {
 
-            ui->GeoBox->insertItem( loc->fullName() );
+            ui->GeoBox->addItem( loc->fullName() );
             filteredCityList.append( loc );
         }
     }
 
-    ui->GeoBox->sort();
+    ui->GeoBox->sortItems();
 
     ui->CountLabel->setText( i18np("One city matches search criteria","%1 cities match search criteria", ui->GeoBox->count()) );
 
-    if ( ui->GeoBox->firstItem() )		// set first item in list as selected
-        ui->GeoBox->setCurrentItem( ui->GeoBox->firstItem() );
+    if ( ui->GeoBox->count() > 0 )		// set first item in list as selected
+        ui->GeoBox->setCurrentItem( ui->GeoBox->item(0) );
 
     ui->MapView->repaint();
 }
@@ -179,7 +178,7 @@
     if ( ui->GeoBox->currentItem() >= 0 ) {
         for ( int i=0; i < filteredCityList.size(); ++i ) {
             GeoLocation *loc = filteredCityList.at(i);
-            if ( loc->fullName() == ui->GeoBox->currentText() ) {
+            if ( loc->fullName() == ui->GeoBox->currentItem()->text()) {
                 SelectedCity = loc;
                 break;
             }
@@ -295,7 +294,7 @@
             if ( ui->GeoBox->count() ) {
                 for ( uint i=0; i<ui->GeoBox->count(); i++ ) {
                     if ( ui->GeoBox->item(i)->text() == g->fullName() ) {
-                        ui->GeoBox->setCurrentItem( i );
+                        ui->GeoBox->setCurrentRow( i );
                         break;
                     }
                 }
@@ -317,16 +316,16 @@
         if ( ( abs(	lng - int( loc->lng()->Degrees() ) ) < 3 ) &&
                 ( abs( lat - int( loc->lat()->Degrees() ) ) < 3 ) ) {
 
-            ui->GeoBox->insertItem( loc->fullName() );
+            ui->GeoBox->addItem( loc->fullName() );
             filteredCityList.append( loc );
         }
     }
 
-    ui->GeoBox->sort();
+    ui->GeoBox->sortItems();
     ui->CountLabel->setText( i18np("One city matches search criteria","%1 cities match search criteria", ui->GeoBox->count()) );
 
-    if ( ui->GeoBox->firstItem() )		// set first item in list as selected
-        ui->GeoBox->setCurrentItem( ui->GeoBox->firstItem() );
+    if ( ui->GeoBox->count() > 0 )		// set first item in list as selected
+        ui->GeoBox->setCurrentItem( ui->GeoBox->item(0) );
 
     repaint();
 }
--- trunk/KDE/kdeedu/kstars/kstars/dialogs/locationdialog.ui #1203703:1203704
@@ -124,7 +124,7 @@
        </layout>
       </item>
       <item>
-       <widget class="K3ListBox" native="1" name="GeoBox" />
+       <widget class="QListWidget" native="1" name="GeoBox" />
       </item>
      </layout>
     </widget>
@@ -408,11 +408,6 @@
    <extends>KLineEdit</extends>
    <header>widgets/dmsbox.h</header>
   </customwidget>
-  <customwidget>
-   <class>K3ListBox</class>
-   <extends></extends>
-   <header>k3listbox.h</header>
-  </customwidget>
  </customwidgets>
  <tabstops>
   <tabstop>CityFilter</tabstop>
--- trunk/KDE/kdeedu/kstars/kstars/dialogs/wizlocation.ui #1203703:1203704
@@ -212,7 +212,7 @@
     </layout>
    </item>
    <item>
-    <widget class="K3ListBox" name="CityListBox" native="true">
+    <widget class="QListWidget" name="CityListBox" native="true">
      <property name="minimumSize">
       <size>
        <width>180</width>
@@ -237,11 +237,6 @@
    <extends>KLineEdit</extends>
    <header>widgets/dmsbox.h</header>
   </customwidget>
-  <customwidget>
-   <class>K3ListBox</class>
-   <extends></extends>
-   <header>k3listbox.h</header>
-  </customwidget>
  </customwidgets>
  <tabstops>
   <tabstop>CityFilter</tabstop>
--- trunk/KDE/kdeedu/kstars/kstars/kswizard.cpp #1203703:1203704
@@ -81,7 +81,7 @@
     //connect signals/slots
     connect( this, SIGNAL( user1Clicked() ), this, SLOT( slotNextPage() ) );
     connect( this, SIGNAL( user2Clicked() ), this, SLOT( slotPrevPage() ) );
-    connect( location->CityListBox, SIGNAL( selectionChanged() ), this, SLOT( slotChangeCity() ) );
+    connect( location->CityListBox, SIGNAL( itemSelectionChanged () ), this, SLOT( slotChangeCity() ) );
     connect( location->CityFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotFilterCities() ) );
     connect( location->ProvinceFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotFilterCities() ) );
     connect( location->CountryFilter, SIGNAL( textChanged( const QString & ) ), this, SLOT( slotFilterCities() ) );
@@ -121,7 +121,7 @@
     //Populate the CityListBox
     //flag the ID of the current City
     foreach ( GeoLocation *loc, data->getGeoList() ) {
-        location->CityListBox->insertItem( loc->fullName() );
+        location->CityListBox->addItem( loc->fullName() );
         filteredCityList.append( loc );
         if ( loc->fullName() == data->geo()->fullName() ) {
             Geo = loc;
@@ -129,15 +129,16 @@
     }
 
     //Sort alphabetically
-    location->CityListBox->sort();
+    location->CityListBox->sortItems();
     //preset to current city
-    location->CityListBox->setCurrentItem( location->CityListBox->findItem(QString(data->geo()->fullName()) ) );
+    location->CityListBox->setCurrentItem(location->CityListBox->findItems(QString(data->geo()->fullName()),
+									   Qt::MatchExactly).at(0));
 }
 
 void KSWizard::slotChangeCity() {
     if ( location->CityListBox->currentItem() >= 0 ) {
         for ( int i=0; i < filteredCityList.size(); ++i ) {
-            if ( filteredCityList[i]->fullName() == location->CityListBox->currentText() ) {
+            if ( filteredCityList[i]->fullName() == location->CityListBox->currentItem()->text() ) {
                 Geo = filteredCityList[i];
                 break;
             }
@@ -158,14 +159,14 @@
             hasPrefix( loc->translatedProvince(), location->ProvinceFilter->text()  )
             )
         {
-            location->CityListBox->insertItem( loc->fullName() );
+            location->CityListBox->addItem( loc->fullName() );
             filteredCityList.append( loc );
         }
     }
-    location->CityListBox->sort();
+    location->CityListBox->sortItems();
 
-    if ( location->CityListBox->firstItem() )  // set first item in list as selected
-        location->CityListBox->setCurrentItem( location->CityListBox->firstItem() );
+    if ( location->CityListBox->count() > 0 )  // set first item in list as selected
+        location->CityListBox->setCurrentItem( location->CityListBox->item(0) );
 }
 
 void KSWizard::slotDownload() {
--- trunk/KDE/kdeedu/kstars/kstars/tools/argloadcolorscheme.ui #1203703:1203704
@@ -17,19 +17,10 @@
     <number>6</number>
    </property>
    <item>
-    <widget class="K3ListBox" name="SchemeList" />
+    <widget class="QListWidget" name="SchemeList" />
    </item>
   </layout>
  </widget>
-  <customwidgets>
-  <customwidget>
-   <class>K3ListBox</class>
-   <extends></extends>
-   <header>k3listbox.h</header>
-   <container>0</container>
-   <pixmap></pixmap>
-  </customwidget>
- </customwidgets>
  <resources/>
  <connections/>
 </ui>
--- trunk/KDE/kdeedu/kstars/kstars/tools/scriptbuilder.cpp #1203703:1203704
@@ -471,7 +471,7 @@
     connect( argPrintImage->UseChartColors, SIGNAL( toggled(bool) ), this, SLOT( slotPrintImage() ) );
     connect( argSetColor->ColorName, SIGNAL( activated(const QString &) ), this, SLOT( slotChangeColorName() ) );
     connect( argSetColor->ColorValue, SIGNAL( changed(const QColor &) ), this, SLOT( slotChangeColor() ) );
-    connect( argLoadColorScheme->SchemeList, SIGNAL( clicked( Q3ListBoxItem* ) ), this, SLOT( slotLoadColorScheme() ) );
+    connect( argLoadColorScheme->SchemeList, SIGNAL( itemClicked ( QListWidgetItem * )), this, SLOT( slotLoadColorScheme() ) );
 
     //connect( sb->AppendINDIWait, SIGNAL ( toggled(bool) ), this, SLOT(slotINDIWaitCheck(bool)));
 
@@ -926,10 +926,10 @@
     }
 
     //init list of color scheme names
-    argLoadColorScheme->SchemeList->insertItem( i18nc( "use default color scheme", "Default Colors" ) );
-    argLoadColorScheme->SchemeList->insertItem( i18nc( "use 'star chart' color scheme", "Star Chart" ) );
-    argLoadColorScheme->SchemeList->insertItem( i18nc( "use 'night vision' color scheme", "Night Vision" ) );
-    argLoadColorScheme->SchemeList->insertItem( i18nc( "use 'moonless night' color scheme", "Moonless Night" ) );
+    argLoadColorScheme->SchemeList->addItem( i18nc( "use default color scheme", "Default Colors" ) );
+    argLoadColorScheme->SchemeList->addItem( i18nc( "use 'star chart' color scheme", "Star Chart" ) );
+    argLoadColorScheme->SchemeList->addItem( i18nc( "use 'night vision' color scheme", "Night Vision" ) );
+    argLoadColorScheme->SchemeList->addItem( i18nc( "use 'moonless night' color scheme", "Moonless Night" ) );
 
     QFile file;
     QString line;
@@ -939,7 +939,7 @@
 
         while ( !stream.atEnd() ) {
             line = stream.readLine();
-            argLoadColorScheme->SchemeList->insertItem( line.left( line.indexOf( ':' ) ) );
+            argLoadColorScheme->SchemeList->addItem( line.left( line.indexOf( ':' ) ) );
         }
         file.close();
     }
@@ -1700,7 +1700,7 @@
 
         } else if ( sf->name() == "loadColorScheme" ) {
             sb->ArgStack->setCurrentWidget( argLoadColorScheme );
-            argLoadColorScheme->SchemeList->setCurrentItem( argLoadColorScheme->SchemeList->findItem( sf->argVal(0).remove('\"'), 0 ) );
+            argLoadColorScheme->SchemeList->setCurrentItem( argLoadColorScheme->SchemeList->findItems( sf->argVal(0).remove('\"'), Qt::MatchExactly ).at(0) );
 
         } else if ( sf->name() == "stop" ) {
             sb->ArgStack->setCurrentWidget( argBlank );
@@ -2431,7 +2431,7 @@
     if ( sf->name() == "loadColorScheme" ) {
         setUnsavedChanges( true );
 
-        sf->setArg( 0, '\"' + argLoadColorScheme->SchemeList->currentText() + '\"' );
+        sf->setArg( 0, '\"' + argLoadColorScheme->SchemeList->currentItem()->text() + '\"' );
         sf->setValid( true );
     } else {
         warningMismatch( "loadColorScheme" );


More information about the Kstars-devel mailing list