File: TileLevelRangeWidget.cpp

package info (click to toggle)
marble 4%3A17.08.3-3.2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 141,596 kB
  • sloc: cpp: 189,322; xml: 39,420; ansic: 7,204; python: 2,244; sh: 1,137; makefile: 236; perl: 222; ruby: 97; java: 66
file content (91 lines) | stat: -rw-r--r-- 2,707 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library. If not, see <http://www.gnu.org/licenses/>.

#include "TileLevelRangeWidget.h"

#include "ui_TileLevelRangeWidget.h"

namespace Marble
{

class Q_DECL_HIDDEN TileLevelRangeWidget::Private
{
public:
    explicit Private( QWidget * const parent );
    Ui::TileLevelRangeWidget m_ui;
};

TileLevelRangeWidget::Private::Private( QWidget * const parent )
{
    m_ui.setupUi( parent );
}

TileLevelRangeWidget::TileLevelRangeWidget( QWidget * const parent, Qt::WindowFlags const f )
    : QWidget( parent, f ),
      d( new Private( this ))
{
    connect( d->m_ui.topSpinBox, SIGNAL(valueChanged(int)), SIGNAL(topLevelChanged(int)));
    connect( d->m_ui.bottomSpinBox, SIGNAL(valueChanged(int)),
             SIGNAL(bottomLevelChanged(int)));

    connect( d->m_ui.topSpinBox, SIGNAL(valueChanged(int)), SLOT(setMinimumBottomLevel(int)));
    connect( d->m_ui.bottomSpinBox, SIGNAL(valueChanged(int)), SLOT(setMaximumTopLevel(int)));
}

TileLevelRangeWidget::~TileLevelRangeWidget()
{
    delete d;
}

QSize TileLevelRangeWidget::sizeHint() const
{
    return size();
}

void TileLevelRangeWidget::setAllowedLevelRange( int const minimumLevel, int const maximumLevel )
{
    d->m_ui.topSpinBox->setRange( minimumLevel, qMin( d->m_ui.bottomSpinBox->value(),
                                                      maximumLevel ));
    d->m_ui.bottomSpinBox->setRange( qMax( d->m_ui.topSpinBox->value(), minimumLevel ),
                                     maximumLevel );
}

void TileLevelRangeWidget::setDefaultLevel( int const level )
{
    d->m_ui.topSpinBox->setValue( level );
    d->m_ui.bottomSpinBox->setValue( level );
}

int TileLevelRangeWidget::bottomLevel() const
{
    return d->m_ui.bottomSpinBox->value();
}

int TileLevelRangeWidget::topLevel() const
{
    return d->m_ui.topSpinBox->value();
}

void TileLevelRangeWidget::setMaximumTopLevel( int const level )
{
    d->m_ui.topSpinBox->setMaximum( level );
}

void TileLevelRangeWidget::setMinimumBottomLevel( int const level )
{
    d->m_ui.bottomSpinBox->setMinimum( level );
}

}

#include "moc_TileLevelRangeWidget.cpp"