Commit 5a1c9286 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Port deprecated signals

parent bc8b149c
......@@ -84,11 +84,11 @@ StartGameDialog::StartGameDialog(QWidget *parent, KgThemeProvider *provider) :
}
}
connect(ui->blackTypeGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &StartGameDialog::slotUpdateBlack);
connect(ui->whiteTypeGroup, static_cast<void (QButtonGroup::*)(int)>(&QButtonGroup::buttonClicked), this, &StartGameDialog::slotUpdateWhite);
connect(ui->blackTypeGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), this, &StartGameDialog::slotUpdateBlack);
connect(ui->whiteTypeGroup, static_cast<void (QButtonGroup::*)(QAbstractButton *)>(&QButtonGroup::buttonClicked), this, &StartGameDialog::slotUpdateWhite);
slotUpdateBlack(GameStartInformation::Human);
slotUpdateWhite(GameStartInformation::AI);
slotUpdateBlack(ui->blackTypeGroup->button(GameStartInformation::Human));
slotUpdateWhite(ui->whiteTypeGroup->button(GameStartInformation::AI));
}
StartGameDialog::~StartGameDialog()
......@@ -160,22 +160,29 @@ void StartGameDialog::setChipsPrefix(ChipsPrefix prefix)
}
void StartGameDialog::slotUpdateBlack(int clickedId)
void StartGameDialog::slotUpdateBlack(QAbstractButton *button)
{
ui->blackSkill->setEnabled(clickedId == GameStartInformation::AI);
ui->blackName->setEnabled(clickedId == GameStartInformation::Human);
if (clickedId == GameStartInformation::Human)
ui->blackName->setText(m_user.loginName());
else
ui->blackName->setText(i18n("Computer"));
if (button) {
const int clickedId = ui->blackTypeGroup->id(button);
ui->blackSkill->setEnabled(clickedId == GameStartInformation::AI);
ui->blackName->setEnabled(clickedId == GameStartInformation::Human);
if (clickedId == GameStartInformation::Human)
ui->blackName->setText(m_user.loginName());
else
ui->blackName->setText(i18n("Computer"));
}
}
void StartGameDialog::slotUpdateWhite(int clickedId)
void StartGameDialog::slotUpdateWhite(QAbstractButton *button)
{
ui->whiteSkill->setEnabled(clickedId == GameStartInformation::AI);
ui->whiteName->setEnabled(clickedId == GameStartInformation::Human);
if (clickedId == GameStartInformation::Human)
ui->whiteName->setText(m_user.loginName());
else
ui->whiteName->setText(i18n("Computer"));
if (button) {
const int clickedId = ui->whiteTypeGroup->id(button);
ui->whiteSkill->setEnabled(clickedId == GameStartInformation::AI);
ui->whiteName->setEnabled(clickedId == GameStartInformation::Human);
if (clickedId == GameStartInformation::Human)
ui->whiteName->setText(m_user.loginName());
else
ui->whiteName->setText(i18n("Computer"));
}
}
......@@ -30,7 +30,7 @@
#include <QDialog>
#include <KUser>
#include <KgThemeProvider>
class QAbstractButton;
namespace Ui
{
class StartGameDialog;
......@@ -67,12 +67,12 @@ private slots:
/**
* Handles "User changed player type for black player" event
*/
void slotUpdateBlack(int clickedId);
void slotUpdateBlack(QAbstractButton *button);
/**
* Handles "User changed player type for white player" event
*/
void slotUpdateWhite(int clickedId);
void slotUpdateWhite(QAbstractButton *button);
void slotAccepted();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment