arkpar
10 years ago
60 changed files with 1219 additions and 1046 deletions
@ -0,0 +1,63 @@ |
|||
/*
|
|||
This file is part of cpp-ethereum. |
|||
|
|||
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 |
|||
the Free Software Foundation, either version 3 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
cpp-ethereum is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
/** @file Connect.cpp
|
|||
* @author Alex Leverington <nessence@gmail.com> |
|||
* @date 2015 |
|||
*/ |
|||
|
|||
#include "Connect.h" |
|||
|
|||
#include <libp2p/Host.h> |
|||
#include "ui_Connect.h" |
|||
|
|||
Connect::Connect(QWidget *parent) : |
|||
QDialog(parent), |
|||
ui(new Ui::Connect) |
|||
{ |
|||
ui->setupUi(this); |
|||
} |
|||
|
|||
Connect::~Connect() |
|||
{ |
|||
delete ui; |
|||
} |
|||
|
|||
void Connect::setEnvironment(QStringList const& _nodes) |
|||
{ |
|||
ui->host->addItems(_nodes); |
|||
} |
|||
|
|||
void Connect::reset() |
|||
{ |
|||
ui->nodeId->clear(); |
|||
ui->required->setChecked(false); |
|||
} |
|||
|
|||
QString Connect::host() |
|||
{ |
|||
return ui->host->currentText(); |
|||
} |
|||
|
|||
QString Connect::nodeId() |
|||
{ |
|||
return ui->nodeId->text(); |
|||
} |
|||
|
|||
bool Connect::required() |
|||
{ |
|||
return ui->required->isChecked(); |
|||
} |
@ -0,0 +1,55 @@ |
|||
/*
|
|||
This file is part of cpp-ethereum. |
|||
|
|||
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 |
|||
the Free Software Foundation, either version 3 of the License, or |
|||
(at your option) any later version. |
|||
|
|||
cpp-ethereum is distributed in the hope that it will be useful, |
|||
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|||
GNU General Public License for more details. |
|||
|
|||
You should have received a copy of the GNU General Public License |
|||
along with cpp-ethereum. If not, see <http://www.gnu.org/licenses/>.
|
|||
*/ |
|||
/** @file Connect.h
|
|||
* @author Alex Leverington <nessence@gmail.com> |
|||
* @date 2015 |
|||
*/ |
|||
|
|||
#pragma once |
|||
|
|||
#include <QDialog> |
|||
#include <QList> |
|||
|
|||
namespace Ui { class Connect; } |
|||
namespace dev { namespace p2p { class Host; } } |
|||
|
|||
class Connect : public QDialog |
|||
{ |
|||
Q_OBJECT |
|||
|
|||
public: |
|||
explicit Connect(QWidget* _parent = 0); |
|||
~Connect(); |
|||
|
|||
/// Populate host chooser with default host entries.
|
|||
void setEnvironment(QStringList const& _nodes); |
|||
|
|||
/// Clear dialogue inputs.
|
|||
void reset(); |
|||
|
|||
/// @returns the host string, as chosen or entered by the user. Assumed to be "hostOrIP:port" (:port is optional).
|
|||
QString host(); |
|||
|
|||
/// @returns the identity of the node, as entered by the user. Assumed to be a 64-character hex string.
|
|||
QString nodeId(); |
|||
|
|||
/// @returns true if Required is checked by the user, indicating that the host is a required Peer.
|
|||
bool required(); |
|||
|
|||
private: |
|||
Ui::Connect* ui; |
|||
}; |
@ -0,0 +1,123 @@ |
|||
<?xml version="1.0" encoding="UTF-8"?> |
|||
<ui version="4.0"> |
|||
<class>Connect</class> |
|||
<widget class="QDialog" name="Connect"> |
|||
<property name="windowModality"> |
|||
<enum>Qt::WindowModal</enum> |
|||
</property> |
|||
<property name="geometry"> |
|||
<rect> |
|||
<x>0</x> |
|||
<y>0</y> |
|||
<width>343</width> |
|||
<height>178</height> |
|||
</rect> |
|||
</property> |
|||
<property name="sizePolicy"> |
|||
<sizepolicy hsizetype="Expanding" vsizetype="Expanding"> |
|||
<horstretch>0</horstretch> |
|||
<verstretch>0</verstretch> |
|||
</sizepolicy> |
|||
</property> |
|||
<property name="maximumSize"> |
|||
<size> |
|||
<width>343</width> |
|||
<height>178</height> |
|||
</size> |
|||
</property> |
|||
<property name="windowTitle"> |
|||
<string>Connect to Peer</string> |
|||
</property> |
|||
<property name="modal"> |
|||
<bool>true</bool> |
|||
</property> |
|||
<layout class="QFormLayout" name="formLayout_2"> |
|||
<item row="1" column="0"> |
|||
<layout class="QFormLayout" name="formLayout"> |
|||
<item row="1" column="0" colspan="2"> |
|||
<widget class="QComboBox" name="host"> |
|||
<property name="minimumSize"> |
|||
<size> |
|||
<width>311</width> |
|||
<height>0</height> |
|||
</size> |
|||
</property> |
|||
<property name="editable"> |
|||
<bool>true</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="2" column="0" colspan="2"> |
|||
<widget class="QLineEdit" name="nodeId"> |
|||
<property name="placeholderText"> |
|||
<string>Node Id</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="3" column="0" colspan="2"> |
|||
<widget class="QCheckBox" name="required"> |
|||
<property name="text"> |
|||
<string>Required (Always Connect to this Peer)</string> |
|||
</property> |
|||
<property name="tristate"> |
|||
<bool>false</bool> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
<item row="4" column="0" colspan="2"> |
|||
<widget class="QDialogButtonBox" name="buttonBox"> |
|||
<property name="orientation"> |
|||
<enum>Qt::Horizontal</enum> |
|||
</property> |
|||
<property name="standardButtons"> |
|||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</item> |
|||
<item row="0" column="0"> |
|||
<widget class="QLabel" name="formLabel"> |
|||
<property name="text"> |
|||
<string>Enter a peer to which a connection may be made:</string> |
|||
</property> |
|||
</widget> |
|||
</item> |
|||
</layout> |
|||
</widget> |
|||
<resources/> |
|||
<connections> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>accepted()</signal> |
|||
<receiver>Connect</receiver> |
|||
<slot>accept()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>248</x> |
|||
<y>254</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>157</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
<connection> |
|||
<sender>buttonBox</sender> |
|||
<signal>rejected()</signal> |
|||
<receiver>Connect</receiver> |
|||
<slot>reject()</slot> |
|||
<hints> |
|||
<hint type="sourcelabel"> |
|||
<x>316</x> |
|||
<y>260</y> |
|||
</hint> |
|||
<hint type="destinationlabel"> |
|||
<x>286</x> |
|||
<y>274</y> |
|||
</hint> |
|||
</hints> |
|||
</connection> |
|||
</connections> |
|||
</ui> |
@ -1,386 +0,0 @@ |
|||
import QtQuick 2.2 |
|||
import QtQuick.Controls 1.1 |
|||
import QtQuick.Controls.Styles 1.1 |
|||
import QtQuick.Dialogs 1.1 |
|||
import QtQuick.Layouts 1.1 |
|||
import QtQuick.Window 2.1 |
|||
import QtQuick.PrivateWidgets 1.1 |
|||
import Qt.labs.settings 1.0 |
|||
import org.ethereum.qml.QEther 1.0 |
|||
import org.ethereum.qml.CodeModel 1.0 |
|||
import org.ethereum.qml.ClientModel 1.0 |
|||
import org.ethereum.qml.FileIo 1.0 |
|||
import org.ethereum.qml.Clipboard 1.0 |
|||
|
|||
ApplicationWindow { |
|||
|
|||
id: mainApplication |
|||
signal loaded; |
|||
visible: true |
|||
width: 1200 |
|||
height: 800 |
|||
minimumWidth: 400 |
|||
minimumHeight: 300 |
|||
title: qsTr("Mix") |
|||
|
|||
CodeModel { |
|||
id: codeModel |
|||
} |
|||
|
|||
ClientModel { |
|||
id: clientModel |
|||
codeModel: codeModel |
|||
} |
|||
|
|||
ProjectModel { |
|||
id: projectModel |
|||
} |
|||
|
|||
FileIo { |
|||
id: fileIo |
|||
} |
|||
|
|||
Clipboard { |
|||
id: clipboard |
|||
} |
|||
|
|||
Connections { |
|||
target: mainApplication |
|||
onClosing: |
|||
{ |
|||
mainApplication.close(); |
|||
close.accepted = false; |
|||
} |
|||
} |
|||
|
|||
Component.onCompleted: { |
|||
loaded(); |
|||
} |
|||
|
|||
function close() { |
|||
projectModel.appIsClosing = true; |
|||
if (projectModel.projectPath !== "") |
|||
projectModel.closeProject(function() { Qt.quit(); }) |
|||
else |
|||
Qt.quit(); |
|||
} |
|||
|
|||
menuBar: MenuBar { |
|||
Menu { |
|||
title: qsTr("File") |
|||
MenuItem { action: createProjectAction } |
|||
MenuItem { action: openProjectAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: saveAllFilesAction } |
|||
MenuItem { action: saveCurrentDocument } |
|||
MenuSeparator {} |
|||
MenuItem { action: addExistingFileAction } |
|||
MenuItem { action: addNewJsFileAction } |
|||
MenuItem { action: addNewHtmlFileAction } |
|||
MenuItem { action: addNewCssFileAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: addNewContractAction } |
|||
MenuItem { action: closeProjectAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: exitAppAction } |
|||
} |
|||
Menu { |
|||
title: qsTr("Deploy") |
|||
MenuItem { action: mineAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: editStatesAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: deployViaRpcAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: toggleRunOnLoadAction } |
|||
} |
|||
Menu { |
|||
title: qsTr("Debug") |
|||
MenuItem { action: debugRunAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: toggleAssemblyDebuggingAction } |
|||
} |
|||
Menu { |
|||
title: qsTr("Windows") |
|||
MenuItem { action: openNextDocumentAction } |
|||
MenuItem { action: openPrevDocumentAction } |
|||
MenuSeparator {} |
|||
MenuItem { action: toggleProjectNavigatorAction } |
|||
MenuItem { action: showHideRightPanelAction } |
|||
MenuItem { action: toggleTransactionLogAction } |
|||
MenuItem { action: toggleWebPreviewAction } |
|||
MenuItem { action: toggleWebPreviewOrientationAction } |
|||
//MenuItem { action: toggleCallsInLog } |
|||
} |
|||
} |
|||
|
|||
MainContent { |
|||
id: mainContent; |
|||
anchors.fill: parent |
|||
} |
|||
|
|||
ModalDialog { |
|||
objectName: "dialog" |
|||
id: dialog |
|||
} |
|||
|
|||
AlertMessageDialog { |
|||
objectName: "alertMessageDialog" |
|||
id: messageDialog |
|||
} |
|||
|
|||
Settings { |
|||
id: mainWindowSettings |
|||
property alias mainWidth: mainApplication.width |
|||
property alias mainHeight: mainApplication.height |
|||
property alias mainX: mainApplication.x |
|||
property alias mainY: mainApplication.y |
|||
} |
|||
|
|||
Action { |
|||
id: exitAppAction |
|||
text: qsTr("Exit") |
|||
shortcut: "Ctrl+Q" |
|||
onTriggered: |
|||
{ |
|||
mainApplication.close(); |
|||
} |
|||
} |
|||
|
|||
Action { |
|||
id: mineAction |
|||
text: qsTr("New Block") |
|||
shortcut: "Ctrl+M" |
|||
onTriggered: clientModel.mine(); |
|||
enabled: codeModel.hasContract && !clientModel.running && !clientModel.mining |
|||
} |
|||
|
|||
StateList { |
|||
id: stateList |
|||
} |
|||
|
|||
Action { |
|||
id: editStatesAction |
|||
text: qsTr("Edit States") |
|||
shortcut: "Ctrl+Alt+E" |
|||
onTriggered: stateList.show(); |
|||
} |
|||
|
|||
Connections { |
|||
target: projectModel.stateListModel |
|||
|
|||
function updateRunLabel() |
|||
{ |
|||
debugRunAction.text = qsTr("Deploy") + " \"" + projectModel.stateListModel.defaultStateName() + "\""; |
|||
} |
|||
|
|||
onDefaultStateChanged: updateRunLabel() |
|||
onStateListModelReady: updateRunLabel() |
|||
} |
|||
|
|||
Action { |
|||
id: debugRunAction |
|||
text: qsTr("Deploy") |
|||
shortcut: "F5" |
|||
onTriggered: mainContent.startQuickDebugging() |
|||
enabled: codeModel.hasContract && !clientModel.running |
|||
} |
|||
|
|||
Action { |
|||
id: toggleAssemblyDebuggingAction |
|||
text: qsTr("Show VM Code") |
|||
shortcut: "Ctrl+Alt+V" |
|||
onTriggered: mainContent.rightPane.assemblyMode = !mainContent.rightPane.assemblyMode; |
|||
checked: mainContent.rightPane.assemblyMode; |
|||
enabled: true |
|||
} |
|||
|
|||
Action { |
|||
id: toggleWebPreviewAction |
|||
text: qsTr("Show Web View") |
|||
shortcut: "F2" |
|||
checkable: true |
|||
checked: mainContent.webViewVisible |
|||
onTriggered: mainContent.toggleWebPreview(); |
|||
} |
|||
|
|||
Action { |
|||
id: toggleTransactionLogAction |
|||
text: qsTr("Show States and Transactions") |
|||
shortcut: "Alt+1" |
|||
checkable: true |
|||
checked: mainContent.rightPane.transactionLog.visible |
|||
onTriggered: mainContent.rightPane.transactionLog.visible = !mainContent.rightPane.transactionLog.visible |
|||
} |
|||
|
|||
Action { |
|||
id: toggleProjectNavigatorAction |
|||
text: qsTr("Show Project Navigator") |
|||
shortcut: "Alt+0" |
|||
checkable: true |
|||
checked: mainContent.projectViewVisible |
|||
onTriggered: mainContent.toggleProjectView(); |
|||
} |
|||
|
|||
Action { |
|||
id: toggleWebPreviewOrientationAction |
|||
text: qsTr("Horizontal Web View") |
|||
shortcut: "" |
|||
checkable: true |
|||
checked: mainContent.webViewHorizontal |
|||
onTriggered: mainContent.toggleWebPreviewOrientation(); |
|||
} |
|||
|
|||
Action { |
|||
id: toggleRunOnLoadAction |
|||
text: qsTr("Load State on Startup") |
|||
shortcut: "" |
|||
checkable: true |
|||
checked: mainContent.runOnProjectLoad |
|||
onTriggered: mainContent.runOnProjectLoad = !mainContent.runOnProjectLoad |
|||
} |
|||
|
|||
Action { |
|||
id: showHideRightPanelAction |
|||
text: qsTr("Show Right View") |
|||
shortcut: "F7" |
|||
checkable: true |
|||
checked: mainContent.rightViewVisible |
|||
onTriggered: mainContent.toggleRightView(); |
|||
} |
|||
|
|||
Action { |
|||
id: createProjectAction |
|||
text: qsTr("&New Project") |
|||
shortcut: "Ctrl+N" |
|||
enabled: true; |
|||
onTriggered: projectModel.createProject(); |
|||
} |
|||
|
|||
Action { |
|||
id: openProjectAction |
|||
text: qsTr("&Open Project") |
|||
shortcut: "Ctrl+O" |
|||
enabled: true; |
|||
onTriggered: openProjectFileDialog.open() |
|||
} |
|||
|
|||
FileDialog { |
|||
id: openProjectFileDialog |
|||
visible: false |
|||
title: qsTr("Open a Project") |
|||
selectFolder: true |
|||
onAccepted: { |
|||
var path = openProjectFileDialog.fileUrl.toString(); |
|||
path += "/"; |
|||
projectModel.loadProject(path); |
|||
} |
|||
} |
|||
|
|||
Action { |
|||
id: addNewJsFileAction |
|||
text: qsTr("New JavaScript File") |
|||
shortcut: "Ctrl+Alt+J" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: projectModel.newJsFile(); |
|||
} |
|||
|
|||
Action { |
|||
id: addNewHtmlFileAction |
|||
text: qsTr("New HTML File") |
|||
shortcut: "Ctrl+Alt+H" |
|||
enabled: !projectModel.isEmpty |
|||
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") |
|||
shortcut: "Ctrl+Alt+C" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: projectModel.newContract(); |
|||
} |
|||
|
|||
Action { |
|||
id: addExistingFileAction |
|||
text: qsTr("Add Existing File") |
|||
shortcut: "Ctrl+Alt+A" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: addExistingFileDialog.open() |
|||
} |
|||
|
|||
FileDialog { |
|||
id: addExistingFileDialog |
|||
visible: false |
|||
title: qsTr("Add a File") |
|||
selectFolder: false |
|||
onAccepted: { |
|||
var paths = addExistingFileDialog.fileUrls; |
|||
projectModel.addExistingFiles(paths); |
|||
} |
|||
} |
|||
|
|||
Action { |
|||
id: saveAllFilesAction |
|||
text: qsTr("Save All") |
|||
shortcut: "Ctrl+Shift+A" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: projectModel.saveAll(); |
|||
} |
|||
|
|||
Action { |
|||
id: saveCurrentDocument |
|||
text: qsTr("Save Current Document") |
|||
shortcut: "Ctrl+S" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: projectModel.saveCurrentDocument(); |
|||
} |
|||
|
|||
Action { |
|||
id: closeProjectAction |
|||
text: qsTr("Close Project") |
|||
shortcut: "Ctrl+W" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: projectModel.closeProject(); |
|||
} |
|||
|
|||
Action { |
|||
id: openNextDocumentAction |
|||
text: qsTr("Next Document") |
|||
shortcut: "Ctrl+Tab" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: projectModel.openNextDocument(); |
|||
} |
|||
|
|||
Action { |
|||
id: openPrevDocumentAction |
|||
text: qsTr("Previous Document") |
|||
shortcut: "Ctrl+Shift+Tab" |
|||
enabled: !projectModel.isEmpty |
|||
onTriggered: projectModel.openPrevDocument(); |
|||
} |
|||
|
|||
Action { |
|||
id: toggleBreakpointAction |
|||
text: qsTr("Toggle Breakpoint") |
|||
shortcut: "F9" |
|||
enabled: mainContent.codeEditor.editingContract(); |
|||
onTriggered: mainContent.toggleBreakpoint(); |
|||
} |
|||
|
|||
Action { |
|||
id: deployViaRpcAction |
|||
text: qsTr("Deploy to Network") |
|||
shortcut: "Ctrl+Shift+D" |
|||
enabled: !projectModel.isEmpty && codeModel.hasContract |
|||
onTriggered: projectModel.deployProject(); |
|||
} |
|||
} |
Loading…
Reference in new issue