• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdegames API Reference
  • KDE Home
  • Contact Us
 

kblackbox

  • sources
  • kde-4.14
  • kdegames
  • kblackbox
kbblevelconfigurationwidget.cpp
Go to the documentation of this file.
1 /*
2 Copyright (c) 2006, 2007, Nicolas Roffet, <nicolas-kde@roffet.com>
3 
4 This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
5 
6 This program 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 General Public License for more details.
7 
8 You should have received a copy of the GNU Library General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
9 */
10 
11 #include "kbblevelconfigurationwidget.h"
12 
13 
14 
15 #include <QGridLayout>
16 
17 #include <klocale.h>
18 #include <KNumInput>
19 
20 #include "kbblevelconfigurationpreview.h"
21 #include "kbbscalablegraphicwidget.h"
22 #include "kbbthememanager.h"
23 
24 
25 
26 KBBLevelConfigurationWidget::KBBLevelConfigurationWidget(QWidget *parent, int c, int r, int b, KBBThemeManager* themeManager) : QWidget(parent)
27 {
28  QGridLayout *l = new QGridLayout(this);
29 
30  kcfg_balls = new KIntSpinBox(this);
31  kcfg_balls->setObjectName( QLatin1String("kcfg_balls" ));
32  l->addWidget(kcfg_balls, 0, 0, 1, 2);
33  kcfg_balls->setMinimum(1);
34  kcfg_balls->setValue(b);
35  kcfg_balls->setSuffix(ki18ncp("A number between 1 and 99 is displayed in front of it.", " ball", " balls"));
36  connect(kcfg_balls, SIGNAL(valueChanged(int)), this, SLOT(boxSizeChanged()));
37 
38  kcfg_columns = new KIntSpinBox(this);
39  kcfg_columns->setObjectName( QLatin1String("kcfg_columns" ));
40  l->addWidget(kcfg_columns, 1, 1);
41  kcfg_columns->setMinimum(2);
42  kcfg_columns->setMaximum(30);
43  kcfg_columns->setValue(c);
44  kcfg_columns->setSuffix(ki18ncp("A number between 2 and 30 is displayed in front of it.", " column", " columns"));
45  connect(kcfg_columns, SIGNAL(valueChanged(int)), this, SLOT(boxSizeChanged()));
46 
47  kcfg_rows = new KIntSpinBox(this);
48  kcfg_rows->setObjectName( QLatin1String("kcfg_rows" ));
49  l->addWidget(kcfg_rows, 2, 0);
50  kcfg_rows->setMinimum(2);
51  kcfg_rows->setMaximum(30);
52  kcfg_rows->setValue(r);
53  kcfg_rows->setSuffix(ki18ncp("A number between 2 and 30 is displayed in front of it.", " row", " rows"));
54  connect(kcfg_rows, SIGNAL(valueChanged(int)), this, SLOT(boxSizeChanged()));
55 
56  m_view = new KBBLevelConfigurationPreview(this, themeManager);
57  l->addWidget(m_view, 2, 1);
58 
59  boxSizeChanged();
60 }
61 
62 
63 int KBBLevelConfigurationWidget::balls() const
64 {
65  return kcfg_balls->value();
66 }
67 
68 
69 int KBBLevelConfigurationWidget::columns() const
70 {
71  return kcfg_columns->value();
72 }
73 
74 
75 int KBBLevelConfigurationWidget::rows() const
76 {
77  return kcfg_rows->value();
78 }
79 
80 
81 void KBBLevelConfigurationWidget::boxSizeChanged()
82 {
83  kcfg_balls->setMaximum(qMin(99, columns()*rows() - 1));
84  m_view->preview(balls(), columns(), rows());
85 }
86 
87 
88 #include "kbblevelconfigurationwidget.moc"
KBBLevelConfigurationWidget::columns
int columns() const
Definition: kbblevelconfigurationwidget.cpp:69
kbblevelconfigurationwidget.h
QWidget
QGridLayout::addWidget
void addWidget(QWidget *widget, int row, int column, QFlags< Qt::AlignmentFlag > alignment)
KBBLevelConfigurationWidget::rows
int rows() const
Definition: kbblevelconfigurationwidget.cpp:75
QGridLayout
kbblevelconfigurationpreview.h
kbbscalablegraphicwidget.h
KBBLevelConfigurationWidget::KBBLevelConfigurationWidget
KBBLevelConfigurationWidget(QWidget *parent, int c, int r, int b, KBBThemeManager *themeManager)
Definition: kbblevelconfigurationwidget.cpp:26
KBBLevelConfigurationWidget::balls
int balls() const
Definition: kbblevelconfigurationwidget.cpp:63
QLatin1String
KBBThemeManager
Theme manager of the scalable graphic widget.
Definition: kbbthememanager.h:51
QObject::connect
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
KBBLevelConfigurationPreview
Widget with the preview of the field in the configuration widget.
Definition: kbblevelconfigurationpreview.h:29
KBBLevelConfigurationPreview::preview
void preview(int balls, int columns, int rows)
Definition: kbblevelconfigurationpreview.cpp:39
kbbthememanager.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:18:20 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

kblackbox

Skip menu "kblackbox"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members

kdegames API Reference

Skip menu "kdegames API Reference"
  • granatier
  • kapman
  • kblackbox
  • kgoldrunner
  • kigo
  • kmahjongg
  • KShisen
  • ksquares
  • libkdegames
  •   highscore
  •   libkdegamesprivate
  •     kgame
  • libkmahjongg
  • palapeli
  •   libpala

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal