Browse Source

- Add Row, Column (UI layout).

- Rename content view.
cl-refactor
yann300 10 years ago
committed by yann300
parent
commit
7091f201b1
  1. 16
      mix/CodeEditorExtensionManager.cpp
  2. 12
      mix/CodeEditorExtensionManager.h
  3. 2
      mix/ConstantCompilationControl.cpp
  4. 4
      mix/Extension.h
  5. 2
      mix/TransactionListView.cpp
  6. 61
      mix/qml/MainContent.qml

16
mix/CodeEditorExtensionManager.cpp

@ -80,10 +80,10 @@ void CodeEditorExtensionManager::initExtension(std::shared_ptr<Extension> _ext)
{ {
try try
{ {
if (_ext->getDisplayBehavior() == ExtensionDisplayBehavior::Tab) if (_ext->getDisplayBehavior() == ExtensionDisplayBehavior::RightView)
_ext->addTabOn(m_tabView); _ext->addContentOn(m_rightView);
else if (_ext->getDisplayBehavior() == ExtensionDisplayBehavior::RightTab) if (_ext->getDisplayBehavior() == ExtensionDisplayBehavior::HeaderView)
_ext->addTabOn(m_rightTabView); _ext->addContentOn(m_headerView);
} }
catch (...) catch (...)
{ {
@ -110,12 +110,12 @@ void CodeEditorExtensionManager::setEditor(QQuickItem* _editor)
} }
} }
void CodeEditorExtensionManager::setRightTabView(QQuickItem* _tabView) void CodeEditorExtensionManager::setRightView(QQuickItem* _rightView)
{ {
m_rightTabView = _tabView; m_rightView = _rightView;
} }
void CodeEditorExtensionManager::setTabView(QQuickItem* _tabView) void CodeEditorExtensionManager::setHeaderView(QQuickItem* _headerView)
{ {
m_tabView = _tabView; m_headerView = _headerView;
} }

12
mix/CodeEditorExtensionManager.h

@ -44,8 +44,8 @@ class CodeEditorExtensionManager: public QObject
Q_OBJECT Q_OBJECT
Q_PROPERTY(QQuickItem* editor MEMBER m_editor WRITE setEditor) Q_PROPERTY(QQuickItem* editor MEMBER m_editor WRITE setEditor)
Q_PROPERTY(QQuickItem* tabView MEMBER m_tabView WRITE setTabView) Q_PROPERTY(QQuickItem* headerView MEMBER m_headerView WRITE setHeaderView)
Q_PROPERTY(QQuickItem* rightTabView MEMBER m_rightTabView WRITE setRightTabView) Q_PROPERTY(QQuickItem* rightView MEMBER m_rightView WRITE setRightView)
public: public:
CodeEditorExtensionManager(); CodeEditorExtensionManager();
@ -57,15 +57,15 @@ public:
/// Set current text editor. /// Set current text editor.
void setEditor(QQuickItem*); void setEditor(QQuickItem*);
/// Set current tab view /// Set current tab view
void setTabView(QQuickItem*); void setHeaderView(QQuickItem*);
/// Set current right tab view. /// Set current right tab view.
void setRightTabView(QQuickItem*); void setRightView(QQuickItem*);
private: private:
QQuickItem* m_editor; QQuickItem* m_editor;
QVector<std::shared_ptr<Extension>> m_features; QVector<std::shared_ptr<Extension>> m_features;
QQuickItem* m_tabView; QQuickItem* m_headerView;
QQuickItem* m_rightTabView; QQuickItem* m_rightView;
QTextDocument* m_doc; QTextDocument* m_doc;
AppContext* m_appContext; AppContext* m_appContext;
void loadEditor(QQuickItem* _editor); void loadEditor(QQuickItem* _editor);

2
mix/ConstantCompilationControl.cpp

