[locale] Move defines

- Used in only one place, move to .cpp
 - Drop useless scaling all the images *are* that size already
 - Add debugging check that the images match expected size
main
Adriaan de Groot 5 years ago
parent 9d9d9c361d
commit 2dfbed40c5

@ -28,6 +28,8 @@
#include "timezonewidget.h"
// Pixel value indicating that a spot is outside of a zone
#define RGB_TRANSPARENT 0
static constexpr double MAP_Y_OFFSET = 0.125;
static constexpr double MAP_X_OFFSET = -0.0370;
@ -49,9 +51,16 @@ TimeZoneWidget::TimeZoneWidget( QWidget* parent )
font.setBold( false );
// Images
background = QImage( ":/images/bg.png" ).scaled( X_SIZE, Y_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
background = QImage( ":/images/bg.png" );
pin = QImage( ":/images/pin.png" );
#ifdef DEBUG_TIMEZONES
if ( background.size() != QSize( 780, 340 ) )
{
cWarning() << "Timezone background size mitsmatch" << background.size();
}
#endif
// Set size
setMinimumSize( background.size() );
setMaximumSize( background.size() );
@ -60,9 +69,12 @@ TimeZoneWidget::TimeZoneWidget( QWidget* parent )
QStringList zones = QString( ZONES ).split( " ", QString::SkipEmptyParts );
for ( int i = 0; i < zones.size(); ++i )
{
timeZoneImages.append( QImage( ":/images/timezone_" + zones.at( i ) + ".png" )
.scaled( X_SIZE, Y_SIZE, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
timeZoneImages.append( QImage( ":/images/timezone_" + zones.at( i ) + ".png" ) );
#ifdef DEBUG_TIMEZONES
if ( timeZoneImages.last().size() != background.size() )
{
cWarning() << "Timezone image size mismatch" << zones.at( i ) << timeZoneImages.last().size();
}
timeZoneImages.last().setText( ZONE_NAME, zones.at( i ) );
#endif
}

@ -40,12 +40,9 @@
#include <QWidget>
#define RGB_TRANSPARENT 0
#define ZONES \
"0.0 1.0 2.0 3.0 3.5 4.0 4.5 5.0 5.5 5.75 6.0 6.5 7.0 8.0 9.0 9.5 10.0 10.5 11.0 11.5 12.0 12.75 13.0 -1.0 -2.0 " \
"-3.0 -3.5 -4.0 -4.5 -5.0 -5.5 -6.0 -7.0 -8.0 -9.0 -9.5 -10.0 -11.0"
#define X_SIZE 780
#define Y_SIZE 340
class TimeZoneWidget : public QWidget

Loading…
Cancel
Save