Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Qt Quick Controls 2 & Qt Labs Platform #1984

Merged
merged 6 commits into from
Nov 25, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
build/
bin/
lib/
qml/
Makefile*
*.o
*.qm
Expand Down Expand Up @@ -31,6 +30,9 @@ moc_predefs.h
.qmake.stash
translations/phony_target.app

# Mac stuff
*.DS_Store

# IDE files
*.pro.user*
*.qbs.user*
Expand Down
12 changes: 12 additions & 0 deletions src/tiledquick/fonts/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Font license info


## Font Awesome

Copyright (C) 2016 by Dave Gandy

Author: Dave Gandy
License: SIL ()
Homepage: http://fortawesome.github.com/Font-Awesome/


6 changes: 6 additions & 0 deletions src/tiledquick/fonts/README.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
This webfont is generated by http://fontello.com open source project.


To recreate fontawesome.ttf, drag and drop fontello-config.json onto the home page of fontello.com. For more information, read this:

https://github.com/fontello/fontello/wiki/How-to-save-and-load-projects#simple-import
Binary file added src/tiledquick/fonts/fontawesome.ttf
Binary file not shown.
22 changes: 22 additions & 0 deletions src/tiledquick/fonts/fontello-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "fontawesome",
"css_prefix_text": "icon-",
"css_use_suffix": false,
"hinting": true,
"units_per_em": 1000,
"ascent": 850,
"glyphs": [
{
"uid": "c95735c17a10af81448c7fed98a04546",
"css": "folder-open",
"code": 59392,
"src": "fontawesome"
},
{
"uid": "f4445feb55521283572ee88bc304f928",
"css": "floppy",
"code": 59393,
"src": "fontawesome"
}
]
}
5 changes: 5 additions & 0 deletions src/tiledquick/fonts/fonts.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<RCC>
<qresource prefix="/fonts">
<file>fontawesome.ttf</file>
</qresource>
</RCC>
20 changes: 0 additions & 20 deletions src/tiledquick/main-android.cpp

This file was deleted.

File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions src/tiledquick/qml/FontAwesome.qml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
pragma Singleton
import QtQml 2.3

QtObject {
readonly property string open: "\uE800"
readonly property string save: "\uE801"
}
47 changes: 28 additions & 19 deletions src/tiledquick/main.qml → src/tiledquick/qml/main.qml
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
import QtQuick 2.4
import QtQuick.Controls 1.3
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.1
import QtQuick 2.10
import QtQuick.Controls 2.3
import QtQuick.Layouts 1.3
import org.mapeditor.Tiled 1.0 as Tiled
import Qt.labs.settings 1.0
import Qt.labs.platform 1.0 as Platform

// For access to FontAwesome Singleton
import "."

ApplicationWindow {
id: window

visible: true

width: 1024
height: 720

minimumWidth: 480
minimumHeight: 320

title: qsTr("Tiled Quick")
visible: true

FontLoader {
source: "fonts/fontawesome.ttf"
}

FileDialog {
Platform.FileDialog {
id: fileDialog
nameFilters: [ "TMX files (*.tmx)", "All files (*)" ]
onAccepted: {
mapLoader.source = fileDialog.fileUrl
mapLoader.source = fileDialog.file
settings.mapsFolder = fileDialog.folder
}
}

MessageDialog {
Platform.MessageDialog {
id: aboutBox
title: "About Tiled Quick"
text: "This is an experimental Qt Quick version of Tiled,\na generic 2D map editor"
icon: StandardIcon.Information
}

Settings {
Expand All @@ -49,29 +51,34 @@ ApplicationWindow {
id: openAction
text: qsTr("Open...")
shortcut: StandardKey.Open
iconName: "document-open"
onTriggered: {
fileDialog.folder = settings.mapsFolder
fileDialog.open()
}
}

Action {
id: exitAction
text: qsTr("Exit")
shortcut: StandardKey.Quit
onTriggered: Qt.quit()
}

menuBar: MenuBar {
Menu {
title: qsTr("File")
MenuItem {
action: openAction
text: qsTr("Open...")
shortcut: StandardKey.Open
onTriggered: {
fileDialog.open()
}
}
MenuSeparator {}
MenuItem {
text: qsTr("Exit")
shortcut: StandardKey.Quit
onTriggered: Qt.quit();
action: exitAction
onTriggered: Qt.quit()
}
}
Menu {
Expand All @@ -83,11 +90,13 @@ ApplicationWindow {
}
}

toolBar: ToolBar {
header: ToolBar {
RowLayout {
anchors.fill: parent
ToolButton {
action: openAction
font.family: "FontAwesome"
text: FontAwesome.open
}
}
}
Expand Down Expand Up @@ -164,7 +173,7 @@ ApplicationWindow {
}
}

statusBar: StatusBar {
footer: Pane {
RowLayout {
Label {
text: {
Expand Down
5 changes: 4 additions & 1 deletion src/tiledquick/qml.qrc → src/tiledquick/qml/qml.qrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
<RCC>
<qresource prefix="/">
<file>DragArea.qml</file>
<file>main.qml</file>
<file>qtquickcontrols2.conf</file>
<file>DragArea.qml</file>
<file>FontAwesome.qml</file>
<file>qmldir</file>
</qresource>
</RCC>
1 change: 1 addition & 0 deletions src/tiledquick/qml/qmldir
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
singleton FontAwesome 1.0 FontAwesome.qml
2 changes: 2 additions & 0 deletions src/tiledquick/qml/qtquickcontrols2.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[Controls]
Style=Material
15 changes: 0 additions & 15 deletions src/tiledquick/tiledquick-android.pro

This file was deleted.

5 changes: 0 additions & 5 deletions src/tiledquick/tiledquick-android.qrc

This file was deleted.

3 changes: 2 additions & 1 deletion src/tiledquick/tiledquick.pro
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ macx {

SOURCES += main.cpp
RESOURCES += \
qml.qrc
qml/qml.qrc \
fonts/fonts.qrc

# Additional import path used to resolve QML modules in Qt Creator's code model
QML_IMPORT_PATH =
Expand Down
4 changes: 3 additions & 1 deletion src/tiledquick/tiledquick.qbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ QtGuiApplication {
cpp.cxxLanguageVersion: "c++11"

files: [
"fonts/fonts.qrc",
"main.cpp",
"qml.qrc",
"qml/qml.qrc",
"qml/qtquickcontrols2.conf",
]

Properties {
Expand Down