summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTorsten Rahn <[email protected]>2015-03-23 23:19:05 +0100
committerTorsten Rahn <[email protected]>2015-03-23 23:19:05 +0100
commit0cd4b0d7e5bcb1e4011eddf3a36300f228e7c03f (patch)
tree6cf7895ff3d8a13a5b602f1f6c9ec8cdf2041135
parent9720212b12dfee41ffe664b1d7b2f56dfe89aa7b (diff)
Unfortunately the scaling patch doesn't work properly -
I added some remarks on review board. Revert "Adds scale option to Placemark icons and labels" This reverts commit 9720212b12dfee41ffe664b1d7b2f56dfe89aa7b.
-rw-r--r--src/lib/marble/EditPlacemarkDialog.ui38
-rw-r--r--src/lib/marble/PlacemarkLayout.cpp15
-rw-r--r--src/lib/marble/VisiblePlacemark.cpp21
-rw-r--r--src/lib/marble/VisiblePlacemark.h1
4 files changed, 17 insertions, 58 deletions
diff --git a/src/lib/marble/EditPlacemarkDialog.ui b/src/lib/marble/EditPlacemarkDialog.ui
index c28555b..e17bf14 100644
--- a/src/lib/marble/EditPlacemarkDialog.ui
+++ b/src/lib/marble/EditPlacemarkDialog.ui
@@ -264,7 +264,7 @@
<item>
<widget class="QLabel" name="m_labelScaleField">
<property name="enabled">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="text">
<string>Scale:</string>
@@ -274,20 +274,11 @@
<item>
<widget class="QDoubleSpinBox" name="m_labelScale">
<property name="enabled">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="decimals">
<number>1</number>
</property>
- <property name="minimum">
- <double>0.500000000000000</double>
- </property>
- <property name="maximum">
- <double>2.000000000000000</double>
- </property>
- <property name="value">
- <double>1.000000000000000</double>
- </property>
</widget>
</item>
</layout>
@@ -382,7 +373,7 @@
<item>
<widget class="QLabel" name="m_iconScaleField">
<property name="enabled">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="text">
<string>Scale:</string>
@@ -392,20 +383,11 @@
<item>
<widget class="QDoubleSpinBox" name="m_iconScale">
<property name="enabled">
- <bool>true</bool>
+ <bool>false</bool>
</property>
<property name="decimals">
<number>1</number>
</property>
- <property name="minimum">
- <double>0.100000000000000</double>
- </property>
- <property name="maximum">
- <double>5.000000000000000</double>
- </property>
- <property name="value">
- <double>1.000000000000000</double>
- </property>
</widget>
</item>
</layout>
@@ -466,7 +448,7 @@
<bool>true</bool>
</property>
<property name="icon">
- <iconset resource="../../apps/marble-ui/marble.qrc">
+ <iconset resource="libmarble.qrc">
<normaloff>:/icons/format-text-bold.png</normaloff>:/icons/format-text-bold.png</iconset>
</property>
<property name="text">
@@ -481,7 +463,7 @@
<bool>true</bool>
</property>
<property name="icon">
- <iconset resource="../../apps/marble-ui/marble.qrc">
+ <iconset resource="libmarble.qrc">
<normaloff>:/icons/format-text-italic.png</normaloff>:/icons/format-text-italic.png</iconset>
</property>
<property name="text">
@@ -496,7 +478,7 @@
<bool>true</bool>
</property>
<property name="icon">
- <iconset resource="../../apps/marble-ui/marble.qrc">
+ <iconset resource="libmarble.qrc">
<normaloff>:/icons/format-text-underline.png</normaloff>:/icons/format-text-underline.png</iconset>
</property>
<property name="text">
@@ -508,7 +490,7 @@
</action>
<action name="m_actionAddImage">
<property name="icon">
- <iconset resource="../../apps/marble-ui/marble.qrc">
+ <iconset resource="libmarble.qrc">
<normaloff>:/icons/insert-image.png</normaloff>:/icons/insert-image.png</iconset>
</property>
<property name="text">
@@ -520,7 +502,7 @@
</action>
<action name="m_actionAddLink">
<property name="icon">
- <iconset resource="../../apps/marble-ui/marble.qrc">
+ <iconset resource="libmarble.qrc">
<normaloff>:/icons/insert-link.png</normaloff>:/icons/insert-link.png</iconset>
</property>
<property name="text">
@@ -539,7 +521,7 @@
</customwidget>
</customwidgets>
<resources>
- <include location="../../apps/marble-ui/marble.qrc"/>
+ <include location="libmarble.qrc"/>
</resources>
<connections>
<connection>
diff --git a/src/lib/marble/PlacemarkLayout.cpp b/src/lib/marble/PlacemarkLayout.cpp
index fc73872..6c0af30 100644
--- a/src/lib/marble/PlacemarkLayout.cpp
+++ b/src/lib/marble/PlacemarkLayout.cpp
@@ -254,8 +254,7 @@ int PlacemarkLayout::maxLabelHeight() const
if ( placemark ) {
const GeoDataStyle* style = placemark->style();
QFont labelFont = style->labelStyle().font();
- float scale = style->labelStyle().scale();
- float textHeight = QFontMetrics( labelFont ).height() * scale;
+ int textHeight = QFontMetrics( labelFont ).height();
if ( textHeight > maxLabelHeight )
maxLabelHeight = textHeight;
}
@@ -603,25 +602,21 @@ QRectF PlacemarkLayout::roomForLabel( const GeoDataStyle * style,
const QString &labelText ) const
{
QFont labelFont = style->labelStyle().font();
- float labelScale = style->labelStyle().scale();
- float iconScale = style->labelStyle().scale();
-
- float textHeight = QFontMetrics( labelFont ).height() * labelScale;
- float textWidth;
+ int textHeight = QFontMetrics( labelFont ).height();
+ int textWidth;
if ( style->labelStyle().glow() ) {
labelFont.setWeight( 75 ); // Needed to calculate the correct pixmap size;
textWidth = ( QFontMetrics( labelFont ).width( labelText )
- * labelScale
+ qRound( 2 * s_labelOutlineWidth ) );
} else {
- textWidth = ( QFontMetrics( labelFont ).width( labelText ) * labelScale );
+ textWidth = ( QFontMetrics( labelFont ).width( labelText ) );
}
const QVector<VisiblePlacemark*> currentsec = m_rowsection.at( y / m_maxLabelHeight );
if ( style->labelStyle().alignment() == GeoDataLabelStyle::Corner ) {
- const int symbolWidth = style->iconStyle().icon().width() * iconScale;
+ const int symbolWidth = style->iconStyle().icon().width();
// Check the four possible positions by going through all of them
for( int i=0; i<4; ++i ) {
diff --git a/src/lib/marble/VisiblePlacemark.cpp b/src/lib/marble/VisiblePlacemark.cpp
index ce86bda..d57dcb0 100644
--- a/src/lib/marble/VisiblePlacemark.cpp
+++ b/src/lib/marble/VisiblePlacemark.cpp
@@ -111,22 +111,8 @@ const QPixmap& VisiblePlacemark::labelPixmap() const
void VisiblePlacemark::setSymbolPixmap()
{
const GeoDataStyle *style = m_placemark->style();
-
- // Scaling icon
- float scale = m_placemark->style()->iconStyle().scale();
- QSize size = m_placemark->style()->iconStyle().icon().size();
-
- if ( size.rheight() * scale < maxIconSize && size.rwidth() * scale < maxIconSize ) {
- size *= scale;
- }
- else {
- size = QSize( maxIconSize, maxIconSize );
- }
-
- if ( style != NULL && !(style->iconStyle().icon().isNull()) ) {
-
- QImage scaledIcon = style->iconStyle().icon().scaled( size, Qt::KeepAspectRatio );
- m_symbolPixmap = QPixmap::fromImage( scaledIcon );
+ if ( style ) {
+ m_symbolPixmap = QPixmap::fromImage( style->iconStyle().icon() );
emit updateNeeded();
}
else {
@@ -157,9 +143,6 @@ void VisiblePlacemark::drawLabelPixmap()
QFont labelFont = style->labelStyle().font();
QColor labelColor = style->labelStyle().color();
- float scale = style->labelStyle().scale();
- labelFont.setPointSize( labelFont.pointSize() * scale );
-
LabelStyle labelStyle = Normal;
if ( m_selected ) {
labelStyle = Selected;
diff --git a/src/lib/marble/VisiblePlacemark.h b/src/lib/marble/VisiblePlacemark.h
index 0c6e1ce..805112d 100644
--- a/src/lib/marble/VisiblePlacemark.h
+++ b/src/lib/marble/VisiblePlacemark.h
@@ -28,7 +28,6 @@ namespace Marble
class GeoDataPlacemark;
static const qreal s_labelOutlineWidth = 2.5;
-static const int maxIconSize = 40;
/**
* @short A class which represents the visible place marks on a map.