2
SPDX-FileCopyrightText: 2005-2006 Albert Astals Cid <aacid@kde.org>
4
SPDX-License-Identifier: GPL-2.0-or-later
10
#include <KSharedConfig>
11
#include <KConfigGroup>
13
#include <QKeySequence>
15
button::button(blinkenGame::color c) : m_selected(false), m_color(c)
17
KConfigGroup kc(KSharedConfig::openConfig(), "General");
18
QString cs = getColorString();
22
case blinkenGame::blue:
23
m_key = kc.readEntry(cs, int(Qt::Key_3));
26
case blinkenGame::yellow:
27
m_key = kc.readEntry(cs, int(Qt::Key_1));
30
case blinkenGame::red:
31
m_key =kc.readEntry(cs, int(Qt::Key_2));
34
case blinkenGame::green:
35
m_key = kc.readEntry(cs, int(Qt::Key_4));
48
void button::setShortcut(int key)
53
KConfigGroup kc(KSharedConfig::openConfig(), "General");
54
kc.writeEntry(getColorString(), key);
58
QString button::shortcut() const
60
return QKeySequence(m_key).toString();
63
int button::key() const
68
void button::setSelected(bool b)
73
bool button::selected() const
78
QString button::getColorString() const
82
case blinkenGame::blue:
83
return QStringLiteral("blue");
85
case blinkenGame::yellow:
86
return QStringLiteral("yellow");
88
case blinkenGame::red:
89
return QStringLiteral("red");
91
case blinkenGame::green:
92
return QStringLiteral("green");