[Kstars-devel] branches/kstars/summer/kstars/kstars/tools
Prakash Mohan
prak902000 at gmail.com
Sat Jun 13 20:28:26 CEST 2009
SVN commit 981604 by prakash:
Provide functionality for the user to download all the images in the Session List by clicking a single button.
CCMAIL: kstars-devel at kde.org
M +19 -0 observinglist.cpp
M +3 -1 observinglist.h
M +12 -0 observinglist.ui
--- branches/kstars/summer/kstars/kstars/tools/observinglist.cpp #981603:981604
@@ -172,6 +172,8 @@
this, SLOT( slotSetTime() ) );
connect( ui->tabWidget, SIGNAL( currentChanged(int) ),
this, SLOT( slotChangeTab(int) ) );
+ connect( ui->saveImages, SIGNAL( clicked() ),
+ this, SLOT( slotSaveImages() ) );
//Add icons to Push Buttons
ui->OpenButton->setIcon( KIcon("document-open") );
ui->SaveButton->setIcon( KIcon("document-save") );
@@ -190,6 +192,7 @@
ui->SetTime->setEnabled( false );
ui->TimeEdit->setEnabled( false );
ui->GetImage->setEnabled( false );
+ ui->saveImages->setEnabled( false );
slotLoadWishList(); //Load the wishlist from disk if present
//Hide the MiniButton until I can figure out how to resize the Dialog!
@@ -278,6 +281,7 @@
//Adding an object should trigger the modified flag
if ( ! isModified ) isModified = true;
ui->SessionView->resizeColumnsToContents();
+ ui->saveImages->setEnabled( sessionView );
//Note addition in statusbar
ks->statusBar()->changeItem( i18n( "Added %1 to session list.", obj->name() ), 0 );
}
@@ -1087,6 +1091,8 @@
else
sessionView = false;
ui->WizardButton->setEnabled( ! sessionView );//wizard adds only to the Wish List
+ if( ! SessionList().isEmpty() )
+ ui->saveImages->setEnabled( sessionView );
//Clear the selection in the Tables
ui->TableView->clearSelection();
ui->SessionView->clearSelection();
@@ -1182,4 +1188,17 @@
SDSSUrl = UrlPrefix + RA + Dec + UrlSuffix;
}
+void ObservingList::slotSaveImages() {
+ foreach( SkyObject *o, SessionList() ) {
+ setCurrentImage( o );
+ KUrl url( SDSSUrl );
+ QString img( KStandardDirs::locateLocal( "appdata", CurrentImage ) );
+ if( KIO::NetAccess::download( url, img, mainWidget() ) )
+ if( QFile( KStandardDirs::locateLocal( "appdata", CurrentImage ) ).size() < 9000 ) {//The default image is around 8689 bytes
+ url = KUrl( DSSUrl );
+ KIO::NetAccess::download( url, img, mainWidget() );
+ }
+ }
+}
+
#include "observinglist.moc"
--- branches/kstars/summer/kstars/kstars/tools/observinglist.h #981603:981604
@@ -250,6 +250,8 @@
*/
void setCurrentImage( SkyObject *o );
+ void slotSaveImages();
+
protected slots:
void slotClose();
void downloadReady();
@@ -261,7 +263,7 @@
QList<SkyObject*> m_ObservingList, m_SessionList;
SkyObject *LogObject, *m_CurrentObject;
uint noNameStars;
- bool isModified, bIsLarge, sessionView, saveOnly, dss;
+ bool isModified, bIsLarge, sessionView, dss;
QString FileName, SessionName, CurrentImage, DSSUrl, SDSSUrl;
char decsgn;
KStarsDateTime dt;
--- branches/kstars/summer/kstars/kstars/tools/observinglist.ui #981603:981604
@@ -396,6 +396,13 @@
</widget>
</item>
<item>
+ <widget class="QPushButton" name="saveImages">
+ <property name="text">
+ <string>Save Images</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
@@ -657,6 +664,11 @@
<header>kimagefilepreview.h</header>
</customwidget>
<customwidget>
+ <class>KPlotWidget</class>
+ <extends>QFrame</extends>
+ <header>kplotwidget.h</header>
+ </customwidget>
+ <customwidget>
<class>KPushButton</class>
<extends>QPushButton</extends>
<header>kpushbutton.h</header>
More information about the Kstars-devel
mailing list