diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c7584d..359678b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,5 @@ configure_project(SOLIDITY) find_package(Qt5Widgets) add_subdirectory(libaleth) -add_subdirectory(alethfive) add_subdirectory(alethone) add_subdirectory(alethzero) - diff --git a/alethfive/AlethFive.cpp b/alethfive/AlethFive.cpp deleted file mode 100644 index 442272f..0000000 --- a/alethfive/AlethFive.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/* - 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 . -*/ -/** @file AlethFive.cpp - * @author Gav Wood - * @date 2015 - */ - -#include "AlethFive.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "alethzero/BuildInfo.h" -#include "ui_AlethFive.h" -using namespace std; -using namespace dev; -using namespace p2p; -using namespace eth; -using namespace aleth; -using namespace five; - -AlethFive::AlethFive(): - m_ui(new Ui::AlethFive) -{ - g_logVerbosity = 1; - - setWindowFlags(Qt::Window); - m_ui->setupUi(this); - m_aleth.init(Aleth::Bootstrap, "AlethFive", "anon"); - m_rpcHost.init(&m_aleth); - m_dappHost.reset(new DappHost(8081, m_aleth.web3())); - m_dappLoader = new DappLoader(this, m_aleth.web3()); - m_dappLoader->setSessionKey(m_rpcHost.sessionManager()->newSession(rpc::SessionPermissions{{rpc::Privilege::Admin}})); - connect(m_dappLoader, &DappLoader::dappReady, this, &AlethFive::dappLoaded); - connect(m_dappLoader, &DappLoader::pageReady, this, &AlethFive::pageLoaded); - connect(m_ui->webView, &QWebEngineView::urlChanged, [=](QUrl const& _url) - { - if (!m_dappHost->servesUrl(_url)) - m_ui->url->setText(_url.toString()); - }); - - m_ui->url->installEventFilter(this); - - m_backMenu = new QMenu(this); - m_ui->back->setMenu(m_backMenu); - - QMenu* popupMenu = new QMenu(this); - popupMenu->addAction("Exit", qApp, SLOT(quit())); - m_ui->menu->setMenu(popupMenu); - - readSettings(); - refresh(); -} - -AlethFive::~AlethFive() -{ - writeSettings(); - delete m_ui; -} - -void AlethFive::refresh() -{ -} - -void AlethFive::readSettings() -{ - QSettings s("ethereum", "alethfive"); - enterDestination(s.value("url", "eth://wallet").toString()); -} - -void AlethFive::writeSettings() -{ - QSettings s("ethereum", "alethfive"); - s.setValue("url", m_history.back().first); -} - -void AlethFive::rebuildBack() -{ - m_backMenu->clear(); - for (int i = m_history.size() - 2; i >= 0; --i) - connect(m_backMenu->addAction(m_history[i].first), &QAction::triggered, [=]() - { - navigateTo(m_history[i].second); - m_history = m_history.mid(0, i); - rebuildBack(); - }); -} - -void AlethFive::on_url_returnPressed() -{ - enterDestination(m_ui->url->text()); -} - -void AlethFive::enterDestination(QString _url) -{ - m_ui->webView->page()->setContent(""); - navigateTo(_url); - m_history += QPair(_url, _url); - rebuildBack(); - updateURLBox(); -} - -void AlethFive::updateURLBox() -{ - if (m_ui->url->hasFocus()) - { - m_ui->url->setText(m_history.back().first); - m_ui->url->setAlignment(Qt::AlignLeft | Qt::AlignVCenter); - m_ui->url->setReadOnly(false); - m_ui->url->setStyleSheet(""); - } - else - { - m_ui->url->setText(m_history.back().second); - m_ui->url->setAlignment(Qt::AlignCenter | Qt::AlignVCenter); - m_ui->url->setReadOnly(true); - m_ui->url->setStyleSheet("font-weight: bold; background: #dfd"); - } -} - -bool AlethFive::eventFilter(QObject* _o, QEvent* _e) -{ - if (_o == m_ui->url && (_e->type() == QEvent::FocusIn || _e->type() == QEvent::FocusOut)) - updateURLBox(); - return false; -} - -void AlethFive::navigateTo(QString _url) -{ - QUrl url(_url); - if (url.scheme().isEmpty() || url.scheme() == "eth" || url.path().endsWith(".dapp")) - { - try - { - //try do resolve dapp url - m_dappLoader->loadDapp(_url); - return; - } - catch (...) - { - qWarning() << boost::current_exception_diagnostic_information().c_str(); - } - } - - if (url.scheme().isEmpty()) - if (url.path().indexOf('/') < url.path().indexOf('.')) - url.setScheme("file"); - else - url.setScheme("http"); - else {} - m_dappLoader->loadPage(url.toString()); -} - -void AlethFive::dappLoaded(Dapp& _dapp) -{ - m_ui->webView->page()->setUrl(m_dappHost->hostDapp(std::move(_dapp))); -} - -void AlethFive::pageLoaded(QByteArray _content, QString _mimeType, QUrl _uri) -{ - m_ui->webView->page()->setContent(_content, _mimeType, _uri); - if (!m_ui->webView->page()->title().isEmpty()) - m_history.back().second = m_ui->webView->page()->title(); - rebuildBack(); - updateURLBox(); -} diff --git a/alethfive/AlethFive.h b/alethfive/AlethFive.h deleted file mode 100644 index dc960d2..0000000 --- a/alethfive/AlethFive.h +++ /dev/null @@ -1,81 +0,0 @@ -/* - 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 . -*/ -/** @file AlethFive.h - * @author Gav Wood - * @date 2015 - */ - -#pragma once - -#include -#include -#include -#include -#include - -namespace Ui { -class AlethFive; -} - -namespace dev -{ -namespace aleth -{ -namespace five -{ - -class AlethFive: public QMainWindow -{ - Q_OBJECT - -public: - AlethFive(); - ~AlethFive(); - -private slots: - void dappLoaded(Dapp& _dapp); - void pageLoaded(QByteArray _content, QString _mimeType, QUrl _uri); - void navigateTo(QString _url); - void enterDestination(QString _url); - - void on_url_returnPressed(); - - void updateURLBox(); - -private: - void refresh(); - void rebuildBack(); - - void readSettings(); - void writeSettings(); - - bool eventFilter(QObject* _o, QEvent* _e) override; - - Ui::AlethFive* m_ui; - QMenu* m_backMenu; - Aleth m_aleth; - RPCHost m_rpcHost; - - QList> m_history; - - std::unique_ptr m_dappHost; - DappLoader* m_dappLoader = nullptr; -}; - -} -} -} diff --git a/alethfive/AlethFive.png b/alethfive/AlethFive.png deleted file mode 100644 index 88a53e7..0000000 Binary files a/alethfive/AlethFive.png and /dev/null differ diff --git a/alethfive/AlethFive.ui b/alethfive/AlethFive.ui deleted file mode 100644 index 7fa7161..0000000 --- a/alethfive/AlethFive.ui +++ /dev/null @@ -1,258 +0,0 @@ - - - AlethFive - - - - 0 - 0 - 843 - 733 - - - - AV - - - Qt::LeftToRight - - - QMainWindow{ -background: #eee; -} -* { -color: #444; -} -QRadioButton { -padding: 3px; -} -QRadioButton::indicator { -width: 18px; -height: 18px; -border: 2.1px solid #cacaca; -border-top: 2.2px solid #c7c7c7; -border-bottom: 2.0px solid #cccccc; -border-radius: 10px; -background-color: white -} -QRadioButton::indicator:checked { -width: 10px; -height: 10px; -border: 6.1px solid #3497ff; -border-radius: 11.1px; -background-color: white -} -QProgressBar { - height: 8px; -border-radius: 4px; -text-align: center; -background-color: #aaa; -border: 1.4px solid #bbb; -color: black; -} -QProgressBar::chunk { - background-color: #3497ff; -} - -QLineEdit { -background-color: white; -border-radius: 4px; -border-bottom: 1.1px solid #ccc; -padding: 4px; -color: #444; -} -QPushButton,QToolButton,QFrame#button{ -color: #444; -background-color: qlineargradient(spread:pad, x1:0, y1:0, x2:0, y2:1, stop:0 rgba(255, 255, 255, 255), stop:1 rgba(248, 248, 248, 255)) -} -QPushButton:pressed,QToolButton:pressed{ -color: #444; -background-color: white; -border: 1.5px solid #3497ff; -} -QPushButton{ -padding: 10px; -border-radius: 10px; -border: 1px solid #b4b4b4; -border-bottom: 1.4px solid #888; -border-top: 1px solid #c4c4c4; -} -QToolButton,QFrame#button{ -border-radius: 4px; -padding: 2px; -border: 1px solid #ddd; -border-bottom: 1.4px solid #ccc; -border-top: 1px solid #eee; -} -QToolButton:pressed{ -border: 1px solid #3497ff; -} -QFrame#button { -padding: 0px; -} -QPushButton#mining{ -qproperty-icon: url(:/power-off.png) off, url(:/power-on.png) on ; -} -QFrame#button > QToolButton { -padding: 2px; -border: 0; -} -QFrame#button > QToolButton:pressed { -border: 1px solid #3497ff; -} -QPushButton#mining:checked{ -} - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 6 - - - 9 - - - 9 - - - 9 - - - 9 - - - - - - 0 - 0 - - - - Qt::LeftArrow - - - - - - - - 0 - 0 - - - - - - - - - 0 - 0 - - - - QToolButton::InstantPopup - - - Qt::DownArrow - - - - - - - - - - 0 - 0 - - - - background :white; - - - - - - - - - 0 - 0 - - - - background: white - - - QFrame::NoFrame - - - QFrame::Raised - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 16777215 - 0 - - - - - - - - - - - - - - - - QWebEngineView - QWidget -
QWebEngineView
- 1 -
-
- - -
diff --git a/alethfive/CMakeLists.txt b/alethfive/CMakeLists.txt deleted file mode 100644 index cb1b548..0000000 --- a/alethfive/CMakeLists.txt +++ /dev/null @@ -1,19 +0,0 @@ - -set(CMAKE_INCLUDE_CURRENT_DIR ON) -file(GLOB SRC_LIST "*.cpp" "*.qrc") -file(GLOB HEADERS "*.h") -file(GLOB UI_RESOURCES "*.ui") - -eth_name(EXECUTABLE AlethFive) -eth_add_executable(${EXECUTABLE} - ICON alethfive - UI_RESOURCES ${UI_RESOURCES} alethfive.icns - WIN_RESOURCES alethfive.rc -) - -target_include_directories(${EXECUTABLE} PUBLIC ..) -set_target_properties(${EXECUTABLE} PROPERTIES AUTOUIC ON AUTOMOC ON AUTORCC ON) -target_link_libraries(${EXECUTABLE} aleth) -eth_use(${EXECUTABLE} REQUIRED Qt::Core Qt::Widgets Qt::WebEngine Qt::WebEngineWidgets Eth::ethereum) - -eth_install_executable(${EXECUTABLE}) diff --git a/alethfive/EthereumMacOSXBundleInfo.plist.in b/alethfive/EthereumMacOSXBundleInfo.plist.in deleted file mode 100644 index 684ad79..0000000 --- a/alethfive/EthereumMacOSXBundleInfo.plist.in +++ /dev/null @@ -1,38 +0,0 @@ - - - - - CFBundleDevelopmentRegion - English - CFBundleExecutable - ${MACOSX_BUNDLE_EXECUTABLE_NAME} - CFBundleGetInfoString - ${MACOSX_BUNDLE_INFO_STRING} - CFBundleIconFile - ${MACOSX_BUNDLE_ICON_FILE} - CFBundleIdentifier - ${MACOSX_BUNDLE_GUI_IDENTIFIER} - CFBundleInfoDictionaryVersion - 6.0 - CFBundleLongVersionString - ${MACOSX_BUNDLE_LONG_VERSION_STRING} - CFBundleName - ${MACOSX_BUNDLE_BUNDLE_NAME} - CFBundlePackageType - APPL - CFBundleShortVersionString - ${MACOSX_BUNDLE_SHORT_VERSION_STRING} - CFBundleSignature - ???? - CFBundleVersion - ${MACOSX_BUNDLE_BUNDLE_VERSION} - CSResourcesFileMapped - - LSRequiresCarbon - - NSHumanReadableCopyright - ${MACOSX_BUNDLE_COPYRIGHT} - NSHighResolutionCapable - - - diff --git a/alethfive/alethfive.icns b/alethfive/alethfive.icns deleted file mode 100644 index 105afb3..0000000 Binary files a/alethfive/alethfive.icns and /dev/null differ diff --git a/alethfive/alethfive.ico b/alethfive/alethfive.ico deleted file mode 100644 index acee277..0000000 Binary files a/alethfive/alethfive.ico and /dev/null differ diff --git a/alethfive/alethfive.qrc b/alethfive/alethfive.qrc deleted file mode 100644 index 7f3c7ff..0000000 --- a/alethfive/alethfive.qrc +++ /dev/null @@ -1,5 +0,0 @@ - - - AlethFive.png - - diff --git a/alethfive/alethfive.rc b/alethfive/alethfive.rc deleted file mode 100644 index 139f534..0000000 --- a/alethfive/alethfive.rc +++ /dev/null @@ -1 +0,0 @@ -APP_ICON ICON DISCARDABLE "alethfive.ico" diff --git a/alethfive/main.cpp b/alethfive/main.cpp deleted file mode 100644 index b1d2024..0000000 --- a/alethfive/main.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include "AlethFive.h" -#include - -int main(int argc, char *argv[]) -{ - QApplication a(argc, argv); - dev::aleth::five::AlethFive w; - w.show(); - - return a.exec(); -}