Commit f348c1e4 authored by Jeremy Whiting's avatar Jeremy Whiting
Browse files

Use theme letter color for labels on gui.

Before the KHangMan gui was changed to qml the themes used a letter
color and other colors to help keep contrast between the background
and the letters.
Expose KHangManTheme letter colors through KHangMan object as letterColor
property.
Use letterColor property for the labels in the gui that don't already
have a color tied to the meaning like wins does.
parent 37f546da
......@@ -383,6 +383,20 @@ QString KHangMan::backgroundUrl()
return QString();
}
QColor KHangMan::currentThemeLetterColor()
{
// Default to white letters
QColor color = "white";
QStringList themes = m_themeFactory.getNames();
int index = themes.indexOf(Prefs::theme());
KHMTheme *theme = m_themeFactory.buildTheme(index);
if (theme) {
color = theme->letterColor();
}
return color;
}
QStringList KHangMan::categories()
{
return m_titleLevels.keys();
......
......@@ -54,6 +54,7 @@ class KHangMan : public QMainWindow
Q_PROPERTY( int currentTheme READ currentTheme WRITE setCurrentTheme NOTIFY currentThemeChanged )
Q_PROPERTY( QStringList themes READ themes NOTIFY themesChanged)
Q_PROPERTY( QString backgroundUrl READ backgroundUrl NOTIFY currentThemeChanged)
Q_PROPERTY( QColor letterColor READ currentThemeLetterColor NOTIFY currentThemeChanged)
Q_PROPERTY( QStringList currentWord READ currentWord NOTIFY currentWordChanged)
Q_PROPERTY( QString currentHint READ getCurrentHint NOTIFY currentHintChanged)
......@@ -102,6 +103,7 @@ public:
int currentTheme();
QStringList themes();
QString backgroundUrl();
QColor currentThemeLetterColor();
//Display the mainwindow only when kvtml files are present, else show an error message and quit.
void show();
......
......@@ -350,6 +350,7 @@ Item {
text: i18n("Remaining guesses: ")
font.pixelSize: 40
font.bold: true
color: khangman.letterColor
}
Text {
......@@ -374,6 +375,7 @@ Item {
text: i18n("Score: ")
font.pixelSize: 40
font.bold: true
color: khangman.letterColor
}
Label {
......@@ -407,6 +409,7 @@ Item {
text: i18n("Wins: ")
font.pixelSize: 40
font.bold: true
color: khangman.letterColor
}
Label {
......@@ -414,6 +417,7 @@ Item {
text: khangman.winCount
font.pixelSize: 40
font.bold: true
color: khangman.letterColor
}
}
......@@ -433,6 +437,7 @@ Item {
text: i18n("Losses: ")
font.pixelSize: 40
font.bold: true
color: khangman.letterColor
}
Label {
......@@ -440,6 +445,7 @@ Item {
text: khangman.lossCount
font.pixelSize: 40
font.bold: true
color: khangman.letterColor
}
}
......@@ -538,7 +544,7 @@ Item {
color: parent.enabled ? "white" : "grey"
}
}
onClicked: {
guessLetter(modelData);
}
......
......@@ -31,7 +31,7 @@ Rectangle {
Text {
id: letterId;
text: letterText;
color: "black";
color: khangman.letterColor;
font {
pixelSize: letterPixelSize;
bold: true;
......
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