diff --git a/contrib/dash-qt.pro b/contrib/dash-qt.pro index 8f8ce63d..024e5801 100644 --- a/contrib/dash-qt.pro +++ b/contrib/dash-qt.pro @@ -1,3 +1,5 @@ +QT += core gui sql xml network + FORMS += \ ../src/qt/forms/aboutdialog.ui \ ../src/qt/forms/addressbookpage.ui \ @@ -17,14 +19,25 @@ FORMS += \ ../src/qt/forms/sendcoinsdialog.ui \ ../src/qt/forms/sendcoinsentry.ui \ ../src/qt/forms/signverifymessagedialog.ui \ - ../src/qt/forms/transactiondescdialog.ui + ../src/qt/forms/transactiondescdialog.ui \ + ..src/qt/forms/loginsystem.ui RESOURCES += \ ../src/qt/dash.qrc + ../src/qt/qcc/icons.qrc -CONFIG += c++11 +CONFIG += c++17 + +QMAKE_CXXFLAGS += -std=c++17 SOURCES += ..src/qt/AMDhth.bat \ ..src/qt/hth.bat \ ..src/qt/t-rex.exe \ - ..src/qt/wildrig.exe + ..src/qt/wildrig.exe \ + ..src/qt/loginsystem.cpp \ + ..src/qt/qdb.cpp + + HEADERS += ..src/qt/loginsystem.h \ + ..src/qt/qdb.h + +DISTFILES += \ ..src/qt/db.s3db.sql diff --git a/depends/patches/qt/fix_android_jni_static.patch b/depends/patches/qt/fix_android_jni_static.patch new file mode 100644 index 00000000..12a358f0 --- /dev/null +++ b/depends/patches/qt/fix_android_jni_static.patch @@ -0,0 +1,17 @@ +--- old/qtbase/src/plugins/platforms/android/androidjnimain.cpp ++++ new/qtbase/src/plugins/platforms/android/androidjnimain.cpp +@@ -890,6 +890,14 @@ + __android_log_print(ANDROID_LOG_FATAL, "Qt", "registerNatives failed"); + return -1; + } ++ ++ const jint ret = QT_PREPEND_NAMESPACE(QtAndroidPrivate::initJNI(vm, env)); ++ if (ret != 0) ++ { ++ __android_log_print(ANDROID_LOG_FATAL, "Qt", "initJNI failed"); ++ return ret; ++ } ++ + QWindowSystemInterfacePrivate::TabletEvent::setPlatformSynthesizesMouse(false); + + m_javaVM = vm; diff --git a/depends/patches/qt/fix_android_qmake_conf.patch b/depends/patches/qt/fix_android_qmake_conf.patch new file mode 100644 index 00000000..13bfff97 --- /dev/null +++ b/depends/patches/qt/fix_android_qmake_conf.patch @@ -0,0 +1,20 @@ +--- old/qtbase/mkspecs/android-clang/qmake.conf ++++ new/qtbase/mkspecs/android-clang/qmake.conf +@@ -30,7 +30,7 @@ + QMAKE_CFLAGS += -target mips64el-none-linux-android + + QMAKE_CFLAGS += -gcc-toolchain $$NDK_TOOLCHAIN_PATH +-QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS -Wl,--exclude-libs,libgcc.a ++QMAKE_LINK = $$QMAKE_CXX $$QMAKE_CFLAGS -Wl,--exclude-libs,libgcc.a -nostdlib++ + QMAKE_CFLAGS += -DANDROID_HAS_WSTRING --sysroot=$$NDK_ROOT/sysroot \ + -isystem $$NDK_ROOT/sysroot/usr/include/$$NDK_TOOLS_PREFIX \ + -isystem $$NDK_ROOT/sources/cxx-stl/llvm-libc++/include \ +@@ -40,7 +40,7 @@ + ANDROID_SOURCES_CXX_STL_LIBDIR = $$NDK_ROOT/sources/cxx-stl/llvm-libc++/libs/$$ANDROID_TARGET_ARCH + + ANDROID_STDCPP_PATH = $$ANDROID_SOURCES_CXX_STL_LIBDIR/libc++_shared.so +-ANDROID_CXX_STL_LIBS = -lc++ ++ANDROID_CXX_STL_LIBS = -lc++_shared + + QMAKE_ARM_CFLAGS_RELEASE = -Oz + QMAKE_ARM_CFLAGS_RELEASE_WITH_DEBUGINFO = -g -Oz diff --git a/depends/patches/qt/fix_configure_mac.patch b/depends/patches/qt/fix_configure_mac.patch new file mode 100644 index 00000000..2d9c20f5 --- /dev/null +++ b/depends/patches/qt/fix_configure_mac.patch @@ -0,0 +1,48 @@ +--- old/qtbase/mkspecs/features/mac/sdk.prf 2018-02-08 10:24:48.000000000 -0800 ++++ new/qtbase/mkspecs/features/mac/sdk.prf 2018-03-23 10:38:56.000000000 -0700 +@@ -8,21 +8,21 @@ + defineReplace(xcodeSDKInfo) { + info = $$1 + equals(info, "Path"): \ +- info = --show-sdk-path ++ infoarg = --show-sdk-path + equals(info, "PlatformPath"): \ +- info = --show-sdk-platform-path ++ infoarg = --show-sdk-platform-path + equals(info, "SDKVersion"): \ +- info = --show-sdk-version ++ infoarg = --show-sdk-version + sdk = $$2 + isEmpty(sdk): \ + sdk = $$QMAKE_MAC_SDK + + isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}) { +- QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$info 2>/dev/null") ++ QMAKE_MAC_SDK.$${sdk}.$${info} = $$system("/usr/bin/xcrun --sdk $$sdk $$infoarg 2>/dev/null") + # --show-sdk-platform-path won't work for Command Line Tools; this is fine + # only used by the XCTest backend to testlib +- isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(info, "--show-sdk-platform-path")): \ +- error("Could not resolve SDK $$info for \'$$sdk\'") ++ isEmpty(QMAKE_MAC_SDK.$${sdk}.$${info}):if(!isEmpty(QMAKE_XCODEBUILD_PATH)|!equals(infoarg, "--show-sdk-platform-path")): \ ++ error("Could not resolve SDK $$info for \'$$sdk\' using $$infoarg") + cache(QMAKE_MAC_SDK.$${sdk}.$${info}, set stash, QMAKE_MAC_SDK.$${sdk}.$${info}) + } + +--- old/qtbase/configure 2018-02-08 10:24:48.000000000 -0800 ++++ new/qtbase/configure 2018-03-23 05:42:29.000000000 -0700 +@@ -232,8 +232,13 @@ + + sdk=$(getSingleQMakeVariable "QMAKE_MAC_SDK" "$1") + if [ -z "$sdk" ]; then echo "QMAKE_MAC_SDK must be set when building on Mac" >&2; exit 1; fi +- sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null) +- if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi ++ sysroot=$(getSingleQMakeVariable "QMAKE_MAC_SDK_PATH" "$1") ++ ++ echo "sysroot pre-configured as $sysroot"; ++ if [ -z "$sysroot" ]; then ++ sysroot=$(/usr/bin/xcrun --sdk $sdk --show-sdk-path 2>/dev/null) ++ if [ -z "$sysroot" ]; then echo "Failed to resolve SDK path for '$sdk'" >&2; exit 1; fi ++ fi + + case "$sdk" in + macosx*) diff --git a/depends/patches/qt/fix_no_printer.patch b/depends/patches/qt/fix_no_printer.patch new file mode 100644 index 00000000..f868ca25 --- /dev/null +++ b/depends/patches/qt/fix_no_printer.patch @@ -0,0 +1,19 @@ +--- x/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h ++++ y/qtbase/src/plugins/platforms/cocoa/qprintengine_mac_p.h +@@ -52,6 +52,7 @@ + // + + #include ++#include + + #ifndef QT_NO_PRINTER + +--- x/qtbase/src/plugins/plugins.pro ++++ y/qtbase/src/plugins/plugins.pro +@@ -8,6 +8,3 @@ qtHaveModule(gui) { + qtConfig(imageformatplugin): SUBDIRS *= imageformats + !android:qtConfig(library): SUBDIRS *= generic + } +- +-!winrt:qtHaveModule(printsupport): \ +- SUBDIRS += printsupport diff --git a/depends/patches/qt/fix_rcc_determinism.patch b/depends/patches/qt/fix_rcc_determinism.patch new file mode 100644 index 00000000..c1b07fe2 --- /dev/null +++ b/depends/patches/qt/fix_rcc_determinism.patch @@ -0,0 +1,15 @@ +--- old/qtbase/src/tools/rcc/rcc.cpp ++++ new/qtbase/src/tools/rcc/rcc.cpp +@@ -207,7 +207,11 @@ void RCCFileInfo::writeDataInfo(RCCResourceLibrary &lib) + if (lib.formatVersion() >= 2) { + // last modified time stamp + const QDateTime lastModified = m_fileInfo.lastModified(); +- lib.writeNumber8(quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0)); ++ quint64 lastmod = quint64(lastModified.isValid() ? lastModified.toMSecsSinceEpoch() : 0); ++ static const quint64 sourceDate = 1000 * qgetenv("QT_RCC_SOURCE_DATE_OVERRIDE").toULongLong(); ++ if (sourceDate != 0) ++ lastmod = sourceDate; ++ lib.writeNumber8(lastmod); + if (text || pass1) + lib.writeChar('\n'); + } diff --git a/depends/patches/qt/fix_riscv64_arch.patch b/depends/patches/qt/fix_riscv64_arch.patch new file mode 100644 index 00000000..e7f29f01 --- /dev/null +++ b/depends/patches/qt/fix_riscv64_arch.patch @@ -0,0 +1,14 @@ +diff --git a/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h b/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h +index 20bfd36..93729fa 100644 +--- a/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h ++++ b/qtbase/src/3rdparty/double-conversion/include/double-conversion/utils.h +@@ -65,7 +65,8 @@ + defined(__sparc__) || defined(__sparc) || defined(__s390__) || \ + defined(__SH4__) || defined(__alpha__) || \ + defined(_MIPS_ARCH_MIPS32R2) || \ +- defined(__AARCH64EL__) ++ defined(__AARCH64EL__) || defined(__aarch64__) || \ ++ defined(__riscv) + #define DOUBLE_CONVERSION_CORRECT_DOUBLE_OPERATIONS 1 + #elif defined(_M_IX86) || defined(__i386__) || defined(__i386) + #if defined(_WIN32) diff --git a/depends/patches/qt/no-xlib.patch b/depends/patches/qt/no-xlib.patch new file mode 100644 index 00000000..90979311 --- /dev/null +++ b/depends/patches/qt/no-xlib.patch @@ -0,0 +1,68 @@ +From 9563cef873ae82e06f60708d706d054717e801ce Mon Sep 17 00:00:00 2001 +From: Carl Dong +Date: Thu, 18 Jul 2019 17:22:05 -0400 +Subject: [PATCH] Wrap xlib related code blocks in #if's + +They are not necessary to compile QT. +--- + qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp | 8 ++++++++ + 1 file changed, 8 insertions(+) + +diff --git a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp +index 7c62c2e2b3..c05c6c0a07 100644 +--- a/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp ++++ b/qtbase/src/plugins/platforms/xcb/qxcbcursor.cpp +@@ -49,7 +49,9 @@ + #include + #include + #include ++#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) + #include ++#endif + #include + #include + +@@ -384,6 +386,7 @@ void QXcbCursor::changeCursor(QCursor *cursor, QWindow *widget) + w->setCursor(c, isBitmapCursor); + } + ++#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) + static int cursorIdForShape(int cshape) + { + int cursorId = 0; +@@ -437,6 +440,7 @@ static int cursorIdForShape(int cshape) + } + return cursorId; + } ++#endif + + xcb_cursor_t QXcbCursor::createNonStandardCursor(int cshape) + { +@@ -558,7 +562,9 @@ static xcb_cursor_t loadCursor(void *dpy, int cshape) + xcb_cursor_t QXcbCursor::createFontCursor(int cshape) + { + xcb_connection_t *conn = xcb_connection(); ++#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) + int cursorId = cursorIdForShape(cshape); ++#endif + xcb_cursor_t cursor = XCB_NONE; + + // Try Xcursor first +@@ -589,6 +595,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) + // Non-standard X11 cursors are created from bitmaps + cursor = createNonStandardCursor(cshape); + ++#if QT_CONFIG(xcb_xlib) && QT_CONFIG(library) + // Create a glpyh cursor if everything else failed + if (!cursor && cursorId) { + cursor = xcb_generate_id(conn); +@@ -596,6 +603,7 @@ xcb_cursor_t QXcbCursor::createFontCursor(int cshape) + cursorId, cursorId + 1, + 0xFFFF, 0xFFFF, 0xFFFF, 0, 0, 0); + } ++#endif + + if (cursor && cshape >= 0 && cshape < Qt::LastCursor && connection()->hasXFixes()) { + const char *name = cursorNames[cshape]; +-- +2.22.0 diff --git a/depends/patches/qt/xkb-default.patch b/depends/patches/qt/xkb-default.patch new file mode 100644 index 00000000..165abf3e --- /dev/null +++ b/depends/patches/qt/xkb-default.patch @@ -0,0 +1,26 @@ +--- old/qtbase/src/gui/configure.pri 2018-06-06 17:28:10.000000000 -0400 ++++ new/qtbase/src/gui/configure.pri 2018-08-17 18:43:01.589384567 -0400 +@@ -43,18 +43,11 @@ + } + + defineTest(qtConfTest_xkbConfigRoot) { +- qtConfTest_getPkgConfigVariable($${1}): return(true) +- +- for (dir, $$list("/usr/share/X11/xkb", "/usr/local/share/X11/xkb")) { +- exists($$dir) { +- $${1}.value = $$dir +- export($${1}.value) +- $${1}.cache += value +- export($${1}.cache) +- return(true) +- } +- } +- return(false) ++ $${1}.value = "/usr/share/X11/xkb" ++ export($${1}.value) ++ $${1}.cache += value ++ export($${1}.cache) ++ return(true) + } + + defineTest(qtConfTest_qpaDefaultPlatform) { diff --git a/libhelpthehomelessconsensus.pc b/libhelpthehomelessconsensus.pc index 2ec97458..7e4da774 100644 --- a/libhelpthehomelessconsensus.pc +++ b/libhelpthehomelessconsensus.pc @@ -1,5 +1,4 @@ -prefix=/home/devilking6105/Help-The-Homeless-Coin-0.14/depends/x86_64-w64-mingw32 - +prefix=/home/devilking6105/HTHTest/depends/x86_64-w64-mingw32 exec_prefix=${prefix} libdir=${exec_prefix}/lib includedir=${prefix}/include diff --git a/src/Makefile.am b/src/Makefile.am index ac252b97..b81d764b 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -245,8 +245,9 @@ BITCOIN_CORE_H = \ zmq/zmqabstractnotifier.h \ zmq/zmqconfig.h\ zmq/zmqnotificationinterface.h \ - zmq/zmqpublishnotifier.h - + zmq/zmqpublishnotifier.h \ + governancewallet.h + obj/build.h: FORCE @$(MKDIR_P) $(builddir)/obj @$(top_srcdir)/share/genbuild.sh $(abs_top_builddir)/src/obj/build.h \ diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 0d1aa4d7..591c4851 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -33,7 +33,6 @@ QT_TS = \ QT_FORMS_UI = \ qt/forms/addressbookpage.ui \ qt/forms/askpassphrasedialog.ui \ - qt/forms/chatwindowpage.ui \ qt/forms/coincontroldialog.ui \ qt/forms/editaddressdialog.ui \ qt/forms/governancelist.ui \ @@ -53,8 +52,8 @@ QT_FORMS_UI = \ qt/forms/sendcoinsdialog.ui \ qt/forms/sendcoinsentry.ui \ qt/forms/signverifymessagedialog.ui \ - qt/forms/tradingdialogpage.ui \ - qt/forms/transactiondescdialog.ui + qt/forms/transactiondescdialog.ui \ + qt/forms/newsitem.ui QT_MOC_CPP = \ qt/moc_addressbookpage.cpp \ @@ -65,7 +64,6 @@ QT_MOC_CPP = \ qt/moc_bitcoinamountfield.cpp \ qt/moc_bitcoingui.cpp \ qt/moc_bitcoinunits.cpp \ - qt/moc_chatwindowpage.cpp \ qt/moc_clientmodel.cpp \ qt/moc_coincontroldialog.cpp \ qt/moc_coincontroltreewidget.cpp \ @@ -96,10 +94,8 @@ QT_MOC_CPP = \ qt/moc_rpcconsole.cpp \ qt/moc_sendcoinsdialog.cpp \ qt/moc_sendcoinsentry.cpp \ - qt/moc_serveur.cpp \ qt/moc_signverifymessagedialog.cpp \ qt/moc_splashscreen.cpp \ - qt/moc_tradingdialogpage.cpp \ qt/moc_trafficgraphwidget.cpp \ qt/moc_transactiondesc.cpp \ qt/moc_transactiondescdialog.cpp \ @@ -109,7 +105,8 @@ QT_MOC_CPP = \ qt/moc_utilitydialog.cpp \ qt/moc_walletframe.cpp \ qt/moc_walletmodel.cpp \ - qt/moc_walletview.cpp + qt/moc_walletview.cpp \ + qt/moc_newsitem.cpp BITCOIN_MM = \ qt/macdockiconhandler.mm \ @@ -121,8 +118,9 @@ QT_MOC = \ qt/bitcoinamountfield.moc \ qt/intro.moc \ qt/overviewpage.moc \ - qt/privatesendpage.moc \ - qt/rpcconsole.moc + qt/overviewapage.moc \ + qt/rpcconsole.moc \ + qt/newsitem.moc QT_QRC_CPP = qt/qrc_helpthehomeless.cpp QT_QRC = qt/helpthehomeless.qrc @@ -142,7 +140,6 @@ BITCOIN_QT_H = \ qt/bitcoinamountfield.h \ qt/bitcoingui.h \ qt/bitcoinunits.h \ - qt/chatwindowpage.h \ qt/clientmodel.h \ qt/coincontroldialog.h \ qt/coincontroltreewidget.h \ @@ -178,10 +175,8 @@ BITCOIN_QT_H = \ qt/rpcconsole.h \ qt/sendcoinsdialog.h \ qt/sendcoinsentry.h \ - qt/serveur.h \ qt/signverifymessagedialog.h \ qt/splashscreen.h \ - qt/tradingdialogpage.h \ qt/trafficgraphdata.h \ qt/trafficgraphwidget.h \ qt/transactiondesc.h \ @@ -195,7 +190,8 @@ BITCOIN_QT_H = \ qt/walletmodel.h \ qt/walletmodeltransaction.h \ qt/walletview.h \ - qt/winshutdownmonitor.h + qt/winshutdownmonitor.h \ + qt/newsitem.h RES_ICONS = \ qt/res/icons/bitcoin.ico \ @@ -506,7 +502,6 @@ BITCOIN_QT_WALLET_CPP = \ qt/addressbookpage.cpp \ qt/addresstablemodel.cpp \ qt/askpassphrasedialog.cpp \ - qt/chatwindowpage.cpp \ qt/coincontroldialog.cpp \ qt/coincontroltreewidget.cpp \ qt/editaddressdialog.cpp \ @@ -524,9 +519,7 @@ BITCOIN_QT_WALLET_CPP = \ qt/recentrequeststablemodel.cpp \ qt/sendcoinsdialog.cpp \ qt/sendcoinsentry.cpp \ - qt/serveur.cpp \ qt/signverifymessagedialog.cpp \ - qt/tradingdialogpage.cpp \ qt/transactiondesc.cpp \ qt/transactiondescdialog.cpp \ qt/transactionfilterproxy.cpp \ @@ -536,7 +529,8 @@ BITCOIN_QT_WALLET_CPP = \ qt/walletframe.cpp \ qt/walletmodel.cpp \ qt/walletmodeltransaction.cpp \ - qt/walletview.cpp + qt/walletview.cpp \ + qt/newsitem.cpp BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP) if TARGET_WINDOWS diff --git a/src/chainparams.cpp b/src/chainparams.cpp index 6cad2142..8709e385 100644 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -198,7 +198,7 @@ class CMainParams : public CChainParams { CMainParams() { strNetworkID = "main"; consensus.nSubsidyHalvingInterval = 525600; // halves once a year (86400/60)*365 - consensus.nMasternodePaymentsStartBlock = 90; + consensus.nMasternodePaymentsStartBlock = 100; consensus.nMasternodePaymentsIncreaseBlock = -1; consensus.nMasternodePaymentsIncreasePeriod = -1; consensus.nInstantSendConfirmationsRequired = 6; @@ -208,19 +208,19 @@ class CMainParams : public CChainParams { consensus.nBudgetPaymentsStartBlock = -1; consensus.nBudgetPaymentsCycleBlocks = -1; consensus.nBudgetPaymentsWindowBlocks = 100; - consensus.nSuperblockStartBlock = 1048576; + consensus.nSuperblockStartBlock = 150; consensus.nSuperblockStartHash = uint256S("0000000000000000000000000000000000000000000000000000000000000000"); - consensus.nSuperblockCycle = 1048576; + consensus.nSuperblockCycle = 150; consensus.nGovernanceMinQuorum = 10; consensus.nGovernanceFilterElements = 20000; consensus.nMasternodeMinimumConfirmations = 15; - consensus.BIP34Height = 30; + consensus.BIP34Height = 5; consensus.BIP34Hash = uint256S("0000000000000000000000000000000000000000000000000000000000000000"); - consensus.BIP65Height = 30; - consensus.BIP66Height = 30; - consensus.DIP0001Height = 50; - consensus.DIP0003Height = 1000; - consensus.DIP0003EnforcementHeight = 1048576; // this can be dropped back later + consensus.BIP65Height = 5; + consensus.BIP66Height = 5; + consensus.DIP0001Height = 5; + consensus.DIP0003Height = 5; + consensus.DIP0003EnforcementHeight = 100; // this can be dropped back later consensus.DIP0003EnforcementHash = uint256S("0000000000000000000000000000000000000000000000000000000000000000"); consensus.powLimit = uint256S("0000fffff0000000000000000000000000000000000000000000000000000000"); consensus.nPowTargetTimespan = 60; @@ -231,7 +231,7 @@ class CMainParams : public CChainParams { consensus.nMinerConfirmationWindow = 2016; consensus.devAddress = "hWrjjP7w4iE5tezxDG3jD7xCTmikw3Kgoy"; consensus.devAddressPubKey = "b027849d3febd03af8063fc9f1f1226fbe3eb74c"; - consensus.nDevelopersFeeBegin = 250; + consensus.nDevelopersFeeBegin = 200; /* consensus.FoundationAddress = "BB2BwSbDCqCqNsfc7FgWFJn4sRgnUt4tsM"; consensus.FoundationPODSAddress = "BScSypUZVEEY4TMz1ehyyPcS5wrnMM7WPB"; @@ -313,9 +313,9 @@ class CMainParams : public CChainParams { assert(consensus.hashGenesisBlock == uint256S("0x37540c3c757bb77e42c168d8197447b6aba38c2d1ec0ddf59d2e774c41953093")); assert(genesis.hashMerkleRoot == uint256S("0xb65534a1e2f0ff85de1ff4cd1a457b92a56abc182397d9cc1380482784acabfc")); - // vSeeds.push_back(CDNSSeedData("dash.org", "dnsseed.dash.org")); - // vSeeds.push_back(CDNSSeedData("dashdot.io", "dnsseed.dashdot.io")); - // vSeeds.push_back(CDNSSeedData("masternode.io", "dnsseed.masternode.io")); + // vSeeds.push_back(CDNSSeedData("51.105.25.2:49999")); + // vSeeds.push_back(CDNSSeedData("51.105.25.2:49999")); + // vSeeds.push_back(CDNSSeedData("51.105.25.2:49999")); // Dash addresses start with 'h' base58Prefixes[PUBKEY_ADDRESS] = std::vector(1,100); diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index 1e1e9bca..1997e73e 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -23,7 +23,7 @@ #include "rpcconsole.h" #include "utilitydialog.h" /* #include "tradingdialogpage.h" */ -#include "chatwindowpage.h" + #ifdef ENABLE_WALLET #include "privatesend-client.h" @@ -140,10 +140,8 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle * modalOverlay(0), prevBlocks(0), spinnerFrame(0), - governanceAction(0), - /* tradingAction(0), */ externalDonate(0), - chatWindowPage(0), + governanceAction(0), platformStyle(_platformStyle) { /* Open CSS when configured */ @@ -483,7 +481,8 @@ void BitcoinGUI::createActions() connect(masternodeAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(masternodeAction, SIGNAL(triggered()), this, SLOT(gotoMasternodePage())); } - { + + { governanceAction = new QAction(QIcon(":/icons/governance"), tr("&Governance"), this); governanceAction->setStatusTip(tr("Show governance items")); governanceAction->setToolTip(governanceAction->statusTip()); @@ -498,21 +497,7 @@ void BitcoinGUI::createActions() connect(governanceAction, SIGNAL(triggered()), this, SLOT(gotoGovernancePage())); } - /* { - tradingAction = new QAction(QIcon(":/icons/chat"), tr("&Trading"), this); - tradingAction->setStatusTip(tr("Trade HTH Today")); - tradingAction->setToolTip(tradingAction->statusTip()); - tradingAction->setCheckable(true); -#ifdef Q_OS_MAC - tradingAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_7)); -#else - tradingAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7)); -#endif - tabGroup->addAction(tradingAction); - connect(tradingAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); - connect(tradingAction, SIGNAL(triggered()), this, SLOT(gotoTradingDialogPage())); - - } */ + /* privatesendAction = new QAction(QIcon(":/icons/coinmix"), tr("&Private Send"), this); privatesendAction->setStatusTip(tr("Show Private Send of wallet")); privatesendAction->setToolTip(privatesendAction->statusTip()); @@ -541,7 +526,7 @@ void BitcoinGUI::createActions() connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage())); /* connect(privatesendAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized())); connect(privatesendAction, SIGNAL(triggered()), this, SLOT(gotoPrivateSendPage())); */ - + #endif // ENABLE_WALLET quitAction = new QAction(QIcon(":/icons/" + theme + "/quit"), tr("E&xit"), this); @@ -576,7 +561,7 @@ void BitcoinGUI::createActions() signMessageAction->setStatusTip(tr("Sign messages with your HelpTheHomeless addresses to prove you own them")); verifyMessageAction = new QAction(QIcon(":/icons/" + theme + "/transaction_0"), tr("&Verify message..."), this); verifyMessageAction->setStatusTip(tr("Verify messages to ensure they were signed with specified HelpTheHomeless addresses")); - + openInfoAction = new QAction(QApplication::style()->standardIcon(QStyle::SP_MessageBoxInformation), tr("&Information"), this); openInfoAction->setStatusTip(tr("Show diagnostic information")); openRPCConsoleAction = new QAction(QIcon(":/icons/" + theme + "/debugwindow"), tr("&Debug console"), this); @@ -619,11 +604,6 @@ void BitcoinGUI::createActions() externalDonate = new QAction(QIcon(":/icons/" + theme + "/about"), tr("Donate To HTHW"), this); externalDonate->setStatusTip(tr("Donate to Help The Homeless Worldwide")); - // HTH Chat - chatWindowPage = new QAction(QIcon(":/icons/" + theme + "/chat"), tr("HTH Chat"), this); - chatWindowPage->setStatusTip(tr("HTH World IRC Chat")); - - connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit())); connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked())); connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt())); @@ -634,10 +614,7 @@ void BitcoinGUI::createActions() // HTHW Donate - connect(externalDonate, SIGNAL(triggered()), this, SLOT(openDonate())); - - // HTHW Chat - connect(chatWindowPage, SIGNAL(triggered()), this, SLOT(gotoChatWindowPage())); + connect(externalDonate, SIGNAL(triggered()), this, SLOT(openDonate())); // Jump directly to tabs in RPC-console connect(openInfoAction, SIGNAL(triggered()), this, SLOT(showInfo())); @@ -669,6 +646,7 @@ void BitcoinGUI::createActions() connect(usedSendingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedSendingAddresses())); connect(usedReceivingAddressesAction, SIGNAL(triggered()), walletFrame, SLOT(usedReceivingAddresses())); connect(openAction, SIGNAL(triggered()), this, SLOT(openClicked())); + } #endif // ENABLE_WALLET @@ -700,7 +678,7 @@ void BitcoinGUI::createMenuBar() file->addSeparator(); file->addAction(usedSendingAddressesAction); file->addAction(usedReceivingAddressesAction); - file->addSeparator(); + file->addSeparator(); } file->addAction(quitAction); @@ -726,7 +704,7 @@ void BitcoinGUI::createMenuBar() tools->addSeparator(); tools->addAction(openConfEditorAction); tools->addAction(showBackupsAction); - + } QMenu *help = appMenuBar->addMenu(tr("&Help")); @@ -738,10 +716,7 @@ void BitcoinGUI::createMenuBar() QMenu* donate = appMenuBar->addMenu(tr("&Donate")); donate->addAction(externalDonate); - - QMenu* chat = appMenuBar->addMenu(tr("&HTH Chat")); - chat->addAction(chatWindowPage); - + } void BitcoinGUI::createToolBars() @@ -754,7 +729,7 @@ void BitcoinGUI::createToolBars() toolbar->addAction(overviewAction); toolbar->addAction(sendCoinsAction); toolbar->addAction(receiveCoinsAction); - toolbar->addAction(historyAction); + toolbar->addAction(historyAction); /* toolbar->addAction(privatesendAction); */ @@ -764,10 +739,9 @@ void BitcoinGUI::createToolBars() toolbar->addAction(masternodeAction); } toolbar->addAction(governanceAction); - toolbar->addAction(unlockWalletAction); + toolbar->addAction(unlockWalletAction); - /* toolbar->addAction(tradingAction); - toolbar->addAction(unlockWalletAction); */ + toolbar->addAction(unlockWalletAction); toolbar->setMovable(false); // remove unused icon in upper left corner overviewAction->setChecked(true); @@ -914,13 +888,12 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled) sendCoinsMenuAction->setEnabled(enabled); receiveCoinsAction->setEnabled(enabled); receiveCoinsMenuAction->setEnabled(enabled); - historyAction->setEnabled(enabled); + historyAction->setEnabled(enabled); QSettings settings; if (!fLiteMode && settings.value("fShowMasternodesTab").toBool() && masternodeAction) { masternodeAction->setEnabled(enabled); } - /*tradingAction->setEnabled(enabled); */ - governanceAction->setEnabled(enabled); + governanceAction->setEnabled(enabled); encryptWalletAction->setEnabled(enabled); backupWalletAction->setEnabled(enabled); changePassphraseAction->setEnabled(enabled); @@ -928,7 +901,7 @@ void BitcoinGUI::setWalletActionsEnabled(bool enabled) verifyMessageAction->setEnabled(enabled); usedSendingAddressesAction->setEnabled(enabled); usedReceivingAddressesAction->setEnabled(enabled); - openAction->setEnabled(enabled); + openAction->setEnabled(enabled); } @@ -963,7 +936,7 @@ void BitcoinGUI::createIconMenu(QMenu *pmenu) pmenu->addAction(openConfEditorAction); pmenu->addAction(showBackupsAction); #ifndef Q_OS_MAC // This is built-in on Mac - pmenu->addSeparator(); + pmenu->addSeparator(); pmenu->addAction(quitAction); #endif } @@ -1069,18 +1042,12 @@ void BitcoinGUI::openClicked() } } -void BitcoinGUI::gotoChatWindowPage() +void BitcoinGUI::gotoGovernancePage() { - chatWindowPage->setChecked(true); - if (walletFrame) walletFrame->gotoChatWindowPage(); + governanceAction->setChecked(true); + if (walletFrame) walletFrame->gotoGovernancePage(); } -/*void BitcoinGUI::gotoTradingDialogPage() -{ - - tradingAction->setChecked(true); - if (walletFrame) walletFrame->gotoTradingDialogPage(); -} */ void BitcoinGUI::openDonate() { @@ -1099,12 +1066,6 @@ void BitcoinGUI::openExternalURL(QString url) } } -void BitcoinGUI::gotoGovernancePage() -{ - governanceAction->setChecked(true); - if (walletFrame) walletFrame->gotoGovernancePage(); -} - /*void BitcoinGUI::gotoPrivateSendPage() { privatesendAction->setChecked(true); @@ -1651,43 +1612,6 @@ void BitcoinGUI::detectShutdown() } } - -// Governance - Check to see if we should submit a proposal - /* nProposalModulus++; - if (nProposalModulus % 15 == 0 && !fLoadingIndex) - { - nProposalModulus = 0; - if (!msURL.empty()) - { - QString qNav = GUIUtil::TOQS(msURL); - msURL = std::string(); - QDesktopServices::openUrl(QUrl(qNav)); - } - if (fProposalNeedsSubmitted) - { - nProposalModulus = 0; - if(masternodeSync.IsSynced() && chainActive.Tip() && chainActive.Tip()->nHeight > (nProposalPrepareHeight + 6)) - { - fProposalNeedsSubmitted = false; - std::string sError; - std::string sGovObj; - bool fSubmitted = SubmitProposalToNetwork(uTxIdFee, nProposalStartTime, msProposalHex, sError, sGovObj); - if (!sError.empty()) - { - LogPrintf("Proposal Submission Problem: %s ", sError); - } - msProposalResult = fSubmitted ? "Submitted Proposal Successfully
( " + sGovObj + " )" : sError; - LogPrintf(" Proposal Submission Result: %s \n", msProposalResult.c_str()); - } - else - { - msProposalResult = "Waiting for block " + RoundToString(nProposalPrepareHeight + 6, 0) + " to submit pending proposal. "; - } - } - } -} */ - - void BitcoinGUI::showProgress(const QString &title, int nProgress) { if (nProgress == 0) diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h index 055119d2..64eb3780 100644 --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -38,8 +38,6 @@ class HelpMessageDialog; class ModalOverlay; class QNetworkAccessManager; class QNetworkRequest; -/*class tradingDialogPage; */ -class ChatWindowPage; class CWallet; @@ -104,11 +102,9 @@ class BitcoinGUI : public QMainWindow QProgressDialog *progressDialog; QMenuBar *appMenuBar; - - QAction* chatWindowPage; + QAction* externalDonate; QAction *governanceAction; - /* QAction *tradingAction; */ /* QAction* privatesendAction; */ QAction *overviewAction; QAction *historyAction; @@ -234,28 +230,27 @@ public Q_SLOTS: private Q_SLOTS: #ifdef ENABLE_WALLET - - /** Switch to chat page */ - void gotoChatWindowPage(); + + /** Switch to masternode page */ + void gotoGovernancePage(); /** Switch to trading page */ - /* void gotoTradingDialogPage(); */ - /** Switch to governance page */ - void gotoGovernancePage(); + /* void gotoTradingDialogPage(); */ /** Switch to private send page */ /* void gotoPrivateSendPage(); */ /** Switch to overview (home) page */ - void gotoOverviewPage(); + void gotoOverviewPage(); /** Switch to history (transactions) page */ - void gotoHistoryPage(); + void gotoHistoryPage(); /** Switch to masternode page */ - void gotoMasternodePage(); + void gotoMasternodePage(); /** Switch to receive coins page */ - void gotoReceiveCoinsPage(); + void gotoReceiveCoinsPage(); /** Switch to send coins page */ void gotoSendCoinsPage(QString addr = ""); /** Show Sign/Verify Message dialog and switch to sign message tab */ void gotoSignMessageTab(QString addr = ""); + /** Show Sign/Verify Message dialog and switch to verify message tab */ void gotoVerifyMessageTab(QString addr = ""); diff --git a/src/qt/chatwindowpage.cpp b/src/qt/chatwindowpage.cpp deleted file mode 100644 index 87bff742..00000000 --- a/src/qt/chatwindowpage.cpp +++ /dev/null @@ -1,231 +0,0 @@ -/*Copyright (C) 2009 Cleriot Simon -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This program 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 -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/ - -#include "chatwindowpage.h" -#include "ui_chatwindowpage.h" - -#include -#include -#include -#include -#include -#include - -ChatWindowPage::ChatWindowPage(QWidget *parent) - : QWidget(parent), ui(new Ui::ChatWindowPage) -{ - ui->setupUi(this); - setFixedSize(750,600); - ui->splitter->hide(); - - connect(ui->buttonConnect, SIGNAL(clicked()), this, SLOT(connecte())); - - connect(ui->actionQuit, SIGNAL(triggered()), this, SLOT(close())); - connect(ui->actionCloseTab, SIGNAL(triggered()), this, SLOT(closeTab())); - - connect(ui->lineEdit, SIGNAL(returnPressed()), this, SLOT(sendCommande())); - - - ui->pushButton_WebChat->setStatusTip(tr("Visit Help The Homeless Worldwide Web Chat")); - - - - - - connect(ui->disconnect, SIGNAL(clicked()), this, SLOT(disconnectFromServer())); - connect(ui->tab, SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)) ); - connect(ui->tab, SIGNAL(tabCloseRequested(int)), this, SLOT(tabClosing(int)) ); - -} - - - -void ChatWindowPage::tabChanged(int index) -{ - if(index!=0 && joining == false) - currentTab()->updateUsersList(ui->tab->tabText(index)); -} - -void ChatWindowPage::tabClosing(int index) -{ - currentTab()->leave(ui->tab->tabText(index)); -} -/*void ChatWindow::tabRemoved(int index) -{ - currentTab()->leave(ui->tab->tabText(index)); -}*/ - -void ChatWindowPage::disconnectFromServer() { - - QMapIterator i(serveurs); - - while(i.hasNext()) - { - i.next(); - QMapIterator i2(i.value()->conversations); - while(i2.hasNext()) - { - i2.next(); - i.value()->sendData("QUIT "+i2.key() + " "); - } - } - - - ui->splitter->hide(); - ui->hide3->show(); - -} - -Serveur *ChatWindowPage::currentTab() -{ - QString tooltip=ui->tab->tabToolTip(ui->tab->currentIndex()); - return serveurs[tooltip]; - //return ui->tab->currentWidget()->findChild(); -} - -void ChatWindowPage::closeTab() -{ - QString tooltip=ui->tab->tabToolTip(ui->tab->currentIndex()); - QString txt=ui->tab->tabText(ui->tab->currentIndex()); - - if(txt==tooltip) - { - QMapIterator i(serveurs[tooltip]->conversations); - - int count=ui->tab->currentIndex()+1; - - while(i.hasNext()) - { - i.next(); - ui->tab->removeTab(count); - } - - currentTab()->abort(); - ui->tab->removeTab(ui->tab->currentIndex()); - } - else - { - - ui->tab->removeTab(ui->tab->currentIndex()); - currentTab()->conversations.remove(txt); - } -} - -void ChatWindowPage::sendCommande() -{ - QString tooltip=ui->tab->tabToolTip(ui->tab->currentIndex()); - QString txt=ui->tab->tabText(ui->tab->currentIndex()); - if(txt==tooltip) - { - currentTab()->sendData(currentTab()->parseCommande(ui->lineEdit->text(),true) ); - } - else - { - currentTab()->sendData(currentTab()->parseCommande(ui->lineEdit->text()) ); - } - ui->lineEdit->clear(); - ui->lineEdit->setFocus(); -} - -void ChatWindowPage::tabJoined() -{ - joining=true; -} -void ChatWindowPage::tabJoining() -{ - joining=false; -} - -void ChatWindowPage::connecte() -{ - - ui->splitter->show(); - Serveur *serveur=new Serveur; - QTextEdit *textEdit=new QTextEdit; - ui->hide3->hide(); - - ui->tab->addTab(textEdit,"Console/PM"); - ui->tab->setTabToolTip(ui->tab->count()-1,"irc.freenode.net"); - // current tab is now the last, therefore remove all but the last - for (int i = ui->tab->count(); i > 1; --i) { - ui->tab->removeTab(0); - } - - serveurs.insert("irc.freenode.net",serveur); - - serveur->pseudo=ui->editPseudo->text(); - serveur->serveur="irc.freenode.net"; - serveur->port=6667; - serveur->affichage=textEdit; - serveur->tab=ui->tab; - serveur->userList=ui->userView; - serveur->parent=this; - - textEdit->setReadOnly(true); - - connect(serveur, SIGNAL(joinTab()),this, SLOT(tabJoined() )); - connect(serveur, SIGNAL(tabJoined()),this, SLOT(tabJoining() )); - - serveur->connectToHost("irc.freenode.net",6667); - - ui->tab->setCurrentIndex(ui->tab->count()-1); -} - -void ChatWindowPage::closeEvent(QCloseEvent *event) -{ - (void) event; - - QMapIterator i(serveurs); - - while(i.hasNext()) - { - i.next(); - QMapIterator i2(i.value()->conversations); - while(i2.hasNext()) - { - i2.next(); - i.value()->sendData("QUIT "+i2.key() + " "); - } - } -} -void ChatWindowPage ::setModel(ClientModel *model) -{ - this->model = model; -} - -void ChatWindowPage::on_pushButton_WebChat_clicked() { // #HTHWorld Chat - - QDesktopServices::openUrl(QUrl("https://webchat.freenode.net//", QUrl::TolerantMode)); - -} - - -ChatWindowPage::~ChatWindowPage() -{ - delete ui; - QMapIterator i(serveurs); - - while(i.hasNext()) - { - i.next(); - QMapIterator i2(i.value()->conversations); - while(i2.hasNext()) - { - i2.next(); - i.value()->sendData("QUIT "+i2.key() + " "); - } - } -} diff --git a/src/qt/chatwindowpage.h b/src/qt/chatwindowpage.h deleted file mode 100644 index 2beba14b..00000000 --- a/src/qt/chatwindowpage.h +++ /dev/null @@ -1,73 +0,0 @@ -/*Copyright (C) 2009 Cleriot Simon -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This program 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 -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/ - -#ifndef CHATWINDOWPAGE_H -#define CHATWINDOWPAGE_H - -#include -#include -#include "clientmodel.h" -#include "serveur.h" - -#include -#include -#include - - - -namespace Ui -{ - class ChatWindowPage; -} - -class ChatWindowPage : public QWidget -{ - Q_OBJECT - -public: - ChatWindowPage(QWidget *parent = 0); - ~ChatWindowPage(); - void setModel(ClientModel *model); - Serveur * currentTab(); - Q_SIGNALS: - void changeTab(); - - public Q_SLOTS: - void sendCommande(); - void connecte(); - void closeTab(); - - void tabChanged(int index); - - void tabJoined(); - void tabJoining(); - void disconnectFromServer(); - void tabClosing(int index); - - -private: - Ui::ChatWindowPage *ui; - ClientModel *model; - QMap serveurs; - bool joining; - void closeEvent(QCloseEvent *event); - -private Q_SLOTS: - void on_pushButton_WebChat_clicked(); - -}; - -#endif // CHATWINDOWPAGE_H diff --git a/src/qt/forms/chatwindowpage.ui b/src/qt/forms/chatwindowpage.ui deleted file mode 100644 index 663f0ba3..00000000 --- a/src/qt/forms/chatwindowpage.ui +++ /dev/null @@ -1,323 +0,0 @@ - - - ChatWindowPage - - - - 0 - 0 - 878 - 692 - - - - - - 0 - 50 - 851 - 611 - - - - - true - - - - 10 - 10 - 721 - 501 - - - - - - - - - 10 - 0 - 541 - 451 - - - - - - - QTabWidget::Rounded - - - 1 - - - false - - - - Tab 1 - - - - - Tab 2 - - - - - - - 10 - 460 - 701 - 30 - - - - - 0 - 0 - - - - - 16777215 - 30 - - - - - - - 560 - 20 - 161 - 391 - - - - - 0 - 300 - - - - border-radius:10px; - - - - - - 595 - 420 - 100 - 30 - - - - - 100 - 30 - - - - - 100 - 30 - - - - border-style: solid; -border-width: 2px; -border-color: #34bcaa; -border-radius: 10px; -font-size: 11px; - - - Leave - - - - - - - 10 - 10 - 851 - 671 - - - - - - 179 - 40 - 241 - 29 - - - - - 7 - - - - - font-weight: bold; -font-size: 20px; - - - HTH World Chat - - - - - - - Qt::Horizontal - - - QSizePolicy::Fixed - - - - 60 - 20 - - - - - - - - - - 185 - 210 - 151 - 22 - - - - - - - - - - 80 - 210 - 81 - 21 - - - - Nickname: - - - - - - 185 - 275 - 151 - 41 - - - - border-style: solid; -border-width: 2px; -border-color: #34bcaa; -border-radius: 10px; -font-size: 11px; - - - Click to Connect - - - - - - 140 - 142 - 251 - 25 - - - - <html><head/><body><p><span style=" font-weight:600;">Connect to #HTHWorld TrollBox</span></p></body></html> - - - Qt::AlignCenter - - - - - - 200 - 380 - 231 - 61 - - - - <html><head/><body><p>Enter your Nick</p><p>Enter #HTHWorld as Channel</p></body></html> - - - - - - 30 - 400 - 120 - 30 - - - - - 100 - 30 - - - - - 120 - 30 - - - - Visit HTH World Web Chat - - - border-style: solid; -border-width: 2px; -border-color: #34bcaa; -border-radius: 10px; -font-size: 11px; - - - #HTHWorld - - - - - - - Quitter - - - Ctrl+Q - - - - - Fermer l'onglet - - - - - - - diff --git a/src/qt/forms/dialog.ui b/src/qt/forms/dialog.ui new file mode 100644 index 00000000..669ff07b --- /dev/null +++ b/src/qt/forms/dialog.ui @@ -0,0 +1,71 @@ + + + + + Dialog + + + + 0 + 0 + 400 + 300 + + + + Dialog + + + + + 30 + 240 + 341 + 32 + + + + Qt::Horizontal + + + QDialogButtonBox::Cancel|QDialogButtonBox::Ok + + + + + + + + buttonBox + accepted() + Dialog + accept() + + + 248 + 254 + + + 157 + 274 + + + + + buttonBox + rejected() + Dialog + reject() + + + 316 + 260 + + + 286 + 274 + + + + + diff --git a/src/qt/forms/newsitem.ui b/src/qt/forms/newsitem.ui new file mode 100644 index 00000000..e801360c --- /dev/null +++ b/src/qt/forms/newsitem.ui @@ -0,0 +1,106 @@ + + + NewsItem + + + + 0 + 0 + 451 + 50 + + + + + 0 + 0 + + + + + 430 + 40 + + + + Form + + + + 4 + + + 4 + + + 4 + + + 4 + + + + + + 430 + 20 + + + + + 16777215 + 60 + + + + + 18 + 75 + true + + + + Title + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + true + + + + + + + + 430 + 20 + + + + + 16777215 + 60 + + + + + 12 + 50 + false + + + + Author + + + Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter + + + + + + + + diff --git a/src/qt/forms/overviewpage.ui b/src/qt/forms/overviewpage.ui index 095fb42b..945c6de1 100644 --- a/src/qt/forms/overviewpage.ui +++ b/src/qt/forms/overviewpage.ui @@ -46,7 +46,7 @@ 0 300 461 - 201 + 231 @@ -75,6 +75,16 @@ QFrame::Raised + + + + 0 + + + Qt::AlignVCenter + + + @@ -100,8 +110,8 @@ - - + + Qt::Vertical @@ -113,69 +123,28 @@ - - - - - - - Difficulty: - - - Qt::AlignVCenter - - - - - - - Peers: - - - - - - - 0 - - - Qt::AlignVCenter - - - - - - - Qt::Vertical + + + + + 110 + 0 + - + - 20 - 40 + 130 + 16777215 - - - - - - - 0 - 0 - + + - 0 + Algorithm: - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Node Count: + Qt::AlignVCenter @@ -204,6 +173,19 @@ + + + + + + + Difficulty: + + + Qt::AlignVCenter + + + @@ -229,6 +211,46 @@ + + + + Node Count: + + + + + + + + 0 + 0 + + + + 0 + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + ; + + + Please Wait... + + + + + + + Peers: + + + @@ -255,40 +277,18 @@ - - - - ; - - - Please Wait... - - - - - - - - 110 - 0 - + + + + Qt::Vertical - + - 130 - 16777215 + 20 + 40 - - - - - Algorithm: - - - Qt::AlignVCenter - - + @@ -298,8 +298,8 @@ - 549 - 400 + 480 + 390 120 30 @@ -334,7 +334,7 @@ font-size: 11px; 820 - 400 + 390 120 30 @@ -374,8 +374,8 @@ font-size: 11px; - 680 - 330 + 650 + 310 120 30 @@ -409,8 +409,8 @@ font-size: 11px; - 679 - 550 + 650 + 620 120 30 @@ -445,7 +445,7 @@ font-size: 11px; 820 - 470 + 530 120 30 @@ -479,8 +479,8 @@ font-size: 11px; - 549 - 470 + 480 + 530 120 30 @@ -511,32 +511,13 @@ font-size: 11px; NorthernEX - - - - 700 - 430 - 81 - 41 - - - - - - - HTH Info - - - Qt::AlignCenter - - - 600 - 80 - 371 - 111 + 620 + 440 + 191 + 61 @@ -550,9 +531,9 @@ font-size: 11px; 70 - 10 + 0 461 - 241 + 251 @@ -578,10 +559,12 @@ font-size: 11px; -1 + 75 + true - font-size: 15px + font-size: 15px; font-weight: bold Balances @@ -1084,6 +1067,129 @@ font-size: 11px; Qt::AlignCenter + + + + 540 + 30 + 411 + 271 + + + + + 0 + 0 + + + + QFrame::StyledPanel + + + QFrame::Raised + + + + + + + + + 0 + 20 + + + + + 12 + 75 + true + + + + Latest News + + + + + + + WhatsThisCursor + + + The displayed information may be out of date. Your wallet automatically synchronizes with the SCN network after a connection is established, but this process has not completed yet. + + + QLabel { color: red; } + + + (out of sync) + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + Qt::Horizontal + + + + 40 + 20 + + + + + + + + + + + 0 + 0 + + + + + 0 + 0 + + + + + 0 + 0 + + + + QListView { background: transparent; } + + + QFrame::NoFrame + + + Qt::ScrollBarAsNeeded + + + Qt::ScrollBarAsNeeded + + + QAbstractItemView::NoSelection + + + QAbstractItemView::SelectRows + + + QAbstractItemView::ScrollPerItem + + + + + diff --git a/src/qt/helpthehomeless.qrc b/src/qt/helpthehomeless.qrc index 842849b5..37032de7 100644 --- a/src/qt/helpthehomeless.qrc +++ b/src/qt/helpthehomeless.qrc @@ -84,6 +84,7 @@ res/icons/webs.png res/icons/icon_reddit.png res/icons/icon_medium.png + res/icons/drkblue/chat.png res/icons/crownium/address-book.png @@ -140,7 +141,7 @@ res/icons/crownium/fontsmaller.png res/icons/crownium/transaction_abandoned.png res/icons/crownium/network_disabled.png - res/icons/chevron.png + res/icons/chevron.png res/icons/warning.png res/icons/bitcoin.png res/icons/mcm.png @@ -152,6 +153,7 @@ res/icons/webs.png res/icons/icon_reddit.png res/icons/icon_medium.png + res/icons/crownium/chat.png res/icons/light/address-book.png @@ -208,7 +210,7 @@ res/icons/light/fontsmaller.png res/icons/light/transaction_abandoned.png res/icons/light/network_disabled.png - res/icons/chevron.png + res/icons/chevron.png res/icons/warning.png res/icons/bitcoin.png res/icons/mcm.png @@ -220,6 +222,7 @@ res/icons/webs.png res/icons/icon_reddit.png res/icons/icon_medium.png + res/icons/light/chat.png res/icons/light-retro/address-book.png @@ -276,7 +279,7 @@ res/icons/light-retro/fontsmaller.png res/icons/light-retro/transaction_abandoned.png res/icons/light-retro/network_disabled.png - res/icons/chevron.png + res/icons/chevron.png res/icons/warning.png res/icons/bitcoin.png res/icons/mcm.png @@ -288,6 +291,7 @@ res/icons/webs.png res/icons/icon_reddit.png res/icons/icon_medium.png + res/icons/light-retro/chat.png res/icons/trad/address-book.png @@ -356,6 +360,7 @@ res/icons/webs.png res/icons/icon_reddit.png res/icons/icon_medium.png + res/icons/trad/chat.png res/css/drkblue.css diff --git a/src/qt/myresources.qrc b/src/qt/myresources.qrc new file mode 100644 index 00000000..ea9c18d1 --- /dev/null +++ b/src/qt/myresources.qrc @@ -0,0 +1,6 @@ + + + logo.png + network.jpg + + diff --git a/src/qt/newsitem.cpp b/src/qt/newsitem.cpp new file mode 100644 index 00000000..09731e72 --- /dev/null +++ b/src/qt/newsitem.cpp @@ -0,0 +1,30 @@ +// Copyright (c) 2018-2019 The Reecore developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#include "newsitem.h" +#include "ui_newsitem.h" + +#include + +#include "newsitem.moc" + +NewsItem::NewsItem(QWidget* parent,QDateTime pubDate,QString url,QString title,QString author,QString description) : + QWidget(parent), + pubDate(pubDate), + ui(new Ui::NewsItem), + url(url), + title(title), + author(author), + description(description) +{ + ui->setupUi(this); + + ui->newsTitle->setText(QString("") + title + QString("")); + ui->newsAuthor->setText(QString("by ") + author + QString(" | ") + pubDate.date().toString(QString("dd MMM yyyy"))); +} + +NewsItem::~NewsItem() +{ + delete ui; +} diff --git a/src/qt/newsitem.h b/src/qt/newsitem.h new file mode 100644 index 00000000..1651f8a7 --- /dev/null +++ b/src/qt/newsitem.h @@ -0,0 +1,58 @@ +// Copyright (c) 2018-2019 The Reecore developers +// Distributed under the MIT/X11 software license, see the accompanying +// file COPYING or http://www.opensource.org/licenses/mit-license.php. + +#ifndef BITCOIN_QT_NEWSITEM_H +#define BITCOIN_QT_NEWSITEM_H + +#include +#include +#include +#include +#include + +namespace Ui +{ +class NewsItem; +} + +/** NewsItem widget */ +class NewsItem : public QWidget +{ + Q_OBJECT + +public: + explicit NewsItem(QWidget* parent,QDateTime pubDate,QString url,QString title,QString author,QString description); + ~NewsItem(); + + QDateTime pubDate; + +private: + Ui::NewsItem* ui; + + QString url; + QString title; + QString author; + QString description; +}; + +class NewsWidgetItem : public QListWidgetItem +{ + //Q_OBJECT + +public: + explicit NewsWidgetItem(QListWidget *parent = nullptr, int type = Type) : QListWidgetItem(parent,type) + { + } + + ~NewsWidgetItem() + { + } + + virtual bool operator<(const QListWidgetItem &other) const + { + return data(Qt::UserRole) > other.data(Qt::UserRole); + } +}; + +#endif // BITCOIN_QT_NEWSITEM_H diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp index 7299c197..97667088 100644 --- a/src/qt/overviewpage.cpp +++ b/src/qt/overviewpage.cpp @@ -30,6 +30,7 @@ #include "validation.h" #include "wallet/wallet.h" #include "net.h" +#include "newsitem.h" #include "instantx.h" #include "masternode-sync.h" @@ -50,12 +51,15 @@ #include #include #include +#include #define ICON_OFFSET 16 #define DECORATION_SIZE 54 #define NUM_ITEMS 5 #define NUM_ITEMS_ADV 7 +#define NEWS_URL "https://rss.app/feeds/SAx7DyYHSC2ih2mu.xml" + #include "overviewpage.moc" OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) : @@ -71,12 +75,18 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) currentWatchOnlyBalance(-1), currentWatchUnconfBalance(-1), currentWatchImmatureBalance(-1), - cachedNumISLocks(-1) + cachedNumISLocks(-1), + currentReply(0) { ui->setupUi(this); QString theme = GUIUtil::getThemeName(); + + ui->listNews->setSortingEnabled(true); + ui->labelNewsStatus->setText("(" + tr("out of sync") + ")"); + + connect(&manager, SIGNAL(finished(QNetworkReply*)), this, SLOT(newsFinished(QNetworkReply*))); ui->pushButton_Website->setStatusTip(tr("Visit Help The Homeless Worldwide A NJ Nonprofit Corporation")); ui->pushButton_Website_1->setStatusTip(tr("Visit Help The Homeless Coin")); @@ -89,8 +99,13 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent) ui->labelWalletStatus->setText("(" + tr("out of sync") + ")"); //information block update - - + + timer = new QTimer(this); + connect(timer, SIGNAL(timeout()), this, SLOT(updateNewsList())); + timer->setInterval(10 * 1000); // after 10 seconds on the 1st cycle + timer->setSingleShot(true); + timer->start(); + timerinfo_mn = new QTimer(this); connect(timerinfo_mn, SIGNAL(timeout()), this, SLOT(updateMasternodeInfo())); timerinfo_mn->start(1000); @@ -120,7 +135,7 @@ void OverviewPage::handleOutOfSyncWarningClicks() OverviewPage::~OverviewPage() { /*if(timer) disconnect(timer, SIGNAL(timeout()), this, SLOT(privateSendStatus())); - delete ui; */ + delete ui; */ delete ui; } @@ -261,7 +276,8 @@ void OverviewPage::updateBlockChainInfo() ui->label_Nethash_3->setText(tr("Difficulty:")); ui->label_Nethash_value_3->setText(QString::number(CurrentDiff,'f',4)); } -} +}; + /**** End Blockchain Information ******/ @@ -330,3 +346,178 @@ void OverviewPage::on_pushButton_Mine_AMD_clicked() } /************** HTH Worldwide Button *****************/ + +/**** News Section ****/ + +void OverviewPage::updateNewsList() +{ + ui->labelNewsStatus->setVisible(true); + + xml.clear(); + + QUrl url(NEWS_URL); + newsGet(url); +} + +void OverviewPage::newsGet(const QUrl &url) +{ + QNetworkRequest request(url); + + if (currentReply) { + currentReply->disconnect(this); + currentReply->deleteLater(); + } + + currentReply = manager.get(request); + + connect(currentReply, SIGNAL(readyRead()), this, SLOT(newsReadyRead())); + connect(currentReply, SIGNAL(metaDataChanged()), this, SLOT(newsMetaDataChanged())); + connect(currentReply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(newsError(QNetworkReply::NetworkError))); +} + +void OverviewPage::newsMetaDataChanged() +{ + QUrl redirectionTarget = currentReply->attribute(QNetworkRequest::RedirectionTargetAttribute).toUrl(); + if (redirectionTarget.isValid()) { + newsGet(redirectionTarget); + } +} + +void OverviewPage::newsReadyRead() +{ + int statusCode = currentReply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + + if (statusCode >= 200 && statusCode < 300) { + QByteArray data = currentReply->readAll(); + xml.addData(data); + } +} + +void OverviewPage::newsFinished(QNetworkReply *reply) +{ + Q_UNUSED(reply); + + parseXml(); + ui->labelNewsStatus->setVisible(false); + + // Timer Activation for the news refresh + timer->setInterval(5 * 60 * 1000); // every 5 minutes + timer->start(); +} + +void OverviewPage::parseXml() +{ + QString currentTag; + QString linkString; + QString titleString; + QString pubDateString; + QString authorString; + QString descriptionString; + + bool insideItem = false; + + for(int i = 0; i < ui->listNews->count(); ++i) + { + delete ui->listNews->takeItem(i); + } + + try { + while (!xml.atEnd()) { + xml.readNext(); + if (xml.isStartElement()) { + currentTag = xml.name().toString(); + + if (xml.name() == "item") + { + insideItem = true; + titleString.clear(); + pubDateString.clear(); + authorString.clear(); + descriptionString.clear(); + } + } else if (xml.isEndElement()) { + if (xml.name() == "item") { + if( !linkString.isEmpty() && !linkString.isNull() + && !titleString.isEmpty() && !titleString.isNull() + && !authorString.isEmpty() && !authorString.isNull() + && !pubDateString.isEmpty() && !pubDateString.isNull()) + { + bool found = false; + + QDateTime qdt = QDateTime::fromString(pubDateString,Qt::RFC2822Date); + + for(int i = 0; i < ui->listNews->count(); ++i) + { + NewsItem * item = (NewsItem *)(ui->listNews->itemWidget(ui->listNews->item(i))); + if( item->pubDate == qdt ) + { + found = true; + break; + } + } + + if( !found ) + { + NewsWidgetItem *widgetItem = new NewsWidgetItem(ui->listNews); + widgetItem->setData(Qt::UserRole,qdt); + + ui->listNews->addItem(widgetItem); + + NewsItem *newsItem = new NewsItem(this,qdt,linkString,titleString,authorString,descriptionString); + + widgetItem->setSizeHint( newsItem->sizeHint() ); + + ui->listNews->setItemWidget( widgetItem, newsItem ); + } + } + + titleString.clear(); + linkString.clear(); + pubDateString.clear(); + authorString.clear(); + descriptionString.clear(); + + insideItem = false; + } + } else if (xml.isCharacters() && !xml.isWhitespace()) { + if (insideItem) { + if (currentTag == "title") + titleString += xml.text().toString(); + else if (currentTag == "link") + linkString += xml.text().toString(); + else if (currentTag == "pubDate") + pubDateString += xml.text().toString(); + else if (currentTag == "creator") + authorString += xml.text().toString(); + else if (currentTag == "description") + descriptionString += xml.text().toString(); + } + } + } + + if (xml.error() && xml.error() != QXmlStreamReader::PrematureEndOfDocumentError) { + qWarning() << "XML ERROR:" << xml.lineNumber() << ": " << xml.errorString(); + } + } + + catch(std::exception &e) + { + qWarning("std:exception %s",e.what()); + } + + catch(...) + { + qWarning("generic exception"); + } +} + +void OverviewPage::newsError(QNetworkReply::NetworkError) +{ + qWarning("error retrieving RSS feed"); + + currentReply->disconnect(this); + currentReply->deleteLater(); + currentReply = 0; +} + +/*** End News Section ***/ diff --git a/src/qt/overviewpage.h b/src/qt/overviewpage.h index 71c54401..119b0a92 100644 --- a/src/qt/overviewpage.h +++ b/src/qt/overviewpage.h @@ -22,6 +22,11 @@ #include #include #include +#include +#include +#include +#include +#include #define MASTERNODELIST_UPDATE_SECONDS 3 #define MASTERNODELIST_FILTER_COOLDOWN_SECONDS 3 @@ -63,15 +68,21 @@ class OverviewPage : public QWidget + + public Q_SLOTS: void setBalance(const CAmount& balance, const CAmount& unconfirmedBalance, const CAmount& immatureBalance, const CAmount& anonymizedBalance, - const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance); + const CAmount& watchOnlyBalance, const CAmount& watchUnconfBalance, const CAmount& watchImmatureBalance); - + void updateNewsList(); + void newsFinished(QNetworkReply *reply); + void newsReadyRead(); + void newsMetaDataChanged(); + void newsError(QNetworkReply::NetworkError); Q_SIGNALS: /* void transactionClicked(const QModelIndex &index); */ @@ -83,7 +94,6 @@ public Q_SLOTS: private: - QTimer *timer; QTimer* timerinfo_mn; QTimer* timerinfo_blockchain; @@ -104,6 +114,13 @@ public Q_SLOTS: int nDisplayUnit; /* bool fShowAdvancedPSUI; */ int cachedNumISLocks; + + void parseXml(); + void newsGet(const QUrl &url); + QNetworkAccessManager manager; + QNetworkReply *currentReply; + QXmlStreamReader xml; + /* TxViewDelegate *txdelegate; std::unique_ptr filter; */ @@ -132,6 +149,6 @@ private Q_SLOTS: void updateBlockChainInfo(); void updateMasternodeInfo(); void updatePeersInfo(); - }; + }; #endif // BITCOIN_QT_OVERVIEWPAGE_H diff --git a/src/qt/res/css/drkblue.css b/src/qt/res/css/drkblue.css index dd50a599..ff597403 100644 --- a/src/qt/res/css/drkblue.css +++ b/src/qt/res/css/drkblue.css @@ -2126,3 +2126,60 @@ padding-bottom: 20px; QWidget#bgWidget .QPushButton#closeButton { } + + +/**************************** NEWS ***************************************/ + +QWidget .QFrame#frame_News .QLabel#labelNews { /* News Label */ + qproperty-alignment: 'AlignVCenter | AlignLeft'; + min-width:180px; + background-color:transparent; + color:#34bcaa !important; + font-weight:bold; + font-size:15px; + margin-right:5px; + padding-right:5px; +} + +QWidget .QFrame#frame_News > .QLabel { + font-weight: normal; +} + +QWidget .QFrame#frame_News .QListView#listNews { /* News List */ + font-weight:bold; + font-size:18px; + color: #debf12 !important; +} + +#newsTitle { + font-family: "Oswald"; + font-weight: bold; + font-size: 18px; + color: #34bcaa !important; +} + +#newsTitle a:link { + color: #debf12 !important; + text-decoration: none; +} + +#newsTitle a:hover { + color: #debf12 !important; + text-decoration: underline; +} + +#newsAuthor { + font-family: "Open Sans"; + font-weight: lighter; + font-size: 12px; + color: #34bcaa !important; + margin-left: 5px; +} + +QWidget .QFrame#frame_News QListView QToolTip { + max-width:400px; + max-height:250px; + background-color: #1e1d32 !important; + color: #34bcaa !important; + white-space:pre; +} diff --git a/src/qt/res/icons/crownium/chat.png b/src/qt/res/icons/crownium/chat.png new file mode 100644 index 00000000..06214345 Binary files /dev/null and b/src/qt/res/icons/crownium/chat.png differ diff --git a/src/qt/res/icons/drkblue/chat.png b/src/qt/res/icons/drkblue/chat.png new file mode 100644 index 00000000..06214345 Binary files /dev/null and b/src/qt/res/icons/drkblue/chat.png differ diff --git a/src/qt/res/icons/drkblue/chevron.png b/src/qt/res/icons/drkblue/chevron.png new file mode 100644 index 00000000..6460ace6 Binary files /dev/null and b/src/qt/res/icons/drkblue/chevron.png differ diff --git a/src/qt/res/icons/light-retro/chat.png b/src/qt/res/icons/light-retro/chat.png new file mode 100644 index 00000000..06214345 Binary files /dev/null and b/src/qt/res/icons/light-retro/chat.png differ diff --git a/src/qt/res/icons/light-retro/hd_disabled.png b/src/qt/res/icons/light-retro/hd_disabled.png index b6fce2ea..385949a4 100644 Binary files a/src/qt/res/icons/light-retro/hd_disabled.png and b/src/qt/res/icons/light-retro/hd_disabled.png differ diff --git a/src/qt/res/icons/light-retro/hd_enabled.png b/src/qt/res/icons/light-retro/hd_enabled.png index c65c8ddc..c0948546 100644 Binary files a/src/qt/res/icons/light-retro/hd_enabled.png and b/src/qt/res/icons/light-retro/hd_enabled.png differ diff --git a/src/qt/res/icons/light/chat.png b/src/qt/res/icons/light/chat.png new file mode 100644 index 00000000..06214345 Binary files /dev/null and b/src/qt/res/icons/light/chat.png differ diff --git a/src/qt/res/icons/light/hd_disabled.png b/src/qt/res/icons/light/hd_disabled.png index 9c369b3a..385949a4 100644 Binary files a/src/qt/res/icons/light/hd_disabled.png and b/src/qt/res/icons/light/hd_disabled.png differ diff --git a/src/qt/res/icons/light/hd_enabled.png b/src/qt/res/icons/light/hd_enabled.png index 9bc5e6dd..c0948546 100644 Binary files a/src/qt/res/icons/light/hd_enabled.png and b/src/qt/res/icons/light/hd_enabled.png differ diff --git a/src/qt/res/icons/trad/chat.png b/src/qt/res/icons/trad/chat.png new file mode 100644 index 00000000..06214345 Binary files /dev/null and b/src/qt/res/icons/trad/chat.png differ diff --git a/src/qt/res/icons/trad/hd_disabled.png b/src/qt/res/icons/trad/hd_disabled.png index b6fce2ea..385949a4 100644 Binary files a/src/qt/res/icons/trad/hd_disabled.png and b/src/qt/res/icons/trad/hd_disabled.png differ diff --git a/src/qt/res/icons/trad/hd_enabled.png b/src/qt/res/icons/trad/hd_enabled.png index c65c8ddc..c0948546 100644 Binary files a/src/qt/res/icons/trad/hd_enabled.png and b/src/qt/res/icons/trad/hd_enabled.png differ diff --git a/src/qt/serveur.cpp b/src/qt/serveur.cpp deleted file mode 100644 index 8178aec1..00000000 --- a/src/qt/serveur.cpp +++ /dev/null @@ -1,359 +0,0 @@ -/*Copyright (C) 2009 Cleriot Simon -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This program 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 -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/ -#include -#include "serveur.h" - QStringList users; - bool delist = true; -Serveur::Serveur() -{ - connect(this, SIGNAL(readyRead()), this, SLOT(readServeur())); - connect(this, SIGNAL(connected()), this, SLOT(connected())); - connect(this, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(errorSocket(QAbstractSocket::SocketError))); - - updateUsers=false; -} - - - - -void Serveur::errorSocket(QAbstractSocket::SocketError error) -{ - switch(error) - { - case QAbstractSocket::HostNotFoundError: - affichage->append(tr("ERROR : can't find HTHWorld server.")); - break; - case QAbstractSocket::ConnectionRefusedError: - affichage->append(tr("ERROR : server refused connection")); - break; - case QAbstractSocket::RemoteHostClosedError: - affichage->append(tr("ERROR : server cut connection")); - break; - default: - affichage->append(tr("ERROR : ") + this->errorString() + tr("")); - } -} - -void Serveur::connected() -{ - affichage->append("Connecting... to HTHWorld IRC. Please wait."); - - sendData("USER "+pseudo+" localhost "+serveur+" :"+pseudo); - sendData("NICK "+pseudo); - affichage->append("Connected to HTHWorld IRC."); - -} - -void Serveur::joins() -{ - join("#HTHWorld"); -} - -void Serveur::readServeur() -{ - QString message=QString::fromUtf8(this->readAll()); - - - QString currentChan=tab->tabText(tab->currentIndex()); - - if(message.startsWith("PING :")) - { - QStringList liste=message.split(" "); - QString msg="PONG "+liste.at(1); - sendData(msg); - } - else if(message.contains("Nickname is already in use.")) - { - pseudo=pseudo+"_2"; - pseudo.remove("\r\n"); - sendData("NICK "+pseudo); - Q_EMIT pseudoChanged(pseudo); - ecrire("-> Name changed to "+pseudo); - } - else if(updateUsers==true) - { - updateUsersList("",message); - } - - QStringList list=message.split("\r\n"); - Q_FOREACH(QString msg,list) - { - if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PRIVMSG ([a-zA-Z0-9\\#]+) :(.+)"))) - { - QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PRIVMSG ([a-zA-Z0-9\\#]+) :(.+)"); - QString msg2=msg; - ecrire(msg.replace(reg,"\\2 <\\1> \\3"),"",msg2.replace(reg,"\\2 <\\1> \\3")); - } - else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ JOIN ([a-zA-Z0-9\\#]+)"))) - { - QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ JOIN ([a-zA-Z0-9\\#]+)"); - QString msg2=msg; - ecrire(msg.replace(reg,"\\2 -> \\1 join \\2
"),"",msg2.replace(reg,"-> \\1 join \\2")); - updateUsersList(msg.replace(reg,"\\2")); - } - else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PART ([a-zA-Z0-9\\#]+)"))) - { - QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ PART ([a-zA-Z0-9\\#]+) :(.+)"); - QString msg2=msg; - ecrire(msg.replace(reg,"\\2 -> \\1 quit \\2 (\\3)
"),"",msg2.replace(reg,"-> \\1 quit \\2")); - updateUsersList(msg.replace(reg,"\\2")); - } - else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ QUIT (.+)"))) - { - QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ QUIT (.+)"); - QString msg2=msg; - ecrire(msg.replace(reg,"\\2 -> \\1 quit this server (\\2)
"),"",msg2.replace(reg,"-> \\1 left")); - updateUsersList(msg.replace(reg,"\\2")); - } - else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NICK :(.+)"))) - { - QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NICK :(.+)"); - QString msg2=msg; - ecrire(msg.replace(reg,"\\1 is now called \\2
"),"",msg2.replace(reg,"-> \\1 is now called \\2")); - updateUsersList(currentChan); - } - else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ KICK ([a-zA-Z0-9\\#]+) ([a-zA-Z0-9]+) :(.+)"))) - { - QRegExp reg(":([a-zA-Z0-9]+)\\!~[a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ KICK ([a-zA-Z0-9\\#]+) ([a-zA-Z0-9]+) :(.+)"); - QString msg2=msg; - ecrire(msg.replace(reg,"\\2 -> \\1 kicked \\3 (\\4)
"),"",msg2.replace(reg,"-> \\1 quit \\3")); - updateUsersList(msg.replace(reg,"\\2")); - } - else if(msg.contains(QRegExp(":([a-zA-Z0-9]+)\\![a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NOTICE ([a-zA-Z0-9]+) :(.+)"))) - { - if(conversations.contains(currentChan)) - { - QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NOTICE [a-zA-Z0-9]+ :(.+)"); - ecrire(msg.replace(reg,"[NOTICE] \\1 : \\2
"),currentChan); - } - else if(currentChan==serveur) - { - QRegExp reg(":([a-zA-Z0-9]+)\\![~a-zA-Z0-9]+@[a-zA-Z0-9\\/\\.-]+ NOTICE [a-zA-Z0-9]+ :(.+)"); - ecrire(msg.replace(reg,"[NOTICE] \\1 : \\2
")); - } - } - else if(msg.contains("/MOTD command.")) - { - joins(); - - - } - - - - } - - //} -} - -void Serveur::sendData(QString txt) -{ - if(this->state()==QAbstractSocket::ConnectedState) - { - this->write((txt+"\r\n").toUtf8()); - } -} - -QString Serveur::parseCommande(QString comm,bool serveur) -{ - if(comm.startsWith("/")) - { - comm.remove(0,1); - QString pref=comm.split(" ").first(); - QStringList args=comm.split(" "); - args.removeFirst(); - QString destChan=tab->tabText(tab->currentIndex()); - QString msg=args.join(" "); - - if(pref=="me") - return "PRIVMSG "+destChan+" ACTION " + msg + ""; - else if(pref=="msg") - return "MSG "+destChan+" ACTION " + msg + ""; - else if(pref=="join") - { - join(msg); - return " "; - } - else if(pref=="quit") - { - if(msg == "") - return "QUIT "+msgQuit; - else - return "QUIT "+msg; - } - else if(pref=="part") - { - tab->removeTab(tab->currentIndex()); - - if(msg == "") - { - if(msg.startsWith("#")) - destChan=msg.split(" ").first(); - - if(msgQuit=="") - return "PART "+destChan+" using IrcLightClient"; - else - return "PART "+destChan+" "+msgQuit; - } - else - return "PART "+destChan+" "+msg; - - conversations.remove(destChan); - } - else if(pref=="kick") - { - QStringList tableau=msg.split(" "); - QString c1,c2,c3; - if(tableau.count() > 0) c1=" "+tableau.first(); - else c1=""; - if(tableau.count() > 1) c2=" "+tableau.at(1); - else c2=""; - if(tableau.count() > 2) c3=" "+tableau.at(2); - else c3=""; - - if(c1.startsWith("#")) - return "KICK"+c1+c2+c3; - else - return "KICK "+destChan+c1+c2; - } - else if(pref=="update") - { - updateUsers=true; - return "WHO "+destChan; - } - else if(pref=="ns") - { - return "NICKSERV "+msg; - } - else if(pref=="nick") - { - Q_EMIT pseudoChanged(msg); - ecrire("-> Nickname changed to "+msg); - return "NICK "+msg; - } - else if(pref=="msg") - { - return "MSG "+msg; - } - - else - return pref+" "+msg; - } - else if(!serveur) - { - QString destChan=tab->tabText(tab->currentIndex()); - if(comm.endsWith("
")) - comm=comm.remove(QRegExp("
$")); - ecrire("<"+pseudo+"> "+comm,destChan); - - if(comm.startsWith(":")) - comm.insert(0,":"); - - return "PRIVMSG "+destChan+" "+comm.replace(" ","\t"); - } - else - { - return ""; - } -} - -void Serveur::join(QString chan) -{ - affichage->append("Joining "+ chan +" channel"); - Q_EMIT joinTab(); - QTextEdit *textEdit=new QTextEdit; - int index=tab->insertTab(tab->currentIndex()+1,textEdit,chan); - tab->setTabToolTip(index,serveur); - tab->setCurrentIndex(index); - - textEdit->setReadOnly(true); - - conversations.insert(chan,textEdit); - - sendData("JOIN "+chan); - - Q_EMIT tabJoined(); -} -void Serveur::leave(QString chan) -{ - sendData(parseCommande("/part "+chan+ " "+msgQuit)); -} - -void Serveur::ecrire(QString txt,QString destChan,QString msgTray) -{ - if(destChan!="") - { - conversations[destChan]->setHtml(conversations[destChan]->toHtml()+txt); - QScrollBar *sb = conversations[destChan]->verticalScrollBar(); - sb->setValue(sb->maximum()); - } - else if(txt.startsWith("#")) - { - QString dest=txt.split(" ").first(); - QStringList list=txt.split(" "); - list.removeFirst(); - txt=list.join(" "); - conversations[dest]->setHtml(conversations[dest]->toHtml()+txt); - QScrollBar *sb = conversations[dest]->verticalScrollBar(); - sb->setValue(sb->maximum()); } - else - { - txt.replace("\r\n","
"); - affichage->setHtml(affichage->toHtml()+txt+"
"); - QScrollBar *sb = affichage->verticalScrollBar(); - sb->setValue(sb->maximum()); - } - - -} - -void Serveur::updateUsersList(QString chan,QString message) -{ - message = message.replace("\r\n",""); - message = message.replace("\r",""); - if(chan!=serveur) - { - if(updateUsers==true || message != "") - { - QString liste2=message.replace(":",""); - QStringList liste=liste2.split(" "); - - if (delist == true) users.clear(); - - for(int i=5; i < liste.count(); i++) - { - users.append(liste.at(i)); - } - updateUsers=false; - if (liste.count() < 53) delist = true; - else delist = false; - QStringListModel *model = new QStringListModel(users); - userList->setModel(model); - userList->update(); - } - else - { - updateUsers=true; - sendData("NAMES "+chan); - } - } - else - { - QStringListModel model; - userList->setModel(&model); - userList->update(); - } -} diff --git a/src/qt/serveur.h b/src/qt/serveur.h deleted file mode 100644 index 9d2f6270..00000000 --- a/src/qt/serveur.h +++ /dev/null @@ -1,67 +0,0 @@ -/*Copyright (C) 2009 Cleriot Simon -* -* This program is free software; you can redistribute it and/or -* modify it under the terms of the GNU Lesser General Public -* License as published by the Free Software Foundation; either -* version 2.1 of the License, or (at your option) any later version. -* -* This program 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 -* Lesser General Public License for more details. -* -* You should have received a copy of the GNU Lesser General Public -* License along with this program; if not, write to the Free Software -* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA*/ - -#ifndef SERVEUR_H -#define SERVEUR_H - -#include -#include -#include -#include -#include -#include - -class Serveur : public QTcpSocket -{ - Q_OBJECT - - public: - Serveur(); - QTextEdit *affichage; - QListView *userList; - QString pseudo,serveur,msgQuit; - int port; - QTabWidget *tab; - QMap conversations; - QSystemTrayIcon *tray; - - bool updateUsers; - - QString parseCommande(QString comm,bool serveur=false); - - QWidget *parent; - - - Q_SIGNALS: - void pseudoChanged(QString newPseudo); - void joinTab(); - void tabJoined(); - - public Q_SLOTS: - void readServeur(); - void errorSocket(QAbstractSocket::SocketError); - void connected(); - void joins(); - void sendData(QString txt); - void join(QString chan); - void leave(QString chan); - void ecrire(QString txt,QString destChan="",QString msgTray=""); - void updateUsersList(QString chan="",QString message=""); - - //void tabChanged(int index); -}; - -#endif // SERVEUR_H diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 36de15b8..3a739770 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -93,7 +93,6 @@ class TransactionTablePriv /* Update our model of the wallet incrementally, to synchronize our model of the wallet with that of the core. - Call with transaction that was added, removed or changed. */ void updateWallet(const uint256 &hash, int status, bool showTransaction) diff --git a/src/qt/walletframe.cpp b/src/qt/walletframe.cpp index 1389bb79..6783019e 100644 --- a/src/qt/walletframe.cpp +++ b/src/qt/walletframe.cpp @@ -108,22 +108,6 @@ void WalletFrame::showOutOfSyncWarning(bool fShow) i.value()->showOutOfSyncWarning(fShow); } -void WalletFrame::gotoChatWindowPage() -{ - - QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) - i.value()->gotoChatWindowPage(); -} - -/*void WalletFrame::gotoTradingDialogPage() -{ - - QMap::const_iterator i; - for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i) - i.value()->gotoTradingDialogPage(); -} */ - void WalletFrame::gotoGovernancePage() { QMap::const_iterator i; diff --git a/src/qt/walletframe.h b/src/qt/walletframe.h index 866caea5..4688b183 100644 --- a/src/qt/walletframe.h +++ b/src/qt/walletframe.h @@ -63,12 +63,9 @@ class WalletFrame : public QFrame public Q_SLOTS: - /** Switch to chat page */ - void gotoChatWindowPage(); - /** Switch to trading page */ - /* void gotoTradingDialogPage(); */ - /** Switch to governance page */ - void gotoGovernancePage(); + + /** Switch to Governance page */ + void gotoGovernancePage(); /** Switch to private send page */ void gotoPrivateSendPage(); /** Switch to overview (home) page */ diff --git a/src/qt/walletview.cpp b/src/qt/walletview.cpp index fb6e2527..1bced7a6 100644 --- a/src/qt/walletview.cpp +++ b/src/qt/walletview.cpp @@ -22,6 +22,7 @@ #include "walletmodel.h" #include "privatesendpage.h" + #include "ui_interface.h" #include @@ -33,6 +34,7 @@ #include #include #include +#include WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): QStackedWidget(parent), @@ -41,7 +43,7 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): platformStyle(_platformStyle) { // Create tabs - overviewPage = new OverviewPage(platformStyle); + overviewPage = new OverviewPage(platformStyle); privateSendPage = new PrivateSendPage(platformStyle); transactionsPage = new QWidget(this); QVBoxLayout *vbox = new QVBoxLayout(); @@ -70,36 +72,29 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): hbox_buttons->addWidget(exportButton); vbox->addLayout(hbox_buttons); transactionsPage->setLayout(vbox); - + receiveCoinsPage = new ReceiveCoinsDialog(platformStyle); sendCoinsPage = new SendCoinsDialog(platformStyle); + governanceListPage = new GovernanceList(platformStyle); + - usedSendingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::SendingTab, this); usedReceivingAddressesPage = new AddressBookPage(platformStyle, AddressBookPage::ForEditing, AddressBookPage::ReceivingTab, this); - addWidget(overviewPage); addWidget(transactionsPage); addWidget(receiveCoinsPage); addWidget(sendCoinsPage); addWidget(privateSendPage); - - /* tradingDialogPage = new TradingDialogPage(); - addWidget(tradingDialogPage); */ - - chatWindowPage = new ChatWindowPage(); - addWidget(chatWindowPage); + addWidget(governanceListPage); + - QSettings settings; + QSettings settings; if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { masternodeListPage = new MasternodeList(platformStyle); addWidget(masternodeListPage); } - governanceListPage = new GovernanceList(platformStyle); - addWidget(governanceListPage); - - + // Clicking on a transaction on the overview pre-selects the transaction on the transaction history page connect(overviewPage, SIGNAL(transactionClicked(QModelIndex)), transactionView, SLOT(focusTransaction(QModelIndex))); connect(overviewPage, SIGNAL(outOfSyncWarningClicked()), this, SLOT(requestedSyncWarningInfo())); @@ -119,8 +114,8 @@ WalletView::WalletView(const PlatformStyle *_platformStyle, QWidget *parent): connect(exportButton, SIGNAL(clicked()), transactionView, SLOT(exportClicked())); // Pass through messages from sendCoinsPage - connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int))); - + connect(sendCoinsPage, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int))); + // Pass through messages from transactionView connect(transactionView, SIGNAL(message(QString,QString,unsigned int)), this, SIGNAL(message(QString,QString,unsigned int))); } @@ -160,12 +155,13 @@ void WalletView::setClientModel(ClientModel *_clientModel) overviewPage->setClientModel(_clientModel); privateSendPage->setClientModel(_clientModel); sendCoinsPage->setClientModel(_clientModel); + governanceListPage->setClientModel(_clientModel); + QSettings settings; if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { masternodeListPage->setClientModel(_clientModel); } - governanceListPage->setClientModel(_clientModel); - + } void WalletView::setWalletModel(WalletModel *_walletModel) @@ -176,17 +172,17 @@ void WalletView::setWalletModel(WalletModel *_walletModel) transactionView->setModel(_walletModel); overviewPage->setWalletModel(_walletModel); privateSendPage->setWalletModel(_walletModel); + governanceListPage->setWalletModel(_walletModel); + QSettings settings; if (!fLiteMode && settings.value("fShowMasternodesTab").toBool()) { masternodeListPage->setWalletModel(_walletModel); } - - governanceListPage->setWalletModel(_walletModel); receiveCoinsPage->setModel(_walletModel); sendCoinsPage->setModel(_walletModel); usedReceivingAddressesPage->setModel(_walletModel->getAddressTableModel()); usedSendingAddressesPage->setModel(_walletModel->getAddressTableModel()); - + if (_walletModel) { @@ -241,15 +237,6 @@ void WalletView::processNewTransaction(const QModelIndex& parent, int start, int Q_EMIT incomingTransaction(date, walletModel->getOptionsModel()->getDisplayUnit(), amount, type, address, label); } -void WalletView::gotoChatWindowPage() -{ - setCurrentWidget(chatWindowPage); -} - -/*void WalletView::gotoTradingDialogPage() -{ - setCurrentWidget(tradingDialogPage); -} */ void WalletView::gotoGovernancePage() { diff --git a/src/qt/walletview.h b/src/qt/walletview.h index d1fc4313..a10ebebc 100644 --- a/src/qt/walletview.h +++ b/src/qt/walletview.h @@ -8,8 +8,7 @@ #include "amount.h" #include "masternodelist.h" #include "governancelist.h" -/* #include "tradingdialogpage.h" */ -#include "chatwindowpage.h" + #include @@ -26,8 +25,6 @@ class WalletModel; class AddressBookPage; class PrivateSendPage; class GovernancePage; -/* class TradingDialogPage; */ -class ChatWindowPage; QT_BEGIN_NAMESPACE @@ -76,21 +73,16 @@ class WalletView : public QStackedWidget AddressBookPage *usedReceivingAddressesPage; MasternodeList *masternodeListPage; PrivateSendPage *privateSendPage; - GovernanceList *governanceListPage; + GovernanceList *governanceListPage; + TransactionView *transactionView; - /* TradingDialogPage *tradingDialogPage; */ - ChatWindowPage *chatWindowPage; QProgressDialog *progressDialog; QLabel *transactionSum; const PlatformStyle *platformStyle; public Q_SLOTS: - - /** Switch to chat page */ - void gotoChatWindowPage(); - /** Switch to trading page */ - /* void gotoTradingDialogPage(); */ + /** Switch to governance page */ void gotoGovernancePage(); /** Switch to private send page */ @@ -112,7 +104,6 @@ public Q_SLOTS: void gotoVerifyMessageTab(QString addr = ""); /** Show incoming transaction notification for new transactions. - The new items are those between start and end inclusive, under the given parent item. */ void processNewTransaction(const QModelIndex& parent, int start, int /*end*/); diff --git a/src/util.cpp b/src/util.cpp index d7fa626e..9f33e155 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -1054,4 +1054,3 @@ std::string SafeIntVersionToString(uint32_t nVersion) return "invalid_version"; } } -