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. 24
      mix/TransactionListView.cpp
  6. 129
      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
}; };

24
mix/TransactionListView.cpp

@ -1,18 +1,18 @@
/* /*
This file is part of cpp-ethereum. This file is part of cpp-ethereum.
cpp-ethereum is free software: you can redistribute it and/or modify cpp-ethereum is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
cpp-ethereum is distributed in the hope that it will be useful, cpp-ethereum is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>. along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
*/ */
/** @file TransactionListView.cpp /** @file TransactionListView.cpp
* @author Arkadiy Paronyan arkadiy@ethdev.com * @author Arkadiy Paronyan arkadiy@ethdev.com
@ -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());

129
mix/qml/MainContent.qml

@ -16,66 +16,71 @@ Rectangle {
anchors.fill: parent anchors.fill: parent
height: parent.height height: parent.height
width: parent.width; width: parent.width;
id:root id:root
SplitView {
orientation: Qt.Horizontal CodeEditorExtensionManager {
anchors.fill: parent headerView: headerView;
SplitView { rightView: rightView;
//anchors.fill: parent editor: codeEditor
width: parent.width * 0.8 }
orientation: Qt.Vertical
Rectangle { Column {
anchors.top: parent.top anchors.fill: parent;
id: contentView anchors.horizontalCenter: parent.horizontalCenter
width: parent.width anchors.verticalCenter: parent.verticalCenter
height: parent.height * 0.7 Rectangle {
TextArea { id: headerView
id: codeEditor height: 50
height: parent.height width: parent.width;
font.family: "Monospace" }
font.pointSize: 12 Row {
width: parent.width anchors.fill: parent;
anchors.centerIn: parent anchors.horizontalCenter: parent.horizontalCenter
tabChangesFocus: false anchors.verticalCenter: parent.verticalCenter
Keys.onPressed: { SplitView {
if (event.key === Qt.Key_Tab) { orientation: Qt.Vertical;
codeEditor.insert(codeEditor.cursorPosition, "\t"); anchors.fill: parent;
event.accepted = true; Rectangle {
} id: editorRect;
} height: parent.height;
} width: parent.width /2;
} TextArea {
Rectangle { id: codeEditor
anchors.bottom: parent.bottom height: parent.height
id: contextualView width: parent.width
width: parent.width font.family: "Monospace"
Layout.minimumHeight: 20 font.pointSize: 12
height: parent.height * 0.3 anchors.centerIn: parent
TabView { tabChangesFocus: false
id: contextualTabs Keys.onPressed: {
antialiasing: true if (event.key === Qt.Key_Tab) {
anchors.fill: parent codeEditor.insert(codeEditor.cursorPosition, "\t");
style: TabStyle {} event.accepted = true;
} }
} }
} }
Rectangle { }
anchors.right: parent.right Rectangle {
id: rightPaneView id: rightView;
width: parent.width * 0.2 height: parent.height;
height: parent.height width: parent.width /2;
Layout.minimumWidth: 20 Rectangle {
TabView { id: debugWindow;
id: rightPaneTabs }
antialiasing: true Rectangle {
anchors.fill: parent anchors.right: parent.right
//style: TabStyle {} id: rightPaneView
} width: parent.width * 0.2
} height: parent.height
CodeEditorExtensionManager { Layout.minimumWidth: 20
tabView: contextualTabs TabView {
rightTabView: rightPaneTabs id: rightPaneTabs
editor: codeEditor antialiasing: true
} anchors.fill: parent
} }
}
}
}
}
}
} }

Loading…
Cancel
Save