Commit 2bd976ec authored by Andreas Cord-Landwehr's avatar Andreas Cord-Landwehr Committed by Jeremy Whiting
Browse files

Make UI usable in small solution landscape

Allows usage of the app in landscape view in Plasma mobile setup
on RaspberryPi 10-inch landscape discplay. Also do initial fixes
for portrait mode on 7-inch.

(cherry picked from commit d1fba2c3)
parent b82de831
......@@ -83,7 +83,7 @@ int main(int argc, char **argv)
KCrash::initialize();
MainWindow mainWindow;
QSize size(800, 600);
QSize size(400, 300);
mainWindow.setMinimumSize(size);
mainWindow.show();
......
......@@ -60,218 +60,214 @@ Rectangle {
}
}
Rectangle {
Item {
id: categoryBar
width: parent.width
height: parent.height / 5
opacity: .25
color: "black"
anchors.top: parent.top
}
Text {
id: categoryName
anchors {
verticalCenter: categoryBar.verticalCenter
horizontalCenter: categoryBar.horizontalCenter
}
color: "white"
text: kanagramGame.title
font.pixelSize: parent.width / 19.5
}
Action {
id: nextVocabularyAction
shortcut: "PgDown"
onTriggered: {
kanagramGame.nextVocabulary();
nextAnagram();
}
tooltip: i18n("Next Vocabulary")
}
ToolButton {
height: categoryBar.height
width: categoryBar.height
id: nextVocabularyButton
anchors {
verticalCenter: categoryBar.verticalCenter
right: categoryBar.right
rightMargin: parent.width / 20
}
action: nextVocabularyAction
Image {
source: "icons/right-arrow.png"
width: parent.width
height: Math.min(parent.height / 5, 4 * categoryName.height)
Rectangle {
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
opacity: .25
color: "black"
}
}
Action {
id: previousVocabularyAction
shortcut: "PgUp"
onTriggered: {
kanagramGame.previousVocabulary();
nextAnagram();
ToolButton {
height: categoryBar.height
width: categoryBar.height
id: nextVocabularyButton
anchors {
verticalCenter: categoryBar.verticalCenter
right: categoryBar.right
rightMargin: parent.width / 20
}
action: Action {
shortcut: "PgDown"
onTriggered: {
kanagramGame.nextVocabulary();
nextAnagram();
}
tooltip: i18n("Next Vocabulary")
}
Image {
source: "icons/right-arrow.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
}
}
tooltip: i18n("Previous Vocabulary")
}
ToolButton {
id: previousVocabularyButton
height: categoryBar.height
width: categoryBar.height
anchors {
verticalCenter: categoryBar.verticalCenter
left: categoryBar.left
leftMargin: parent.width / 20
}
action: previousVocabularyAction
Image {
source: "icons/left-arrow.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
Text {
id: categoryName
anchors {
verticalCenter: categoryBar.verticalCenter
horizontalCenter: categoryBar.horizontalCenter
}
color: "white"
text: kanagramGame.title
font.pixelSize: Math.min(parent.width / 19.5, 32)
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
ToolButton {
id: previousVocabularyButton
height: categoryBar.height
width: categoryBar.height
anchors {
verticalCenter: categoryBar.verticalCenter
left: categoryBar.left
leftMargin: parent.width / 20
}
action: Action {
shortcut: "PgUp"
onTriggered: {
kanagramGame.previousVocabulary();
nextAnagram();
}
tooltip: i18n("Previous Vocabulary")
}
Image {
source: "icons/left-arrow.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
}
}
}
Rectangle {
Item {
id: optionsBar
width: parent.width
height: parent.height / 5
opacity: .25
color: "black"
height: categoryBar.height
anchors.bottom: parent.bottom
}
Action {
id: scoreAction
shortcut: "Ctrl+S"
onTriggered: {
if (!scoreButton.flagToggleTimer) {
scoreButton.countDownTimerValue = kanagramGame.scoreTime();
scoreTimer.repeat = true;
scoreTimer.start();
kanagramGame.resetTotalScore();
scoreSection.opacity = 0.35;
score.opacity = 1;
} else {
scoreButton.countDownTimerValue = 1
}
scoreButton.flagToggleTimer = !scoreButton.flagToggleTimer;
}
tooltip: i18n("Start Timer");
}
ToolButton {
id: scoreButton
height: optionsBar.height
width: optionsBar.height
anchors {
verticalCenter: optionsBar.verticalCenter
left: optionsBar.left
}
property int countDownTimerValue: 0
property bool flagToggleTimer: false
action: scoreAction
Image {
source: "icons/timer.png"
Rectangle {
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
opacity: .25
color: "black"
}
}
Action {
id: hintAction
shortcut: "Ctrl+H"
onTriggered: {
hintButton.countDownTimerValue = kanagramGame.hintHideTime()
hintTimer.repeat = true
hintTimer.start()
ToolButton {
id: scoreButton
height: optionsBar.height
width: optionsBar.height
anchors {
verticalCenter: optionsBar.verticalCenter
left: optionsBar.left
}
property int countDownTimerValue: 0
property bool flagToggleTimer: false
action: Action {
id: scoreAction
shortcut: "Ctrl+S"
onTriggered: {
if (!scoreButton.flagToggleTimer) {
scoreButton.countDownTimerValue = kanagramGame.scoreTime();
scoreTimer.repeat = true;
scoreTimer.start();
kanagramGame.resetTotalScore();
scoreSection.opacity = 0.35;
score.opacity = 1;
} else {
scoreButton.countDownTimerValue = 1
}
scoreButton.flagToggleTimer = !scoreButton.flagToggleTimer;
}
tooltip: i18n("Start Timer");
}
Image {
source: "icons/timer.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
}
}
tooltip: i18n("Show Hint")
}
ToolButton {
id: hintButton
action: hintAction
width: optionsBar.height
height: optionsBar.height
property int countDownTimerValue: 0
anchors {
verticalCenter: optionsBar.verticalCenter
horizontalCenter: optionsBar.horizontalCenter
}
Image {
source: "icons/hint.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
ToolButton {
id: hintButton
action: Action {
id: hintAction
shortcut: "Ctrl+H"
onTriggered: {
hintButton.countDownTimerValue = kanagramGame.hintHideTime()
hintTimer.repeat = true
hintTimer.start()
}
tooltip: i18n("Show Hint")
}
width: optionsBar.height
height: optionsBar.height
property int countDownTimerValue: 0
anchors {
verticalCenter: optionsBar.verticalCenter
horizontalCenter: optionsBar.horizontalCenter
}
Image {
source: "icons/hint.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
}
}
}
Action {
id: revealAction
shortcut: "Ctrl+R"
onTriggered: {
kanagramGame.revealWord();
if (blackboard.activeTimer) {
kanagramGame.answerRevealed();
Action {
id: revealAction
shortcut: "Ctrl+R"
onTriggered: {
kanagramGame.revealWord();
if (blackboard.activeTimer) {
kanagramGame.answerRevealed();
}
revealButton.countDownTimerValue = 2
showAnswerTimer.repeat = true
showAnswerTimer.start()
}
revealButton.countDownTimerValue = 2
showAnswerTimer.repeat = true
showAnswerTimer.start()
tooltip: i18n("Reveal Word")
}
tooltip: i18n("Reveal Word")
}
ToolButton {
id: revealButton
action: revealAction
width: optionsBar.height
height: optionsBar.height
anchors {
verticalCenter: optionsBar.verticalCenter
right: optionsBar.right
}
property int countDownTimerValue: 0
Image {
source: "icons/reveal.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
ToolButton {
id: revealButton
action: revealAction
width: optionsBar.height
height: optionsBar.height
anchors {
verticalCenter: optionsBar.verticalCenter
right: optionsBar.right
}
property int countDownTimerValue: 0
Image {
source: "icons/reveal.png"
anchors.fill: parent
anchors.margins: 4
fillMode: Image.PreserveAspectFit
}
style: ButtonStyle {
background: Rectangle { color: "transparent" }
}
}
}
Rectangle {
id: timerSection
width: blackboard.width / 9
height: blackboard.height / 7
anchors {
top: blackboard.top
topMargin: blackboard.height / 7
right: blackboard.left
rightMargin: blackboard.width / 68.5
Rectangle {
id: timerSection
width: blackboard.width / 9
height: blackboard.height / 7
anchors {
top: blackboard.top
topMargin: blackboard.height / 7
right: blackboard.left
rightMargin: blackboard.width / 68.5
}
color: "black"
opacity: 0
}
color: "black"
opacity: 0
}
Text {
......
src/ui/images/header.png

37.4 KB | W: | H:

src/ui/images/header.png

40.5 KB | W: | H:

src/ui/images/header.png
src/ui/images/header.png
src/ui/images/header.png
src/ui/images/header.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -23,7 +23,6 @@ import QtQuick.Controls 1.2
import QtMultimedia 5.0
Rectangle {
id: screen
focus: true
property int countDownTimerValue: 0
......@@ -79,7 +78,7 @@ Rectangle {
Item {
id: headerArea
width: parent.width;
width: parent.width
height: parent.height / 6
anchors.top: screen.top
......@@ -92,15 +91,15 @@ Rectangle {
Image {
id: header
width: parent.width / 3.5
height: parent.height / 1.5
height: Math.round(parent.height * 0.8)
width: headerArea.width - playericon.width - powerButton.width - 80
anchors {
verticalCenter: parent.verticalCenter
horizontalCenter: parent.horizontalCenter
}
source: "images/header.png"
smooth: true
fillMode: Image.PreserveAspectCrop
fillMode: Image.PreserveAspectFit
}
Image {
......@@ -108,7 +107,7 @@ Rectangle {
width: 60
height: 60
anchors.left:parent.left
anchors.leftMargin:20
anchors.leftMargin: 20
anchors.verticalCenter: parent.verticalCenter
source: kanagramGame.singlePlayer ? "icons/1player.png" : "icons/2player.png"
smooth: true
......
Supports Markdown
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