Browse Source

Merge pull request #991 from yann300/ui_improvement

Integration with system default font size.
cl-refactor
Arkadiy Paronyan 10 years ago
parent
commit
b353921b10
  1. 2
      mix/AppContext.cpp
  2. 1
      mix/ClientModel.cpp
  3. 35
      mix/qml/BasicContent.qml
  4. 3
      mix/qml/CodeEditor.qml
  5. 14
      mix/qml/CodeEditorStyle.qml
  6. 19
      mix/qml/Debugger.qml
  7. 15
      mix/qml/DebuggerPaneStyle.qml
  8. 26
      mix/qml/FilesSection.qml
  9. 5
      mix/qml/ItemDelegateDataDump.qml
  10. 15
      mix/qml/ProjectFilesStyle.qml
  11. 16
      mix/qml/ProjectList.qml
  12. 3
      mix/qml/StateDialog.qml
  13. 3
      mix/qml/StateList.qml
  14. 14
      mix/qml/StateStyle.qml
  15. 5
      mix/qml/StatusPane.qml
  16. 15
      mix/qml/StatusPaneStyle.qml
  17. 5
      mix/qml/qmldir
  18. 7
      mix/res.qrc

2
mix/AppContext.cpp

@ -81,6 +81,8 @@ void AppContext::load()
BOOST_THROW_EXCEPTION(exception); BOOST_THROW_EXCEPTION(exception);
} }
m_applicationEngine->rootContext()->setContextProperty("projectModel", projectModel); m_applicationEngine->rootContext()->setContextProperty("projectModel", projectModel);
QFont f;
m_applicationEngine->rootContext()->setContextProperty("systemPointSize", f.pointSize());
qmlRegisterType<CodeEditorExtensionManager>("CodeEditorExtensionManager", 1, 0, "CodeEditorExtensionManager"); qmlRegisterType<CodeEditorExtensionManager>("CodeEditorExtensionManager", 1, 0, "CodeEditorExtensionManager");
qmlRegisterType<HttpServer>("HttpServer", 1, 0, "HttpServer"); qmlRegisterType<HttpServer>("HttpServer", 1, 0, "HttpServer");
m_applicationEngine->load(QUrl("qrc:/qml/main.qml")); m_applicationEngine->load(QUrl("qrc:/qml/main.qml"));

1
mix/ClientModel.cpp

@ -89,7 +89,6 @@ ClientModel::ClientModel(AppContext* _context):
m_web3Server.reset(new Web3Server(*m_rpcConnector.get(), std::vector<dev::KeyPair> { m_client->userAccount() }, m_client.get())); m_web3Server.reset(new Web3Server(*m_rpcConnector.get(), std::vector<dev::KeyPair> { m_client->userAccount() }, m_client.get()));
connect(m_web3Server.get(), &Web3Server::newTransaction, this, &ClientModel::onNewTransaction, Qt::DirectConnection); connect(m_web3Server.get(), &Web3Server::newTransaction, this, &ClientModel::onNewTransaction, Qt::DirectConnection);
_context->appEngine()->rootContext()->setContextProperty("clientModel", this); _context->appEngine()->rootContext()->setContextProperty("clientModel", this);
} }

35
mix/qml/BasicContent.qml

@ -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
}
}

3
mix/qml/CodeEditor.qml

@ -3,6 +3,7 @@ import QtQuick.Window 2.0
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls 1.0 import QtQuick.Controls 1.0
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import "."
Item { Item {
signal editorTextChanged signal editorTextChanged
@ -65,7 +66,7 @@ Item {
height: parent.height height: parent.height
font.family: "Monospace" font.family: "Monospace"
font.pointSize: 12 font.pointSize: CodeEditorStyle.general.basicFontSize
width: parent.width width: parent.width
tabChangesFocus: false tabChangesFocus: false

14
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)
}
}

19
mix/qml/Debugger.qml

