From fe707c0387b8b042e17780db0493575b67212d7c Mon Sep 17 00:00:00 2001 From: Douglas Pike Date: Tue, 17 Oct 2017 23:52:21 -0400 Subject: [PATCH 1/4] remove webkit for better win64 support and less wallet bloat --- src/qt/bitcoingui.cpp | 29 +- src/qt/bitcoingui.h | 6 - src/qt/blockchainpage.cpp | 61 ----- src/qt/blockchainpage.h | 45 --- src/qt/chatpage.h | 45 --- src/qt/cookiejar.cpp | 483 --------------------------------- src/qt/cookiejar.h | 147 ---------- src/qt/forms/blockchainpage.ui | 257 ------------------ src/qt/forms/forumspage.ui | 42 +-- src/qt/forumspage.cpp | 20 -- src/qt/overviewpage.cpp | 3 - src/qt/webview.cpp | 129 --------- src/qt/webview.h | 57 ---- verium-qt.pro | 64 ++--- 14 files changed, 36 insertions(+), 1352 deletions(-) delete mode 100644 src/qt/blockchainpage.cpp delete mode 100644 src/qt/blockchainpage.h delete mode 100644 src/qt/chatpage.h delete mode 100755 src/qt/cookiejar.cpp delete mode 100755 src/qt/cookiejar.h delete mode 100644 src/qt/forms/blockchainpage.ui delete mode 100644 src/qt/webview.cpp delete mode 100644 src/qt/webview.h diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index d20e4ebe9e028..38b05b4d9cb7c 100755 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -31,15 +31,11 @@ #include "guiutil.h" #include "rpcconsole.h" #include "forumspage.h" -#include "blockchainpage.h" #include "ui_forumspage.h" -#include "ui_blockchainpage.h" #include "downloader.h" #include "updatedialog.h" #include "whatsnewdialog.h" #include "rescandialog.h" -#include "cookiejar.h" -#include "webview.h" #include "JlCompress.h" #include "walletdb.h" @@ -54,6 +50,7 @@ #include #include +#include #include #include #include @@ -184,9 +181,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): // Create Forums Page forumsPage = new ForumsPage(); - // Create Blockchain Page - blockchainPage = new BlockchainPage(); - // Create Sign Message Dialog signVerifyMessageDialog = new SignVerifyMessageDialog(this); @@ -199,7 +193,6 @@ BitcoinGUI::BitcoinGUI(QWidget *parent): centralWidget->addWidget(receiveCoinsPage); centralWidget->addWidget(sendCoinsPage); centralWidget->addWidget(forumsPage); - centralWidget->addWidget(blockchainPage); setCentralWidget(centralWidget); // Create status bar @@ -408,12 +401,6 @@ void BitcoinGUI::createActions() forumsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7)); tabGroup->addAction(forumsAction); - blockchainAction = new QAction(QIcon(":/icons/blockchain"), tr("BlockChain"), this); - blockchainAction->setToolTip(tr("Explore the Verium Blockchain")); - blockchainAction->setCheckable(true); - blockchainAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_9)); - tabGroup->addAction(blockchainAction); - connect(overviewAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage())); connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); @@ -424,8 +411,6 @@ void BitcoinGUI::createActions() connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); connect(forumsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(forumsAction, SIGNAL(triggered()), this, SLOT(gotoForumsPage())); - connect(blockchainAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(blockchainAction, SIGNAL(triggered()), this, SLOT(gotoBlockchainPage())); quitAction = new QAction(QIcon(":/icons/quit"), tr("E&xit"), this); quitAction->setToolTip(tr("Quit Application")); @@ -576,7 +561,6 @@ void BitcoinGUI::createToolBars() toolbar->addAction(receiveCoinsAction); toolbar->addAction(historyAction); toolbar->addAction(forumsAction); - toolbar->addAction(blockchainAction); } void BitcoinGUI::setClientModel(ClientModel *clientModel) @@ -639,7 +623,6 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel) transactionView->setModel(walletModel); addressBookPage->setModel(walletModel->getAddressTableModel()); forumsPage->setModel(walletModel); - blockchainPage->setModel(walletModel); signVerifyMessageDialog->setModel(walletModel); @@ -1099,15 +1082,6 @@ void BitcoinGUI::gotoForumsPage() disconnect(exportAction, SIGNAL(triggered()), 0, 0); } -void BitcoinGUI::gotoBlockchainPage() -{ - blockchainAction->setChecked(true); - centralWidget->setCurrentWidget(blockchainPage); - - exportAction->setEnabled(false); - disconnect(exportAction, SIGNAL(triggered()), 0, 0); -} - void BitcoinGUI::resizeEvent(QResizeEvent *e) { if (resizeGUICalled) return; // Don't allow resizeEvent to be called twice @@ -1162,7 +1136,6 @@ void BitcoinGUI::dropEvent(QDropEvent *event) if(event->mimeData()->hasUrls()) { int nValidUrisFound = 0; - int nValidUrisFoundBit = 0; QList uris = event->mimeData()->urls(); foreach(const QUrl &uri, uris) { diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 88aa9747c87f3..77bc780d67df6 100755 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -20,9 +20,7 @@ class SignVerifyMessageDialog; class Notificator; class RPCConsole; class Downloader; -class WebView; class ForumsPage; -class BlockchainPage; QT_BEGIN_NAMESPACE class QLabel; @@ -81,7 +79,6 @@ class BitcoinGUI : public QMainWindow AddressBookPage *receiveCoinsPage; SendCoinsDialog *sendCoinsPage; ForumsPage *forumsPage; - BlockchainPage *blockchainPage; QLabel *labelEncryptionIcon; QLabel *labelBalanceIcon; @@ -103,7 +100,6 @@ class BitcoinGUI : public QMainWindow QAction *sendCoinsAction; QAction *sendBitCoinsAction; QAction *forumsAction; - QAction *blockchainAction; QAction *addressBookAction; QAction *signMessageAction; QAction *verifyMessageAction; @@ -197,8 +193,6 @@ private slots: void gotoSendCoinsPage(); /** Switch to Forums page */ void gotoForumsPage(); - /** Switch to Blockchain page */ - void gotoBlockchainPage(); void resizeGUI(); void logout(); diff --git a/src/qt/blockchainpage.cpp b/src/qt/blockchainpage.cpp deleted file mode 100644 index 9d870778a8ef8..0000000000000 --- a/src/qt/blockchainpage.cpp +++ /dev/null @@ -1,61 +0,0 @@ -#include "blockchainpage.h" -#include "ui_blockchainpage.h" - -#include "clientmodel.h" -#include "walletmodel.h" -#include "guiutil.h" -#include "guiconstants.h" -#include "util.h" -#include "cookiejar.h" -#include "webview.h" - -using namespace GUIUtil; - -BlockchainPage::BlockchainPage(QWidget *parent) : - QWidget(parent), - ui(new Ui::BlockchainPage), - walletModel(0) -{ - ui->setupUi(this); - - // Setup header and styles - if (fNoHeaders) - GUIUtil::header(this, QString("")); - else if (fSmallHeaders) - GUIUtil::header(this, QString(":images/headerBlockchainSmall")); - else - GUIUtil::header(this, QString(":images/headerBlockchain")); - this->layout()->setContentsMargins(0, HEADER_HEIGHT, 0, 0); - - CookieJar *blockchainJar = new CookieJar; - ui->webView->page()->networkAccessManager()->setCookieJar(blockchainJar); - - ui->webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); - ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); - ui->frame->setVisible(true); // Set to true to enable webView navigation buttons - connect(ui->webView->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList & )), ui->webView, SLOT(sslErrorHandler(QNetworkReply*, const QList & ))); - connect(ui->webView->page(), SIGNAL(linkClicked(QUrl)), ui->webView, SLOT(myOpenUrl(QUrl))); - - // buttons - ui->back->setDisabled(true); - ui->home->setDisabled(true); - ui->forward->setDisabled(true); - ui->webView->sendButtons(ui->back, ui->home, ui->forward); - connect(ui->back, SIGNAL(clicked()), ui->webView, SLOT(myBack())); - connect(ui->home, SIGNAL(clicked()), ui->webView, SLOT(myHome())); - connect(ui->forward, SIGNAL(clicked()), ui->webView, SLOT(myForward())); - connect(ui->reload, SIGNAL(clicked()), ui->webView, SLOT(myReload())); -} - -BlockchainPage::~BlockchainPage() -{ - delete ui; -} - -void BlockchainPage::setModel(WalletModel *model) -{ - this->walletModel = model; - - QUrl url(QString(walletUrl).append("wallet/blockchainVRM.php")); - ui->webView->myOpenUrl(url); -} diff --git a/src/qt/blockchainpage.h b/src/qt/blockchainpage.h deleted file mode 100644 index 087fc04e5bfa3..0000000000000 --- a/src/qt/blockchainpage.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef BLOCKCHAINPAGE_H -#define BLOCKCHAINPAGE_H - -#include -#include -#include -#include -#include - -namespace Ui { - class BlockchainPage; -} -class ClientModel; -class WalletModel; - -QT_BEGIN_NAMESPACE -class QModelIndex; -QT_END_NAMESPACE - -/** Trade page widget */ -class BlockchainPage : public QWidget -{ - Q_OBJECT - -public: - explicit BlockchainPage(QWidget *parent = 0); - ~BlockchainPage(); - - void setModel(ClientModel *clientModel); - void setModel(WalletModel *walletModel); - -public slots: - -// signals: - -private: - Ui::BlockchainPage *ui; - ClientModel *clientModel; - WalletModel *walletModel; - -private slots: - -}; - -#endif // BLOCKCHAINPAGE_H diff --git a/src/qt/chatpage.h b/src/qt/chatpage.h deleted file mode 100644 index cccb215314e3d..0000000000000 --- a/src/qt/chatpage.h +++ /dev/null @@ -1,45 +0,0 @@ -#ifndef CHATPAGE_H -#define CHATPAGE_H - -#include -#include -#include -#include -#include - -namespace Ui { - class ChatPage; -} -class ClientModel; -class WalletModel; - -QT_BEGIN_NAMESPACE -class QModelIndex; -QT_END_NAMESPACE - -/** Trade page widget */ -class ChatPage : public QWidget -{ - Q_OBJECT - -public: - explicit ChatPage(QWidget *parent = 0); - ~ChatPage(); - - void setModel(ClientModel *clientModel); - void setModel(WalletModel *walletModel); - -public slots: - -// signals: - -private: - Ui::ChatPage *ui; - ClientModel *clientModel; - WalletModel *walletModel; - -private slots: - -}; - -#endif // CHATPAGE_H diff --git a/src/qt/cookiejar.cpp b/src/qt/cookiejar.cpp deleted file mode 100755 index 474b5c7b846fc..0000000000000 --- a/src/qt/cookiejar.cpp +++ /dev/null @@ -1,483 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -** 20141219 : onsightit: stripped GUI components out. -****************************************************************************/ - -#include "cookiejar.h" - -#include "autosaver.h" - -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -static const unsigned int JAR_VERSION = 23; - -QDataStream &operator<<(QDataStream &stream, const QList &list) -{ - stream << JAR_VERSION; - stream << quint32(list.size()); - for (int i = 0; i < list.size(); ++i) - stream << list.at(i).toRawForm(); - return stream; -} - -QDataStream &operator>>(QDataStream &stream, QList &list) -{ - list.clear(); - - quint32 version; - stream >> version; - - if (version != JAR_VERSION) - return stream; - - quint32 count; - stream >> count; - for(quint32 i = 0; i < count; ++i) - { - QByteArray value; - stream >> value; - QList newCookies = QNetworkCookie::parseCookies(value); - if (newCookies.count() == 0 && value.length() != 0) { - qWarning() << "CookieJar: Unable to parse saved cookie:" << value; - } - for (int j = 0; j < newCookies.count(); ++j) - list.append(newCookies.at(j)); - if (stream.atEnd()) - break; - } - return stream; -} - -CookieJar::CookieJar(QObject *parent) - : QNetworkCookieJar(parent) - , m_loaded(false) - , m_saveTimer(new AutoSaver(this)) - , m_acceptCookies(AcceptOnlyFromSitesNavigatedTo) -{ -} - -CookieJar::~CookieJar() -{ - if (m_keepCookies == KeepUntilExit) - clear(); - m_saveTimer->saveIfNeccessary(); -} - -void CookieJar::clear() -{ - setAllCookies(QList()); - m_saveTimer->changeOccurred(); - emit cookiesChanged(); -} - -void CookieJar::load() -{ - if (m_loaded) - return; - // load cookies and exceptions - qRegisterMetaTypeStreamOperators >("QList"); - QSettings cookieSettings(QStandardPaths::writableLocation(QStandardPaths::DataLocation) + QLatin1String("/cookies.ini"), QSettings::IniFormat); - setAllCookies(qvariant_cast >(cookieSettings.value(QLatin1String("cookies")))); - cookieSettings.beginGroup(QLatin1String("Exceptions")); - m_exceptions_block = cookieSettings.value(QLatin1String("block")).toStringList(); - m_exceptions_allow = cookieSettings.value(QLatin1String("allow")).toStringList(); - m_exceptions_allowForSession = cookieSettings.value(QLatin1String("allowForSession")).toStringList(); - qSort(m_exceptions_block.begin(), m_exceptions_block.end()); - qSort(m_exceptions_allow.begin(), m_exceptions_allow.end()); - qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end()); - - loadSettings(); -} - -void CookieJar::loadSettings() -{ - QSettings settings; - settings.beginGroup(QLatin1String("cookies")); - QByteArray value = settings.value(QLatin1String("acceptCookies"), - QLatin1String("AcceptOnlyFromSitesNavigatedTo")).toByteArray(); - QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy")); - m_acceptCookies = acceptPolicyEnum.keyToValue(value) == -1 ? - AcceptOnlyFromSitesNavigatedTo : - static_cast(acceptPolicyEnum.keyToValue(value)); - - value = settings.value(QLatin1String("keepCookiesUntil"), QLatin1String("KeepUntilExpire")).toByteArray(); - QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy")); - m_keepCookies = keepPolicyEnum.keyToValue(value) == -1 ? - KeepUntilExpire : - static_cast(keepPolicyEnum.keyToValue(value)); - - if (m_keepCookies == KeepUntilExit) - setAllCookies(QList()); - - m_loaded = true; - emit cookiesChanged(); -} - -void CookieJar::save() -{ - if (!m_loaded) - return; - purgeOldCookies(); - QString directory = QStandardPaths::writableLocation(QStandardPaths::DataLocation); - if (directory.isEmpty()) - directory = QDir::homePath() + QLatin1String("/.cookiejar"); - if (!QFile::exists(directory)) { - QDir dir; - dir.mkpath(directory); - } - QSettings cookieSettings(directory + QLatin1String("/cookies.ini"), QSettings::IniFormat); - QList cookies = allCookies(); - for (int i = cookies.count() - 1; i >= 0; --i) { - if (cookies.at(i).isSessionCookie()) - cookies.removeAt(i); - } - cookieSettings.setValue(QLatin1String("cookies"), QVariant::fromValue >(cookies)); - cookieSettings.beginGroup(QLatin1String("Exceptions")); - cookieSettings.setValue(QLatin1String("block"), m_exceptions_block); - cookieSettings.setValue(QLatin1String("allow"), m_exceptions_allow); - cookieSettings.setValue(QLatin1String("allowForSession"), m_exceptions_allowForSession); - - // save cookie settings - QSettings settings; - settings.beginGroup(QLatin1String("cookies")); - QMetaEnum acceptPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("AcceptPolicy")); - settings.setValue(QLatin1String("acceptCookies"), QLatin1String(acceptPolicyEnum.valueToKey(m_acceptCookies))); - - QMetaEnum keepPolicyEnum = staticMetaObject.enumerator(staticMetaObject.indexOfEnumerator("KeepPolicy")); - settings.setValue(QLatin1String("keepCookiesUntil"), QLatin1String(keepPolicyEnum.valueToKey(m_keepCookies))); -} - -void CookieJar::purgeOldCookies() -{ - QList cookies = allCookies(); - if (cookies.isEmpty()) - return; - int oldCount = cookies.count(); - QDateTime now = QDateTime::currentDateTime(); - for (int i = cookies.count() - 1; i >= 0; --i) { - if (!cookies.at(i).isSessionCookie() && cookies.at(i).expirationDate() < now) - cookies.removeAt(i); - } - if (oldCount == cookies.count()) - return; - setAllCookies(cookies); - emit cookiesChanged(); -} - -QList CookieJar::cookiesForUrl(const QUrl &url) const -{ - CookieJar *that = const_cast(this); - if (!m_loaded) - that->load(); - - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) { - QList noCookies; - return noCookies; - } - - return QNetworkCookieJar::cookiesForUrl(url); -} - -bool CookieJar::setCookiesFromUrl(const QList &cookieList, const QUrl &url) -{ - if (!m_loaded) - load(); - - QWebSettings *globalSettings = QWebSettings::globalSettings(); - if (globalSettings->testAttribute(QWebSettings::PrivateBrowsingEnabled)) - return false; - - QString host = url.host(); - bool eBlock = qBinaryFind(m_exceptions_block.begin(), m_exceptions_block.end(), host) != m_exceptions_block.end(); - bool eAllow = qBinaryFind(m_exceptions_allow.begin(), m_exceptions_allow.end(), host) != m_exceptions_allow.end(); - bool eAllowSession = qBinaryFind(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end(), host) != m_exceptions_allowForSession.end(); - - bool addedCookies = false; - // pass exceptions - bool acceptInitially = (m_acceptCookies != AcceptNever); - if ((acceptInitially && !eBlock) - || (!acceptInitially && (eAllow || eAllowSession))) { - // pass url domain == cookie domain - QDateTime soon = QDateTime::currentDateTime(); - soon = soon.addDays(90); - foreach(QNetworkCookie cookie, cookieList) { - QList lst; - if (m_keepCookies == KeepUntilTimeLimit - && !cookie.isSessionCookie() - && cookie.expirationDate() > soon) { - cookie.setExpirationDate(soon); - } - lst += cookie; - if (QNetworkCookieJar::setCookiesFromUrl(lst, url)) { - addedCookies = true; - } else { - // finally force it in if wanted - if (m_acceptCookies == AcceptAlways) { - QList cookies = allCookies(); - cookies += cookie; - setAllCookies(cookies); - addedCookies = true; - } -#if 0 - else - qWarning() << "setCookiesFromUrl failed" << url << cookieList.value(0).toRawForm(); -#endif - } - } - } - - if (addedCookies) { - m_saveTimer->changeOccurred(); - emit cookiesChanged(); - } - return addedCookies; -} - -CookieJar::AcceptPolicy CookieJar::acceptPolicy() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_acceptCookies; -} - -void CookieJar::setAcceptPolicy(AcceptPolicy policy) -{ - if (!m_loaded) - load(); - if (policy == m_acceptCookies) - return; - m_acceptCookies = policy; - m_saveTimer->changeOccurred(); -} - -CookieJar::KeepPolicy CookieJar::keepPolicy() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_keepCookies; -} - -void CookieJar::setKeepPolicy(KeepPolicy policy) -{ - if (!m_loaded) - load(); - if (policy == m_keepCookies) - return; - m_keepCookies = policy; - m_saveTimer->changeOccurred(); -} - -QStringList CookieJar::blockedCookies() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_exceptions_block; -} - -QStringList CookieJar::allowedCookies() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_exceptions_allow; -} - -QStringList CookieJar::allowForSessionCookies() const -{ - if (!m_loaded) - (const_cast(this))->load(); - return m_exceptions_allowForSession; -} - -void CookieJar::setBlockedCookies(const QStringList &list) -{ - if (!m_loaded) - load(); - m_exceptions_block = list; - qSort(m_exceptions_block.begin(), m_exceptions_block.end()); - m_saveTimer->changeOccurred(); -} - -void CookieJar::setAllowedCookies(const QStringList &list) -{ - if (!m_loaded) - load(); - m_exceptions_allow = list; - qSort(m_exceptions_allow.begin(), m_exceptions_allow.end()); - m_saveTimer->changeOccurred(); -} - -void CookieJar::setAllowForSessionCookies(const QStringList &list) -{ - if (!m_loaded) - load(); - m_exceptions_allowForSession = list; - qSort(m_exceptions_allowForSession.begin(), m_exceptions_allowForSession.end()); - m_saveTimer->changeOccurred(); -} - -CookieModel::CookieModel(CookieJar *cookieJar, QObject *parent) - : QAbstractTableModel(parent) - , m_cookieJar(cookieJar) -{ - connect(m_cookieJar, SIGNAL(cookiesChanged()), this, SLOT(cookiesChanged())); - m_cookieJar->load(); -} - -QVariant CookieModel::headerData(int section, Qt::Orientation orientation, int role) const -{ - if (role == Qt::SizeHintRole) { - QFont font; - font.setPointSize(10); - QFontMetrics fm(font); - int height = fm.height() + fm.height()/3; - int width = fm.width(headerData(section, orientation, Qt::DisplayRole).toString()); - return QSize(width, height); - } - - if (orientation == Qt::Horizontal) { - if (role != Qt::DisplayRole) - return QVariant(); - - switch (section) { - case 0: - return tr("Website"); - case 1: - return tr("Name"); - case 2: - return tr("Path"); - case 3: - return tr("Secure"); - case 4: - return tr("Expires"); - case 5: - return tr("Contents"); - default: - return QVariant(); - } - } - return QAbstractTableModel::headerData(section, orientation, role); -} - -QVariant CookieModel::data(const QModelIndex &index, int role) const -{ - QList lst; - if (m_cookieJar) - lst = m_cookieJar->allCookies(); - if (index.row() < 0 || index.row() >= lst.size()) - return QVariant(); - - switch (role) { - case Qt::DisplayRole: - case Qt::EditRole: { - QNetworkCookie cookie = lst.at(index.row()); - switch (index.column()) { - case 0: - return cookie.domain(); - case 1: - return cookie.name(); - case 2: - return cookie.path(); - case 3: - return cookie.isSecure(); - case 4: - return cookie.expirationDate(); - case 5: - return cookie.value(); - } - } - case Qt::FontRole:{ - QFont font; - font.setPointSize(10); - return font; - } - } - - return QVariant(); -} - -int CookieModel::columnCount(const QModelIndex &parent) const -{ - return (parent.isValid()) ? 0 : 6; -} - -int CookieModel::rowCount(const QModelIndex &parent) const -{ - return (parent.isValid() || !m_cookieJar) ? 0 : m_cookieJar->allCookies().count(); -} - -bool CookieModel::removeRows(int row, int count, const QModelIndex &parent) -{ - if (parent.isValid() || !m_cookieJar) - return false; - int lastRow = row + count - 1; - beginRemoveRows(parent, row, lastRow); - QList lst = m_cookieJar->allCookies(); - for (int i = lastRow; i >= row; --i) { - lst.removeAt(i); - } - m_cookieJar->setAllCookies(lst); - endRemoveRows(); - return true; -} - -void CookieModel::cookiesChanged() -{ - beginResetModel(); - endResetModel(); -} diff --git a/src/qt/cookiejar.h b/src/qt/cookiejar.h deleted file mode 100755 index 12c5f8b9f5540..0000000000000 --- a/src/qt/cookiejar.h +++ /dev/null @@ -1,147 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/legal -** -** This file is part of the demonstration applications of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and Digia. For licensing terms and -** conditions see http://qt.digia.com/licensing. For further information -** use the contact form at http://qt.digia.com/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Digia gives you certain additional -** rights. These rights are described in the Digia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3.0 as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU General Public License version 3.0 requirements will be -** met: http://www.gnu.org/copyleft/gpl.html. -** -** -** $QT_END_LICENSE$ -** -** 20141219 : onsightit: stripped GUI components out. -****************************************************************************/ - -#ifndef COOKIEJAR_H -#define COOKIEJAR_H - -#include - -#include -#include - -#include -#include - -class QSortFilterProxyModel; -class QKeyEvent; - -class AutoSaver; - -class CookieJar : public QNetworkCookieJar -{ - friend class CookieModel; - Q_OBJECT - Q_PROPERTY(AcceptPolicy acceptPolicy READ acceptPolicy WRITE setAcceptPolicy) - Q_PROPERTY(KeepPolicy keepPolicy READ keepPolicy WRITE setKeepPolicy) - Q_PROPERTY(QStringList blockedCookies READ blockedCookies WRITE setBlockedCookies) - Q_PROPERTY(QStringList allowedCookies READ allowedCookies WRITE setAllowedCookies) - Q_PROPERTY(QStringList allowForSessionCookies READ allowForSessionCookies WRITE setAllowForSessionCookies) - Q_ENUMS(KeepPolicy) - Q_ENUMS(AcceptPolicy) - -signals: - void cookiesChanged(); - -public: - enum AcceptPolicy { - AcceptAlways, - AcceptNever, - AcceptOnlyFromSitesNavigatedTo - }; - - enum KeepPolicy { - KeepUntilExpire, - KeepUntilExit, - KeepUntilTimeLimit - }; - - CookieJar(QObject *parent = 0); - ~CookieJar(); - - QList cookiesForUrl(const QUrl &url) const; - bool setCookiesFromUrl(const QList &cookieList, const QUrl &url); - - AcceptPolicy acceptPolicy() const; - void setAcceptPolicy(AcceptPolicy policy); - - KeepPolicy keepPolicy() const; - void setKeepPolicy(KeepPolicy policy); - - QStringList blockedCookies() const; - QStringList allowedCookies() const; - QStringList allowForSessionCookies() const; - - void setBlockedCookies(const QStringList &list); - void setAllowedCookies(const QStringList &list); - void setAllowForSessionCookies(const QStringList &list); - -public slots: - void clear(); - void loadSettings(); - -private slots: - void save(); - -private: - void purgeOldCookies(); - void load(); - bool m_loaded; - AutoSaver *m_saveTimer; - - AcceptPolicy m_acceptCookies; - KeepPolicy m_keepCookies; - - QStringList m_exceptions_block; - QStringList m_exceptions_allow; - QStringList m_exceptions_allowForSession; -}; - -class CookieModel : public QAbstractTableModel -{ - Q_OBJECT - -public: - CookieModel(CookieJar *jar, QObject *parent = 0); - QVariant headerData(int section, Qt::Orientation orientation, int role) const; - QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const; - int columnCount(const QModelIndex &parent = QModelIndex()) const; - int rowCount(const QModelIndex &parent = QModelIndex()) const; - bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()); - -private slots: - void cookiesChanged(); - -private: - CookieJar *m_cookieJar; -}; - -#endif // COOKIEJAR_H diff --git a/src/qt/forms/blockchainpage.ui b/src/qt/forms/blockchainpage.ui deleted file mode 100644 index 884e78345f270..0000000000000 --- a/src/qt/forms/blockchainpage.ui +++ /dev/null @@ -1,257 +0,0 @@ - - - BlockchainPage - - - - 0 - 0 - 1024 - 768 - - - - Form - - - false - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - 0 - - - - - 0 - 0 - - - - - about:blank - - - - - - - - - 0 - 0 - - - - - 0 - 40 - - - - Qt::LeftToRight - - - false - - - QFrame::NoFrame - - - QFrame::Raised - - - - 10 - - - 0 - - - 10 - - - 0 - - - 10 - - - 0 - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Back - - - - :/icons/back:/icons/back - - - - 12 - 12 - - - - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Reload - - - - :/icons/reload:/icons/reload - - - - 12 - 12 - - - - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Home - - - - :/icons/home:/icons/home - - - - 12 - 12 - - - - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Forward - - - - :/icons/forward:/icons/forward - - - - 12 - 12 - - - - - - - - - - - - WebView - QWidget -
webview.h
-
-
- - - - -
diff --git a/src/qt/forms/forumspage.ui b/src/qt/forms/forumspage.ui index 73406cbf02182..747071d1549c9 100644 --- a/src/qt/forms/forumspage.ui +++ b/src/qt/forms/forumspage.ui @@ -32,28 +32,7 @@ 0 - - - - - 0 - 0 - - - - - 0 - 0 - - - - - about:blank - - - - - + @@ -122,7 +101,7 @@ Back - + :/icons/back:/icons/back @@ -157,7 +136,7 @@ Reload - + :/icons/reload:/icons/reload @@ -192,7 +171,7 @@ Home - + :/icons/home:/icons/home @@ -227,7 +206,7 @@ Forward - + :/icons/forward:/icons/forward @@ -243,13 +222,8 @@ - - - WebView - QWidget -
webview.h
-
-
- + + + diff --git a/src/qt/forumspage.cpp b/src/qt/forumspage.cpp index 10e80b9ba7b0f..f48e5a1816b3e 100644 --- a/src/qt/forumspage.cpp +++ b/src/qt/forumspage.cpp @@ -1,13 +1,10 @@ #include "forumspage.h" #include "ui_forumspage.h" - #include "clientmodel.h" #include "walletmodel.h" #include "guiutil.h" #include "guiconstants.h" #include "util.h" -#include "cookiejar.h" -#include "webview.h" using namespace GUIUtil; @@ -27,24 +24,10 @@ ForumsPage::ForumsPage(QWidget *parent) : GUIUtil::header(this, QString(":images/headerForums")); this->layout()->setContentsMargins(0, HEADER_HEIGHT, 0, 0); - CookieJar *forumsJar = new CookieJar; - ui->webView->page()->networkAccessManager()->setCookieJar(forumsJar); - - ui->webView->page()->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAsNeeded); - ui->webView->page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); - ui->frame->setVisible(true); // Set to true to enable webView navigation buttons - connect(ui->webView->page()->networkAccessManager(), SIGNAL(sslErrors(QNetworkReply*, const QList & )), ui->webView, SLOT(sslErrorHandler(QNetworkReply*, const QList & ))); - connect(ui->webView->page(), SIGNAL(linkClicked(QUrl)), ui->webView, SLOT(myOpenUrl(QUrl))); - // buttons ui->back->setDisabled(true); ui->home->setDisabled(true); ui->forward->setDisabled(true); - ui->webView->sendButtons(ui->back, ui->home, ui->forward); - connect(ui->back, SIGNAL(clicked()), ui->webView, SLOT(myBack())); - connect(ui->home, SIGNAL(clicked()), ui->webView, SLOT(myHome())); - connect(ui->forward, SIGNAL(clicked()), ui->webView, SLOT(myForward())); - connect(ui->reload, SIGNAL(clicked()), ui->webView, SLOT(myReload())); } ForumsPage::~ForumsPage() @@ -55,7 +38,4 @@ ForumsPage::~ForumsPage() void ForumsPage::setModel(WalletModel *model) { this->walletModel = model; - - QUrl url(QString(walletUrl).append("wallet/forums2.php")); - ui->webView->myOpenUrl(url); } diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 68056a4163a97..36558300f1723 100755 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -7,7 +7,6 @@ #include "walletmodel.h" #include "clientmodel.h" #include "bitcoinunits.h" -#include "cookiejar.h" #include "optionsmodel.h" #include "transactiontablemodel.h" #include "transactionfilterproxy.h" @@ -15,13 +14,11 @@ #include "guiconstants.h" #include "bitcoingui.h" #include "bitcoinrpc.h" -#include "webview.h" #include #include #include #include -#include #include using namespace GUIUtil; diff --git a/src/qt/webview.cpp b/src/qt/webview.cpp deleted file mode 100644 index a32bc8fcb8c46..0000000000000 --- a/src/qt/webview.cpp +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Qt5 webview naviagation - * - * Developed by OnsightIT 2014-2015 - * onsightit@gmail.com - */ -#include "webview.h" -#include "util.h" - -#include -#include -#include -#include -#include - -using namespace std; - -WebView::WebView(QWidget *parent) : - QWebView(parent) -{ - trustedUrls << "www.vericoin.info" << "vericoin.info"; // These will get appended to by the values in VERSION.json - fTrustedUrlsSet = false; -} - -WebView::~WebView() -{ -} - -// Receives web nav buttons from parent webview -void WebView::sendButtons(QPushButton *bb, QPushButton *hb, QPushButton *fb) -{ - // Get the addresses of the nav buttons - backButton = bb; - homeButton = hb; - forwardButton = fb; -} - -void WebView::myBack() -{ - if (this->history()->currentItemIndex() > 1) // 0 is a blank page - { - this->back(); - } - setButtonStates((this->history()->currentItemIndex() > 1), (this->history()->currentItemIndex() > 1), this->history()->canGoForward()); -} - -void WebView::myHome() -{ - if ((this->history()->currentItemIndex() > 1)) - { - this->history()->goToItem(this->history()->itemAt(1)); // 0 is a blank page - } - setButtonStates((this->history()->currentItemIndex() > 1), (this->history()->currentItemIndex() > 1), this->history()->canGoForward()); -} - -void WebView::myForward() -{ - if (this->history()->canGoForward()) - { - this->forward(); - } - setButtonStates((this->history()->currentItemIndex() > 1), (this->history()->currentItemIndex() > 1), this->history()->canGoForward()); -} - -void WebView::myReload() -{ - this->reload(); -} - -void WebView::myOpenUrl(QUrl url) -{ - if (!fTrustedUrlsSet) - { - std::string urls = GetArg("-vTrustedUrls", ""); - typedef vector parts_type; - parts_type parts; - boost::split(parts, urls, boost::is_any_of(",; "), boost::token_compress_on); - for (vector::iterator it = parts.begin(); it != parts.end(); ++it) - { - QString url = QString::fromStdString(*it); - // Sanity check the url - if (url.contains(QChar('.'))) - { - trustedUrls << url; - if (!fTrustedUrlsSet) - fTrustedUrlsSet = true; - } - } - } - - if (isTrustedUrl(url)) - { - try - { - this->load(url); - } - catch (...) - { - printf("WebView: Error loading: %s\n", url.toString().toStdString().c_str()); - } - // This uses canGoBack() and currentItemIndex > 0 as opposed to currentItemIndex > 1 like the other setButtonStates calls. - setButtonStates(this->history()->canGoBack(), (this->history()->currentItemIndex() > 0), this->history()->canGoForward()); - } - else - { - QDesktopServices::openUrl(url); - } -} - -// Set button enabled/disabled states -void WebView::setButtonStates(bool canGoBack, bool canGoHome, bool canGoForward) -{ - backButton->setEnabled(canGoBack); - homeButton->setEnabled(canGoHome); - forwardButton->setEnabled(canGoForward); -} - -bool WebView::isTrustedUrl(QUrl url) -{ - if (trustedUrls.contains(url.host())) - return true; - else - return false; -} - -void WebView::sslErrorHandler(QNetworkReply* qnr, const QList & errlist) -{ - qnr->ignoreSslErrors(); -} diff --git a/src/qt/webview.h b/src/qt/webview.h deleted file mode 100644 index 0d7adad1d6a73..0000000000000 --- a/src/qt/webview.h +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Qt5 webview naviagation - * - * Developed by OnsightIT 2014-2015 - * onsightit@gmail.com - */ -#ifndef WEBVIEW_H -#define WEBVIEW_H - -#include -#include -#include -#include -#include -#include -#include -#include - -namespace Ui { -class WebView; -} - -class WebView : public QWebView -{ - Q_OBJECT - -public: - explicit WebView(QWidget *parent = 0); - ~WebView(); - - // Receives web nav buttons from parent webview - void sendButtons(QPushButton *bb, QPushButton *hb, QPushButton *fb); - -public slots: - void myBack(); - void myHome(); - void myForward(); - void myReload(); - void myOpenUrl(QUrl url); - bool isTrustedUrl(QUrl url); - void sslErrorHandler(QNetworkReply* qnr, const QList & errlist); - -private: - Ui::WebView *ui; - - bool fTrustedUrlsSet; - QPushButton *backButton; - QPushButton *homeButton; - QPushButton *forwardButton; - - // Set button enabled/disabled states - void setButtonStates(bool canGoBack, bool canGoHome, bool canGoForward); - - QList trustedUrls; -}; - -#endif // WEBVIEW_H diff --git a/verium-qt.pro b/verium-qt.pro index 4c95b3b94fcf4..6cd26a5a2d8c9 100755 --- a/verium-qt.pro +++ b/verium-qt.pro @@ -4,19 +4,16 @@ VERSION = 1.1 INCLUDEPATH += src src/json src/qt DEFINES += QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE __STDC_FORMAT_MACROS __STDC_LIMIT_MACROS CONFIG += no_include_pwd thread release -USE_QRCODE = 1 -USE_AVX = 1 -USE_AVX2 = 0 - -!win32{ CONFIG += static -} -QT += network webkit +QT += network widgets core gui greaterThan(QT_MAJOR_VERSION, 4) { - QT += webkitwidgets - DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 + DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0 } +USE_QRCODE = 1 +USE_AVX = 1 +USE_AVX2 = 0 + # Profiling on linux # Download, build and install: libunwind and gperftools # Include the profiler header "gperftools/profiler.h" in the code to profile @@ -28,7 +25,7 @@ greaterThan(QT_MAJOR_VERSION, 4) { # Then run: # pprof --gv ./verium-qt verium-qt.prof PROFILE = 0 -!macx:!win32:contains(PROFILE, 1) { +!macx:!windows:contains(PROFILE, 1) { DEFINES += PROFILER PROFILER_INCLUDE_PATH=/usr/local/include/gperftools PROFILER_LIB_PATH=-L/usr/local/lib -lprofiler @@ -39,8 +36,8 @@ LIBS += $$UNWIND_LIB_PATH $$PROFILER_LIB_PATH # for boost 1.37, add -mt to the boost libraries # use: qmake BOOST_LIB_SUFFIX=-mt -# for boost thread win32 with _win32 sufix -# use: BOOST_THREAD_LIB_SUFFIX=_win32-... +# for boost thread windows with _windows sufix +# use: BOOST_THREAD_LIB_SUFFIX=_windows-... # or when linking against a specific BerkelyDB version: BDB_LIB_SUFFIX=-4.8 # Dependency library locations can be customized with: @@ -49,7 +46,7 @@ LIBS += $$UNWIND_LIB_PATH $$PROFILER_LIB_PATH # win build dependencies -win32 { +windows { lessThan(QT_VERSION, 5.4) { BOOST_LIB_SUFFIX=-mgw48-mt-s-1_55 } else { @@ -103,7 +100,7 @@ contains(RELEASE, 1) { } } -!win32 { +!windows { # for extra security against potential buffer overflows: enable GCCs Stack Smashing Protection QMAKE_CXXFLAGS *= -fstack-protector-all --param ssp-buffer-size=1 QMAKE_LFLAGS *= -fstack-protector-all --param ssp-buffer-size=1 -Wl,-rpath,./libs @@ -111,8 +108,8 @@ QMAKE_LFLAGS *= -fstack-protector-all --param ssp-buffer-size=1 -Wl,-rpath,./lib # This can be enabled for Windows, when we switch to MinGW >= 4.4.x. } # for extra security on Windows: enable ASLR and DEP via GCC linker flags -win32:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -#win32:QMAKE_LFLAGS += -static-libgcc -static-libstdc++ +windows:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware +#windows:QMAKE_LFLAGS += -static-libgcc -static-libstdc++ # use: qmake "USE_QRCODE=1" # libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support @@ -136,7 +133,7 @@ contains(USE_UPNP, -) { DEFINES += USE_UPNP=$$USE_UPNP STATICLIB INCLUDEPATH += $$MINIUPNPC_INCLUDE_PATH LIBS += $$join(MINIUPNPC_LIB_PATH,,-L,) -lminiupnpc - win32:LIBS += -liphlpapi + windows:LIBS += -liphlpapi } # use: qmake "USE_DBUS=1" @@ -177,7 +174,7 @@ contains(BITCOIN_NEED_QT_PLUGINS, 1) { INCLUDEPATH += src/leveldb/include src/leveldb/helpers LIBS += $$PWD/src/leveldb/libleveldb.a $$PWD/src/leveldb/libmemenv.a SOURCES += src/txdb-leveldb.cpp -!win32 { +!windows { # we use QMAKE_CXXFLAGS_RELEASE even without RELEASE=1 because we use RELEASE to indicate linking preferences not -O preferences genleveldb.commands = cd $$PWD/src/leveldb && CC=$$QMAKE_CC CXX=$$QMAKE_CXX $(MAKE) OPT=\"$$QMAKE_CXXFLAGS $$QMAKE_CXXFLAGS_RELEASE\" libleveldb.a libmemenv.a } else { @@ -200,18 +197,18 @@ INCLUDEPATH += $$PWD/src/quazip DEPENDPATH += $$PWD/src/quazip DEFINES += QUAZIP_STATIC -win32:CONFIG(release, debug|release): LIBS += -L$$PWD/src/quazip/release/ -lquazip -lz -else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/src/quazip/debug/ -lquazip -lz +windows:CONFIG(release, debug|release): LIBS += -L$$PWD/src/quazip/release/ -lquazip -lz +else:windows:CONFIG(debug, debug|release): LIBS += -L$$PWD/src/quazip/debug/ -lquazip -lz else: LIBS += -L$$PWD/src/quazip/ -lquazip -lz -win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/libquazip.a -else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/libquazip.a -else:win32:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/quazip.lib -else:win32:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/quazip.lib +windows-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/libquazip.a +else:windows-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/libquazip.a +else:windows:!windows-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/quazip.lib +else:windows:!windows-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/quazip.lib else: PRE_TARGETDEPS += $$PWD/src/quazip/libquazip.a -win32:CONFIG(release, debug|release): QUAZIPLIB=release -else:win32:CONFIG(debug, debug|release): QUAZIPLIB=debug +windows:CONFIG(release, debug|release): QUAZIPLIB=release +else:windows:CONFIG(debug, debug|release): QUAZIPLIB=debug else: QUAZIPLIB= genquazip.commands = cd $$PWD/src/quazip && qmake quazip.pro && $(MAKE) @@ -321,7 +318,6 @@ HEADERS += src/qt/bitcoingui.h \ src/qt/askpassphrasedialog.h \ src/qt/askpassphrasepage.h \ src/qt/forumspage.h \ - src/qt/blockchainpage.h \ src/protocol.h \ src/qt/notificator.h \ src/qt/qtipcserver.h \ @@ -333,10 +329,8 @@ HEADERS += src/qt/bitcoingui.h \ src/clientversion.h \ src/qt/downloader.h \ src/qt/updatedialog.h \ - src/qt/cookiejar.h \ src/qt/autosaver.h \ src/qt/rescandialog.h \ - src/qt/webview.h \ src/qt/postdialog.h \ src/qt/whatsnewdialog.h @@ -406,12 +400,9 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \ src/qt/downloader.cpp \ src/qt/updatedialog.cpp \ src/qt/rescandialog.cpp \ - src/qt/cookiejar.cpp \ src/qt/autosaver.cpp \ src/qt/forumspage.cpp \ - src/qt/blockchainpage.cpp \ src/noui.cpp \ - src/qt/webview.cpp \ src/qt/postdialog.cpp \ src/qt/whatsnewdialog.cpp \ src/scrypt.cpp \ @@ -429,7 +420,6 @@ FORMS += \ src/qt/forms/coincontroldialog.ui \ src/qt/forms/sendcoinsdialog.ui \ src/qt/forms/forumspage.ui \ - src/qt/forms/blockchainpage.ui \ src/qt/forms/addressbookpage.ui \ src/qt/forms/signverifymessagedialog.ui \ src/qt/forms/aboutdialog.ui \ @@ -461,7 +451,7 @@ CODECFORTR = UTF-8 TRANSLATIONS = $$files(src/qt/locale/bitcoin_*.ts) isEmpty(QMAKE_LRELEASE) { - win32:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe + windows:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]\\lrelease.exe else:QMAKE_LRELEASE = $$[QT_INSTALL_BINS]/lrelease } isEmpty(QM_DIR):QM_DIR = $$PWD/src/qt/locale @@ -484,7 +474,7 @@ isEmpty(BOOST_LIB_SUFFIX) { } isEmpty(BOOST_THREAD_LIB_SUFFIX) { - win32:BOOST_THREAD_LIB_SUFFIX = $$BOOST_LIB_SUFFIX + windows:BOOST_THREAD_LIB_SUFFIX = $$BOOST_LIB_SUFFIX else:BOOST_THREAD_LIB_SUFFIX = $$BOOST_LIB_SUFFIX } @@ -508,11 +498,11 @@ isEmpty(BOOST_INCLUDE_PATH) { macx:BOOST_INCLUDE_PATH = /opt/local/include } -windows:DEFINES += WIN32 +windows:DEFINES += windows windows:RC_FILE = src/qt/res/bitcoin-qt.rc windows:!contains(MINGW_THREAD_BUGFIX, 0) { - # At least qmake's win32-g++-cross profile is missing the -lmingwthrd + # At least qmake's windows-g++-cross profile is missing the -lmingwthrd # thread-safety flag. GCC has -mthreads to enable this, but it doesn't # work with static linking. -lmingwthrd must come BEFORE -lmingw, so # it is prepended to QMAKE_LIBS_QT_ENTRY. From d9c510c23b3afc6e05ef4516c48ce51555de0467 Mon Sep 17 00:00:00 2001 From: effectsToCause Date: Wed, 18 Oct 2017 15:40:49 -0400 Subject: [PATCH 2/4] fix win32 flags when referring to g++ --- verium-qt.pro | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/verium-qt.pro b/verium-qt.pro index 6cd26a5a2d8c9..6bbc36c64c2f5 100755 --- a/verium-qt.pro +++ b/verium-qt.pro @@ -109,7 +109,7 @@ QMAKE_LFLAGS *= -fstack-protector-all --param ssp-buffer-size=1 -Wl,-rpath,./lib } # for extra security on Windows: enable ASLR and DEP via GCC linker flags windows:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -#windows:QMAKE_LFLAGS += -static-libgcc -static-libstdc++ +windows:QMAKE_LFLAGS += -static-libgcc -static-libstdc++ # use: qmake "USE_QRCODE=1" # libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support @@ -201,10 +201,10 @@ windows:CONFIG(release, debug|release): LIBS += -L$$PWD/src/quazip/release/ -lqu else:windows:CONFIG(debug, debug|release): LIBS += -L$$PWD/src/quazip/debug/ -lquazip -lz else: LIBS += -L$$PWD/src/quazip/ -lquazip -lz -windows-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/libquazip.a -else:windows-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/libquazip.a -else:windows:!windows-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/quazip.lib -else:windows:!windows-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/quazip.lib +win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/libquazip.a +else:win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/libquazip.a +else:windows:!win32-g++:CONFIG(release, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/release/quazip.lib +else:windows:!win32-g++:CONFIG(debug, debug|release): PRE_TARGETDEPS += $$PWD/src/quazip/debug/quazip.lib else: PRE_TARGETDEPS += $$PWD/src/quazip/libquazip.a windows:CONFIG(release, debug|release): QUAZIPLIB=release @@ -498,7 +498,7 @@ isEmpty(BOOST_INCLUDE_PATH) { macx:BOOST_INCLUDE_PATH = /opt/local/include } -windows:DEFINES += windows +windows:DEFINES += WIN32 windows:RC_FILE = src/qt/res/bitcoin-qt.rc windows:!contains(MINGW_THREAD_BUGFIX, 0) { From 454f5d84c017375bc2936cdd35a45478d7bb2372 Mon Sep 17 00:00:00 2001 From: effectsToCause Date: Wed, 18 Oct 2017 15:48:21 -0400 Subject: [PATCH 3/4] add static flag for windows --- verium-qt.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/verium-qt.pro b/verium-qt.pro index 6bbc36c64c2f5..f3e2679b3afd2 100755 --- a/verium-qt.pro +++ b/verium-qt.pro @@ -108,7 +108,7 @@ QMAKE_LFLAGS *= -fstack-protector-all --param ssp-buffer-size=1 -Wl,-rpath,./lib # This can be enabled for Windows, when we switch to MinGW >= 4.4.x. } # for extra security on Windows: enable ASLR and DEP via GCC linker flags -windows:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware +windows:QMAKE_LFLAGS *= -Wl,--dynamicbase -Wl,--nxcompat -Wl,--large-address-aware -static windows:QMAKE_LFLAGS += -static-libgcc -static-libstdc++ # use: qmake "USE_QRCODE=1" From 76a3f9354efa4a439066cd6f7405ecaf9e4d4c37 Mon Sep 17 00:00:00 2001 From: Douglas Pike Date: Wed, 18 Oct 2017 23:19:42 -0400 Subject: [PATCH 4/4] support tab --- .gitignore | 2 + src/qt/bitcoingui.cpp | 20 +- src/qt/bitcoingui.h | 4 - src/qt/forms/aboutdialog.ui | 2 +- src/qt/forms/forumspage.ui | 490 ++++++++++++++++++++++-------------- src/qt/forumspage.cpp | 27 +- src/qt/forumspage.h | 4 + 7 files changed, 334 insertions(+), 215 deletions(-) diff --git a/.gitignore b/.gitignore index c65c6d34abf0f..77997822f8a22 100755 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,8 @@ build debug release +.gitignore +.gitattributes src/*.exe src/verium src/veriumd diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 38b05b4d9cb7c..65121ffef213b 100755 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -395,8 +395,8 @@ void BitcoinGUI::createActions() historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4)); tabGroup->addAction(historyAction); - forumsAction = new QAction(QIcon(":/icons/forums"), tr("Community"), this); - forumsAction->setToolTip(tr("Join the Verium Community\nGet the Latest News")); + forumsAction = new QAction(QIcon(":/icons/chat"), tr("Support"), this); + forumsAction->setToolTip(tr("Get Support and connect with community")); forumsAction->setCheckable(true); forumsAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7)); tabGroup->addAction(forumsAction); @@ -455,10 +455,6 @@ void BitcoinGUI::createActions() verifyMessageAction = new QAction(QIcon(":/icons/verify"), tr("&Verify Message"), this); checkForUpdateAction = new QAction(QIcon(":/icons/update"), tr("Check For &Update"), this); checkForUpdateAction->setToolTip(tr("Check for a new version of the wallet and update.")); - forumAction = new QAction(QIcon(":/icons/bitcoin"), tr("Verium &Forums"), this); - forumAction->setToolTip(tr("Go to the Verium forums.")); - webAction = new QAction(QIcon(":/icons/site"), tr("www.veriumreserve.com"), this); - webAction->setToolTip(tr("Go to Verium website.")); exportAction = new QAction(QIcon(":/icons/export"), tr("&Export Data"), this); exportAction->setToolTip(tr("Export the data in the current tab to a file")); @@ -485,8 +481,6 @@ void BitcoinGUI::createActions() connect(signMessageAction, SIGNAL(triggered()), this, SLOT(gotoSignMessageTab())); connect(verifyMessageAction, SIGNAL(triggered()), this, SLOT(gotoVerifyMessageTab())); connect(checkForUpdateAction, SIGNAL(triggered()), this, SLOT(menuCheckForUpdate())); - connect(forumAction, SIGNAL(triggered()), this, SLOT(forumClicked())); - connect(webAction, SIGNAL(triggered()), this, SLOT(webClicked())); // Disable on testnet if (fTestNet) @@ -697,16 +691,6 @@ void BitcoinGUI::optionsClicked() setBalanceLabel(walletModel->getBalance(), walletModel->getUnconfirmedBalance(), walletModel->getImmatureBalance()); } -void BitcoinGUI::forumClicked() -{ - QDesktopServices::openUrl(QUrl(forumsUrl)); -} - -void BitcoinGUI::webClicked() -{ - QDesktopServices::openUrl(QUrl(walletUrl)); -} - void BitcoinGUI::aboutClicked() { AboutDialog dlg; diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 77bc780d67df6..b380bf903c941 100755 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -205,10 +205,6 @@ private slots: /** Show configuration dialog */ void optionsClicked(); - /** Show forums page */ - void forumClicked(); - /** Show web page */ - void webClicked(); /** Show about dialog */ void aboutClicked(); /** Show about PoWT dialog */ diff --git a/src/qt/forms/aboutdialog.ui b/src/qt/forms/aboutdialog.ui index 8cd18b3a51587..e596e1e8d0953 100755 --- a/src/qt/forms/aboutdialog.ui +++ b/src/qt/forms/aboutdialog.ui @@ -91,7 +91,7 @@ Copyright © 2011-2012 The PeerCoin developers Copyright © 2012-2014 The NovaCoin developers Copyright © 2014 The BlackCoin developers -Copyright © 2014-2016 The VeriCoin developers +Copyright © 2014-2017 The VeriCoin developers Artwork by @BrunoPro79 - Copyright © 2016 diff --git a/src/qt/forms/forumspage.ui b/src/qt/forms/forumspage.ui index 747071d1549c9..6efc780eb0c1d 100644 --- a/src/qt/forms/forumspage.ui +++ b/src/qt/forms/forumspage.ui @@ -32,193 +32,309 @@ 0 - - - - - 0 - 0 - - - - - 0 - 40 - - - - Qt::LeftToRight - - - false - - - QFrame::NoFrame - - - QFrame::Raised - - - - 10 - - - 0 - - - 10 - - - 0 - - - 10 - - - 0 - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Back - - - - :/icons/back:/icons/back - - - - 12 - 12 - - - - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Reload - - - - :/icons/reload:/icons/reload - - - - 12 - 12 - - - - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Home - - - - :/icons/home:/icons/home - - - - 12 - 12 - - - - - - - - - 0 - 0 - - - - - 120 - 27 - - - - - 120 - 27 - - - - Forward - - - - :/icons/forward:/icons/forward - - - - 12 - 12 - - - - - - + + + + + + + 300 + 50 + + + + + 300 + 16777215 + + + + + 24 + + + + Forums + + + + :/icons/forum:/icons/forum + + + + 24 + 24 + + + + true + + + + + + + + 300 + 50 + + + + + 300 + 16777215 + + + + + 24 + + + + Website + + + + :/icons/site:/icons/site + + + + 32 + 32 + + + + true + + + + + + + + 300 + 50 + + + + + 300 + 16777215 + + + + + 24 + + + + Qt::LeftToRight + + + Slack chat + + + + :/icons/chat:/icons/chat + + + + 32 + 32 + + + + true + + + + + + + + 300 + 50 + + + + + 16777215 + 16777215 + + + + + 24 + + + + Block Explorer + + + + :/icons/blockchain:/icons/blockchain + + + + 32 + 32 + + + + true + + + + + + + + 0 + 0 + + + + Qt::LeftToRight + + + + + + :/icons/miningon + + + Qt::AlignCenter + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + + + + + 350 + 100 + + + + + 24 + + + + Support and Community Resources + + + Qt::AlignCenter + + + + + + + Explore the full blockchain database including all transactions since genesis. + + + + + + + Chat with the developers, community, miners and get answers to your questions. + + + + + + + Get more info and access to community resources. + + + + + + + Stay up to date with news, wallet updates, media and learn more about Verium. + + + + diff --git a/src/qt/forumspage.cpp b/src/qt/forumspage.cpp index f48e5a1816b3e..01dc3b0b4b44d 100644 --- a/src/qt/forumspage.cpp +++ b/src/qt/forumspage.cpp @@ -5,6 +5,7 @@ #include "guiutil.h" #include "guiconstants.h" #include "util.h" +#include using namespace GUIUtil; @@ -14,7 +15,7 @@ ForumsPage::ForumsPage(QWidget *parent) : walletModel(0) { ui->setupUi(this); - + ui->textEdit->setFont(qFontLargerBold); // Setup header and styles if (fNoHeaders) GUIUtil::header(this, QString("")); @@ -24,10 +25,6 @@ ForumsPage::ForumsPage(QWidget *parent) : GUIUtil::header(this, QString(":images/headerForums")); this->layout()->setContentsMargins(0, HEADER_HEIGHT, 0, 0); - // buttons - ui->back->setDisabled(true); - ui->home->setDisabled(true); - ui->forward->setDisabled(true); } ForumsPage::~ForumsPage() @@ -39,3 +36,23 @@ void ForumsPage::setModel(WalletModel *model) { this->walletModel = model; } + +void ForumsPage::on_explorerButton_clicked() +{ + QDesktopServices::openUrl(QUrl("http://www.vericoin.info/wallet/blockchainVRM.php")); +} + +void ForumsPage::on_chatButton_clicked() +{ + QDesktopServices::openUrl(QUrl("http://www.vericoin.info/wallet/forums2.php")); +} + +void ForumsPage::on_forumButton_clicked() +{ + QDesktopServices::openUrl(QUrl("https://forums.vericoin.info/")); +} + +void ForumsPage::on_siteButton_clicked() +{ + QDesktopServices::openUrl(QUrl("http://www.vericoin.info")); +} diff --git a/src/qt/forumspage.h b/src/qt/forumspage.h index a23d81726f4da..f108798c7f9da 100644 --- a/src/qt/forumspage.h +++ b/src/qt/forumspage.h @@ -40,6 +40,10 @@ public slots: private slots: + void on_explorerButton_clicked(); + void on_chatButton_clicked(); + void on_forumButton_clicked(); + void on_siteButton_clicked(); }; #endif // FORUMSPAGE_H