marble/src
MarbleNavigator.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #include "MarbleNavigator.h"
00014
00015 #include <QtCore/QtAlgorithms>
00016 #include <QtCore/QDebug>
00017 #include <QtCore/QTimer>
00018 #include <QtGui/QStringListModel>
00019
00020 #include "ui_MarbleNavigator.h"
00021
00022
00023 class MarbleNavigatorPrivate
00024 {
00025 public:
00026 int m_minimumzoom;
00027
00028 Ui::MarbleNavigator uiWidget;
00029 };
00030
00031
00032 MarbleNavigator::MarbleNavigator( QWidget *parent )
00033 : QWidget( parent ),
00034 d( new MarbleNavigatorPrivate )
00035
00036 {
00037 d->uiWidget.setupUi( this );
00038
00039 d->m_minimumzoom = 950;
00040
00041 setFocusPolicy( Qt::NoFocus );
00042
00043 connect( d->uiWidget.goHomeButton, SIGNAL( clicked() ),
00044 this, SIGNAL( goHome() ) );
00045 connect( d->uiWidget.zoomSlider, SIGNAL( valueChanged( int ) ),
00046 this, SIGNAL( zoomChanged( int ) ) );
00047 connect( d->uiWidget.zoomInButton, SIGNAL( clicked() ),
00048 this, SIGNAL( zoomIn() ) );
00049 connect( d->uiWidget.zoomOutButton, SIGNAL( clicked() ),
00050 this, SIGNAL( zoomOut() ) );
00051
00052 connect( d->uiWidget.moveLeftButton, SIGNAL( clicked() ),
00053 this, SIGNAL( moveLeft() ) );
00054 connect( d->uiWidget.moveRightButton, SIGNAL( clicked() ),
00055 this, SIGNAL( moveRight() ) );
00056 connect( d->uiWidget.moveUpButton, SIGNAL( clicked() ),
00057 this, SIGNAL( moveUp() ) );
00058 connect( d->uiWidget.moveDownButton, SIGNAL( clicked() ),
00059 this, SIGNAL (moveDown() ) );
00060 }
00061
00062 MarbleNavigator::~MarbleNavigator()
00063 {
00064 delete d;
00065 }
00066
00067
00068 int MarbleNavigator::minimumZoom() const
00069 {
00070 return d->m_minimumzoom;
00071 }
00072
00073
00074 void MarbleNavigator::changeZoom( int zoom )
00075 {
00076
00077
00078 d->uiWidget.zoomSlider->setValue( zoom );
00079 d->uiWidget.zoomSlider->setMinimum( d->m_minimumzoom );
00080 }
00081
00082
00083 void MarbleNavigator::resizeEvent ( QResizeEvent * )
00084 {
00085
00086
00087 if ( height() < 100 ) {
00088 if ( !d->uiWidget.zoomSlider->isHidden() ) {
00089 d->uiWidget.zoomSlider->hide();
00090 d->uiWidget.m_pSpacerFrame->setSizePolicy( QSizePolicy::Preferred,
00091 QSizePolicy::Expanding );
00092 }
00093 } else {
00094 if ( d->uiWidget.zoomSlider->isHidden() ) {
00095 d->uiWidget.zoomSlider->show();
00096 d->uiWidget.m_pSpacerFrame->setSizePolicy( QSizePolicy::Preferred,
00097 QSizePolicy::Fixed );
00098 }
00099 }
00100 }
00101
00102
00103 #include "MarbleNavigator.moc"