mirror of
https://github.com/QuasarApp/Snake.git
synced 2025-04-28 10:44:42 +00:00
added cocept of new user inteface
This commit is contained in:
parent
de37400589
commit
5f6cbbd6d8
@ -8,3 +8,11 @@ MainMenuModel::MainMenuModel(QObject *ptr): QObject (ptr) {
|
||||
QObject *MainMenuModel::userViewModel() const {
|
||||
return _userViewModel;
|
||||
}
|
||||
|
||||
bool MainMenuModel::online() const {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool MainMenuModel::login() const {
|
||||
return false;
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ class MainMenuModel : public QObject
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QObject* userViewModel READ userViewModel NOTIFY userViewModelChanged)
|
||||
Q_PROPERTY(bool online READ online NOTIFY onlinelChanged)
|
||||
Q_PROPERTY(bool login READ login NOTIFY loginChanged)
|
||||
|
||||
UserView* _userViewModel = nullptr;
|
||||
|
||||
@ -17,10 +19,16 @@ public:
|
||||
MainMenuModel(QObject *ptr = nullptr);
|
||||
|
||||
QObject* userViewModel() const;
|
||||
bool online() const;
|
||||
|
||||
bool login() const;
|
||||
|
||||
signals:
|
||||
void userViewModelChanged(QObject* userViewModel);
|
||||
void newGame();
|
||||
|
||||
void onlinelChanged(bool online);
|
||||
void loginChanged(bool login);
|
||||
};
|
||||
|
||||
#endif // NETWORKPROFILEMAINMODEL_H
|
||||
|
17
SnakeClient/SnakeApp/front-end/FrameView.qml
Normal file
17
SnakeClient/SnakeApp/front-end/FrameView.qml
Normal file
@ -0,0 +1,17 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtGraphicalEffects 1.12
|
||||
|
||||
Frame {
|
||||
id: frameVew
|
||||
width: 5 * metrix.pt
|
||||
background: Rectangle {
|
||||
color: (Material.theme == Material.Dark)? "#50000000": "#50ffffff"
|
||||
border.color: "#5e5d5d"
|
||||
radius: metrix.mm
|
||||
}
|
||||
|
||||
padding: 3 * metrix.mm
|
||||
}
|
124
SnakeClient/SnakeApp/front-end/LoginView.qml
Normal file
124
SnakeClient/SnakeApp/front-end/LoginView.qml
Normal file
@ -0,0 +1,124 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtGraphicalEffects 1.12
|
||||
|
||||
Item {
|
||||
id: element
|
||||
SwipeView {
|
||||
id: swipeView
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.top: tabBar.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
|
||||
clip: true
|
||||
|
||||
currentIndex: tabBar.currentIndex
|
||||
|
||||
Item {
|
||||
id: loginPage
|
||||
|
||||
ColumnLayout {
|
||||
id: columnLayout
|
||||
anchors.fill: parent
|
||||
|
||||
TextField {
|
||||
placeholderText: "Write Your Email"
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
}
|
||||
|
||||
TextField {
|
||||
placeholderText: qsTr("Write Your passsword")
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
|
||||
echoMode: TextInput.Password
|
||||
cursorVisible: true
|
||||
Layout.fillWidth: true
|
||||
|
||||
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("sign in")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
id: rigisterPage
|
||||
ColumnLayout {
|
||||
|
||||
anchors.fill: parent
|
||||
|
||||
|
||||
TextField {
|
||||
placeholderText: "Write Your Email"
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
}
|
||||
|
||||
TextField {
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
|
||||
placeholderText: qsTr("Write Your Name")
|
||||
echoMode: TextInput.NoEcho
|
||||
cursorVisible: true
|
||||
|
||||
}
|
||||
|
||||
TextField {
|
||||
placeholderText: qsTr("Write Your passsword")
|
||||
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
Layout.fillWidth: true
|
||||
echoMode: TextInput.Password
|
||||
cursorVisible: true
|
||||
}
|
||||
|
||||
Button {
|
||||
text: qsTr("sign Up")
|
||||
Layout.alignment: Qt.AlignRight | Qt.AlignVCenter
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TabBar {
|
||||
id: tabBar
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0
|
||||
anchors.left: parent.left
|
||||
anchors.leftMargin: 0
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
|
||||
TabButton {
|
||||
id: login
|
||||
text: qsTr("Sign in")
|
||||
checkable: false
|
||||
}
|
||||
|
||||
TabButton {
|
||||
id: register
|
||||
text: qsTr("Sign Up")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
/*##^## Designer {
|
||||
D{i:0;autoSize:true;height:480;width:640}D{i:3;anchors_height:100;anchors_width:100;anchors_x:228;anchors_y:63}
|
||||
D{i:1;anchors_height:200;anchors_width:200;anchors_x:205;anchors_y:53}D{i:11;anchors_width:240;anchors_x:226;anchors_y:21}
|
||||
}
|
||||
##^##*/
|
@ -6,11 +6,20 @@ import QtQuick.Layouts 1.3
|
||||
Item {
|
||||
id: item1
|
||||
property var model: null
|
||||
property bool online: (model)? model.online: false
|
||||
property bool login: (model)? model.login: false
|
||||
|
||||
visible: true
|
||||
z: 1
|
||||
|
||||
signal playGame();
|
||||
|
||||
onLoginChanged: {
|
||||
if (!login) {
|
||||
loginPopUp._show();
|
||||
}
|
||||
}
|
||||
|
||||
UserView {
|
||||
id: userView
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
@ -22,29 +31,28 @@ Item {
|
||||
model: (item1.model)? item1.model.userViewModel: null
|
||||
}
|
||||
|
||||
ColumnLayout {
|
||||
GridLayout {
|
||||
id: columnLayout
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 0
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.bottomMargin: 0
|
||||
anchors.left: userView.right
|
||||
anchors.leftMargin: 0
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 0
|
||||
transformOrigin: Item.Center
|
||||
spacing: -100
|
||||
|
||||
Button {
|
||||
anchors.leftMargin: 0
|
||||
anchors.rightMargin: 0
|
||||
anchors.bottomMargin: 0
|
||||
anchors.topMargin: 0
|
||||
|
||||
columns: 3
|
||||
rows: 2
|
||||
|
||||
|
||||
transformOrigin: Item.Center
|
||||
|
||||
|
||||
MainMenuButton {
|
||||
id: play
|
||||
text: qsTr("Play game")
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
font.pixelSize: 20
|
||||
spacing: 4
|
||||
focusPolicy: Qt.StrongFocus
|
||||
display: AbstractButton.TextBesideIcon
|
||||
Layout.preferredHeight: item1.height / 5
|
||||
Layout.preferredWidth: item1.height * 0.8
|
||||
|
||||
onClicked: {
|
||||
playGame();
|
||||
@ -54,27 +62,32 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
Button {
|
||||
id: level
|
||||
text: qsTr("My Status")
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
font.pixelSize: 20
|
||||
Layout.preferredHeight: item1.height / 5
|
||||
Layout.preferredWidth: item1.height * 0.8
|
||||
spacing: 2
|
||||
MainMenuButton {
|
||||
id: store
|
||||
text: qsTr("Store")
|
||||
|
||||
onClicked: {
|
||||
userView._show();
|
||||
}
|
||||
}
|
||||
|
||||
Button {
|
||||
MainMenuButton {
|
||||
id: invitar
|
||||
text: qsTr("My Items")
|
||||
}
|
||||
|
||||
MainMenuButton {
|
||||
id: freands
|
||||
text: qsTr("My friends")
|
||||
|
||||
}
|
||||
|
||||
MainMenuButton {
|
||||
id: settings
|
||||
text: qsTr("My Settings")
|
||||
|
||||
}
|
||||
|
||||
MainMenuButton {
|
||||
id: exit
|
||||
text: qsTr("Exit")
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
font.pixelSize: 20
|
||||
Layout.preferredHeight: item1.height / 5
|
||||
Layout.preferredWidth: item1.height * 0.8
|
||||
|
||||
onClicked: {
|
||||
Qt.quit();
|
||||
@ -83,23 +96,6 @@ Item {
|
||||
|
||||
}
|
||||
|
||||
RoundButton {
|
||||
id: roundButton
|
||||
x: 569
|
||||
y: 20
|
||||
height: 48
|
||||
clip: false
|
||||
anchors.right: parent.right
|
||||
anchors.rightMargin: 23
|
||||
anchors.top: parent.top
|
||||
anchors.topMargin: 20
|
||||
|
||||
onClicked: {
|
||||
about._show();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PagePopUp {
|
||||
id: about;
|
||||
width: parent.width / 2
|
||||
@ -112,6 +108,20 @@ Item {
|
||||
|
||||
|
||||
|
||||
PagePopUp {
|
||||
id: loginPopUp
|
||||
source: LoginView {
|
||||
|
||||
}
|
||||
|
||||
visible: true;
|
||||
|
||||
width: parent.width / 2
|
||||
height: parent.height / 2;
|
||||
x: parent.width / 2 - width / 2
|
||||
y: parent.height / 2 - height / 2
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
20
SnakeClient/SnakeApp/front-end/MainMenuButton.qml
Normal file
20
SnakeClient/SnakeApp/front-end/MainMenuButton.qml
Normal file
@ -0,0 +1,20 @@
|
||||
import QtQuick 2.12
|
||||
import QtQuick.Controls.Material 2.12
|
||||
import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.3
|
||||
|
||||
Button {
|
||||
id: exit
|
||||
Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
|
||||
font.pixelSize: height * 0.1
|
||||
display: AbstractButton.TextBesideIcon
|
||||
spacing: 4
|
||||
focusPolicy: Qt.StrongFocus
|
||||
|
||||
Layout.preferredHeight: parent.height / (parent.rows + 1)
|
||||
Layout.preferredWidth: parent.width / (parent.columns + 1)
|
||||
|
||||
onClicked: {
|
||||
Qt.quit();
|
||||
}
|
||||
}
|
@ -15,7 +15,7 @@ Item {
|
||||
property string valueImage: "";
|
||||
property string valueText: "";
|
||||
|
||||
property int lineWidth : 1
|
||||
property int lineWidth : 0.5 * metrix.mm
|
||||
|
||||
property bool hovered: false
|
||||
property bool hold: false
|
||||
@ -27,7 +27,7 @@ Item {
|
||||
|
||||
Rectangle {
|
||||
height: lineWidth
|
||||
color: (hold)? Material.foreground: (hovered)? Material.foreground:"#aaa"
|
||||
color: (hold)? Material.accent: (hovered)? Material.foreground:"#aaa"
|
||||
anchors.bottom: parent.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.right: parent.right
|
||||
@ -35,7 +35,7 @@ Item {
|
||||
Behavior on color {
|
||||
|
||||
ColorAnimation {
|
||||
duration: 200
|
||||
duration: 100
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,20 +4,10 @@ import QtQuick.Controls 2.12
|
||||
import QtQuick.Layouts 1.3
|
||||
import QtGraphicalEffects 1.12
|
||||
|
||||
Frame {
|
||||
FrameView {
|
||||
id: userVew
|
||||
|
||||
property var model: null
|
||||
property int sourceId: 0
|
||||
width: 5 * metrix.pt
|
||||
background: Rectangle {
|
||||
color: "#50ffffff"
|
||||
border.color: "#5e5d5d"
|
||||
radius: 4
|
||||
}
|
||||
|
||||
padding: 10
|
||||
|
||||
|
||||
ColumnLayout {
|
||||
id: columnLayout
|
||||
|
@ -16,6 +16,9 @@
|
||||
<file>front-end/ImageView.qml</file>
|
||||
<file>front-end/PropertyView.qml</file>
|
||||
<file>front-end/Metrix.qml</file>
|
||||
<file>front-end/LoginView.qml</file>
|
||||
<file>front-end/FrameView.qml</file>
|
||||
<file>front-end/MainMenuButton.qml</file>
|
||||
</qresource>
|
||||
<qresource prefix="/texture">
|
||||
<file alias="up">img/up.svg</file>
|
||||
|
@ -2,8 +2,6 @@
|
||||
Style=Material
|
||||
|
||||
[Material]
|
||||
#Accent=#5840FF
|
||||
#Foreground=#142ECC
|
||||
#Primary=#FFF600
|
||||
Background=#eeeeee
|
||||
Theme=Light
|
||||
Accent=Teal
|
||||
Primary=BlueGrey
|
||||
Theme=Dark
|
||||
|
Loading…
x
Reference in New Issue
Block a user