@ -34,7 +34,7 @@
using namespace dev::mix; using namespace dev::mix;
ConstantCompilationControl::ConstantCompilationControl(AppContext* _context): Extension(_context, ExtensionDisplayBehavior::Tab) ConstantCompilationControl::ConstantCompilationControl(AppContext* _context): Extension(_context, ExtensionDisplayBehavior::HeaderView)
{ {
connect(_context->codeModel(), &CodeModel::compilationComplete, this, &ConstantCompilationControl::update); connect(_context->codeModel(), &CodeModel::compilationComplete, this, &ConstantCompilationControl::update);
} }

4
mix/Extension.h

@ -33,8 +33,8 @@ class AppContext;
enum ExtensionDisplayBehavior enum ExtensionDisplayBehavior
{ {
Tab, HeaderView,
RightTab, RightView,
ModalDialog ModalDialog
}; };

2
mix/TransactionListView.cpp

@ -29,7 +29,7 @@
#include "TransactionListModel.h" #include "TransactionListModel.h"
using namespace dev::mix; using namespace dev::mix;
TransactionListView::TransactionListView(AppContext* _context): Extension(_context, ExtensionDisplayBehavior::RightTab) TransactionListView::TransactionListView(AppContext* _context): Extension(_context, ExtensionDisplayBehavior::RightView)
{ {
m_model.reset(new TransactionListModel(this, _context)); m_model.reset(new TransactionListModel(this, _context));
m_appEngine->rootContext()->setContextProperty("transactionListModel", m_model.get()); m_appEngine->rootContext()->setContextProperty("transactionListModel", m_model.get());

61
mix/qml/MainContent.qml

@ -17,24 +17,39 @@ Rectangle {
height: parent.height height: parent.height
width: parent.width; width: parent.width;
id:root id:root
CodeEditorExtensionManager {
headerView: headerView;
rightView: rightView;
editor: codeEditor
}
Column {
anchors.fill: parent;
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
Rectangle {
id: headerView
height: 50
width: parent.width;
}
Row {
anchors.fill: parent;
anchors.horizontalCenter: parent.horizontalCenter
anchors.verticalCenter: parent.verticalCenter
SplitView { SplitView {
orientation: Qt.Horizontal orientation: Qt.Vertical;
anchors.fill: parent anchors.fill: parent;
SplitView {
//anchors.fill: parent
width: parent.width * 0.8
orientation: Qt.Vertical
Rectangle { Rectangle {
anchors.top: parent.top id: editorRect;
id: contentView height: parent.height;
width: parent.width width: parent.width /2;
height: parent.height * 0.7
TextArea { TextArea {
id: codeEditor id: codeEditor
height: parent.height height: parent.height
width: parent.width
font.family: "Monospace" font.family: "Monospace"
font.pointSize: 12 font.pointSize: 12
width: parent.width
anchors.centerIn: parent anchors.centerIn: parent
tabChangesFocus: false tabChangesFocus: false
Keys.onPressed: { Keys.onPressed: {
@ -46,18 +61,11 @@ Rectangle {
} }
} }
Rectangle { Rectangle {
anchors.bottom: parent.bottom id: rightView;
id: contextualView height: parent.height;
width: parent.width width: parent.width /2;
Layout.minimumHeight: 20 Rectangle {
height: parent.height * 0.3 id: debugWindow;
TabView {
id: contextualTabs
antialiasing: true
anchors.fill: parent
style: TabStyle {}
}
}
} }
Rectangle { Rectangle {
anchors.right: parent.right anchors.right: parent.right
@ -69,13 +77,10 @@ Rectangle {
id: rightPaneTabs id: rightPaneTabs
antialiasing: true antialiasing: true
anchors.fill: parent anchors.fill: parent
//style: TabStyle {}
} }
} }
CodeEditorExtensionManager { }
tabView: contextualTabs }
rightTabView: rightPaneTabs
editor: codeEditor
} }
} }
} }

Loading…
Cancel
Save