[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: branches/KDE/4.1/kdeedu/marble
From: Torsten Rahn <tackat () kde ! org>
Date: 2008-08-16 13:25:37
Message-ID: 1218893137.972148.1536.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 847947 by rahn:
- Fixing Marble not showing anything if no maptheme got assigned.
- Fixing a corner case where the bounding box didn't get detected properly
M +1 -0 data/CMakeLists.txt
AM data/svg/marble-logo-inverted-72dpi.png
M +50 -17 src/lib/MarbleWidget.cpp
M +4 -1 src/lib/Projections/SphericalProjection.cpp
--- branches/KDE/4.1/kdeedu/marble/data/CMakeLists.txt #847946:847947
@@ -26,6 +26,7 @@
svg/marble-logo.svg
svg/marble-logo.png
svg/marble-logo-72dpi.png
+svg/marble-logo-inverted-72dpi.png
svg/application-x-marble.svg
svg/application-x-marble.png
svg/application-x-marble-gray.png
** branches/KDE/4.1/kdeedu/marble/data/svg/marble-logo-inverted-72dpi.png #property \
svn:mime-type + application/octet-stream
--- branches/KDE/4.1/kdeedu/marble/src/lib/MarbleWidget.cpp #847946:847947
@@ -26,6 +26,7 @@
//#include <QtDBus/QDBusConnection>
#include "AbstractProjection.h"
+#include "MarbleDirs.h"
#include "MarbleMap.h"
#include "MarbleModel.h"
#include "Quaternion.h"
@@ -34,7 +35,6 @@
#include "FileViewModel.h"
#include "GeoDataPoint.h"
#include "GpxFileViewItem.h"
-#include "MarbleDirs.h"
#include "MarblePhysics.h"
#include "MarblePlacemarkModel.h"
#include "MarbleWidgetInputHandler.h"
@@ -90,6 +90,8 @@
void construct();
+ void paintEmptyMapWarning();
+
MarbleWidget *m_widget;
// The model we are showing.
MarbleMap *m_map;
@@ -229,7 +231,32 @@
m_widget, SLOT( updateAnimation( qreal ) ) );
}
+void MarbleWidgetPrivate::paintEmptyMapWarning()
+{
+ QPainter logoPainter;
+ logoPainter.begin( m_widget );
+ QPixmap logoPixmap( MarbleDirs::path( "svg/marble-logo-inverted-72dpi.png" ) );
+
+ if ( logoPixmap.width() > m_widget->width() * 0.7 || logoPixmap.height() > \
m_widget->height() * 0.7 ) + {
+ logoPixmap = logoPixmap.scaled( m_widget->size() * 0.7, Qt::KeepAspectRatio, \
Qt::SmoothTransformation ); + }
+
+ QPoint logoPosition( ( m_widget->width() - logoPixmap.width() ) / 2 ,
+ ( m_widget->height() - logoPixmap.height() ) / 2 );
+ logoPainter.drawPixmap( logoPosition, logoPixmap );
+
+ QString noThemeWarning = "Please assign a map theme!";
+
+ logoPainter.setPen( Qt::white );
+ QRect textRect( 0, logoPosition.y() + logoPixmap.height() + \
m_widget->fontMetrics().height(), + m_widget->width(), \
m_widget->fontMetrics().height() ); + logoPainter.drawText( textRect, \
Qt::AlignCenter, noThemeWarning ); + logoPainter.end();
+}
+
+
// ----------------------------------------------------------------
@@ -290,7 +317,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
emit distanceChanged( distanceString() );
@@ -474,7 +501,7 @@
// We only have to repaint the background every time if the globe
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
emit distanceChanged( distanceString() );
@@ -504,7 +531,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -515,7 +542,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -534,7 +561,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -564,7 +591,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -588,7 +615,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -614,7 +641,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() ); }
void MarbleWidget::setCenterLongitude( double lon )
@@ -623,7 +650,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() ); }
Projection MarbleWidget::projection() const
@@ -635,7 +662,7 @@
{
d->m_map->setProjection( projection );
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -667,7 +694,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -678,7 +705,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -690,7 +717,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -701,7 +728,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -715,7 +742,7 @@
{
d->m_map->setSize( width(), height() );
- setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint();
}
@@ -803,6 +830,12 @@
void MarbleWidget::paintEvent(QPaintEvent *evt)
{
+ if ( mapThemeId().isEmpty() )
+ {
+ d->paintEmptyMapWarning();
+ return;
+ }
+
QTime t;
t.start();
@@ -842,7 +875,7 @@
// We only have to repaint the background every time if the earth
// doesn't cover the whole image.
- setAttribute( Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() );
+ setAttribute(Qt::WA_NoSystemBackground, d->m_map->mapCoversViewport() && \
!mapThemeId().isEmpty() );
repaint(); // not obsolete in case the zoomlevel stays unaltered
}
--- branches/KDE/4.1/kdeedu/marble/src/lib/Projections/SphericalProjection.cpp \
#847946:847947 @@ -202,7 +202,10 @@
// If the whole globe is visible we can easily calculate analytically the \
lon-/lat- range
double pitch = GeoDataPoint::normalizeLat( viewport->planetAxis().pitch() );
- if ( 2 * viewport->radius() < viewport->height() && viewport->radius() < \
viewport->width() ) { + // "+1" is necessary to ensure that both hemispheres \
touch the screenborder: + if ( 2 * viewport->radius() <= viewport->height() + 1
+ && 2 * viewport->radius() <= viewport->width() + 1 )
+ {
// Unless the planetaxis is in the screen plane the allowed longitude range
// covers full -180 deg to +180 deg:
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic