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);
}
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"

7
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

1
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(); }

2
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 {

7
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", "<html>\n</html>");
}
function newCssFile() {
createAndAddFile("style", "css", "body {\n}\n");
}
function newJsFile() {
createAndAddFile("script", "js", "function foo() {\n}\n");
}

9
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")

Loading…
Cancel
Save