@ -6,6 +6,7 @@ import QtQuick.Layouts 1.1
import Qt.labs.settings 1.0 import Qt.labs.settings 1.0
import "js/Debugger.js" as Debugger import "js/Debugger.js" as Debugger
import "js/ErrorLocationFormater.js" as ErrorLocationFormater import "js/ErrorLocationFormater.js" as ErrorLocationFormater
import "."
Rectangle { Rectangle {
id: debugPanel id: debugPanel
@ -346,7 +347,7 @@ Rectangle {
color: "#b2b3ae" color: "#b2b3ae"
text: styleData.value.split(' ')[0] text: styleData.value.split(' ')[0]
font.family: "monospace" font.family: "monospace"
font.pointSize: 9 font.pointSize: DebuggerPaneStyle.general.basicFontSize
wrapMode: Text.NoWrap wrapMode: Text.NoWrap
id: id id: id
} }
@ -356,7 +357,7 @@ Rectangle {
color: styleData.selected ? "white" : "black" color: styleData.selected ? "white" : "black"
font.family: "monospace" font.family: "monospace"
text: styleData.value.replace(styleData.value.split(' ')[0], '') 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 Layout.minimumHeight: parent.height
Text { Text {
anchors.centerIn: parent anchors.centerIn: parent
anchors.leftMargin: 5 anchors.leftMargin: 5()
font.family: "monospace" font.family: "monospace"
color: "#4a4a4a" color: "#4a4a4a"
text: styleData.row; text: styleData.row;
font.pointSize: 9 font.pointSize: DebuggerPaneStyle.general.basicFontSize
} }
} }
@ -447,7 +448,7 @@ Rectangle {
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
color: "#4a4a4a" color: "#4a4a4a"
text: styleData.value text: styleData.value
font.pointSize: 9 font.pointSize: DebuggerPaneStyle.general.basicFontSize
} }
} }
} }
@ -514,7 +515,7 @@ Rectangle {
anchors.leftMargin: 5 anchors.leftMargin: 5
color: "#4a4a4a" color: "#4a4a4a"
text: styleData.row; text: styleData.row;
font.pointSize: 9 font.pointSize: DebuggerPaneStyle.general.basicFontSize
width: parent.width - 5 width: parent.width - 5
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -535,7 +536,7 @@ Rectangle {
color: "#4a4a4a" color: "#4a4a4a"
text: styleData.value; text: styleData.value;
elide: Text.ElideRight elide: Text.ElideRight
font.pointSize: 9 font.pointSize: DebuggerPaneStyle.general.basicFontSize
} }
} }
} }
@ -585,7 +586,7 @@ Rectangle {
anchors.leftMargin: 5 anchors.leftMargin: 5
color: "#4a4a4a" color: "#4a4a4a"
text: styleData.value.split('\t')[0]; text: styleData.value.split('\t')[0];
font.pointSize: 9 font.pointSize: DebuggerPaneStyle.general.basicFontSize
width: parent.width - 5 width: parent.width - 5
elide: Text.ElideRight elide: Text.ElideRight
} }
@ -606,7 +607,7 @@ Rectangle {
color: "#4a4a4a" color: "#4a4a4a"
text: styleData.value.split('\t')[1]; text: styleData.value.split('\t')[1];
elide: Text.ElideRight elide: Text.ElideRight
font.pointSize: 9 font.pointSize: DebuggerPaneStyle.general.basicFontSize
} }
} }
} }

15
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)
}
}

26
mix/qml/FilesSection.qml

