[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdeedu/marble/src/plugins/render
From: Bastian Holst <bastianholst () gmx ! de>
Date: 2009-04-27 9:34:05
Message-ID: 1240824845.217760.9129.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 959811 by bholst:
* Marbles PanoramioPlugin now compiled by default
* PanoramioImages now scaled
* Painting the most important images in the foreground
M +1 -1 CMakeLists.txt
M +3 -4 panoramio/AbstractDataPlugin.cpp
M +21 -11 panoramio/AbstractDataPluginModel.cpp
M +9 -2 panoramio/PanoramioWidget.cpp
M +2 -2 panoramio/PanoramioWidget.h
--- trunk/KDE/kdeedu/marble/src/plugins/render/CMakeLists.txt #959810:959811
@@ -8,7 +8,7 @@
add_subdirectory( overviewmap )
add_subdirectory( mapscale )
add_subdirectory( stars )
-# add_subdirectory( panoramio )
+add_subdirectory( panoramio )
# add_subdirectory ( twitter )
add_subdirectory( navigation )
--- trunk/KDE/kdeedu/marble/src/plugins/render/panoramio/AbstractDataPlugin.cpp #959810:959811
@@ -62,10 +62,9 @@
numberOfWidgets() );
painter->save();
- QList<AbstractDataPluginWidget*>::iterator it;
-
- for( it = widgets.begin(); it != widgets.end(); ++it ) {
- (*it)->render( painter, viewport, renderPos, layer );
+ // Paint the most important widget at last
+ for( int i = widgets.size() - 1; i >= 0; i-- ) {
+ widgets.at( i )->render( painter, viewport, renderPos, layer );
}
painter->restore();
--- trunk/KDE/kdeedu/marble/src/plugins/render/panoramio/AbstractDataPluginModel.cpp #959810:959811
@@ -32,6 +32,9 @@
// Time between to new description file downloads in ms
const int timeBetweenDownloads = 250;
+
+// Seperator to seperate the id of the widget from the file type
+const char fileIdSeperator = '_';
class AbstractDataPluginModelPrivate {
public:
@@ -170,7 +173,7 @@
QString AbstractDataPluginModel::generateFilename( QString id, QString type ) const {
QString name;
name += id;
- name += '_';
+ name += fileIdSeperator;
name += type;
return name;
@@ -217,25 +220,32 @@
}
else {
// The downloaded file contains widget data.
- QStringList fileInformation = id.split( '_' );
+ // Splitting the id in widgetId and fileType
+ QStringList fileInformation = id.split( fileIdSeperator );
+
+ if( fileInformation.size() < 2) {
+ qDebug() << "Strange file information " << id;
+ return;
+ }
+ QString widgetId = fileInformation.at( 0 );
+ fileInformation.removeAt( 0 );
+ QString fileType = fileInformation.join( QString( fileIdSeperator ) );
+
+ // Searching for the right widget in m_downloadingWidgets
QHash<QString, AbstractDataPluginWidget *>::iterator i = d->m_downloadingWidgets.find( id );
if( i != d->m_downloadingWidgets.end() ) {
- if( fileInformation.size() != 2 ) {
- qDebug() << "Strange file information " << id;
- return;
- }
-
- if( fileInformation.at( 0 ) != (*i)->id() ) {
+ if( widgetId != (*i)->id() ) {
qDebug() << "Different id";
return;
}
- (*i)->addDownloadedFile( generateFilepath( fileInformation.at( 0 ),
- fileInformation.at( 1 ) ),
- fileInformation.at( 1 ) );
+ (*i)->addDownloadedFile( generateFilepath( widgetId, fileType ),
+ fileType );
d->m_downloadingWidgets.erase( i );
+ // If the file is ready for displaying, it can be added to the list of
+ // initialized widgets
if( (*i)->initialized() ) {
addWidgetToList( *i );
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/panoramio/PanoramioWidget.cpp #959810:959811
@@ -36,7 +36,14 @@
void PanoramioWidget::addDownloadedFile( QString url, QString type ) {
if( standardImageSize == type ) {
- smallImage.load( url );
+ // Loading original image
+ QImage largeImage;
+ largeImage.load( url );
+
+ // Scaling the image to the half of the original size
+ smallImage = largeImage.scaled( largeImage.size() / 2,
+ Qt::IgnoreAspectRatio,
+ Qt::SmoothTransformation );
}
else {
qDebug() << "PanoramioWidget: addDownloadFile can't handle type " << type;
@@ -63,7 +70,7 @@
bool PanoramioWidget::render( GeoPainter *painter, ViewportParams *viewport,
const QString& renderPos, GeoSceneLayer * layer )
{
- painter->drawPixmap( coordinates(), smallImage );
+ painter->drawImage( coordinates(), smallImage );
return true;
}
--- trunk/KDE/kdeedu/marble/src/plugins/render/panoramio/PanoramioWidget.h #959810:959811
@@ -18,7 +18,7 @@
namespace Marble {
-const QString standardImageSize = "square";
+const QString standardImageSize = "mini_square";
class PanoramioWidget : public AbstractDataPluginWidget {
public:
@@ -39,7 +39,7 @@
bool operator<( const AbstractDataPluginWidget *other ) const;
private:
- QPixmap smallImage;
+ QImage smallImage;
QDate m_uploadDate;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic