Browse Source

- add 'add css files'

- ui improvements
cl-refactor
yann300 10 years ago
parent
commit
f3341bef3f
  1. 10
      mix/qml/FilesSection.qml
  2. 7
      mix/qml/ProjectList.qml
  3. 1
      mix/qml/ProjectModel.qml
  4. 2
      mix/qml/Style.qml
  5. 7
      mix/qml/js/ProjectModel.js
  6. 9
      mix/qml/main.qml

10
mix/qml/FilesSection.qml

@ -48,12 +48,6 @@ ColumnLayout {
model.remove(i); model.remove(i);
} }
FontLoader
{
id: sectionTitleFont
source: "qrc:/qml/fonts/SourceSansPro-Bold.ttf"
}
FontLoader FontLoader
{ {
id: fileNameFont id: fileNameFont
@ -85,8 +79,10 @@ ColumnLayout {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin anchors.leftMargin: Style.general.leftMargin
color: Style.documentsList.sectionColor color: Style.documentsList.sectionColor
font.family: sectionTitleFont.name font.family: fileNameFont.name
font.pointSize: Style.documentsList.fontSize font.pointSize: Style.documentsList.fontSize
font.weight: Font.Bold
font.letterSpacing: 1
states: [ states: [
State { State {
name: "hidden" name: "hidden"

7
mix/qml/ProjectList.qml

@ -15,7 +15,7 @@ Item {
FontLoader FontLoader
{ {
id: srcSansProLight id: srcSansProLight
source: "qrc:/qml/fonts/SourceSansPro-ExtraLight.ttf" source: "qrc:/qml/fonts/SourceSansPro-Regular.ttf"
} }
Rectangle Rectangle
@ -42,7 +42,8 @@ Item {
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin anchors.leftMargin: Style.general.leftMargin
font.family: srcSansProLight.name font.family: srcSansProLight.name
font.pointSize: Style.title.pointSize font.pointSize: Style.title.pointSize + 3
font.weight: Font.Light
} }
Text Text
@ -78,7 +79,7 @@ Item {
spacing: 0 spacing: 0
Repeater { Repeater {
model: ["Contracts", "Javascript", "HTML", "Styles", "Images"] model: ["Contracts", "Javascript", "HTML", "Styles", "Images", "Misc"]
signal selected(string doc, string groupName) signal selected(string doc, string groupName)
id: sectionRepeater id: sectionRepeater
FilesSection FilesSection

1
mix/qml/ProjectModel.qml

@ -41,6 +41,7 @@ Item {
function addExistingFile() { ProjectModelCode.addExistingFile(); } function addExistingFile() { ProjectModelCode.addExistingFile(); }
function newHtmlFile() { ProjectModelCode.newHtmlFile(); } function newHtmlFile() { ProjectModelCode.newHtmlFile(); }
function newJsFile() { ProjectModelCode.newJsFile(); } function newJsFile() { ProjectModelCode.newJsFile(); }
function newCssFile() { ProjectModelCode.newCssFile(); }
//function newContract() { ProjectModelCode.newContract(); } //function newContract() { ProjectModelCode.newContract(); }
function openDocument(documentId) { ProjectModelCode.openDocument(documentId); } function openDocument(documentId) { ProjectModelCode.openDocument(documentId); }
function openNextDocument() { ProjectModelCode.openNextDocument(); } function openNextDocument() { ProjectModelCode.openNextDocument(); }

2
mix/qml/Style.qml

@ -13,7 +13,7 @@ QtObject {
property string color: "#808080" property string color: "#808080"
property string background: "#f0f0f0" property string background: "#f0f0f0"
property int height: 70 property int height: 70
property int pointSize: 15 property int pointSize: 18
} }
property QtObject documentsList: QtObject { property QtObject documentsList: QtObject {

7
mix/qml/js/ProjectModel.js

@ -88,8 +88,9 @@ function addFile(fileName) {
var isHtml = extension === ".html"; var isHtml = extension === ".html";
var isCss = extension === ".css"; var isCss = extension === ".css";
var isJs = extension === ".js"; 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 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 = { var docData = {
contract: false, contract: false,
path: p, path: p,
@ -227,6 +228,10 @@ function newHtmlFile() {
createAndAddFile("page", "html", "<html>\n</html>"); createAndAddFile("page", "html", "<html>\n</html>");
} }
function newCssFile() {
createAndAddFile("style", "css", "body {\n}\n");
}
function newJsFile() { function newJsFile() {
createAndAddFile("script", "js", "function foo() {\n}\n"); createAndAddFile("script", "js", "function foo() {\n}\n");
} }

9
mix/qml/main.qml

@ -28,6 +28,7 @@ ApplicationWindow {
MenuItem { action: addExistingFileAction } MenuItem { action: addExistingFileAction }
MenuItem { action: addNewJsFileAction } MenuItem { action: addNewJsFileAction }
MenuItem { action: addNewHtmlFileAction } MenuItem { action: addNewHtmlFileAction }
MenuItem { action: addNewCssFileAction }
MenuSeparator {} MenuSeparator {}
//MenuItem { action: addNewContractAction } //MenuItem { action: addNewContractAction }
MenuItem { action: closeProjectAction } MenuItem { action: closeProjectAction }
@ -188,6 +189,14 @@ ApplicationWindow {
onTriggered: projectModel.newHtmlFile(); onTriggered: projectModel.newHtmlFile();
} }
Action {
id: addNewCssFileAction
text: qsTr("New CSS File")
shortcut: "Ctrl+Alt+S"
enabled: !projectModel.isEmpty
onTriggered: projectModel.newCssFile();
}
Action { Action {
id: addNewContractAction id: addNewContractAction
text: qsTr("New Contract") text: qsTr("New Contract")

Loading…
Cancel
Save