[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/kstars/kstars/tools
From: Prakash Mohan <prak902000 () gmail ! com>
Date: 2010-07-06 14:56:22
Message-ID: 20100706145622.294AAAC85D () svn ! kde ! org
[Download RAW message or body]
SVN commit 1146743 by prakash:
Remove code repetition. Add a function to set the default image in the image preview.
CCMAIL:kstars-devel@kde.org
M +10 -12 observinglist.cpp
M +4 -0 observinglist.h
--- trunk/KDE/kdeedu/kstars/kstars/tools/observinglist.cpp #1146742:1146743
@@ -137,12 +137,7 @@
ui->ImagePreview->installEventFilter( this );
ui->TableView->viewport()->installEventFilter( this );
ui->SessionView->viewport()->installEventFilter( this );
- QFile file;
- if ( KSUtils::openDataFile( file, "noimage.png" ) ) {
- file.close();
- ui->ImagePreview->showPreview( KUrl( file.fileName() ) );
- } else
- ui->ImagePreview->hide();
+ setDefaultImage();
//Connections
connect( this, SIGNAL( closeClicked() ), this, SLOT( slotClose() ) );
connect( ui->TableView, SIGNAL( doubleClicked( const QModelIndex& ) ),
@@ -450,12 +445,7 @@
showScope = false;
ui->ImagePreview->clearPreview();
ui->ImagePreview->setCursor( Qt::ArrowCursor );
- QFile file;
- if ( KSUtils::openDataFile( file, "noimage.png" ) ) {
- file.close();
- ui->ImagePreview->showPreview( KUrl( file.fileName() ) );
- } else
- ui->ImagePreview->hide();
+ setDefaultImage();
QModelIndexList selectedItems;
QString newName;
SkyObject *o;
@@ -1429,4 +1419,12 @@
}
}
+void ObservingList::setDefaultImage() {
+ QFile file;
+ if ( KSUtils::openDataFile( file, "noimage.png" ) ) {
+ file.close();
+ ui->ImagePreview->showPreview( KUrl( file.fileName() ) );
+ } else
+ ui->ImagePreview->hide();
+}
#include "observinglist.moc"
--- trunk/KDE/kdeedu/kstars/kstars/tools/observinglist.h #1146742:1146743
@@ -174,6 +174,10 @@
*/
void selectObject( SkyObject *o );
+ /**@short set the default image in the image preview.
+ */
+ void setDefaultImage();
+
public slots:
/**@short add a new object to list
*@p o pointer to the object to add to the list
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic