From f3341bef3fe91d314be63e408a1c424ac1823a9e Mon Sep 17 00:00:00 2001 From: yann300 Date: Fri, 6 Feb 2015 18:23:24 +0100 Subject: [PATCH] - add 'add css files' - ui improvements --- mix/qml/FilesSection.qml | 10 +++------- mix/qml/ProjectList.qml | 7 ++++--- mix/qml/ProjectModel.qml | 1 + mix/qml/Style.qml | 2 +- mix/qml/js/ProjectModel.js | 7 ++++++- mix/qml/main.qml | 9 +++++++++ 6 files changed, 24 insertions(+), 12 deletions(-) diff --git a/mix/qml/FilesSection.qml b/mix/qml/FilesSection.qml index 7c31e2db0..d532fb2b1 100644 --- a/mix/qml/FilesSection.qml +++ b/mix/qml/FilesSection.qml @@ -48,12 +48,6 @@ ColumnLayout { model.remove(i); } - FontLoader - { - id: sectionTitleFont - source: "qrc:/qml/fonts/SourceSansPro-Bold.ttf" - } - FontLoader { id: fileNameFont @@ -85,8 +79,10 @@ ColumnLayout { anchors.left: parent.left anchors.leftMargin: Style.general.leftMargin color: Style.documentsList.sectionColor - font.family: sectionTitleFont.name + font.family: fileNameFont.name font.pointSize: Style.documentsList.fontSize + font.weight: Font.Bold + font.letterSpacing: 1 states: [ State { name: "hidden" diff --git a/mix/qml/ProjectList.qml b/mix/qml/ProjectList.qml index e19326e44..61b83ac14 100644 --- a/mix/qml/ProjectList.qml +++ b/mix/qml/ProjectList.qml @@ -15,7 +15,7 @@ Item { FontLoader { id: srcSansProLight - source: "qrc:/qml/fonts/SourceSansPro-ExtraLight.ttf" + source: "qrc:/qml/fonts/SourceSansPro-Regular.ttf" } Rectangle @@ -42,7 +42,8 @@ Item { anchors.left: parent.left anchors.leftMargin: Style.general.leftMargin font.family: srcSansProLight.name - font.pointSize: Style.title.pointSize + font.pointSize: Style.title.pointSize + 3 + font.weight: Font.Light } Text @@ -78,7 +79,7 @@ Item { spacing: 0 Repeater { - model: ["Contracts", "Javascript", "HTML", "Styles", "Images"] + model: ["Contracts", "Javascript", "HTML", "Styles", "Images", "Misc"] signal selected(string doc, string groupName) id: sectionRepeater FilesSection diff --git a/mix/qml/ProjectModel.qml b/mix/qml/ProjectModel.qml index 49e63e184..42bf91d9d 100644 --- a/mix/qml/ProjectModel.qml +++ b/mix/qml/ProjectModel.qml @@ -41,6 +41,7 @@ Item { function addExistingFile() { ProjectModelCode.addExistingFile(); } function newHtmlFile() { ProjectModelCode.newHtmlFile(); } function newJsFile() { ProjectModelCode.newJsFile(); } + function newCssFile() { ProjectModelCode.newCssFile(); } //function newContract() { ProjectModelCode.newContract(); } function openDocument(documentId) { ProjectModelCode.openDocument(documentId); } function openNextDocument() { ProjectModelCode.openNextDocument(); } diff --git a/mix/qml/Style.qml b/mix/qml/Style.qml index 22ae87a6f..91745749f 100644 --- a/mix/qml/Style.qml +++ b/mix/qml/Style.qml @@ -13,7 +13,7 @@ QtObject { property string color: "#808080" property string background: "#f0f0f0" property int height: 70 - property int pointSize: 15 + property int pointSize: 18 } property QtObject documentsList: QtObject { diff --git a/mix/qml/js/ProjectModel.js b/mix/qml/js/ProjectModel.js index 09daeb79b..19a56432e 100644 --- a/mix/qml/js/ProjectModel.js +++ b/mix/qml/js/ProjectModel.js @@ -88,8 +88,9 @@ function addFile(fileName) { var isHtml = extension === ".html"; var isCss = extension === ".css"; var isJs = extension === ".js"; + var isImg = extension === ".png" || extension === ".gif" || extension === ".jpg" || extension === ".svg"; var syntaxMode = isContract ? "solidity" : isJs ? "javascript" : isHtml ? "htmlmixed" : isCss ? "css" : ""; - var groupName = isContract ? "Contracts" : isJs ? "Javascript" : isHtml ? "HTML" : isCss ? "Styles" : ""; + var groupName = isContract ? "Contracts" : isJs ? "Javascript" : isHtml ? "HTML" : isCss ? "Styles" : isImg ? "Images" : "Misc"; var docData = { contract: false, path: p, @@ -227,6 +228,10 @@ function newHtmlFile() { createAndAddFile("page", "html", "\n"); } +function newCssFile() { + createAndAddFile("style", "css", "body {\n}\n"); +} + function newJsFile() { createAndAddFile("script", "js", "function foo() {\n}\n"); } diff --git a/mix/qml/main.qml b/mix/qml/main.qml index 41b7c50a4..24bd73e6d 100644 --- a/mix/qml/main.qml +++ b/mix/qml/main.qml @@ -28,6 +28,7 @@ ApplicationWindow { MenuItem { action: addExistingFileAction } MenuItem { action: addNewJsFileAction } MenuItem { action: addNewHtmlFileAction } + MenuItem { action: addNewCssFileAction } MenuSeparator {} //MenuItem { action: addNewContractAction } MenuItem { action: closeProjectAction } @@ -188,6 +189,14 @@ ApplicationWindow { onTriggered: projectModel.newHtmlFile(); } + Action { + id: addNewCssFileAction + text: qsTr("New CSS File") + shortcut: "Ctrl+Alt+S" + enabled: !projectModel.isEmpty + onTriggered: projectModel.newCssFile(); + } + Action { id: addNewContractAction text: qsTr("New Contract")