@ -20,17 +20,17 @@ ColumnLayout {
function hiddenHeightTopLevel() 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() 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() function hiddenHeightElement()
{ {
return section.state === "hidden" ? 0 : Style.documentsList.fileNameHeight; return section.state === "hidden" ? 0 : ProjectFilesStyle.documentsList.fileNameHeight;
} }
function getDocumentIndex(documentId) function getDocumentIndex(documentId)
@ -65,7 +65,7 @@ ColumnLayout {
anchors.top: parent.top anchors.top: parent.top
id: rowCol id: rowCol
width: parent.width width: parent.width
height: Style.documentsList.height height: ProjectFilesStyle.documentsList.height
Image { Image {
source: "qrc:/qml/img/opentriangleindicator_filesproject.png" source: "qrc:/qml/img/opentriangleindicator_filesproject.png"
@ -83,15 +83,15 @@ ColumnLayout {
id: section id: section
text: sectionName text: sectionName
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin anchors.leftMargin: ProjectFilesStyle.general.leftMargin
color: Style.documentsList.sectionColor color: ProjectFilesStyle.documentsList.sectionColor
font.family: boldFont.name font.family: boldFont.name
font.pointSize: Style.documentsList.sectionFontSize font.pointSize: ProjectFilesStyle.documentsList.sectionFontSize
states: [ states: [
State { State {
name: "hidden" name: "hidden"
PropertyChanges { target: filesList; visible: false; } 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" } PropertyChanges { target: imgArrow; source: "qrc:/qml/img/closedtriangleindicator_filesproject.png" }
} }
] ]
@ -132,21 +132,21 @@ ColumnLayout {
Layout.preferredHeight: wrapperItem.hiddenHeightElement() Layout.preferredHeight: wrapperItem.hiddenHeightElement()
Layout.maximumHeight: wrapperItem.hiddenHeightElement() Layout.maximumHeight: wrapperItem.hiddenHeightElement()
height: 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 isSelected
property bool renameMode property bool renameMode
Text { Text {
id: nameText id: nameText
height: parent.height height: parent.height
visible: !renameMode visible: !renameMode
color: rootItem.isSelected ? Style.documentsList.selectedColor : Style.documentsList.color color: rootItem.isSelected ? ProjectFilesStyle.documentsList.selectedColor : ProjectFilesStyle.documentsList.color
text: name; text: name;
font.family: fileNameFont.name font.family: fileNameFont.name
font.pointSize: Style.documentsList.fontSize font.pointSize: ProjectFilesStyle.documentsList.fontSize
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
verticalAlignment: Text.AlignVCenter verticalAlignment: Text.AlignVCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin + 2 anchors.leftMargin: ProjectFilesStyle.general.leftMargin + 2
width: parent.width width: parent.width
Connections Connections
{ {
@ -171,7 +171,7 @@ ColumnLayout {
visible: renameMode visible: renameMode
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin anchors.leftMargin: ProjectFilesStyle.general.leftMargin
MouseArea { MouseArea {
id: textMouseArea id: textMouseArea
anchors.fill: parent anchors.fill: parent

5
mix/qml/ItemDelegateDataDump.qml

@ -2,6 +2,7 @@ import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Layouts 1.0 import QtQuick.Layouts 1.0
import QtQuick.Controls.Styles 1.1 import QtQuick.Controls.Styles 1.1
import "."
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
@ -27,7 +28,7 @@ Rectangle {
font.bold: true font.bold: true
color: "#4a4a4a" color: "#4a4a4a"
text: modelData[0] text: modelData[0]
font.pointSize: 8; font.pointSize: DebuggerPaneStyle.general.dataDumpFontSize;
} }
} }
@ -46,7 +47,7 @@ Rectangle {
anchors.leftMargin: 4 anchors.leftMargin: 4
color: "#4a4a4a" color: "#4a4a4a"
text: modelData[1] text: modelData[1]
font.pointSize: 8 font.pointSize: DebuggerPaneStyle.general.dataDumpFontSize
} }
} }
} }

15
mix/qml/Style.qml → mix/qml/ProjectFilesStyle.qml

@ -1,10 +1,13 @@
pragma Singleton pragma Singleton
import QtQuick 2.0 import QtQuick 2.0
/*
* Project Files
*/
QtObject { QtObject {
function absoluteSize(rel)
{
return systemPointSize + rel;
}
property QtObject general: QtObject { property QtObject general: QtObject {
property int leftMargin: 45 property int leftMargin: 45
} }
@ -13,7 +16,7 @@ QtObject {
property string color: "#808080" property string color: "#808080"
property string background: "#f0f0f0" property string background: "#f0f0f0"
property int height: 55 property int height: 55
property int pointSize: 18 property int fontSize: absoluteSize(7);// 18
} }
property QtObject documentsList: QtObject { property QtObject documentsList: QtObject {
@ -24,7 +27,7 @@ QtObject {
property string highlightColor: "#4a90e2" property string highlightColor: "#4a90e2"
property int height: 25 property int height: 25
property int fileNameHeight: 30 property int fileNameHeight: 30
property int fontSize: 13 property int fontSize: absoluteSize(2)// 13
property int sectionFontSize: 13 property int sectionFontSize: absoluteSize(2)// 13
} }
} }

16
mix/qml/ProjectList.qml

@ -20,8 +20,8 @@ Item {
Rectangle Rectangle
{ {
color: Style.title.background color: ProjectFilesStyle.title.background
height: Style.title.height height: ProjectFilesStyle.title.height
Layout.fillWidth: true Layout.fillWidth: true
Image { Image {
id: projectIcon id: projectIcon
@ -35,14 +35,14 @@ Item {
Text Text
{ {
id: projectTitle id: projectTitle
color: Style.title.color color: ProjectFilesStyle.title.color
text: projectModel.projectTitle text: projectModel.projectTitle
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
visible: !projectModel.isEmpty; visible: !projectModel.isEmpty;
anchors.left: parent.left anchors.left: parent.left
anchors.leftMargin: Style.general.leftMargin anchors.leftMargin: ProjectFilesStyle.general.leftMargin
font.family: srcSansProLight.name font.family: srcSansProLight.name
font.pointSize: Style.title.pointSize font.pointSize: ProjectFilesStyle.title.fontSize
font.weight: Font.Light font.weight: Font.Light
} }
@ -52,7 +52,7 @@ Item {
anchors.right: parent.right anchors.right: parent.right
anchors.rightMargin: 15 anchors.rightMargin: 15
font.family: srcSansProLight.name font.family: srcSansProLight.name
font.pointSize: Style.title.pointSize font.pointSize: ProjectFilesStyle.title.fontSize
anchors.verticalCenter: parent.verticalCenter anchors.verticalCenter: parent.verticalCenter
font.weight: Font.Light font.weight: Font.Light
} }
@ -62,7 +62,7 @@ Item {
{ {
Layout.fillWidth: true Layout.fillWidth: true
height: 10 height: 10
color: Style.documentsList.background color: ProjectFilesStyle.documentsList.background
} }
@ -71,7 +71,7 @@ Item {
{ {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
color: Style.documentsList.background color: ProjectFilesStyle.documentsList.background
ColumnLayout ColumnLayout
{ {

3
mix/qml/StateDialog.qml

@ -5,6 +5,7 @@ import QtQuick.Window 2.0
import org.ethereum.qml.QEther 1.0 import org.ethereum.qml.QEther 1.0
import "js/QEtherHelper.js" as QEtherHelper import "js/QEtherHelper.js" as QEtherHelper
import "js/TransactionHelper.js" as TransactionHelper import "js/TransactionHelper.js" as TransactionHelper
import "."
Window { Window {
id: modalStateDialog id: modalStateDialog
@ -158,7 +159,7 @@ Window {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
text: functionId text: functionId
font.pointSize: 12 font.pointSize: StateStyle.general.basicFontSize //12
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
} }
ToolButton { ToolButton {

3
mix/qml/StateList.qml

@ -4,6 +4,7 @@ import QtQuick.Controls 1.1
import QtQuick.Dialogs 1.1 import QtQuick.Dialogs 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import QtQuick.Window 2.0 import QtQuick.Window 2.0
import "."
Window { Window {
id: stateListContainer id: stateListContainer
@ -45,7 +46,7 @@ Window {
Layout.fillWidth: true Layout.fillWidth: true
Layout.fillHeight: true Layout.fillHeight: true
text: styleData.value text: styleData.value
font.pointSize: 12 font.pointSize: StateStyle.general.basicFontSize
verticalAlignment: Text.AlignBottom verticalAlignment: Text.AlignBottom
} }
ToolButton { ToolButton {

14
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)
}
}

5
mix/qml/StatusPane.qml

@ -2,6 +2,7 @@ import QtQuick 2.2
import QtQuick.Controls 1.1 import QtQuick.Controls 1.1
import QtQuick.Layouts 1.1 import QtQuick.Layouts 1.1
import "js/ErrorLocationFormater.js" as ErrorLocationFormater import "js/ErrorLocationFormater.js" as ErrorLocationFormater
import "."
Rectangle { Rectangle {
id: statusHeader id: statusHeader
@ -59,7 +60,7 @@ Rectangle {
spacing: 5 spacing: 5
Text { Text {
font.pointSize: 10 font.pointSize: StatusPaneStyle.general.statusFontSize
height: 9 height: 9
font.family: "sans serif" font.family: "sans serif"
objectName: "status" objectName: "status"
@ -81,7 +82,7 @@ Rectangle {
Text { Text {
visible: false visible: false
font.pointSize: 9 font.pointSize: StatusPaneStyle.general.logLinkFontSize
height: 9 height: 9
text: qsTr("See Log.") text: qsTr("See Log.")
font.family: "Monospace" font.family: "Monospace"

15
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)
}
}

5
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

7
mix/res.qrc

@ -2,7 +2,6 @@
<qresource prefix="/"> <qresource prefix="/">
<file>qml/main.qml</file> <file>qml/main.qml</file>
<file>qml/AlertMessageDialog.qml</file> <file>qml/AlertMessageDialog.qml</file>
<file>qml/BasicContent.qml</file>
<file>qml/BasicMessage.qml</file> <file>qml/BasicMessage.qml</file>
<file>qml/Debugger.qml</file> <file>qml/Debugger.qml</file>
<file>qml/MainContent.qml</file> <file>qml/MainContent.qml</file>
@ -62,7 +61,6 @@
<file>qml/TransactionLog.qml</file> <file>qml/TransactionLog.qml</file>
<file>res/mix_256x256x32.png</file> <file>res/mix_256x256x32.png</file>
<file>qml/QVariableDeclaration.qml</file> <file>qml/QVariableDeclaration.qml</file>
<file>qml/Style.qml</file>
<file>qml/qmldir</file> <file>qml/qmldir</file>
<file>qml/FilesSection.qml</file> <file>qml/FilesSection.qml</file>
<file>qml/fonts/SourceSansPro-Black.ttf</file> <file>qml/fonts/SourceSansPro-Black.ttf</file>
@ -83,5 +81,10 @@
<file>qml/img/closedtriangleindicator_filesproject.png</file> <file>qml/img/closedtriangleindicator_filesproject.png</file>
<file>qml/img/opentriangleindicator_filesproject.png</file> <file>qml/img/opentriangleindicator_filesproject.png</file>
<file>qml/img/projecticon.png</file> <file>qml/img/projecticon.png</file>
<file>qml/ProjectFilesStyle.qml</file>
<file>qml/DebuggerPaneStyle.qml</file>
<file>qml/CodeEditorStyle.qml</file>
<file>qml/StatusPaneStyle.qml</file>
<file>qml/StateStyle.qml</file>
</qresource> </qresource>
</RCC> </RCC>

Loading…
Cancel
Save