• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

kblackbox

kbblevelconfigurationwidget.cpp

Go to the documentation of this file.
00001 /*
00002 Copyright (c) 2006, 2007, Nicolas Roffet, <nicolas-kde@roffet.com>
00003 
00004 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.
00005 
00006 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.
00007 
00008 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
00009 */
00010 
00011 #include "kbblevelconfigurationwidget.h"
00012 
00013 
00014 
00015 #include <QGridLayout>
00016 #include <QSpinBox>
00017 
00018 
00019 #include <klocale.h>
00020 
00021 
00022 #include "kbblevelconfigurationpreview.h"
00023 #include "kbbscalablegraphicwidget.h"
00024 #include "kbbthememanager.h"
00025 
00026 
00027 
00028 KBBLevelConfigurationWidget::KBBLevelConfigurationWidget(QWidget *parent, int c, int r, int b, KBBThemeManager* themeManager) : QWidget(parent)
00029 {
00030     QGridLayout *l = new QGridLayout(this);
00031 
00032     kcfg_balls = new QSpinBox(this);
00033     kcfg_balls->setObjectName("kcfg_balls");
00034     l->addWidget(kcfg_balls, 0, 0, 1, 2);
00035     kcfg_balls->setMinimum(1);
00036     kcfg_balls->setValue(b);
00037     kcfg_balls->setSuffix(i18nc("A number between 1 and 99 is displayed in front of it.", " ball(s)"));
00038     connect(kcfg_balls, SIGNAL(valueChanged(int)), this, SLOT(boxSizeChanged()));
00039 
00040     kcfg_columns = new QSpinBox(this);
00041     kcfg_columns->setObjectName("kcfg_columns");
00042     l->addWidget(kcfg_columns, 1, 1);
00043     kcfg_columns->setMinimum(2);
00044     kcfg_columns->setMaximum(30);
00045     kcfg_columns->setValue(c);
00046     kcfg_columns->setSuffix(i18nc("A number between 2 and 30 is displayed in front of it.", " columns"));
00047     connect(kcfg_columns, SIGNAL(valueChanged(int)), this, SLOT(boxSizeChanged()));
00048 
00049     kcfg_rows = new QSpinBox(this);
00050     kcfg_rows->setObjectName("kcfg_rows");
00051     l->addWidget(kcfg_rows, 2, 0);
00052     kcfg_rows->setMinimum(2);
00053     kcfg_rows->setMaximum(30);
00054     kcfg_rows->setValue(r);
00055     kcfg_rows->setSuffix(i18nc("A number between 2 and 30 is displayed in front of it.", " rows"));
00056     connect(kcfg_rows, SIGNAL(valueChanged(int)), this, SLOT(boxSizeChanged()));
00057 
00058     m_view = new KBBLevelConfigurationPreview(this, themeManager);
00059     l->addWidget(m_view, 2, 1);
00060 
00061     boxSizeChanged();
00062 }
00063 
00064 
00065 int KBBLevelConfigurationWidget::balls() const
00066 {
00067     return kcfg_balls->value();
00068 }
00069 
00070 
00071 int KBBLevelConfigurationWidget::columns() const
00072 {
00073     return kcfg_columns->value();
00074 }
00075 
00076 
00077 int KBBLevelConfigurationWidget::rows() const
00078 {
00079     return kcfg_rows->value();
00080 }
00081 
00082 
00083 void KBBLevelConfigurationWidget::boxSizeChanged()
00084 {
00085     kcfg_balls->setMaximum(qMin(99, columns()*rows() - 1));
00086     m_view->preview(balls(), columns(), rows());
00087 }
00088 
00089 
00090 #include "kbblevelconfigurationwidget.moc"

kblackbox

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

API Reference

Skip menu "API Reference"
  • kblackbox
  • kgoldrunner
  • kmahjongg
  • ksquares
  • libkdegames
  •   highscore
  •   kgame
  •   kggzgames
  •   kggzmod
  •   kggznet
  • libkmahjongg
Generated for API Reference by doxygen 1.5.4
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal