diff --git a/mix/AppContext.cpp b/mix/AppContext.cpp index a806a39f4..7fe22106f 100644 --- a/mix/AppContext.cpp +++ b/mix/AppContext.cpp @@ -81,6 +81,8 @@ void AppContext::load() BOOST_THROW_EXCEPTION(exception); } m_applicationEngine->rootContext()->setContextProperty("projectModel", projectModel); + QFont f; + m_applicationEngine->rootContext()->setContextProperty("systemPointSize", f.pointSize()); qmlRegisterType("CodeEditorExtensionManager", 1, 0, "CodeEditorExtensionManager"); qmlRegisterType("HttpServer", 1, 0, "HttpServer"); m_applicationEngine->load(QUrl("qrc:/qml/main.qml")); diff --git a/mix/ClientModel.cpp b/mix/ClientModel.cpp index 10a60811f..b7be8988a 100644 --- a/mix/ClientModel.cpp +++ b/mix/ClientModel.cpp @@ -89,7 +89,6 @@ ClientModel::ClientModel(AppContext* _context): m_web3Server.reset(new Web3Server(*m_rpcConnector.get(), std::vector { m_client->userAccount() }, m_client.get())); connect(m_web3Server.get(), &Web3Server::newTransaction, this, &ClientModel::onNewTransaction, Qt::DirectConnection); - _context->appEngine()->rootContext()->setContextProperty("clientModel", this); } diff --git a/mix/qml/BasicContent.qml b/mix/qml/BasicContent.qml deleted file mode 100644 index ff31dc86f..000000000 --- a/mix/qml/BasicContent.qml +++ /dev/null @@ -1,35 +0,0 @@ -import QtQuick 2.2 -import QtQuick.Controls 1.1 - -Rectangle { - anchors.fill: parent - width: parent.width - height: parent.height - color: "lightgray" - Text { - font.pointSize: 9 - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: 3 - anchors.leftMargin: 3 - height: 9 - font.family: "Monospace" - objectName: "status" - id: status - } - TextArea { - readOnly: true - anchors.left: parent.left - anchors.leftMargin: 10 - anchors.top: status.bottom - anchors.topMargin: 3 - font.pointSize: 9 - font.family: "Monospace" - height: parent.height * 0.8 - width: parent.width - 20 - wrapMode: Text.Wrap - backgroundVisible: false - objectName: "content" - id: content - } -} diff --git a/mix/qml/CodeEditor.qml b/mix/qml/CodeEditor.qml index 0c554b379..9d3df69e5 100644 --- a/mix/qml/CodeEditor.qml +++ b/mix/qml/CodeEditor.qml @@ -3,6 +3,7 @@ import QtQuick.Window 2.0 import QtQuick.Layouts 1.0 import QtQuick.Controls 1.0 import QtQuick.Controls.Styles 1.1 +import "." Item { signal editorTextChanged @@ -65,7 +66,7 @@ Item { height: parent.height font.family: "Monospace" - font.pointSize: 12 + font.pointSize: CodeEditorStyle.general.basicFontSize width: parent.width tabChangesFocus: false diff --git a/mix/qml/CodeEditorStyle.qml b/mix/qml/CodeEditorStyle.qml new file mode 100644 index 000000000..c9740957c --- /dev/null +++ b/mix/qml/CodeEditorStyle.qml @@ -0,0 +1,14 @@ +pragma Singleton +import QtQuick 2.0 + +QtObject { + + function absoluteSize(rel) + { + return systemPointSize + rel; + } + + property QtObject general: QtObject { + property int basicFontSize: absoluteSize(1) + } +} diff --git a/mix/qml/Debugger.qml b/mix/qml/Debugger.qml index e9c718f70..2bf23ccef 100644 --- a/mix/qml/Debugger.qml +++ b/mix/qml/Debugger.qml @@ -6,6 +6,7 @@ import QtQuick.Layouts 1.1 import Qt.labs.settings 1.0 import "js/Debugger.js" as Debugger import "js/ErrorLocationFormater.js" as ErrorLocationFormater +import "." Rectangle { id: debugPanel @@ -346,7 +347,7 @@ Rectangle { color: "#b2b3ae" text: styleData.value.split(' ')[0] font.family: "monospace" - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize wrapMode: Text.NoWrap id: id } @@ -356,7 +357,7 @@ Rectangle { color: styleData.selected ? "white" : "black" font.family: "monospace" text: styleData.value.replace(styleData.value.split(' ')[0], '') - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize } } } @@ -425,11 +426,11 @@ Rectangle { Layout.minimumHeight: parent.height Text { anchors.centerIn: parent - anchors.leftMargin: 5 + anchors.leftMargin: 5() font.family: "monospace" color: "#4a4a4a" text: styleData.row; - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize } } @@ -447,7 +448,7 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter color: "#4a4a4a" text: styleData.value - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize } } } @@ -514,7 +515,7 @@ Rectangle { anchors.leftMargin: 5 color: "#4a4a4a" text: styleData.row; - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize width: parent.width - 5 elide: Text.ElideRight } @@ -535,7 +536,7 @@ Rectangle { color: "#4a4a4a" text: styleData.value; elide: Text.ElideRight - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize } } } @@ -585,7 +586,7 @@ Rectangle { anchors.leftMargin: 5 color: "#4a4a4a" text: styleData.value.split('\t')[0]; - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize width: parent.width - 5 elide: Text.ElideRight } @@ -606,7 +607,7 @@ Rectangle { color: "#4a4a4a" text: styleData.value.split('\t')[1]; elide: Text.ElideRight - font.pointSize: 9 + font.pointSize: DebuggerPaneStyle.general.basicFontSize } } } diff --git a/mix/qml/DebuggerPaneStyle.qml b/mix/qml/DebuggerPaneStyle.qml new file mode 100644 index 000000000..1078df2f9 --- /dev/null +++ b/mix/qml/DebuggerPaneStyle.qml @@ -0,0 +1,15 @@ +pragma Singleton +import QtQuick 2.0 + +QtObject { + + function absoluteSize(rel) + { + return systemPointSize + rel; + } + + property QtObject general: QtObject { + property int basicFontSize: absoluteSize(-2) + property int dataDumpFontSize: absoluteSize(-3) + } +} diff --git a/mix/qml/FilesSection.qml b/mix/qml/FilesSection.qml index 32202f839..76e235e7d 100644 --- a/mix/qml/FilesSection.qml +++ b/mix/qml/FilesSection.qml @@ -20,17 +20,17 @@ ColumnLayout { function hiddenHeightTopLevel() { - return section.state === "hidden" ? Style.documentsList.height : Style.documentsList.fileNameHeight * model.count + Style.documentsList.height; + return section.state === "hidden" ? ProjectFilesStyle.documentsList.height : ProjectFilesStyle.documentsList.fileNameHeight * model.count + ProjectFilesStyle.documentsList.height; } function hiddenHeightRepeater() { - return section.state === "hidden" ? 0 : Style.documentsList.fileNameHeight * wrapperItem.model.count; + return section.state === "hidden" ? 0 : ProjectFilesStyle.documentsList.fileNameHeight * wrapperItem.model.count; } function hiddenHeightElement() { - return section.state === "hidden" ? 0 : Style.documentsList.fileNameHeight; + return section.state === "hidden" ? 0 : ProjectFilesStyle.documentsList.fileNameHeight; } function getDocumentIndex(documentId) @@ -65,7 +65,7 @@ ColumnLayout { anchors.top: parent.top id: rowCol width: parent.width - height: Style.documentsList.height + height: ProjectFilesStyle.documentsList.height Image { source: "qrc:/qml/img/opentriangleindicator_filesproject.png" @@ -83,15 +83,15 @@ ColumnLayout { id: section text: sectionName anchors.left: parent.left - anchors.leftMargin: Style.general.leftMargin - color: Style.documentsList.sectionColor + anchors.leftMargin: ProjectFilesStyle.general.leftMargin + color: ProjectFilesStyle.documentsList.sectionColor font.family: boldFont.name - font.pointSize: Style.documentsList.sectionFontSize + font.pointSize: ProjectFilesStyle.documentsList.sectionFontSize states: [ State { name: "hidden" PropertyChanges { target: filesList; visible: false; } - PropertyChanges { target: rowCol; Layout.minimumHeight: Style.documentsList.height; Layout.maximumHeight: Style.documentsList.height; height: Style.documentsList.height; } + PropertyChanges { target: rowCol; Layout.minimumHeight: ProjectFilesStyle.documentsList.height; Layout.maximumHeight: ProjectFilesStyle.documentsList.height; height: ProjectFilesStyle.documentsList.height; } PropertyChanges { target: imgArrow; source: "qrc:/qml/img/closedtriangleindicator_filesproject.png" } } ] @@ -132,21 +132,21 @@ ColumnLayout { Layout.preferredHeight: wrapperItem.hiddenHeightElement() Layout.maximumHeight: wrapperItem.hiddenHeightElement() height: wrapperItem.hiddenHeightElement() - color: isSelected ? Style.documentsList.highlightColor : Style.documentsList.background + color: isSelected ? ProjectFilesStyle.documentsList.highlightColor : ProjectFilesStyle.documentsList.background property bool isSelected property bool renameMode Text { id: nameText height: parent.height visible: !renameMode - color: rootItem.isSelected ? Style.documentsList.selectedColor : Style.documentsList.color + color: rootItem.isSelected ? ProjectFilesStyle.documentsList.selectedColor : ProjectFilesStyle.documentsList.color text: name; font.family: fileNameFont.name - font.pointSize: Style.documentsList.fontSize + font.pointSize: ProjectFilesStyle.documentsList.fontSize anchors.verticalCenter: parent.verticalCenter verticalAlignment: Text.AlignVCenter anchors.left: parent.left - anchors.leftMargin: Style.general.leftMargin + 2 + anchors.leftMargin: ProjectFilesStyle.general.leftMargin + 2 width: parent.width Connections { @@ -171,7 +171,7 @@ ColumnLayout { visible: renameMode anchors.verticalCenter: parent.verticalCenter anchors.left: parent.left - anchors.leftMargin: Style.general.leftMargin + anchors.leftMargin: ProjectFilesStyle.general.leftMargin MouseArea { id: textMouseArea anchors.fill: parent diff --git a/mix/qml/ItemDelegateDataDump.qml b/mix/qml/ItemDelegateDataDump.qml index a57a61b03..9aa6d00db 100644 --- a/mix/qml/ItemDelegateDataDump.qml +++ b/mix/qml/ItemDelegateDataDump.qml @@ -2,6 +2,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.0 import QtQuick.Controls.Styles 1.1 +import "." Rectangle { anchors.fill: parent @@ -27,7 +28,7 @@ Rectangle { font.bold: true color: "#4a4a4a" text: modelData[0] - font.pointSize: 8; + font.pointSize: DebuggerPaneStyle.general.dataDumpFontSize; } } @@ -46,7 +47,7 @@ Rectangle { anchors.leftMargin: 4 color: "#4a4a4a" text: modelData[1] - font.pointSize: 8 + font.pointSize: DebuggerPaneStyle.general.dataDumpFontSize } } } diff --git a/mix/qml/Style.qml b/mix/qml/ProjectFilesStyle.qml similarity index 72% rename from mix/qml/Style.qml rename to mix/qml/ProjectFilesStyle.qml index 348d8c4d1..cb8225e0d 100644 --- a/mix/qml/Style.qml +++ b/mix/qml/ProjectFilesStyle.qml @@ -1,10 +1,13 @@ pragma Singleton import QtQuick 2.0 -/* - * Project Files - */ QtObject { + + function absoluteSize(rel) + { + return systemPointSize + rel; + } + property QtObject general: QtObject { property int leftMargin: 45 } @@ -13,7 +16,7 @@ QtObject { property string color: "#808080" property string background: "#f0f0f0" property int height: 55 - property int pointSize: 18 + property int fontSize: absoluteSize(7);// 18 } property QtObject documentsList: QtObject { @@ -24,7 +27,7 @@ QtObject { property string highlightColor: "#4a90e2" property int height: 25 property int fileNameHeight: 30 - property int fontSize: 13 - property int sectionFontSize: 13 + property int fontSize: absoluteSize(2)// 13 + property int sectionFontSize: absoluteSize(2)// 13 } } diff --git a/mix/qml/ProjectList.qml b/mix/qml/ProjectList.qml index 6895de125..0297c2441 100644 --- a/mix/qml/ProjectList.qml +++ b/mix/qml/ProjectList.qml @@ -20,8 +20,8 @@ Item { Rectangle { - color: Style.title.background - height: Style.title.height + color: ProjectFilesStyle.title.background + height: ProjectFilesStyle.title.height Layout.fillWidth: true Image { id: projectIcon @@ -35,14 +35,14 @@ Item { Text { id: projectTitle - color: Style.title.color + color: ProjectFilesStyle.title.color text: projectModel.projectTitle anchors.verticalCenter: parent.verticalCenter visible: !projectModel.isEmpty; anchors.left: parent.left - anchors.leftMargin: Style.general.leftMargin + anchors.leftMargin: ProjectFilesStyle.general.leftMargin font.family: srcSansProLight.name - font.pointSize: Style.title.pointSize + font.pointSize: ProjectFilesStyle.title.fontSize font.weight: Font.Light } @@ -52,7 +52,7 @@ Item { anchors.right: parent.right anchors.rightMargin: 15 font.family: srcSansProLight.name - font.pointSize: Style.title.pointSize + font.pointSize: ProjectFilesStyle.title.fontSize anchors.verticalCenter: parent.verticalCenter font.weight: Font.Light } @@ -62,7 +62,7 @@ Item { { Layout.fillWidth: true height: 10 - color: Style.documentsList.background + color: ProjectFilesStyle.documentsList.background } @@ -71,7 +71,7 @@ Item { { Layout.fillWidth: true Layout.fillHeight: true - color: Style.documentsList.background + color: ProjectFilesStyle.documentsList.background ColumnLayout { diff --git a/mix/qml/StateDialog.qml b/mix/qml/StateDialog.qml index fa48c640e..4384b81a6 100644 --- a/mix/qml/StateDialog.qml +++ b/mix/qml/StateDialog.qml @@ -5,6 +5,7 @@ import QtQuick.Window 2.0 import org.ethereum.qml.QEther 1.0 import "js/QEtherHelper.js" as QEtherHelper import "js/TransactionHelper.js" as TransactionHelper +import "." Window { id: modalStateDialog @@ -158,7 +159,7 @@ Window { Layout.fillWidth: true Layout.fillHeight: true text: functionId - font.pointSize: 12 + font.pointSize: StateStyle.general.basicFontSize //12 verticalAlignment: Text.AlignBottom } ToolButton { diff --git a/mix/qml/StateList.qml b/mix/qml/StateList.qml index 059b35bc2..f6f778cd9 100644 --- a/mix/qml/StateList.qml +++ b/mix/qml/StateList.qml @@ -4,6 +4,7 @@ import QtQuick.Controls 1.1 import QtQuick.Dialogs 1.1 import QtQuick.Layouts 1.1 import QtQuick.Window 2.0 +import "." Window { id: stateListContainer @@ -45,7 +46,7 @@ Window { Layout.fillWidth: true Layout.fillHeight: true text: styleData.value - font.pointSize: 12 + font.pointSize: StateStyle.general.basicFontSize verticalAlignment: Text.AlignBottom } ToolButton { diff --git a/mix/qml/StateStyle.qml b/mix/qml/StateStyle.qml new file mode 100644 index 000000000..c9740957c --- /dev/null +++ b/mix/qml/StateStyle.qml @@ -0,0 +1,14 @@ +pragma Singleton +import QtQuick 2.0 + +QtObject { + + function absoluteSize(rel) + { + return systemPointSize + rel; + } + + property QtObject general: QtObject { + property int basicFontSize: absoluteSize(1) + } +} diff --git a/mix/qml/StatusPane.qml b/mix/qml/StatusPane.qml index 57ade7a3a..956d3f2ec 100644 --- a/mix/qml/StatusPane.qml +++ b/mix/qml/StatusPane.qml @@ -2,6 +2,7 @@ import QtQuick 2.2 import QtQuick.Controls 1.1 import QtQuick.Layouts 1.1 import "js/ErrorLocationFormater.js" as ErrorLocationFormater +import "." Rectangle { id: statusHeader @@ -59,7 +60,7 @@ Rectangle { spacing: 5 Text { - font.pointSize: 10 + font.pointSize: StatusPaneStyle.general.statusFontSize height: 9 font.family: "sans serif" objectName: "status" @@ -81,7 +82,7 @@ Rectangle { Text { visible: false - font.pointSize: 9 + font.pointSize: StatusPaneStyle.general.logLinkFontSize height: 9 text: qsTr("See Log.") font.family: "Monospace" diff --git a/mix/qml/StatusPaneStyle.qml b/mix/qml/StatusPaneStyle.qml new file mode 100644 index 000000000..e6a1c9910 --- /dev/null +++ b/mix/qml/StatusPaneStyle.qml @@ -0,0 +1,15 @@ +pragma Singleton +import QtQuick 2.0 + +QtObject { + + function absoluteSize(rel) + { + return systemPointSize + rel; + } + + property QtObject general: QtObject { + property int statusFontSize: absoluteSize(-1) + property int logLinkFontSize: absoluteSize(-2) + } +} diff --git a/mix/qml/qmldir b/mix/qml/qmldir index 819842274..9eb0effd0 100644 --- a/mix/qml/qmldir +++ b/mix/qml/qmldir @@ -1 +1,4 @@ -singleton Style 1.0 Style.qml +singleton ProjectFilesStyle 1.0 ProjectFilesStyle.qml +singleton DebuggerPaneStyle 1.0 DebuggerPaneStyle.qml +singleton StateStyle 1.0 StateStyle.qml +singleton StatusPaneStyle 1.0 StatusPaneStyle.qml diff --git a/mix/res.qrc b/mix/res.qrc index a33323870..cc37b1d32 100644 --- a/mix/res.qrc +++ b/mix/res.qrc @@ -2,7 +2,6 @@ qml/main.qml qml/AlertMessageDialog.qml - qml/BasicContent.qml qml/BasicMessage.qml qml/Debugger.qml qml/MainContent.qml @@ -62,7 +61,6 @@ qml/TransactionLog.qml res/mix_256x256x32.png qml/QVariableDeclaration.qml - qml/Style.qml qml/qmldir qml/FilesSection.qml qml/fonts/SourceSansPro-Black.ttf @@ -83,5 +81,10 @@ qml/img/closedtriangleindicator_filesproject.png qml/img/opentriangleindicator_filesproject.png qml/img/projecticon.png + qml/ProjectFilesStyle.qml + qml/DebuggerPaneStyle.qml + qml/CodeEditorStyle.qml + qml/StatusPaneStyle.qml + qml/StateStyle.qml