File indexing completed on 2022-09-27 13:12:49

0001 /***************************************************************************
0002  *   Copyright (C) 2005 by Albert Astals Cid <aacid@kde.org>               *
0003  *                                                                         *
0004  *   This program is free software; you can redistribute it and/or modify  *
0005  *   it under the terms of the GNU General Public License as published by  *
0006  *   the Free Software Foundation; either version 2 of the License, or     *
0007  *   (at your option) any later version.                                   *
0008  ***************************************************************************/
0009 
0010 #include "configwidget.h"
0011 
0012 #include <KAcceleratorManager>
0013 
0014 configWidget::configWidget(QWidget *parent) : QWidget(parent)
0015 {
0016     setupUi(this);
0017     KAcceleratorManager::setNoAccel(this);
0018     connect(kcfg_numberOfPlayers, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &configWidget::numberOfPlayersChanged);
0019     connect(kcfg_fontSize, static_cast<void (QSpinBox::*)(int)>(&QSpinBox::valueChanged), this, &configWidget::minimumRowHeightChanged);
0020 }
0021 
0022 void configWidget::numberOfPlayersChanged(int numberOfPlayers)
0023 {
0024     kcfg_player3Name -> setEnabled(true);
0025     kcfg_player3IsHuman -> setEnabled(true);
0026     kcfg_player4Name -> setEnabled(true);
0027     kcfg_player4IsHuman -> setEnabled(true);
0028     kcfg_player5Name -> setEnabled(true);
0029     kcfg_player5IsHuman -> setEnabled(true);
0030     kcfg_player6Name -> setEnabled(true);
0031     kcfg_player6IsHuman -> setEnabled(true);
0032     if (numberOfPlayers < 3)
0033     {
0034         kcfg_player3Name -> setEnabled(false);
0035         kcfg_player3IsHuman -> setEnabled(false);
0036     }
0037     if (numberOfPlayers < 4)
0038     {
0039         kcfg_player4Name -> setEnabled(false);
0040         kcfg_player4IsHuman -> setEnabled(false);
0041     }
0042     if (numberOfPlayers < 5)
0043     {
0044         kcfg_player5Name -> setEnabled(false);
0045         kcfg_player5IsHuman -> setEnabled(false);
0046     }
0047     if (numberOfPlayers < 6)
0048     {
0049         kcfg_player6Name -> setEnabled(false);
0050         kcfg_player6IsHuman -> setEnabled(false);
0051     }
0052 }
0053 
0054 void configWidget::minimumRowHeightChanged(int height)
0055 {
0056     kcfg_rowHeight -> setMinimum(height);
0057 }
0058 
0059 
0060