Commit eb1778d9 authored by Denis Kuplyakov's avatar Denis Kuplyakov

Replaced Black and White captions with chip images at StartGameDialog

Used passed to StartGameDialog KgThemeProvider and extracted needed
image with QSvgRenderer.
parent 368e343e
......@@ -5,6 +5,9 @@
#include <QCloseEvent>
#include <KgDifficulty>
#include <kdebug.h>
#include <QSvgRenderer>
#include <QPainter>
#include <KColorScheme>
StartGameDialog::StartGameDialog(QWidget *parent, KgThemeProvider *provider) :
KDialog(parent),
......@@ -24,6 +27,38 @@ StartGameDialog::StartGameDialog(QWidget *parent, KgThemeProvider *provider) :
setMainWidget(m_contents);
ui->setupUi(m_contents);
QSvgRenderer svgRenderer;
svgRenderer.load(m_provider->currentTheme()->graphicsPath());
QPixmap blackChip(QSize(46, 46));
blackChip.fill(Qt::transparent);
QPixmap whiteChip(QSize(46, 46));
whiteChip.fill(Qt::transparent);
QPainter *painter = new QPainter(&blackChip);
svgRenderer.render(painter, "chip_bw_1");
delete painter;
painter = new QPainter(&whiteChip);
svgRenderer.render(painter, "chip_bw_12");
delete painter;
ui->blackLabel->setPixmap(blackChip);
ui->whiteLabel->setPixmap(whiteChip);
QGraphicsDropShadowEffect *blackShadow = new QGraphicsDropShadowEffect(this);
blackShadow->setBlurRadius(10.0);
blackShadow->setColor(Qt::black);
blackShadow->setOffset(0.0);
QGraphicsDropShadowEffect *whiteShadow = new QGraphicsDropShadowEffect(this);
whiteShadow->setBlurRadius(10.0);
whiteShadow->setColor(Qt::black);
whiteShadow->setOffset(0.0);
ui->blackLabel->setGraphicsEffect(blackShadow);
ui->whiteLabel->setGraphicsEffect(whiteShadow);
ui->whiteTypeGroup->setId(ui->whiteHuman, GameStartInformation::Human);
ui->whiteTypeGroup->setId(ui->whiteAI, GameStartInformation::AI);
......
......@@ -16,7 +16,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<widget class="QLabel" name="blackLabel">
<property name="text">
<string>Black</string>
</property>
......@@ -142,7 +142,7 @@
<item>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_3">
<widget class="QLabel" name="whiteLabel">
<property name="text">
<string>White</string>
</property>
......
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