1/*
2 * Copyright 2007-2009 Parker Coates <coates@kde.org>
3 *
4 * This file is part of Killbots.
5 *
6 * Killbots is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * Killbots is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with Killbots. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20#include "optionspage.h"
21
22#include <KDE/KComboBox>
23#include <KDE/KLocalizedString>
24
25#include <QtGui/QCheckBox>
26#include <QtGui/QFormLayout>
27#include <QtGui/QGridLayout>
28#include <QtGui/QLabel>
29#include <QtGui/QSlider>
30
31Killbots::OptionsPage::OptionsPage( QWidget * parent )
32 : QWidget( parent )
33{
34 QStringList clickActionList;
35 clickActionList << i18n("Nothing");
36 clickActionList << i18n("Step");
37 clickActionList << i18n("Repeated Step");
38 clickActionList << i18n("Teleport");
39 clickActionList << i18n("Teleport Safely");
40 clickActionList << i18n("Teleport (Safely If Possible)");
41 clickActionList << i18n("Wait Out Round");
42
43 kcfg_MiddleClickAction = new KComboBox();
44 kcfg_MiddleClickAction->setObjectName( QLatin1String("kcfg_MiddleClickAction" ));
45 kcfg_MiddleClickAction->addItems( clickActionList );
46
47 kcfg_RightClickAction = new KComboBox();
48 kcfg_RightClickAction->setObjectName( QLatin1String("kcfg_RightClickAction" ));
49 kcfg_RightClickAction->addItems( clickActionList );
50
51 kcfg_AnimationSpeed = new QSlider( Qt::Horizontal );
52 kcfg_AnimationSpeed->setObjectName( QLatin1String("kcfg_AnimationSpeed" ));
53 kcfg_AnimationSpeed->setSingleStep( 1 );
54 kcfg_AnimationSpeed->setMinimumWidth( 200 );
55 QLabel * slowLabel = new QLabel( i18n("Slow") );
56 slowLabel->setAlignment( Qt::AlignLeft );
57 QLabel * fastLabel = new QLabel( i18n("Fast") );
58 fastLabel->setAlignment( Qt::AlignCenter );
59 QLabel * instantLabel = new QLabel( i18n("Instant") );
60 instantLabel->setAlignment( Qt::AlignRight );
61
62 QGridLayout * speedLayout = new QGridLayout();
63 speedLayout->setMargin( 0 );
64 speedLayout->setSpacing( 0 );
65 speedLayout->addWidget( kcfg_AnimationSpeed, 0, 0, 1, 3 );
66 speedLayout->addWidget( slowLabel, 1, 0 );
67 speedLayout->addWidget( fastLabel, 1, 1 );
68 speedLayout->addWidget( instantLabel, 1, 2 );
69
70 QLabel * speedLabel = new QLabel( i18n("Animation &speed:") );
71 speedLabel->setBuddy( kcfg_AnimationSpeed );
72
73 kcfg_PreventUnsafeMoves = new QCheckBox( i18n("Prevent &unsafe moves") );
74 kcfg_PreventUnsafeMoves->setObjectName( QLatin1String("kcfg_PreventUnsafeMoves" ));
75
76 QFormLayout * formLayout = new QFormLayout( this );
77 formLayout->setMargin( 0 );
78 formLayout->addRow( i18n("&Middle-click action:"), kcfg_MiddleClickAction );
79 formLayout->addRow( i18n("&Right-click action:"), kcfg_RightClickAction );
80 formLayout->addItem( new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
81 formLayout->addRow( speedLabel, speedLayout );
82 formLayout->addItem( new QSpacerItem( 0, 16, QSizePolicy::Minimum, QSizePolicy::Fixed ) );
83 formLayout->addRow( 0, kcfg_PreventUnsafeMoves );
84}
85
86Killbots::OptionsPage::~OptionsPage()
87{
88}
89
90#include "moc_optionspage.cpp"
91