Auto merge of #1636 - daira:fix-licensing-and-remove-qt, r=str4d
Remove QT code This removes the QT wallet code, and updates license documentation accordingly.
This commit is contained in:
commit
a28b17b7b7
|
@ -7,7 +7,6 @@ src/zcash-cli
|
|||
src/zcash-gtest
|
||||
src/zcash-tx
|
||||
src/test/test_bitcoin
|
||||
src/qt/test/test_bitcoin-qt
|
||||
|
||||
# Zcash utilities
|
||||
src/zcash/GenerateParams
|
||||
|
@ -41,16 +40,11 @@ src/config/bitcoin-config.h
|
|||
src/config/bitcoin-config.h.in
|
||||
src/config/stamp-h1
|
||||
share/setup.nsi
|
||||
share/qt/Info.plist
|
||||
|
||||
cache/
|
||||
venv-mnf/
|
||||
src/univalue/gen
|
||||
|
||||
src/qt/*.moc
|
||||
src/qt/moc_*.cpp
|
||||
src/qt/forms/ui_*.h
|
||||
|
||||
src/qt/test/moc*.cpp
|
||||
|
||||
.deps
|
||||
.dirstamp
|
||||
.libs
|
||||
|
@ -79,23 +73,16 @@ src/qt/test/moc*.cpp
|
|||
*.lo
|
||||
*.la
|
||||
|
||||
# Compilation and Qt preprocessor part
|
||||
*.qm
|
||||
# Compilation
|
||||
Makefile
|
||||
bitcoin-qt
|
||||
Bitcoin-Qt.app
|
||||
|
||||
# Unit-tests
|
||||
Makefile.test
|
||||
bitcoin-qt_test
|
||||
src/test/buildenv.py
|
||||
|
||||
# Resources cpp
|
||||
qrc_*.cpp
|
||||
|
||||
# Qt creator
|
||||
*.pro.user
|
||||
|
||||
# Mac specific
|
||||
.DS_Store
|
||||
build
|
||||
|
|
|
@ -31,11 +31,11 @@ matrix:
|
|||
- compiler: ": ARM"
|
||||
env: HOST=arm-linux-gnueabihf PACKAGES="g++-arm-linux-gnueabihf" DEP_OPTS="NO_QT=1" GOAL="install" BITCOIN_CONFIG="--enable-glibc-back-compat --enable-reduce-exports"
|
||||
- compiler: ": Win32"
|
||||
env: HOST=i686-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-i686 g++-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-gui --enable-reduce-exports" MAKEJOBS="-j2"
|
||||
env: HOST=i686-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-i686 g++-mingw-w64-i686 binutils-mingw-w64-i686 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-reduce-exports" MAKEJOBS="-j2"
|
||||
- compiler: ": 32-bit + dash"
|
||||
env: HOST=i686-pc-linux-gnu PACKAGES="g++-multilib bc python-zmq" PPA="ppa:chris-lea/zeromq" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports LDFLAGS=-static-libstdc++" USE_SHELL="/bin/dash"
|
||||
- compiler: ": Win64"
|
||||
env: HOST=x86_64-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-gui --enable-reduce-exports" MAKEJOBS="-j2"
|
||||
env: HOST=x86_64-w64-mingw32 PACKAGES="nsis gcc-mingw-w64-x86-64 g++-mingw-w64-x86-64 binutils-mingw-w64-x86-64 mingw-w64-dev wine bc" RUN_TESTS=true GOAL="deploy" BITCOIN_CONFIG="--enable-reduce-exports" MAKEJOBS="-j2"
|
||||
- compiler: ": bitcoind"
|
||||
env: HOST=x86_64-unknown-linux-gnu PACKAGES="bc python-zmq" PPA="ppa:chris-lea/zeromq" DEP_OPTS="NO_QT=1 NO_UPNP=1 DEBUG=1" RUN_TESTS=true GOAL="install" BITCOIN_CONFIG="--enable-zmq --enable-glibc-back-compat --enable-reduce-exports CPPFLAGS=-DDEBUG_LOCKORDER"
|
||||
- compiler: ": No wallet"
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
[main]
|
||||
host = https://www.transifex.com
|
||||
|
||||
[bitcoin.qt-translation-011x]
|
||||
file_filter = src/qt/locale/bitcoin_<lang>.ts
|
||||
source_file = src/qt/locale/bitcoin_en.ts
|
||||
source_lang = en
|
10
COPYING
10
COPYING
|
@ -20,12 +20,10 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|||
THE SOFTWARE.
|
||||
|
||||
|
||||
The MIT software license (http://www.opensource.org/licenses/mit-license.php)
|
||||
above applies to the code directly included in this source distribution, with
|
||||
the exception of certain files under the 'src/qt/' and 'scripts/img/' directories
|
||||
which are distributed under the LGPL or GPL licenses. Dependencies downloaded
|
||||
as part of the build process may be covered by other open source licenses.
|
||||
For further details see 'contrib/DEBIAN/copyright'.
|
||||
The [MIT software license](http://www.opensource.org/licenses/mit-license.php)
|
||||
above applies to the code directly included in this source distribution.
|
||||
Dependencies downloaded as part of the build process may be covered by other
|
||||
open-source licenses. For further details see 'contrib/debian/copyright'.
|
||||
|
||||
|
||||
This product includes software developed by the OpenSSL Project for use in the
|
||||
|
|
156
Makefile.am
156
Makefile.am
|
@ -13,19 +13,18 @@ pkgconfig_DATA = libzcashconsensus.pc
|
|||
endif
|
||||
|
||||
BITCOIND_BIN=$(top_builddir)/src/zcashd$(EXEEXT)
|
||||
BITCOIN_QT_BIN=$(top_builddir)/src/qt/bitcoin-qt$(EXEEXT)
|
||||
BITCOIN_CLI_BIN=$(top_builddir)/src/zcash-cli$(EXEEXT)
|
||||
BITCOIN_WIN_INSTALLER=$(PACKAGE)-$(PACKAGE_VERSION)-win$(WINDOWS_BITS)-setup$(EXEEXT)
|
||||
|
||||
OSX_APP=Bitcoin-Qt.app
|
||||
OSX_DMG=Bitcoin-Core.dmg
|
||||
OSX_BACKGROUND_IMAGE=background.tiff
|
||||
OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
||||
OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
||||
OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
||||
OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
||||
OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
|
||||
OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
|
||||
##OSX_APP=Bitcoin-Qt.app
|
||||
##OSX_DMG=Bitcoin-Core.dmg
|
||||
##OSX_BACKGROUND_IMAGE=background.tiff
|
||||
##OSX_DEPLOY_SCRIPT=$(top_srcdir)/contrib/macdeploy/macdeployqtplus
|
||||
##OSX_FANCY_PLIST=$(top_srcdir)/contrib/macdeploy/fancy.plist
|
||||
##OSX_BASE_LPROJ_DIR=$(top_srcdir)/contrib/macdeploy/Base.lproj/InfoPlist.strings
|
||||
##OSX_INSTALLER_ICONS=$(top_srcdir)/src/qt/res/icons/bitcoin.icns
|
||||
##OSX_PLIST=$(top_srcdir)/share/qt/Info.plist #not installed
|
||||
##OSX_QT_TRANSLATIONS = da,de,es,hu,ru,uk,zh_CN,zh_TW
|
||||
|
||||
DIST_DOCS = $(wildcard doc/*.md) $(wildcard doc/release-notes/*.md)
|
||||
|
||||
|
@ -36,11 +35,11 @@ WINDOWS_PACKAGING = $(top_srcdir)/share/pixmaps/bitcoin.ico \
|
|||
$(top_srcdir)/share/pixmaps/nsis-header.bmp \
|
||||
$(top_srcdir)/share/pixmaps/nsis-wizard.bmp
|
||||
|
||||
OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
||||
$(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
||||
$(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||
$(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
||||
##OSX_PACKAGING = $(OSX_DEPLOY_SCRIPT) $(OSX_FANCY_PLIST) $(OSX_INSTALLER_ICONS) $(OSX_BASE_LPROJ_DIR) \
|
||||
## $(top_srcdir)/contrib/macdeploy/$(OSX_BACKGROUND_IMAGE) \
|
||||
## $(top_srcdir)/contrib/macdeploy/DS_Store \
|
||||
## $(top_srcdir)/contrib/macdeploy/detached-sig-apply.sh \
|
||||
## $(top_srcdir)/contrib/macdeploy/detached-sig-create.sh
|
||||
|
||||
COVERAGE_INFO = baseline_filtered_combined.info baseline.info block_test.info \
|
||||
leveldb_baseline.info test_bitcoin_filtered.info total_coverage.info \
|
||||
|
@ -64,7 +63,6 @@ distcleancheck:
|
|||
$(BITCOIN_WIN_INSTALLER): all-recursive
|
||||
$(MKDIR_P) $(top_builddir)/release
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIND_BIN) $(top_builddir)/release
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_QT_BIN) $(top_builddir)/release
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $(BITCOIN_CLI_BIN) $(top_builddir)/release
|
||||
@test -f $(MAKENSIS) && $(MAKENSIS) -V2 $(top_builddir)/share/setup.nsi || \
|
||||
echo error: could not build $@
|
||||
|
@ -73,75 +71,73 @@ $(BITCOIN_WIN_INSTALLER): all-recursive
|
|||
$(if $(findstring src/,$(MAKECMDGOALS)),$(MAKECMDGOALS), none): FORCE
|
||||
$(MAKE) -C src $(patsubst src/%,%,$@)
|
||||
|
||||
$(OSX_APP)/Contents/PkgInfo:
|
||||
$(MKDIR_P) $(@D)
|
||||
@echo "APPL????" > $@
|
||||
##$(OSX_APP)/Contents/PkgInfo:
|
||||
## $(MKDIR_P) $(@D)
|
||||
## @echo "APPL????" > $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Resources/empty.lproj:
|
||||
## $(MKDIR_P) $(@D)
|
||||
## @touch $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL_DATA) $< $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL_DATA) $< $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||
##
|
||||
##$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL_DATA) $< $@
|
||||
##
|
||||
##OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||
## $(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||
## $(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||
##
|
||||
##if BUILD_DARWIN
|
||||
##$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
## $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
|
||||
##
|
||||
##deploydir: $(OSX_DMG)
|
||||
##else
|
||||
##APP_DIST_DIR=$(top_builddir)/dist
|
||||
##APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
||||
##
|
||||
##$(APP_DIST_DIR)/Applications:
|
||||
## @rm -f $@
|
||||
## @cd $(@D); $(LN_S) /Applications $(@F)
|
||||
##
|
||||
##$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
##
|
||||
##$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||
## $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
|
||||
##
|
||||
##$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
||||
## $(MKDIR_P) $(@D)
|
||||
## $(INSTALL) $< $@
|
||||
##$(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
|
||||
## $(INSTALL) $< $@
|
||||
##
|
||||
##$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
## INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||
##
|
||||
##deploydir: $(APP_DIST_EXTRAS)
|
||||
##endif
|
||||
##
|
||||
##if TARGET_DARWIN
|
||||
##appbundle: $(OSX_APP_BUILT)
|
||||
##deploy: $(OSX_DMG)
|
||||
##endif
|
||||
|
||||
$(OSX_APP)/Contents/Resources/empty.lproj:
|
||||
$(MKDIR_P) $(@D)
|
||||
@touch $@
|
||||
|
||||
$(OSX_APP)/Contents/Info.plist: $(OSX_PLIST)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns: $(OSX_INSTALLER_ICONS)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(BITCOIN_QT_BIN)
|
||||
$(MKDIR_P) $(@D)
|
||||
STRIPPROG="$(STRIP)" $(INSTALL_STRIP_PROGRAM) $< $@
|
||||
|
||||
$(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings: $(OSX_BASE_LPROJ_DIR)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL_DATA) $< $@
|
||||
|
||||
OSX_APP_BUILT=$(OSX_APP)/Contents/PkgInfo $(OSX_APP)/Contents/Resources/empty.lproj \
|
||||
$(OSX_APP)/Contents/Resources/bitcoin.icns $(OSX_APP)/Contents/Info.plist \
|
||||
$(OSX_APP)/Contents/MacOS/Bitcoin-Qt $(OSX_APP)/Contents/Resources/Base.lproj/InfoPlist.strings
|
||||
|
||||
if BUILD_DARWIN
|
||||
$(OSX_DMG): $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
$(OSX_DEPLOY_SCRIPT) $(OSX_APP) -add-qt-tr $(OSX_QT_TRANSLATIONS) -translations-dir=$(QT_TRANSLATION_DIR) -dmg -fancy $(OSX_FANCY_PLIST) -verbose 2
|
||||
|
||||
deploydir: $(OSX_DMG)
|
||||
else
|
||||
APP_DIST_DIR=$(top_builddir)/dist
|
||||
APP_DIST_EXTRAS=$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE) $(APP_DIST_DIR)/.DS_Store $(APP_DIST_DIR)/Applications
|
||||
|
||||
$(APP_DIST_DIR)/Applications:
|
||||
@rm -f $@
|
||||
@cd $(@D); $(LN_S) /Applications $(@F)
|
||||
|
||||
$(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt
|
||||
|
||||
$(OSX_DMG): $(APP_DIST_EXTRAS)
|
||||
$(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Bitcoin-Core" -no-pad -r -apple -o $@ dist
|
||||
|
||||
$(APP_DIST_DIR)/.background/$(OSX_BACKGROUND_IMAGE): contrib/macdeploy/$(OSX_BACKGROUND_IMAGE)
|
||||
$(MKDIR_P) $(@D)
|
||||
$(INSTALL) $< $@
|
||||
$(APP_DIST_DIR)/.DS_Store: contrib/macdeploy/DS_Store
|
||||
$(INSTALL) $< $@
|
||||
|
||||
$(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/Bitcoin-Qt: $(OSX_APP_BUILT) $(OSX_PACKAGING)
|
||||
INSTALLNAMETOOL=$(INSTALLNAMETOOL) OTOOL=$(OTOOL) STRIP=$(STRIP) $(OSX_DEPLOY_SCRIPT) $(OSX_APP) -translations-dir=$(QT_TRANSLATION_DIR) -add-qt-tr $(OSX_QT_TRANSLATIONS) -verbose 2
|
||||
|
||||
deploydir: $(APP_DIST_EXTRAS)
|
||||
endif
|
||||
|
||||
if TARGET_DARWIN
|
||||
appbundle: $(OSX_APP_BUILT)
|
||||
deploy: $(OSX_DMG)
|
||||
endif
|
||||
if TARGET_WINDOWS
|
||||
deploy: $(BITCOIN_WIN_INSTALLER)
|
||||
endif
|
||||
|
||||
$(BITCOIN_QT_BIN): FORCE
|
||||
$(MAKE) -C src qt/$(@F)
|
||||
|
||||
$(BITCOIND_BIN): FORCE
|
||||
$(MAKE) -C src $(@F)
|
||||
|
||||
|
|
|
@ -1,433 +0,0 @@
|
|||
dnl Helper for cases where a qt dependency is not met.
|
||||
dnl Output: If qt version is auto, set bitcoin_enable_qt to false. Else, exit.
|
||||
AC_DEFUN([BITCOIN_QT_FAIL],[
|
||||
if test "x$bitcoin_qt_want_version" = "xauto" && test x$bitcoin_qt_force != xyes; then
|
||||
if test x$bitcoin_enable_qt != xno; then
|
||||
AC_MSG_WARN([$1; bitcoin-qt frontend will not be built])
|
||||
fi
|
||||
bitcoin_enable_qt=no
|
||||
bitcoin_enable_qt_test=no
|
||||
else
|
||||
AC_MSG_ERROR([$1])
|
||||
fi
|
||||
])
|
||||
|
||||
AC_DEFUN([BITCOIN_QT_CHECK],[
|
||||
if test "x$bitcoin_enable_qt" != "xno" && test x$bitcoin_qt_want_version != xno; then
|
||||
true
|
||||
$1
|
||||
else
|
||||
true
|
||||
$2
|
||||
fi
|
||||
])
|
||||
|
||||
dnl BITCOIN_QT_PATH_PROGS([FOO], [foo foo2], [/path/to/search/first], [continue if missing])
|
||||
dnl Helper for finding the path of programs needed for Qt.
|
||||
dnl Inputs: $1: Variable to be set
|
||||
dnl Inputs: $2: List of programs to search for
|
||||
dnl Inputs: $3: Look for $2 here before $PATH
|
||||
dnl Inputs: $4: If "yes", don't fail if $2 is not found.
|
||||
dnl Output: $1 is set to the path of $2 if found. $2 are searched in order.
|
||||
AC_DEFUN([BITCOIN_QT_PATH_PROGS],[
|
||||
BITCOIN_QT_CHECK([
|
||||
if test "x$3" != "x"; then
|
||||
AC_PATH_PROGS($1,$2,,$3)
|
||||
else
|
||||
AC_PATH_PROGS($1,$2)
|
||||
fi
|
||||
if test "x$$1" = "x" && test "x$4" != "xyes"; then
|
||||
BITCOIN_QT_FAIL([$1 not found])
|
||||
fi
|
||||
])
|
||||
])
|
||||
|
||||
dnl Initialize qt input.
|
||||
dnl This must be called before any other BITCOIN_QT* macros to ensure that
|
||||
dnl input variables are set correctly.
|
||||
dnl CAUTION: Do not use this inside of a conditional.
|
||||
AC_DEFUN([BITCOIN_QT_INIT],[
|
||||
dnl enable qt support
|
||||
AC_ARG_WITH([gui],
|
||||
[AS_HELP_STRING([--with-gui@<:@=no|qt4|qt5|auto@:>@],
|
||||
[build bitcoin-qt GUI (default=auto, qt4 tried first)])],
|
||||
[
|
||||
bitcoin_qt_want_version=$withval
|
||||
if test x$bitcoin_qt_want_version = xyes; then
|
||||
bitcoin_qt_force=yes
|
||||
bitcoin_qt_want_version=auto
|
||||
fi
|
||||
],
|
||||
[bitcoin_qt_want_version=auto])
|
||||
|
||||
AC_ARG_WITH([qt-incdir],[AS_HELP_STRING([--with-qt-incdir=INC_DIR],[specify qt include path (overridden by pkgconfig)])], [qt_include_path=$withval], [])
|
||||
AC_ARG_WITH([qt-libdir],[AS_HELP_STRING([--with-qt-libdir=LIB_DIR],[specify qt lib path (overridden by pkgconfig)])], [qt_lib_path=$withval], [])
|
||||
AC_ARG_WITH([qt-plugindir],[AS_HELP_STRING([--with-qt-plugindir=PLUGIN_DIR],[specify qt plugin path (overridden by pkgconfig)])], [qt_plugin_path=$withval], [])
|
||||
AC_ARG_WITH([qt-translationdir],[AS_HELP_STRING([--with-qt-translationdir=PLUGIN_DIR],[specify qt translation path (overridden by pkgconfig)])], [qt_translation_path=$withval], [])
|
||||
AC_ARG_WITH([qt-bindir],[AS_HELP_STRING([--with-qt-bindir=BIN_DIR],[specify qt bin path])], [qt_bin_path=$withval], [])
|
||||
|
||||
AC_ARG_WITH([qtdbus],
|
||||
[AS_HELP_STRING([--with-qtdbus],
|
||||
[enable DBus support (default is yes if qt is enabled and QtDBus is found)])],
|
||||
[use_dbus=$withval],
|
||||
[use_dbus=auto])
|
||||
|
||||
AC_SUBST(QT_TRANSLATION_DIR,$qt_translation_path)
|
||||
])
|
||||
|
||||
dnl Find the appropriate version of Qt libraries and includes.
|
||||
dnl Inputs: $1: Whether or not pkg-config should be used. yes|no. Default: yes.
|
||||
dnl Inputs: $2: If $1 is "yes" and --with-gui=auto, which qt version should be
|
||||
dnl tried first.
|
||||
dnl Outputs: See _BITCOIN_QT_FIND_LIBS_*
|
||||
dnl Outputs: Sets variables for all qt-related tools.
|
||||
dnl Outputs: bitcoin_enable_qt, bitcoin_enable_qt_dbus, bitcoin_enable_qt_test
|
||||
AC_DEFUN([BITCOIN_QT_CONFIGURE],[
|
||||
use_pkgconfig=$1
|
||||
|
||||
if test x$use_pkgconfig = x; then
|
||||
use_pkgconfig=yes
|
||||
fi
|
||||
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG([$2])])
|
||||
else
|
||||
BITCOIN_QT_CHECK([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG])
|
||||
fi
|
||||
|
||||
dnl This is ugly and complicated. Yuck. Works as follows:
|
||||
dnl We can't discern whether Qt4 builds are static or not. For Qt5, we can
|
||||
dnl check a header to find out. When Qt is built statically, some plugins must
|
||||
dnl be linked into the final binary as well. These plugins have changed between
|
||||
dnl Qt4 and Qt5. With Qt5, languages moved into core and the WindowsIntegration
|
||||
dnl plugin was added. Since we can't tell if Qt4 is static or not, it is
|
||||
dnl assumed for windows builds.
|
||||
dnl _BITCOIN_QT_CHECK_STATIC_PLUGINS does a quick link-check and appends the
|
||||
dnl results to QT_LIBS.
|
||||
BITCOIN_QT_CHECK([
|
||||
TEMP_CPPFLAGS=$CPPFLAGS
|
||||
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
|
||||
if test x$bitcoin_qt_got_major_vers = x5; then
|
||||
_BITCOIN_QT_IS_STATIC
|
||||
if test x$bitcoin_cv_static_qt = xyes; then
|
||||
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
|
||||
if test x$qt_plugin_path != x; then
|
||||
QT_LIBS="$QT_LIBS -L$qt_plugin_path/platforms"
|
||||
fi
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
PKG_CHECK_MODULES([QTPLATFORM], [Qt5PlatformSupport], [QT_LIBS="$QTPLATFORM_LIBS $QT_LIBS"])
|
||||
fi
|
||||
AC_CACHE_CHECK(for Qt < 5.4, bitcoin_cv_need_acc_widget,[AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <QtCore>]],[[
|
||||
#if QT_VERSION >= 0x050400
|
||||
choke;
|
||||
#endif
|
||||
]])],
|
||||
[bitcoin_cv_need_acc_widget=yes],
|
||||
[bitcoin_cv_need_acc_widget=no])
|
||||
])
|
||||
if test "x$bitcoin_cv_need_acc_widget" = "xyes"; then
|
||||
if test x$qt_plugin_path != x; then
|
||||
QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible"
|
||||
fi
|
||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(AccessibleFactory)], [-lqtaccessiblewidgets])
|
||||
fi
|
||||
if test x$TARGET_OS = xwindows; then
|
||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin)],[-lqwindows])
|
||||
AC_DEFINE(QT_QPA_PLATFORM_WINDOWS, 1, [Define this symbol if the qt platform is windows])
|
||||
elif test x$TARGET_OS = xlinux; then
|
||||
PKG_CHECK_MODULES([X11XCB], [x11-xcb], [QT_LIBS="$X11XCB_LIBS $QT_LIBS"])
|
||||
if ${PKG_CONFIG} --exists "Qt5Core >= 5.5" 2>/dev/null; then
|
||||
PKG_CHECK_MODULES([QTXCBQPA], [Qt5XcbQpa], [QT_LIBS="$QTXCBQPA_LIBS $QT_LIBS"])
|
||||
fi
|
||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QXcbIntegrationPlugin)],[-lqxcb -lxcb-static])
|
||||
AC_DEFINE(QT_QPA_PLATFORM_XCB, 1, [Define this symbol if the qt platform is xcb])
|
||||
elif test x$TARGET_OS = xdarwin; then
|
||||
if test x$use_pkgconfig = xyes; then
|
||||
PKG_CHECK_MODULES([QTPRINT], [Qt5PrintSupport], [QT_LIBS="$QTPRINT_LIBS $QT_LIBS"])
|
||||
fi
|
||||
AX_CHECK_LINK_FLAG([[-framework IOKit]],[QT_LIBS="$QT_LIBS -framework IOKit"],[AC_MSG_ERROR(could not iokit framework)])
|
||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin)],[-lqcocoa])
|
||||
AC_DEFINE(QT_QPA_PLATFORM_COCOA, 1, [Define this symbol if the qt platform is cocoa])
|
||||
fi
|
||||
fi
|
||||
else
|
||||
if test x$TARGET_OS = xwindows; then
|
||||
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol if qt plugins are static])
|
||||
if test x$qt_plugin_path != x; then
|
||||
QT_LIBS="$QT_LIBS -L$qt_plugin_path/accessible"
|
||||
QT_LIBS="$QT_LIBS -L$qt_plugin_path/codecs"
|
||||
fi
|
||||
_BITCOIN_QT_CHECK_STATIC_PLUGINS([
|
||||
Q_IMPORT_PLUGIN(qcncodecs)
|
||||
Q_IMPORT_PLUGIN(qjpcodecs)
|
||||
Q_IMPORT_PLUGIN(qtwcodecs)
|
||||
Q_IMPORT_PLUGIN(qkrcodecs)
|
||||
Q_IMPORT_PLUGIN(AccessibleFactory)],
|
||||
[-lqcncodecs -lqjpcodecs -lqtwcodecs -lqkrcodecs -lqtaccessiblewidgets])
|
||||
fi
|
||||
fi
|
||||
CPPFLAGS=$TEMP_CPPFLAGS
|
||||
])
|
||||
|
||||
if test x$use_pkgconfig$qt_bin_path = xyes; then
|
||||
if test x$bitcoin_qt_got_major_vers = x5; then
|
||||
qt_bin_path="`$PKG_CONFIG --variable=host_bins Qt5Core 2>/dev/null`"
|
||||
fi
|
||||
fi
|
||||
|
||||
BITCOIN_QT_PATH_PROGS([MOC], [moc-qt${bitcoin_qt_got_major_vers} moc${bitcoin_qt_got_major_vers} moc], $qt_bin_path)
|
||||
BITCOIN_QT_PATH_PROGS([UIC], [uic-qt${bitcoin_qt_got_major_vers} uic${bitcoin_qt_got_major_vers} uic], $qt_bin_path)
|
||||
BITCOIN_QT_PATH_PROGS([RCC], [rcc-qt${bitcoin_qt_got_major_vers} rcc${bitcoin_qt_got_major_vers} rcc], $qt_bin_path)
|
||||
BITCOIN_QT_PATH_PROGS([LRELEASE], [lrelease-qt${bitcoin_qt_got_major_vers} lrelease${bitcoin_qt_got_major_vers} lrelease], $qt_bin_path)
|
||||
BITCOIN_QT_PATH_PROGS([LUPDATE], [lupdate-qt${bitcoin_qt_got_major_vers} lupdate${bitcoin_qt_got_major_vers} lupdate],$qt_bin_path, yes)
|
||||
|
||||
MOC_DEFS='-DHAVE_CONFIG_H -I$(srcdir)'
|
||||
case $host in
|
||||
*darwin*)
|
||||
BITCOIN_QT_CHECK([
|
||||
MOC_DEFS="${MOC_DEFS} -DQ_OS_MAC"
|
||||
base_frameworks="-framework Foundation -framework ApplicationServices -framework AppKit"
|
||||
AX_CHECK_LINK_FLAG([[$base_frameworks]],[QT_LIBS="$QT_LIBS $base_frameworks"],[AC_MSG_ERROR(could not find base frameworks)])
|
||||
])
|
||||
;;
|
||||
*mingw*)
|
||||
BITCOIN_QT_CHECK([
|
||||
AX_CHECK_LINK_FLAG([[-mwindows]],[QT_LDFLAGS="$QT_LDFLAGS -mwindows"],[AC_MSG_WARN(-mwindows linker support not detected)])
|
||||
])
|
||||
esac
|
||||
|
||||
|
||||
dnl enable qt support
|
||||
AC_MSG_CHECKING(whether to build Bitcoin Core GUI)
|
||||
BITCOIN_QT_CHECK([
|
||||
bitcoin_enable_qt=yes
|
||||
bitcoin_enable_qt_test=yes
|
||||
if test x$have_qt_test = xno; then
|
||||
bitcoin_enable_qt_test=no
|
||||
fi
|
||||
bitcoin_enable_qt_dbus=no
|
||||
if test x$use_dbus != xno && test x$have_qt_dbus = xyes; then
|
||||
bitcoin_enable_qt_dbus=yes
|
||||
fi
|
||||
if test x$use_dbus = xyes && test x$have_qt_dbus = xno; then
|
||||
AC_MSG_ERROR("libQtDBus not found. Install libQtDBus or remove --with-qtdbus.")
|
||||
fi
|
||||
if test x$LUPDATE = x; then
|
||||
AC_MSG_WARN("lupdate is required to update qt translations")
|
||||
fi
|
||||
],[
|
||||
bitcoin_enable_qt=no
|
||||
])
|
||||
AC_MSG_RESULT([$bitcoin_enable_qt (Qt${bitcoin_qt_got_major_vers})])
|
||||
|
||||
AC_SUBST(QT_INCLUDES)
|
||||
AC_SUBST(QT_LIBS)
|
||||
AC_SUBST(QT_LDFLAGS)
|
||||
AC_SUBST(QT_DBUS_INCLUDES)
|
||||
AC_SUBST(QT_DBUS_LIBS)
|
||||
AC_SUBST(QT_TEST_INCLUDES)
|
||||
AC_SUBST(QT_TEST_LIBS)
|
||||
AC_SUBST(QT_SELECT, qt${bitcoin_qt_got_major_vers})
|
||||
AC_SUBST(MOC_DEFS)
|
||||
])
|
||||
|
||||
dnl All macros below are internal and should _not_ be used from the main
|
||||
dnl configure.ac.
|
||||
dnl ----
|
||||
|
||||
dnl Internal. Check if the included version of Qt is Qt5.
|
||||
dnl Requires: INCLUDES must be populated as necessary.
|
||||
dnl Output: bitcoin_cv_qt5=yes|no
|
||||
AC_DEFUN([_BITCOIN_QT_CHECK_QT5],[
|
||||
AC_CACHE_CHECK(for Qt 5, bitcoin_cv_qt5,[
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <QtCore>]],
|
||||
[[
|
||||
#if QT_VERSION < 0x050000
|
||||
choke me
|
||||
#else
|
||||
return 0;
|
||||
#endif
|
||||
]])],
|
||||
[bitcoin_cv_qt5=yes],
|
||||
[bitcoin_cv_qt5=no])
|
||||
])])
|
||||
|
||||
dnl Internal. Check if the linked version of Qt was built as static libs.
|
||||
dnl Requires: Qt5. This check cannot determine if Qt4 is static.
|
||||
dnl Requires: INCLUDES and LIBS must be populated as necessary.
|
||||
dnl Output: bitcoin_cv_static_qt=yes|no
|
||||
dnl Output: Defines QT_STATICPLUGIN if plugins are static.
|
||||
AC_DEFUN([_BITCOIN_QT_IS_STATIC],[
|
||||
AC_CACHE_CHECK(for static Qt, bitcoin_cv_static_qt,[
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
|
||||
[[#include <QtCore>]],
|
||||
[[
|
||||
#if defined(QT_STATIC)
|
||||
return 0;
|
||||
#else
|
||||
choke me
|
||||
#endif
|
||||
]])],
|
||||
[bitcoin_cv_static_qt=yes],
|
||||
[bitcoin_cv_static_qt=no])
|
||||
])
|
||||
if test xbitcoin_cv_static_qt = xyes; then
|
||||
AC_DEFINE(QT_STATICPLUGIN, 1, [Define this symbol for static Qt plugins])
|
||||
fi
|
||||
])
|
||||
|
||||
dnl Internal. Check if the link-requirements for static plugins are met.
|
||||
dnl Requires: INCLUDES and LIBS must be populated as necessary.
|
||||
dnl Inputs: $1: A series of Q_IMPORT_PLUGIN().
|
||||
dnl Inputs: $2: The libraries that resolve $1.
|
||||
dnl Output: QT_LIBS is prepended or configure exits.
|
||||
AC_DEFUN([_BITCOIN_QT_CHECK_STATIC_PLUGINS],[
|
||||
AC_MSG_CHECKING(for static Qt plugins: $2)
|
||||
CHECK_STATIC_PLUGINS_TEMP_LIBS="$LIBS"
|
||||
LIBS="$2 $QT_LIBS $LIBS"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[
|
||||
#define QT_STATICPLUGIN
|
||||
#include <QtPlugin>
|
||||
$1]],
|
||||
[[return 0;]])],
|
||||
[AC_MSG_RESULT(yes); QT_LIBS="$2 $QT_LIBS"],
|
||||
[AC_MSG_RESULT(no); BITCOIN_QT_FAIL(Could not resolve: $2)])
|
||||
LIBS="$CHECK_STATIC_PLUGINS_TEMP_LIBS"
|
||||
])
|
||||
|
||||
dnl Internal. Find Qt libraries using pkg-config.
|
||||
dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to check
|
||||
dnl first.
|
||||
dnl Inputs: $1: If bitcoin_qt_want_version is "auto", check for this version
|
||||
dnl first.
|
||||
dnl Outputs: All necessary QT_* variables are set.
|
||||
dnl Outputs: bitcoin_qt_got_major_vers is set to "4" or "5".
|
||||
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
|
||||
AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITH_PKGCONFIG],[
|
||||
m4_ifdef([PKG_CHECK_MODULES],[
|
||||
auto_priority_version=$1
|
||||
if test x$auto_priority_version = x; then
|
||||
auto_priority_version=qt5
|
||||
fi
|
||||
if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then
|
||||
QT_LIB_PREFIX=Qt5
|
||||
bitcoin_qt_got_major_vers=5
|
||||
else
|
||||
QT_LIB_PREFIX=Qt
|
||||
bitcoin_qt_got_major_vers=4
|
||||
fi
|
||||
qt5_modules="Qt5Core Qt5Gui Qt5Network Qt5Widgets"
|
||||
qt4_modules="QtCore QtGui QtNetwork"
|
||||
BITCOIN_QT_CHECK([
|
||||
if test x$bitcoin_qt_want_version = xqt5 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt5 ); then
|
||||
PKG_CHECK_MODULES([QT], [$qt5_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes],[have_qt=no])
|
||||
elif test x$bitcoin_qt_want_version = xqt4 || ( test x$bitcoin_qt_want_version = xauto && test x$auto_priority_version = xqt4 ); then
|
||||
PKG_CHECK_MODULES([QT], [$qt4_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes], [have_qt=no])
|
||||
fi
|
||||
|
||||
dnl qt version is set to 'auto' and the preferred version wasn't found. Now try the other.
|
||||
if test x$have_qt = xno && test x$bitcoin_qt_want_version = xauto; then
|
||||
if test x$auto_priority_version = x$qt5; then
|
||||
PKG_CHECK_MODULES([QT], [$qt4_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes; QT_LIB_PREFIX=Qt; bitcoin_qt_got_major_vers=4], [have_qt=no])
|
||||
else
|
||||
PKG_CHECK_MODULES([QT], [$qt5_modules], [QT_INCLUDES="$QT_CFLAGS"; have_qt=yes; QT_LIB_PREFIX=Qt5; bitcoin_qt_got_major_vers=5], [have_qt=no])
|
||||
fi
|
||||
fi
|
||||
if test x$have_qt != xyes; then
|
||||
have_qt=no
|
||||
BITCOIN_QT_FAIL([Qt dependencies not found])
|
||||
fi
|
||||
])
|
||||
BITCOIN_QT_CHECK([
|
||||
PKG_CHECK_MODULES([QT_TEST], [${QT_LIB_PREFIX}Test], [QT_TEST_INCLUDES="$QT_TEST_CFLAGS"; have_qt_test=yes], [have_qt_test=no])
|
||||
if test x$use_dbus != xno; then
|
||||
PKG_CHECK_MODULES([QT_DBUS], [${QT_LIB_PREFIX}DBus], [QT_DBUS_INCLUDES="$QT_DBUS_CFLAGS"; have_qt_dbus=yes], [have_qt_dbus=no])
|
||||
fi
|
||||
])
|
||||
])
|
||||
true; dnl
|
||||
])
|
||||
|
||||
dnl Internal. Find Qt libraries without using pkg-config. Version is deduced
|
||||
dnl from the discovered headers.
|
||||
dnl Inputs: bitcoin_qt_want_version (from --with-gui=). The version to use.
|
||||
dnl If "auto", the version will be discovered by _BITCOIN_QT_CHECK_QT5.
|
||||
dnl Outputs: All necessary QT_* variables are set.
|
||||
dnl Outputs: bitcoin_qt_got_major_vers is set to "4" or "5".
|
||||
dnl Outputs: have_qt_test and have_qt_dbus are set (if applicable) to yes|no.
|
||||
AC_DEFUN([_BITCOIN_QT_FIND_LIBS_WITHOUT_PKGCONFIG],[
|
||||
TEMP_CPPFLAGS="$CPPFLAGS"
|
||||
TEMP_LIBS="$LIBS"
|
||||
BITCOIN_QT_CHECK([
|
||||
if test x$qt_include_path != x; then
|
||||
QT_INCLUDES="-I$qt_include_path -I$qt_include_path/QtCore -I$qt_include_path/QtGui -I$qt_include_path/QtWidgets -I$qt_include_path/QtNetwork -I$qt_include_path/QtTest -I$qt_include_path/QtDBus"
|
||||
CPPFLAGS="$QT_INCLUDES $CPPFLAGS"
|
||||
fi
|
||||
])
|
||||
|
||||
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QtPlugin],,BITCOIN_QT_FAIL(QtCore headers missing))])
|
||||
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QApplication],, BITCOIN_QT_FAIL(QtGui headers missing))])
|
||||
BITCOIN_QT_CHECK([AC_CHECK_HEADER([QLocalSocket],, BITCOIN_QT_FAIL(QtNetwork headers missing))])
|
||||
|
||||
BITCOIN_QT_CHECK([
|
||||
if test x$bitcoin_qt_want_version = xauto; then
|
||||
_BITCOIN_QT_CHECK_QT5
|
||||
fi
|
||||
if test x$bitcoin_cv_qt5 = xyes || test x$bitcoin_qt_want_version = xqt5; then
|
||||
QT_LIB_PREFIX=Qt5
|
||||
bitcoin_qt_got_major_vers=5
|
||||
else
|
||||
QT_LIB_PREFIX=Qt
|
||||
bitcoin_qt_got_major_vers=4
|
||||
fi
|
||||
])
|
||||
|
||||
BITCOIN_QT_CHECK([
|
||||
LIBS=
|
||||
if test x$qt_lib_path != x; then
|
||||
LIBS="$LIBS -L$qt_lib_path"
|
||||
fi
|
||||
|
||||
if test x$TARGET_OS = xwindows; then
|
||||
AC_CHECK_LIB([imm32], [main],, BITCOIN_QT_FAIL(libimm32 not found))
|
||||
fi
|
||||
])
|
||||
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([z] ,[main],,AC_MSG_WARN([zlib not found. Assuming qt has it built-in])))
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([png] ,[main],,AC_MSG_WARN([libpng not found. Assuming qt has it built-in])))
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([jpeg] ,[main],,AC_MSG_WARN([libjpeg not found. Assuming qt has it built-in])))
|
||||
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([pcre16_exec], [qtpcre pcre16],,AC_MSG_WARN([libpcre16 not found. Assuming qt has it built-in])))
|
||||
BITCOIN_QT_CHECK(AC_SEARCH_LIBS([hb_ot_tags_from_script] ,[qtharfbuzzng harfbuzz],,AC_MSG_WARN([libharfbuzz not found. Assuming qt has it built-in or support is disabled])))
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Core] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXCore not found)))
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Gui] ,[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXGui not found)))
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Network],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXNetwork not found)))
|
||||
if test x$bitcoin_qt_got_major_vers = x5; then
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([${QT_LIB_PREFIX}Widgets],[main],,BITCOIN_QT_FAIL(lib$QT_LIB_PREFIXWidgets not found)))
|
||||
fi
|
||||
QT_LIBS="$LIBS"
|
||||
LIBS="$TEMP_LIBS"
|
||||
|
||||
BITCOIN_QT_CHECK([
|
||||
LIBS=
|
||||
if test x$qt_lib_path != x; then
|
||||
LIBS="-L$qt_lib_path"
|
||||
fi
|
||||
AC_CHECK_LIB([${QT_LIB_PREFIX}Test], [main],, have_qt_test=no)
|
||||
AC_CHECK_HEADER([QTest],, have_qt_test=no)
|
||||
QT_TEST_LIBS="$LIBS"
|
||||
if test x$use_dbus != xno; then
|
||||
LIBS=
|
||||
if test x$qt_lib_path != x; then
|
||||
LIBS="-L$qt_lib_path"
|
||||
fi
|
||||
AC_CHECK_LIB([${QT_LIB_PREFIX}DBus], [main],, have_qt_dbus=no)
|
||||
AC_CHECK_HEADER([QtDBus],, have_qt_dbus=no)
|
||||
QT_DBUS_LIBS="$LIBS"
|
||||
fi
|
||||
])
|
||||
CPPFLAGS="$TEMP_CPPFLAGS"
|
||||
LIBS="$TEMP_LIBS"
|
||||
])
|
||||
|
87
configure.ac
87
configure.ac
|
@ -105,11 +105,6 @@ AC_ARG_ENABLE(tests,
|
|||
[use_tests=$enableval],
|
||||
[use_tests=yes])
|
||||
|
||||
AC_ARG_ENABLE(gui-tests,
|
||||
AS_HELP_STRING([--disable-gui-tests],[do not compile GUI tests (default is to compile if GUI and tests enabled)]),
|
||||
[use_gui_tests=$enableval],
|
||||
[use_gui_tests=$use_tests])
|
||||
|
||||
AC_ARG_WITH([comparison-tool],
|
||||
AS_HELP_STRING([--with-comparison-tool],[path to java comparison tool (requires --enable-tests)]),
|
||||
[use_comparison_tool=$withval],
|
||||
|
@ -120,12 +115,6 @@ AC_ARG_ENABLE([comparison-tool-reorg-tests],
|
|||
[use_comparison_tool_reorg_tests=$enableval],
|
||||
[use_comparison_tool_reorg_tests=no])
|
||||
|
||||
AC_ARG_WITH([qrencode],
|
||||
[AS_HELP_STRING([--with-qrencode],
|
||||
[enable QR code support (default is yes if qt is enabled and libqrencode is found)])],
|
||||
[use_qr=$withval],
|
||||
[use_qr=auto])
|
||||
|
||||
AC_ARG_ENABLE([hardening],
|
||||
[AS_HELP_STRING([--enable-hardening],
|
||||
[attempt to harden the resulting executables (default is yes)])],
|
||||
|
@ -301,11 +290,10 @@ case $host in
|
|||
dnl in expected paths because they may conflict with system files. Ask
|
||||
dnl Homebrew where each one is located, then adjust paths accordingly.
|
||||
dnl It's safe to add these paths even if the functionality is disabled by
|
||||
dnl the user (--without-wallet or --without-gui for example).
|
||||
dnl the user (--without-wallet for example).
|
||||
|
||||
openssl_prefix=`$BREW --prefix openssl 2>/dev/null`
|
||||
bdb_prefix=`$BREW --prefix berkeley-db4 2>/dev/null`
|
||||
qt5_prefix=`$BREW --prefix qt5 2>/dev/null`
|
||||
if test x$openssl_prefix != x; then
|
||||
PKG_CONFIG_PATH="$openssl_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
export PKG_CONFIG_PATH
|
||||
|
@ -314,10 +302,6 @@ case $host in
|
|||
CPPFLAGS="$CPPFLAGS -I$bdb_prefix/include"
|
||||
LIBS="$LIBS -L$bdb_prefix/lib"
|
||||
fi
|
||||
if test x$qt5_prefix != x; then
|
||||
PKG_CONFIG_PATH="$qt5_prefix/lib/pkgconfig:$PKG_CONFIG_PATH"
|
||||
export PKG_CONFIG_PATH
|
||||
fi
|
||||
fi
|
||||
else
|
||||
case $build_os in
|
||||
|
@ -553,12 +537,7 @@ if test x$use_upnp != xno; then
|
|||
)
|
||||
fi
|
||||
|
||||
BITCOIN_QT_INIT
|
||||
|
||||
dnl sets $bitcoin_enable_qt, $bitcoin_enable_qt_test, $bitcoin_enable_qt_dbus
|
||||
BITCOIN_QT_CONFIGURE([$use_pkgconfig], [qt4])
|
||||
|
||||
if test x$build_bitcoin_utils$build_bitcoind$bitcoin_enable_qt$use_tests = xnononono; then
|
||||
if test x$build_bitcoin_utils$build_bitcoind$use_tests = xnonono; then
|
||||
use_boost=no
|
||||
else
|
||||
use_boost=yes
|
||||
|
@ -702,10 +681,6 @@ if test x$use_pkgconfig = xyes; then
|
|||
[
|
||||
PKG_CHECK_MODULES([SSL], [libssl],, [AC_MSG_ERROR(openssl not found.)])
|
||||
PKG_CHECK_MODULES([CRYPTO], [libcrypto],,[AC_MSG_ERROR(libcrypto not found.)])
|
||||
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([PROTOBUF], [protobuf], [have_protobuf=yes], [BITCOIN_QT_FAIL(libprotobuf not found)])])
|
||||
if test x$use_qr != xno; then
|
||||
BITCOIN_QT_CHECK([PKG_CHECK_MODULES([QR], [libqrencode], [have_qrencode=yes], [have_qrencode=no])])
|
||||
fi
|
||||
|
||||
if test "x$use_zmq" = "xyes"; then
|
||||
PKG_CHECK_MODULES([ZMQ],[libzmq >= 4],
|
||||
|
@ -750,12 +725,6 @@ else
|
|||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
BITCOIN_QT_CHECK(AC_CHECK_LIB([protobuf] ,[main],[PROTOBUF_LIBS=-lprotobuf], BITCOIN_QT_FAIL(libprotobuf not found)))
|
||||
if test x$use_qr != xno; then
|
||||
BITCOIN_QT_CHECK([AC_CHECK_LIB([qrencode], [main],[QR_LIBS=-lqrencode], [have_qrencode=no])])
|
||||
BITCOIN_QT_CHECK([AC_CHECK_HEADER([qrencode.h],, have_qrencode=no)])
|
||||
fi
|
||||
fi
|
||||
|
||||
# These packages don't provide pkgconfig config files across all
|
||||
|
@ -792,8 +761,6 @@ AC_CHECK_HEADER([openssl/ec.h],, AC_MSG_ERROR(OpenSSL ec header missing),)
|
|||
CXXFLAGS="$CXXFLAGS_TEMP"
|
||||
LIBS="$LIBS_TEMP"
|
||||
|
||||
BITCOIN_QT_PATH_PROGS([PROTOC], [protoc],$protoc_bin_path)
|
||||
|
||||
AC_MSG_CHECKING([whether to build bitcoind])
|
||||
AM_CONDITIONAL([BUILD_BITCOIND], [test x$build_bitcoind = xyes])
|
||||
AC_MSG_RESULT($build_bitcoind)
|
||||
|
@ -879,46 +846,6 @@ else
|
|||
fi
|
||||
fi
|
||||
|
||||
dnl these are only used when qt is enabled
|
||||
BUILD_TEST_QT=""
|
||||
if test x$bitcoin_enable_qt != xno; then
|
||||
dnl enable dbus support
|
||||
AC_MSG_CHECKING([whether to build GUI with support for D-Bus])
|
||||
if test x$bitcoin_enable_qt_dbus != xno; then
|
||||
AC_DEFINE([USE_DBUS],[1],[Define if dbus support should be compiled in])
|
||||
fi
|
||||
AC_MSG_RESULT($bitcoin_enable_qt_dbus)
|
||||
|
||||
dnl enable qr support
|
||||
AC_MSG_CHECKING([whether to build GUI with support for QR codes])
|
||||
if test x$have_qrencode = xno; then
|
||||
if test x$use_qr = xyes; then
|
||||
AC_MSG_ERROR("QR support requested but cannot be built. use --without-qrencode")
|
||||
fi
|
||||
AC_MSG_RESULT(no)
|
||||
else
|
||||
if test x$use_qr != xno; then
|
||||
AC_MSG_RESULT(yes)
|
||||
AC_DEFINE([USE_QRCODE],[1],[Define if QR support should be compiled in])
|
||||
use_qr=yes
|
||||
else
|
||||
AC_MSG_RESULT(no)
|
||||
fi
|
||||
fi
|
||||
|
||||
if test x$XGETTEXT = x; then
|
||||
AC_MSG_WARN("xgettext is required to update qt translations")
|
||||
fi
|
||||
|
||||
AC_MSG_CHECKING([whether to build test_bitcoin-qt])
|
||||
if test x$use_gui_tests$bitcoin_enable_qt_test = xyesyes; then
|
||||
AC_MSG_RESULT([yes])
|
||||
BUILD_TEST_QT="yes"
|
||||
else
|
||||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([ENABLE_ZMQ], [test "x$use_zmq" = "xyes"])
|
||||
|
||||
AC_MSG_CHECKING([whether to build test_bitcoin])
|
||||
|
@ -937,8 +864,8 @@ else
|
|||
AC_MSG_RESULT([no])
|
||||
fi
|
||||
|
||||
if test x$build_bitcoin_utils$build_bitcoin_libs$build_bitcoind$bitcoin_enable_qt$use_tests = xnonononono; then
|
||||
AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon --with-gui or --enable-tests])
|
||||
if test x$build_bitcoin_utils$build_bitcoin_libs$build_bitcoind$use_tests = xnononono; then
|
||||
AC_MSG_ERROR([No targets! Please specify at least one of: --with-utils --with-libs --with-daemon or --enable-tests])
|
||||
fi
|
||||
|
||||
AM_CONDITIONAL([TARGET_DARWIN], [test x$TARGET_OS = xdarwin])
|
||||
|
@ -947,9 +874,6 @@ AM_CONDITIONAL([TARGET_WINDOWS], [test x$TARGET_OS = xwindows])
|
|||
AM_CONDITIONAL([ENABLE_WALLET],[test x$enable_wallet = xyes])
|
||||
AM_CONDITIONAL([ENABLE_MINING],[test x$enable_mining = xyes])
|
||||
AM_CONDITIONAL([ENABLE_TESTS],[test x$BUILD_TEST = xyes])
|
||||
AM_CONDITIONAL([ENABLE_QT],[test x$bitcoin_enable_qt = xyes])
|
||||
AM_CONDITIONAL([ENABLE_QT_TESTS],[test x$BUILD_TEST_QT = xyes])
|
||||
AM_CONDITIONAL([USE_QRCODE], [test x$use_qr = xyes])
|
||||
AM_CONDITIONAL([USE_LCOV],[test x$use_lcov = xyes])
|
||||
AM_CONDITIONAL([USE_COMPARISON_TOOL],[test x$use_comparison_tool != xno])
|
||||
AM_CONDITIONAL([USE_COMPARISON_TOOL_REORG_TESTS],[test x$use_comparison_tool_reorg_test != xno])
|
||||
|
@ -972,7 +896,6 @@ AC_SUBST(COPYRIGHT_YEAR, _COPYRIGHT_YEAR)
|
|||
AC_SUBST(RELDFLAGS)
|
||||
AC_SUBST(LIBTOOL_APP_LDFLAGS)
|
||||
AC_SUBST(USE_UPNP)
|
||||
AC_SUBST(USE_QRCODE)
|
||||
AC_SUBST(BOOST_LIBS)
|
||||
AC_SUBST(TESTDEFS)
|
||||
AC_SUBST(LEVELDB_TARGET_FLAGS)
|
||||
|
@ -982,7 +905,7 @@ AC_SUBST(GMP_LIBS)
|
|||
AC_SUBST(GMPXX_LIBS)
|
||||
AC_SUBST(LIBSNARK_LIBS)
|
||||
AC_SUBST(LIBZCASH_LIBS)
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi share/qt/Info.plist src/test/buildenv.py])
|
||||
AC_CONFIG_FILES([Makefile src/Makefile doc/man/Makefile share/setup.nsi src/test/buildenv.py])
|
||||
AC_CONFIG_FILES([qa/pull-tester/run-bitcoind-for-test.sh],[chmod +x qa/pull-tester/run-bitcoind-for-test.sh])
|
||||
AC_CONFIG_FILES([qa/pull-tester/tests-config.sh],[chmod +x qa/pull-tester/tests-config.sh])
|
||||
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
*** Warning: This document has not been updated for Zcash and may be inaccurate. ***
|
||||
|
||||
Wallet Tools
|
||||
---------------------
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
FORMS += \
|
||||
../src/qt/forms/aboutdialog.ui \
|
||||
../src/qt/forms/addressbookpage.ui \
|
||||
../src/qt/forms/askpassphrasedialog.ui \
|
||||
../src/qt/forms/coincontroldialog.ui \
|
||||
../src/qt/forms/editaddressdialog.ui \
|
||||
../src/qt/forms/helpmessagedialog.ui \
|
||||
../src/qt/forms/intro.ui \
|
||||
../src/qt/forms/openuridialog.ui \
|
||||
../src/qt/forms/optionsdialog.ui \
|
||||
../src/qt/forms/overviewpage.ui \
|
||||
../src/qt/forms/receivecoinsdialog.ui \
|
||||
../src/qt/forms/receiverequestdialog.ui \
|
||||
../src/qt/forms/rpcconsole.ui \
|
||||
../src/qt/forms/sendcoinsdialog.ui \
|
||||
../src/qt/forms/sendcoinsentry.ui \
|
||||
../src/qt/forms/signverifymessagedialog.ui \
|
||||
../src/qt/forms/transactiondescdialog.ui \
|
||||
|
||||
RESOURCES += \
|
||||
../src/qt/bitcoin.qrc
|
|
@ -1,5 +1,6 @@
|
|||
# bash programmable completion for bitcoind(1) and bitcoin-qt(1)
|
||||
# Copyright (c) 2012-2016 The Bitcoin Core developers
|
||||
# bash programmable completion for zcashd(1)
|
||||
# Copyright (c) 2012-2017 The Bitcoin Core developers
|
||||
# Copyright (c) 2016-2017 The Zcash developers
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
|
@ -7,7 +8,7 @@ _zcashd() {
|
|||
local cur prev words=() cword
|
||||
local bitcoind
|
||||
|
||||
# save and use original argument to invoke bitcoind for -help
|
||||
# save and use original argument to invoke zcashd for -help
|
||||
# it might not be in $PATH
|
||||
bitcoind="$1"
|
||||
|
||||
|
@ -15,7 +16,7 @@ _zcashd() {
|
|||
_get_comp_words_by_ref -n = cur prev words cword
|
||||
|
||||
case "$cur" in
|
||||
-conf=*|-pid=*|-loadblock=*|-rootcertificates=*|-rpccookiefile=*|-wallet=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*)
|
||||
-conf=*|-pid=*|-loadblock=*|-rpccookiefile=*|-wallet=*|-rpcsslcertificatechainfile=*|-rpcsslprivatekeyfile=*)
|
||||
cur="${cur#*=}"
|
||||
_filedir
|
||||
return 0
|
||||
|
|
|
@ -4,67 +4,13 @@ Upstream-Contact: Zcash Company <team@z.cash>
|
|||
Source: https://github.com/zcash/zcash
|
||||
|
||||
Files: *
|
||||
Copyright: 2016, The Zcash developers
|
||||
2009-2015, Bitcoin Core developers
|
||||
Copyright: 2016-2017, The Zcash developers
|
||||
2009-2017, Bitcoin Core developers
|
||||
License: Expat
|
||||
Comment: The Bitcoin Core developers encompasses the current developers listed on bitcoin.org,
|
||||
as well as the numerous contributors to the project.
|
||||
The Zcash developers are listed at https://z.cash/team.html.
|
||||
|
||||
Files: src/qt/res/icons/clock*.png, src/qt/res/icons/tx*.png,
|
||||
src/qt/res/src/*.svg
|
||||
Copyright: Wladimir van der Laan
|
||||
License: Expat
|
||||
|
||||
Files: src/qt/res/icons/address-book.png, src/qt/res/icons/export.png,
|
||||
src/qt/res/icons/history.png, src/qt/res/icons/key.png,
|
||||
src/qt/res/icons/lock_*.png, src/qt/res/icons/overview.png,
|
||||
src/qt/res/icons/receive.png, src/qt/res/icons/send.png,
|
||||
src/qt/res/icons/synced.png, src/qt/res/icons/filesave.png
|
||||
Copyright: David Vignoni (david@icon-king.com)
|
||||
ICON KING - www.icon-king.com
|
||||
License: LGPL
|
||||
Comment: NUVOLA ICON THEME for KDE 3.x
|
||||
Original icons: kaddressbook, klipper_dock, view-list-text,
|
||||
key-password, encrypted/decrypted, go-home, go-down,
|
||||
go-next, dialog-ok
|
||||
Site: http://www.icon-king.com/projects/nuvola/
|
||||
|
||||
Files: src/qt/res/icons/connect*.png
|
||||
Copyright: schollidesign
|
||||
License: GPL-3+
|
||||
Comment: Icon Pack: Human-O2
|
||||
Site: http://findicons.com/icon/93743/blocks_gnome_netstatus_0
|
||||
|
||||
Files: src/qt/res/icons/transaction*.png
|
||||
Copyright: md2k7
|
||||
License: Expat
|
||||
Comment: Site: https://bitcointalk.org/index.php?topic=15276.0
|
||||
|
||||
Files: src/qt/res/icons/configure.png, src/qt/res/icons/quit.png,
|
||||
src/qt/res/icons/editcopy.png, src/qt/res/icons/editpaste.png,
|
||||
src/qt/res/icons/add.png, src/qt/res/icons/edit.png,
|
||||
src/qt/res/icons/remove.png
|
||||
Copyright: http://www.everaldo.com
|
||||
License: LGPL
|
||||
Comment: Icon Pack: Crystal SVG
|
||||
|
||||
Files: src/qt/res/icons/bitcoin.png, src/qt/res/icons/toolbar.png
|
||||
Copyright: Bitboy (optimized for 16x16 by Wladimir van der Laan)
|
||||
License: PUB-DOM
|
||||
Comment: Site: https://bitcointalk.org/?topic=1756.0
|
||||
|
||||
Files: scripts/img/reload.xcf, src/qt/res/movies/*.png
|
||||
Copyright: Everaldo (Everaldo Coelho)
|
||||
License: GPL-3+
|
||||
Comment: Icon Pack: Kids
|
||||
Site: http://findicons.com/icon/17102/reload?id=17102
|
||||
|
||||
Files: src/qt/res/images/splash2.jpg
|
||||
License: PUB-DOM
|
||||
Copyright: Crobbo (forum)
|
||||
Comment: Site: https://bitcointalk.org/index.php?topic=32273.0
|
||||
|
||||
Files: depends/sources/libsodium-*.tar.gz
|
||||
Copyright: 2013-2016 Frank Denis
|
||||
License: ISC
|
||||
|
@ -1102,54 +1048,21 @@ License: ISC
|
|||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
|
||||
SOFTWARE.
|
||||
|
||||
License: GPL-2+
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of the GNU General Public License as published by the
|
||||
Free Software Foundation; either version 2, 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
|
||||
General Public License for more details.
|
||||
Comment:
|
||||
On Debian systems the GNU General Public License (GPL) version 2 is
|
||||
located in '/usr/share/common-licenses/GPL-2'.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
License: GPL-3+
|
||||
Permission is granted to copy, distribute and/or modify this document
|
||||
under the terms of the GNU General Public License, Version 3 or any
|
||||
later version published by the Free Software Foundation.
|
||||
Comment:
|
||||
On Debian systems the GNU General Public License (GPL) version 3 is
|
||||
located in '/usr/share/common-licenses/GPL-3'.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
License: LGPL
|
||||
This program is free software: you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation, either version 3 of the License, or
|
||||
(at your option) any later version.
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
.
|
||||
On Debian systems the GNU Lesser General Public License (LGPL) is
|
||||
located in '/usr/share/common-licenses/LGPL'.
|
||||
.
|
||||
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 General Public License for more details.
|
||||
Comment:
|
||||
On Debian systems the GNU Lesser General Public License (LGPL) is
|
||||
located in '/usr/share/common-licenses/LGPL'.
|
||||
.
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
License: PUB-DOM
|
||||
This work is in the public domain.
|
||||
|
||||
License: LGPL-with-ZeroMQ-exception
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
|
|
@ -53,21 +53,17 @@ READELF_CMD = os.getenv('READELF', '/usr/bin/readelf')
|
|||
CPPFILT_CMD = os.getenv('CPPFILT', '/usr/bin/c++filt')
|
||||
# Allowed NEEDED libraries
|
||||
ALLOWED_LIBRARIES = {
|
||||
# bitcoind and bitcoin-qt
|
||||
# zcashd
|
||||
'libgcc_s.so.1', # GCC base support
|
||||
'libc.so.6', # C library
|
||||
'libstdc++.so.6', # C++ standard library
|
||||
'libpthread.so.0', # threading
|
||||
'libanl.so.1', # DNS resolve
|
||||
'libm.so.6', # math library
|
||||
'librt.so.1', # real-time (clock)
|
||||
'libgomp.so.1', # OpenMP support library
|
||||
'ld-linux-x86-64.so.2', # 64-bit dynamic linker
|
||||
'ld-linux.so.2', # 32-bit dynamic linker
|
||||
# bitcoin-qt only
|
||||
'libX11-xcb.so.1', # part of X11
|
||||
'libX11.so.6', # part of X11
|
||||
'libxcb.so.1', # part of X11
|
||||
'libfontconfig.so.1', # font support
|
||||
'libfreetype.so.6', # font parsing
|
||||
'libdl.so.2' # programming interface to dynamic linker
|
||||
}
|
||||
|
||||
|
|
|
@ -1,186 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
# Copyright (c) 2014 Wladimir J. van der Laan
|
||||
# Distributed under the MIT software license, see the accompanying
|
||||
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
'''
|
||||
Run this script from the root of the repository to update all translations from
|
||||
transifex.
|
||||
It will do the following automatically:
|
||||
|
||||
- fetch all translations using the tx tool
|
||||
- post-process them into valid and committable format
|
||||
- remove invalid control characters
|
||||
- remove location tags (makes diffs less noisy)
|
||||
|
||||
TODO:
|
||||
- auto-add new translations to the build system according to the translation process
|
||||
'''
|
||||
from __future__ import division, print_function
|
||||
import subprocess
|
||||
import re
|
||||
import sys
|
||||
import os
|
||||
import io
|
||||
import xml.etree.ElementTree as ET
|
||||
|
||||
# Name of transifex tool
|
||||
TX = 'tx'
|
||||
# Name of source language file
|
||||
SOURCE_LANG = 'bitcoin_en.ts'
|
||||
# Directory with locale files
|
||||
LOCALE_DIR = 'src/qt/locale'
|
||||
|
||||
def check_at_repository_root():
|
||||
if not os.path.exists('.git'):
|
||||
print('No .git directory found')
|
||||
print('Execute this script at the root of the repository', file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
def fetch_all_translations():
|
||||
if subprocess.call([TX, 'pull', '-f']):
|
||||
print('Error while fetching translations', file=sys.stderr)
|
||||
exit(1)
|
||||
|
||||
def find_format_specifiers(s):
|
||||
'''Find all format specifiers in a string.'''
|
||||
pos = 0
|
||||
specifiers = []
|
||||
while True:
|
||||
percent = s.find('%', pos)
|
||||
if percent < 0:
|
||||
break
|
||||
specifiers.append(s[percent+1])
|
||||
pos = percent+2
|
||||
return specifiers
|
||||
|
||||
def split_format_specifiers(specifiers):
|
||||
'''Split format specifiers between numeric (Qt) and others (strprintf)'''
|
||||
numeric = []
|
||||
other = []
|
||||
for s in specifiers:
|
||||
if s in {'1','2','3','4','5','6','7','8','9'}:
|
||||
numeric.append(s)
|
||||
else:
|
||||
other.append(s)
|
||||
|
||||
# numeric (Qt) can be present in any order, others (strprintf) must be in specified order
|
||||
return set(numeric),other
|
||||
|
||||
def sanitize_string(s):
|
||||
'''Sanitize string for printing'''
|
||||
return s.replace('\n',' ')
|
||||
|
||||
def check_format_specifiers(source, translation, errors):
|
||||
source_f = split_format_specifiers(find_format_specifiers(source))
|
||||
# assert that no source messages contain both Qt and strprintf format specifiers
|
||||
# if this fails, go change the source as this is hacky and confusing!
|
||||
assert(not(source_f[0] and source_f[1]))
|
||||
try:
|
||||
translation_f = split_format_specifiers(find_format_specifiers(translation))
|
||||
except IndexError:
|
||||
errors.append("Parse error in translation '%s'" % sanitize_string(translation))
|
||||
return False
|
||||
else:
|
||||
if source_f != translation_f:
|
||||
errors.append("Mismatch between '%s' and '%s'" % (sanitize_string(source), sanitize_string(translation)))
|
||||
return False
|
||||
return True
|
||||
|
||||
def all_ts_files(suffix=''):
|
||||
for filename in os.listdir(LOCALE_DIR):
|
||||
# process only language files, and do not process source language
|
||||
if not filename.endswith('.ts'+suffix) or filename == SOURCE_LANG+suffix:
|
||||
continue
|
||||
if suffix: # remove provided suffix
|
||||
filename = filename[0:-len(suffix)]
|
||||
filepath = os.path.join(LOCALE_DIR, filename)
|
||||
yield(filename, filepath)
|
||||
|
||||
FIX_RE = re.compile(b'[\x00-\x09\x0b\x0c\x0e-\x1f]')
|
||||
def remove_invalid_characters(s):
|
||||
'''Remove invalid characters from translation string'''
|
||||
return FIX_RE.sub(b'', s)
|
||||
|
||||
# Override cdata escape function to make our output match Qt's (optional, just for cleaner diffs for
|
||||
# comparison, disable by default)
|
||||
_orig_escape_cdata = None
|
||||
def escape_cdata(text):
|
||||
text = _orig_escape_cdata(text)
|
||||
text = text.replace("'", ''')
|
||||
text = text.replace('"', '"')
|
||||
return text
|
||||
|
||||
def postprocess_translations(reduce_diff_hacks=False):
|
||||
print('Checking and postprocessing...')
|
||||
|
||||
if reduce_diff_hacks:
|
||||
global _orig_escape_cdata
|
||||
_orig_escape_cdata = ET._escape_cdata
|
||||
ET._escape_cdata = escape_cdata
|
||||
|
||||
for (filename,filepath) in all_ts_files():
|
||||
os.rename(filepath, filepath+'.orig')
|
||||
|
||||
have_errors = False
|
||||
for (filename,filepath) in all_ts_files('.orig'):
|
||||
# pre-fixups to cope with transifex output
|
||||
parser = ET.XMLParser(encoding='utf-8') # need to override encoding because 'utf8' is not understood only 'utf-8'
|
||||
with open(filepath + '.orig', 'rb') as f:
|
||||
data = f.read()
|
||||
# remove control characters; this must be done over the entire file otherwise the XML parser will fail
|
||||
data = remove_invalid_characters(data)
|
||||
tree = ET.parse(io.BytesIO(data), parser=parser)
|
||||
|
||||
# iterate over all messages in file
|
||||
root = tree.getroot()
|
||||
for context in root.findall('context'):
|
||||
for message in context.findall('message'):
|
||||
numerus = message.get('numerus') == 'yes'
|
||||
source = message.find('source').text
|
||||
translation_node = message.find('translation')
|
||||
# pick all numerusforms
|
||||
if numerus:
|
||||
translations = [i.text for i in translation_node.findall('numerusform')]
|
||||
else:
|
||||
translations = [translation_node.text]
|
||||
|
||||
for translation in translations:
|
||||
if translation is None:
|
||||
continue
|
||||
errors = []
|
||||
valid = check_format_specifiers(source, translation, errors)
|
||||
|
||||
for error in errors:
|
||||
print('%s: %s' % (filename, error))
|
||||
|
||||
if not valid: # set type to unfinished and clear string if invalid
|
||||
translation_node.clear()
|
||||
translation_node.set('type', 'unfinished')
|
||||
have_errors = True
|
||||
|
||||
# Remove location tags
|
||||
for location in message.findall('location'):
|
||||
message.remove(location)
|
||||
|
||||
# Remove entire message if it is an unfinished translation
|
||||
if translation_node.get('type') == 'unfinished':
|
||||
context.remove(message)
|
||||
|
||||
# write fixed-up tree
|
||||
# if diff reduction requested, replace some XML to 'sanitize' to qt formatting
|
||||
if reduce_diff_hacks:
|
||||
out = io.BytesIO()
|
||||
tree.write(out, encoding='utf-8')
|
||||
out = out.getvalue()
|
||||
out = out.replace(b' />', b'/>')
|
||||
with open(filepath, 'wb') as f:
|
||||
f.write(out)
|
||||
else:
|
||||
tree.write(filepath, encoding='utf-8')
|
||||
return have_errors
|
||||
|
||||
if __name__ == '__main__':
|
||||
check_at_repository_root()
|
||||
fetch_all_translations()
|
||||
postprocess_translations()
|
||||
|
|
@ -31,8 +31,8 @@ files: []
|
|||
script: |
|
||||
WRAP_DIR=$HOME/wrapped
|
||||
HOSTS="x86_64-unknown-linux-gnu"
|
||||
CONFIGFLAGS="--enable-glibc-back-compat --enable-reduce-exports --disable-bench --disable-gui-tests --with-gui=no --enable-hardening"
|
||||
MAKEOPTS="V=1 NO_QT=1"
|
||||
CONFIGFLAGS="--enable-glibc-back-compat --enable-reduce-exports --disable-bench --enable-hardening"
|
||||
MAKEOPTS="V=1"
|
||||
FAKETIME_HOST_PROGS=""
|
||||
FAKETIME_PROGS="date ar ranlib nm strip objcopy"
|
||||
HOST_CFLAGS="-fwrapv -fno-strict-aliasing -Werror -g"
|
||||
|
|
|
@ -28,7 +28,7 @@ files:
|
|||
script: |
|
||||
WRAP_DIR=$HOME/wrapped
|
||||
HOSTS="x86_64-apple-darwin11"
|
||||
CONFIGFLAGS="--enable-reduce-exports --disable-bench --disable-gui-tests GENISOIMAGE=$WRAP_DIR/genisoimage"
|
||||
CONFIGFLAGS="--enable-reduce-exports --disable-bench GENISOIMAGE=$WRAP_DIR/genisoimage"
|
||||
FAKETIME_HOST_PROGS=""
|
||||
FAKETIME_PROGS="ar ranlib date dmg genisoimage"
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ files: []
|
|||
script: |
|
||||
WRAP_DIR=$HOME/wrapped
|
||||
HOSTS="x86_64-w64-mingw32 i686-w64-mingw32"
|
||||
CONFIGFLAGS="--enable-reduce-exports --disable-bench --disable-gui-tests"
|
||||
CONFIGFLAGS="--enable-reduce-exports --disable-bench"
|
||||
FAKETIME_HOST_PROGS="g++ ar ranlib nm windres strip objcopy"
|
||||
FAKETIME_PROGS="date makensis zip"
|
||||
HOST_CFLAGS="-O2 -g"
|
||||
|
|
|
@ -1,883 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
#
|
||||
# Copyright (C) 2011 Patrick "p2k" Schneider <me@p2k-network.org>
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# 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 General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
import subprocess, sys, re, os, shutil, stat, os.path, time
|
||||
from string import Template
|
||||
from argparse import ArgumentParser
|
||||
|
||||
# This is ported from the original macdeployqt with modifications
|
||||
|
||||
class FrameworkInfo(object):
|
||||
def __init__(self):
|
||||
self.frameworkDirectory = ""
|
||||
self.frameworkName = ""
|
||||
self.frameworkPath = ""
|
||||
self.binaryDirectory = ""
|
||||
self.binaryName = ""
|
||||
self.binaryPath = ""
|
||||
self.version = ""
|
||||
self.installName = ""
|
||||
self.deployedInstallName = ""
|
||||
self.sourceFilePath = ""
|
||||
self.destinationDirectory = ""
|
||||
self.sourceResourcesDirectory = ""
|
||||
self.sourceVersionContentsDirectory = ""
|
||||
self.sourceContentsDirectory = ""
|
||||
self.destinationResourcesDirectory = ""
|
||||
self.destinationVersionContentsDirectory = ""
|
||||
|
||||
def __eq__(self, other):
|
||||
if self.__class__ == other.__class__:
|
||||
return self.__dict__ == other.__dict__
|
||||
else:
|
||||
return False
|
||||
|
||||
def __str__(self):
|
||||
return """ Framework name: %s
|
||||
Framework directory: %s
|
||||
Framework path: %s
|
||||
Binary name: %s
|
||||
Binary directory: %s
|
||||
Binary path: %s
|
||||
Version: %s
|
||||
Install name: %s
|
||||
Deployed install name: %s
|
||||
Source file Path: %s
|
||||
Deployed Directory (relative to bundle): %s
|
||||
""" % (self.frameworkName,
|
||||
self.frameworkDirectory,
|
||||
self.frameworkPath,
|
||||
self.binaryName,
|
||||
self.binaryDirectory,
|
||||
self.binaryPath,
|
||||
self.version,
|
||||
self.installName,
|
||||
self.deployedInstallName,
|
||||
self.sourceFilePath,
|
||||
self.destinationDirectory)
|
||||
|
||||
def isDylib(self):
|
||||
return self.frameworkName.endswith(".dylib")
|
||||
|
||||
def isQtFramework(self):
|
||||
if self.isDylib():
|
||||
return self.frameworkName.startswith("libQt")
|
||||
else:
|
||||
return self.frameworkName.startswith("Qt")
|
||||
|
||||
reOLine = re.compile(r'^(.+) \(compatibility version [0-9.]+, current version [0-9.]+\)$')
|
||||
bundleFrameworkDirectory = "Contents/Frameworks"
|
||||
bundleBinaryDirectory = "Contents/MacOS"
|
||||
|
||||
@classmethod
|
||||
def fromOtoolLibraryLine(cls, line):
|
||||
# Note: line must be trimmed
|
||||
if line == "":
|
||||
return None
|
||||
|
||||
# Don't deploy system libraries (exception for libQtuitools and libQtlucene).
|
||||
if line.startswith("/System/Library/") or line.startswith("@executable_path") or (line.startswith("/usr/lib/") and "libQt" not in line):
|
||||
return None
|
||||
|
||||
m = cls.reOLine.match(line)
|
||||
if m is None:
|
||||
raise RuntimeError("otool line could not be parsed: " + line)
|
||||
|
||||
path = m.group(1)
|
||||
|
||||
info = cls()
|
||||
info.sourceFilePath = path
|
||||
info.installName = path
|
||||
|
||||
if path.endswith(".dylib"):
|
||||
dirname, filename = os.path.split(path)
|
||||
info.frameworkName = filename
|
||||
info.frameworkDirectory = dirname
|
||||
info.frameworkPath = path
|
||||
|
||||
info.binaryDirectory = dirname
|
||||
info.binaryName = filename
|
||||
info.binaryPath = path
|
||||
info.version = "-"
|
||||
|
||||
info.installName = path
|
||||
info.deployedInstallName = "@executable_path/../Frameworks/" + info.binaryName
|
||||
info.sourceFilePath = path
|
||||
info.destinationDirectory = cls.bundleFrameworkDirectory
|
||||
else:
|
||||
parts = path.split("/")
|
||||
i = 0
|
||||
# Search for the .framework directory
|
||||
for part in parts:
|
||||
if part.endswith(".framework"):
|
||||
break
|
||||
i += 1
|
||||
if i == len(parts):
|
||||
raise RuntimeError("Could not find .framework or .dylib in otool line: " + line)
|
||||
|
||||
info.frameworkName = parts[i]
|
||||
info.frameworkDirectory = "/".join(parts[:i])
|
||||
info.frameworkPath = os.path.join(info.frameworkDirectory, info.frameworkName)
|
||||
|
||||
info.binaryName = parts[i+3]
|
||||
info.binaryDirectory = "/".join(parts[i+1:i+3])
|
||||
info.binaryPath = os.path.join(info.binaryDirectory, info.binaryName)
|
||||
info.version = parts[i+2]
|
||||
|
||||
info.deployedInstallName = "@executable_path/../Frameworks/" + os.path.join(info.frameworkName, info.binaryPath)
|
||||
info.destinationDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, info.binaryDirectory)
|
||||
|
||||
info.sourceResourcesDirectory = os.path.join(info.frameworkPath, "Resources")
|
||||
info.sourceContentsDirectory = os.path.join(info.frameworkPath, "Contents")
|
||||
info.sourceVersionContentsDirectory = os.path.join(info.frameworkPath, "Versions", info.version, "Contents")
|
||||
info.destinationResourcesDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Resources")
|
||||
info.destinationContentsDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Contents")
|
||||
info.destinationVersionContentsDirectory = os.path.join(cls.bundleFrameworkDirectory, info.frameworkName, "Versions", info.version, "Contents")
|
||||
|
||||
return info
|
||||
|
||||
class ApplicationBundleInfo(object):
|
||||
def __init__(self, path):
|
||||
self.path = path
|
||||
appName = "Bitcoin-Qt"
|
||||
self.binaryPath = os.path.join(path, "Contents", "MacOS", appName)
|
||||
if not os.path.exists(self.binaryPath):
|
||||
raise RuntimeError("Could not find bundle binary for " + path)
|
||||
self.resourcesPath = os.path.join(path, "Contents", "Resources")
|
||||
self.pluginPath = os.path.join(path, "Contents", "PlugIns")
|
||||
|
||||
class DeploymentInfo(object):
|
||||
def __init__(self):
|
||||
self.qtPath = None
|
||||
self.pluginPath = None
|
||||
self.deployedFrameworks = []
|
||||
|
||||
def detectQtPath(self, frameworkDirectory):
|
||||
parentDir = os.path.dirname(frameworkDirectory)
|
||||
if os.path.exists(os.path.join(parentDir, "translations")):
|
||||
# Classic layout, e.g. "/usr/local/Trolltech/Qt-4.x.x"
|
||||
self.qtPath = parentDir
|
||||
elif os.path.exists(os.path.join(parentDir, "share", "qt4", "translations")):
|
||||
# MacPorts layout, e.g. "/opt/local/share/qt4"
|
||||
self.qtPath = os.path.join(parentDir, "share", "qt4")
|
||||
elif os.path.exists(os.path.join(os.path.dirname(parentDir), "share", "qt4", "translations")):
|
||||
# Newer Macports layout
|
||||
self.qtPath = os.path.join(os.path.dirname(parentDir), "share", "qt4")
|
||||
else:
|
||||
self.qtPath = os.getenv("QTDIR", None)
|
||||
|
||||
if self.qtPath is not None:
|
||||
pluginPath = os.path.join(self.qtPath, "plugins")
|
||||
if os.path.exists(pluginPath):
|
||||
self.pluginPath = pluginPath
|
||||
|
||||
def usesFramework(self, name):
|
||||
nameDot = "%s." % name
|
||||
libNameDot = "lib%s." % name
|
||||
for framework in self.deployedFrameworks:
|
||||
if framework.endswith(".framework"):
|
||||
if framework.startswith(nameDot):
|
||||
return True
|
||||
elif framework.endswith(".dylib"):
|
||||
if framework.startswith(libNameDot):
|
||||
return True
|
||||
return False
|
||||
|
||||
def getFrameworks(binaryPath, verbose):
|
||||
if verbose >= 3:
|
||||
print "Inspecting with otool: " + binaryPath
|
||||
otoolbin=os.getenv("OTOOL", "otool")
|
||||
otool = subprocess.Popen([otoolbin, "-L", binaryPath], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
|
||||
o_stdout, o_stderr = otool.communicate()
|
||||
if otool.returncode != 0:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write(o_stderr)
|
||||
sys.stderr.flush()
|
||||
raise RuntimeError("otool failed with return code %d" % otool.returncode)
|
||||
|
||||
otoolLines = o_stdout.split("\n")
|
||||
otoolLines.pop(0) # First line is the inspected binary
|
||||
if ".framework" in binaryPath or binaryPath.endswith(".dylib"):
|
||||
otoolLines.pop(0) # Frameworks and dylibs list themselves as a dependency.
|
||||
|
||||
libraries = []
|
||||
for line in otoolLines:
|
||||
line = line.replace("@loader_path", os.path.dirname(binaryPath))
|
||||
info = FrameworkInfo.fromOtoolLibraryLine(line.strip())
|
||||
if info is not None:
|
||||
if verbose >= 3:
|
||||
print "Found framework:"
|
||||
print info
|
||||
libraries.append(info)
|
||||
|
||||
return libraries
|
||||
|
||||
def runInstallNameTool(action, *args):
|
||||
installnametoolbin=os.getenv("INSTALLNAMETOOL", "install_name_tool")
|
||||
subprocess.check_call([installnametoolbin, "-"+action] + list(args))
|
||||
|
||||
def changeInstallName(oldName, newName, binaryPath, verbose):
|
||||
if verbose >= 3:
|
||||
print "Using install_name_tool:"
|
||||
print " in", binaryPath
|
||||
print " change reference", oldName
|
||||
print " to", newName
|
||||
runInstallNameTool("change", oldName, newName, binaryPath)
|
||||
|
||||
def changeIdentification(id, binaryPath, verbose):
|
||||
if verbose >= 3:
|
||||
print "Using install_name_tool:"
|
||||
print " change identification in", binaryPath
|
||||
print " to", id
|
||||
runInstallNameTool("id", id, binaryPath)
|
||||
|
||||
def runStrip(binaryPath, verbose):
|
||||
stripbin=os.getenv("STRIP", "strip")
|
||||
if verbose >= 3:
|
||||
print "Using strip:"
|
||||
print " stripped", binaryPath
|
||||
subprocess.check_call([stripbin, "-x", binaryPath])
|
||||
|
||||
def copyFramework(framework, path, verbose):
|
||||
if framework.sourceFilePath.startswith("Qt"):
|
||||
#standard place for Nokia Qt installer's frameworks
|
||||
fromPath = "/Library/Frameworks/" + framework.sourceFilePath
|
||||
else:
|
||||
fromPath = framework.sourceFilePath
|
||||
toDir = os.path.join(path, framework.destinationDirectory)
|
||||
toPath = os.path.join(toDir, framework.binaryName)
|
||||
|
||||
if not os.path.exists(fromPath):
|
||||
raise RuntimeError("No file at " + fromPath)
|
||||
|
||||
if os.path.exists(toPath):
|
||||
return None # Already there
|
||||
|
||||
if not os.path.exists(toDir):
|
||||
os.makedirs(toDir)
|
||||
|
||||
shutil.copy2(fromPath, toPath)
|
||||
if verbose >= 3:
|
||||
print "Copied:", fromPath
|
||||
print " to:", toPath
|
||||
|
||||
permissions = os.stat(toPath)
|
||||
if not permissions.st_mode & stat.S_IWRITE:
|
||||
os.chmod(toPath, permissions.st_mode | stat.S_IWRITE)
|
||||
|
||||
if not framework.isDylib(): # Copy resources for real frameworks
|
||||
|
||||
linkfrom = os.path.join(path, "Contents","Frameworks", framework.frameworkName, "Versions", "Current")
|
||||
linkto = framework.version
|
||||
if not os.path.exists(linkfrom):
|
||||
os.symlink(linkto, linkfrom)
|
||||
if verbose >= 2:
|
||||
print "Linked:", linkfrom, "->", linkto
|
||||
fromResourcesDir = framework.sourceResourcesDirectory
|
||||
if os.path.exists(fromResourcesDir):
|
||||
toResourcesDir = os.path.join(path, framework.destinationResourcesDirectory)
|
||||
shutil.copytree(fromResourcesDir, toResourcesDir, symlinks=True)
|
||||
if verbose >= 3:
|
||||
print "Copied resources:", fromResourcesDir
|
||||
print " to:", toResourcesDir
|
||||
fromContentsDir = framework.sourceVersionContentsDirectory
|
||||
if not os.path.exists(fromContentsDir):
|
||||
fromContentsDir = framework.sourceContentsDirectory
|
||||
if os.path.exists(fromContentsDir):
|
||||
toContentsDir = os.path.join(path, framework.destinationVersionContentsDirectory)
|
||||
shutil.copytree(fromContentsDir, toContentsDir, symlinks=True)
|
||||
contentslinkfrom = os.path.join(path, framework.destinationContentsDirectory)
|
||||
if verbose >= 3:
|
||||
print "Copied Contents:", fromContentsDir
|
||||
print " to:", toContentsDir
|
||||
elif framework.frameworkName.startswith("libQtGui"): # Copy qt_menu.nib (applies to non-framework layout)
|
||||
qtMenuNibSourcePath = os.path.join(framework.frameworkDirectory, "Resources", "qt_menu.nib")
|
||||
qtMenuNibDestinationPath = os.path.join(path, "Contents", "Resources", "qt_menu.nib")
|
||||
if os.path.exists(qtMenuNibSourcePath) and not os.path.exists(qtMenuNibDestinationPath):
|
||||
shutil.copytree(qtMenuNibSourcePath, qtMenuNibDestinationPath, symlinks=True)
|
||||
if verbose >= 3:
|
||||
print "Copied for libQtGui:", qtMenuNibSourcePath
|
||||
print " to:", qtMenuNibDestinationPath
|
||||
|
||||
return toPath
|
||||
|
||||
def deployFrameworks(frameworks, bundlePath, binaryPath, strip, verbose, deploymentInfo=None):
|
||||
if deploymentInfo is None:
|
||||
deploymentInfo = DeploymentInfo()
|
||||
|
||||
while len(frameworks) > 0:
|
||||
framework = frameworks.pop(0)
|
||||
deploymentInfo.deployedFrameworks.append(framework.frameworkName)
|
||||
|
||||
if verbose >= 2:
|
||||
print "Processing", framework.frameworkName, "..."
|
||||
|
||||
# Get the Qt path from one of the Qt frameworks
|
||||
if deploymentInfo.qtPath is None and framework.isQtFramework():
|
||||
deploymentInfo.detectQtPath(framework.frameworkDirectory)
|
||||
|
||||
if framework.installName.startswith("@executable_path") or framework.installName.startswith(bundlePath):
|
||||
if verbose >= 2:
|
||||
print framework.frameworkName, "already deployed, skipping."
|
||||
continue
|
||||
|
||||
# install_name_tool the new id into the binary
|
||||
changeInstallName(framework.installName, framework.deployedInstallName, binaryPath, verbose)
|
||||
|
||||
# Copy farmework to app bundle.
|
||||
deployedBinaryPath = copyFramework(framework, bundlePath, verbose)
|
||||
# Skip the rest if already was deployed.
|
||||
if deployedBinaryPath is None:
|
||||
continue
|
||||
|
||||
if strip:
|
||||
runStrip(deployedBinaryPath, verbose)
|
||||
|
||||
# install_name_tool it a new id.
|
||||
changeIdentification(framework.deployedInstallName, deployedBinaryPath, verbose)
|
||||
# Check for framework dependencies
|
||||
dependencies = getFrameworks(deployedBinaryPath, verbose)
|
||||
|
||||
for dependency in dependencies:
|
||||
changeInstallName(dependency.installName, dependency.deployedInstallName, deployedBinaryPath, verbose)
|
||||
|
||||
# Deploy framework if necessary.
|
||||
if dependency.frameworkName not in deploymentInfo.deployedFrameworks and dependency not in frameworks:
|
||||
frameworks.append(dependency)
|
||||
|
||||
return deploymentInfo
|
||||
|
||||
def deployFrameworksForAppBundle(applicationBundle, strip, verbose):
|
||||
frameworks = getFrameworks(applicationBundle.binaryPath, verbose)
|
||||
if len(frameworks) == 0 and verbose >= 1:
|
||||
print "Warning: Could not find any external frameworks to deploy in %s." % (applicationBundle.path)
|
||||
return DeploymentInfo()
|
||||
else:
|
||||
return deployFrameworks(frameworks, applicationBundle.path, applicationBundle.binaryPath, strip, verbose)
|
||||
|
||||
def deployPlugins(appBundleInfo, deploymentInfo, strip, verbose):
|
||||
# Lookup available plugins, exclude unneeded
|
||||
plugins = []
|
||||
if deploymentInfo.pluginPath is None:
|
||||
return
|
||||
for dirpath, dirnames, filenames in os.walk(deploymentInfo.pluginPath):
|
||||
pluginDirectory = os.path.relpath(dirpath, deploymentInfo.pluginPath)
|
||||
if pluginDirectory == "designer":
|
||||
# Skip designer plugins
|
||||
continue
|
||||
elif pluginDirectory == "phonon" or pluginDirectory == "phonon_backend":
|
||||
# Deploy the phonon plugins only if phonon is in use
|
||||
if not deploymentInfo.usesFramework("phonon"):
|
||||
continue
|
||||
elif pluginDirectory == "sqldrivers":
|
||||
# Deploy the sql plugins only if QtSql is in use
|
||||
if not deploymentInfo.usesFramework("QtSql"):
|
||||
continue
|
||||
elif pluginDirectory == "script":
|
||||
# Deploy the script plugins only if QtScript is in use
|
||||
if not deploymentInfo.usesFramework("QtScript"):
|
||||
continue
|
||||
elif pluginDirectory == "qmltooling" or pluginDirectory == "qml1tooling":
|
||||
# Deploy the qml plugins only if QtDeclarative is in use
|
||||
if not deploymentInfo.usesFramework("QtDeclarative"):
|
||||
continue
|
||||
elif pluginDirectory == "bearer":
|
||||
# Deploy the bearer plugins only if QtNetwork is in use
|
||||
if not deploymentInfo.usesFramework("QtNetwork"):
|
||||
continue
|
||||
elif pluginDirectory == "position":
|
||||
# Deploy the position plugins only if QtPositioning is in use
|
||||
if not deploymentInfo.usesFramework("QtPositioning"):
|
||||
continue
|
||||
elif pluginDirectory == "sensors" or pluginDirectory == "sensorgestures":
|
||||
# Deploy the sensor plugins only if QtSensors is in use
|
||||
if not deploymentInfo.usesFramework("QtSensors"):
|
||||
continue
|
||||
elif pluginDirectory == "audio" or pluginDirectory == "playlistformats":
|
||||
# Deploy the audio plugins only if QtMultimedia is in use
|
||||
if not deploymentInfo.usesFramework("QtMultimedia"):
|
||||
continue
|
||||
elif pluginDirectory == "mediaservice":
|
||||
# Deploy the mediaservice plugins only if QtMultimediaWidgets is in use
|
||||
if not deploymentInfo.usesFramework("QtMultimediaWidgets"):
|
||||
continue
|
||||
|
||||
for pluginName in filenames:
|
||||
pluginPath = os.path.join(pluginDirectory, pluginName)
|
||||
if pluginName.endswith("_debug.dylib"):
|
||||
# Skip debug plugins
|
||||
continue
|
||||
elif pluginPath == "imageformats/libqsvg.dylib" or pluginPath == "iconengines/libqsvgicon.dylib":
|
||||
# Deploy the svg plugins only if QtSvg is in use
|
||||
if not deploymentInfo.usesFramework("QtSvg"):
|
||||
continue
|
||||
elif pluginPath == "accessible/libqtaccessiblecompatwidgets.dylib":
|
||||
# Deploy accessibility for Qt3Support only if the Qt3Support is in use
|
||||
if not deploymentInfo.usesFramework("Qt3Support"):
|
||||
continue
|
||||
elif pluginPath == "graphicssystems/libqglgraphicssystem.dylib":
|
||||
# Deploy the opengl graphicssystem plugin only if QtOpenGL is in use
|
||||
if not deploymentInfo.usesFramework("QtOpenGL"):
|
||||
continue
|
||||
elif pluginPath == "accessible/libqtaccessiblequick.dylib":
|
||||
# Deploy the accessible qtquick plugin only if QtQuick is in use
|
||||
if not deploymentInfo.usesFramework("QtQuick"):
|
||||
continue
|
||||
|
||||
plugins.append((pluginDirectory, pluginName))
|
||||
|
||||
for pluginDirectory, pluginName in plugins:
|
||||
if verbose >= 2:
|
||||
print "Processing plugin", os.path.join(pluginDirectory, pluginName), "..."
|
||||
|
||||
sourcePath = os.path.join(deploymentInfo.pluginPath, pluginDirectory, pluginName)
|
||||
destinationDirectory = os.path.join(appBundleInfo.pluginPath, pluginDirectory)
|
||||
if not os.path.exists(destinationDirectory):
|
||||
os.makedirs(destinationDirectory)
|
||||
|
||||
destinationPath = os.path.join(destinationDirectory, pluginName)
|
||||
shutil.copy2(sourcePath, destinationPath)
|
||||
if verbose >= 3:
|
||||
print "Copied:", sourcePath
|
||||
print " to:", destinationPath
|
||||
|
||||
if strip:
|
||||
runStrip(destinationPath, verbose)
|
||||
|
||||
dependencies = getFrameworks(destinationPath, verbose)
|
||||
|
||||
for dependency in dependencies:
|
||||
changeInstallName(dependency.installName, dependency.deployedInstallName, destinationPath, verbose)
|
||||
|
||||
# Deploy framework if necessary.
|
||||
if dependency.frameworkName not in deploymentInfo.deployedFrameworks:
|
||||
deployFrameworks([dependency], appBundleInfo.path, destinationPath, strip, verbose, deploymentInfo)
|
||||
|
||||
qt_conf="""[Paths]
|
||||
Translations=Resources
|
||||
Plugins=PlugIns
|
||||
"""
|
||||
|
||||
ap = ArgumentParser(description="""Improved version of macdeployqt.
|
||||
|
||||
Outputs a ready-to-deploy app in a folder "dist" and optionally wraps it in a .dmg file.
|
||||
Note, that the "dist" folder will be deleted before deploying on each run.
|
||||
|
||||
Optionally, Qt translation files (.qm) and additional resources can be added to the bundle.
|
||||
|
||||
Also optionally signs the .app bundle; set the CODESIGNARGS environment variable to pass arguments
|
||||
to the codesign tool.
|
||||
E.g. CODESIGNARGS='--sign "Developer ID Application: ..." --keychain /encrypted/foo.keychain'""")
|
||||
|
||||
ap.add_argument("app_bundle", nargs=1, metavar="app-bundle", help="application bundle to be deployed")
|
||||
ap.add_argument("-verbose", type=int, nargs=1, default=[1], metavar="<0-3>", help="0 = no output, 1 = error/warning (default), 2 = normal, 3 = debug")
|
||||
ap.add_argument("-no-plugins", dest="plugins", action="store_false", default=True, help="skip plugin deployment")
|
||||
ap.add_argument("-no-strip", dest="strip", action="store_false", default=True, help="don't run 'strip' on the binaries")
|
||||
ap.add_argument("-sign", dest="sign", action="store_true", default=False, help="sign .app bundle with codesign tool")
|
||||
ap.add_argument("-dmg", nargs="?", const="", metavar="basename", help="create a .dmg disk image; if basename is not specified, a camel-cased version of the app name is used")
|
||||
ap.add_argument("-fancy", nargs=1, metavar="plist", default=[], help="make a fancy looking disk image using the given plist file with instructions; requires -dmg to work")
|
||||
ap.add_argument("-add-qt-tr", nargs=1, metavar="languages", default=[], help="add Qt translation files to the bundle's ressources; the language list must be separated with commas, not with whitespace")
|
||||
ap.add_argument("-translations-dir", nargs=1, metavar="path", default=None, help="Path to Qt's translation files")
|
||||
ap.add_argument("-add-resources", nargs="+", metavar="path", default=[], help="list of additional files or folders to be copied into the bundle's resources; must be the last argument")
|
||||
|
||||
config = ap.parse_args()
|
||||
|
||||
verbose = config.verbose[0]
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
app_bundle = config.app_bundle[0]
|
||||
|
||||
if not os.path.exists(app_bundle):
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not find app bundle \"%s\"\n" % (app_bundle))
|
||||
sys.exit(1)
|
||||
|
||||
app_bundle_name = os.path.splitext(os.path.basename(app_bundle))[0]
|
||||
|
||||
# ------------------------------------------------
|
||||
translations_dir = None
|
||||
if config.translations_dir and config.translations_dir[0]:
|
||||
if os.path.exists(config.translations_dir[0]):
|
||||
translations_dir = config.translations_dir[0]
|
||||
else:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not find translation dir \"%s\"\n" % (translations_dir))
|
||||
sys.exit(1)
|
||||
# ------------------------------------------------
|
||||
|
||||
for p in config.add_resources:
|
||||
if verbose >= 3:
|
||||
print "Checking for \"%s\"..." % p
|
||||
if not os.path.exists(p):
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not find additional resource file \"%s\"\n" % (p))
|
||||
sys.exit(1)
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if len(config.fancy) == 1:
|
||||
if verbose >= 3:
|
||||
print "Fancy: Importing plistlib..."
|
||||
try:
|
||||
import plistlib
|
||||
except ImportError:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not import plistlib which is required for fancy disk images.\n")
|
||||
sys.exit(1)
|
||||
|
||||
p = config.fancy[0]
|
||||
if verbose >= 3:
|
||||
print "Fancy: Loading \"%s\"..." % p
|
||||
if not os.path.exists(p):
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not find fancy disk image plist at \"%s\"\n" % (p))
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
fancy = plistlib.readPlist(p)
|
||||
except:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not parse fancy disk image plist at \"%s\"\n" % (p))
|
||||
sys.exit(1)
|
||||
|
||||
try:
|
||||
assert not fancy.has_key("window_bounds") or (isinstance(fancy["window_bounds"], list) and len(fancy["window_bounds"]) == 4)
|
||||
assert not fancy.has_key("background_picture") or isinstance(fancy["background_picture"], str)
|
||||
assert not fancy.has_key("icon_size") or isinstance(fancy["icon_size"], int)
|
||||
assert not fancy.has_key("applications_symlink") or isinstance(fancy["applications_symlink"], bool)
|
||||
if fancy.has_key("items_position"):
|
||||
assert isinstance(fancy["items_position"], dict)
|
||||
for key, value in fancy["items_position"].iteritems():
|
||||
assert isinstance(value, list) and len(value) == 2 and isinstance(value[0], int) and isinstance(value[1], int)
|
||||
except:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Bad format of fancy disk image plist at \"%s\"\n" % (p))
|
||||
sys.exit(1)
|
||||
|
||||
if fancy.has_key("background_picture"):
|
||||
bp = fancy["background_picture"]
|
||||
if verbose >= 3:
|
||||
print "Fancy: Resolving background picture \"%s\"..." % bp
|
||||
if not os.path.exists(bp):
|
||||
bp = os.path.join(os.path.dirname(p), bp)
|
||||
if not os.path.exists(bp):
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not find background picture at \"%s\" or \"%s\"\n" % (fancy["background_picture"], bp))
|
||||
sys.exit(1)
|
||||
else:
|
||||
fancy["background_picture"] = bp
|
||||
else:
|
||||
fancy = None
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if os.path.exists("dist"):
|
||||
if verbose >= 2:
|
||||
print "+ Removing old dist folder +"
|
||||
|
||||
shutil.rmtree("dist")
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
target = os.path.join("dist", "Bitcoin-Qt.app")
|
||||
|
||||
if verbose >= 2:
|
||||
print "+ Copying source bundle +"
|
||||
if verbose >= 3:
|
||||
print app_bundle, "->", target
|
||||
|
||||
os.mkdir("dist")
|
||||
shutil.copytree(app_bundle, target, symlinks=True)
|
||||
|
||||
applicationBundle = ApplicationBundleInfo(target)
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if verbose >= 2:
|
||||
print "+ Deploying frameworks +"
|
||||
|
||||
try:
|
||||
deploymentInfo = deployFrameworksForAppBundle(applicationBundle, config.strip, verbose)
|
||||
if deploymentInfo.qtPath is None:
|
||||
deploymentInfo.qtPath = os.getenv("QTDIR", None)
|
||||
if deploymentInfo.qtPath is None:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Warning: Could not detect Qt's path, skipping plugin deployment!\n")
|
||||
config.plugins = False
|
||||
except RuntimeError as e:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: %s\n" % str(e))
|
||||
sys.exit(1)
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if config.plugins:
|
||||
if verbose >= 2:
|
||||
print "+ Deploying plugins +"
|
||||
|
||||
try:
|
||||
deployPlugins(applicationBundle, deploymentInfo, config.strip, verbose)
|
||||
except RuntimeError as e:
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: %s\n" % str(e))
|
||||
sys.exit(1)
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if len(config.add_qt_tr) == 0:
|
||||
add_qt_tr = []
|
||||
else:
|
||||
if translations_dir is not None:
|
||||
qt_tr_dir = translations_dir
|
||||
else:
|
||||
if deploymentInfo.qtPath is not None:
|
||||
qt_tr_dir = os.path.join(deploymentInfo.qtPath, "translations")
|
||||
else:
|
||||
sys.stderr.write("Error: Could not find Qt translation path\n")
|
||||
sys.exit(1)
|
||||
add_qt_tr = ["qt_%s.qm" % lng for lng in config.add_qt_tr[0].split(",")]
|
||||
for lng_file in add_qt_tr:
|
||||
p = os.path.join(qt_tr_dir, lng_file)
|
||||
if verbose >= 3:
|
||||
print "Checking for \"%s\"..." % p
|
||||
if not os.path.exists(p):
|
||||
if verbose >= 1:
|
||||
sys.stderr.write("Error: Could not find Qt translation file \"%s\"\n" % (lng_file))
|
||||
sys.exit(1)
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if verbose >= 2:
|
||||
print "+ Installing qt.conf +"
|
||||
|
||||
f = open(os.path.join(applicationBundle.resourcesPath, "qt.conf"), "wb")
|
||||
f.write(qt_conf)
|
||||
f.close()
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if len(add_qt_tr) > 0 and verbose >= 2:
|
||||
print "+ Adding Qt translations +"
|
||||
|
||||
for lng_file in add_qt_tr:
|
||||
if verbose >= 3:
|
||||
print os.path.join(qt_tr_dir, lng_file), "->", os.path.join(applicationBundle.resourcesPath, lng_file)
|
||||
shutil.copy2(os.path.join(qt_tr_dir, lng_file), os.path.join(applicationBundle.resourcesPath, lng_file))
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if len(config.add_resources) > 0 and verbose >= 2:
|
||||
print "+ Adding additional resources +"
|
||||
|
||||
for p in config.add_resources:
|
||||
t = os.path.join(applicationBundle.resourcesPath, os.path.basename(p))
|
||||
if verbose >= 3:
|
||||
print p, "->", t
|
||||
if os.path.isdir(p):
|
||||
shutil.copytree(p, t, symlinks=True)
|
||||
else:
|
||||
shutil.copy2(p, t)
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if config.sign and 'CODESIGNARGS' not in os.environ:
|
||||
print "You must set the CODESIGNARGS environment variable. Skipping signing."
|
||||
elif config.sign:
|
||||
if verbose >= 1:
|
||||
print "Code-signing app bundle %s"%(target,)
|
||||
subprocess.check_call("codesign --force %s %s"%(os.environ['CODESIGNARGS'], target), shell=True)
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if config.dmg is not None:
|
||||
|
||||
#Patch in check_output for Python 2.6
|
||||
if "check_output" not in dir( subprocess ):
|
||||
def f(*popenargs, **kwargs):
|
||||
if 'stdout' in kwargs:
|
||||
raise ValueError('stdout argument not allowed, it will be overridden.')
|
||||
process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs)
|
||||
output, unused_err = process.communicate()
|
||||
retcode = process.poll()
|
||||
if retcode:
|
||||
cmd = kwargs.get("args")
|
||||
if cmd is None:
|
||||
cmd = popenargs[0]
|
||||
raise CalledProcessError(retcode, cmd)
|
||||
return output
|
||||
subprocess.check_output = f
|
||||
|
||||
def runHDIUtil(verb, image_basename, **kwargs):
|
||||
hdiutil_args = ["hdiutil", verb, image_basename + ".dmg"]
|
||||
if kwargs.has_key("capture_stdout"):
|
||||
del kwargs["capture_stdout"]
|
||||
run = subprocess.check_output
|
||||
else:
|
||||
if verbose < 2:
|
||||
hdiutil_args.append("-quiet")
|
||||
elif verbose >= 3:
|
||||
hdiutil_args.append("-verbose")
|
||||
run = subprocess.check_call
|
||||
|
||||
for key, value in kwargs.iteritems():
|
||||
hdiutil_args.append("-" + key)
|
||||
if not value is True:
|
||||
hdiutil_args.append(str(value))
|
||||
|
||||
return run(hdiutil_args)
|
||||
|
||||
if verbose >= 2:
|
||||
if fancy is None:
|
||||
print "+ Creating .dmg disk image +"
|
||||
else:
|
||||
print "+ Preparing .dmg disk image +"
|
||||
|
||||
if config.dmg != "":
|
||||
dmg_name = config.dmg
|
||||
else:
|
||||
spl = app_bundle_name.split(" ")
|
||||
dmg_name = spl[0] + "".join(p.capitalize() for p in spl[1:])
|
||||
|
||||
if fancy is None:
|
||||
try:
|
||||
runHDIUtil("create", dmg_name, srcfolder="dist", format="UDBZ", volname="Bitcoin-Core", ov=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
else:
|
||||
if verbose >= 3:
|
||||
print "Determining size of \"dist\"..."
|
||||
size = 0
|
||||
for path, dirs, files in os.walk("dist"):
|
||||
for file in files:
|
||||
size += os.path.getsize(os.path.join(path, file))
|
||||
size += int(size * 0.15)
|
||||
|
||||
if verbose >= 3:
|
||||
print "Creating temp image for modification..."
|
||||
try:
|
||||
runHDIUtil("create", dmg_name + ".temp", srcfolder="dist", format="UDRW", size=size, volname="Bitcoin-Core", ov=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
|
||||
if verbose >= 3:
|
||||
print "Attaching temp image..."
|
||||
try:
|
||||
output = runHDIUtil("attach", dmg_name + ".temp", readwrite=True, noverify=True, noautoopen=True, capture_stdout=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
|
||||
m = re.search("/Volumes/(.+$)", output)
|
||||
disk_root = m.group(0)
|
||||
disk_name = m.group(1)
|
||||
|
||||
if verbose >= 2:
|
||||
print "+ Applying fancy settings +"
|
||||
|
||||
if fancy.has_key("background_picture"):
|
||||
bg_path = os.path.join(disk_root, ".background", os.path.basename(fancy["background_picture"]))
|
||||
os.mkdir(os.path.dirname(bg_path))
|
||||
if verbose >= 3:
|
||||
print fancy["background_picture"], "->", bg_path
|
||||
shutil.copy2(fancy["background_picture"], bg_path)
|
||||
else:
|
||||
bg_path = None
|
||||
|
||||
if fancy.get("applications_symlink", False):
|
||||
os.symlink("/Applications", os.path.join(disk_root, "Applications"))
|
||||
|
||||
# The Python appscript package broke with OSX 10.8 and isn't being fixed.
|
||||
# So we now build up an AppleScript string and use the osascript command
|
||||
# to make the .dmg file pretty:
|
||||
appscript = Template( """
|
||||
on run argv
|
||||
tell application "Finder"
|
||||
tell disk "$disk"
|
||||
open
|
||||
set current view of container window to icon view
|
||||
set toolbar visible of container window to false
|
||||
set statusbar visible of container window to false
|
||||
set the bounds of container window to {$window_bounds}
|
||||
set theViewOptions to the icon view options of container window
|
||||
set arrangement of theViewOptions to not arranged
|
||||
set icon size of theViewOptions to $icon_size
|
||||
$background_commands
|
||||
$items_positions
|
||||
close -- close/reopen works around a bug...
|
||||
open
|
||||
update without registering applications
|
||||
delay 5
|
||||
eject
|
||||
end tell
|
||||
end tell
|
||||
end run
|
||||
""")
|
||||
|
||||
itemscript = Template('set position of item "${item}" of container window to {${position}}')
|
||||
items_positions = []
|
||||
if fancy.has_key("items_position"):
|
||||
for name, position in fancy["items_position"].iteritems():
|
||||
params = { "item" : name, "position" : ",".join([str(p) for p in position]) }
|
||||
items_positions.append(itemscript.substitute(params))
|
||||
|
||||
params = {
|
||||
"disk" : "Bitcoin-Core",
|
||||
"window_bounds" : "300,300,800,620",
|
||||
"icon_size" : "96",
|
||||
"background_commands" : "",
|
||||
"items_positions" : "\n ".join(items_positions)
|
||||
}
|
||||
if fancy.has_key("window_bounds"):
|
||||
params["window.bounds"] = ",".join([str(p) for p in fancy["window_bounds"]])
|
||||
if fancy.has_key("icon_size"):
|
||||
params["icon_size"] = str(fancy["icon_size"])
|
||||
if bg_path is not None:
|
||||
# Set background file, then call SetFile to make it invisible.
|
||||
# (note: making it invisible first makes set background picture fail)
|
||||
bgscript = Template("""set background picture of theViewOptions to file ".background:$bgpic"
|
||||
do shell script "SetFile -a V /Volumes/$disk/.background/$bgpic" """)
|
||||
params["background_commands"] = bgscript.substitute({"bgpic" : os.path.basename(bg_path), "disk" : params["disk"]})
|
||||
|
||||
s = appscript.substitute(params)
|
||||
if verbose >= 2:
|
||||
print("Running AppleScript:")
|
||||
print(s)
|
||||
|
||||
p = subprocess.Popen(['osascript', '-'], stdin=subprocess.PIPE)
|
||||
p.communicate(input=s)
|
||||
if p.returncode:
|
||||
print("Error running osascript.")
|
||||
|
||||
if verbose >= 2:
|
||||
print "+ Finalizing .dmg disk image +"
|
||||
time.sleep(5)
|
||||
|
||||
try:
|
||||
runHDIUtil("convert", dmg_name + ".temp", format="UDBZ", o=dmg_name + ".dmg", ov=True)
|
||||
except subprocess.CalledProcessError as e:
|
||||
sys.exit(e.returncode)
|
||||
|
||||
os.unlink(dmg_name + ".temp.dmg")
|
||||
|
||||
# ------------------------------------------------
|
||||
|
||||
if verbose >= 2:
|
||||
print "+ Done +"
|
||||
|
||||
sys.exit(0)
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# Helpful little script that spits out a comma-separated list of
|
||||
# language codes for Qt icons that should be included
|
||||
# in binary bitcoin distributions
|
||||
|
||||
import glob
|
||||
import os
|
||||
import re
|
||||
import sys
|
||||
|
||||
if len(sys.argv) != 3:
|
||||
sys.exit("Usage: %s $QTDIR/translations $BITCOINDIR/src/qt/locale"%sys.argv[0])
|
||||
|
||||
d1 = sys.argv[1]
|
||||
d2 = sys.argv[2]
|
||||
|
||||
l1 = set([ re.search(r'qt_(.*).qm', f).group(1) for f in glob.glob(os.path.join(d1, 'qt_*.qm')) ])
|
||||
l2 = set([ re.search(r'bitcoin_(.*).qm', f).group(1) for f in glob.glob(os.path.join(d2, 'bitcoin_*.qm')) ])
|
||||
|
||||
print ",".join(sorted(l1.intersection(l2)))
|
||||
|
|
@ -3,7 +3,6 @@
|
|||
SOURCES_PATH ?= $(BASEDIR)/sources
|
||||
BASE_CACHE ?= $(BASEDIR)/built
|
||||
SDK_PATH ?= $(BASEDIR)/SDKs
|
||||
NO_QT ?=
|
||||
NO_WALLET ?=
|
||||
NO_UPNP ?=
|
||||
FALLBACK_DOWNLOAD_PATH ?= https://z.cash/depends-sources
|
||||
|
@ -73,13 +72,11 @@ include builders/$(build_os).mk
|
|||
include builders/default.mk
|
||||
include packages/packages.mk
|
||||
|
||||
qt_packages_$(NO_QT) = $(qt_packages) $(qt_$(host_os)_packages)
|
||||
qt_native_packages_$(NO_QT) = $(qt_native_packages)
|
||||
wallet_packages_$(NO_WALLET) = $(wallet_packages)
|
||||
upnp_packages_$(NO_UPNP) = $(upnp_packages)
|
||||
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(qt_packages_) $(wallet_packages_) $(upnp_packages_)
|
||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) $(qt_native_packages_)
|
||||
packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(wallet_packages_) $(upnp_packages_)
|
||||
native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
|
||||
all_packages = $(packages) $(native_packages)
|
||||
|
||||
meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk
|
||||
|
@ -114,7 +111,6 @@ $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_
|
|||
-e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \
|
||||
-e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
|
||||
-e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
|
||||
-e 's|@no_qt@|$(NO_QT)|' \
|
||||
-e 's|@no_wallet@|$(NO_WALLET)|' \
|
||||
-e 's|@no_upnp@|$(NO_UPNP)|' \
|
||||
-e 's|@debug@|$(DEBUG)|' \
|
||||
|
|
|
@ -34,7 +34,6 @@ The following can be set when running make: make FOO=bar
|
|||
BASE_CACHE: built packages will be placed here
|
||||
SDK_PATH: Path where sdk's can be found (used by OSX)
|
||||
FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up
|
||||
NO_QT: Don't download/build/cache qt and its dependencies
|
||||
NO_WALLET: Don't download/build/cache libs needed to enable the wallet
|
||||
NO_UPNP: Don't download/build/cache packages needed for enabling upnp
|
||||
DEBUG: disable some optimizations and enable more runtime checking
|
||||
|
|
|
@ -7,18 +7,6 @@ ac_tool_prefix=${host_alias}-
|
|||
if test -z $with_boost; then
|
||||
with_boost=$depends_prefix
|
||||
fi
|
||||
if test -z $with_qt_plugindir; then
|
||||
with_qt_plugindir=$depends_prefix/plugins
|
||||
fi
|
||||
if test -z $with_qt_translationdir; then
|
||||
with_qt_translationdir=$depends_prefix/translations
|
||||
fi
|
||||
if test -z $with_qt_bindir; then
|
||||
with_qt_bindir=$depends_prefix/native/bin
|
||||
fi
|
||||
if test -z $with_protoc_bindir; then
|
||||
with_protoc_bindir=$depends_prefix/native/bin
|
||||
fi
|
||||
# Disable comparison utility (#592)
|
||||
#if test -z $with_comparison_tool; then
|
||||
# with_comparison_tool=$depends_prefix/native/share/BitcoindComparisonTool_jar/BitcoindComparisonTool.jar
|
||||
|
@ -33,24 +21,11 @@ if test -z $with_miniupnpc && test -n "@no_upnp@"; then
|
|||
with_miniupnpc=no
|
||||
fi
|
||||
|
||||
if test -z $with_gui && test -n "@no_qt@"; then
|
||||
with_gui=no
|
||||
fi
|
||||
|
||||
if test x@host_os@ = xdarwin; then
|
||||
BREW=no
|
||||
PORT=no
|
||||
fi
|
||||
|
||||
if test x@host_os@ = xmingw32; then
|
||||
if test -z $with_qt_incdir; then
|
||||
with_qt_incdir=$depends_prefix/include
|
||||
fi
|
||||
if test -z $with_qt_libdir; then
|
||||
with_qt_libdir=$depends_prefix/lib
|
||||
fi
|
||||
fi
|
||||
|
||||
PATH=$depends_prefix/native/bin:$PATH
|
||||
PKG_CONFIG="`which pkg-config` --static"
|
||||
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
package=dbus
|
||||
$(package)_version=1.8.6
|
||||
$(package)_download_path=http://dbus.freedesktop.org/releases/dbus
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=eded83ca007b719f32761e60fd8b9ffd0f5796a4caf455b01b5a5ef740ebd23f
|
||||
$(package)_dependencies=expat
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-tests --disable-doxygen-docs --disable-xml-docs --disable-static --without-x
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C dbus libdbus-1.la
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) -C dbus DESTDIR=$($(package)_staging_dir) install-libLTLIBRARIES install-dbusincludeHEADERS install-nodist_dbusarchincludeHEADERS && \
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA
|
||||
endef
|
|
@ -1,21 +0,0 @@
|
|||
package=expat
|
||||
$(package)_version=2.1.0
|
||||
$(package)_download_path=http://sourceforge.net/projects/expat/files/expat/$($(package)_version)
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=823705472f816df21c8f6aa026dd162b280806838bb55b3432b0fb1fcca7eb86
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-static
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,22 +0,0 @@
|
|||
package=fontconfig
|
||||
$(package)_version=2.11.1
|
||||
$(package)_download_path=http://www.freedesktop.org/software/fontconfig/release/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=dc62447533bca844463a3c3fd4083b57c90f18a70506e7a9f4936b5a1e516a99
|
||||
$(package)_dependencies=freetype expat
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-docs --disable-static
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,22 +0,0 @@
|
|||
package=freetype
|
||||
$(package)_version=2.5.3
|
||||
$(package)_download_path=http://downloads.sourceforge.net/$(package)
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=c0848b29d52ef3ca27ad92e08351f023c5e24ce8cea7d8fe69fc96358e65f75e
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--without-zlib --without-png --disable-static
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,23 +0,0 @@
|
|||
package=libICE
|
||||
$(package)_version=1.0.9
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=8f7032f2c1c64352b5423f6b48a8ebdc339cc63064af34d66a6c9aa79759e202
|
||||
$(package)_dependencies=xtrans xproto
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-static --disable-docs --disable-specs --without-xsltproc
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,23 +0,0 @@
|
|||
package=libSM
|
||||
$(package)_version=1.2.2
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=0baca8c9f5d934450a70896c4ad38d06475521255ca63b717a6510fdb6e287bd
|
||||
$(package)_dependencies=xtrans xproto libICE
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--without-libuuid --without-xsltproc --disable-docs --disable-static
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,23 +0,0 @@
|
|||
package=libX11
|
||||
$(package)_version=1.6.2
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=2aa027e837231d2eeea90f3a4afe19948a6eb4c8b2bec0241eba7dbc8106bd16
|
||||
$(package)_dependencies=libxcb xtrans xextproto xproto
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-xkb --disable-static
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,23 +0,0 @@
|
|||
package=libXau
|
||||
$(package)_version=1.0.8
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=fdd477320aeb5cdd67272838722d6b7d544887dfe7de46e1e7cc0c27c2bea4f2
|
||||
$(package)_dependencies=xproto
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,22 +0,0 @@
|
|||
package=libXext
|
||||
$(package)_version=1.3.2
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=f829075bc646cdc085fa25d98d5885d83b1759ceb355933127c257e8e50432e0
|
||||
$(package)_dependencies=xproto xextproto libX11 libXau
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-static
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,35 +0,0 @@
|
|||
package=libxcb
|
||||
$(package)_version=1.10
|
||||
$(package)_download_path=http://xcb.freedesktop.org/dist
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=98d9ab05b636dd088603b64229dd1ab2d2cc02ab807892e107d674f9c3f2d5b5
|
||||
$(package)_dependencies=xcb_proto libXau xproto
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-static
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
sed "s/pthread-stubs//" -i configure
|
||||
endef
|
||||
|
||||
# Don't install xcb headers to the default path in order to work around a qt
|
||||
# build issue: https://bugreports.qt.io/browse/QTBUG-34748
|
||||
# When using qt's internal libxcb, it may end up finding the real headers in
|
||||
# depends staging. Use a non-default path to avoid that.
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf) --includedir=$(host_prefix)/include/xcb-shared
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
rm -rf share/man share/doc
|
||||
endef
|
|
@ -1,26 +0,0 @@
|
|||
package=native_cdrkit
|
||||
$(package)_version=1.1.11
|
||||
$(package)_download_path=http://distro.ibiblio.org/fatdog/source/600/c
|
||||
$(package)_file_name=cdrkit-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=b50d64c214a65b1a79afe3a964c691931a4233e2ba605d793eb85d0ac3652564
|
||||
$(package)_patches=cdrkit-deterministic.patch
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
patch -p1 < $($(package)_patch_dir)/cdrkit-deterministic.patch
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
cmake -DCMAKE_INSTALL_PREFIX=$(build_prefix)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) genisoimage
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) -C genisoimage install
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
rm bin/isovfy bin/isoinfo bin/isodump bin/isodebug bin/devdump
|
||||
endef
|
|
@ -1,22 +0,0 @@
|
|||
package=native_libdmg-hfsplus
|
||||
$(package)_version=0.1
|
||||
$(package)_download_path=https://github.com/theuni/libdmg-hfsplus/archive
|
||||
$(package)_file_name=libdmg-hfsplus-v$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=6569a02eb31c2827080d7d59001869ea14484c281efab0ae7f2b86af5c3120b3
|
||||
$(package)_build_subdir=build
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
mkdir build
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
cmake -DCMAKE_INSTALL_PREFIX:PATH=$(build_prefix)/bin ..
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C dmg
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) -C dmg install
|
||||
endef
|
|
@ -1,25 +0,0 @@
|
|||
package=native_protobuf
|
||||
$(package)_version=2.5.0
|
||||
$(package)_download_path=https://protobuf.googlecode.com/files
|
||||
$(package)_file_name=protobuf-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=13bfc5ae543cf3aa180ac2485c0bc89495e3ae711fc6fab4f8ffe90dfb4bb677
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C src protoc
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) -C src DESTDIR=$($(package)_staging_dir) install-strip
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
rm -rf lib include
|
||||
endef
|
|
@ -1,28 +0,0 @@
|
|||
package=protobuf
|
||||
$(package)_version=$(native_$(package)_version)
|
||||
$(package)_download_path=$(native_$(package)_download_path)
|
||||
$(package)_file_name=$(native_$(package)_file_name)
|
||||
$(package)_sha256_hash=$(native_$(package)_sha256_hash)
|
||||
$(package)_dependencies=native_$(package)
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared --with-protoc=$(build_prefix)/bin/protoc
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE) -C src libprotobuf.la
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) -C src install-libLTLIBRARIES install-nobase_includeHEADERS &&\
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install-pkgconfigDATA
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
rm lib/libprotoc.a
|
||||
endef
|
|
@ -1,22 +0,0 @@
|
|||
package=qrencode
|
||||
$(package)_version=3.4.3
|
||||
$(package)_download_path=https://fukuchi.org/works/qrencode/
|
||||
$(package)_file_name=qrencode-$(qrencode_version).tar.bz2
|
||||
$(package)_sha256_hash=dfd71487513c871bad485806bfd1fdb304dedc84d2b01a8fb8e0940b50597a98
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared -without-tools --disable-sdltest
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,66 +0,0 @@
|
|||
PACKAGE=qt46
|
||||
$(package)_version=4.6.4
|
||||
$(package)_download_path=http://download.qt-project.org/archive/qt/4.6/
|
||||
$(package)_file_name=qt-everywhere-opensource-src-$($(package)_version).tar.gz
|
||||
$(package)_sha256_hash=9ad4d46c721b53a429ed5a2eecfd3c239a9ab566562f183f99d3125f1a234250
|
||||
$(package)_dependencies=openssl freetype dbus libX11 xproto libXext libICE libSM
|
||||
$(package)_patches=stlfix.patch
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts = -prefix $(host_prefix) -headerdir $(host_prefix)/include/qt4 -bindir $(build_prefix)/bin
|
||||
$(package)_config_opts += -release -no-separate-debug-info -opensource -confirm-license
|
||||
$(package)_config_opts += -stl -qt-zlib
|
||||
|
||||
$(package)_config_opts += -nomake examples -nomake tests -nomake tools -nomake translations -nomake demos -nomake docs
|
||||
$(package)_config_opts += -no-audio-backend -no-glib -no-nis -no-cups -no-iconv -no-gif -no-pch
|
||||
$(package)_config_opts += -no-xkb -no-xrender -no-xrandr -no-xfixes -no-xcursor -no-xinerama -no-xsync -no-xinput -no-mitshm -no-xshape
|
||||
$(package)_config_opts += -no-libtiff -no-fontconfig -openssl-linked
|
||||
$(package)_config_opts += -no-sql-db2 -no-sql-ibase -no-sql-oci -no-sql-tds -no-sql-mysql
|
||||
$(package)_config_opts += -no-sql-odbc -no-sql-psql -no-sql-sqlite -no-sql-sqlite2
|
||||
$(package)_config_opts += -no-xmlpatterns -no-multimedia -no-phonon -no-scripttools -no-declarative
|
||||
$(package)_config_opts += -no-phonon-backend -no-webkit -no-javascript-jit -no-script
|
||||
$(package)_config_opts += -no-svg -no-libjpeg -no-libtiff -no-libpng -no-libmng -no-qt3support -no-opengl
|
||||
|
||||
$(package)_config_opts_x86_64_linux += -platform linux-g++-64
|
||||
$(package)_config_opts_i686_linux = -platform linux-g++-32
|
||||
$(package)_build_env = QT_RCC_TEST=1
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
sed -i.old "s|/include /usr/include||" config.tests/unix/freetype/freetype.pri && \
|
||||
sed -i.old "s|src_plugins.depends = src_gui src_sql src_svg|src_plugins.depends = src_gui src_sql|" src/src.pro && \
|
||||
sed -i.old "s|\.lower(|\.toLower(|g" src/network/ssl/qsslsocket_openssl.cpp && \
|
||||
sed -i.old "s|Key_BackSpace|Key_Backspace|" src/gui/itemviews/qabstractitemview.cpp && \
|
||||
sed -i.old "s|/usr/X11R6/lib64|$(host_prefix)/lib|" mkspecs/*/*.conf && \
|
||||
sed -i.old "s|/usr/X11R6/lib|$(host_prefix)/lib|" mkspecs/*/*.conf && \
|
||||
sed -i.old "s|/usr/X11R6/include|$(host_prefix)/include|" mkspecs/*/*.conf && \
|
||||
sed -i.old "s|QMAKE_LFLAGS_SHLIB\t+= -shared|QMAKE_LFLAGS_SHLIB\t+= -shared -Wl,--exclude-libs,ALL|" mkspecs/common/g++.conf && \
|
||||
sed -i.old "/SSLv2_client_method/d" src/network/ssl/qsslsocket_openssl.cpp src/network/ssl/qsslsocket_openssl_symbols.cpp && \
|
||||
sed -i.old "/SSLv2_server_method/d" src/network/ssl/qsslsocket_openssl.cpp src/network/ssl/qsslsocket_openssl_symbols.cpp && \
|
||||
patch -p1 < $($(package)_patch_dir)/stlfix.patch
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
export PKG_CONFIG_SYSROOT_DIR=/ && \
|
||||
export PKG_CONFIG_LIBDIR=$(host_prefix)/lib/pkgconfig && \
|
||||
export PKG_CONFIG_PATH=$(host_prefix)/share/pkgconfig && \
|
||||
export CPATH=$(host_prefix)/include && \
|
||||
OPENSSL_LIBS='-L$(host_prefix)/lib -lssl -lcrypto' ./configure $($(package)_config_opts) && \
|
||||
cd tools/linguist/lrelease; ../../../bin/qmake -o Makefile lrelease.pro
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
export CPATH=$(host_prefix)/include && \
|
||||
$(MAKE) -C src && \
|
||||
$(MAKE) -C tools/linguist/lrelease
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) -C src INSTALL_ROOT=$($(package)_staging_dir) install && \
|
||||
$(MAKE) -C tools/linguist/lrelease INSTALL_ROOT=$($(package)_staging_dir) install
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
rm -rf mkspecs/ lib/cmake/ lib/*.prl lib/*.la && \
|
||||
find native/bin -type f -exec mv {} {}-qt4 \;
|
||||
endef
|
|
@ -1,27 +0,0 @@
|
|||
package=xcb_proto
|
||||
$(package)_version=1.10
|
||||
$(package)_download_path=http://xcb.freedesktop.org/dist
|
||||
$(package)_file_name=xcb-proto-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=7ef40ddd855b750bc597d2a435da21e55e502a0fefa85b274f2c922800baaf05
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared
|
||||
$(package)_config_opts_linux=--with-pic
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
||||
|
||||
define $(package)_postprocess_cmds
|
||||
find -name "*.pyc" -delete && \
|
||||
find -name "*.pyo" -delete
|
||||
endef
|
|
@ -1,21 +0,0 @@
|
|||
package=xextproto
|
||||
$(package)_version=7.3.0
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/proto
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=f3f4b23ac8db9c3a9e0d8edb591713f3d70ef9c3b175970dd8823dfc92aa5bb0
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,21 +0,0 @@
|
|||
package=xproto
|
||||
$(package)_version=7.0.26
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/proto
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=636162c1759805a5a0114a369dffdeccb8af8c859ef6e1445f26a4e6e046514f
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts=--disable-shared
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,22 +0,0 @@
|
|||
package=xtrans
|
||||
$(package)_version=1.3.4
|
||||
$(package)_download_path=http://xorg.freedesktop.org/releases/individual/lib/
|
||||
$(package)_file_name=$(package)-$($(package)_version).tar.bz2
|
||||
$(package)_sha256_hash=054d4ee3efd52508c753e9f7bc655ef185a29bd2850dd9e2fc2ccc33544f583a
|
||||
$(package)_dependencies=
|
||||
|
||||
define $(package)_set_vars
|
||||
$(package)_config_opts_linux=--with-pic --disable-static
|
||||
endef
|
||||
|
||||
define $(package)_config_cmds
|
||||
$($(package)_autoconf)
|
||||
endef
|
||||
|
||||
define $(package)_build_cmds
|
||||
$(MAKE)
|
||||
endef
|
||||
|
||||
define $(package)_stage_cmds
|
||||
$(MAKE) DESTDIR=$($(package)_staging_dir) install
|
||||
endef
|
|
@ -1,86 +0,0 @@
|
|||
--- cdrkit-1.1.11.old/genisoimage/tree.c 2008-10-21 19:57:47.000000000 -0400
|
||||
+++ cdrkit-1.1.11/genisoimage/tree.c 2013-12-06 00:23:18.489622668 -0500
|
||||
@@ -1139,8 +1139,9 @@
|
||||
scan_directory_tree(struct directory *this_dir, char *path,
|
||||
struct directory_entry *de)
|
||||
{
|
||||
- DIR *current_dir;
|
||||
+ int current_file;
|
||||
char whole_path[PATH_MAX];
|
||||
+ struct dirent **d_list;
|
||||
struct dirent *d_entry;
|
||||
struct directory *parent;
|
||||
int dflag;
|
||||
@@ -1164,7 +1165,8 @@
|
||||
this_dir->dir_flags |= DIR_WAS_SCANNED;
|
||||
|
||||
errno = 0; /* Paranoia */
|
||||
- current_dir = opendir(path);
|
||||
+ //current_dir = opendir(path);
|
||||
+ current_file = scandir(path, &d_list, NULL, alphasort);
|
||||
d_entry = NULL;
|
||||
|
||||
/*
|
||||
@@ -1173,12 +1175,12 @@
|
||||
*/
|
||||
old_path = path;
|
||||
|
||||
- if (current_dir) {
|
||||
+ if (current_file >= 0) {
|
||||
errno = 0;
|
||||
- d_entry = readdir(current_dir);
|
||||
+ d_entry = d_list[0];
|
||||
}
|
||||
|
||||
- if (!current_dir || !d_entry) {
|
||||
+ if (current_file < 0 || !d_entry) {
|
||||
int ret = 1;
|
||||
|
||||
#ifdef USE_LIBSCHILY
|
||||
@@ -1191,8 +1193,8 @@
|
||||
de->isorec.flags[0] &= ~ISO_DIRECTORY;
|
||||
ret = 0;
|
||||
}
|
||||
- if (current_dir)
|
||||
- closedir(current_dir);
|
||||
+ if(d_list)
|
||||
+ free(d_list);
|
||||
return (ret);
|
||||
}
|
||||
#ifdef ABORT_DEEP_ISO_ONLY
|
||||
@@ -1208,7 +1210,7 @@
|
||||
errmsgno(EX_BAD, "use Rock Ridge extensions via -R or -r,\n");
|
||||
errmsgno(EX_BAD, "or allow deep ISO9660 directory nesting via -D.\n");
|
||||
}
|
||||
- closedir(current_dir);
|
||||
+ free(d_list);
|
||||
return (1);
|
||||
}
|
||||
#endif
|
||||
@@ -1250,13 +1252,13 @@
|
||||
* The first time through, skip this, since we already asked
|
||||
* for the first entry when we opened the directory.
|
||||
*/
|
||||
- if (dflag)
|
||||
- d_entry = readdir(current_dir);
|
||||
+ if (dflag && current_file >= 0)
|
||||
+ d_entry = d_list[current_file];
|
||||
dflag++;
|
||||
|
||||
- if (!d_entry)
|
||||
+ if (current_file < 0)
|
||||
break;
|
||||
-
|
||||
+ current_file--;
|
||||
/* OK, got a valid entry */
|
||||
|
||||
/* If we do not want all files, then pitch the backups. */
|
||||
@@ -1348,7 +1350,7 @@
|
||||
insert_file_entry(this_dir, whole_path, d_entry->d_name);
|
||||
#endif /* APPLE_HYB */
|
||||
}
|
||||
- closedir(current_dir);
|
||||
+ free(d_list);
|
||||
|
||||
#ifdef APPLE_HYB
|
||||
/*
|
|
@ -1,45 +0,0 @@
|
|||
--- old/qtbase/src/plugins/platforms/xcb/xcb_qpa_lib.pro 2015-03-17 02:06:42.705930685 +0000
|
||||
+++ new/qtbase/src/plugins/platforms/xcb/xcb_qpa_lib.pro 2015-03-17 02:08:41.281926351 +0000
|
||||
@@ -94,8 +94,6 @@
|
||||
|
||||
DEFINES += $$QMAKE_DEFINES_XCB
|
||||
LIBS += $$QMAKE_LIBS_XCB
|
||||
-QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
|
||||
-QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
|
||||
|
||||
CONFIG += qpa/genericunixfontdatabase
|
||||
|
||||
@@ -104,7 +102,8 @@
|
||||
contains(QT_CONFIG, xcb-qt) {
|
||||
DEFINES += XCB_USE_RENDER
|
||||
XCB_DIR = ../../../3rdparty/xcb
|
||||
- INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude
|
||||
+ QMAKE_CFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB
|
||||
+ QMAKE_CXXFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB
|
||||
LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static
|
||||
} else {
|
||||
LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms
|
||||
--- old/qtbase/src/plugins/platforms/xcb/xcb-static/xcb-static.pro 2015-03-17 02:07:04.641929383 +0000
|
||||
+++ new/qtbase/src/plugins/platforms/xcb/xcb-static/xcb-static.pro 2015-03-17 02:10:15.485922059 +0000
|
||||
@@ -8,7 +8,8 @@
|
||||
|
||||
XCB_DIR = ../../../../3rdparty/xcb
|
||||
|
||||
-INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$XCB_DIR/sysinclude
|
||||
+QMAKE_CFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/include/xcb -I$$XCB_DIR/sysinclude
|
||||
+QMAKE_CXXFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/include/xcb -I$$XCB_DIR/sysinclude
|
||||
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_XCB
|
||||
QMAKE_CFLAGS += $$QMAKE_CFLAGS_XCB
|
||||
--- old/qtbase/src/plugins/platforms/xcb/xcb-plugin.pro 2015-07-24 16:02:59.530038830 -0400
|
||||
+++ new/qtbase/src/plugins/platforms/xcb/xcb-plugin.pro 2015-07-24 16:01:22.106037459 -0400
|
||||
@@ -11,3 +11,9 @@
|
||||
qxcbmain.cpp
|
||||
OTHER_FILES += xcb.json README
|
||||
|
||||
+contains(QT_CONFIG, xcb-qt) {
|
||||
+ DEFINES += XCB_USE_RENDER
|
||||
+ XCB_DIR = ../../../3rdparty/xcb
|
||||
+ QMAKE_CFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB
|
||||
+ QMAKE_CXXFLAGS += -I$$XCB_DIR/include -I$$XCB_DIR/sysinclude $$QMAKE_CFLAGS_XCB
|
||||
+}
|
|
@ -1,26 +0,0 @@
|
|||
MAKEFILE_GENERATOR = UNIX
|
||||
CONFIG += app_bundle incremental global_init_link_order lib_version_first plugin_no_soname absolute_library_soname
|
||||
DEFINES += QT_NO_PRINTER QT_NO_PRINTDIALOG
|
||||
QMAKE_INCREMENTAL_STYLE = sublib
|
||||
include(../common/macx.conf)
|
||||
include(../common/gcc-base-mac.conf)
|
||||
include(../common/clang.conf)
|
||||
include(../common/clang-mac.conf)
|
||||
QMAKE_MAC_SDK_PATH=$${MAC_SDK_PATH}
|
||||
QMAKE_XCODE_VERSION=4.3
|
||||
QMAKE_XCODE_DEVELOPER_PATH=/Developer
|
||||
QMAKE_MACOSX_DEPLOYMENT_TARGET = $${MAC_MIN_VERSION}
|
||||
QMAKE_MAC_SDK=macosx
|
||||
QMAKE_MAC_SDK.macosx.path = $${MAC_SDK_PATH}
|
||||
QMAKE_MAC_SDK.macosx.platform_name = macosx
|
||||
QMAKE_MAC_SDK.macosx.version = $${MAC_SDK_VERSION}
|
||||
QMAKE_MAC_SDK.macosx.platform_path = /phony
|
||||
QMAKE_CFLAGS += -target $${MAC_TARGET}
|
||||
QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS
|
||||
QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
|
||||
QMAKE_LFLAGS += -target $${MAC_TARGET} -mlinker-version=$${MAC_LD64_VERSION}
|
||||
QMAKE_AR = $${CROSS_COMPILE}ar cq
|
||||
QMAKE_RANLIB=$${CROSS_COMPILE}ranlib
|
||||
QMAKE_LIBTOOL=$${CROSS_COMPILE}libtool
|
||||
QMAKE_INSTALL_NAME_TOOL=$${CROSS_COMPILE}install_name_tool
|
||||
load(qt_config)
|
|
@ -1,44 +0,0 @@
|
|||
--- old/qtbase/src/plugins/platforms/windows/qwindowscontext.cpp 2015-06-20 17:40:20.956781548 -0400
|
||||
+++ new/qtbase/src/plugins/platforms/windows/qwindowscontext.cpp 2015-06-20 17:29:32.052772416 -0400
|
||||
@@ -69,7 +69,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <windowsx.h>
|
||||
-#ifndef Q_OS_WINCE
|
||||
+#if !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1))
|
||||
# include <comdef.h>
|
||||
#endif
|
||||
|
||||
@@ -762,7 +762,7 @@
|
||||
HWND_MESSAGE, NULL, (HINSTANCE)GetModuleHandle(0), NULL);
|
||||
}
|
||||
|
||||
-#ifndef Q_OS_WINCE
|
||||
+#if !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1))
|
||||
// Re-engineered from the inline function _com_error::ErrorMessage().
|
||||
// We cannot use it directly since it uses swprintf_s(), which is not
|
||||
// present in the MSVCRT.DLL found on Windows XP (QTBUG-35617).
|
||||
@@ -781,7 +781,7 @@
|
||||
return QStringLiteral("IDispatch error #") + QString::number(wCode);
|
||||
return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16);
|
||||
}
|
||||
-#endif // !Q_OS_WINCE
|
||||
+#endif // !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1))
|
||||
|
||||
/*!
|
||||
\brief Common COM error strings.
|
||||
@@ -846,12 +846,12 @@
|
||||
default:
|
||||
break;
|
||||
}
|
||||
-#ifndef Q_OS_WINCE
|
||||
+#if !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1))
|
||||
_com_error error(hr);
|
||||
result += QByteArrayLiteral(" (");
|
||||
result += errorMessageFromComError(error);
|
||||
result += ')';
|
||||
-#endif // !Q_OS_WINCE
|
||||
+#endif // !defined(Q_OS_WINCE) && (!defined(USE___UUIDOF) || (defined(USE___UUIDOF) && USE___UUIDOF == 1))
|
||||
return result;
|
||||
}
|
||||
|
|
@ -1,10 +0,0 @@
|
|||
--- old/config.tests/unix/stl/stltest.cpp 2011-06-23 03:45:23.000000000 -0400
|
||||
+++ new/config.tests/unix/stl/stltest.cpp 2014-08-28 00:54:04.154837604 -0400
|
||||
@@ -49,6 +49,7 @@
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <iostream>
|
||||
+#include <cstddef>
|
||||
|
||||
// something mean to see if the compiler and C++ standard lib are good enough
|
||||
template<class K, class T>
|
|
@ -1,46 +0,0 @@
|
|||
The following is a list of assets used in the bitcoin source and their proper attribution.
|
||||
|
||||
[Typicons/Stephen Hutchings](http://typicons.com)
|
||||
-----------------------
|
||||
|
||||
### Info
|
||||
* Icon Pack: Typicons (http://typicons.com)
|
||||
* Designer: Stephen Hutchings (and more)
|
||||
* License: MIT
|
||||
* Site: [https://github.com/stephenhutchings/typicons.font](https://github.com/stephenhutchings/typicons.font)
|
||||
|
||||
### Assets Used
|
||||
src/qt/res/icons/add.png, src/qt/res/icons/address-book.png,
|
||||
src/qt/res/icons/configure.png, src/qt/res/icons/connect4.png,
|
||||
src/qt/res/icons/debugwindow.png, src/qt/res/icons/edit.png,
|
||||
src/qt/res/icons/exitcopy.png, src/qt/res/icons/editpaste.png,
|
||||
src/qt/res/icons/export.png, src/qt/res/icons/eye.png,
|
||||
src/qt/res/icons/filesave.png, src/qt/res/icons/history.png,
|
||||
src/qt/res/icons/info.png, src/qt/res/icons/key.png,
|
||||
src/qt/res/icons/lock_*.png, src/qt/res/icons/open.png,
|
||||
src/qt/res/icons/overview.png, src/qt/res/icons/quit.png,
|
||||
src/qt/res/icons/receive.png, src/qt/res/icons/remove.png,
|
||||
src/qt/res/icons/send.png, src/qt/res/icons/synced.png,
|
||||
src/qt/res/icons/transaction*.png, src/qt/res/icons/tx_output.png,
|
||||
src/qt/res/icons/warning.png
|
||||
|
||||
Jonas Schnelli
|
||||
-----------------------
|
||||
|
||||
### Info
|
||||
* Designer: Jonas Schnelli
|
||||
* Bitcoin Icon: (based on the original bitcoin logo from Bitboy)
|
||||
* Some icons are based on Stephan Hutchings Typicons
|
||||
* License: MIT
|
||||
|
||||
### Assets Used
|
||||
src/qt/res/icons/about.png, src/qt/res/icons/about_qt.png,
|
||||
src/qt/res/icons/bitcoin.icns, src/qt/res/icons/bitcoin.ico,
|
||||
src/qt/res/icons/bitcoin.png, src/qt/res/icons/clock*.png,
|
||||
src/qt/res/icons/connect[0-3].png, src/qt/res/icons/eye_minus.png,
|
||||
src/qt/res/icons/eye_plus.png, src/qt/res/icons/verify.png,
|
||||
src/qt/res/icons/tx_inout.png, src/qt/res/icons/tx_input.png,
|
||||
src/qt/res/src/verify.svg, src/qt/res/src/bitcoin.svg,
|
||||
src/qt/res/src/clock*.svg, src/qt/res/src/connect*.svg,
|
||||
src/qt/res/src/mine.svg, src/qt/res/src/qt.svg, src/qt/res/src/tx*.svg,
|
||||
src/qt/res/src/verify.svg,
|
|
@ -105,9 +105,6 @@ error and debugging messages are written there.
|
|||
The -debug=... command-line option controls debugging; running with just -debug or -debug=1 will turn
|
||||
on all categories (and give you a very large debug.log file).
|
||||
|
||||
The Qt code routes qDebug() output to debug.log under category "qt": run with -debug=qt
|
||||
to see it.
|
||||
|
||||
**testnet and regtest modes**
|
||||
|
||||
Run with the -testnet option to run with "play zcash" on the test network, if you
|
||||
|
|
|
@ -1,50 +0,0 @@
|
|||
*** Warning: This document has not been updated for Zcash and may be inaccurate. ***
|
||||
|
||||
Multiwallet Qt Development and Integration Strategy
|
||||
===================================================
|
||||
|
||||
In order to support loading of multiple wallets in bitcoin-qt, a few changes in the UI architecture will be needed.
|
||||
Fortunately, only four of the files in the existing project are affected by this change.
|
||||
|
||||
Two new classes have been implemented in two new .h/.cpp file pairs, with much of the functionality that was previously
|
||||
implemented in the BitcoinGUI class moved over to these new classes.
|
||||
|
||||
The two existing files most affected, by far, are bitcoingui.h and bitcoingui.cpp, as the BitcoinGUI class will require
|
||||
some major retrofitting.
|
||||
|
||||
Only requiring some minor changes is bitcoin.cpp.
|
||||
|
||||
Finally, two new headers and source files will have to be added to bitcoin-qt.pro.
|
||||
|
||||
Changes to class BitcoinGUI
|
||||
---------------------------
|
||||
The principal change to the BitcoinGUI class concerns the QStackedWidget instance called centralWidget.
|
||||
This widget owns five page views: overviewPage, transactionsPage, addressBookPage, receiveCoinsPage, and sendCoinsPage.
|
||||
|
||||
A new class called *WalletView* inheriting from QStackedWidget has been written to handle all renderings and updates of
|
||||
these page views. In addition to owning these five page views, a WalletView also has a pointer to a WalletModel instance.
|
||||
This allows the construction of multiple WalletView objects, each rendering a distinct wallet.
|
||||
|
||||
A second class called *WalletFrame* inheriting from QFrame has been written as a container for embedding all wallet-related
|
||||
controls into BitcoinGUI. At present it contains the WalletView instances for the wallets and does little more than passing on messages
|
||||
from BitcoinGUI to the currently selected WalletView. It is a WalletFrame instance
|
||||
that takes the place of what used to be centralWidget in BitcoinGUI. The purpose of this class is to allow future
|
||||
refinements of the wallet controls with minimal need for further modifications to BitcoinGUI, thus greatly simplifying
|
||||
merges while reducing the risk of breaking top-level stuff.
|
||||
|
||||
Changes to bitcoin.cpp
|
||||
----------------------
|
||||
bitcoin.cpp is the entry point into bitcoin-qt, and as such, will require some minor modifications to provide hooks for
|
||||
multiple wallet support. Most importantly will be the way it instantiates WalletModels and passes them to the
|
||||
singleton BitcoinGUI instance called window. Formerly, BitcoinGUI kept a pointer to a single instance of a WalletModel.
|
||||
The initial change required is very simple: rather than calling `window.setWalletModel(&walletModel);` we perform the
|
||||
following two steps:
|
||||
|
||||
window.addWallet("~Default", &walletModel);
|
||||
window.setCurrentWallet("~Default");
|
||||
|
||||
The string parameter is just an arbitrary name given to the default wallet. It's been prepended with a tilde to avoid name collisions in the future with additional wallets.
|
||||
|
||||
The shutdown call `window.setWalletModel(0)` has also been removed. In its place is now:
|
||||
|
||||
window.removeAllWallets();
|
|
@ -1,114 +0,0 @@
|
|||
*** Warning: This document has not been updated for Zcash and may be inaccurate. ***
|
||||
|
||||
|
||||
Translations
|
||||
============
|
||||
|
||||
The Bitcoin-Core project has been designed to support multiple localisations. This makes adding new phrases, and completely new languages easily achievable. For managing all application translations, Bitcoin-Core makes use of the Transifex online translation management tool.
|
||||
|
||||
### Helping to translate (using Transifex)
|
||||
Transifex is setup to monitor the Github repo for updates, and when code containing new translations is found, Transifex will process any changes. It may take several hours after a pull-request has been merged, to appear in the Transifex web interface.
|
||||
|
||||
Multiple language support is critical in assisting Bitcoin’s global adoption, and growth. One of Bitcoin’s greatest strengths is cross-boarder money transfers, any help making that easier is greatly appreciated.
|
||||
|
||||
See the [Transifex Bitcoin project](https://www.transifex.com/projects/p/bitcoin/) to assist in translations. You should also join the translation mailing list for announcements - see details below.
|
||||
|
||||
### Writing code with translations
|
||||
We use automated scripts to help extract translations in both Qt, and non-Qt source files. It is rarely necessary to manually edit the files in `src/qt/locale/`. The translation source files must adhere to the following format:
|
||||
`bitcoin_xx_YY.ts or bitcoin_xx.ts`
|
||||
|
||||
`src/qt/locale/bitcoin_en.ts` is treated in a special way. It is used as the source for all other translations. Whenever a string in the source code is changed, this file must be updated to reflect those changes. A custom script is used to extract strings from the non-Qt parts. This script makes use of `gettext`, so make sure that utility is installed (ie, `apt-get install gettext` on Ubuntu/Debian). Once this has been updated, `lupdate` (included in the Qt SDK) is used to update `bitcoin_en.ts`.
|
||||
|
||||
To automatically regenerate the `bitcoin_en.ts` file, run the following commands:
|
||||
```sh
|
||||
cd src/
|
||||
make translate
|
||||
```
|
||||
|
||||
`contrib/bitcoin-qt.pro` takes care of generating `.qm` (binary compiled) files from `.ts` (source files) files. It’s mostly automated, and you shouldn’t need to worry about it.
|
||||
|
||||
**Example Qt translation**
|
||||
```cpp
|
||||
QToolBar *toolbar = addToolBar(tr("Tabs toolbar"));
|
||||
```
|
||||
|
||||
### Creating a pull-request
|
||||
For general PRs, you shouldn’t include any updates to the translation source files. They will be updated periodically, primarily around pre-releases, allowing time for any new phrases to be translated before public releases. This is also important in avoiding translation related merge conflicts.
|
||||
|
||||
When an updated source file is merged into the Github repo, Transifex will automatically detect it (although it can take several hours). Once processed, the new strings will show up as "Remaining" in the Transifex web interface and are ready for translators.
|
||||
|
||||
To create the pull-request, use the following commands:
|
||||
```
|
||||
git add src/qt/bitcoinstrings.cpp src/qt/locale/bitcoin_en.ts
|
||||
git commit
|
||||
```
|
||||
|
||||
### Creating a Transifex account
|
||||
Visit the [Transifex Signup](https://www.transifex.com/signup/) page to create an account. Take note of your username and password, as they will be required to configure the command-line tool.
|
||||
|
||||
You can find the Bitcoin translation project at [https://www.transifex.com/projects/p/bitcoin/](https://www.transifex.com/projects/p/bitcoin/).
|
||||
|
||||
### Installing the Transifex client command-line tool
|
||||
The client it used to fetch updated translations. If you are having problems, or need more details, see [http://docs.transifex.com/developer/client/setup](http://docs.transifex.com/developer/client/setup)
|
||||
|
||||
**For Linux and Mac**
|
||||
|
||||
`pip install transifex-client`
|
||||
|
||||
Setup your transifex client config as follows. Please *ignore the token field*.
|
||||
|
||||
```ini
|
||||
nano ~/.transifexrc
|
||||
|
||||
[https://www.transifex.com]
|
||||
hostname = https://www.transifex.com
|
||||
password = PASSWORD
|
||||
token =
|
||||
username = USERNAME
|
||||
```
|
||||
|
||||
**For Windows**
|
||||
|
||||
Please see [http://docs.transifex.com/developer/client/setup#windows](http://docs.transifex.com/developer/client/setup#windows) for details on installation.
|
||||
|
||||
The Transifex Bitcoin project config file is included as part of the repo. It can be found at `.tx/config`, however you shouldn’t need change anything.
|
||||
|
||||
### Synchronising translations
|
||||
To assist in updating translations, we have created a script to help.
|
||||
|
||||
1. `python contrib/devtools/update-translations.py`
|
||||
2. Update `src/qt/bitcoin.qrc` manually or via
|
||||
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/<file alias="\2">locale\/\1.qm<\/file>/'`
|
||||
3. Update `src/qt/Makefile.am` manually or via
|
||||
`ls src/qt/locale/*ts|xargs -n1 basename|sed 's/\(bitcoin_\(.*\)\).ts/ locale\/\1.ts \\/'`
|
||||
4. `git add` new translations from `src/qt/locale/`
|
||||
|
||||
**Do not directly download translations** one by one from the Transifex website, as we do a few post-processing steps before committing the translations.
|
||||
|
||||
### Handling Plurals (in source files)
|
||||
When new plurals are added to the source file, it's important to do the following steps:
|
||||
|
||||
1. Open `bitcoin_en.ts` in Qt Linguist (included in the Qt SDK)
|
||||
2. Search for `%n`, which will take you to the parts in the translation that use plurals
|
||||
3. Look for empty `English Translation (Singular)` and `English Translation (Plural)` fields
|
||||
4. Add the appropriate strings for the singular and plural form of the base string
|
||||
5. Mark the item as done (via the green arrow symbol in the toolbar)
|
||||
6. Repeat from step 2, until all singular and plural forms are in the source file
|
||||
7. Save the source file
|
||||
|
||||
### Translating a new language
|
||||
To create a new language template, you will need to edit the languages manifest file `src/qt/bitcoin.qrc` and add a new entry. Below is an example of the english language entry.
|
||||
|
||||
```xml
|
||||
<qresource prefix="/translations">
|
||||
<file alias="en">locale/bitcoin_en.qm</file>
|
||||
...
|
||||
</qresource>
|
||||
```
|
||||
|
||||
**Note:** that the language translation file **must end in `.qm`** (the compiled extension), and not `.ts`.
|
||||
|
||||
### Questions and general assistance
|
||||
The Bitcoin-Core translation maintainers include *tcatm, seone, Diapolo, wumpus and luke-jr*.You can find them, and others, in the Freenode IRC chatroom - `irc.freenode.net #bitcoin-dev`.
|
||||
|
||||
If you are a translator, you should also subscribe to the mailing list, https://groups.google.com/forum/#!forum/bitcoin-translators. Announcements will be posted during application pre-releases to notify translators to check for updates.
|
|
@ -10,8 +10,6 @@ How to translate?
|
|||
|
||||
To mark a message as translatable
|
||||
|
||||
- In GUI source code (under `src/qt`): use `tr("...")`
|
||||
|
||||
- In non-GUI source code (under `src`): use `_("...")`
|
||||
|
||||
No internationalization is used for e.g. developer scripts outside `src`.
|
||||
|
|
|
@ -1,106 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd">
|
||||
<plist version="0.9">
|
||||
<dict>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.7.0</string>
|
||||
|
||||
<key>LSArchitecturePriority</key>
|
||||
<array>
|
||||
<string>x86_64</string>
|
||||
</array>
|
||||
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>bitcoin.icns</string>
|
||||
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@, Copyright © 2009-@COPYRIGHT_YEAR@ The Bitcoin Core developers</string>
|
||||
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@</string>
|
||||
|
||||
<key>CFBundleVersion</key>
|
||||
<string>@CLIENT_VERSION_MAJOR@.@CLIENT_VERSION_MINOR@.@CLIENT_VERSION_REVISION@</string>
|
||||
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Bitcoin-Qt</string>
|
||||
|
||||
<key>CFBundleName</key>
|
||||
<string>Bitcoin-Qt</string>
|
||||
|
||||
<key>LSHasLocalizedDisplayName</key>
|
||||
<true/>
|
||||
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.bitcoinfoundation.Bitcoin-Qt</string>
|
||||
|
||||
<key>CFBundleURLTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>CFBundleURLName</key>
|
||||
<string>org.bitcoin.BitcoinPayment</string>
|
||||
<key>CFBundleURLSchemes</key>
|
||||
<array>
|
||||
<string>bitcoin</string>
|
||||
</array>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>UTExportedTypeDeclarations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>UTTypeIdentifier</key>
|
||||
<string>org.bitcoin.paymentrequest</string>
|
||||
<key>UTTypeDescription</key>
|
||||
<string>Bitcoin payment request</string>
|
||||
<key>UTTypeConformsTo</key>
|
||||
<array>
|
||||
<string>public.data</string>
|
||||
</array>
|
||||
<key>UTTypeTagSpecification</key>
|
||||
<dict>
|
||||
<key>public.mime-type</key>
|
||||
<string>application/x-bitcoin-payment-request</string>
|
||||
<key>public.filename-extension</key>
|
||||
<array>
|
||||
<string>bitcoinpaymentrequest</string>
|
||||
</array>
|
||||
</dict>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>CFBundleDocumentTypes</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>CFBundleTypeRole</key>
|
||||
<string>Editor</string>
|
||||
<key>LSItemContentTypes</key>
|
||||
<array>
|
||||
<string>org.bitcoin.paymentrequest</string>
|
||||
</array>
|
||||
<key>LSHandlerRank</key>
|
||||
<string>Owner</string>
|
||||
</dict>
|
||||
</array>
|
||||
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<string>True</string>
|
||||
|
||||
<key>LSAppNapIsDisabled</key>
|
||||
<string>True</string>
|
||||
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.finance</string>
|
||||
</dict>
|
||||
</plist>
|
|
@ -1,78 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
'''
|
||||
Extract _("...") strings for translation and convert to Qt4 stringdefs so that
|
||||
they can be picked up by Qt linguist.
|
||||
'''
|
||||
from subprocess import Popen, PIPE
|
||||
import glob
|
||||
import operator
|
||||
import os
|
||||
import sys
|
||||
|
||||
OUT_CPP="qt/bitcoinstrings.cpp"
|
||||
EMPTY=['""']
|
||||
|
||||
def parse_po(text):
|
||||
"""
|
||||
Parse 'po' format produced by xgettext.
|
||||
Return a list of (msgid,msgstr) tuples.
|
||||
"""
|
||||
messages = []
|
||||
msgid = []
|
||||
msgstr = []
|
||||
in_msgid = False
|
||||
in_msgstr = False
|
||||
|
||||
for line in text.split('\n'):
|
||||
line = line.rstrip('\r')
|
||||
if line.startswith('msgid '):
|
||||
if in_msgstr:
|
||||
messages.append((msgid, msgstr))
|
||||
in_msgstr = False
|
||||
# message start
|
||||
in_msgid = True
|
||||
|
||||
msgid = [line[6:]]
|
||||
elif line.startswith('msgstr '):
|
||||
in_msgid = False
|
||||
in_msgstr = True
|
||||
msgstr = [line[7:]]
|
||||
elif line.startswith('"'):
|
||||
if in_msgid:
|
||||
msgid.append(line)
|
||||
if in_msgstr:
|
||||
msgstr.append(line)
|
||||
|
||||
if in_msgstr:
|
||||
messages.append((msgid, msgstr))
|
||||
|
||||
return messages
|
||||
|
||||
files = sys.argv[1:]
|
||||
|
||||
# xgettext -n --keyword=_ $FILES
|
||||
XGETTEXT=os.getenv('XGETTEXT', 'xgettext')
|
||||
child = Popen([XGETTEXT,'--output=-','-n','--keyword=_'] + files, stdout=PIPE)
|
||||
(out, err) = child.communicate()
|
||||
|
||||
messages = parse_po(out)
|
||||
|
||||
f = open(OUT_CPP, 'w')
|
||||
f.write("""
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
// Automatically generated by extract_strings.py
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define UNUSED
|
||||
#endif
|
||||
""")
|
||||
f.write('static const char UNUSED *bitcoin_strings[] = {\n')
|
||||
messages.sort(key=operator.itemgetter(0))
|
||||
for (msgid, msgstr) in messages:
|
||||
if msgid != EMPTY:
|
||||
f.write('QT_TRANSLATE_NOOP("bitcoin-core", %s),\n' % ('\n'.join(msgid)))
|
||||
f.write('};\n')
|
||||
f.close()
|
Binary file not shown.
Before Width: | Height: | Size: 9.7 KiB |
Binary file not shown.
|
@ -1,38 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
# W.J. van der Laan, 2011
|
||||
# Make spinning animation from a .png
|
||||
# Requires imagemagick 6.7+
|
||||
from __future__ import division
|
||||
from os import path
|
||||
from PIL import Image
|
||||
from subprocess import Popen
|
||||
|
||||
SRC='img/reload.png'
|
||||
TMPDIR='../../src/qt/res/movies/'
|
||||
TMPNAME='spinner-%03i.png'
|
||||
NUMFRAMES=35
|
||||
FRAMERATE=10.0
|
||||
CONVERT='convert'
|
||||
CLOCKWISE=True
|
||||
DSIZE=(16,16)
|
||||
|
||||
im_src = Image.open(SRC)
|
||||
|
||||
if CLOCKWISE:
|
||||
im_src = im_src.transpose(Image.FLIP_LEFT_RIGHT)
|
||||
|
||||
def frame_to_filename(frame):
|
||||
return path.join(TMPDIR, TMPNAME % frame)
|
||||
|
||||
frame_files = []
|
||||
for frame in xrange(NUMFRAMES):
|
||||
rotation = (frame + 0.5) / NUMFRAMES * 360.0
|
||||
if CLOCKWISE:
|
||||
rotation = -rotation
|
||||
im_new = im_src.rotate(rotation, Image.BICUBIC)
|
||||
im_new.thumbnail(DSIZE, Image.ANTIALIAS)
|
||||
outfile = frame_to_filename(frame)
|
||||
im_new.save(outfile, 'png')
|
||||
frame_files.append(outfile)
|
||||
|
||||
|
|
@ -1,9 +0,0 @@
|
|||
#!/bin/bash
|
||||
# create multiresolution windows icon
|
||||
ICON_SRC=../../src/qt/res/icons/bitcoin.png
|
||||
ICON_DST=../../src/qt/res/icons/bitcoin.ico
|
||||
convert ${ICON_SRC} -resize 16x16 bitcoin-16.png
|
||||
convert ${ICON_SRC} -resize 32x32 bitcoin-32.png
|
||||
convert ${ICON_SRC} -resize 48x48 bitcoin-48.png
|
||||
convert bitcoin-16.png bitcoin-32.png bitcoin-48.png ${ICON_DST}
|
||||
|
|
@ -1,35 +0,0 @@
|
|||
# Based on: http://code.google.com/p/ostinato/source/browse/protobuf.pri
|
||||
#
|
||||
# Qt qmake integration with Google Protocol Buffers compiler protoc
|
||||
#
|
||||
# To compile protocol buffers with qt qmake, specify PROTOS variable and
|
||||
# include this file
|
||||
#
|
||||
# Example:
|
||||
# PROTOS = a.proto b.proto
|
||||
# include(protobuf.pri)
|
||||
#
|
||||
# Set PROTO_PATH if you need to set the protoc --proto_path search path
|
||||
# Set PROTOC to the path to the protoc compiler if it is not in your $PATH
|
||||
#
|
||||
|
||||
isEmpty(PROTO_DIR):PROTO_DIR = .
|
||||
isEmpty(PROTOC):PROTOC = protoc
|
||||
|
||||
PROTOPATHS =
|
||||
for(p, PROTO_PATH):PROTOPATHS += --proto_path=$${p}
|
||||
|
||||
protobuf_decl.name = protobuf header
|
||||
protobuf_decl.input = PROTOS
|
||||
protobuf_decl.output = $${PROTO_DIR}/${QMAKE_FILE_BASE}.pb.h
|
||||
protobuf_decl.commands = $${PROTOC} --cpp_out="$${PROTO_DIR}" $${PROTOPATHS} --proto_path=${QMAKE_FILE_IN_PATH} ${QMAKE_FILE_NAME}
|
||||
protobuf_decl.variable_out = GENERATED_FILES
|
||||
QMAKE_EXTRA_COMPILERS += protobuf_decl
|
||||
|
||||
protobuf_impl.name = protobuf implementation
|
||||
protobuf_impl.input = PROTOS
|
||||
protobuf_impl.output = $${PROTO_DIR}/${QMAKE_FILE_BASE}.pb.cc
|
||||
protobuf_impl.depends = $${PROTO_DIR}/${QMAKE_FILE_BASE}.pb.h
|
||||
protobuf_impl.commands = $$escape_expand(\\n)
|
||||
protobuf_impl.variable_out = GENERATED_SOURCES
|
||||
QMAKE_EXTRA_COMPILERS += protobuf_impl
|
|
@ -29,7 +29,6 @@ LIBBITCOIN_COMMON=libbitcoin_common.a
|
|||
LIBBITCOIN_CLI=libbitcoin_cli.a
|
||||
LIBBITCOIN_UTIL=libbitcoin_util.a
|
||||
LIBBITCOIN_CRYPTO=crypto/libbitcoin_crypto.a
|
||||
LIBBITCOINQT=qt/libbitcoinqt.a
|
||||
LIBSECP256K1=secp256k1/libsecp256k1.la
|
||||
LIBUNIVALUE=univalue/libunivalue.la
|
||||
LIBZCASH=libzcash.a
|
||||
|
@ -191,7 +190,7 @@ obj/build.h: FORCE
|
|||
$(abs_top_srcdir)
|
||||
libbitcoin_util_a-clientversion.$(OBJEXT): obj/build.h
|
||||
|
||||
# server: shared between bitcoind and bitcoin-qt
|
||||
# server: zcashd
|
||||
libbitcoin_server_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(MINIUPNPC_CPPFLAGS)
|
||||
libbitcoin_server_a_SOURCES = \
|
||||
sendalert.cpp \
|
||||
|
@ -239,8 +238,7 @@ libbitcoin_zmq_a_SOURCES = \
|
|||
endif
|
||||
|
||||
|
||||
# wallet: shared between bitcoind and bitcoin-qt, but only linked
|
||||
# when wallet enabled
|
||||
# wallet: zcashd, but only linked when wallet enabled
|
||||
libbitcoin_wallet_a_CPPFLAGS = $(BITCOIN_INCLUDES)
|
||||
libbitcoin_wallet_a_SOURCES = \
|
||||
utiltest.cpp \
|
||||
|
@ -290,7 +288,7 @@ crypto_libbitcoin_crypto_a_SOURCES += \
|
|||
${EQUIHASH_TROMP_SOURCES}
|
||||
endif
|
||||
|
||||
# common: shared between bitcoind, and bitcoin-qt and non-server tools
|
||||
# common: shared between zcashd and non-server tools
|
||||
libbitcoin_common_a_CPPFLAGS = $(BITCOIN_INCLUDES)
|
||||
libbitcoin_common_a_SOURCES = \
|
||||
amount.cpp \
|
||||
|
@ -347,7 +345,7 @@ if GLIBC_BACK_COMPAT
|
|||
libbitcoin_util_a_SOURCES += compat/glibc_compat.cpp
|
||||
endif
|
||||
|
||||
# cli: shared between bitcoin-cli and bitcoin-qt
|
||||
# cli: zcash-cli
|
||||
libbitcoin_cli_a_CPPFLAGS = $(BITCOIN_INCLUDES)
|
||||
libbitcoin_cli_a_SOURCES = \
|
||||
rpcclient.cpp \
|
||||
|
@ -513,7 +511,7 @@ clean-local:
|
|||
|
||||
.mm.o:
|
||||
$(AM_V_CXX) $(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
||||
$(CPPFLAGS) $(AM_CXXFLAGS) $(QT_INCLUDES) $(CXXFLAGS) -c -o $@ $<
|
||||
$(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o $@ $<
|
||||
|
||||
check-symbols: $(bin_PROGRAMS)
|
||||
if GLIBC_BACK_COMPAT
|
||||
|
@ -536,12 +534,4 @@ include Makefile.test.include
|
|||
include Makefile.gtest.include
|
||||
endif
|
||||
|
||||
if ENABLE_QT
|
||||
include Makefile.qt.include
|
||||
endif
|
||||
|
||||
if ENABLE_QT_TESTS
|
||||
include Makefile.qttest.include
|
||||
endif
|
||||
|
||||
include Makefile.zcash.include
|
||||
|
|
|
@ -1,421 +0,0 @@
|
|||
bin_PROGRAMS += qt/bitcoin-qt
|
||||
EXTRA_LIBRARIES += qt/libbitcoinqt.a
|
||||
|
||||
# bitcoin qt core #
|
||||
QT_TS = \
|
||||
qt/locale/bitcoin_ach.ts \
|
||||
qt/locale/bitcoin_af_ZA.ts \
|
||||
qt/locale/bitcoin_ar.ts \
|
||||
qt/locale/bitcoin_be_BY.ts \
|
||||
qt/locale/bitcoin_bg.ts \
|
||||
qt/locale/bitcoin_bs.ts \
|
||||
qt/locale/bitcoin_ca_ES.ts \
|
||||
qt/locale/bitcoin_ca.ts \
|
||||
qt/locale/bitcoin_ca@valencia.ts \
|
||||
qt/locale/bitcoin_cmn.ts \
|
||||
qt/locale/bitcoin_cs.ts \
|
||||
qt/locale/bitcoin_cy.ts \
|
||||
qt/locale/bitcoin_da.ts \
|
||||
qt/locale/bitcoin_de.ts \
|
||||
qt/locale/bitcoin_el_GR.ts \
|
||||
qt/locale/bitcoin_en.ts \
|
||||
qt/locale/bitcoin_eo.ts \
|
||||
qt/locale/bitcoin_es_CL.ts \
|
||||
qt/locale/bitcoin_es_DO.ts \
|
||||
qt/locale/bitcoin_es_MX.ts \
|
||||
qt/locale/bitcoin_es.ts \
|
||||
qt/locale/bitcoin_es_UY.ts \
|
||||
qt/locale/bitcoin_et.ts \
|
||||
qt/locale/bitcoin_eu_ES.ts \
|
||||
qt/locale/bitcoin_fa_IR.ts \
|
||||
qt/locale/bitcoin_fa.ts \
|
||||
qt/locale/bitcoin_fi.ts \
|
||||
qt/locale/bitcoin_fr_CA.ts \
|
||||
qt/locale/bitcoin_fr.ts \
|
||||
qt/locale/bitcoin_gl.ts \
|
||||
qt/locale/bitcoin_gu_IN.ts \
|
||||
qt/locale/bitcoin_he.ts \
|
||||
qt/locale/bitcoin_hi_IN.ts \
|
||||
qt/locale/bitcoin_hr.ts \
|
||||
qt/locale/bitcoin_hu.ts \
|
||||
qt/locale/bitcoin_id_ID.ts \
|
||||
qt/locale/bitcoin_it.ts \
|
||||
qt/locale/bitcoin_ja.ts \
|
||||
qt/locale/bitcoin_ka.ts \
|
||||
qt/locale/bitcoin_kk_KZ.ts \
|
||||
qt/locale/bitcoin_ko_KR.ts \
|
||||
qt/locale/bitcoin_ky.ts \
|
||||
qt/locale/bitcoin_la.ts \
|
||||
qt/locale/bitcoin_lt.ts \
|
||||
qt/locale/bitcoin_lv_LV.ts \
|
||||
qt/locale/bitcoin_mn.ts \
|
||||
qt/locale/bitcoin_ms_MY.ts \
|
||||
qt/locale/bitcoin_nb.ts \
|
||||
qt/locale/bitcoin_nl.ts \
|
||||
qt/locale/bitcoin_pam.ts \
|
||||
qt/locale/bitcoin_pl.ts \
|
||||
qt/locale/bitcoin_pt_BR.ts \
|
||||
qt/locale/bitcoin_pt_PT.ts \
|
||||
qt/locale/bitcoin_ro_RO.ts \
|
||||
qt/locale/bitcoin_ru.ts \
|
||||
qt/locale/bitcoin_sah.ts \
|
||||
qt/locale/bitcoin_sk.ts \
|
||||
qt/locale/bitcoin_sl_SI.ts \
|
||||
qt/locale/bitcoin_sq.ts \
|
||||
qt/locale/bitcoin_sr.ts \
|
||||
qt/locale/bitcoin_sv.ts \
|
||||
qt/locale/bitcoin_th_TH.ts \
|
||||
qt/locale/bitcoin_tr.ts \
|
||||
qt/locale/bitcoin_uk.ts \
|
||||
qt/locale/bitcoin_ur_PK.ts \
|
||||
qt/locale/bitcoin_uz@Cyrl.ts \
|
||||
qt/locale/bitcoin_vi.ts \
|
||||
qt/locale/bitcoin_vi_VN.ts \
|
||||
qt/locale/bitcoin_zh_CN.ts \
|
||||
qt/locale/bitcoin_zh_HK.ts \
|
||||
qt/locale/bitcoin_zh_TW.ts
|
||||
|
||||
QT_FORMS_UI = \
|
||||
qt/forms/addressbookpage.ui \
|
||||
qt/forms/askpassphrasedialog.ui \
|
||||
qt/forms/coincontroldialog.ui \
|
||||
qt/forms/editaddressdialog.ui \
|
||||
qt/forms/helpmessagedialog.ui \
|
||||
qt/forms/intro.ui \
|
||||
qt/forms/openuridialog.ui \
|
||||
qt/forms/optionsdialog.ui \
|
||||
qt/forms/overviewpage.ui \
|
||||
qt/forms/receivecoinsdialog.ui \
|
||||
qt/forms/receiverequestdialog.ui \
|
||||
qt/forms/rpcconsole.ui \
|
||||
qt/forms/sendcoinsdialog.ui \
|
||||
qt/forms/sendcoinsentry.ui \
|
||||
qt/forms/signverifymessagedialog.ui \
|
||||
qt/forms/transactiondescdialog.ui
|
||||
|
||||
QT_MOC_CPP = \
|
||||
qt/moc_addressbookpage.cpp \
|
||||
qt/moc_addresstablemodel.cpp \
|
||||
qt/moc_askpassphrasedialog.cpp \
|
||||
qt/moc_bitcoinaddressvalidator.cpp \
|
||||
qt/moc_bitcoinamountfield.cpp \
|
||||
qt/moc_bitcoingui.cpp \
|
||||
qt/moc_bitcoinunits.cpp \
|
||||
qt/moc_clientmodel.cpp \
|
||||
qt/moc_coincontroldialog.cpp \
|
||||
qt/moc_coincontroltreewidget.cpp \
|
||||
qt/moc_csvmodelwriter.cpp \
|
||||
qt/moc_editaddressdialog.cpp \
|
||||
qt/moc_guiutil.cpp \
|
||||
qt/moc_intro.cpp \
|
||||
qt/moc_macdockiconhandler.cpp \
|
||||
qt/moc_macnotificationhandler.cpp \
|
||||
qt/moc_notificator.cpp \
|
||||
qt/moc_openuridialog.cpp \
|
||||
qt/moc_optionsdialog.cpp \
|
||||
qt/moc_optionsmodel.cpp \
|
||||
qt/moc_overviewpage.cpp \
|
||||
qt/moc_peertablemodel.cpp \
|
||||
qt/moc_paymentserver.cpp \
|
||||
qt/moc_qvalidatedlineedit.cpp \
|
||||
qt/moc_qvaluecombobox.cpp \
|
||||
qt/moc_receivecoinsdialog.cpp \
|
||||
qt/moc_receiverequestdialog.cpp \
|
||||
qt/moc_recentrequeststablemodel.cpp \
|
||||
qt/moc_rpcconsole.cpp \
|
||||
qt/moc_sendcoinsdialog.cpp \
|
||||
qt/moc_sendcoinsentry.cpp \
|
||||
qt/moc_signverifymessagedialog.cpp \
|
||||
qt/moc_splashscreen.cpp \
|
||||
qt/moc_trafficgraphwidget.cpp \
|
||||
qt/moc_transactiondesc.cpp \
|
||||
qt/moc_transactiondescdialog.cpp \
|
||||
qt/moc_transactionfilterproxy.cpp \
|
||||
qt/moc_transactiontablemodel.cpp \
|
||||
qt/moc_transactionview.cpp \
|
||||
qt/moc_utilitydialog.cpp \
|
||||
qt/moc_walletframe.cpp \
|
||||
qt/moc_walletmodel.cpp \
|
||||
qt/moc_walletview.cpp
|
||||
|
||||
BITCOIN_MM = \
|
||||
qt/macdockiconhandler.mm \
|
||||
qt/macnotificationhandler.mm
|
||||
|
||||
QT_MOC = \
|
||||
qt/bitcoin.moc \
|
||||
qt/bitcoinamountfield.moc \
|
||||
qt/intro.moc \
|
||||
qt/overviewpage.moc \
|
||||
qt/rpcconsole.moc
|
||||
|
||||
QT_QRC_CPP = qt/qrc_bitcoin.cpp
|
||||
QT_QRC = qt/bitcoin.qrc
|
||||
QT_QRC_LOCALE_CPP = qt/qrc_bitcoin_locale.cpp
|
||||
QT_QRC_LOCALE = qt/bitcoin_locale.qrc
|
||||
|
||||
PROTOBUF_CC = qt/paymentrequest.pb.cc
|
||||
PROTOBUF_H = qt/paymentrequest.pb.h
|
||||
PROTOBUF_PROTO = qt/paymentrequest.proto
|
||||
|
||||
BITCOIN_QT_H = \
|
||||
qt/addressbookpage.h \
|
||||
qt/addresstablemodel.h \
|
||||
qt/askpassphrasedialog.h \
|
||||
qt/bitcoinaddressvalidator.h \
|
||||
qt/bitcoinamountfield.h \
|
||||
qt/bitcoingui.h \
|
||||
qt/bitcoinunits.h \
|
||||
qt/clientmodel.h \
|
||||
qt/coincontroldialog.h \
|
||||
qt/coincontroltreewidget.h \
|
||||
qt/csvmodelwriter.h \
|
||||
qt/editaddressdialog.h \
|
||||
qt/guiconstants.h \
|
||||
qt/guiutil.h \
|
||||
qt/intro.h \
|
||||
qt/macdockiconhandler.h \
|
||||
qt/macnotificationhandler.h \
|
||||
qt/networkstyle.h \
|
||||
qt/notificator.h \
|
||||
qt/openuridialog.h \
|
||||
qt/optionsdialog.h \
|
||||
qt/optionsmodel.h \
|
||||
qt/overviewpage.h \
|
||||
qt/paymentrequestplus.h \
|
||||
qt/paymentserver.h \
|
||||
qt/peertablemodel.h \
|
||||
qt/qvalidatedlineedit.h \
|
||||
qt/qvaluecombobox.h \
|
||||
qt/receivecoinsdialog.h \
|
||||
qt/receiverequestdialog.h \
|
||||
qt/recentrequeststablemodel.h \
|
||||
qt/rpcconsole.h \
|
||||
qt/scicon.h \
|
||||
qt/sendcoinsdialog.h \
|
||||
qt/sendcoinsentry.h \
|
||||
qt/signverifymessagedialog.h \
|
||||
qt/splashscreen.h \
|
||||
qt/trafficgraphwidget.h \
|
||||
qt/transactiondesc.h \
|
||||
qt/transactiondescdialog.h \
|
||||
qt/transactionfilterproxy.h \
|
||||
qt/transactionrecord.h \
|
||||
qt/transactiontablemodel.h \
|
||||
qt/transactionview.h \
|
||||
qt/utilitydialog.h \
|
||||
qt/walletframe.h \
|
||||
qt/walletmodel.h \
|
||||
qt/walletmodeltransaction.h \
|
||||
qt/walletview.h \
|
||||
qt/winshutdownmonitor.h
|
||||
|
||||
RES_ICONS = \
|
||||
qt/res/icons/add.png \
|
||||
qt/res/icons/address-book.png \
|
||||
qt/res/icons/about.png \
|
||||
qt/res/icons/about_qt.png \
|
||||
qt/res/icons/bitcoin.ico \
|
||||
qt/res/icons/bitcoin.png \
|
||||
qt/res/icons/clock1.png \
|
||||
qt/res/icons/clock2.png \
|
||||
qt/res/icons/clock3.png \
|
||||
qt/res/icons/clock4.png \
|
||||
qt/res/icons/clock5.png \
|
||||
qt/res/icons/configure.png \
|
||||
qt/res/icons/connect0.png \
|
||||
qt/res/icons/connect1.png \
|
||||
qt/res/icons/connect2.png \
|
||||
qt/res/icons/connect3.png \
|
||||
qt/res/icons/connect4.png \
|
||||
qt/res/icons/debugwindow.png \
|
||||
qt/res/icons/edit.png \
|
||||
qt/res/icons/editcopy.png \
|
||||
qt/res/icons/editpaste.png \
|
||||
qt/res/icons/export.png \
|
||||
qt/res/icons/eye.png \
|
||||
qt/res/icons/eye_minus.png \
|
||||
qt/res/icons/eye_plus.png \
|
||||
qt/res/icons/filesave.png \
|
||||
qt/res/icons/history.png \
|
||||
qt/res/icons/info.png \
|
||||
qt/res/icons/key.png \
|
||||
qt/res/icons/lock_closed.png \
|
||||
qt/res/icons/lock_open.png \
|
||||
qt/res/icons/open.png \
|
||||
qt/res/icons/overview.png \
|
||||
qt/res/icons/quit.png \
|
||||
qt/res/icons/receive.png \
|
||||
qt/res/icons/remove.png \
|
||||
qt/res/icons/send.png \
|
||||
qt/res/icons/synced.png \
|
||||
qt/res/icons/transaction0.png \
|
||||
qt/res/icons/transaction2.png \
|
||||
qt/res/icons/transaction_conflicted.png \
|
||||
qt/res/icons/tx_inout.png \
|
||||
qt/res/icons/tx_input.png \
|
||||
qt/res/icons/tx_output.png \
|
||||
qt/res/icons/tx_mined.png \
|
||||
qt/res/icons/warning.png \
|
||||
qt/res/icons/verify.png
|
||||
|
||||
BITCOIN_QT_CPP = \
|
||||
qt/bitcoinaddressvalidator.cpp \
|
||||
qt/bitcoinamountfield.cpp \
|
||||
qt/bitcoingui.cpp \
|
||||
qt/bitcoinunits.cpp \
|
||||
qt/clientmodel.cpp \
|
||||
qt/csvmodelwriter.cpp \
|
||||
qt/guiutil.cpp \
|
||||
qt/intro.cpp \
|
||||
qt/networkstyle.cpp \
|
||||
qt/notificator.cpp \
|
||||
qt/optionsdialog.cpp \
|
||||
qt/optionsmodel.cpp \
|
||||
qt/peertablemodel.cpp \
|
||||
qt/qvalidatedlineedit.cpp \
|
||||
qt/qvaluecombobox.cpp \
|
||||
qt/rpcconsole.cpp \
|
||||
qt/scicon.cpp \
|
||||
qt/splashscreen.cpp \
|
||||
qt/trafficgraphwidget.cpp \
|
||||
qt/utilitydialog.cpp
|
||||
|
||||
if TARGET_WINDOWS
|
||||
BITCOIN_QT_CPP += qt/winshutdownmonitor.cpp
|
||||
endif
|
||||
|
||||
if ENABLE_WALLET
|
||||
BITCOIN_QT_CPP += \
|
||||
qt/addressbookpage.cpp \
|
||||
qt/addresstablemodel.cpp \
|
||||
qt/askpassphrasedialog.cpp \
|
||||
qt/coincontroldialog.cpp \
|
||||
qt/coincontroltreewidget.cpp \
|
||||
qt/editaddressdialog.cpp \
|
||||
qt/openuridialog.cpp \
|
||||
qt/overviewpage.cpp \
|
||||
qt/paymentrequestplus.cpp \
|
||||
qt/paymentserver.cpp \
|
||||
qt/receivecoinsdialog.cpp \
|
||||
qt/receiverequestdialog.cpp \
|
||||
qt/recentrequeststablemodel.cpp \
|
||||
qt/sendcoinsdialog.cpp \
|
||||
qt/sendcoinsentry.cpp \
|
||||
qt/signverifymessagedialog.cpp \
|
||||
qt/transactiondesc.cpp \
|
||||
qt/transactiondescdialog.cpp \
|
||||
qt/transactionfilterproxy.cpp \
|
||||
qt/transactionrecord.cpp \
|
||||
qt/transactiontablemodel.cpp \
|
||||
qt/transactionview.cpp \
|
||||
qt/walletframe.cpp \
|
||||
qt/walletmodel.cpp \
|
||||
qt/walletmodeltransaction.cpp \
|
||||
qt/walletview.cpp
|
||||
endif
|
||||
|
||||
RES_IMAGES =
|
||||
|
||||
RES_MOVIES = $(wildcard qt/res/movies/spinner-*.png)
|
||||
|
||||
BITCOIN_RC = qt/res/bitcoin-qt-res.rc
|
||||
|
||||
BITCOIN_QT_INCLUDES = -I$(builddir)/qt -I$(srcdir)/qt -I$(srcdir)/qt/forms \
|
||||
-I$(builddir)/qt/forms -DQT_NO_KEYWORDS
|
||||
|
||||
qt_libbitcoinqt_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
$(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
|
||||
|
||||
qt_libbitcoinqt_a_SOURCES = $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(QT_FORMS_UI) \
|
||||
$(QT_QRC) $(QT_QRC_LOCALE) $(QT_TS) $(PROTOBUF_PROTO) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES)
|
||||
|
||||
nodist_qt_libbitcoinqt_a_SOURCES = $(QT_MOC_CPP) $(QT_MOC) $(PROTOBUF_CC) \
|
||||
$(PROTOBUF_H) $(QT_QRC_CPP) $(QT_QRC_LOCALE_CPP)
|
||||
|
||||
# forms/foo.h -> forms/ui_foo.h
|
||||
QT_FORMS_H=$(join $(dir $(QT_FORMS_UI)),$(addprefix ui_, $(notdir $(QT_FORMS_UI:.ui=.h))))
|
||||
|
||||
# Most files will depend on the forms and moc files as includes. Generate them
|
||||
# before anything else.
|
||||
$(QT_MOC): $(QT_FORMS_H)
|
||||
$(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) : | $(QT_MOC)
|
||||
|
||||
#Generating these with a half-written protobuf header leads to wacky results.
|
||||
#This makes sure it's done.
|
||||
$(QT_MOC): $(PROTOBUF_H)
|
||||
$(QT_MOC_CPP): $(PROTOBUF_H)
|
||||
|
||||
# bitcoin-qt binary #
|
||||
qt_bitcoin_qt_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
$(QT_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
|
||||
|
||||
qt_bitcoin_qt_SOURCES = qt/bitcoin.cpp
|
||||
if TARGET_DARWIN
|
||||
qt_bitcoin_qt_SOURCES += $(BITCOIN_MM)
|
||||
endif
|
||||
if TARGET_WINDOWS
|
||||
qt_bitcoin_qt_SOURCES += $(BITCOIN_RC)
|
||||
endif
|
||||
qt_bitcoin_qt_LDADD = qt/libbitcoinqt.a $(LIBBITCOIN_SERVER)
|
||||
if ENABLE_WALLET
|
||||
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_WALLET)
|
||||
endif
|
||||
if ENABLE_ZMQ
|
||||
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
endif
|
||||
qt_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) $(LIBMEMENV) \
|
||||
$(BOOST_LIBS) $(QT_LIBS) $(QT_DBUS_LIBS) $(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) $(LIBZCASH_LIBS)
|
||||
qt_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
qt_bitcoin_qt_LIBTOOLFLAGS = --tag CXX
|
||||
|
||||
#locale/foo.ts -> locale/foo.qm
|
||||
QT_QM=$(QT_TS:.ts=.qm)
|
||||
|
||||
SECONDARY: $(QT_QM)
|
||||
|
||||
qt/bitcoinstrings.cpp: $(libbitcoin_server_a_SOURCES) $(libbitcoin_wallet_a_SOURCES)
|
||||
@test -n $(XGETTEXT) || echo "xgettext is required for updating translations"
|
||||
$(AM_V_GEN) cd $(srcdir); XGETTEXT=$(XGETTEXT) ../share/qt/extract_strings_qt.py $^
|
||||
|
||||
translate: qt/bitcoinstrings.cpp $(QT_FORMS_UI) $(QT_FORMS_UI) $(BITCOIN_QT_CPP) $(BITCOIN_QT_H) $(BITCOIN_MM)
|
||||
@test -n $(LUPDATE) || echo "lupdate is required for updating translations"
|
||||
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LUPDATE) $^ -locations relative -no-obsolete -ts qt/locale/bitcoin_en.ts
|
||||
|
||||
$(QT_QRC_LOCALE_CPP): $(QT_QRC_LOCALE) $(QT_QM)
|
||||
@test -f $(RCC)
|
||||
@test -f $(@D)/$(<F) || cp -f $< $(@D)
|
||||
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin_locale $(@D)/$(<F) | \
|
||||
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
|
||||
|
||||
$(QT_QRC_CPP): $(QT_QRC) $(QT_FORMS_H) $(RES_ICONS) $(RES_IMAGES) $(RES_MOVIES) $(PROTOBUF_H)
|
||||
@test -f $(RCC)
|
||||
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(RCC) -name bitcoin $< | \
|
||||
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
|
||||
|
||||
CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda qt/*.gcno
|
||||
|
||||
CLEANFILES += $(CLEAN_QT)
|
||||
|
||||
bitcoin_qt_clean: FORCE
|
||||
rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_bitcoin_qt_OBJECTS) qt/bitcoin-qt$(EXEEXT) $(LIBBITCOINQT)
|
||||
|
||||
bitcoin_qt : qt/bitcoin-qt$(EXEEXT)
|
||||
|
||||
ui_%.h: %.ui
|
||||
@test -f $(UIC)
|
||||
@$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(UIC) -o $@ $< || (echo "Error creating $@"; false)
|
||||
|
||||
%.moc: %.cpp
|
||||
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) $< | \
|
||||
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
|
||||
|
||||
moc_%.cpp: %.h
|
||||
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(MOC) $(QT_INCLUDES) $(MOC_DEFS) $< | \
|
||||
$(SED) -e '/^\*\*.*Created:/d' -e '/^\*\*.*by:/d' > $@
|
||||
|
||||
%.qm: %.ts
|
||||
@test -f $(LRELEASE)
|
||||
@$(MKDIR_P) $(@D)
|
||||
$(AM_V_GEN) QT_SELECT=$(QT_SELECT) $(LRELEASE) -silent $< -qm $@
|
|
@ -1,51 +0,0 @@
|
|||
bin_PROGRAMS += qt/test/test_bitcoin-qt
|
||||
TESTS += qt/test/test_bitcoin-qt
|
||||
|
||||
TEST_QT_MOC_CPP = qt/test/moc_uritests.cpp
|
||||
|
||||
if ENABLE_WALLET
|
||||
TEST_QT_MOC_CPP += qt/test/moc_paymentservertests.cpp
|
||||
endif
|
||||
|
||||
TEST_QT_H = \
|
||||
qt/test/uritests.h \
|
||||
qt/test/paymentrequestdata.h \
|
||||
qt/test/paymentservertests.h
|
||||
|
||||
qt_test_test_bitcoin_qt_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
|
||||
$(QT_INCLUDES) $(QT_TEST_INCLUDES) $(PROTOBUF_CFLAGS)
|
||||
|
||||
qt_test_test_bitcoin_qt_SOURCES = \
|
||||
qt/test/test_main.cpp \
|
||||
qt/test/uritests.cpp \
|
||||
$(TEST_QT_H)
|
||||
if ENABLE_WALLET
|
||||
qt_test_test_bitcoin_qt_SOURCES += \
|
||||
qt/test/paymentservertests.cpp
|
||||
endif
|
||||
|
||||
nodist_qt_test_test_bitcoin_qt_SOURCES = $(TEST_QT_MOC_CPP)
|
||||
|
||||
qt_test_test_bitcoin_qt_LDADD = $(LIBBITCOINQT) $(LIBBITCOIN_SERVER)
|
||||
if ENABLE_WALLET
|
||||
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_WALLET)
|
||||
endif
|
||||
if ENABLE_ZMQ
|
||||
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_ZMQ) $(ZMQ_LIBS)
|
||||
endif
|
||||
qt_test_test_bitcoin_qt_LDADD += $(LIBBITCOIN_CLI) $(LIBBITCOIN_COMMON) $(LIBBITCOIN_UTIL) $(LIBBITCOIN_CRYPTO) $(LIBUNIVALUE) $(LIBLEVELDB) \
|
||||
$(LIBMEMENV) $(BOOST_LIBS) $(QT_DBUS_LIBS) $(QT_TEST_LIBS) $(QT_LIBS) \
|
||||
$(QR_LIBS) $(PROTOBUF_LIBS) $(BDB_LIBS) $(SSL_LIBS) $(CRYPTO_LIBS) $(MINIUPNPC_LIBS) $(LIBSECP256K1) $(LIBZCASH_LIBS)
|
||||
qt_test_test_bitcoin_qt_LDFLAGS = $(RELDFLAGS) $(AM_LDFLAGS) $(QT_LDFLAGS) $(LIBTOOL_APP_LDFLAGS)
|
||||
|
||||
CLEAN_BITCOIN_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno
|
||||
|
||||
CLEANFILES += $(CLEAN_BITCOIN_QT_TEST)
|
||||
|
||||
test_bitcoin_qt : qt/test/test_bitcoin-qt$(EXEEXT)
|
||||
|
||||
test_bitcoin_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE
|
||||
$(MAKE) check-TESTS TESTS=$^
|
||||
|
||||
test_bitcoin_qt_clean: FORCE
|
||||
rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_bitcoin_qt_OBJECTS)
|
|
@ -63,7 +63,6 @@ bool AppInit(int argc, char* argv[])
|
|||
//
|
||||
// Parameters
|
||||
//
|
||||
// If Qt is used, parameters/zcash.conf are parsed in qt/bitcoin.cpp's main()
|
||||
ParseParameters(argc, argv);
|
||||
|
||||
// Process help and version before taking care about datadir
|
||||
|
|
23
src/init.cpp
23
src/init.cpp
|
@ -100,7 +100,7 @@ CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
|
|||
// Thread management and startup/shutdown:
|
||||
//
|
||||
// The network-processing threads are all part of a thread group
|
||||
// created by AppInit() or the Qt main() function.
|
||||
// created by AppInit().
|
||||
//
|
||||
// A clean exit happens when StartShutdown() or the SIGTERM
|
||||
// signal handler sets fRequestShutdown, which triggers
|
||||
|
@ -116,10 +116,6 @@ CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
|
|||
// before adding any threads to the threadGroup, so .join_all() returns
|
||||
// immediately and the parent exits from main().
|
||||
//
|
||||
// Shutdown for Qt is very similar, only it uses a QTimer to detect
|
||||
// fRequestShutdown getting set, and then does the normal Qt
|
||||
// shutdown thing.
|
||||
//
|
||||
|
||||
std::atomic<bool> fRequestShutdown(false);
|
||||
|
||||
|
@ -410,9 +406,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-stopafterblockimport", strprintf("Stop running after importing blocks from disk (default: %u)", 0));
|
||||
}
|
||||
string debugCategories = "addrman, alert, bench, coindb, db, estimatefee, lock, mempool, net, partitioncheck, pow, proxy, prune, "
|
||||
"rand, reindex, rpc, selectcoins, zmq, zrpc, zrpcunsafe (implies zrpc)"; // Don't translate these and qt below
|
||||
if (mode == HMM_BITCOIN_QT)
|
||||
debugCategories += ", qt";
|
||||
"rand, reindex, rpc, selectcoins, zmq, zrpc, zrpcunsafe (implies zrpc)"; // Don't translate these
|
||||
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
|
||||
_("If <category> is not supplied or if <category> = 1, output all debugging information.") + " " + _("<category> can be:") + " " + debugCategories + ".");
|
||||
strUsage += HelpMessageOpt("-experimentalfeatures", _("Enable use of experimental features"));
|
||||
|
@ -487,18 +481,7 @@ std::string HelpMessage(HelpMessageMode mode)
|
|||
strUsage += HelpMessageOpt("-rpcsslprivatekeyfile=<file.pem>", strprintf(_("Server private key (default: %s)"), "server.pem"));
|
||||
strUsage += HelpMessageOpt("-rpcsslciphers=<ciphers>", strprintf(_("Acceptable ciphers (default: %s)"), "TLSv1.2+HIGH:TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!3DES:@STRENGTH"));
|
||||
|
||||
if (mode == HMM_BITCOIN_QT)
|
||||
{
|
||||
strUsage += HelpMessageGroup(_("UI Options:"));
|
||||
if (showDebug) {
|
||||
strUsage += HelpMessageOpt("-allowselfsignedrootcertificates", "Allow self signed root certificates (default: 0)");
|
||||
}
|
||||
strUsage += HelpMessageOpt("-choosedatadir", _("Choose data directory on startup (default: 0)"));
|
||||
strUsage += HelpMessageOpt("-lang=<lang>", _("Set language, for example \"de_DE\" (default: system locale)"));
|
||||
strUsage += HelpMessageOpt("-min", _("Start minimized"));
|
||||
strUsage += HelpMessageOpt("-rootcertificates=<file>", _("Set SSL root certificates for payment request (default: -system-)"));
|
||||
strUsage += HelpMessageOpt("-splash", _("Show splash screen on startup (default: 1)"));
|
||||
} else if (mode == HMM_BITCOIND) {
|
||||
if (mode == HMM_BITCOIND) {
|
||||
strUsage += HelpMessageGroup(_("Metrics Options (only if -daemon and -printtoconsole are not set):"));
|
||||
strUsage += HelpMessageOpt("-showmetrics", _("Show metrics on stdout (default: 1 if running in a console, 0 otherwise)"));
|
||||
strUsage += HelpMessageOpt("-metricsui", _("Set to 1 for a persistent metrics screen, 0 for sequential metrics output (default: 1 if running in a console, 0 otherwise)"));
|
||||
|
|
|
@ -28,8 +28,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler);
|
|||
|
||||
/** The help message mode determines what help message to show */
|
||||
enum HelpMessageMode {
|
||||
HMM_BITCOIND,
|
||||
HMM_BITCOIN_QT
|
||||
HMM_BITCOIND
|
||||
};
|
||||
|
||||
/** Help for options shared between UI and daemon (for -help) */
|
||||
|
|
|
@ -2387,7 +2387,7 @@ void static UpdateTip(CBlockIndex *pindexNew) {
|
|||
LogPrintf("%s: %d of last 100 blocks above version %d\n", __func__, nUpgraded, (int)CBlock::CURRENT_VERSION);
|
||||
if (nUpgraded > 100/2)
|
||||
{
|
||||
// strMiscWarning is read by GetWarnings(), called by Qt and the JSON-RPC code to warn the user:
|
||||
// strMiscWarning is read by GetWarnings(), called by the JSON-RPC code to warn the user:
|
||||
strMiscWarning = _("Warning: This version is obsolete; upgrade required!");
|
||||
CAlert::Notify(strMiscWarning, true);
|
||||
fWarned = true;
|
||||
|
|
|
@ -1,9 +0,0 @@
|
|||
.PHONY: FORCE
|
||||
all: FORCE
|
||||
$(MAKE) -C .. bitcoin_qt test_bitcoin_qt
|
||||
clean: FORCE
|
||||
$(MAKE) -C .. bitcoin_qt_clean test_bitcoin_qt_clean
|
||||
check: FORCE
|
||||
$(MAKE) -C .. test_bitcoin_qt_check
|
||||
bitcoin-qt bitcoin-qt.exe: FORCE
|
||||
$(MAKE) -C .. bitcoin_qt
|
|
@ -1,313 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#endif
|
||||
|
||||
#include "addressbookpage.h"
|
||||
#include "ui_addressbookpage.h"
|
||||
|
||||
#include "addresstablemodel.h"
|
||||
#include "bitcoingui.h"
|
||||
#include "csvmodelwriter.h"
|
||||
#include "editaddressdialog.h"
|
||||
#include "guiutil.h"
|
||||
#include "scicon.h"
|
||||
|
||||
#include <QIcon>
|
||||
#include <QMenu>
|
||||
#include <QMessageBox>
|
||||
#include <QSortFilterProxyModel>
|
||||
|
||||
AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AddressBookPage),
|
||||
model(0),
|
||||
mode(mode),
|
||||
tab(tab)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
#ifdef Q_OS_MAC // Icons on push buttons are very uncommon on Mac
|
||||
ui->newAddress->setIcon(QIcon());
|
||||
ui->copyAddress->setIcon(QIcon());
|
||||
ui->deleteAddress->setIcon(QIcon());
|
||||
ui->exportButton->setIcon(QIcon());
|
||||
#else
|
||||
ui->newAddress->setIcon(SingleColorIcon(":/icons/add"));
|
||||
ui->copyAddress->setIcon(SingleColorIcon(":/icons/editcopy"));
|
||||
ui->deleteAddress->setIcon(SingleColorIcon(":/icons/remove"));
|
||||
ui->exportButton->setIcon(SingleColorIcon(":/icons/export"));
|
||||
#endif
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case ForSelection:
|
||||
switch(tab)
|
||||
{
|
||||
case SendingTab: setWindowTitle(tr("Choose the address to send coins to")); break;
|
||||
case ReceivingTab: setWindowTitle(tr("Choose the address to receive coins with")); break;
|
||||
}
|
||||
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(accept()));
|
||||
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
|
||||
ui->tableView->setFocus();
|
||||
ui->closeButton->setText(tr("C&hoose"));
|
||||
ui->exportButton->hide();
|
||||
break;
|
||||
case ForEditing:
|
||||
switch(tab)
|
||||
{
|
||||
case SendingTab: setWindowTitle(tr("Sending addresses")); break;
|
||||
case ReceivingTab: setWindowTitle(tr("Receiving addresses")); break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch(tab)
|
||||
{
|
||||
case SendingTab:
|
||||
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for sending payments. Always check the amount and the receiving address before sending coins."));
|
||||
ui->deleteAddress->setVisible(true);
|
||||
break;
|
||||
case ReceivingTab:
|
||||
ui->labelExplanation->setText(tr("These are your Bitcoin addresses for receiving payments. It is recommended to use a new receiving address for each transaction."));
|
||||
ui->deleteAddress->setVisible(false);
|
||||
break;
|
||||
}
|
||||
|
||||
// Context menu actions
|
||||
QAction *copyAddressAction = new QAction(tr("&Copy Address"), this);
|
||||
QAction *copyLabelAction = new QAction(tr("Copy &Label"), this);
|
||||
QAction *editAction = new QAction(tr("&Edit"), this);
|
||||
deleteAction = new QAction(ui->deleteAddress->text(), this);
|
||||
|
||||
// Build context menu
|
||||
contextMenu = new QMenu();
|
||||
contextMenu->addAction(copyAddressAction);
|
||||
contextMenu->addAction(copyLabelAction);
|
||||
contextMenu->addAction(editAction);
|
||||
if(tab == SendingTab)
|
||||
contextMenu->addAction(deleteAction);
|
||||
contextMenu->addSeparator();
|
||||
|
||||
// Connect signals for context menu actions
|
||||
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(on_copyAddress_clicked()));
|
||||
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(onCopyLabelAction()));
|
||||
connect(editAction, SIGNAL(triggered()), this, SLOT(onEditAction()));
|
||||
connect(deleteAction, SIGNAL(triggered()), this, SLOT(on_deleteAddress_clicked()));
|
||||
|
||||
connect(ui->tableView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextualMenu(QPoint)));
|
||||
|
||||
connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(accept()));
|
||||
}
|
||||
|
||||
AddressBookPage::~AddressBookPage()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AddressBookPage::setModel(AddressTableModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
proxyModel = new QSortFilterProxyModel(this);
|
||||
proxyModel->setSourceModel(model);
|
||||
proxyModel->setDynamicSortFilter(true);
|
||||
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
|
||||
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
|
||||
switch(tab)
|
||||
{
|
||||
case ReceivingTab:
|
||||
// Receive filter
|
||||
proxyModel->setFilterRole(AddressTableModel::TypeRole);
|
||||
proxyModel->setFilterFixedString(AddressTableModel::Receive);
|
||||
break;
|
||||
case SendingTab:
|
||||
// Send filter
|
||||
proxyModel->setFilterRole(AddressTableModel::TypeRole);
|
||||
proxyModel->setFilterFixedString(AddressTableModel::Send);
|
||||
break;
|
||||
}
|
||||
ui->tableView->setModel(proxyModel);
|
||||
ui->tableView->sortByColumn(0, Qt::AscendingOrder);
|
||||
|
||||
// Set column widths
|
||||
#if QT_VERSION < 0x050000
|
||||
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
|
||||
ui->tableView->horizontalHeader()->setResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
|
||||
#else
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Label, QHeaderView::Stretch);
|
||||
ui->tableView->horizontalHeader()->setSectionResizeMode(AddressTableModel::Address, QHeaderView::ResizeToContents);
|
||||
#endif
|
||||
|
||||
connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||
this, SLOT(selectionChanged()));
|
||||
|
||||
// Select row for newly created address
|
||||
connect(model, SIGNAL(rowsInserted(QModelIndex,int,int)), this, SLOT(selectNewAddress(QModelIndex,int,int)));
|
||||
|
||||
selectionChanged();
|
||||
}
|
||||
|
||||
void AddressBookPage::on_copyAddress_clicked()
|
||||
{
|
||||
GUIUtil::copyEntryData(ui->tableView, AddressTableModel::Address);
|
||||
}
|
||||
|
||||
void AddressBookPage::onCopyLabelAction()
|
||||
{
|
||||
GUIUtil::copyEntryData(ui->tableView, AddressTableModel::Label);
|
||||
}
|
||||
|
||||
void AddressBookPage::onEditAction()
|
||||
{
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
if(!ui->tableView->selectionModel())
|
||||
return;
|
||||
QModelIndexList indexes = ui->tableView->selectionModel()->selectedRows();
|
||||
if(indexes.isEmpty())
|
||||
return;
|
||||
|
||||
EditAddressDialog dlg(
|
||||
tab == SendingTab ?
|
||||
EditAddressDialog::EditSendingAddress :
|
||||
EditAddressDialog::EditReceivingAddress, this);
|
||||
dlg.setModel(model);
|
||||
QModelIndex origIndex = proxyModel->mapToSource(indexes.at(0));
|
||||
dlg.loadRow(origIndex.row());
|
||||
dlg.exec();
|
||||
}
|
||||
|
||||
void AddressBookPage::on_newAddress_clicked()
|
||||
{
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
EditAddressDialog dlg(
|
||||
tab == SendingTab ?
|
||||
EditAddressDialog::NewSendingAddress :
|
||||
EditAddressDialog::NewReceivingAddress, this);
|
||||
dlg.setModel(model);
|
||||
if(dlg.exec())
|
||||
{
|
||||
newAddressToSelect = dlg.getAddress();
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::on_deleteAddress_clicked()
|
||||
{
|
||||
QTableView *table = ui->tableView;
|
||||
if(!table->selectionModel())
|
||||
return;
|
||||
|
||||
QModelIndexList indexes = table->selectionModel()->selectedRows();
|
||||
if(!indexes.isEmpty())
|
||||
{
|
||||
table->model()->removeRow(indexes.at(0).row());
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::selectionChanged()
|
||||
{
|
||||
// Set button states based on selected tab and selection
|
||||
QTableView *table = ui->tableView;
|
||||
if(!table->selectionModel())
|
||||
return;
|
||||
|
||||
if(table->selectionModel()->hasSelection())
|
||||
{
|
||||
switch(tab)
|
||||
{
|
||||
case SendingTab:
|
||||
// In sending tab, allow deletion of selection
|
||||
ui->deleteAddress->setEnabled(true);
|
||||
ui->deleteAddress->setVisible(true);
|
||||
deleteAction->setEnabled(true);
|
||||
break;
|
||||
case ReceivingTab:
|
||||
// Deleting receiving addresses, however, is not allowed
|
||||
ui->deleteAddress->setEnabled(false);
|
||||
ui->deleteAddress->setVisible(false);
|
||||
deleteAction->setEnabled(false);
|
||||
break;
|
||||
}
|
||||
ui->copyAddress->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
ui->deleteAddress->setEnabled(false);
|
||||
ui->copyAddress->setEnabled(false);
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::done(int retval)
|
||||
{
|
||||
QTableView *table = ui->tableView;
|
||||
if(!table->selectionModel() || !table->model())
|
||||
return;
|
||||
|
||||
// Figure out which address was selected, and return it
|
||||
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
||||
|
||||
Q_FOREACH (const QModelIndex& index, indexes) {
|
||||
QVariant address = table->model()->data(index);
|
||||
returnValue = address.toString();
|
||||
}
|
||||
|
||||
if(returnValue.isEmpty())
|
||||
{
|
||||
// If no address entry selected, return rejected
|
||||
retval = Rejected;
|
||||
}
|
||||
|
||||
QDialog::done(retval);
|
||||
}
|
||||
|
||||
void AddressBookPage::on_exportButton_clicked()
|
||||
{
|
||||
// CSV is currently the only supported format
|
||||
QString filename = GUIUtil::getSaveFileName(this,
|
||||
tr("Export Address List"), QString(),
|
||||
tr("Comma separated file (*.csv)"), NULL);
|
||||
|
||||
if (filename.isNull())
|
||||
return;
|
||||
|
||||
CSVModelWriter writer(filename);
|
||||
|
||||
// name, column, role
|
||||
writer.setModel(proxyModel);
|
||||
writer.addColumn("Label", AddressTableModel::Label, Qt::EditRole);
|
||||
writer.addColumn("Address", AddressTableModel::Address, Qt::EditRole);
|
||||
|
||||
if(!writer.write()) {
|
||||
QMessageBox::critical(this, tr("Exporting Failed"),
|
||||
tr("There was an error trying to save the address list to %1. Please try again.").arg(filename));
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::contextualMenu(const QPoint &point)
|
||||
{
|
||||
QModelIndex index = ui->tableView->indexAt(point);
|
||||
if(index.isValid())
|
||||
{
|
||||
contextMenu->exec(QCursor::pos());
|
||||
}
|
||||
}
|
||||
|
||||
void AddressBookPage::selectNewAddress(const QModelIndex &parent, int begin, int /*end*/)
|
||||
{
|
||||
QModelIndex idx = proxyModel->mapFromSource(model->index(begin, AddressTableModel::Address, parent));
|
||||
if(idx.isValid() && (idx.data(Qt::EditRole).toString() == newAddressToSelect))
|
||||
{
|
||||
// Select row of newly created address, once
|
||||
ui->tableView->setFocus();
|
||||
ui->tableView->selectRow(idx.row());
|
||||
newAddressToSelect.clear();
|
||||
}
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_ADDRESSBOOKPAGE_H
|
||||
#define BITCOIN_QT_ADDRESSBOOKPAGE_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class AddressTableModel;
|
||||
class OptionsModel;
|
||||
|
||||
namespace Ui {
|
||||
class AddressBookPage;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QItemSelection;
|
||||
class QMenu;
|
||||
class QModelIndex;
|
||||
class QSortFilterProxyModel;
|
||||
class QTableView;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/** Widget that shows a list of sending or receiving addresses.
|
||||
*/
|
||||
class AddressBookPage : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Tabs {
|
||||
SendingTab = 0,
|
||||
ReceivingTab = 1
|
||||
};
|
||||
|
||||
enum Mode {
|
||||
ForSelection, /**< Open address book to pick address */
|
||||
ForEditing /**< Open address book for editing */
|
||||
};
|
||||
|
||||
explicit AddressBookPage(Mode mode, Tabs tab, QWidget *parent);
|
||||
~AddressBookPage();
|
||||
|
||||
void setModel(AddressTableModel *model);
|
||||
const QString &getReturnValue() const { return returnValue; }
|
||||
|
||||
public Q_SLOTS:
|
||||
void done(int retval);
|
||||
|
||||
private:
|
||||
Ui::AddressBookPage *ui;
|
||||
AddressTableModel *model;
|
||||
Mode mode;
|
||||
Tabs tab;
|
||||
QString returnValue;
|
||||
QSortFilterProxyModel *proxyModel;
|
||||
QMenu *contextMenu;
|
||||
QAction *deleteAction; // to be able to explicitly disable it
|
||||
QString newAddressToSelect;
|
||||
|
||||
private Q_SLOTS:
|
||||
/** Delete currently selected address entry */
|
||||
void on_deleteAddress_clicked();
|
||||
/** Create a new address for receiving coins and / or add a new address book entry */
|
||||
void on_newAddress_clicked();
|
||||
/** Copy address of currently selected address entry to clipboard */
|
||||
void on_copyAddress_clicked();
|
||||
/** Copy label of currently selected address entry to clipboard (no button) */
|
||||
void onCopyLabelAction();
|
||||
/** Edit currently selected address entry (no button) */
|
||||
void onEditAction();
|
||||
/** Export button clicked */
|
||||
void on_exportButton_clicked();
|
||||
|
||||
/** Set button states based on selected tab and selection */
|
||||
void selectionChanged();
|
||||
/** Spawn contextual menu (right mouse menu) for address book entry */
|
||||
void contextualMenu(const QPoint &point);
|
||||
/** New entry/entries were added to address table */
|
||||
void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);
|
||||
|
||||
Q_SIGNALS:
|
||||
void sendCoins(QString addr);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_ADDRESSBOOKPAGE_H
|
|
@ -1,454 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "addresstablemodel.h"
|
||||
|
||||
#include "guiutil.h"
|
||||
#include "walletmodel.h"
|
||||
|
||||
#include "base58.h"
|
||||
#include "wallet/wallet.h"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include <QFont>
|
||||
#include <QDebug>
|
||||
|
||||
const QString AddressTableModel::Send = "S";
|
||||
const QString AddressTableModel::Receive = "R";
|
||||
|
||||
struct AddressTableEntry
|
||||
{
|
||||
enum Type {
|
||||
Sending,
|
||||
Receiving,
|
||||
Hidden /* QSortFilterProxyModel will filter these out */
|
||||
};
|
||||
|
||||
Type type;
|
||||
QString label;
|
||||
QString address;
|
||||
|
||||
AddressTableEntry() {}
|
||||
AddressTableEntry(Type type, const QString &label, const QString &address):
|
||||
type(type), label(label), address(address) {}
|
||||
};
|
||||
|
||||
struct AddressTableEntryLessThan
|
||||
{
|
||||
bool operator()(const AddressTableEntry &a, const AddressTableEntry &b) const
|
||||
{
|
||||
return a.address < b.address;
|
||||
}
|
||||
bool operator()(const AddressTableEntry &a, const QString &b) const
|
||||
{
|
||||
return a.address < b;
|
||||
}
|
||||
bool operator()(const QString &a, const AddressTableEntry &b) const
|
||||
{
|
||||
return a < b.address;
|
||||
}
|
||||
};
|
||||
|
||||
/* Determine address type from address purpose */
|
||||
static AddressTableEntry::Type translateTransactionType(const QString &strPurpose, bool isMine)
|
||||
{
|
||||
AddressTableEntry::Type addressType = AddressTableEntry::Hidden;
|
||||
// "refund" addresses aren't shown, and change addresses aren't in mapAddressBook at all.
|
||||
if (strPurpose == "send")
|
||||
addressType = AddressTableEntry::Sending;
|
||||
else if (strPurpose == "receive")
|
||||
addressType = AddressTableEntry::Receiving;
|
||||
else if (strPurpose == "unknown" || strPurpose == "") // if purpose not set, guess
|
||||
addressType = (isMine ? AddressTableEntry::Receiving : AddressTableEntry::Sending);
|
||||
return addressType;
|
||||
}
|
||||
|
||||
// Private implementation
|
||||
class AddressTablePriv
|
||||
{
|
||||
public:
|
||||
CWallet *wallet;
|
||||
QList<AddressTableEntry> cachedAddressTable;
|
||||
AddressTableModel *parent;
|
||||
|
||||
AddressTablePriv(CWallet *wallet, AddressTableModel *parent):
|
||||
wallet(wallet), parent(parent) {}
|
||||
|
||||
void refreshAddressTable()
|
||||
{
|
||||
cachedAddressTable.clear();
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
BOOST_FOREACH(const PAIRTYPE(CTxDestination, CAddressBookData)& item, wallet->mapAddressBook)
|
||||
{
|
||||
const CBitcoinAddress& address = item.first;
|
||||
bool fMine = IsMine(*wallet, address.Get());
|
||||
AddressTableEntry::Type addressType = translateTransactionType(
|
||||
QString::fromStdString(item.second.purpose), fMine);
|
||||
const std::string& strName = item.second.name;
|
||||
cachedAddressTable.append(AddressTableEntry(addressType,
|
||||
QString::fromStdString(strName),
|
||||
QString::fromStdString(address.ToString())));
|
||||
}
|
||||
}
|
||||
// qLowerBound() and qUpperBound() require our cachedAddressTable list to be sorted in asc order
|
||||
// Even though the map is already sorted this re-sorting step is needed because the originating map
|
||||
// is sorted by binary address, not by base58() address.
|
||||
qSort(cachedAddressTable.begin(), cachedAddressTable.end(), AddressTableEntryLessThan());
|
||||
}
|
||||
|
||||
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status)
|
||||
{
|
||||
// Find address / label in model
|
||||
QList<AddressTableEntry>::iterator lower = qLowerBound(
|
||||
cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan());
|
||||
QList<AddressTableEntry>::iterator upper = qUpperBound(
|
||||
cachedAddressTable.begin(), cachedAddressTable.end(), address, AddressTableEntryLessThan());
|
||||
int lowerIndex = (lower - cachedAddressTable.begin());
|
||||
int upperIndex = (upper - cachedAddressTable.begin());
|
||||
bool inModel = (lower != upper);
|
||||
AddressTableEntry::Type newEntryType = translateTransactionType(purpose, isMine);
|
||||
|
||||
switch(status)
|
||||
{
|
||||
case CT_NEW:
|
||||
if(inModel)
|
||||
{
|
||||
qWarning() << "AddressTablePriv::updateEntry: Warning: Got CT_NEW, but entry is already in model";
|
||||
break;
|
||||
}
|
||||
parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex);
|
||||
cachedAddressTable.insert(lowerIndex, AddressTableEntry(newEntryType, label, address));
|
||||
parent->endInsertRows();
|
||||
break;
|
||||
case CT_UPDATED:
|
||||
if(!inModel)
|
||||
{
|
||||
qWarning() << "AddressTablePriv::updateEntry: Warning: Got CT_UPDATED, but entry is not in model";
|
||||
break;
|
||||
}
|
||||
lower->type = newEntryType;
|
||||
lower->label = label;
|
||||
parent->emitDataChanged(lowerIndex);
|
||||
break;
|
||||
case CT_DELETED:
|
||||
if(!inModel)
|
||||
{
|
||||
qWarning() << "AddressTablePriv::updateEntry: Warning: Got CT_DELETED, but entry is not in model";
|
||||
break;
|
||||
}
|
||||
parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex-1);
|
||||
cachedAddressTable.erase(lower, upper);
|
||||
parent->endRemoveRows();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int size()
|
||||
{
|
||||
return cachedAddressTable.size();
|
||||
}
|
||||
|
||||
AddressTableEntry *index(int idx)
|
||||
{
|
||||
if(idx >= 0 && idx < cachedAddressTable.size())
|
||||
{
|
||||
return &cachedAddressTable[idx];
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
AddressTableModel::AddressTableModel(CWallet *wallet, WalletModel *parent) :
|
||||
QAbstractTableModel(parent),walletModel(parent),wallet(wallet),priv(0)
|
||||
{
|
||||
columns << tr("Label") << tr("Address");
|
||||
priv = new AddressTablePriv(wallet, this);
|
||||
priv->refreshAddressTable();
|
||||
}
|
||||
|
||||
AddressTableModel::~AddressTableModel()
|
||||
{
|
||||
delete priv;
|
||||
}
|
||||
|
||||
int AddressTableModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return priv->size();
|
||||
}
|
||||
|
||||
int AddressTableModel::columnCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return columns.length();
|
||||
}
|
||||
|
||||
QVariant AddressTableModel::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return QVariant();
|
||||
|
||||
AddressTableEntry *rec = static_cast<AddressTableEntry*>(index.internalPointer());
|
||||
|
||||
if(role == Qt::DisplayRole || role == Qt::EditRole)
|
||||
{
|
||||
switch(index.column())
|
||||
{
|
||||
case Label:
|
||||
if(rec->label.isEmpty() && role == Qt::DisplayRole)
|
||||
{
|
||||
return tr("(no label)");
|
||||
}
|
||||
else
|
||||
{
|
||||
return rec->label;
|
||||
}
|
||||
case Address:
|
||||
return rec->address;
|
||||
}
|
||||
}
|
||||
else if (role == Qt::FontRole)
|
||||
{
|
||||
QFont font;
|
||||
if(index.column() == Address)
|
||||
{
|
||||
font = GUIUtil::bitcoinAddressFont();
|
||||
}
|
||||
return font;
|
||||
}
|
||||
else if (role == TypeRole)
|
||||
{
|
||||
switch(rec->type)
|
||||
{
|
||||
case AddressTableEntry::Sending:
|
||||
return Send;
|
||||
case AddressTableEntry::Receiving:
|
||||
return Receive;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
if(!index.isValid())
|
||||
return false;
|
||||
AddressTableEntry *rec = static_cast<AddressTableEntry*>(index.internalPointer());
|
||||
std::string strPurpose = (rec->type == AddressTableEntry::Sending ? "send" : "receive");
|
||||
editStatus = OK;
|
||||
|
||||
if(role == Qt::EditRole)
|
||||
{
|
||||
LOCK(wallet->cs_wallet); /* For SetAddressBook / DelAddressBook */
|
||||
CTxDestination curAddress = CBitcoinAddress(rec->address.toStdString()).Get();
|
||||
if(index.column() == Label)
|
||||
{
|
||||
// Do nothing, if old label == new label
|
||||
if(rec->label == value.toString())
|
||||
{
|
||||
editStatus = NO_CHANGES;
|
||||
return false;
|
||||
}
|
||||
wallet->SetAddressBook(curAddress, value.toString().toStdString(), strPurpose);
|
||||
} else if(index.column() == Address) {
|
||||
CTxDestination newAddress = CBitcoinAddress(value.toString().toStdString()).Get();
|
||||
// Refuse to set invalid address, set error status and return false
|
||||
if(boost::get<CNoDestination>(&newAddress))
|
||||
{
|
||||
editStatus = INVALID_ADDRESS;
|
||||
return false;
|
||||
}
|
||||
// Do nothing, if old address == new address
|
||||
else if(newAddress == curAddress)
|
||||
{
|
||||
editStatus = NO_CHANGES;
|
||||
return false;
|
||||
}
|
||||
// Check for duplicate addresses to prevent accidental deletion of addresses, if you try
|
||||
// to paste an existing address over another address (with a different label)
|
||||
else if(wallet->mapAddressBook.count(newAddress))
|
||||
{
|
||||
editStatus = DUPLICATE_ADDRESS;
|
||||
return false;
|
||||
}
|
||||
// Double-check that we're not overwriting a receiving address
|
||||
else if(rec->type == AddressTableEntry::Sending)
|
||||
{
|
||||
// Remove old entry
|
||||
wallet->DelAddressBook(curAddress);
|
||||
// Add new entry with new address
|
||||
wallet->SetAddressBook(newAddress, rec->label.toStdString(), strPurpose);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
QVariant AddressTableModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if(orientation == Qt::Horizontal)
|
||||
{
|
||||
if(role == Qt::DisplayRole && section < columns.size())
|
||||
{
|
||||
return columns[section];
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
Qt::ItemFlags AddressTableModel::flags(const QModelIndex &index) const
|
||||
{
|
||||
if(!index.isValid())
|
||||
return 0;
|
||||
AddressTableEntry *rec = static_cast<AddressTableEntry*>(index.internalPointer());
|
||||
|
||||
Qt::ItemFlags retval = Qt::ItemIsSelectable | Qt::ItemIsEnabled;
|
||||
// Can edit address and label for sending addresses,
|
||||
// and only label for receiving addresses.
|
||||
if(rec->type == AddressTableEntry::Sending ||
|
||||
(rec->type == AddressTableEntry::Receiving && index.column()==Label))
|
||||
{
|
||||
retval |= Qt::ItemIsEditable;
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
|
||||
QModelIndex AddressTableModel::index(int row, int column, const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
AddressTableEntry *data = priv->index(row);
|
||||
if(data)
|
||||
{
|
||||
return createIndex(row, column, priv->index(row));
|
||||
}
|
||||
else
|
||||
{
|
||||
return QModelIndex();
|
||||
}
|
||||
}
|
||||
|
||||
void AddressTableModel::updateEntry(const QString &address,
|
||||
const QString &label, bool isMine, const QString &purpose, int status)
|
||||
{
|
||||
// Update address book model from Bitcoin core
|
||||
priv->updateEntry(address, label, isMine, purpose, status);
|
||||
}
|
||||
|
||||
QString AddressTableModel::addRow(const QString &type, const QString &label, const QString &address)
|
||||
{
|
||||
std::string strLabel = label.toStdString();
|
||||
std::string strAddress = address.toStdString();
|
||||
|
||||
editStatus = OK;
|
||||
|
||||
if(type == Send)
|
||||
{
|
||||
if(!walletModel->validateAddress(address))
|
||||
{
|
||||
editStatus = INVALID_ADDRESS;
|
||||
return QString();
|
||||
}
|
||||
// Check for duplicate addresses
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
if(wallet->mapAddressBook.count(CBitcoinAddress(strAddress).Get()))
|
||||
{
|
||||
editStatus = DUPLICATE_ADDRESS;
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(type == Receive)
|
||||
{
|
||||
// Generate a new address to associate with given label
|
||||
CPubKey newKey;
|
||||
if(!wallet->GetKeyFromPool(newKey))
|
||||
{
|
||||
WalletModel::UnlockContext ctx(walletModel->requestUnlock());
|
||||
if(!ctx.isValid())
|
||||
{
|
||||
// Unlock wallet failed or was cancelled
|
||||
editStatus = WALLET_UNLOCK_FAILURE;
|
||||
return QString();
|
||||
}
|
||||
if(!wallet->GetKeyFromPool(newKey))
|
||||
{
|
||||
editStatus = KEY_GENERATION_FAILURE;
|
||||
return QString();
|
||||
}
|
||||
}
|
||||
strAddress = CBitcoinAddress(newKey.GetID()).ToString();
|
||||
}
|
||||
else
|
||||
{
|
||||
return QString();
|
||||
}
|
||||
|
||||
// Add entry
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
wallet->SetAddressBook(CBitcoinAddress(strAddress).Get(), strLabel,
|
||||
(type == Send ? "send" : "receive"));
|
||||
}
|
||||
return QString::fromStdString(strAddress);
|
||||
}
|
||||
|
||||
bool AddressTableModel::removeRows(int row, int count, const QModelIndex &parent)
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
AddressTableEntry *rec = priv->index(row);
|
||||
if(count != 1 || !rec || rec->type == AddressTableEntry::Receiving)
|
||||
{
|
||||
// Can only remove one row at a time, and cannot remove rows not in model.
|
||||
// Also refuse to remove receiving addresses.
|
||||
return false;
|
||||
}
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
wallet->DelAddressBook(CBitcoinAddress(rec->address.toStdString()).Get());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Look up label for address in address book, if not found return empty string.
|
||||
*/
|
||||
QString AddressTableModel::labelForAddress(const QString &address) const
|
||||
{
|
||||
{
|
||||
LOCK(wallet->cs_wallet);
|
||||
CBitcoinAddress address_parsed(address.toStdString());
|
||||
std::map<CTxDestination, CAddressBookData>::iterator mi = wallet->mapAddressBook.find(address_parsed.Get());
|
||||
if (mi != wallet->mapAddressBook.end())
|
||||
{
|
||||
return QString::fromStdString(mi->second.name);
|
||||
}
|
||||
}
|
||||
return QString();
|
||||
}
|
||||
|
||||
int AddressTableModel::lookupAddress(const QString &address) const
|
||||
{
|
||||
QModelIndexList lst = match(index(0, Address, QModelIndex()),
|
||||
Qt::EditRole, address, 1, Qt::MatchExactly);
|
||||
if(lst.isEmpty())
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return lst.at(0).row();
|
||||
}
|
||||
}
|
||||
|
||||
void AddressTableModel::emitDataChanged(int idx)
|
||||
{
|
||||
Q_EMIT dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length()-1, QModelIndex()));
|
||||
}
|
|
@ -1,95 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_ADDRESSTABLEMODEL_H
|
||||
#define BITCOIN_QT_ADDRESSTABLEMODEL_H
|
||||
|
||||
#include <QAbstractTableModel>
|
||||
#include <QStringList>
|
||||
|
||||
class AddressTablePriv;
|
||||
class WalletModel;
|
||||
|
||||
class CWallet;
|
||||
|
||||
/**
|
||||
Qt model of the address book in the core. This allows views to access and modify the address book.
|
||||
*/
|
||||
class AddressTableModel : public QAbstractTableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AddressTableModel(CWallet *wallet, WalletModel *parent = 0);
|
||||
~AddressTableModel();
|
||||
|
||||
enum ColumnIndex {
|
||||
Label = 0, /**< User specified label */
|
||||
Address = 1 /**< Bitcoin address */
|
||||
};
|
||||
|
||||
enum RoleIndex {
|
||||
TypeRole = Qt::UserRole /**< Type of address (#Send or #Receive) */
|
||||
};
|
||||
|
||||
/** Return status of edit/insert operation */
|
||||
enum EditStatus {
|
||||
OK, /**< Everything ok */
|
||||
NO_CHANGES, /**< No changes were made during edit operation */
|
||||
INVALID_ADDRESS, /**< Unparseable address */
|
||||
DUPLICATE_ADDRESS, /**< Address already in address book */
|
||||
WALLET_UNLOCK_FAILURE, /**< Wallet could not be unlocked to create new receiving address */
|
||||
KEY_GENERATION_FAILURE /**< Generating a new public key for a receiving address failed */
|
||||
};
|
||||
|
||||
static const QString Send; /**< Specifies send address */
|
||||
static const QString Receive; /**< Specifies receive address */
|
||||
|
||||
/** @name Methods overridden from QAbstractTableModel
|
||||
@{*/
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
int columnCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role);
|
||||
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
|
||||
QModelIndex index(int row, int column, const QModelIndex &parent) const;
|
||||
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex());
|
||||
Qt::ItemFlags flags(const QModelIndex &index) const;
|
||||
/*@}*/
|
||||
|
||||
/* Add an address to the model.
|
||||
Returns the added address on success, and an empty string otherwise.
|
||||
*/
|
||||
QString addRow(const QString &type, const QString &label, const QString &address);
|
||||
|
||||
/* Look up label for address in address book, if not found return empty string.
|
||||
*/
|
||||
QString labelForAddress(const QString &address) const;
|
||||
|
||||
/* Look up row index of an address in the model.
|
||||
Return -1 if not found.
|
||||
*/
|
||||
int lookupAddress(const QString &address) const;
|
||||
|
||||
EditStatus getEditStatus() const { return editStatus; }
|
||||
|
||||
private:
|
||||
WalletModel *walletModel;
|
||||
CWallet *wallet;
|
||||
AddressTablePriv *priv;
|
||||
QStringList columns;
|
||||
EditStatus editStatus;
|
||||
|
||||
/** Notify listeners that data changed. */
|
||||
void emitDataChanged(int index);
|
||||
|
||||
public Q_SLOTS:
|
||||
/* Update address list from core.
|
||||
*/
|
||||
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status);
|
||||
|
||||
friend class AddressTablePriv;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_ADDRESSTABLEMODEL_H
|
|
@ -1,258 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "askpassphrasedialog.h"
|
||||
#include "ui_askpassphrasedialog.h"
|
||||
|
||||
#include "guiconstants.h"
|
||||
#include "walletmodel.h"
|
||||
|
||||
#include "support/allocators/secure.h"
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QMessageBox>
|
||||
#include <QPushButton>
|
||||
|
||||
AskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::AskPassphraseDialog),
|
||||
mode(mode),
|
||||
model(0),
|
||||
fCapsLock(false)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
ui->passEdit1->setMinimumSize(ui->passEdit1->sizeHint());
|
||||
ui->passEdit2->setMinimumSize(ui->passEdit2->sizeHint());
|
||||
ui->passEdit3->setMinimumSize(ui->passEdit3->sizeHint());
|
||||
|
||||
ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE);
|
||||
ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE);
|
||||
ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE);
|
||||
|
||||
// Setup Caps Lock detection.
|
||||
ui->passEdit1->installEventFilter(this);
|
||||
ui->passEdit2->installEventFilter(this);
|
||||
ui->passEdit3->installEventFilter(this);
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case Encrypt: // Ask passphrase x2
|
||||
ui->warningLabel->setText(tr("Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>ten or more random characters</b>, or <b>eight or more words</b>."));
|
||||
ui->passLabel1->hide();
|
||||
ui->passEdit1->hide();
|
||||
setWindowTitle(tr("Encrypt wallet"));
|
||||
break;
|
||||
case Unlock: // Ask passphrase
|
||||
ui->warningLabel->setText(tr("This operation needs your wallet passphrase to unlock the wallet."));
|
||||
ui->passLabel2->hide();
|
||||
ui->passEdit2->hide();
|
||||
ui->passLabel3->hide();
|
||||
ui->passEdit3->hide();
|
||||
setWindowTitle(tr("Unlock wallet"));
|
||||
break;
|
||||
case Decrypt: // Ask passphrase
|
||||
ui->warningLabel->setText(tr("This operation needs your wallet passphrase to decrypt the wallet."));
|
||||
ui->passLabel2->hide();
|
||||
ui->passEdit2->hide();
|
||||
ui->passLabel3->hide();
|
||||
ui->passEdit3->hide();
|
||||
setWindowTitle(tr("Decrypt wallet"));
|
||||
break;
|
||||
case ChangePass: // Ask old passphrase + new passphrase x2
|
||||
setWindowTitle(tr("Change passphrase"));
|
||||
ui->warningLabel->setText(tr("Enter the old passphrase and new passphrase to the wallet."));
|
||||
break;
|
||||
}
|
||||
textChanged();
|
||||
connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
||||
connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
||||
connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));
|
||||
}
|
||||
|
||||
AskPassphraseDialog::~AskPassphraseDialog()
|
||||
{
|
||||
// Attempt to overwrite text so that they do not linger around in memory
|
||||
ui->passEdit1->setText(QString(" ").repeated(ui->passEdit1->text().size()));
|
||||
ui->passEdit2->setText(QString(" ").repeated(ui->passEdit2->text().size()));
|
||||
ui->passEdit3->setText(QString(" ").repeated(ui->passEdit3->text().size()));
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void AskPassphraseDialog::setModel(WalletModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
}
|
||||
|
||||
void AskPassphraseDialog::accept()
|
||||
{
|
||||
SecureString oldpass, newpass1, newpass2;
|
||||
if(!model)
|
||||
return;
|
||||
oldpass.reserve(MAX_PASSPHRASE_SIZE);
|
||||
newpass1.reserve(MAX_PASSPHRASE_SIZE);
|
||||
newpass2.reserve(MAX_PASSPHRASE_SIZE);
|
||||
// TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string)
|
||||
// Alternately, find a way to make this input mlock()'d to begin with.
|
||||
oldpass.assign(ui->passEdit1->text().toStdString().c_str());
|
||||
newpass1.assign(ui->passEdit2->text().toStdString().c_str());
|
||||
newpass2.assign(ui->passEdit3->text().toStdString().c_str());
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case Encrypt: {
|
||||
if(newpass1.empty() || newpass2.empty())
|
||||
{
|
||||
// Cannot encrypt with empty passphrase
|
||||
break;
|
||||
}
|
||||
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm wallet encryption"),
|
||||
tr("Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR BITCOINS</b>!") + "<br><br>" + tr("Are you sure you wish to encrypt your wallet?"),
|
||||
QMessageBox::Yes|QMessageBox::Cancel,
|
||||
QMessageBox::Cancel);
|
||||
if(retval == QMessageBox::Yes)
|
||||
{
|
||||
if(newpass1 == newpass2)
|
||||
{
|
||||
if(model->setWalletEncrypted(true, newpass1))
|
||||
{
|
||||
QMessageBox::warning(this, tr("Wallet encrypted"),
|
||||
"<qt>" +
|
||||
tr("Bitcoin Core will close now to finish the encryption process. "
|
||||
"Remember that encrypting your wallet cannot fully protect "
|
||||
"your bitcoins from being stolen by malware infecting your computer.") +
|
||||
"<br><br><b>" +
|
||||
tr("IMPORTANT: Any previous backups you have made of your wallet file "
|
||||
"should be replaced with the newly generated, encrypted wallet file. "
|
||||
"For security reasons, previous backups of the unencrypted wallet file "
|
||||
"will become useless as soon as you start using the new, encrypted wallet.") +
|
||||
"</b></qt>");
|
||||
QApplication::quit();
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wallet encryption failed"),
|
||||
tr("Wallet encryption failed due to an internal error. Your wallet was not encrypted."));
|
||||
}
|
||||
QDialog::accept(); // Success
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wallet encryption failed"),
|
||||
tr("The supplied passphrases do not match."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QDialog::reject(); // Cancelled
|
||||
}
|
||||
} break;
|
||||
case Unlock:
|
||||
if(!model->setWalletLocked(false, oldpass))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wallet unlock failed"),
|
||||
tr("The passphrase entered for the wallet decryption was incorrect."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QDialog::accept(); // Success
|
||||
}
|
||||
break;
|
||||
case Decrypt:
|
||||
if(!model->setWalletEncrypted(false, oldpass))
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wallet decryption failed"),
|
||||
tr("The passphrase entered for the wallet decryption was incorrect."));
|
||||
}
|
||||
else
|
||||
{
|
||||
QDialog::accept(); // Success
|
||||
}
|
||||
break;
|
||||
case ChangePass:
|
||||
if(newpass1 == newpass2)
|
||||
{
|
||||
if(model->changePassphrase(oldpass, newpass1))
|
||||
{
|
||||
QMessageBox::information(this, tr("Wallet encrypted"),
|
||||
tr("Wallet passphrase was successfully changed."));
|
||||
QDialog::accept(); // Success
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wallet encryption failed"),
|
||||
tr("The passphrase entered for the wallet decryption was incorrect."));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
QMessageBox::critical(this, tr("Wallet encryption failed"),
|
||||
tr("The supplied passphrases do not match."));
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void AskPassphraseDialog::textChanged()
|
||||
{
|
||||
// Validate input, set Ok button to enabled when acceptable
|
||||
bool acceptable = false;
|
||||
switch(mode)
|
||||
{
|
||||
case Encrypt: // New passphrase x2
|
||||
acceptable = !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
|
||||
break;
|
||||
case Unlock: // Old passphrase x1
|
||||
case Decrypt:
|
||||
acceptable = !ui->passEdit1->text().isEmpty();
|
||||
break;
|
||||
case ChangePass: // Old passphrase x1, new passphrase x2
|
||||
acceptable = !ui->passEdit1->text().isEmpty() && !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();
|
||||
break;
|
||||
}
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(acceptable);
|
||||
}
|
||||
|
||||
bool AskPassphraseDialog::event(QEvent *event)
|
||||
{
|
||||
// Detect Caps Lock key press.
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
if (ke->key() == Qt::Key_CapsLock) {
|
||||
fCapsLock = !fCapsLock;
|
||||
}
|
||||
if (fCapsLock) {
|
||||
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));
|
||||
} else {
|
||||
ui->capsLabel->clear();
|
||||
}
|
||||
}
|
||||
return QWidget::event(event);
|
||||
}
|
||||
|
||||
bool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
/* Detect Caps Lock.
|
||||
* There is no good OS-independent way to check a key state in Qt, but we
|
||||
* can detect Caps Lock by checking for the following condition:
|
||||
* Shift key is down and the result is a lower case character, or
|
||||
* Shift key is not down and the result is an upper case character.
|
||||
*/
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent *ke = static_cast<QKeyEvent *>(event);
|
||||
QString str = ke->text();
|
||||
if (str.length() != 0) {
|
||||
const QChar *psz = str.unicode();
|
||||
bool fShift = (ke->modifiers() & Qt::ShiftModifier) != 0;
|
||||
if ((fShift && *psz >= 'a' && *psz <= 'z') || (!fShift && *psz >= 'A' && *psz <= 'Z')) {
|
||||
fCapsLock = true;
|
||||
ui->capsLabel->setText(tr("Warning: The Caps Lock key is on!"));
|
||||
} else if (psz->isLetter()) {
|
||||
fCapsLock = false;
|
||||
ui->capsLabel->clear();
|
||||
}
|
||||
}
|
||||
}
|
||||
return QDialog::eventFilter(object, event);
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_ASKPASSPHRASEDIALOG_H
|
||||
#define BITCOIN_QT_ASKPASSPHRASEDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class WalletModel;
|
||||
|
||||
namespace Ui {
|
||||
class AskPassphraseDialog;
|
||||
}
|
||||
|
||||
/** Multifunctional dialog to ask for passphrases. Used for encryption, unlocking, and changing the passphrase.
|
||||
*/
|
||||
class AskPassphraseDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Mode {
|
||||
Encrypt, /**< Ask passphrase twice and encrypt */
|
||||
Unlock, /**< Ask passphrase and unlock */
|
||||
ChangePass, /**< Ask old passphrase + new passphrase twice */
|
||||
Decrypt /**< Ask passphrase and decrypt wallet */
|
||||
};
|
||||
|
||||
explicit AskPassphraseDialog(Mode mode, QWidget *parent);
|
||||
~AskPassphraseDialog();
|
||||
|
||||
void accept();
|
||||
|
||||
void setModel(WalletModel *model);
|
||||
|
||||
private:
|
||||
Ui::AskPassphraseDialog *ui;
|
||||
Mode mode;
|
||||
WalletModel *model;
|
||||
bool fCapsLock;
|
||||
|
||||
private Q_SLOTS:
|
||||
void textChanged();
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_ASKPASSPHRASEDIALOG_H
|
|
@ -1,658 +0,0 @@
|
|||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#endif
|
||||
|
||||
#include "bitcoingui.h"
|
||||
|
||||
#include "clientmodel.h"
|
||||
#include "guiconstants.h"
|
||||
#include "guiutil.h"
|
||||
#include "intro.h"
|
||||
#include "networkstyle.h"
|
||||
#include "optionsmodel.h"
|
||||
#include "splashscreen.h"
|
||||
#include "utilitydialog.h"
|
||||
#include "winshutdownmonitor.h"
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "paymentserver.h"
|
||||
#include "walletmodel.h"
|
||||
#endif
|
||||
|
||||
#include "init.h"
|
||||
#include "main.h"
|
||||
#include "rpcserver.h"
|
||||
#include "scheduler.h"
|
||||
#include "ui_interface.h"
|
||||
#include "util.h"
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
#include "wallet/wallet.h"
|
||||
#endif
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/filesystem/operations.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
#include <QLibraryInfo>
|
||||
#include <QLocale>
|
||||
#include <QMessageBox>
|
||||
#include <QSettings>
|
||||
#include <QThread>
|
||||
#include <QTimer>
|
||||
#include <QTranslator>
|
||||
#include <QSslConfiguration>
|
||||
|
||||
#if defined(QT_STATICPLUGIN)
|
||||
#include <QtPlugin>
|
||||
#if QT_VERSION < 0x050000
|
||||
Q_IMPORT_PLUGIN(qcncodecs)
|
||||
Q_IMPORT_PLUGIN(qjpcodecs)
|
||||
Q_IMPORT_PLUGIN(qtwcodecs)
|
||||
Q_IMPORT_PLUGIN(qkrcodecs)
|
||||
Q_IMPORT_PLUGIN(qtaccessiblewidgets)
|
||||
#else
|
||||
#if QT_VERSION < 0x050400
|
||||
Q_IMPORT_PLUGIN(AccessibleFactory)
|
||||
#endif
|
||||
#if defined(QT_QPA_PLATFORM_XCB)
|
||||
Q_IMPORT_PLUGIN(QXcbIntegrationPlugin);
|
||||
#elif defined(QT_QPA_PLATFORM_WINDOWS)
|
||||
Q_IMPORT_PLUGIN(QWindowsIntegrationPlugin);
|
||||
#elif defined(QT_QPA_PLATFORM_COCOA)
|
||||
Q_IMPORT_PLUGIN(QCocoaIntegrationPlugin);
|
||||
#endif
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if QT_VERSION < 0x050000
|
||||
#include <QTextCodec>
|
||||
#endif
|
||||
|
||||
// Declare meta types used for QMetaObject::invokeMethod
|
||||
Q_DECLARE_METATYPE(bool*)
|
||||
Q_DECLARE_METATYPE(CAmount)
|
||||
|
||||
static void InitMessage(const std::string &message)
|
||||
{
|
||||
LogPrintf("init message: %s\n", message);
|
||||
}
|
||||
|
||||
/*
|
||||
Translate string to current locale using Qt.
|
||||
*/
|
||||
static std::string Translate(const char* psz)
|
||||
{
|
||||
return QCoreApplication::translate("bitcoin-core", psz).toStdString();
|
||||
}
|
||||
|
||||
static QString GetLangTerritory()
|
||||
{
|
||||
QSettings settings;
|
||||
// Get desired locale (e.g. "de_DE")
|
||||
// 1) System default language
|
||||
QString lang_territory = QLocale::system().name();
|
||||
// 2) Language from QSettings
|
||||
QString lang_territory_qsettings = settings.value("language", "").toString();
|
||||
if(!lang_territory_qsettings.isEmpty())
|
||||
lang_territory = lang_territory_qsettings;
|
||||
// 3) -lang command line argument
|
||||
lang_territory = QString::fromStdString(GetArg("-lang", lang_territory.toStdString()));
|
||||
return lang_territory;
|
||||
}
|
||||
|
||||
/** Set up translations */
|
||||
static void initTranslations(QTranslator &qtTranslatorBase, QTranslator &qtTranslator, QTranslator &translatorBase, QTranslator &translator)
|
||||
{
|
||||
// Remove old translators
|
||||
QApplication::removeTranslator(&qtTranslatorBase);
|
||||
QApplication::removeTranslator(&qtTranslator);
|
||||
QApplication::removeTranslator(&translatorBase);
|
||||
QApplication::removeTranslator(&translator);
|
||||
|
||||
// Get desired locale (e.g. "de_DE")
|
||||
// 1) System default language
|
||||
QString lang_territory = GetLangTerritory();
|
||||
|
||||
// Convert to "de" only by truncating "_DE"
|
||||
QString lang = lang_territory;
|
||||
lang.truncate(lang_territory.lastIndexOf('_'));
|
||||
|
||||
// Load language files for configured locale:
|
||||
// - First load the translator for the base language, without territory
|
||||
// - Then load the more specific locale translator
|
||||
|
||||
// Load e.g. qt_de.qm
|
||||
if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
||||
QApplication::installTranslator(&qtTranslatorBase);
|
||||
|
||||
// Load e.g. qt_de_DE.qm
|
||||
if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
|
||||
QApplication::installTranslator(&qtTranslator);
|
||||
|
||||
// Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc)
|
||||
if (translatorBase.load(lang, ":/translations/"))
|
||||
QApplication::installTranslator(&translatorBase);
|
||||
|
||||
// Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc)
|
||||
if (translator.load(lang_territory, ":/translations/"))
|
||||
QApplication::installTranslator(&translator);
|
||||
}
|
||||
|
||||
/* qDebug() message handler --> debug.log */
|
||||
#if QT_VERSION < 0x050000
|
||||
void DebugMessageHandler(QtMsgType type, const char *msg)
|
||||
{
|
||||
const char *category = (type == QtDebugMsg) ? "qt" : NULL;
|
||||
LogPrint(category, "GUI: %s\n", msg);
|
||||
}
|
||||
#else
|
||||
void DebugMessageHandler(QtMsgType type, const QMessageLogContext& context, const QString &msg)
|
||||
{
|
||||
Q_UNUSED(context);
|
||||
const char *category = (type == QtDebugMsg) ? "qt" : NULL;
|
||||
LogPrint(category, "GUI: %s\n", msg.toStdString());
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Class encapsulating Bitcoin Core startup and shutdown.
|
||||
* Allows running startup and shutdown in a different thread from the UI thread.
|
||||
*/
|
||||
class BitcoinCore: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BitcoinCore();
|
||||
|
||||
public Q_SLOTS:
|
||||
void initialize();
|
||||
void shutdown();
|
||||
|
||||
Q_SIGNALS:
|
||||
void initializeResult(int retval);
|
||||
void shutdownResult(int retval);
|
||||
void runawayException(const QString &message);
|
||||
|
||||
private:
|
||||
boost::thread_group threadGroup;
|
||||
CScheduler scheduler;
|
||||
|
||||
/// Pass fatal exception message to UI thread
|
||||
void handleRunawayException(const std::exception *e);
|
||||
};
|
||||
|
||||
/** Main Bitcoin application object */
|
||||
class BitcoinApplication: public QApplication
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit BitcoinApplication(int &argc, char **argv);
|
||||
~BitcoinApplication();
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
/// Create payment server
|
||||
void createPaymentServer();
|
||||
#endif
|
||||
/// Create options model
|
||||
void createOptionsModel();
|
||||
/// Create main window
|
||||
void createWindow(const NetworkStyle *networkStyle);
|
||||
/// Create splash screen
|
||||
void createSplashScreen(const NetworkStyle *networkStyle);
|
||||
|
||||
/// Request core initialization
|
||||
void requestInitialize();
|
||||
/// Request core shutdown
|
||||
void requestShutdown();
|
||||
|
||||
/// Get process return value
|
||||
int getReturnValue() { return returnValue; }
|
||||
|
||||
/// Get window identifier of QMainWindow (BitcoinGUI)
|
||||
WId getMainWinId() const;
|
||||
|
||||
public Q_SLOTS:
|
||||
void initializeResult(int retval);
|
||||
void shutdownResult(int retval);
|
||||
/// Handle runaway exceptions. Shows a message box with the problem and quits the program.
|
||||
void handleRunawayException(const QString &message);
|
||||
|
||||
Q_SIGNALS:
|
||||
void requestedInitialize();
|
||||
void requestedShutdown();
|
||||
void stopThread();
|
||||
void splashFinished(QWidget *window);
|
||||
|
||||
private:
|
||||
QThread *coreThread;
|
||||
OptionsModel *optionsModel;
|
||||
ClientModel *clientModel;
|
||||
BitcoinGUI *window;
|
||||
QTimer *pollShutdownTimer;
|
||||
#ifdef ENABLE_WALLET
|
||||
PaymentServer* paymentServer;
|
||||
WalletModel *walletModel;
|
||||
#endif
|
||||
int returnValue;
|
||||
|
||||
void startThread();
|
||||
};
|
||||
|
||||
#include "bitcoin.moc"
|
||||
|
||||
BitcoinCore::BitcoinCore():
|
||||
QObject()
|
||||
{
|
||||
}
|
||||
|
||||
void BitcoinCore::handleRunawayException(const std::exception *e)
|
||||
{
|
||||
PrintExceptionContinue(e, "Runaway exception");
|
||||
Q_EMIT runawayException(QString::fromStdString(strMiscWarning));
|
||||
}
|
||||
|
||||
void BitcoinCore::initialize()
|
||||
{
|
||||
try
|
||||
{
|
||||
qDebug() << __func__ << ": Running AppInit2 in thread";
|
||||
int rv = AppInit2(threadGroup, scheduler);
|
||||
if(rv)
|
||||
{
|
||||
/* Start a dummy RPC thread if no RPC thread is active yet
|
||||
* to handle timeouts.
|
||||
*/
|
||||
StartDummyRPCThread();
|
||||
}
|
||||
Q_EMIT initializeResult(rv);
|
||||
} catch (const std::exception& e) {
|
||||
handleRunawayException(&e);
|
||||
} catch (...) {
|
||||
handleRunawayException(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
void BitcoinCore::shutdown()
|
||||
{
|
||||
try
|
||||
{
|
||||
qDebug() << __func__ << ": Running Shutdown in thread";
|
||||
threadGroup.interrupt_all();
|
||||
threadGroup.join_all();
|
||||
Shutdown();
|
||||
qDebug() << __func__ << ": Shutdown finished";
|
||||
Q_EMIT shutdownResult(1);
|
||||
} catch (const std::exception& e) {
|
||||
handleRunawayException(&e);
|
||||
} catch (...) {
|
||||
handleRunawayException(NULL);
|
||||
}
|
||||
}
|
||||
|
||||
BitcoinApplication::BitcoinApplication(int &argc, char **argv):
|
||||
QApplication(argc, argv),
|
||||
coreThread(0),
|
||||
optionsModel(0),
|
||||
clientModel(0),
|
||||
window(0),
|
||||
pollShutdownTimer(0),
|
||||
#ifdef ENABLE_WALLET
|
||||
paymentServer(0),
|
||||
walletModel(0),
|
||||
#endif
|
||||
returnValue(0)
|
||||
{
|
||||
setQuitOnLastWindowClosed(false);
|
||||
}
|
||||
|
||||
BitcoinApplication::~BitcoinApplication()
|
||||
{
|
||||
if(coreThread)
|
||||
{
|
||||
qDebug() << __func__ << ": Stopping thread";
|
||||
Q_EMIT stopThread();
|
||||
coreThread->wait();
|
||||
qDebug() << __func__ << ": Stopped thread";
|
||||
}
|
||||
|
||||
delete window;
|
||||
window = 0;
|
||||
#ifdef ENABLE_WALLET
|
||||
delete paymentServer;
|
||||
paymentServer = 0;
|
||||
#endif
|
||||
delete optionsModel;
|
||||
optionsModel = 0;
|
||||
}
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
void BitcoinApplication::createPaymentServer()
|
||||
{
|
||||
paymentServer = new PaymentServer(this);
|
||||
}
|
||||
#endif
|
||||
|
||||
void BitcoinApplication::createOptionsModel()
|
||||
{
|
||||
optionsModel = new OptionsModel();
|
||||
}
|
||||
|
||||
void BitcoinApplication::createWindow(const NetworkStyle *networkStyle)
|
||||
{
|
||||
window = new BitcoinGUI(networkStyle, 0);
|
||||
|
||||
pollShutdownTimer = new QTimer(window);
|
||||
connect(pollShutdownTimer, SIGNAL(timeout()), window, SLOT(detectShutdown()));
|
||||
pollShutdownTimer->start(200);
|
||||
}
|
||||
|
||||
void BitcoinApplication::createSplashScreen(const NetworkStyle *networkStyle)
|
||||
{
|
||||
SplashScreen *splash = new SplashScreen(0, networkStyle);
|
||||
// We don't hold a direct pointer to the splash screen after creation, so use
|
||||
// Qt::WA_DeleteOnClose to make sure that the window will be deleted eventually.
|
||||
splash->setAttribute(Qt::WA_DeleteOnClose);
|
||||
splash->show();
|
||||
connect(this, SIGNAL(splashFinished(QWidget*)), splash, SLOT(slotFinish(QWidget*)));
|
||||
}
|
||||
|
||||
void BitcoinApplication::startThread()
|
||||
{
|
||||
if(coreThread)
|
||||
return;
|
||||
coreThread = new QThread(this);
|
||||
BitcoinCore *executor = new BitcoinCore();
|
||||
executor->moveToThread(coreThread);
|
||||
|
||||
/* communication to and from thread */
|
||||
connect(executor, SIGNAL(initializeResult(int)), this, SLOT(initializeResult(int)));
|
||||
connect(executor, SIGNAL(shutdownResult(int)), this, SLOT(shutdownResult(int)));
|
||||
connect(executor, SIGNAL(runawayException(QString)), this, SLOT(handleRunawayException(QString)));
|
||||
connect(this, SIGNAL(requestedInitialize()), executor, SLOT(initialize()));
|
||||
connect(this, SIGNAL(requestedShutdown()), executor, SLOT(shutdown()));
|
||||
/* make sure executor object is deleted in its own thread */
|
||||
connect(this, SIGNAL(stopThread()), executor, SLOT(deleteLater()));
|
||||
connect(this, SIGNAL(stopThread()), coreThread, SLOT(quit()));
|
||||
|
||||
coreThread->start();
|
||||
}
|
||||
|
||||
void BitcoinApplication::requestInitialize()
|
||||
{
|
||||
qDebug() << __func__ << ": Requesting initialize";
|
||||
startThread();
|
||||
Q_EMIT requestedInitialize();
|
||||
}
|
||||
|
||||
void BitcoinApplication::requestShutdown()
|
||||
{
|
||||
qDebug() << __func__ << ": Requesting shutdown";
|
||||
startThread();
|
||||
window->hide();
|
||||
window->setClientModel(0);
|
||||
pollShutdownTimer->stop();
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
window->removeAllWallets();
|
||||
delete walletModel;
|
||||
walletModel = 0;
|
||||
#endif
|
||||
delete clientModel;
|
||||
clientModel = 0;
|
||||
|
||||
// Show a simple window indicating shutdown status
|
||||
ShutdownWindow::showShutdownWindow(window);
|
||||
|
||||
// Request shutdown from core thread
|
||||
Q_EMIT requestedShutdown();
|
||||
}
|
||||
|
||||
void BitcoinApplication::initializeResult(int retval)
|
||||
{
|
||||
qDebug() << __func__ << ": Initialization result: " << retval;
|
||||
// Set exit result: 0 if successful, 1 if failure
|
||||
returnValue = retval ? 0 : 1;
|
||||
if(retval)
|
||||
{
|
||||
#ifdef ENABLE_WALLET
|
||||
PaymentServer::LoadRootCAs();
|
||||
paymentServer->setOptionsModel(optionsModel);
|
||||
#endif
|
||||
|
||||
clientModel = new ClientModel(optionsModel);
|
||||
window->setClientModel(clientModel);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
if(pwalletMain)
|
||||
{
|
||||
walletModel = new WalletModel(pwalletMain, optionsModel);
|
||||
|
||||
window->addWallet(BitcoinGUI::DEFAULT_WALLET, walletModel);
|
||||
window->setCurrentWallet(BitcoinGUI::DEFAULT_WALLET);
|
||||
|
||||
connect(walletModel, SIGNAL(coinsSent(CWallet*,SendCoinsRecipient,QByteArray)),
|
||||
paymentServer, SLOT(fetchPaymentACK(CWallet*,const SendCoinsRecipient&,QByteArray)));
|
||||
}
|
||||
#endif
|
||||
|
||||
// If -min option passed, start window minimized.
|
||||
if(GetBoolArg("-min", false))
|
||||
{
|
||||
window->showMinimized();
|
||||
}
|
||||
else
|
||||
{
|
||||
window->show();
|
||||
}
|
||||
Q_EMIT splashFinished(window);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
// Now that initialization/startup is done, process any command-line
|
||||
// bitcoin: URIs or payment requests:
|
||||
connect(paymentServer, SIGNAL(receivedPaymentRequest(SendCoinsRecipient)),
|
||||
window, SLOT(handlePaymentRequest(SendCoinsRecipient)));
|
||||
connect(window, SIGNAL(receivedURI(QString)),
|
||||
paymentServer, SLOT(handleURIOrFile(QString)));
|
||||
connect(paymentServer, SIGNAL(message(QString,QString,unsigned int)),
|
||||
window, SLOT(message(QString,QString,unsigned int)));
|
||||
QTimer::singleShot(100, paymentServer, SLOT(uiReady()));
|
||||
#endif
|
||||
} else {
|
||||
quit(); // Exit main loop
|
||||
}
|
||||
}
|
||||
|
||||
void BitcoinApplication::shutdownResult(int retval)
|
||||
{
|
||||
qDebug() << __func__ << ": Shutdown result: " << retval;
|
||||
quit(); // Exit main loop after shutdown finished
|
||||
}
|
||||
|
||||
void BitcoinApplication::handleRunawayException(const QString &message)
|
||||
{
|
||||
QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Bitcoin can no longer continue safely and will quit.") + QString("\n\n") + message);
|
||||
::exit(1);
|
||||
}
|
||||
|
||||
WId BitcoinApplication::getMainWinId() const
|
||||
{
|
||||
if (!window)
|
||||
return 0;
|
||||
|
||||
return window->winId();
|
||||
}
|
||||
|
||||
#ifndef BITCOIN_QT_TEST
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
SetupEnvironment();
|
||||
|
||||
/// 1. Parse command-line options. These take precedence over anything else.
|
||||
// Command-line options take precedence:
|
||||
ParseParameters(argc, argv);
|
||||
|
||||
// Do not refer to data directory yet, this can be overridden by Intro::pickDataDirectory
|
||||
|
||||
/// 2. Basic Qt initialization (not dependent on parameters or configuration)
|
||||
#if QT_VERSION < 0x050000
|
||||
// Internal string conversion is all UTF-8
|
||||
QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
|
||||
QTextCodec::setCodecForCStrings(QTextCodec::codecForTr());
|
||||
#endif
|
||||
|
||||
Q_INIT_RESOURCE(bitcoin);
|
||||
Q_INIT_RESOURCE(bitcoin_locale);
|
||||
|
||||
BitcoinApplication app(argc, argv);
|
||||
#if QT_VERSION > 0x050100
|
||||
// Generate high-dpi pixmaps
|
||||
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
|
||||
#endif
|
||||
#ifdef Q_OS_MAC
|
||||
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
|
||||
#endif
|
||||
#if QT_VERSION >= 0x050500
|
||||
// Because of the POODLE attack it is recommended to disable SSLv3 (https://disablessl3.com/),
|
||||
// so set SSL protocols to TLS1.0+.
|
||||
QSslConfiguration sslconf = QSslConfiguration::defaultConfiguration();
|
||||
sslconf.setProtocol(QSsl::TlsV1_0OrLater);
|
||||
QSslConfiguration::setDefaultConfiguration(sslconf);
|
||||
#endif
|
||||
|
||||
// Register meta types used for QMetaObject::invokeMethod
|
||||
qRegisterMetaType< bool* >();
|
||||
// Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType)
|
||||
// IMPORTANT if it is no longer a typedef use the normal variant above
|
||||
qRegisterMetaType< CAmount >("CAmount");
|
||||
|
||||
/// 3. Application identification
|
||||
// must be set before OptionsModel is initialized or translations are loaded,
|
||||
// as it is used to locate QSettings
|
||||
QApplication::setOrganizationName(QAPP_ORG_NAME);
|
||||
QApplication::setOrganizationDomain(QAPP_ORG_DOMAIN);
|
||||
QApplication::setApplicationName(QAPP_APP_NAME_DEFAULT);
|
||||
GUIUtil::SubstituteFonts(GetLangTerritory());
|
||||
|
||||
/// 4. Initialization of translations, so that intro dialog is in user's language
|
||||
// Now that QSettings are accessible, initialize translations
|
||||
QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator;
|
||||
initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
|
||||
translationInterface.Translate.connect(Translate);
|
||||
|
||||
// Show help message immediately after parsing command-line options (for "-lang") and setting locale,
|
||||
// but before showing splash screen.
|
||||
if (mapArgs.count("-?") || mapArgs.count("-h") || mapArgs.count("-help") || mapArgs.count("-version"))
|
||||
{
|
||||
HelpMessageDialog help(NULL, mapArgs.count("-version"));
|
||||
help.showOrPrint();
|
||||
return 1;
|
||||
}
|
||||
|
||||
/// 5. Now that settings and translations are available, ask user for data directory
|
||||
// User language is set up: pick a data directory
|
||||
Intro::pickDataDirectory();
|
||||
|
||||
/// 6. Determine availability of data directory and parse zcash.conf
|
||||
/// - Do not call GetDataDir(true) before this step finishes
|
||||
if (!boost::filesystem::is_directory(GetDataDir(false)))
|
||||
{
|
||||
QMessageBox::critical(0, QObject::tr("Bitcoin Core"),
|
||||
QObject::tr("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"])));
|
||||
return 1;
|
||||
}
|
||||
try {
|
||||
ReadConfigFile(mapArgs, mapMultiArgs);
|
||||
} catch (const std::exception& e) {
|
||||
QMessageBox::critical(0, QObject::tr("Bitcoin Core"),
|
||||
QObject::tr("Error: Cannot parse configuration file: %1. Only use key=value syntax.").arg(e.what()));
|
||||
return false;
|
||||
}
|
||||
|
||||
/// 7. Determine network (and switch to network specific options)
|
||||
// - Do not call Params() before this step
|
||||
// - Do this after parsing the configuration file, as the network can be switched there
|
||||
// - QSettings() will use the new application name after this, resulting in network-specific settings
|
||||
// - Needs to be done before createOptionsModel
|
||||
|
||||
// Check for -testnet or -regtest parameter (Params() calls are only valid after this clause)
|
||||
if (!SelectParamsFromCommandLine()) {
|
||||
QMessageBox::critical(0, QObject::tr("Bitcoin Core"), QObject::tr("Error: Invalid combination of -regtest and -testnet."));
|
||||
return 1;
|
||||
}
|
||||
#ifdef ENABLE_WALLET
|
||||
// Parse URIs on command line -- this can affect Params()
|
||||
PaymentServer::ipcParseCommandLine(argc, argv);
|
||||
#endif
|
||||
|
||||
QScopedPointer<const NetworkStyle> networkStyle(NetworkStyle::instantiate(QString::fromStdString(Params().NetworkIDString())));
|
||||
assert(!networkStyle.isNull());
|
||||
// Allow for separate UI settings for testnets
|
||||
QApplication::setApplicationName(networkStyle->getAppName());
|
||||
// Re-initialize translations after changing application name (language in network-specific settings can be different)
|
||||
initTranslations(qtTranslatorBase, qtTranslator, translatorBase, translator);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
/// 8. URI IPC sending
|
||||
// - Do this early as we don't want to bother initializing if we are just calling IPC
|
||||
// - Do this *after* setting up the data directory, as the data directory hash is used in the name
|
||||
// of the server.
|
||||
// - Do this after creating app and setting up translations, so errors are
|
||||
// translated properly.
|
||||
if (PaymentServer::ipcSendCommandLine())
|
||||
exit(0);
|
||||
|
||||
// Start up the payment server early, too, so impatient users that click on
|
||||
// bitcoin: links repeatedly have their payment requests routed to this process:
|
||||
app.createPaymentServer();
|
||||
#endif
|
||||
|
||||
/// 9. Main GUI initialization
|
||||
// Install global event filter that makes sure that long tooltips can be word-wrapped
|
||||
app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app));
|
||||
#if QT_VERSION < 0x050000
|
||||
// Install qDebug() message handler to route to debug.log
|
||||
qInstallMsgHandler(DebugMessageHandler);
|
||||
#else
|
||||
#if defined(Q_OS_WIN)
|
||||
// Install global event filter for processing Windows session related Windows messages (WM_QUERYENDSESSION and WM_ENDSESSION)
|
||||
qApp->installNativeEventFilter(new WinShutdownMonitor());
|
||||
#endif
|
||||
// Install qDebug() message handler to route to debug.log
|
||||
qInstallMessageHandler(DebugMessageHandler);
|
||||
#endif
|
||||
// Load GUI settings from QSettings
|
||||
app.createOptionsModel();
|
||||
|
||||
// Subscribe to global signals from core
|
||||
uiInterface.InitMessage.connect(InitMessage);
|
||||
|
||||
if (GetBoolArg("-splash", true) && !GetBoolArg("-min", false))
|
||||
app.createSplashScreen(networkStyle.data());
|
||||
|
||||
try
|
||||
{
|
||||
app.createWindow(networkStyle.data());
|
||||
app.requestInitialize();
|
||||
#if defined(Q_OS_WIN) && QT_VERSION >= 0x050000
|
||||
WinShutdownMonitor::registerShutdownBlockReason(QObject::tr("Bitcoin Core didn't yet exit safely..."), (HWND)app.getMainWinId());
|
||||
#endif
|
||||
app.exec();
|
||||
app.requestShutdown();
|
||||
app.exec();
|
||||
} catch (const std::exception& e) {
|
||||
PrintExceptionContinue(&e, "Runaway exception");
|
||||
app.handleRunawayException(QString::fromStdString(strMiscWarning));
|
||||
} catch (...) {
|
||||
PrintExceptionContinue(NULL, "Runaway exception");
|
||||
app.handleRunawayException(QString::fromStdString(strMiscWarning));
|
||||
}
|
||||
return app.getReturnValue();
|
||||
}
|
||||
#endif // BITCOIN_QT_TEST
|
|
@ -1,88 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/icons">
|
||||
<file alias="bitcoin">res/icons/bitcoin.png</file>
|
||||
<file alias="address-book">res/icons/address-book.png</file>
|
||||
<file alias="quit">res/icons/quit.png</file>
|
||||
<file alias="send">res/icons/send.png</file>
|
||||
<file alias="connect_0">res/icons/connect0.png</file>
|
||||
<file alias="connect_1">res/icons/connect1.png</file>
|
||||
<file alias="connect_2">res/icons/connect2.png</file>
|
||||
<file alias="connect_3">res/icons/connect3.png</file>
|
||||
<file alias="connect_4">res/icons/connect4.png</file>
|
||||
<file alias="transaction_0">res/icons/transaction0.png</file>
|
||||
<file alias="transaction_confirmed">res/icons/transaction2.png</file>
|
||||
<file alias="transaction_conflicted">res/icons/transaction_conflicted.png</file>
|
||||
<file alias="transaction_1">res/icons/clock1.png</file>
|
||||
<file alias="transaction_2">res/icons/clock2.png</file>
|
||||
<file alias="transaction_3">res/icons/clock3.png</file>
|
||||
<file alias="transaction_4">res/icons/clock4.png</file>
|
||||
<file alias="transaction_5">res/icons/clock5.png</file>
|
||||
<file alias="eye">res/icons/eye.png</file>
|
||||
<file alias="eye_minus">res/icons/eye_minus.png</file>
|
||||
<file alias="eye_plus">res/icons/eye_plus.png</file>
|
||||
<file alias="options">res/icons/configure.png</file>
|
||||
<file alias="receiving_addresses">res/icons/receive.png</file>
|
||||
<file alias="editpaste">res/icons/editpaste.png</file>
|
||||
<file alias="editcopy">res/icons/editcopy.png</file>
|
||||
<file alias="add">res/icons/add.png</file>
|
||||
<file alias="edit">res/icons/edit.png</file>
|
||||
<file alias="history">res/icons/history.png</file>
|
||||
<file alias="overview">res/icons/overview.png</file>
|
||||
<file alias="export">res/icons/export.png</file>
|
||||
<file alias="synced">res/icons/synced.png</file>
|
||||
<file alias="remove">res/icons/remove.png</file>
|
||||
<file alias="tx_mined">res/icons/tx_mined.png</file>
|
||||
<file alias="tx_input">res/icons/tx_input.png</file>
|
||||
<file alias="tx_output">res/icons/tx_output.png</file>
|
||||
<file alias="tx_inout">res/icons/tx_inout.png</file>
|
||||
<file alias="lock_closed">res/icons/lock_closed.png</file>
|
||||
<file alias="lock_open">res/icons/lock_open.png</file>
|
||||
<file alias="key">res/icons/key.png</file>
|
||||
<file alias="filesave">res/icons/filesave.png</file>
|
||||
<file alias="debugwindow">res/icons/debugwindow.png</file>
|
||||
<file alias="open">res/icons/open.png</file>
|
||||
<file alias="info">res/icons/info.png</file>
|
||||
<file alias="about">res/icons/about.png</file>
|
||||
<file alias="about_qt">res/icons/about_qt.png</file>
|
||||
<file alias="verify">res/icons/verify.png</file>
|
||||
<file alias="warning">res/icons/warning.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/movies">
|
||||
<file alias="spinner-000">res/movies/spinner-000.png</file>
|
||||
<file alias="spinner-001">res/movies/spinner-001.png</file>
|
||||
<file alias="spinner-002">res/movies/spinner-002.png</file>
|
||||
<file alias="spinner-003">res/movies/spinner-003.png</file>
|
||||
<file alias="spinner-004">res/movies/spinner-004.png</file>
|
||||
<file alias="spinner-005">res/movies/spinner-005.png</file>
|
||||
<file alias="spinner-006">res/movies/spinner-006.png</file>
|
||||
<file alias="spinner-007">res/movies/spinner-007.png</file>
|
||||
<file alias="spinner-008">res/movies/spinner-008.png</file>
|
||||
<file alias="spinner-009">res/movies/spinner-009.png</file>
|
||||
<file alias="spinner-010">res/movies/spinner-010.png</file>
|
||||
<file alias="spinner-011">res/movies/spinner-011.png</file>
|
||||
<file alias="spinner-012">res/movies/spinner-012.png</file>
|
||||
<file alias="spinner-013">res/movies/spinner-013.png</file>
|
||||
<file alias="spinner-014">res/movies/spinner-014.png</file>
|
||||
<file alias="spinner-015">res/movies/spinner-015.png</file>
|
||||
<file alias="spinner-016">res/movies/spinner-016.png</file>
|
||||
<file alias="spinner-017">res/movies/spinner-017.png</file>
|
||||
<file alias="spinner-018">res/movies/spinner-018.png</file>
|
||||
<file alias="spinner-019">res/movies/spinner-019.png</file>
|
||||
<file alias="spinner-020">res/movies/spinner-020.png</file>
|
||||
<file alias="spinner-021">res/movies/spinner-021.png</file>
|
||||
<file alias="spinner-022">res/movies/spinner-022.png</file>
|
||||
<file alias="spinner-023">res/movies/spinner-023.png</file>
|
||||
<file alias="spinner-024">res/movies/spinner-024.png</file>
|
||||
<file alias="spinner-025">res/movies/spinner-025.png</file>
|
||||
<file alias="spinner-026">res/movies/spinner-026.png</file>
|
||||
<file alias="spinner-027">res/movies/spinner-027.png</file>
|
||||
<file alias="spinner-028">res/movies/spinner-028.png</file>
|
||||
<file alias="spinner-029">res/movies/spinner-029.png</file>
|
||||
<file alias="spinner-030">res/movies/spinner-030.png</file>
|
||||
<file alias="spinner-031">res/movies/spinner-031.png</file>
|
||||
<file alias="spinner-032">res/movies/spinner-032.png</file>
|
||||
<file alias="spinner-033">res/movies/spinner-033.png</file>
|
||||
<file alias="spinner-034">res/movies/spinner-034.png</file>
|
||||
<file alias="spinner-035">res/movies/spinner-035.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,75 +0,0 @@
|
|||
<!DOCTYPE RCC><RCC version="1.0">
|
||||
<qresource prefix="/translations">
|
||||
<file alias="ach">locale/bitcoin_ach.qm</file>
|
||||
<file alias="af_ZA">locale/bitcoin_af_ZA.qm</file>
|
||||
<file alias="ar">locale/bitcoin_ar.qm</file>
|
||||
<file alias="be_BY">locale/bitcoin_be_BY.qm</file>
|
||||
<file alias="bg">locale/bitcoin_bg.qm</file>
|
||||
<file alias="bs">locale/bitcoin_bs.qm</file>
|
||||
<file alias="ca_ES">locale/bitcoin_ca_ES.qm</file>
|
||||
<file alias="ca">locale/bitcoin_ca.qm</file>
|
||||
<file alias="ca@valencia">locale/bitcoin_ca@valencia.qm</file>
|
||||
<file alias="cmn">locale/bitcoin_cmn.qm</file>
|
||||
<file alias="cs">locale/bitcoin_cs.qm</file>
|
||||
<file alias="cy">locale/bitcoin_cy.qm</file>
|
||||
<file alias="da">locale/bitcoin_da.qm</file>
|
||||
<file alias="de">locale/bitcoin_de.qm</file>
|
||||
<file alias="el_GR">locale/bitcoin_el_GR.qm</file>
|
||||
<file alias="en">locale/bitcoin_en.qm</file>
|
||||
<file alias="eo">locale/bitcoin_eo.qm</file>
|
||||
<file alias="es_CL">locale/bitcoin_es_CL.qm</file>
|
||||
<file alias="es_DO">locale/bitcoin_es_DO.qm</file>
|
||||
<file alias="es_MX">locale/bitcoin_es_MX.qm</file>
|
||||
<file alias="es">locale/bitcoin_es.qm</file>
|
||||
<file alias="es_UY">locale/bitcoin_es_UY.qm</file>
|
||||
<file alias="et">locale/bitcoin_et.qm</file>
|
||||
<file alias="eu_ES">locale/bitcoin_eu_ES.qm</file>
|
||||
<file alias="fa_IR">locale/bitcoin_fa_IR.qm</file>
|
||||
<file alias="fa">locale/bitcoin_fa.qm</file>
|
||||
<file alias="fi">locale/bitcoin_fi.qm</file>
|
||||
<file alias="fr_CA">locale/bitcoin_fr_CA.qm</file>
|
||||
<file alias="fr">locale/bitcoin_fr.qm</file>
|
||||
<file alias="gl">locale/bitcoin_gl.qm</file>
|
||||
<file alias="gu_IN">locale/bitcoin_gu_IN.qm</file>
|
||||
<file alias="he">locale/bitcoin_he.qm</file>
|
||||
<file alias="hi_IN">locale/bitcoin_hi_IN.qm</file>
|
||||
<file alias="hr">locale/bitcoin_hr.qm</file>
|
||||
<file alias="hu">locale/bitcoin_hu.qm</file>
|
||||
<file alias="id_ID">locale/bitcoin_id_ID.qm</file>
|
||||
<file alias="it">locale/bitcoin_it.qm</file>
|
||||
<file alias="ja">locale/bitcoin_ja.qm</file>
|
||||
<file alias="ka">locale/bitcoin_ka.qm</file>
|
||||
<file alias="kk_KZ">locale/bitcoin_kk_KZ.qm</file>
|
||||
<file alias="ko_KR">locale/bitcoin_ko_KR.qm</file>
|
||||
<file alias="ky">locale/bitcoin_ky.qm</file>
|
||||
<file alias="la">locale/bitcoin_la.qm</file>
|
||||
<file alias="lt">locale/bitcoin_lt.qm</file>
|
||||
<file alias="lv_LV">locale/bitcoin_lv_LV.qm</file>
|
||||
<file alias="mn">locale/bitcoin_mn.qm</file>
|
||||
<file alias="ms_MY">locale/bitcoin_ms_MY.qm</file>
|
||||
<file alias="nb">locale/bitcoin_nb.qm</file>
|
||||
<file alias="nl">locale/bitcoin_nl.qm</file>
|
||||
<file alias="pam">locale/bitcoin_pam.qm</file>
|
||||
<file alias="pl">locale/bitcoin_pl.qm</file>
|
||||
<file alias="pt_BR">locale/bitcoin_pt_BR.qm</file>
|
||||
<file alias="pt_PT">locale/bitcoin_pt_PT.qm</file>
|
||||
<file alias="ro_RO">locale/bitcoin_ro_RO.qm</file>
|
||||
<file alias="ru">locale/bitcoin_ru.qm</file>
|
||||
<file alias="sah">locale/bitcoin_sah.qm</file>
|
||||
<file alias="sk">locale/bitcoin_sk.qm</file>
|
||||
<file alias="sl_SI">locale/bitcoin_sl_SI.qm</file>
|
||||
<file alias="sq">locale/bitcoin_sq.qm</file>
|
||||
<file alias="sr">locale/bitcoin_sr.qm</file>
|
||||
<file alias="sv">locale/bitcoin_sv.qm</file>
|
||||
<file alias="th_TH">locale/bitcoin_th_TH.qm</file>
|
||||
<file alias="tr">locale/bitcoin_tr.qm</file>
|
||||
<file alias="uk">locale/bitcoin_uk.qm</file>
|
||||
<file alias="ur_PK">locale/bitcoin_ur_PK.qm</file>
|
||||
<file alias="uz@Cyrl">locale/bitcoin_uz@Cyrl.qm</file>
|
||||
<file alias="vi">locale/bitcoin_vi.qm</file>
|
||||
<file alias="vi_VN">locale/bitcoin_vi_VN.qm</file>
|
||||
<file alias="zh_CN">locale/bitcoin_zh_CN.qm</file>
|
||||
<file alias="zh_HK">locale/bitcoin_zh_HK.qm</file>
|
||||
<file alias="zh_TW">locale/bitcoin_zh_TW.qm</file>
|
||||
</qresource>
|
||||
</RCC>
|
|
@ -1,97 +0,0 @@
|
|||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "bitcoinaddressvalidator.h"
|
||||
|
||||
#include "base58.h"
|
||||
|
||||
/* Base58 characters are:
|
||||
"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"
|
||||
|
||||
This is:
|
||||
- All numbers except for '0'
|
||||
- All upper-case letters except for 'I' and 'O'
|
||||
- All lower-case letters except for 'l'
|
||||
*/
|
||||
|
||||
BitcoinAddressEntryValidator::BitcoinAddressEntryValidator(QObject *parent) :
|
||||
QValidator(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QValidator::State BitcoinAddressEntryValidator::validate(QString &input, int &pos) const
|
||||
{
|
||||
Q_UNUSED(pos);
|
||||
|
||||
// Empty address is "intermediate" input
|
||||
if (input.isEmpty())
|
||||
return QValidator::Intermediate;
|
||||
|
||||
// Correction
|
||||
for (int idx = 0; idx < input.size();)
|
||||
{
|
||||
bool removeChar = false;
|
||||
QChar ch = input.at(idx);
|
||||
// Corrections made are very conservative on purpose, to avoid
|
||||
// users unexpectedly getting away with typos that would normally
|
||||
// be detected, and thus sending to the wrong address.
|
||||
switch(ch.unicode())
|
||||
{
|
||||
// Qt categorizes these as "Other_Format" not "Separator_Space"
|
||||
case 0x200B: // ZERO WIDTH SPACE
|
||||
case 0xFEFF: // ZERO WIDTH NO-BREAK SPACE
|
||||
removeChar = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
// Remove whitespace
|
||||
if (ch.isSpace())
|
||||
removeChar = true;
|
||||
|
||||
// To next character
|
||||
if (removeChar)
|
||||
input.remove(idx, 1);
|
||||
else
|
||||
++idx;
|
||||
}
|
||||
|
||||
// Validation
|
||||
QValidator::State state = QValidator::Acceptable;
|
||||
for (int idx = 0; idx < input.size(); ++idx)
|
||||
{
|
||||
int ch = input.at(idx).unicode();
|
||||
|
||||
if (((ch >= '0' && ch<='9') ||
|
||||
(ch >= 'a' && ch<='z') ||
|
||||
(ch >= 'A' && ch<='Z')) &&
|
||||
ch != 'l' && ch != 'I' && ch != '0' && ch != 'O')
|
||||
{
|
||||
// Alphanumeric and not a 'forbidden' character
|
||||
}
|
||||
else
|
||||
{
|
||||
state = QValidator::Invalid;
|
||||
}
|
||||
}
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
BitcoinAddressCheckValidator::BitcoinAddressCheckValidator(QObject *parent) :
|
||||
QValidator(parent)
|
||||
{
|
||||
}
|
||||
|
||||
QValidator::State BitcoinAddressCheckValidator::validate(QString &input, int &pos) const
|
||||
{
|
||||
Q_UNUSED(pos);
|
||||
// Validate the passed Bitcoin address
|
||||
CBitcoinAddress addr(input.toStdString());
|
||||
if (addr.IsValid())
|
||||
return QValidator::Acceptable;
|
||||
|
||||
return QValidator::Invalid;
|
||||
}
|
|
@ -1,35 +0,0 @@
|
|||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_BITCOINADDRESSVALIDATOR_H
|
||||
#define BITCOIN_QT_BITCOINADDRESSVALIDATOR_H
|
||||
|
||||
#include <QValidator>
|
||||
|
||||
/** Base58 entry widget validator, checks for valid characters and
|
||||
* removes some whitespace.
|
||||
*/
|
||||
class BitcoinAddressEntryValidator : public QValidator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BitcoinAddressEntryValidator(QObject *parent);
|
||||
|
||||
State validate(QString &input, int &pos) const;
|
||||
};
|
||||
|
||||
/** Bitcoin address widget validator, checks for a valid bitcoin address.
|
||||
*/
|
||||
class BitcoinAddressCheckValidator : public QValidator
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BitcoinAddressCheckValidator(QObject *parent);
|
||||
|
||||
State validate(QString &input, int &pos) const;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_BITCOINADDRESSVALIDATOR_H
|
|
@ -1,302 +0,0 @@
|
|||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "bitcoinamountfield.h"
|
||||
|
||||
#include "bitcoinunits.h"
|
||||
#include "guiconstants.h"
|
||||
#include "qvaluecombobox.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QAbstractSpinBox>
|
||||
#include <QHBoxLayout>
|
||||
#include <QKeyEvent>
|
||||
#include <QLineEdit>
|
||||
|
||||
/** QSpinBox that uses fixed-point numbers internally and uses our own
|
||||
* formatting/parsing functions.
|
||||
*/
|
||||
class AmountSpinBox: public QAbstractSpinBox
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AmountSpinBox(QWidget *parent):
|
||||
QAbstractSpinBox(parent),
|
||||
currentUnit(BitcoinUnits::BTC),
|
||||
singleStep(100000) // satoshis
|
||||
{
|
||||
setAlignment(Qt::AlignRight);
|
||||
|
||||
connect(lineEdit(), SIGNAL(textEdited(QString)), this, SIGNAL(valueChanged()));
|
||||
}
|
||||
|
||||
QValidator::State validate(QString &text, int &pos) const
|
||||
{
|
||||
if(text.isEmpty())
|
||||
return QValidator::Intermediate;
|
||||
bool valid = false;
|
||||
parse(text, &valid);
|
||||
/* Make sure we return Intermediate so that fixup() is called on defocus */
|
||||
return valid ? QValidator::Intermediate : QValidator::Invalid;
|
||||
}
|
||||
|
||||
void fixup(QString &input) const
|
||||
{
|
||||
bool valid = false;
|
||||
CAmount val = parse(input, &valid);
|
||||
if(valid)
|
||||
{
|
||||
input = BitcoinUnits::format(currentUnit, val, false, BitcoinUnits::separatorAlways);
|
||||
lineEdit()->setText(input);
|
||||
}
|
||||
}
|
||||
|
||||
CAmount value(bool *valid_out=0) const
|
||||
{
|
||||
return parse(text(), valid_out);
|
||||
}
|
||||
|
||||
void setValue(const CAmount& value)
|
||||
{
|
||||
lineEdit()->setText(BitcoinUnits::format(currentUnit, value, false, BitcoinUnits::separatorAlways));
|
||||
Q_EMIT valueChanged();
|
||||
}
|
||||
|
||||
void stepBy(int steps)
|
||||
{
|
||||
bool valid = false;
|
||||
CAmount val = value(&valid);
|
||||
val = val + steps * singleStep;
|
||||
val = qMin(qMax(val, CAmount(0)), BitcoinUnits::maxMoney());
|
||||
setValue(val);
|
||||
}
|
||||
|
||||
void setDisplayUnit(int unit)
|
||||
{
|
||||
bool valid = false;
|
||||
CAmount val = value(&valid);
|
||||
|
||||
currentUnit = unit;
|
||||
|
||||
if(valid)
|
||||
setValue(val);
|
||||
else
|
||||
clear();
|
||||
}
|
||||
|
||||
void setSingleStep(const CAmount& step)
|
||||
{
|
||||
singleStep = step;
|
||||
}
|
||||
|
||||
QSize minimumSizeHint() const
|
||||
{
|
||||
if(cachedMinimumSizeHint.isEmpty())
|
||||
{
|
||||
ensurePolished();
|
||||
|
||||
const QFontMetrics fm(fontMetrics());
|
||||
int h = lineEdit()->minimumSizeHint().height();
|
||||
int w = fm.width(BitcoinUnits::format(BitcoinUnits::BTC, BitcoinUnits::maxMoney(), false, BitcoinUnits::separatorAlways));
|
||||
w += 2; // cursor blinking space
|
||||
|
||||
QStyleOptionSpinBox opt;
|
||||
initStyleOption(&opt);
|
||||
QSize hint(w, h);
|
||||
QSize extra(35, 6);
|
||||
opt.rect.setSize(hint + extra);
|
||||
extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
|
||||
QStyle::SC_SpinBoxEditField, this).size();
|
||||
// get closer to final result by repeating the calculation
|
||||
opt.rect.setSize(hint + extra);
|
||||
extra += hint - style()->subControlRect(QStyle::CC_SpinBox, &opt,
|
||||
QStyle::SC_SpinBoxEditField, this).size();
|
||||
hint += extra;
|
||||
hint.setHeight(h);
|
||||
|
||||
opt.rect = rect();
|
||||
|
||||
cachedMinimumSizeHint = style()->sizeFromContents(QStyle::CT_SpinBox, &opt, hint, this)
|
||||
.expandedTo(QApplication::globalStrut());
|
||||
}
|
||||
return cachedMinimumSizeHint;
|
||||
}
|
||||
|
||||
private:
|
||||
int currentUnit;
|
||||
CAmount singleStep;
|
||||
mutable QSize cachedMinimumSizeHint;
|
||||
|
||||
/**
|
||||
* Parse a string into a number of base monetary units and
|
||||
* return validity.
|
||||
* @note Must return 0 if !valid.
|
||||
*/
|
||||
CAmount parse(const QString &text, bool *valid_out=0) const
|
||||
{
|
||||
CAmount val = 0;
|
||||
bool valid = BitcoinUnits::parse(currentUnit, text, &val);
|
||||
if(valid)
|
||||
{
|
||||
if(val < 0 || val > BitcoinUnits::maxMoney())
|
||||
valid = false;
|
||||
}
|
||||
if(valid_out)
|
||||
*valid_out = valid;
|
||||
return valid ? val : 0;
|
||||
}
|
||||
|
||||
protected:
|
||||
bool event(QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::KeyPress || event->type() == QEvent::KeyRelease)
|
||||
{
|
||||
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);
|
||||
if (keyEvent->key() == Qt::Key_Comma)
|
||||
{
|
||||
// Translate a comma into a period
|
||||
QKeyEvent periodKeyEvent(event->type(), Qt::Key_Period, keyEvent->modifiers(), ".", keyEvent->isAutoRepeat(), keyEvent->count());
|
||||
return QAbstractSpinBox::event(&periodKeyEvent);
|
||||
}
|
||||
}
|
||||
return QAbstractSpinBox::event(event);
|
||||
}
|
||||
|
||||
StepEnabled stepEnabled() const
|
||||
{
|
||||
if (isReadOnly()) // Disable steps when AmountSpinBox is read-only
|
||||
return StepNone;
|
||||
if (text().isEmpty()) // Allow step-up with empty field
|
||||
return StepUpEnabled;
|
||||
|
||||
StepEnabled rv = 0;
|
||||
bool valid = false;
|
||||
CAmount val = value(&valid);
|
||||
if(valid)
|
||||
{
|
||||
if(val > 0)
|
||||
rv |= StepDownEnabled;
|
||||
if(val < BitcoinUnits::maxMoney())
|
||||
rv |= StepUpEnabled;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged();
|
||||
};
|
||||
|
||||
#include "bitcoinamountfield.moc"
|
||||
|
||||
BitcoinAmountField::BitcoinAmountField(QWidget *parent) :
|
||||
QWidget(parent),
|
||||
amount(0)
|
||||
{
|
||||
amount = new AmountSpinBox(this);
|
||||
amount->setLocale(QLocale::c());
|
||||
amount->installEventFilter(this);
|
||||
amount->setMaximumWidth(170);
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->addWidget(amount);
|
||||
unit = new QValueComboBox(this);
|
||||
unit->setModel(new BitcoinUnits(this));
|
||||
layout->addWidget(unit);
|
||||
layout->addStretch(1);
|
||||
layout->setContentsMargins(0,0,0,0);
|
||||
|
||||
setLayout(layout);
|
||||
|
||||
setFocusPolicy(Qt::TabFocus);
|
||||
setFocusProxy(amount);
|
||||
|
||||
// If one if the widgets changes, the combined content changes as well
|
||||
connect(amount, SIGNAL(valueChanged()), this, SIGNAL(valueChanged()));
|
||||
connect(unit, SIGNAL(currentIndexChanged(int)), this, SLOT(unitChanged(int)));
|
||||
|
||||
// Set default based on configuration
|
||||
unitChanged(unit->currentIndex());
|
||||
}
|
||||
|
||||
void BitcoinAmountField::clear()
|
||||
{
|
||||
amount->clear();
|
||||
unit->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
void BitcoinAmountField::setEnabled(bool fEnabled)
|
||||
{
|
||||
amount->setEnabled(fEnabled);
|
||||
unit->setEnabled(fEnabled);
|
||||
}
|
||||
|
||||
bool BitcoinAmountField::validate()
|
||||
{
|
||||
bool valid = false;
|
||||
value(&valid);
|
||||
setValid(valid);
|
||||
return valid;
|
||||
}
|
||||
|
||||
void BitcoinAmountField::setValid(bool valid)
|
||||
{
|
||||
if (valid)
|
||||
amount->setStyleSheet("");
|
||||
else
|
||||
amount->setStyleSheet(STYLE_INVALID);
|
||||
}
|
||||
|
||||
bool BitcoinAmountField::eventFilter(QObject *object, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::FocusIn)
|
||||
{
|
||||
// Clear invalid flag on focus
|
||||
setValid(true);
|
||||
}
|
||||
return QWidget::eventFilter(object, event);
|
||||
}
|
||||
|
||||
QWidget *BitcoinAmountField::setupTabChain(QWidget *prev)
|
||||
{
|
||||
QWidget::setTabOrder(prev, amount);
|
||||
QWidget::setTabOrder(amount, unit);
|
||||
return unit;
|
||||
}
|
||||
|
||||
CAmount BitcoinAmountField::value(bool *valid_out) const
|
||||
{
|
||||
return amount->value(valid_out);
|
||||
}
|
||||
|
||||
void BitcoinAmountField::setValue(const CAmount& value)
|
||||
{
|
||||
amount->setValue(value);
|
||||
}
|
||||
|
||||
void BitcoinAmountField::setReadOnly(bool fReadOnly)
|
||||
{
|
||||
amount->setReadOnly(fReadOnly);
|
||||
}
|
||||
|
||||
void BitcoinAmountField::unitChanged(int idx)
|
||||
{
|
||||
// Use description tooltip for current unit for the combobox
|
||||
unit->setToolTip(unit->itemData(idx, Qt::ToolTipRole).toString());
|
||||
|
||||
// Determine new unit ID
|
||||
int newUnit = unit->itemData(idx, BitcoinUnits::UnitRole).toInt();
|
||||
|
||||
amount->setDisplayUnit(newUnit);
|
||||
}
|
||||
|
||||
void BitcoinAmountField::setDisplayUnit(int newUnit)
|
||||
{
|
||||
unit->setValue(newUnit);
|
||||
}
|
||||
|
||||
void BitcoinAmountField::setSingleStep(const CAmount& step)
|
||||
{
|
||||
amount->setSingleStep(step);
|
||||
}
|
|
@ -1,75 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_BITCOINAMOUNTFIELD_H
|
||||
#define BITCOIN_QT_BITCOINAMOUNTFIELD_H
|
||||
|
||||
#include "amount.h"
|
||||
|
||||
#include <QWidget>
|
||||
|
||||
class AmountSpinBox;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QValueComboBox;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/** Widget for entering bitcoin amounts.
|
||||
*/
|
||||
class BitcoinAmountField: public QWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
// ugly hack: for some unknown reason CAmount (instead of qint64) does not work here as expected
|
||||
// discussion: https://github.com/bitcoin/bitcoin/pull/5117
|
||||
Q_PROPERTY(qint64 value READ value WRITE setValue NOTIFY valueChanged USER true)
|
||||
|
||||
public:
|
||||
explicit BitcoinAmountField(QWidget *parent = 0);
|
||||
|
||||
CAmount value(bool *value=0) const;
|
||||
void setValue(const CAmount& value);
|
||||
|
||||
/** Set single step in satoshis **/
|
||||
void setSingleStep(const CAmount& step);
|
||||
|
||||
/** Make read-only **/
|
||||
void setReadOnly(bool fReadOnly);
|
||||
|
||||
/** Mark current value as invalid in UI. */
|
||||
void setValid(bool valid);
|
||||
/** Perform input validation, mark field as invalid if entered value is not valid. */
|
||||
bool validate();
|
||||
|
||||
/** Change unit used to display amount. */
|
||||
void setDisplayUnit(int unit);
|
||||
|
||||
/** Make field empty and ready for new input. */
|
||||
void clear();
|
||||
|
||||
/** Enable/Disable. */
|
||||
void setEnabled(bool fEnabled);
|
||||
|
||||
/** Qt messes up the tab chain by default in some cases (issue https://bugreports.qt-project.org/browse/QTBUG-10907),
|
||||
in these cases we have to set it up manually.
|
||||
*/
|
||||
QWidget *setupTabChain(QWidget *prev);
|
||||
|
||||
Q_SIGNALS:
|
||||
void valueChanged();
|
||||
|
||||
protected:
|
||||
/** Intercept focus-in event and ',' key presses */
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
private:
|
||||
AmountSpinBox *amount;
|
||||
QValueComboBox *unit;
|
||||
|
||||
private Q_SLOTS:
|
||||
void unitChanged(int idx);
|
||||
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_BITCOINAMOUNTFIELD_H
|
File diff suppressed because it is too large
Load Diff
|
@ -1,244 +0,0 @@
|
|||
// Copyright (c) 2011-2014 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_BITCOINGUI_H
|
||||
#define BITCOIN_QT_BITCOINGUI_H
|
||||
|
||||
#if defined(HAVE_CONFIG_H)
|
||||
#include "config/bitcoin-config.h"
|
||||
#endif
|
||||
|
||||
#include "amount.h"
|
||||
|
||||
#include <QLabel>
|
||||
#include <QMainWindow>
|
||||
#include <QMap>
|
||||
#include <QMenu>
|
||||
#include <QPoint>
|
||||
#include <QSystemTrayIcon>
|
||||
|
||||
class ClientModel;
|
||||
class NetworkStyle;
|
||||
class Notificator;
|
||||
class OptionsModel;
|
||||
class RPCConsole;
|
||||
class SendCoinsRecipient;
|
||||
class UnitDisplayStatusBarControl;
|
||||
class WalletFrame;
|
||||
class WalletModel;
|
||||
|
||||
class CWallet;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAction;
|
||||
class QProgressBar;
|
||||
class QProgressDialog;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/**
|
||||
Bitcoin GUI main class. This class represents the main window of the Bitcoin UI. It communicates with both the client and
|
||||
wallet models to give the user an up-to-date view of the current core state.
|
||||
*/
|
||||
class BitcoinGUI : public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static const QString DEFAULT_WALLET;
|
||||
|
||||
explicit BitcoinGUI(const NetworkStyle *networkStyle, QWidget *parent = 0);
|
||||
~BitcoinGUI();
|
||||
|
||||
/** Set the client model.
|
||||
The client model represents the part of the core that communicates with the P2P network, and is wallet-agnostic.
|
||||
*/
|
||||
void setClientModel(ClientModel *clientModel);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
/** Set the wallet model.
|
||||
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
|
||||
functionality.
|
||||
*/
|
||||
bool addWallet(const QString& name, WalletModel *walletModel);
|
||||
bool setCurrentWallet(const QString& name);
|
||||
void removeAllWallets();
|
||||
#endif // ENABLE_WALLET
|
||||
bool enableWallet;
|
||||
|
||||
protected:
|
||||
void changeEvent(QEvent *e);
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void dragEnterEvent(QDragEnterEvent *event);
|
||||
void dropEvent(QDropEvent *event);
|
||||
bool eventFilter(QObject *object, QEvent *event);
|
||||
|
||||
private:
|
||||
ClientModel *clientModel;
|
||||
WalletFrame *walletFrame;
|
||||
|
||||
UnitDisplayStatusBarControl *unitDisplayControl;
|
||||
QLabel *labelEncryptionIcon;
|
||||
QLabel *labelConnectionsIcon;
|
||||
QLabel *labelBlocksIcon;
|
||||
QLabel *progressBarLabel;
|
||||
QProgressBar *progressBar;
|
||||
QProgressDialog *progressDialog;
|
||||
|
||||
QMenuBar *appMenuBar;
|
||||
QAction *overviewAction;
|
||||
QAction *historyAction;
|
||||
QAction *quitAction;
|
||||
QAction *sendCoinsAction;
|
||||
QAction *sendCoinsMenuAction;
|
||||
QAction *usedSendingAddressesAction;
|
||||
QAction *usedReceivingAddressesAction;
|
||||
QAction *signMessageAction;
|
||||
QAction *verifyMessageAction;
|
||||
QAction *aboutAction;
|
||||
QAction *receiveCoinsAction;
|
||||
QAction *receiveCoinsMenuAction;
|
||||
QAction *optionsAction;
|
||||
QAction *toggleHideAction;
|
||||
QAction *encryptWalletAction;
|
||||
QAction *backupWalletAction;
|
||||
QAction *changePassphraseAction;
|
||||
QAction *aboutQtAction;
|
||||
QAction *openRPCConsoleAction;
|
||||
QAction *openAction;
|
||||
QAction *showHelpMessageAction;
|
||||
|
||||
QSystemTrayIcon *trayIcon;
|
||||
QMenu *trayIconMenu;
|
||||
Notificator *notificator;
|
||||
RPCConsole *rpcConsole;
|
||||
|
||||
/** Keep track of previous number of blocks, to detect progress */
|
||||
int prevBlocks;
|
||||
int spinnerFrame;
|
||||
|
||||
/** Create the main UI actions. */
|
||||
void createActions();
|
||||
/** Create the menu bar and sub-menus. */
|
||||
void createMenuBar();
|
||||
/** Create the toolbars */
|
||||
void createToolBars();
|
||||
/** Create system tray icon and notification */
|
||||
void createTrayIcon(const NetworkStyle *networkStyle);
|
||||
/** Create system tray menu (or setup the dock menu) */
|
||||
void createTrayIconMenu();
|
||||
|
||||
/** Enable or disable all wallet-related actions */
|
||||
void setWalletActionsEnabled(bool enabled);
|
||||
|
||||
/** Connect core signals to GUI client */
|
||||
void subscribeToCoreSignals();
|
||||
/** Disconnect core signals from GUI client */
|
||||
void unsubscribeFromCoreSignals();
|
||||
|
||||
Q_SIGNALS:
|
||||
/** Signal raised when a URI was entered or dragged to the GUI */
|
||||
void receivedURI(const QString &uri);
|
||||
|
||||
public Q_SLOTS:
|
||||
/** Set number of connections shown in the UI */
|
||||
void setNumConnections(int count);
|
||||
/** Set number of blocks and last block date shown in the UI */
|
||||
void setNumBlocks(int count, const QDateTime& blockDate);
|
||||
|
||||
/** Notify the user of an event from the core network or transaction handling code.
|
||||
@param[in] title the message box / notification title
|
||||
@param[in] message the displayed text
|
||||
@param[in] style modality and style definitions (icon and used buttons - buttons only for message boxes)
|
||||
@see CClientUIInterface::MessageBoxFlags
|
||||
@param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
|
||||
*/
|
||||
void message(const QString &title, const QString &message, unsigned int style, bool *ret = NULL);
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
/** Set the encryption status as shown in the UI.
|
||||
@param[in] status current encryption status
|
||||
@see WalletModel::EncryptionStatus
|
||||
*/
|
||||
void setEncryptionStatus(int status);
|
||||
|
||||
bool handlePaymentRequest(const SendCoinsRecipient& recipient);
|
||||
|
||||
/** Show incoming transaction notification for new transactions. */
|
||||
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label);
|
||||
#endif // ENABLE_WALLET
|
||||
|
||||
private Q_SLOTS:
|
||||
#ifdef ENABLE_WALLET
|
||||
/** Switch to overview (home) page */
|
||||
void gotoOverviewPage();
|
||||
/** Switch to history (transactions) page */
|
||||
void gotoHistoryPage();
|
||||
/** Switch to receive coins page */
|
||||
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 = "");
|
||||
|
||||
/** Show open dialog */
|
||||
void openClicked();
|
||||
#endif // ENABLE_WALLET
|
||||
/** Show configuration dialog */
|
||||
void optionsClicked();
|
||||
/** Show about dialog */
|
||||
void aboutClicked();
|
||||
/** Show debug window */
|
||||
void showDebugWindow();
|
||||
/** Show help message dialog */
|
||||
void showHelpMessageClicked();
|
||||
#ifndef Q_OS_MAC
|
||||
/** Handle tray icon clicked */
|
||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||
#endif
|
||||
|
||||
/** Show window if hidden, unminimize when minimized, rise when obscured or show if hidden and fToggleHidden is true */
|
||||
void showNormalIfMinimized(bool fToggleHidden = false);
|
||||
/** Simply calls showNormalIfMinimized(true) for use in SLOT() macro */
|
||||
void toggleHidden();
|
||||
|
||||
/** called by a timer to check if fRequestShutdown has been set **/
|
||||
void detectShutdown();
|
||||
|
||||
/** Show progress dialog e.g. for verifychain */
|
||||
void showProgress(const QString &title, int nProgress);
|
||||
};
|
||||
|
||||
class UnitDisplayStatusBarControl : public QLabel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UnitDisplayStatusBarControl();
|
||||
/** Lets the control know about the Options Model (and its signals) */
|
||||
void setOptionsModel(OptionsModel *optionsModel);
|
||||
|
||||
protected:
|
||||
/** So that it responds to left-button clicks */
|
||||
void mousePressEvent(QMouseEvent *event);
|
||||
|
||||
private:
|
||||
OptionsModel *optionsModel;
|
||||
QMenu* menu;
|
||||
|
||||
/** Shows context menu with Display Unit options by the mouse coordinates */
|
||||
void onDisplayUnitsClicked(const QPoint& point);
|
||||
/** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */
|
||||
void createContextMenu();
|
||||
|
||||
private Q_SLOTS:
|
||||
/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */
|
||||
void updateDisplayUnit(int newUnits);
|
||||
/** Tells underlying optionsModel to update its current display unit. */
|
||||
void onMenuSelection(QAction* action);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_BITCOINGUI_H
|
|
@ -1,319 +0,0 @@
|
|||
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
// Automatically generated by extract_strings.py
|
||||
#ifdef __GNUC__
|
||||
#define UNUSED __attribute__((unused))
|
||||
#else
|
||||
#define UNUSED
|
||||
#endif
|
||||
static const char UNUSED *bitcoin_strings[] = {
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"(1 = keep tx meta data e.g. account owner and payment request information, 2 "
|
||||
"= drop tx meta data)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Allow JSON-RPC connections from specified source. Valid for <ip> are a "
|
||||
"single IP (e.g. 1.2.3.4), a network/netmask (e.g. 1.2.3.4/255.255.255.0) or "
|
||||
"a network/CIDR (e.g. 1.2.3.4/24). This option can be specified multiple times"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"An error occurred while setting up the RPC address %s port %u for listening: "
|
||||
"%s"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Bind to given address and always listen on it. Use [host]:port notation for "
|
||||
"IPv6"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Bind to given address and whitelist peers connecting to it. Use [host]:port "
|
||||
"notation for IPv6"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Bind to given address to listen for JSON-RPC connections. Use [host]:port "
|
||||
"notation for IPv6. This option can be specified multiple times (default: "
|
||||
"bind to all interfaces)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Cannot obtain a lock on data directory %s. Bitcoin Core is probably already "
|
||||
"running."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Create new files with system default permissions, instead of umask 077 (only "
|
||||
"effective with disabled wallet functionality)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Delete all wallet transactions and only recover those parts of the "
|
||||
"blockchain through -rescan on startup"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Discover own IP addresses (default: 1 when listening and no -externalip or -"
|
||||
"proxy)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Distributed under the MIT software license, see the accompanying file "
|
||||
"COPYING or <http://www.opensource.org/licenses/mit-license.php>."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Error: Listening for incoming connections failed (listen returned error %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Error: Unsupported argument -socks found. Setting SOCKS version isn't "
|
||||
"possible anymore, only SOCKS5 proxies are supported."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Execute command when a relevant alert is received or we see a really long "
|
||||
"fork (%s in cmd is replaced by message)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Execute command when a wallet transaction changes (%s in cmd is replaced by "
|
||||
"TxID)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Execute command when the best block changes (%s in cmd is replaced by block "
|
||||
"hash)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Fees (in BTC/Kb) smaller than this are considered zero fee for relaying "
|
||||
"(default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"How thorough the block verification of -checkblocks is (0-4, default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"If paytxfee is not set, include enough fee so transactions begin "
|
||||
"confirmation on average within n blocks (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Invalid amount for -maxtxfee=<amount>: '%s' (must be at least the minrelay "
|
||||
"fee of %s to prevent stuck transactions)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Maintain a full transaction index, used by the getrawtransaction rpc call "
|
||||
"(default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Maximum size of data in data carrier transactions we relay and mine "
|
||||
"(default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Maximum total fees to use in a single wallet transaction; setting this too "
|
||||
"low may abort large transactions (default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Number of seconds to keep misbehaving peers from reconnecting (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Output debugging information (default: %u, supplying <category> is optional)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Prune configured below the minimum of %d MB. Please use a higher number."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Query for peer addresses via DNS lookup, if low on addresses (default: 1 "
|
||||
"unless -connect)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Randomize credentials for every proxy connection. This enables Tor stream "
|
||||
"isolation (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Reduce storage requirements by pruning (deleting) old blocks. This mode "
|
||||
"disables wallet support and is incompatible with -txindex. Warning: "
|
||||
"Reverting this setting requires re-downloading the entire blockchain. "
|
||||
"(default: 0 = disable pruning blocks, >%u = target size in MiB to use for "
|
||||
"block files)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Set maximum size of high-priority/low-fee transactions in bytes (default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Set the number of script verification threads (%u to %d, 0 = auto, <0 = "
|
||||
"leave that many cores free, default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Set the number of threads for coin generation if enabled (-1 = all cores, "
|
||||
"default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"The transaction amount is too small to send after the fee has been deducted"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"This is a pre-release test build - use at your own risk - do not use for "
|
||||
"mining or merchant applications"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"This product includes software developed by the OpenSSL Project for use in "
|
||||
"the OpenSSL Toolkit <https://www.openssl.org/> and cryptographic software "
|
||||
"written by Eric Young and UPnP software written by Thomas Bernard."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"To use bitcoind, or the -server option to bitcoin-qt, you must set an "
|
||||
"rpcpassword in the configuration file:\n"
|
||||
"%s\n"
|
||||
"It is recommended you use the following random password:\n"
|
||||
"rpcuser=bitcoinrpc\n"
|
||||
"rpcpassword=%s\n"
|
||||
"(you do not need to remember this password)\n"
|
||||
"The username and password MUST NOT be the same.\n"
|
||||
"If the file does not exist, create it with owner-readable-only file "
|
||||
"permissions.\n"
|
||||
"It is also recommended to set alertnotify so you are notified of problems;\n"
|
||||
"for example: alertnotify=echo %%s | mail -s \"Bitcoin Alert\" admin@foo.com\n"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Unable to bind to %s on this computer. Bitcoin Core is probably already "
|
||||
"running."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Use separate SOCKS5 proxy to reach peers via Tor hidden services (default: "
|
||||
"%s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"WARNING: abnormally high number of blocks generated, %d blocks received in "
|
||||
"the last %d hours (%d expected)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"WARNING: check your network connection, %d blocks received in the last %d "
|
||||
"hours (%d expected)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: -maxtxfee is set very high! Fees this large could be paid on a "
|
||||
"single transaction."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: -paytxfee is set very high! This is the transaction fee you will "
|
||||
"pay if you send a transaction."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: Please check that your computer's date and time are correct! If "
|
||||
"your clock is wrong Bitcoin Core will not work properly."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: The network does not appear to fully agree! Some miners appear to "
|
||||
"be experiencing issues."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: We do not appear to fully agree with our peers! You may need to "
|
||||
"upgrade, or other nodes may need to upgrade."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: error reading wallet.dat! All keys read correctly, but transaction "
|
||||
"data or address book entries might be missing or incorrect."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as "
|
||||
"wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect "
|
||||
"you should restore from a backup."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Whitelist peers connecting from the given netmask or IP address. Can be "
|
||||
"specified multiple times."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"Whitelisted peers cannot be DoS banned and their transactions are always "
|
||||
"relayed, even if they are already in the mempool, useful e.g. for a gateway"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", ""
|
||||
"You need to rebuild the database using -reindex to go back to unpruned "
|
||||
"mode. This will redownload the entire blockchain"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "(default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "(default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "(default: 1)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "<category> can be:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Accept command line and JSON-RPC commands"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Accept connections from outside (default: 1 if no -proxy or -connect)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Accept public REST requests (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Acceptable ciphers (default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Activating best chain..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Add a node to connect to and attempt to keep the connection open"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Allow DNS lookups for -addnode, -seednode and -connect"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Always query for peer addresses via DNS lookup (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Attempt to recover private keys from a corrupt wallet.dat"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Block creation options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Can't run with a wallet in prune mode."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot downgrade wallet"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -bind address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -externalip address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot resolve -whitebind address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Cannot write default address"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Choose data directory on startup (default: 0)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Connect only to the specified node(s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Connect through SOCKS5 proxy"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Connect to a node to retrieve peer addresses, and disconnect"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Connection options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Copyright (C) 2009-%i The Bitcoin Core Developers"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Corrupted block database detected"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Could not parse -rpcbind value %s as network address"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Debugging/Testing options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Do not load the wallet and disable wallet RPC calls"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Do you want to rebuild the block database now?"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Done loading"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing block database"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error initializing wallet database environment %s!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading block database"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet corrupted"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error loading wallet.dat: Wallet requires newer version of Bitcoin Core"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error opening block database"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error reading from database, shutting down."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: A fatal internal error occurred, see debug.log for details"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Disk space is low!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Error: Unsupported argument -tor found, use -onion."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Failed to listen on any port. Use -listen=0 if you want this."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Fee (in BTC/kB) to add to transactions you send (default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Generate coins (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "How many blocks to check at startup (default: %u, 0 = all)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "If <category> is not supplied, output all debugging information."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Importing..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Imports blocks from external blk000??.dat file"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Include IP addresses in debug output (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Incorrect or no genesis block found. Wrong datadir for network?"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Information"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Initialization sanity check failed. Bitcoin Core is shutting down."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Insufficient funds"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -onion address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid -proxy address: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -maxtxfee=<amount>: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -minrelaytxfee=<amount>: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -mintxfee=<amount>: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s' (must be at least %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid amount for -paytxfee=<amount>: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Invalid netmask specified in -whitelist: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Keep at most <n> unconnectable transactions in memory (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Listen for JSON-RPC connections on <port> (default: %u or testnet: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Listen for connections on <port> (default: %u or testnet: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Loading addresses..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Loading block index..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Loading wallet..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Maintain at most <n> connections to peers (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Make the wallet broadcast transactions"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection receive buffer, <n>*1000 bytes (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Maximum per-connection send buffer, <n>*1000 bytes (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Need to specify a port with -whitebind: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Node relay options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Not enough file descriptors available."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Only connect to nodes in network <net> (ipv4, ipv6 or onion)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Password for JSON-RPC connections"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Prepend debug output with timestamp (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Prune cannot be configured with a negative value."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Prune mode is incompatible with -txindex."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Pruning blockstore..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "RPC SSL options: (see the Bitcoin Wiki for SSL setup instructions)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "RPC server options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "RPC support for HTTP persistent connections (default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Rebuild block chain index from current blk000??.dat files on startup"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Receive and display P2P network alerts (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Relay and mine data carrier transactions (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Relay non-P2SH multisig (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Rescan the block chain for missing wallet transactions"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Rescanning..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Run in the background as a daemon and accept commands"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Send trace/debug info to console instead of debug.log file"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Send transactions as zero-fee transactions if possible (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Server certificate file (default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Server private key (default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set SSL root certificates for payment request (default: -system-)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set database cache size in megabytes (%d to %d, default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set key pool size to <n> (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set language, for example \"de_DE\" (default: system locale)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set maximum block size in bytes (default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set minimum block size in bytes (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Set the number of threads to service RPC calls (default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Show all debugging options (usage: --help -help-debug)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Show splash screen on startup (default: 1)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Shrink debug.log file on client startup (default: 1 when no -debug)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Signing transaction failed"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify configuration file (default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify connection timeout in milliseconds (minimum: 1, default: %d)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify data directory"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify pid file (default: %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify wallet file (within data directory)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Specify your own public address"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Spend unconfirmed change when sending transactions (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Start minimized"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "The transaction amount is too small to pay the fee"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "This help message"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "This is experimental software."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Threshold for disconnecting misbehaving peers (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amount too small"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction amounts must be positive"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large for fee policy"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Transaction too large"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "UI Options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Unable to bind to %s on this computer (bind returned error %s)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Unknown network specified in -onlynet: '%s'"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Upgrade wallet to latest format"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use OpenSSL (https) for JSON-RPC connections"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: %u)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use UPnP to map the listening port (default: 1 when listening)"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Use the test network"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Username for JSON-RPC connections"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying blocks..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Verifying wallet..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet %s resides outside data directory %s"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet needed to be rewritten: restart Bitcoin Core to complete"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Wallet options:"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: This version is obsolete; upgrade required!"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Unsupported argument -benchmark ignored, use -debug=bench."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Warning: Unsupported argument -debugnet ignored, use -debug=net."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "You need to rebuild the database using -reindex to change -txindex"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "Zapping all transactions from wallet..."),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "on startup"),
|
||||
QT_TRANSLATE_NOOP("bitcoin-core", "wallet.dat corrupt, salvage failed"),
|
||||
};
|
|
@ -1,220 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "bitcoinunits.h"
|
||||
|
||||
#include "primitives/transaction.h"
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
BitcoinUnits::BitcoinUnits(QObject *parent):
|
||||
QAbstractListModel(parent),
|
||||
unitlist(availableUnits())
|
||||
{
|
||||
}
|
||||
|
||||
QList<BitcoinUnits::Unit> BitcoinUnits::availableUnits()
|
||||
{
|
||||
QList<BitcoinUnits::Unit> unitlist;
|
||||
unitlist.append(BTC);
|
||||
unitlist.append(mBTC);
|
||||
unitlist.append(uBTC);
|
||||
return unitlist;
|
||||
}
|
||||
|
||||
bool BitcoinUnits::valid(int unit)
|
||||
{
|
||||
switch(unit)
|
||||
{
|
||||
case BTC:
|
||||
case mBTC:
|
||||
case uBTC:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
QString BitcoinUnits::name(int unit)
|
||||
{
|
||||
switch(unit)
|
||||
{
|
||||
case BTC: return QString("BTC");
|
||||
case mBTC: return QString("mBTC");
|
||||
case uBTC: return QString::fromUtf8("μBTC");
|
||||
default: return QString("???");
|
||||
}
|
||||
}
|
||||
|
||||
QString BitcoinUnits::description(int unit)
|
||||
{
|
||||
switch(unit)
|
||||
{
|
||||
case BTC: return QString("Bitcoins");
|
||||
case mBTC: return QString("Milli-Bitcoins (1 / 1" THIN_SP_UTF8 "000)");
|
||||
case uBTC: return QString("Micro-Bitcoins (1 / 1" THIN_SP_UTF8 "000" THIN_SP_UTF8 "000)");
|
||||
default: return QString("???");
|
||||
}
|
||||
}
|
||||
|
||||
qint64 BitcoinUnits::factor(int unit)
|
||||
{
|
||||
switch(unit)
|
||||
{
|
||||
case BTC: return 100000000;
|
||||
case mBTC: return 100000;
|
||||
case uBTC: return 100;
|
||||
default: return 100000000;
|
||||
}
|
||||
}
|
||||
|
||||
int BitcoinUnits::decimals(int unit)
|
||||
{
|
||||
switch(unit)
|
||||
{
|
||||
case BTC: return 8;
|
||||
case mBTC: return 5;
|
||||
case uBTC: return 2;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
QString BitcoinUnits::format(int unit, const CAmount& nIn, bool fPlus, SeparatorStyle separators)
|
||||
{
|
||||
// Note: not using straight sprintf here because we do NOT want
|
||||
// localized number formatting.
|
||||
if(!valid(unit))
|
||||
return QString(); // Refuse to format invalid unit
|
||||
qint64 n = (qint64)nIn;
|
||||
qint64 coin = factor(unit);
|
||||
int num_decimals = decimals(unit);
|
||||
qint64 n_abs = (n > 0 ? n : -n);
|
||||
qint64 quotient = n_abs / coin;
|
||||
qint64 remainder = n_abs % coin;
|
||||
QString quotient_str = QString::number(quotient);
|
||||
QString remainder_str = QString::number(remainder).rightJustified(num_decimals, '0');
|
||||
|
||||
// Use SI-style thin space separators as these are locale independent and can't be
|
||||
// confused with the decimal marker.
|
||||
QChar thin_sp(THIN_SP_CP);
|
||||
int q_size = quotient_str.size();
|
||||
if (separators == separatorAlways || (separators == separatorStandard && q_size > 4))
|
||||
for (int i = 3; i < q_size; i += 3)
|
||||
quotient_str.insert(q_size - i, thin_sp);
|
||||
|
||||
if (n < 0)
|
||||
quotient_str.insert(0, '-');
|
||||
else if (fPlus && n > 0)
|
||||
quotient_str.insert(0, '+');
|
||||
return quotient_str + QString(".") + remainder_str;
|
||||
}
|
||||
|
||||
|
||||
// TODO: Review all remaining calls to BitcoinUnits::formatWithUnit to
|
||||
// TODO: determine whether the output is used in a plain text context
|
||||
// TODO: or an HTML context (and replace with
|
||||
// TODO: BtcoinUnits::formatHtmlWithUnit in the latter case). Hopefully
|
||||
// TODO: there aren't instances where the result could be used in
|
||||
// TODO: either context.
|
||||
|
||||
// NOTE: Using formatWithUnit in an HTML context risks wrapping
|
||||
// quantities at the thousands separator. More subtly, it also results
|
||||
// in a standard space rather than a thin space, due to a bug in Qt's
|
||||
// XML whitespace canonicalisation
|
||||
//
|
||||
// Please take care to use formatHtmlWithUnit instead, when
|
||||
// appropriate.
|
||||
|
||||
QString BitcoinUnits::formatWithUnit(int unit, const CAmount& amount, bool plussign, SeparatorStyle separators)
|
||||
{
|
||||
return format(unit, amount, plussign, separators) + QString(" ") + name(unit);
|
||||
}
|
||||
|
||||
QString BitcoinUnits::formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign, SeparatorStyle separators)
|
||||
{
|
||||
QString str(formatWithUnit(unit, amount, plussign, separators));
|
||||
str.replace(QChar(THIN_SP_CP), QString(THIN_SP_HTML));
|
||||
return QString("<span style='white-space: nowrap;'>%1</span>").arg(str);
|
||||
}
|
||||
|
||||
|
||||
bool BitcoinUnits::parse(int unit, const QString &value, CAmount *val_out)
|
||||
{
|
||||
if(!valid(unit) || value.isEmpty())
|
||||
return false; // Refuse to parse invalid unit or empty string
|
||||
int num_decimals = decimals(unit);
|
||||
|
||||
// Ignore spaces and thin spaces when parsing
|
||||
QStringList parts = removeSpaces(value).split(".");
|
||||
|
||||
if(parts.size() > 2)
|
||||
{
|
||||
return false; // More than one dot
|
||||
}
|
||||
QString whole = parts[0];
|
||||
QString decimals;
|
||||
|
||||
if(parts.size() > 1)
|
||||
{
|
||||
decimals = parts[1];
|
||||
}
|
||||
if(decimals.size() > num_decimals)
|
||||
{
|
||||
return false; // Exceeds max precision
|
||||
}
|
||||
bool ok = false;
|
||||
QString str = whole + decimals.leftJustified(num_decimals, '0');
|
||||
|
||||
if(str.size() > 18)
|
||||
{
|
||||
return false; // Longer numbers will exceed 63 bits
|
||||
}
|
||||
CAmount retvalue(str.toLongLong(&ok));
|
||||
if(val_out)
|
||||
{
|
||||
*val_out = retvalue;
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
QString BitcoinUnits::getAmountColumnTitle(int unit)
|
||||
{
|
||||
QString amountTitle = QObject::tr("Amount");
|
||||
if (BitcoinUnits::valid(unit))
|
||||
{
|
||||
amountTitle += " ("+BitcoinUnits::name(unit) + ")";
|
||||
}
|
||||
return amountTitle;
|
||||
}
|
||||
|
||||
int BitcoinUnits::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
Q_UNUSED(parent);
|
||||
return unitlist.size();
|
||||
}
|
||||
|
||||
QVariant BitcoinUnits::data(const QModelIndex &index, int role) const
|
||||
{
|
||||
int row = index.row();
|
||||
if(row >= 0 && row < unitlist.size())
|
||||
{
|
||||
Unit unit = unitlist.at(row);
|
||||
switch(role)
|
||||
{
|
||||
case Qt::EditRole:
|
||||
case Qt::DisplayRole:
|
||||
return QVariant(name(unit));
|
||||
case Qt::ToolTipRole:
|
||||
return QVariant(description(unit));
|
||||
case UnitRole:
|
||||
return QVariant(static_cast<int>(unit));
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
CAmount BitcoinUnits::maxMoney()
|
||||
{
|
||||
return MAX_MONEY;
|
||||
}
|
|
@ -1,127 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_BITCOINUNITS_H
|
||||
#define BITCOIN_QT_BITCOINUNITS_H
|
||||
|
||||
#include "amount.h"
|
||||
|
||||
#include <QAbstractListModel>
|
||||
#include <QString>
|
||||
|
||||
// U+2009 THIN SPACE = UTF-8 E2 80 89
|
||||
#define REAL_THIN_SP_CP 0x2009
|
||||
#define REAL_THIN_SP_UTF8 "\xE2\x80\x89"
|
||||
#define REAL_THIN_SP_HTML " "
|
||||
|
||||
// U+200A HAIR SPACE = UTF-8 E2 80 8A
|
||||
#define HAIR_SP_CP 0x200A
|
||||
#define HAIR_SP_UTF8 "\xE2\x80\x8A"
|
||||
#define HAIR_SP_HTML " "
|
||||
|
||||
// U+2006 SIX-PER-EM SPACE = UTF-8 E2 80 86
|
||||
#define SIXPEREM_SP_CP 0x2006
|
||||
#define SIXPEREM_SP_UTF8 "\xE2\x80\x86"
|
||||
#define SIXPEREM_SP_HTML " "
|
||||
|
||||
// U+2007 FIGURE SPACE = UTF-8 E2 80 87
|
||||
#define FIGURE_SP_CP 0x2007
|
||||
#define FIGURE_SP_UTF8 "\xE2\x80\x87"
|
||||
#define FIGURE_SP_HTML " "
|
||||
|
||||
// QMessageBox seems to have a bug whereby it doesn't display thin/hair spaces
|
||||
// correctly. Workaround is to display a space in a small font. If you
|
||||
// change this, please test that it doesn't cause the parent span to start
|
||||
// wrapping.
|
||||
#define HTML_HACK_SP "<span style='white-space: nowrap; font-size: 6pt'> </span>"
|
||||
|
||||
// Define THIN_SP_* variables to be our preferred type of thin space
|
||||
#define THIN_SP_CP REAL_THIN_SP_CP
|
||||
#define THIN_SP_UTF8 REAL_THIN_SP_UTF8
|
||||
#define THIN_SP_HTML HTML_HACK_SP
|
||||
|
||||
/** Bitcoin unit definitions. Encapsulates parsing and formatting
|
||||
and serves as list model for drop-down selection boxes.
|
||||
*/
|
||||
class BitcoinUnits: public QAbstractListModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit BitcoinUnits(QObject *parent);
|
||||
|
||||
/** Bitcoin units.
|
||||
@note Source: https://en.bitcoin.it/wiki/Units . Please add only sensible ones
|
||||
*/
|
||||
enum Unit
|
||||
{
|
||||
BTC,
|
||||
mBTC,
|
||||
uBTC
|
||||
};
|
||||
|
||||
enum SeparatorStyle
|
||||
{
|
||||
separatorNever,
|
||||
separatorStandard,
|
||||
separatorAlways
|
||||
};
|
||||
|
||||
//! @name Static API
|
||||
//! Unit conversion and formatting
|
||||
///@{
|
||||
|
||||
//! Get list of units, for drop-down box
|
||||
static QList<Unit> availableUnits();
|
||||
//! Is unit ID valid?
|
||||
static bool valid(int unit);
|
||||
//! Short name
|
||||
static QString name(int unit);
|
||||
//! Longer description
|
||||
static QString description(int unit);
|
||||
//! Number of Satoshis (1e-8) per unit
|
||||
static qint64 factor(int unit);
|
||||
//! Number of decimals left
|
||||
static int decimals(int unit);
|
||||
//! Format as string
|
||||
static QString format(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
|
||||
//! Format as string (with unit)
|
||||
static QString formatWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
|
||||
static QString formatHtmlWithUnit(int unit, const CAmount& amount, bool plussign=false, SeparatorStyle separators=separatorStandard);
|
||||
//! Parse string to coin amount
|
||||
static bool parse(int unit, const QString &value, CAmount *val_out);
|
||||
//! Gets title for amount column including current display unit if optionsModel reference available */
|
||||
static QString getAmountColumnTitle(int unit);
|
||||
///@}
|
||||
|
||||
//! @name AbstractListModel implementation
|
||||
//! List model for unit drop-down selection box.
|
||||
///@{
|
||||
enum RoleIndex {
|
||||
/** Unit identifier */
|
||||
UnitRole = Qt::UserRole
|
||||
};
|
||||
int rowCount(const QModelIndex &parent) const;
|
||||
QVariant data(const QModelIndex &index, int role) const;
|
||||
///@}
|
||||
|
||||
static QString removeSpaces(QString text)
|
||||
{
|
||||
text.remove(' ');
|
||||
text.remove(QChar(THIN_SP_CP));
|
||||
#if (THIN_SP_CP != REAL_THIN_SP_CP)
|
||||
text.remove(QChar(REAL_THIN_SP_CP));
|
||||
#endif
|
||||
return text;
|
||||
}
|
||||
|
||||
//! Return maximum number of base units (Satoshis)
|
||||
static CAmount maxMoney();
|
||||
|
||||
private:
|
||||
QList<BitcoinUnits::Unit> unitlist;
|
||||
};
|
||||
typedef BitcoinUnits::Unit BitcoinUnit;
|
||||
|
||||
#endif // BITCOIN_QT_BITCOINUNITS_H
|
|
@ -1,243 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "clientmodel.h"
|
||||
|
||||
#include "guiconstants.h"
|
||||
#include "peertablemodel.h"
|
||||
|
||||
#include "alert.h"
|
||||
#include "chainparams.h"
|
||||
#include "checkpoints.h"
|
||||
#include "clientversion.h"
|
||||
#include "main.h"
|
||||
#include "net.h"
|
||||
#include "ui_interface.h"
|
||||
#include "util.h"
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <QDebug>
|
||||
#include <QTimer>
|
||||
|
||||
static const int64_t nClientStartupTime = GetTime();
|
||||
|
||||
ClientModel::ClientModel(OptionsModel *optionsModel, QObject *parent) :
|
||||
QObject(parent),
|
||||
optionsModel(optionsModel),
|
||||
peerTableModel(0),
|
||||
cachedNumBlocks(0),
|
||||
cachedBlockDate(QDateTime()),
|
||||
cachedReindexing(0),
|
||||
cachedImporting(0),
|
||||
pollTimer(0)
|
||||
{
|
||||
peerTableModel = new PeerTableModel(this);
|
||||
pollTimer = new QTimer(this);
|
||||
connect(pollTimer, SIGNAL(timeout()), this, SLOT(updateTimer()));
|
||||
pollTimer->start(MODEL_UPDATE_DELAY);
|
||||
|
||||
subscribeToCoreSignals();
|
||||
}
|
||||
|
||||
ClientModel::~ClientModel()
|
||||
{
|
||||
unsubscribeFromCoreSignals();
|
||||
}
|
||||
|
||||
int ClientModel::getNumConnections(unsigned int flags) const
|
||||
{
|
||||
LOCK(cs_vNodes);
|
||||
if (flags == CONNECTIONS_ALL) // Shortcut if we want total
|
||||
return vNodes.size();
|
||||
|
||||
int nNum = 0;
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
if (flags & (pnode->fInbound ? CONNECTIONS_IN : CONNECTIONS_OUT))
|
||||
nNum++;
|
||||
|
||||
return nNum;
|
||||
}
|
||||
|
||||
int ClientModel::getNumBlocks() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
return chainActive.Height();
|
||||
}
|
||||
|
||||
quint64 ClientModel::getTotalBytesRecv() const
|
||||
{
|
||||
return CNode::GetTotalBytesRecv();
|
||||
}
|
||||
|
||||
quint64 ClientModel::getTotalBytesSent() const
|
||||
{
|
||||
return CNode::GetTotalBytesSent();
|
||||
}
|
||||
|
||||
QDateTime ClientModel::getLastBlockDate() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
|
||||
if (chainActive.Tip())
|
||||
return QDateTime::fromTime_t(chainActive.Tip()->GetBlockTime());
|
||||
|
||||
return QDateTime::fromTime_t(Params().GenesisBlock().GetBlockTime()); // Genesis block's time of current network
|
||||
}
|
||||
|
||||
double ClientModel::getVerificationProgress() const
|
||||
{
|
||||
LOCK(cs_main);
|
||||
return Checkpoints::GuessVerificationProgress(Params().Checkpoints(), chainActive.Tip());
|
||||
}
|
||||
|
||||
void ClientModel::updateTimer()
|
||||
{
|
||||
// Get required lock upfront. This avoids the GUI from getting stuck on
|
||||
// periodical polls if the core is holding the locks for a longer time -
|
||||
// for example, during a wallet rescan.
|
||||
TRY_LOCK(cs_main, lockMain);
|
||||
if (!lockMain)
|
||||
return;
|
||||
|
||||
// Some quantities (such as number of blocks) change so fast that we don't want to be notified for each change.
|
||||
// Periodically check and update with a timer.
|
||||
int newNumBlocks = getNumBlocks();
|
||||
QDateTime newBlockDate = getLastBlockDate();
|
||||
|
||||
// check for changed number of blocks we have, number of blocks peers claim to have, reindexing state and importing state
|
||||
if (cachedNumBlocks != newNumBlocks ||
|
||||
cachedBlockDate != newBlockDate ||
|
||||
cachedReindexing != fReindex ||
|
||||
cachedImporting != fImporting)
|
||||
{
|
||||
cachedNumBlocks = newNumBlocks;
|
||||
cachedBlockDate = newBlockDate;
|
||||
cachedReindexing = fReindex;
|
||||
cachedImporting = fImporting;
|
||||
|
||||
Q_EMIT numBlocksChanged(newNumBlocks, newBlockDate);
|
||||
}
|
||||
|
||||
Q_EMIT bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
|
||||
}
|
||||
|
||||
void ClientModel::updateNumConnections(int numConnections)
|
||||
{
|
||||
Q_EMIT numConnectionsChanged(numConnections);
|
||||
}
|
||||
|
||||
void ClientModel::updateAlert(const QString &hash, int status)
|
||||
{
|
||||
// Show error message notification for new alert
|
||||
if(status == CT_NEW)
|
||||
{
|
||||
uint256 hash_256;
|
||||
hash_256.SetHex(hash.toStdString());
|
||||
CAlert alert = CAlert::getAlertByHash(hash_256);
|
||||
if(!alert.IsNull())
|
||||
{
|
||||
Q_EMIT message(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), CClientUIInterface::ICON_ERROR);
|
||||
}
|
||||
}
|
||||
|
||||
Q_EMIT alertsChanged(getStatusBarWarnings());
|
||||
}
|
||||
|
||||
bool ClientModel::inInitialBlockDownload() const
|
||||
{
|
||||
return IsInitialBlockDownload();
|
||||
}
|
||||
|
||||
enum BlockSource ClientModel::getBlockSource() const
|
||||
{
|
||||
if (fReindex)
|
||||
return BLOCK_SOURCE_REINDEX;
|
||||
else if (fImporting)
|
||||
return BLOCK_SOURCE_DISK;
|
||||
else if (getNumConnections() > 0)
|
||||
return BLOCK_SOURCE_NETWORK;
|
||||
|
||||
return BLOCK_SOURCE_NONE;
|
||||
}
|
||||
|
||||
QString ClientModel::getStatusBarWarnings() const
|
||||
{
|
||||
return QString::fromStdString(GetWarnings("statusbar"));
|
||||
}
|
||||
|
||||
OptionsModel *ClientModel::getOptionsModel()
|
||||
{
|
||||
return optionsModel;
|
||||
}
|
||||
|
||||
PeerTableModel *ClientModel::getPeerTableModel()
|
||||
{
|
||||
return peerTableModel;
|
||||
}
|
||||
|
||||
QString ClientModel::formatFullVersion() const
|
||||
{
|
||||
return QString::fromStdString(FormatFullVersion());
|
||||
}
|
||||
|
||||
QString ClientModel::formatBuildDate() const
|
||||
{
|
||||
return QString::fromStdString(CLIENT_DATE);
|
||||
}
|
||||
|
||||
bool ClientModel::isReleaseVersion() const
|
||||
{
|
||||
return CLIENT_VERSION_IS_RELEASE;
|
||||
}
|
||||
|
||||
QString ClientModel::clientName() const
|
||||
{
|
||||
return QString::fromStdString(CLIENT_NAME);
|
||||
}
|
||||
|
||||
QString ClientModel::formatClientStartupTime() const
|
||||
{
|
||||
return QDateTime::fromTime_t(nClientStartupTime).toString();
|
||||
}
|
||||
|
||||
// Handlers for core signals
|
||||
static void ShowProgress(ClientModel *clientmodel, const std::string &title, int nProgress)
|
||||
{
|
||||
// emits signal "showProgress"
|
||||
QMetaObject::invokeMethod(clientmodel, "showProgress", Qt::QueuedConnection,
|
||||
Q_ARG(QString, QString::fromStdString(title)),
|
||||
Q_ARG(int, nProgress));
|
||||
}
|
||||
|
||||
static void NotifyNumConnectionsChanged(ClientModel *clientmodel, int newNumConnections)
|
||||
{
|
||||
// Too noisy: qDebug() << "NotifyNumConnectionsChanged: " + QString::number(newNumConnections);
|
||||
QMetaObject::invokeMethod(clientmodel, "updateNumConnections", Qt::QueuedConnection,
|
||||
Q_ARG(int, newNumConnections));
|
||||
}
|
||||
|
||||
static void NotifyAlertChanged(ClientModel *clientmodel, const uint256 &hash, ChangeType status)
|
||||
{
|
||||
qDebug() << "NotifyAlertChanged: " + QString::fromStdString(hash.GetHex()) + " status=" + QString::number(status);
|
||||
QMetaObject::invokeMethod(clientmodel, "updateAlert", Qt::QueuedConnection,
|
||||
Q_ARG(QString, QString::fromStdString(hash.GetHex())),
|
||||
Q_ARG(int, status));
|
||||
}
|
||||
|
||||
void ClientModel::subscribeToCoreSignals()
|
||||
{
|
||||
// Connect signals to client
|
||||
uiInterface.ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2));
|
||||
uiInterface.NotifyNumConnectionsChanged.connect(boost::bind(NotifyNumConnectionsChanged, this, _1));
|
||||
uiInterface.NotifyAlertChanged.connect(boost::bind(NotifyAlertChanged, this, _1, _2));
|
||||
}
|
||||
|
||||
void ClientModel::unsubscribeFromCoreSignals()
|
||||
{
|
||||
// Disconnect signals from client
|
||||
uiInterface.ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2));
|
||||
uiInterface.NotifyNumConnectionsChanged.disconnect(boost::bind(NotifyNumConnectionsChanged, this, _1));
|
||||
uiInterface.NotifyAlertChanged.disconnect(boost::bind(NotifyAlertChanged, this, _1, _2));
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_CLIENTMODEL_H
|
||||
#define BITCOIN_QT_CLIENTMODEL_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QDateTime>
|
||||
|
||||
class AddressTableModel;
|
||||
class OptionsModel;
|
||||
class PeerTableModel;
|
||||
class TransactionTableModel;
|
||||
|
||||
class CWallet;
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QTimer;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
enum BlockSource {
|
||||
BLOCK_SOURCE_NONE,
|
||||
BLOCK_SOURCE_REINDEX,
|
||||
BLOCK_SOURCE_DISK,
|
||||
BLOCK_SOURCE_NETWORK
|
||||
};
|
||||
|
||||
enum NumConnections {
|
||||
CONNECTIONS_NONE = 0,
|
||||
CONNECTIONS_IN = (1U << 0),
|
||||
CONNECTIONS_OUT = (1U << 1),
|
||||
CONNECTIONS_ALL = (CONNECTIONS_IN | CONNECTIONS_OUT),
|
||||
};
|
||||
|
||||
/** Model for Bitcoin network client. */
|
||||
class ClientModel : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ClientModel(OptionsModel *optionsModel, QObject *parent = 0);
|
||||
~ClientModel();
|
||||
|
||||
OptionsModel *getOptionsModel();
|
||||
PeerTableModel *getPeerTableModel();
|
||||
|
||||
//! Return number of connections, default is in- and outbound (total)
|
||||
int getNumConnections(unsigned int flags = CONNECTIONS_ALL) const;
|
||||
int getNumBlocks() const;
|
||||
|
||||
quint64 getTotalBytesRecv() const;
|
||||
quint64 getTotalBytesSent() const;
|
||||
|
||||
double getVerificationProgress() const;
|
||||
QDateTime getLastBlockDate() const;
|
||||
|
||||
//! Return true if core is doing initial block download
|
||||
bool inInitialBlockDownload() const;
|
||||
//! Return true if core is importing blocks
|
||||
enum BlockSource getBlockSource() const;
|
||||
//! Return warnings to be displayed in status bar
|
||||
QString getStatusBarWarnings() const;
|
||||
|
||||
QString formatFullVersion() const;
|
||||
QString formatBuildDate() const;
|
||||
bool isReleaseVersion() const;
|
||||
QString clientName() const;
|
||||
QString formatClientStartupTime() const;
|
||||
|
||||
private:
|
||||
OptionsModel *optionsModel;
|
||||
PeerTableModel *peerTableModel;
|
||||
|
||||
int cachedNumBlocks;
|
||||
QDateTime cachedBlockDate;
|
||||
bool cachedReindexing;
|
||||
bool cachedImporting;
|
||||
|
||||
QTimer *pollTimer;
|
||||
|
||||
void subscribeToCoreSignals();
|
||||
void unsubscribeFromCoreSignals();
|
||||
|
||||
Q_SIGNALS:
|
||||
void numConnectionsChanged(int count);
|
||||
void numBlocksChanged(int count, const QDateTime& blockDate);
|
||||
void alertsChanged(const QString &warnings);
|
||||
void bytesChanged(quint64 totalBytesIn, quint64 totalBytesOut);
|
||||
|
||||
//! Fired when a message should be reported to the user
|
||||
void message(const QString &title, const QString &message, unsigned int style);
|
||||
|
||||
// Show progress dialog e.g. for verifychain
|
||||
void showProgress(const QString &title, int nProgress);
|
||||
|
||||
public Q_SLOTS:
|
||||
void updateTimer();
|
||||
void updateNumConnections(int numConnections);
|
||||
void updateAlert(const QString &hash, int status);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_CLIENTMODEL_H
|
|
@ -1,828 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "coincontroldialog.h"
|
||||
#include "ui_coincontroldialog.h"
|
||||
|
||||
#include "addresstablemodel.h"
|
||||
#include "bitcoinunits.h"
|
||||
#include "guiutil.h"
|
||||
#include "optionsmodel.h"
|
||||
#include "scicon.h"
|
||||
#include "walletmodel.h"
|
||||
|
||||
#include "coincontrol.h"
|
||||
#include "init.h"
|
||||
#include "main.h"
|
||||
#include "wallet/wallet.h"
|
||||
|
||||
#include <boost/assign/list_of.hpp> // for 'map_list_of()'
|
||||
|
||||
#include <QApplication>
|
||||
#include <QCheckBox>
|
||||
#include <QCursor>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFlags>
|
||||
#include <QIcon>
|
||||
#include <QSettings>
|
||||
#include <QString>
|
||||
#include <QTreeWidget>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
using namespace std;
|
||||
QList<CAmount> CoinControlDialog::payAmounts;
|
||||
CCoinControl* CoinControlDialog::coinControl = new CCoinControl();
|
||||
bool CoinControlDialog::fSubtractFeeFromAmount = false;
|
||||
|
||||
CoinControlDialog::CoinControlDialog(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::CoinControlDialog),
|
||||
model(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
// context menu actions
|
||||
QAction *copyAddressAction = new QAction(tr("Copy address"), this);
|
||||
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
||||
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
|
||||
copyTransactionHashAction = new QAction(tr("Copy transaction ID"), this); // we need to enable/disable this
|
||||
lockAction = new QAction(tr("Lock unspent"), this); // we need to enable/disable this
|
||||
unlockAction = new QAction(tr("Unlock unspent"), this); // we need to enable/disable this
|
||||
|
||||
// context menu
|
||||
contextMenu = new QMenu();
|
||||
contextMenu->addAction(copyAddressAction);
|
||||
contextMenu->addAction(copyLabelAction);
|
||||
contextMenu->addAction(copyAmountAction);
|
||||
contextMenu->addAction(copyTransactionHashAction);
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction(lockAction);
|
||||
contextMenu->addAction(unlockAction);
|
||||
|
||||
// context menu signals
|
||||
connect(ui->treeWidget, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint)));
|
||||
connect(copyAddressAction, SIGNAL(triggered()), this, SLOT(copyAddress()));
|
||||
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
|
||||
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
|
||||
connect(copyTransactionHashAction, SIGNAL(triggered()), this, SLOT(copyTransactionHash()));
|
||||
connect(lockAction, SIGNAL(triggered()), this, SLOT(lockCoin()));
|
||||
connect(unlockAction, SIGNAL(triggered()), this, SLOT(unlockCoin()));
|
||||
|
||||
// clipboard actions
|
||||
QAction *clipboardQuantityAction = new QAction(tr("Copy quantity"), this);
|
||||
QAction *clipboardAmountAction = new QAction(tr("Copy amount"), this);
|
||||
QAction *clipboardFeeAction = new QAction(tr("Copy fee"), this);
|
||||
QAction *clipboardAfterFeeAction = new QAction(tr("Copy after fee"), this);
|
||||
QAction *clipboardBytesAction = new QAction(tr("Copy bytes"), this);
|
||||
QAction *clipboardPriorityAction = new QAction(tr("Copy priority"), this);
|
||||
QAction *clipboardLowOutputAction = new QAction(tr("Copy dust"), this);
|
||||
QAction *clipboardChangeAction = new QAction(tr("Copy change"), this);
|
||||
|
||||
connect(clipboardQuantityAction, SIGNAL(triggered()), this, SLOT(clipboardQuantity()));
|
||||
connect(clipboardAmountAction, SIGNAL(triggered()), this, SLOT(clipboardAmount()));
|
||||
connect(clipboardFeeAction, SIGNAL(triggered()), this, SLOT(clipboardFee()));
|
||||
connect(clipboardAfterFeeAction, SIGNAL(triggered()), this, SLOT(clipboardAfterFee()));
|
||||
connect(clipboardBytesAction, SIGNAL(triggered()), this, SLOT(clipboardBytes()));
|
||||
connect(clipboardPriorityAction, SIGNAL(triggered()), this, SLOT(clipboardPriority()));
|
||||
connect(clipboardLowOutputAction, SIGNAL(triggered()), this, SLOT(clipboardLowOutput()));
|
||||
connect(clipboardChangeAction, SIGNAL(triggered()), this, SLOT(clipboardChange()));
|
||||
|
||||
ui->labelCoinControlQuantity->addAction(clipboardQuantityAction);
|
||||
ui->labelCoinControlAmount->addAction(clipboardAmountAction);
|
||||
ui->labelCoinControlFee->addAction(clipboardFeeAction);
|
||||
ui->labelCoinControlAfterFee->addAction(clipboardAfterFeeAction);
|
||||
ui->labelCoinControlBytes->addAction(clipboardBytesAction);
|
||||
ui->labelCoinControlPriority->addAction(clipboardPriorityAction);
|
||||
ui->labelCoinControlLowOutput->addAction(clipboardLowOutputAction);
|
||||
ui->labelCoinControlChange->addAction(clipboardChangeAction);
|
||||
|
||||
// toggle tree/list mode
|
||||
connect(ui->radioTreeMode, SIGNAL(toggled(bool)), this, SLOT(radioTreeMode(bool)));
|
||||
connect(ui->radioListMode, SIGNAL(toggled(bool)), this, SLOT(radioListMode(bool)));
|
||||
|
||||
// click on checkbox
|
||||
connect(ui->treeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), this, SLOT(viewItemChanged(QTreeWidgetItem*, int)));
|
||||
|
||||
// click on header
|
||||
#if QT_VERSION < 0x050000
|
||||
ui->treeWidget->header()->setClickable(true);
|
||||
#else
|
||||
ui->treeWidget->header()->setSectionsClickable(true);
|
||||
#endif
|
||||
connect(ui->treeWidget->header(), SIGNAL(sectionClicked(int)), this, SLOT(headerSectionClicked(int)));
|
||||
|
||||
// ok button
|
||||
connect(ui->buttonBox, SIGNAL(clicked( QAbstractButton*)), this, SLOT(buttonBoxClicked(QAbstractButton*)));
|
||||
|
||||
// (un)select all
|
||||
connect(ui->pushButtonSelectAll, SIGNAL(clicked()), this, SLOT(buttonSelectAllClicked()));
|
||||
|
||||
// change coin control first column label due Qt4 bug.
|
||||
// see https://github.com/bitcoin/bitcoin/issues/5716
|
||||
ui->treeWidget->headerItem()->setText(COLUMN_CHECKBOX, QString());
|
||||
|
||||
ui->treeWidget->setColumnWidth(COLUMN_CHECKBOX, 84);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_AMOUNT, 100);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_LABEL, 170);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_ADDRESS, 290);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_DATE, 110);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_CONFIRMATIONS, 100);
|
||||
ui->treeWidget->setColumnWidth(COLUMN_PRIORITY, 100);
|
||||
ui->treeWidget->setColumnHidden(COLUMN_TXHASH, true); // store transacton hash in this column, but don't show it
|
||||
ui->treeWidget->setColumnHidden(COLUMN_VOUT_INDEX, true); // store vout index in this column, but don't show it
|
||||
ui->treeWidget->setColumnHidden(COLUMN_AMOUNT_INT64, true); // store amount int64 in this column, but don't show it
|
||||
ui->treeWidget->setColumnHidden(COLUMN_PRIORITY_INT64, true); // store priority int64 in this column, but don't show it
|
||||
ui->treeWidget->setColumnHidden(COLUMN_DATE_INT64, true); // store date int64 in this column, but don't show it
|
||||
|
||||
// default view is sorted by amount desc
|
||||
sortView(COLUMN_AMOUNT_INT64, Qt::DescendingOrder);
|
||||
|
||||
// restore list mode and sortorder as a convenience feature
|
||||
QSettings settings;
|
||||
if (settings.contains("nCoinControlMode") && !settings.value("nCoinControlMode").toBool())
|
||||
ui->radioTreeMode->click();
|
||||
if (settings.contains("nCoinControlSortColumn") && settings.contains("nCoinControlSortOrder"))
|
||||
sortView(settings.value("nCoinControlSortColumn").toInt(), ((Qt::SortOrder)settings.value("nCoinControlSortOrder").toInt()));
|
||||
}
|
||||
|
||||
CoinControlDialog::~CoinControlDialog()
|
||||
{
|
||||
QSettings settings;
|
||||
settings.setValue("nCoinControlMode", ui->radioListMode->isChecked());
|
||||
settings.setValue("nCoinControlSortColumn", sortColumn);
|
||||
settings.setValue("nCoinControlSortOrder", (int)sortOrder);
|
||||
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void CoinControlDialog::setModel(WalletModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
|
||||
if(model && model->getOptionsModel() && model->getAddressTableModel())
|
||||
{
|
||||
updateView();
|
||||
updateLabelLocked();
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
}
|
||||
|
||||
// helper function str_pad
|
||||
QString CoinControlDialog::strPad(QString s, int nPadLength, QString sPadding)
|
||||
{
|
||||
while (s.length() < nPadLength)
|
||||
s = sPadding + s;
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
// ok button
|
||||
void CoinControlDialog::buttonBoxClicked(QAbstractButton* button)
|
||||
{
|
||||
if (ui->buttonBox->buttonRole(button) == QDialogButtonBox::AcceptRole)
|
||||
done(QDialog::Accepted); // closes the dialog
|
||||
}
|
||||
|
||||
// (un)select all
|
||||
void CoinControlDialog::buttonSelectAllClicked()
|
||||
{
|
||||
Qt::CheckState state = Qt::Checked;
|
||||
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
|
||||
{
|
||||
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != Qt::Unchecked)
|
||||
{
|
||||
state = Qt::Unchecked;
|
||||
break;
|
||||
}
|
||||
}
|
||||
ui->treeWidget->setEnabled(false);
|
||||
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
|
||||
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) != state)
|
||||
ui->treeWidget->topLevelItem(i)->setCheckState(COLUMN_CHECKBOX, state);
|
||||
ui->treeWidget->setEnabled(true);
|
||||
if (state == Qt::Unchecked)
|
||||
coinControl->UnSelectAll(); // just to be sure
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
|
||||
// context menu
|
||||
void CoinControlDialog::showMenu(const QPoint &point)
|
||||
{
|
||||
QTreeWidgetItem *item = ui->treeWidget->itemAt(point);
|
||||
if(item)
|
||||
{
|
||||
contextMenuItem = item;
|
||||
|
||||
// disable some items (like Copy Transaction ID, lock, unlock) for tree roots in context menu
|
||||
if (item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode)
|
||||
{
|
||||
copyTransactionHashAction->setEnabled(true);
|
||||
if (model->isLockedCoin(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt()))
|
||||
{
|
||||
lockAction->setEnabled(false);
|
||||
unlockAction->setEnabled(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
lockAction->setEnabled(true);
|
||||
unlockAction->setEnabled(false);
|
||||
}
|
||||
}
|
||||
else // this means click on parent node in tree mode -> disable all
|
||||
{
|
||||
copyTransactionHashAction->setEnabled(false);
|
||||
lockAction->setEnabled(false);
|
||||
unlockAction->setEnabled(false);
|
||||
}
|
||||
|
||||
// show context menu
|
||||
contextMenu->exec(QCursor::pos());
|
||||
}
|
||||
}
|
||||
|
||||
// context menu action: copy amount
|
||||
void CoinControlDialog::copyAmount()
|
||||
{
|
||||
GUIUtil::setClipboard(BitcoinUnits::removeSpaces(contextMenuItem->text(COLUMN_AMOUNT)));
|
||||
}
|
||||
|
||||
// context menu action: copy label
|
||||
void CoinControlDialog::copyLabel()
|
||||
{
|
||||
if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_LABEL).length() == 0 && contextMenuItem->parent())
|
||||
GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_LABEL));
|
||||
else
|
||||
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_LABEL));
|
||||
}
|
||||
|
||||
// context menu action: copy address
|
||||
void CoinControlDialog::copyAddress()
|
||||
{
|
||||
if (ui->radioTreeMode->isChecked() && contextMenuItem->text(COLUMN_ADDRESS).length() == 0 && contextMenuItem->parent())
|
||||
GUIUtil::setClipboard(contextMenuItem->parent()->text(COLUMN_ADDRESS));
|
||||
else
|
||||
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_ADDRESS));
|
||||
}
|
||||
|
||||
// context menu action: copy transaction id
|
||||
void CoinControlDialog::copyTransactionHash()
|
||||
{
|
||||
GUIUtil::setClipboard(contextMenuItem->text(COLUMN_TXHASH));
|
||||
}
|
||||
|
||||
// context menu action: lock coin
|
||||
void CoinControlDialog::lockCoin()
|
||||
{
|
||||
if (contextMenuItem->checkState(COLUMN_CHECKBOX) == Qt::Checked)
|
||||
contextMenuItem->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
||||
|
||||
COutPoint outpt(uint256S(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt());
|
||||
model->lockCoin(outpt);
|
||||
contextMenuItem->setDisabled(true);
|
||||
contextMenuItem->setIcon(COLUMN_CHECKBOX, SingleColorIcon(":/icons/lock_closed"));
|
||||
updateLabelLocked();
|
||||
}
|
||||
|
||||
// context menu action: unlock coin
|
||||
void CoinControlDialog::unlockCoin()
|
||||
{
|
||||
COutPoint outpt(uint256S(contextMenuItem->text(COLUMN_TXHASH).toStdString()), contextMenuItem->text(COLUMN_VOUT_INDEX).toUInt());
|
||||
model->unlockCoin(outpt);
|
||||
contextMenuItem->setDisabled(false);
|
||||
contextMenuItem->setIcon(COLUMN_CHECKBOX, QIcon());
|
||||
updateLabelLocked();
|
||||
}
|
||||
|
||||
// copy label "Quantity" to clipboard
|
||||
void CoinControlDialog::clipboardQuantity()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlQuantity->text());
|
||||
}
|
||||
|
||||
// copy label "Amount" to clipboard
|
||||
void CoinControlDialog::clipboardAmount()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlAmount->text().left(ui->labelCoinControlAmount->text().indexOf(" ")));
|
||||
}
|
||||
|
||||
// copy label "Fee" to clipboard
|
||||
void CoinControlDialog::clipboardFee()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlFee->text().left(ui->labelCoinControlFee->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
|
||||
}
|
||||
|
||||
// copy label "After fee" to clipboard
|
||||
void CoinControlDialog::clipboardAfterFee()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlAfterFee->text().left(ui->labelCoinControlAfterFee->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
|
||||
}
|
||||
|
||||
// copy label "Bytes" to clipboard
|
||||
void CoinControlDialog::clipboardBytes()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlBytes->text().replace(ASYMP_UTF8, ""));
|
||||
}
|
||||
|
||||
// copy label "Priority" to clipboard
|
||||
void CoinControlDialog::clipboardPriority()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlPriority->text());
|
||||
}
|
||||
|
||||
// copy label "Dust" to clipboard
|
||||
void CoinControlDialog::clipboardLowOutput()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlLowOutput->text());
|
||||
}
|
||||
|
||||
// copy label "Change" to clipboard
|
||||
void CoinControlDialog::clipboardChange()
|
||||
{
|
||||
GUIUtil::setClipboard(ui->labelCoinControlChange->text().left(ui->labelCoinControlChange->text().indexOf(" ")).replace(ASYMP_UTF8, ""));
|
||||
}
|
||||
|
||||
// treeview: sort
|
||||
void CoinControlDialog::sortView(int column, Qt::SortOrder order)
|
||||
{
|
||||
sortColumn = column;
|
||||
sortOrder = order;
|
||||
ui->treeWidget->sortItems(column, order);
|
||||
ui->treeWidget->header()->setSortIndicator(getMappedColumn(sortColumn), sortOrder);
|
||||
}
|
||||
|
||||
// treeview: clicked on header
|
||||
void CoinControlDialog::headerSectionClicked(int logicalIndex)
|
||||
{
|
||||
if (logicalIndex == COLUMN_CHECKBOX) // click on most left column -> do nothing
|
||||
{
|
||||
ui->treeWidget->header()->setSortIndicator(getMappedColumn(sortColumn), sortOrder);
|
||||
}
|
||||
else
|
||||
{
|
||||
logicalIndex = getMappedColumn(logicalIndex, false);
|
||||
|
||||
if (sortColumn == logicalIndex)
|
||||
sortOrder = ((sortOrder == Qt::AscendingOrder) ? Qt::DescendingOrder : Qt::AscendingOrder);
|
||||
else
|
||||
{
|
||||
sortColumn = logicalIndex;
|
||||
sortOrder = ((sortColumn == COLUMN_LABEL || sortColumn == COLUMN_ADDRESS) ? Qt::AscendingOrder : Qt::DescendingOrder); // if label or address then default => asc, else default => desc
|
||||
}
|
||||
|
||||
sortView(sortColumn, sortOrder);
|
||||
}
|
||||
}
|
||||
|
||||
// toggle tree mode
|
||||
void CoinControlDialog::radioTreeMode(bool checked)
|
||||
{
|
||||
if (checked && model)
|
||||
updateView();
|
||||
}
|
||||
|
||||
// toggle list mode
|
||||
void CoinControlDialog::radioListMode(bool checked)
|
||||
{
|
||||
if (checked && model)
|
||||
updateView();
|
||||
}
|
||||
|
||||
// checkbox clicked by user
|
||||
void CoinControlDialog::viewItemChanged(QTreeWidgetItem* item, int column)
|
||||
{
|
||||
if (column == COLUMN_CHECKBOX && item->text(COLUMN_TXHASH).length() == 64) // transaction hash is 64 characters (this means its a child node, so its not a parent node in tree mode)
|
||||
{
|
||||
COutPoint outpt(uint256S(item->text(COLUMN_TXHASH).toStdString()), item->text(COLUMN_VOUT_INDEX).toUInt());
|
||||
|
||||
if (item->checkState(COLUMN_CHECKBOX) == Qt::Unchecked)
|
||||
coinControl->UnSelect(outpt);
|
||||
else if (item->isDisabled()) // locked (this happens if "check all" through parent node)
|
||||
item->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
||||
else
|
||||
coinControl->Select(outpt);
|
||||
|
||||
// selection changed -> update labels
|
||||
if (ui->treeWidget->isEnabled()) // do not update on every click for (un)select all
|
||||
CoinControlDialog::updateLabels(model, this);
|
||||
}
|
||||
|
||||
// todo: this is a temporary qt5 fix: when clicking a parent node in tree mode, the parent node
|
||||
// including all children are partially selected. But the parent node should be fully selected
|
||||
// as well as the children. Children should never be partially selected in the first place.
|
||||
// Please remove this ugly fix, once the bug is solved upstream.
|
||||
#if QT_VERSION >= 0x050000
|
||||
else if (column == COLUMN_CHECKBOX && item->childCount() > 0)
|
||||
{
|
||||
if (item->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked && item->child(0)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked)
|
||||
item->setCheckState(COLUMN_CHECKBOX, Qt::Checked);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
// return human readable label for priority number
|
||||
QString CoinControlDialog::getPriorityLabel(double dPriority, double mempoolEstimatePriority)
|
||||
{
|
||||
double dPriorityMedium = mempoolEstimatePriority;
|
||||
|
||||
if (dPriorityMedium <= 0)
|
||||
dPriorityMedium = AllowFreeThreshold(); // not enough data, back to hard-coded
|
||||
|
||||
if (dPriority / 1000000 > dPriorityMedium) return tr("highest");
|
||||
else if (dPriority / 100000 > dPriorityMedium) return tr("higher");
|
||||
else if (dPriority / 10000 > dPriorityMedium) return tr("high");
|
||||
else if (dPriority / 1000 > dPriorityMedium) return tr("medium-high");
|
||||
else if (dPriority > dPriorityMedium) return tr("medium");
|
||||
else if (dPriority * 10 > dPriorityMedium) return tr("low-medium");
|
||||
else if (dPriority * 100 > dPriorityMedium) return tr("low");
|
||||
else if (dPriority * 1000 > dPriorityMedium) return tr("lower");
|
||||
else return tr("lowest");
|
||||
}
|
||||
|
||||
// shows count of locked unspent outputs
|
||||
void CoinControlDialog::updateLabelLocked()
|
||||
{
|
||||
vector<COutPoint> vOutpts;
|
||||
model->listLockedCoins(vOutpts);
|
||||
if (vOutpts.size() > 0)
|
||||
{
|
||||
ui->labelLocked->setText(tr("(%1 locked)").arg(vOutpts.size()));
|
||||
ui->labelLocked->setVisible(true);
|
||||
}
|
||||
else ui->labelLocked->setVisible(false);
|
||||
}
|
||||
|
||||
void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
|
||||
{
|
||||
if (!model)
|
||||
return;
|
||||
|
||||
// nPayAmount
|
||||
CAmount nPayAmount = 0;
|
||||
bool fDust = false;
|
||||
CMutableTransaction txDummy;
|
||||
Q_FOREACH(const CAmount &amount, CoinControlDialog::payAmounts)
|
||||
{
|
||||
nPayAmount += amount;
|
||||
|
||||
if (amount > 0)
|
||||
{
|
||||
CTxOut txout(amount, (CScript)vector<unsigned char>(24, 0));
|
||||
txDummy.vout.push_back(txout);
|
||||
if (txout.IsDust(::minRelayTxFee))
|
||||
fDust = true;
|
||||
}
|
||||
}
|
||||
|
||||
QString sPriorityLabel = tr("none");
|
||||
CAmount nAmount = 0;
|
||||
CAmount nPayFee = 0;
|
||||
CAmount nAfterFee = 0;
|
||||
CAmount nChange = 0;
|
||||
unsigned int nBytes = 0;
|
||||
unsigned int nBytesInputs = 0;
|
||||
double dPriority = 0;
|
||||
double dPriorityInputs = 0;
|
||||
unsigned int nQuantity = 0;
|
||||
int nQuantityUncompressed = 0;
|
||||
bool fAllowFree = false;
|
||||
|
||||
vector<COutPoint> vCoinControl;
|
||||
vector<COutput> vOutputs;
|
||||
coinControl->ListSelected(vCoinControl);
|
||||
model->getOutputs(vCoinControl, vOutputs);
|
||||
|
||||
BOOST_FOREACH(const COutput& out, vOutputs)
|
||||
{
|
||||
// unselect already spent, very unlikely scenario, this could happen
|
||||
// when selected are spent elsewhere, like rpc or another computer
|
||||
uint256 txhash = out.tx->GetHash();
|
||||
COutPoint outpt(txhash, out.i);
|
||||
if (model->isSpent(outpt))
|
||||
{
|
||||
coinControl->UnSelect(outpt);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Quantity
|
||||
nQuantity++;
|
||||
|
||||
// Amount
|
||||
nAmount += out.tx->vout[out.i].nValue;
|
||||
|
||||
// Priority
|
||||
dPriorityInputs += (double)out.tx->vout[out.i].nValue * (out.nDepth+1);
|
||||
|
||||
// Bytes
|
||||
CTxDestination address;
|
||||
if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
|
||||
{
|
||||
CPubKey pubkey;
|
||||
CKeyID *keyid = boost::get<CKeyID>(&address);
|
||||
if (keyid && model->getPubKey(*keyid, pubkey))
|
||||
{
|
||||
nBytesInputs += (pubkey.IsCompressed() ? 148 : 180);
|
||||
if (!pubkey.IsCompressed())
|
||||
nQuantityUncompressed++;
|
||||
}
|
||||
else
|
||||
nBytesInputs += 148; // in all error cases, simply assume 148 here
|
||||
}
|
||||
else nBytesInputs += 148;
|
||||
}
|
||||
|
||||
// calculation
|
||||
if (nQuantity > 0)
|
||||
{
|
||||
// Bytes
|
||||
nBytes = nBytesInputs + ((CoinControlDialog::payAmounts.size() > 0 ? CoinControlDialog::payAmounts.size() + 1 : 2) * 34) + 10; // always assume +1 output for change here
|
||||
|
||||
// Priority
|
||||
double mempoolEstimatePriority = mempool.estimatePriority(nTxConfirmTarget);
|
||||
dPriority = dPriorityInputs / (nBytes - nBytesInputs + (nQuantityUncompressed * 29)); // 29 = 180 - 151 (uncompressed public keys are over the limit. max 151 bytes of the input are ignored for priority)
|
||||
sPriorityLabel = CoinControlDialog::getPriorityLabel(dPriority, mempoolEstimatePriority);
|
||||
|
||||
// in the subtract fee from amount case, we can tell if zero change already and subtract the bytes, so that fee calculation afterwards is accurate
|
||||
if (CoinControlDialog::fSubtractFeeFromAmount)
|
||||
if (nAmount - nPayAmount == 0)
|
||||
nBytes -= 34;
|
||||
|
||||
// Fee
|
||||
nPayFee = CWallet::GetMinimumFee(nBytes, nTxConfirmTarget, mempool);
|
||||
|
||||
// Allow free?
|
||||
double dPriorityNeeded = mempoolEstimatePriority;
|
||||
if (dPriorityNeeded <= 0)
|
||||
dPriorityNeeded = AllowFreeThreshold(); // not enough data, back to hard-coded
|
||||
fAllowFree = (dPriority >= dPriorityNeeded);
|
||||
|
||||
if (fSendFreeTransactions)
|
||||
if (fAllowFree && nBytes <= MAX_FREE_TRANSACTION_CREATE_SIZE)
|
||||
nPayFee = 0;
|
||||
|
||||
if (nPayAmount > 0)
|
||||
{
|
||||
nChange = nAmount - nPayAmount;
|
||||
if (!CoinControlDialog::fSubtractFeeFromAmount)
|
||||
nChange -= nPayFee;
|
||||
|
||||
// Never create dust outputs; if we would, just add the dust to the fee.
|
||||
if (nChange > 0 && nChange < CENT)
|
||||
{
|
||||
CTxOut txout(nChange, (CScript)vector<unsigned char>(24, 0));
|
||||
if (txout.IsDust(::minRelayTxFee))
|
||||
{
|
||||
if (CoinControlDialog::fSubtractFeeFromAmount) // dust-change will be raised until no dust
|
||||
nChange = txout.GetDustThreshold(::minRelayTxFee);
|
||||
else
|
||||
{
|
||||
nPayFee += nChange;
|
||||
nChange = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (nChange == 0 && !CoinControlDialog::fSubtractFeeFromAmount)
|
||||
nBytes -= 34;
|
||||
}
|
||||
|
||||
// after fee
|
||||
nAfterFee = nAmount - nPayFee;
|
||||
if (nAfterFee < 0)
|
||||
nAfterFee = 0;
|
||||
}
|
||||
|
||||
// actually update labels
|
||||
int nDisplayUnit = BitcoinUnits::BTC;
|
||||
if (model && model->getOptionsModel())
|
||||
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||
|
||||
QLabel *l1 = dialog->findChild<QLabel *>("labelCoinControlQuantity");
|
||||
QLabel *l2 = dialog->findChild<QLabel *>("labelCoinControlAmount");
|
||||
QLabel *l3 = dialog->findChild<QLabel *>("labelCoinControlFee");
|
||||
QLabel *l4 = dialog->findChild<QLabel *>("labelCoinControlAfterFee");
|
||||
QLabel *l5 = dialog->findChild<QLabel *>("labelCoinControlBytes");
|
||||
QLabel *l6 = dialog->findChild<QLabel *>("labelCoinControlPriority");
|
||||
QLabel *l7 = dialog->findChild<QLabel *>("labelCoinControlLowOutput");
|
||||
QLabel *l8 = dialog->findChild<QLabel *>("labelCoinControlChange");
|
||||
|
||||
// enable/disable "dust" and "change"
|
||||
dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setEnabled(nPayAmount > 0);
|
||||
dialog->findChild<QLabel *>("labelCoinControlLowOutput") ->setEnabled(nPayAmount > 0);
|
||||
dialog->findChild<QLabel *>("labelCoinControlChangeText") ->setEnabled(nPayAmount > 0);
|
||||
dialog->findChild<QLabel *>("labelCoinControlChange") ->setEnabled(nPayAmount > 0);
|
||||
|
||||
// stats
|
||||
l1->setText(QString::number(nQuantity)); // Quantity
|
||||
l2->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAmount)); // Amount
|
||||
l3->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee
|
||||
l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee
|
||||
l5->setText(((nBytes > 0) ? ASYMP_UTF8 : "") + QString::number(nBytes)); // Bytes
|
||||
l6->setText(sPriorityLabel); // Priority
|
||||
l7->setText(fDust ? tr("yes") : tr("no")); // Dust
|
||||
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
|
||||
if (nPayFee > 0 && !(payTxFee.GetFeePerK() > 0 && fPayAtLeastCustomFee && nBytes < 1000))
|
||||
{
|
||||
l3->setText(ASYMP_UTF8 + l3->text());
|
||||
l4->setText(ASYMP_UTF8 + l4->text());
|
||||
if (nChange > 0 && !CoinControlDialog::fSubtractFeeFromAmount)
|
||||
l8->setText(ASYMP_UTF8 + l8->text());
|
||||
}
|
||||
|
||||
// turn labels "red"
|
||||
l5->setStyleSheet((nBytes >= MAX_FREE_TRANSACTION_CREATE_SIZE) ? "color:red;" : "");// Bytes >= 1000
|
||||
l6->setStyleSheet((dPriority > 0 && !fAllowFree) ? "color:red;" : ""); // Priority < "medium"
|
||||
l7->setStyleSheet((fDust) ? "color:red;" : ""); // Dust = "yes"
|
||||
|
||||
// tool tips
|
||||
QString toolTip1 = tr("This label turns red if the transaction size is greater than 1000 bytes.") + "<br /><br />";
|
||||
toolTip1 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CWallet::minTxFee.GetFeePerK())) + "<br /><br />";
|
||||
toolTip1 += tr("Can vary +/- 1 byte per input.");
|
||||
|
||||
QString toolTip2 = tr("Transactions with higher priority are more likely to get included into a block.") + "<br /><br />";
|
||||
toolTip2 += tr("This label turns red if the priority is smaller than \"medium\".") + "<br /><br />";
|
||||
toolTip2 += tr("This means a fee of at least %1 per kB is required.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, CWallet::minTxFee.GetFeePerK()));
|
||||
|
||||
QString toolTip3 = tr("This label turns red if any recipient receives an amount smaller than %1.").arg(BitcoinUnits::formatWithUnit(nDisplayUnit, ::minRelayTxFee.GetFee(546)));
|
||||
|
||||
// how many satoshis the estimated fee can vary per byte we guess wrong
|
||||
double dFeeVary;
|
||||
if (payTxFee.GetFeePerK() > 0)
|
||||
dFeeVary = (double)std::max(CWallet::minTxFee.GetFeePerK(), payTxFee.GetFeePerK()) / 1000;
|
||||
else
|
||||
dFeeVary = (double)std::max(CWallet::minTxFee.GetFeePerK(), mempool.estimateFee(nTxConfirmTarget).GetFeePerK()) / 1000;
|
||||
QString toolTip4 = tr("Can vary +/- %1 satoshi(s) per input.").arg(dFeeVary);
|
||||
|
||||
l3->setToolTip(toolTip4);
|
||||
l4->setToolTip(toolTip4);
|
||||
l5->setToolTip(toolTip1);
|
||||
l6->setToolTip(toolTip2);
|
||||
l7->setToolTip(toolTip3);
|
||||
l8->setToolTip(toolTip4);
|
||||
dialog->findChild<QLabel *>("labelCoinControlFeeText") ->setToolTip(l3->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlAfterFeeText") ->setToolTip(l4->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlBytesText") ->setToolTip(l5->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlPriorityText") ->setToolTip(l6->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlLowOutputText")->setToolTip(l7->toolTip());
|
||||
dialog->findChild<QLabel *>("labelCoinControlChangeText") ->setToolTip(l8->toolTip());
|
||||
|
||||
// Insufficient funds
|
||||
QLabel *label = dialog->findChild<QLabel *>("labelCoinControlInsuffFunds");
|
||||
if (label)
|
||||
label->setVisible(nChange < 0);
|
||||
}
|
||||
|
||||
void CoinControlDialog::updateView()
|
||||
{
|
||||
if (!model || !model->getOptionsModel() || !model->getAddressTableModel())
|
||||
return;
|
||||
|
||||
bool treeMode = ui->radioTreeMode->isChecked();
|
||||
|
||||
ui->treeWidget->clear();
|
||||
ui->treeWidget->setEnabled(false); // performance, otherwise updateLabels would be called for every checked checkbox
|
||||
ui->treeWidget->setAlternatingRowColors(!treeMode);
|
||||
QFlags<Qt::ItemFlag> flgCheckbox = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable;
|
||||
QFlags<Qt::ItemFlag> flgTristate = Qt::ItemIsSelectable | Qt::ItemIsEnabled | Qt::ItemIsUserCheckable | Qt::ItemIsTristate;
|
||||
|
||||
int nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
|
||||
double mempoolEstimatePriority = mempool.estimatePriority(nTxConfirmTarget);
|
||||
|
||||
map<QString, vector<COutput> > mapCoins;
|
||||
model->listCoins(mapCoins);
|
||||
|
||||
BOOST_FOREACH(PAIRTYPE(QString, vector<COutput>) coins, mapCoins)
|
||||
{
|
||||
QTreeWidgetItem *itemWalletAddress = new QTreeWidgetItem();
|
||||
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
||||
QString sWalletAddress = coins.first;
|
||||
QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress);
|
||||
if (sWalletLabel.isEmpty())
|
||||
sWalletLabel = tr("(no label)");
|
||||
|
||||
if (treeMode)
|
||||
{
|
||||
// wallet address
|
||||
ui->treeWidget->addTopLevelItem(itemWalletAddress);
|
||||
|
||||
itemWalletAddress->setFlags(flgTristate);
|
||||
itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked);
|
||||
|
||||
// label
|
||||
itemWalletAddress->setText(COLUMN_LABEL, sWalletLabel);
|
||||
|
||||
// address
|
||||
itemWalletAddress->setText(COLUMN_ADDRESS, sWalletAddress);
|
||||
}
|
||||
|
||||
CAmount nSum = 0;
|
||||
double dPrioritySum = 0;
|
||||
int nChildren = 0;
|
||||
int nInputSum = 0;
|
||||
BOOST_FOREACH(const COutput& out, coins.second)
|
||||
{
|
||||
int nInputSize = 0;
|
||||
nSum += out.tx->vout[out.i].nValue;
|
||||
nChildren++;
|
||||
|
||||
QTreeWidgetItem *itemOutput;
|
||||
if (treeMode) itemOutput = new QTreeWidgetItem(itemWalletAddress);
|
||||
else itemOutput = new QTreeWidgetItem(ui->treeWidget);
|
||||
itemOutput->setFlags(flgCheckbox);
|
||||
itemOutput->setCheckState(COLUMN_CHECKBOX,Qt::Unchecked);
|
||||
|
||||
// address
|
||||
CTxDestination outputAddress;
|
||||
QString sAddress = "";
|
||||
if(ExtractDestination(out.tx->vout[out.i].scriptPubKey, outputAddress))
|
||||
{
|
||||
sAddress = QString::fromStdString(CBitcoinAddress(outputAddress).ToString());
|
||||
|
||||
// if listMode or change => show bitcoin address. In tree mode, address is not shown again for direct wallet address outputs
|
||||
if (!treeMode || (!(sAddress == sWalletAddress)))
|
||||
itemOutput->setText(COLUMN_ADDRESS, sAddress);
|
||||
|
||||
CPubKey pubkey;
|
||||
CKeyID *keyid = boost::get<CKeyID>(&outputAddress);
|
||||
if (keyid && model->getPubKey(*keyid, pubkey) && !pubkey.IsCompressed())
|
||||
nInputSize = 29; // 29 = 180 - 151 (public key is 180 bytes, priority free area is 151 bytes)
|
||||
}
|
||||
|
||||
// label
|
||||
if (!(sAddress == sWalletAddress)) // change
|
||||
{
|
||||
// tooltip from where the change comes from
|
||||
itemOutput->setToolTip(COLUMN_LABEL, tr("change from %1 (%2)").arg(sWalletLabel).arg(sWalletAddress));
|
||||
itemOutput->setText(COLUMN_LABEL, tr("(change)"));
|
||||
}
|
||||
else if (!treeMode)
|
||||
{
|
||||
QString sLabel = model->getAddressTableModel()->labelForAddress(sAddress);
|
||||
if (sLabel.isEmpty())
|
||||
sLabel = tr("(no label)");
|
||||
itemOutput->setText(COLUMN_LABEL, sLabel);
|
||||
}
|
||||
|
||||
// amount
|
||||
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.tx->vout[out.i].nValue));
|
||||
itemOutput->setText(COLUMN_AMOUNT_INT64, strPad(QString::number(out.tx->vout[out.i].nValue), 15, " ")); // padding so that sorting works correctly
|
||||
|
||||
// date
|
||||
itemOutput->setText(COLUMN_DATE, GUIUtil::dateTimeStr(out.tx->GetTxTime()));
|
||||
itemOutput->setText(COLUMN_DATE_INT64, strPad(QString::number(out.tx->GetTxTime()), 20, " "));
|
||||
|
||||
// confirmations
|
||||
itemOutput->setText(COLUMN_CONFIRMATIONS, strPad(QString::number(out.nDepth), 8, " "));
|
||||
|
||||
// priority
|
||||
double dPriority = ((double)out.tx->vout[out.i].nValue / (nInputSize + 78)) * (out.nDepth+1); // 78 = 2 * 34 + 10
|
||||
itemOutput->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPriority, mempoolEstimatePriority));
|
||||
itemOutput->setText(COLUMN_PRIORITY_INT64, strPad(QString::number((int64_t)dPriority), 20, " "));
|
||||
dPrioritySum += (double)out.tx->vout[out.i].nValue * (out.nDepth+1);
|
||||
nInputSum += nInputSize;
|
||||
|
||||
// transaction hash
|
||||
uint256 txhash = out.tx->GetHash();
|
||||
itemOutput->setText(COLUMN_TXHASH, QString::fromStdString(txhash.GetHex()));
|
||||
|
||||
// vout index
|
||||
itemOutput->setText(COLUMN_VOUT_INDEX, QString::number(out.i));
|
||||
|
||||
// disable locked coins
|
||||
if (model->isLockedCoin(txhash, out.i))
|
||||
{
|
||||
COutPoint outpt(txhash, out.i);
|
||||
coinControl->UnSelect(outpt); // just to be sure
|
||||
itemOutput->setDisabled(true);
|
||||
itemOutput->setIcon(COLUMN_CHECKBOX, SingleColorIcon(":/icons/lock_closed"));
|
||||
}
|
||||
|
||||
// set checkbox
|
||||
if (coinControl->IsSelected(txhash, out.i))
|
||||
itemOutput->setCheckState(COLUMN_CHECKBOX, Qt::Checked);
|
||||
}
|
||||
|
||||
// amount
|
||||
if (treeMode)
|
||||
{
|
||||
dPrioritySum = dPrioritySum / (nInputSum + 78);
|
||||
itemWalletAddress->setText(COLUMN_CHECKBOX, "(" + QString::number(nChildren) + ")");
|
||||
itemWalletAddress->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum));
|
||||
itemWalletAddress->setText(COLUMN_AMOUNT_INT64, strPad(QString::number(nSum), 15, " "));
|
||||
itemWalletAddress->setText(COLUMN_PRIORITY, CoinControlDialog::getPriorityLabel(dPrioritySum, mempoolEstimatePriority));
|
||||
itemWalletAddress->setText(COLUMN_PRIORITY_INT64, strPad(QString::number((int64_t)dPrioritySum), 20, " "));
|
||||
}
|
||||
}
|
||||
|
||||
// expand all partially selected
|
||||
if (treeMode)
|
||||
{
|
||||
for (int i = 0; i < ui->treeWidget->topLevelItemCount(); i++)
|
||||
if (ui->treeWidget->topLevelItem(i)->checkState(COLUMN_CHECKBOX) == Qt::PartiallyChecked)
|
||||
ui->treeWidget->topLevelItem(i)->setExpanded(true);
|
||||
}
|
||||
|
||||
// sort view
|
||||
sortView(sortColumn, sortOrder);
|
||||
ui->treeWidget->setEnabled(true);
|
||||
}
|
|
@ -1,130 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_COINCONTROLDIALOG_H
|
||||
#define BITCOIN_QT_COINCONTROLDIALOG_H
|
||||
|
||||
#include "amount.h"
|
||||
|
||||
#include <QAbstractButton>
|
||||
#include <QAction>
|
||||
#include <QDialog>
|
||||
#include <QList>
|
||||
#include <QMenu>
|
||||
#include <QPoint>
|
||||
#include <QString>
|
||||
#include <QTreeWidgetItem>
|
||||
|
||||
class WalletModel;
|
||||
|
||||
class CCoinControl;
|
||||
class CTxMemPool;
|
||||
|
||||
namespace Ui {
|
||||
class CoinControlDialog;
|
||||
}
|
||||
|
||||
#define ASYMP_UTF8 "\xE2\x89\x88"
|
||||
|
||||
class CoinControlDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CoinControlDialog(QWidget *parent = 0);
|
||||
~CoinControlDialog();
|
||||
|
||||
void setModel(WalletModel *model);
|
||||
|
||||
// static because also called from sendcoinsdialog
|
||||
static void updateLabels(WalletModel*, QDialog*);
|
||||
static QString getPriorityLabel(double dPriority, double mempoolEstimatePriority);
|
||||
|
||||
static QList<CAmount> payAmounts;
|
||||
static CCoinControl *coinControl;
|
||||
static bool fSubtractFeeFromAmount;
|
||||
|
||||
private:
|
||||
Ui::CoinControlDialog *ui;
|
||||
WalletModel *model;
|
||||
int sortColumn;
|
||||
Qt::SortOrder sortOrder;
|
||||
|
||||
QMenu *contextMenu;
|
||||
QTreeWidgetItem *contextMenuItem;
|
||||
QAction *copyTransactionHashAction;
|
||||
QAction *lockAction;
|
||||
QAction *unlockAction;
|
||||
|
||||
QString strPad(QString, int, QString);
|
||||
void sortView(int, Qt::SortOrder);
|
||||
void updateView();
|
||||
|
||||
enum
|
||||
{
|
||||
COLUMN_CHECKBOX,
|
||||
COLUMN_AMOUNT,
|
||||
COLUMN_LABEL,
|
||||
COLUMN_ADDRESS,
|
||||
COLUMN_DATE,
|
||||
COLUMN_CONFIRMATIONS,
|
||||
COLUMN_PRIORITY,
|
||||
COLUMN_TXHASH,
|
||||
COLUMN_VOUT_INDEX,
|
||||
COLUMN_AMOUNT_INT64,
|
||||
COLUMN_PRIORITY_INT64,
|
||||
COLUMN_DATE_INT64
|
||||
};
|
||||
|
||||
// some columns have a hidden column containing the value used for sorting
|
||||
int getMappedColumn(int column, bool fVisibleColumn = true)
|
||||
{
|
||||
if (fVisibleColumn)
|
||||
{
|
||||
if (column == COLUMN_AMOUNT_INT64)
|
||||
return COLUMN_AMOUNT;
|
||||
else if (column == COLUMN_PRIORITY_INT64)
|
||||
return COLUMN_PRIORITY;
|
||||
else if (column == COLUMN_DATE_INT64)
|
||||
return COLUMN_DATE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (column == COLUMN_AMOUNT)
|
||||
return COLUMN_AMOUNT_INT64;
|
||||
else if (column == COLUMN_PRIORITY)
|
||||
return COLUMN_PRIORITY_INT64;
|
||||
else if (column == COLUMN_DATE)
|
||||
return COLUMN_DATE_INT64;
|
||||
}
|
||||
|
||||
return column;
|
||||
}
|
||||
|
||||
private Q_SLOTS:
|
||||
void showMenu(const QPoint &);
|
||||
void copyAmount();
|
||||
void copyLabel();
|
||||
void copyAddress();
|
||||
void copyTransactionHash();
|
||||
void lockCoin();
|
||||
void unlockCoin();
|
||||
void clipboardQuantity();
|
||||
void clipboardAmount();
|
||||
void clipboardFee();
|
||||
void clipboardAfterFee();
|
||||
void clipboardBytes();
|
||||
void clipboardPriority();
|
||||
void clipboardLowOutput();
|
||||
void clipboardChange();
|
||||
void radioTreeMode(bool);
|
||||
void radioListMode(bool);
|
||||
void viewItemChanged(QTreeWidgetItem*, int);
|
||||
void headerSectionClicked(int);
|
||||
void buttonBoxClicked(QAbstractButton*);
|
||||
void buttonSelectAllClicked();
|
||||
void updateLabelLocked();
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_COINCONTROLDIALOG_H
|
|
@ -1,33 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "coincontroltreewidget.h"
|
||||
#include "coincontroldialog.h"
|
||||
|
||||
CoinControlTreeWidget::CoinControlTreeWidget(QWidget *parent) :
|
||||
QTreeWidget(parent)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void CoinControlTreeWidget::keyPressEvent(QKeyEvent *event)
|
||||
{
|
||||
if (event->key() == Qt::Key_Space) // press spacebar -> select checkbox
|
||||
{
|
||||
event->ignore();
|
||||
int COLUMN_CHECKBOX = 0;
|
||||
if(this->currentItem())
|
||||
this->currentItem()->setCheckState(COLUMN_CHECKBOX, ((this->currentItem()->checkState(COLUMN_CHECKBOX) == Qt::Checked) ? Qt::Unchecked : Qt::Checked));
|
||||
}
|
||||
else if (event->key() == Qt::Key_Escape) // press esc -> close dialog
|
||||
{
|
||||
event->ignore();
|
||||
CoinControlDialog *coinControlDialog = (CoinControlDialog*)this->parentWidget();
|
||||
coinControlDialog->done(QDialog::Accepted);
|
||||
}
|
||||
else
|
||||
{
|
||||
this->QTreeWidget::keyPressEvent(event);
|
||||
}
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_COINCONTROLTREEWIDGET_H
|
||||
#define BITCOIN_QT_COINCONTROLTREEWIDGET_H
|
||||
|
||||
#include <QKeyEvent>
|
||||
#include <QTreeWidget>
|
||||
|
||||
class CoinControlTreeWidget : public QTreeWidget
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CoinControlTreeWidget(QWidget *parent = 0);
|
||||
|
||||
protected:
|
||||
virtual void keyPressEvent(QKeyEvent *event);
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_COINCONTROLTREEWIDGET_H
|
|
@ -1,91 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "csvmodelwriter.h"
|
||||
|
||||
#include <QAbstractItemModel>
|
||||
#include <QFile>
|
||||
#include <QTextStream>
|
||||
|
||||
CSVModelWriter::CSVModelWriter(const QString &filename, QObject *parent) :
|
||||
QObject(parent),
|
||||
filename(filename), model(0)
|
||||
{
|
||||
}
|
||||
|
||||
void CSVModelWriter::setModel(const QAbstractItemModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
}
|
||||
|
||||
void CSVModelWriter::addColumn(const QString &title, int column, int role)
|
||||
{
|
||||
Column col;
|
||||
col.title = title;
|
||||
col.column = column;
|
||||
col.role = role;
|
||||
|
||||
columns.append(col);
|
||||
}
|
||||
|
||||
static void writeValue(QTextStream &f, const QString &value)
|
||||
{
|
||||
QString escaped = value;
|
||||
escaped.replace('"', "\"\"");
|
||||
f << "\"" << escaped << "\"";
|
||||
}
|
||||
|
||||
static void writeSep(QTextStream &f)
|
||||
{
|
||||
f << ",";
|
||||
}
|
||||
|
||||
static void writeNewline(QTextStream &f)
|
||||
{
|
||||
f << "\n";
|
||||
}
|
||||
|
||||
bool CSVModelWriter::write()
|
||||
{
|
||||
QFile file(filename);
|
||||
if(!file.open(QIODevice::WriteOnly | QIODevice::Text))
|
||||
return false;
|
||||
QTextStream out(&file);
|
||||
|
||||
int numRows = 0;
|
||||
if(model)
|
||||
{
|
||||
numRows = model->rowCount();
|
||||
}
|
||||
|
||||
// Header row
|
||||
for(int i=0; i<columns.size(); ++i)
|
||||
{
|
||||
if(i!=0)
|
||||
{
|
||||
writeSep(out);
|
||||
}
|
||||
writeValue(out, columns[i].title);
|
||||
}
|
||||
writeNewline(out);
|
||||
|
||||
// Data rows
|
||||
for(int j=0; j<numRows; ++j)
|
||||
{
|
||||
for(int i=0; i<columns.size(); ++i)
|
||||
{
|
||||
if(i!=0)
|
||||
{
|
||||
writeSep(out);
|
||||
}
|
||||
QVariant data = model->index(j, columns[i].column).data(columns[i].role);
|
||||
writeValue(out, data.toString());
|
||||
}
|
||||
writeNewline(out);
|
||||
}
|
||||
|
||||
file.close();
|
||||
|
||||
return file.error() == QFile::NoError;
|
||||
}
|
|
@ -1,46 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_CSVMODELWRITER_H
|
||||
#define BITCOIN_QT_CSVMODELWRITER_H
|
||||
|
||||
#include <QList>
|
||||
#include <QObject>
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QAbstractItemModel;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/** Export a Qt table model to a CSV file. This is useful for analyzing or post-processing the data in
|
||||
a spreadsheet.
|
||||
*/
|
||||
class CSVModelWriter : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit CSVModelWriter(const QString &filename, QObject *parent = 0);
|
||||
|
||||
void setModel(const QAbstractItemModel *model);
|
||||
void addColumn(const QString &title, int column, int role=Qt::EditRole);
|
||||
|
||||
/** Perform export of the model to CSV.
|
||||
@returns true on success, false otherwise
|
||||
*/
|
||||
bool write();
|
||||
|
||||
private:
|
||||
QString filename;
|
||||
const QAbstractItemModel *model;
|
||||
|
||||
struct Column
|
||||
{
|
||||
QString title;
|
||||
int column;
|
||||
int role;
|
||||
};
|
||||
QList<Column> columns;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_CSVMODELWRITER_H
|
|
@ -1,144 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include "editaddressdialog.h"
|
||||
#include "ui_editaddressdialog.h"
|
||||
|
||||
#include "addresstablemodel.h"
|
||||
#include "guiutil.h"
|
||||
|
||||
#include <QDataWidgetMapper>
|
||||
#include <QMessageBox>
|
||||
|
||||
EditAddressDialog::EditAddressDialog(Mode mode, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
ui(new Ui::EditAddressDialog),
|
||||
mapper(0),
|
||||
mode(mode),
|
||||
model(0)
|
||||
{
|
||||
ui->setupUi(this);
|
||||
|
||||
GUIUtil::setupAddressWidget(ui->addressEdit, this);
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case NewReceivingAddress:
|
||||
setWindowTitle(tr("New receiving address"));
|
||||
ui->addressEdit->setEnabled(false);
|
||||
break;
|
||||
case NewSendingAddress:
|
||||
setWindowTitle(tr("New sending address"));
|
||||
break;
|
||||
case EditReceivingAddress:
|
||||
setWindowTitle(tr("Edit receiving address"));
|
||||
ui->addressEdit->setEnabled(false);
|
||||
break;
|
||||
case EditSendingAddress:
|
||||
setWindowTitle(tr("Edit sending address"));
|
||||
break;
|
||||
}
|
||||
|
||||
mapper = new QDataWidgetMapper(this);
|
||||
mapper->setSubmitPolicy(QDataWidgetMapper::ManualSubmit);
|
||||
}
|
||||
|
||||
EditAddressDialog::~EditAddressDialog()
|
||||
{
|
||||
delete ui;
|
||||
}
|
||||
|
||||
void EditAddressDialog::setModel(AddressTableModel *model)
|
||||
{
|
||||
this->model = model;
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
mapper->setModel(model);
|
||||
mapper->addMapping(ui->labelEdit, AddressTableModel::Label);
|
||||
mapper->addMapping(ui->addressEdit, AddressTableModel::Address);
|
||||
}
|
||||
|
||||
void EditAddressDialog::loadRow(int row)
|
||||
{
|
||||
mapper->setCurrentIndex(row);
|
||||
}
|
||||
|
||||
bool EditAddressDialog::saveCurrentRow()
|
||||
{
|
||||
if(!model)
|
||||
return false;
|
||||
|
||||
switch(mode)
|
||||
{
|
||||
case NewReceivingAddress:
|
||||
case NewSendingAddress:
|
||||
address = model->addRow(
|
||||
mode == NewSendingAddress ? AddressTableModel::Send : AddressTableModel::Receive,
|
||||
ui->labelEdit->text(),
|
||||
ui->addressEdit->text());
|
||||
break;
|
||||
case EditReceivingAddress:
|
||||
case EditSendingAddress:
|
||||
if(mapper->submit())
|
||||
{
|
||||
address = ui->addressEdit->text();
|
||||
}
|
||||
break;
|
||||
}
|
||||
return !address.isEmpty();
|
||||
}
|
||||
|
||||
void EditAddressDialog::accept()
|
||||
{
|
||||
if(!model)
|
||||
return;
|
||||
|
||||
if(!saveCurrentRow())
|
||||
{
|
||||
switch(model->getEditStatus())
|
||||
{
|
||||
case AddressTableModel::OK:
|
||||
// Failed with unknown reason. Just reject.
|
||||
break;
|
||||
case AddressTableModel::NO_CHANGES:
|
||||
// No changes were made during edit operation. Just reject.
|
||||
break;
|
||||
case AddressTableModel::INVALID_ADDRESS:
|
||||
QMessageBox::warning(this, windowTitle(),
|
||||
tr("The entered address \"%1\" is not a valid Bitcoin address.").arg(ui->addressEdit->text()),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
case AddressTableModel::DUPLICATE_ADDRESS:
|
||||
QMessageBox::warning(this, windowTitle(),
|
||||
tr("The entered address \"%1\" is already in the address book.").arg(ui->addressEdit->text()),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
case AddressTableModel::WALLET_UNLOCK_FAILURE:
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("Could not unlock wallet."),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
case AddressTableModel::KEY_GENERATION_FAILURE:
|
||||
QMessageBox::critical(this, windowTitle(),
|
||||
tr("New key generation failed."),
|
||||
QMessageBox::Ok, QMessageBox::Ok);
|
||||
break;
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
QDialog::accept();
|
||||
}
|
||||
|
||||
QString EditAddressDialog::getAddress() const
|
||||
{
|
||||
return address;
|
||||
}
|
||||
|
||||
void EditAddressDialog::setAddress(const QString &address)
|
||||
{
|
||||
this->address = address;
|
||||
ui->addressEdit->setText(address);
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
// Copyright (c) 2011-2013 The Bitcoin Core developers
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#ifndef BITCOIN_QT_EDITADDRESSDIALOG_H
|
||||
#define BITCOIN_QT_EDITADDRESSDIALOG_H
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class AddressTableModel;
|
||||
|
||||
namespace Ui {
|
||||
class EditAddressDialog;
|
||||
}
|
||||
|
||||
QT_BEGIN_NAMESPACE
|
||||
class QDataWidgetMapper;
|
||||
QT_END_NAMESPACE
|
||||
|
||||
/** Dialog for editing an address and associated information.
|
||||
*/
|
||||
class EditAddressDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
enum Mode {
|
||||
NewReceivingAddress,
|
||||
NewSendingAddress,
|
||||
EditReceivingAddress,
|
||||
EditSendingAddress
|
||||
};
|
||||
|
||||
explicit EditAddressDialog(Mode mode, QWidget *parent);
|
||||
~EditAddressDialog();
|
||||
|
||||
void setModel(AddressTableModel *model);
|
||||
void loadRow(int row);
|
||||
|
||||
QString getAddress() const;
|
||||
void setAddress(const QString &address);
|
||||
|
||||
public Q_SLOTS:
|
||||
void accept();
|
||||
|
||||
private:
|
||||
bool saveCurrentRow();
|
||||
|
||||
Ui::EditAddressDialog *ui;
|
||||
QDataWidgetMapper *mapper;
|
||||
Mode mode;
|
||||
AddressTableModel *model;
|
||||
|
||||
QString address;
|
||||
};
|
||||
|
||||
#endif // BITCOIN_QT_EDITADDRESSDIALOG_H
|
|
@ -1,159 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AddressBookPage</class>
|
||||
<widget class="QWidget" name="AddressBookPage">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>760</width>
|
||||
<height>380</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="labelExplanation">
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QTableView" name="tableView">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Right-click to edit address or label</string>
|
||||
</property>
|
||||
<property name="tabKeyNavigation">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="alternatingRowColors">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="selectionMode">
|
||||
<enum>QAbstractItemView::SingleSelection</enum>
|
||||
</property>
|
||||
<property name="selectionBehavior">
|
||||
<enum>QAbstractItemView::SelectRows</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<attribute name="verticalHeaderVisible">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<widget class="QPushButton" name="newAddress">
|
||||
<property name="toolTip">
|
||||
<string>Create a new address</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&New</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="copyAddress">
|
||||
<property name="toolTip">
|
||||
<string>Copy the currently selected address to the system clipboard</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Copy</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
<normaloff>:/icons/editcopy</normaloff>:/icons/editcopy</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="deleteAddress">
|
||||
<property name="toolTip">
|
||||
<string>Delete the currently selected address from the list</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Delete</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="exportButton">
|
||||
<property name="toolTip">
|
||||
<string>Export the data in the current tab to a file</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>&Export</string>
|
||||
</property>
|
||||
<property name="icon">
|
||||
<iconset resource="../bitcoin.qrc">
|
||||
<normaloff>:/icons/export</normaloff>:/icons/export</iconset>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="closeButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>C&lose</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../bitcoin.qrc"/>
|
||||
</resources>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,160 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>AskPassphraseDialog</class>
|
||||
<widget class="QDialog" name="AskPassphraseDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>598</width>
|
||||
<height>222</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Minimum">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>550</width>
|
||||
<height>0</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Passphrase Dialog</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="warningLabel">
|
||||
<property name="text">
|
||||
<string notr="true">Placeholder text</string>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetMinimumSize</enum>
|
||||
</property>
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="passLabel1">
|
||||
<property name="text">
|
||||
<string>Enter passphrase</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="passEdit1">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="passLabel2">
|
||||
<property name="text">
|
||||
<string>New passphrase</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLineEdit" name="passEdit2">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0">
|
||||
<widget class="QLabel" name="passLabel3">
|
||||
<property name="text">
|
||||
<string>Repeat new passphrase</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="1">
|
||||
<widget class="QLineEdit" name="passEdit3">
|
||||
<property name="echoMode">
|
||||
<enum>QLineEdit::Password</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="3" column="1">
|
||||
<widget class="QLabel" name="capsLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignCenter</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>AskPassphraseDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>AskPassphraseDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,534 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>CoinControlDialog</class>
|
||||
<widget class="QDialog" name="CoinControlDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>1000</width>
|
||||
<height>500</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Coin Selection</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutTop" stretch="0,0,0,0">
|
||||
<property name="topMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl1">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlQuantityText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Quantity:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlQuantity">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlBytesText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Bytes:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlBytes">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl2">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlAmountText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Amount:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlAmount">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlPriorityText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Priority:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlPriority">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">medium</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl3">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlFeeText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Fee:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlFee">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlLowOutputText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Dust:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlLowOutput">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">no</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayoutCoinControl4">
|
||||
<property name="horizontalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="verticalSpacing">
|
||||
<number>10</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>6</number>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlAfterFeeText">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>After Fee:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlAfterFee">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="labelCoinControlChangeText">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Change:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="labelCoinControlChange">
|
||||
<property name="enabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::ActionsContextMenu</enum>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">0.00 BTC</string>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="minimumSize">
|
||||
<size>
|
||||
<width>0</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::StyledPanel</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Sunken</enum>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayoutPanel" stretch="0,0,0,0,0">
|
||||
<property name="spacing">
|
||||
<number>14</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QPushButton" name="pushButtonSelectAll">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>(un)select all</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioTreeMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Tree mode</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="radioListMode">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>List mode</string>
|
||||
</property>
|
||||
<property name="checked">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="labelLocked">
|
||||
<property name="text">
|
||||
<string notr="true">(1 locked)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="CoinControlTreeWidget" name="treeWidget">
|
||||
<property name="contextMenuPolicy">
|
||||
<enum>Qt::CustomContextMenu</enum>
|
||||
</property>
|
||||
<property name="sortingEnabled">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="columnCount">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<attribute name="headerShowSortIndicator" stdset="0">
|
||||
<bool>true</bool>
|
||||
</attribute>
|
||||
<attribute name="headerStretchLastSection">
|
||||
<bool>false</bool>
|
||||
</attribute>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Amount</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Received with label</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Received with address</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Date</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Confirmations</string>
|
||||
</property>
|
||||
<property name="toolTip">
|
||||
<string>Confirmed</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string>Priority</string>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
<column>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
</column>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Maximum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>CoinControlTreeWidget</class>
|
||||
<extends>QTreeWidget</extends>
|
||||
<header>coincontroltreewidget.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections/>
|
||||
</ui>
|
|
@ -1,112 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>EditAddressDialog</class>
|
||||
<widget class="QDialog" name="EditAddressDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>457</width>
|
||||
<height>126</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Edit Address</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<layout class="QFormLayout" name="formLayout">
|
||||
<property name="fieldGrowthPolicy">
|
||||
<enum>QFormLayout::AllNonFixedFieldsGrow</enum>
|
||||
</property>
|
||||
<item row="0" column="0">
|
||||
<widget class="QLabel" name="label">
|
||||
<property name="text">
|
||||
<string>&Label</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>labelEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="0" column="1">
|
||||
<widget class="QLineEdit" name="labelEdit">
|
||||
<property name="toolTip">
|
||||
<string>The label associated with this address list entry</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="text">
|
||||
<string>&Address</string>
|
||||
</property>
|
||||
<property name="buddy">
|
||||
<cstring>addressEdit</cstring>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QValidatedLineEdit" name="addressEdit">
|
||||
<property name="toolTip">
|
||||
<string>The address associated with this address list entry. This can only be modified for sending addresses.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<customwidgets>
|
||||
<customwidget>
|
||||
<class>QValidatedLineEdit</class>
|
||||
<extends>QLineEdit</extends>
|
||||
<header>qvalidatedlineedit.h</header>
|
||||
</customwidget>
|
||||
</customwidgets>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>EditAddressDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>EditAddressDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,192 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>HelpMessageDialog</class>
|
||||
<widget class="QDialog" name="HelpMessageDialog">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>780</width>
|
||||
<height>400</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string notr="true">Bitcoin Core - Command-line options</string>
|
||||
</property>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="leftMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<property name="bottomMargin">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayoutLogo" stretch="0,0">
|
||||
<property name="leftMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin">
|
||||
<number>4</number>
|
||||
</property>
|
||||
<property name="rightMargin">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
<widget class="QLabel" name="aboutLogo">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Ignored">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>100</width>
|
||||
<height>100</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="pixmap">
|
||||
<pixmap resource="../bitcoin.qrc">:/icons/bitcoin</pixmap>
|
||||
</property>
|
||||
<property name="scaledContents">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QFrame" name="frame">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="frameShadow">
|
||||
<enum>QFrame::Raised</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QTextEdit" name="helpMessage">
|
||||
<property name="readOnly">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QScrollArea" name="scrollArea">
|
||||
<property name="frameShape">
|
||||
<enum>QFrame::NoFrame</enum>
|
||||
</property>
|
||||
<property name="verticalScrollBarPolicy">
|
||||
<enum>Qt::ScrollBarAlwaysOn</enum>
|
||||
</property>
|
||||
<property name="widgetResizable">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<widget class="QWidget" name="scrollAreaWidgetContents">
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<item>
|
||||
<widget class="QLabel" name="aboutMessage">
|
||||
<property name="cursor">
|
||||
<cursorShape>IBeamCursor</cursorShape>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::PlainText</enum>
|
||||
</property>
|
||||
<property name="alignment">
|
||||
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set>
|
||||
</property>
|
||||
<property name="openExternalLinks">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
<property name="textInteractionFlags">
|
||||
<set>Qt::LinksAccessibleByMouse|Qt::TextSelectableByKeyboard|Qt::TextSelectableByMouse</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>4</width>
|
||||
<height>4</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="okButton">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources>
|
||||
<include location="../bitcoin.qrc"/>
|
||||
</resources>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>HelpMessageDialog</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>okButton</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>HelpMessageDialog</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
|
@ -1,266 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ui version="4.0">
|
||||
<class>Intro</class>
|
||||
<widget class="QDialog" name="Intro">
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>674</width>
|
||||
<height>363</height>
|
||||
</rect>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Welcome</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout">
|
||||
<item>
|
||||
<widget class="QLabel" name="label_2">
|
||||
<property name="styleSheet">
|
||||
<string notr="true">QLabel { font-style:italic; }</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Welcome to Bitcoin Core.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_4">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Minimum</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>15</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="label_4">
|
||||
<property name="text">
|
||||
<string>As this is the first time the program is launched, you can choose where Bitcoin Core will store its data.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="sizeWarningLabel">
|
||||
<property name="text">
|
||||
<string>Bitcoin Core will download and store a copy of the Bitcoin block chain. At least %1GB of data will be stored in this directory, and it will grow over time. The wallet will also be stored in this directory.</string>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="dataDirDefault">
|
||||
<property name="text">
|
||||
<string>Use the default data directory</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QRadioButton" name="dataDirCustom">
|
||||
<property name="text">
|
||||
<string>Use a custom data directory:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||
<property name="spacing">
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<spacer name="horizontalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>60</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||
<property name="sizeConstraint">
|
||||
<enum>QLayout::SetDefaultConstraint</enum>
|
||||
</property>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||
<item>
|
||||
<widget class="QLineEdit" name="dataDirectory"/>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QPushButton" name="ellipsisButton">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="maximumSize">
|
||||
<size>
|
||||
<width>30</width>
|
||||
<height>16777215</height>
|
||||
</size>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string notr="true">…</string>
|
||||
</property>
|
||||
<property name="autoDefault">
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_3">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="freeSpace">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>1</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string/>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer_2">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeType">
|
||||
<enum>QSizePolicy::Fixed</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>5</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLabel" name="errorMessage">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="textFormat">
|
||||
<enum>Qt::RichText</enum>
|
||||
</property>
|
||||
<property name="wordWrap">
|
||||
<bool>true</bool>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<spacer name="verticalSpacer">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0">
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QDialogButtonBox" name="buttonBox">
|
||||
<property name="orientation">
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons">
|
||||
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<resources/>
|
||||
<connections>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>accepted()</signal>
|
||||
<receiver>Intro</receiver>
|
||||
<slot>accept()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
<connection>
|
||||
<sender>buttonBox</sender>
|
||||
<signal>rejected()</signal>
|
||||
<receiver>Intro</receiver>
|
||||
<slot>reject()</slot>
|
||||
<hints>
|
||||
<hint type="sourcelabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
<hint type="destinationlabel">
|
||||
<x>20</x>
|
||||
<y>20</y>
|
||||
</hint>
|
||||
</hints>
|
||||
</connection>
|
||||
</connections>
|
||||
</ui>
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue