Browse Source

Implemented bookmarks for namespaces.

views
Just Wonder 5 years ago
parent
commit
7fc7f28f6c
  1. 4
      configure.ac
  2. 4
      src/Makefile.qt.include
  3. 2
      src/qt/bitcoin.qrc
  4. 2
      src/qt/bitcoingui.cpp
  5. 2
      src/qt/forms/kevabookmarksdialog.ui
  6. 660
      src/qt/forms/kevadialog.ui
  7. 60
      src/qt/forms/kevaeditbookmarkdialog.ui
  8. 55
      src/qt/kevabookmarksdialog.cpp
  9. 4
      src/qt/kevabookmarksdialog.h
  10. 10
      src/qt/kevabookmarksmodel.cpp
  11. 1
      src/qt/kevabookmarksmodel.h
  12. 70
      src/qt/kevadialog.cpp
  13. 3
      src/qt/kevadialog.h
  14. 53
      src/qt/kevaeditbookmarkdialog.cpp
  15. 41
      src/qt/kevaeditbookmarkdialog.h
  16. 6
      src/qt/kevamynamespacesdialog.cpp
  17. 1
      src/qt/kevamynamespacesdialog.h
  18. 5
      src/qt/kevatablemodel.cpp
  19. 39
      src/qt/locale/bitcoin_en.ts
  20. 6
      src/qt/locale/bitcoin_zh_CN.ts
  21. BIN
      src/qt/res/icons/keva.png
  22. BIN
      src/qt/res/icons/star.png
  23. BIN
      src/qt/res/icons/star_empty.png

4
configure.ac

@ -3,9 +3,9 @@ AC_PREREQ([2.60]) @@ -3,9 +3,9 @@ AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 0)
define(_CLIENT_VERSION_MINOR, 16)
define(_CLIENT_VERSION_REVISION, 5)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_BUILD, 2)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2019)
define(_COPYRIGHT_YEAR, 2020)
define(_COPYRIGHT_HOLDERS,[The %s developers])
define(_COPYRIGHT_HOLDERS_SUBSTITUTION,[[Kevacoin Core]])
AC_INIT([Kevacoin Core],[_CLIENT_VERSION_MAJOR._CLIENT_VERSION_MINOR._CLIENT_VERSION_REVISION],[https://github.com/kevacoin-project/kevacoin/issues],[kevacoin],[https://kevacoin.org/])

4
src/Makefile.qt.include

@ -140,6 +140,7 @@ QT_FORMS_UI = \ @@ -140,6 +140,7 @@ QT_FORMS_UI = \
qt/forms/kevaaddkeydialog.ui \
qt/forms/kevabookmarksdialog.ui \
qt/forms/kevanewnamespacedialog.ui \
qt/forms/kevaeditbookmarkdialog.ui \
qt/forms/kevamynamespacesdialog.ui \
qt/forms/debugwindow.ui \
qt/forms/sendcoinsdialog.ui \
@ -186,6 +187,7 @@ QT_MOC_CPP = \ @@ -186,6 +187,7 @@ QT_MOC_CPP = \
qt/moc_kevaaddkeydialog.cpp \
qt/moc_kevabookmarksdialog.cpp \
qt/moc_kevanewnamespacedialog.cpp \
qt/moc_kevaeditbookmarkdialog.cpp \
qt/moc_kevamynamespacesdialog.cpp \
qt/moc_rpcconsole.cpp \
qt/moc_sendcoinsdialog.cpp \
@ -281,6 +283,7 @@ BITCOIN_QT_H = \ @@ -281,6 +283,7 @@ BITCOIN_QT_H = \
qt/kevaaddkeydialog.h \
qt/kevabookmarksdialog.h \
qt/kevanewnamespacedialog.h \
qt/kevaeditbookmarkdialog.h \
qt/kevamynamespacesdialog.h \
qt/utilitydialog.h \
qt/walletframe.h \
@ -405,6 +408,7 @@ BITCOIN_QT_WALLET_CPP = \ @@ -405,6 +408,7 @@ BITCOIN_QT_WALLET_CPP = \
qt/kevaaddkeydialog.cpp \
qt/kevabookmarksdialog.cpp \
qt/kevanewnamespacedialog.cpp \
qt/kevaeditbookmarkdialog.cpp \
qt/kevamynamespacesdialog.cpp \
qt/walletframe.cpp \
qt/walletmodel.cpp \

2
src/qt/bitcoin.qrc

@ -55,6 +55,8 @@ @@ -55,6 +55,8 @@
<file alias="hd_enabled">res/icons/hd_enabled.png</file>
<file alias="hd_disabled">res/icons/hd_disabled.png</file>
<file alias="network_disabled">res/icons/network_disabled.png</file>
<file alias="star">res/icons/star.png</file>
<file alias="star_empty">res/icons/star_empty.png</file>
</qresource>
<qresource prefix="/movies">
<file alias="spinner-000">res/movies/spinner-000.png</file>

2
src/qt/bitcoingui.cpp

@ -313,7 +313,7 @@ void BitcoinGUI::createActions() @@ -313,7 +313,7 @@ void BitcoinGUI::createActions()
historyAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_4));
tabGroup->addAction(historyAction);
kevaAction = new QAction(platformStyle->SingleColorIcon(":/icons/keva"), tr("&Keva"), this);
kevaAction = new QAction(QIcon(":/icons/keva"), tr("&Keva"), this);
kevaAction->setStatusTip(tr("Keva related operations"));
kevaAction->setToolTip(kevaAction->statusTip());
kevaAction->setCheckable(true);

2
src/qt/forms/kevabookmarksdialog.ui

@ -33,7 +33,7 @@ @@ -33,7 +33,7 @@
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel</set>
<set>QDialogButtonBox::Save|QDialogButtonBox::Ok|QDialogButtonBox::Close</set>
</property>
</widget>
</item>

660
src/qt/forms/kevadialog.ui

@ -1,329 +1,361 @@ @@ -1,329 +1,361 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KevaDialog</class>
<widget class="QWidget" name="KevaDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>776</width>
<height>396</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
<item>
<widget class="QFrame" name="frame2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<class>KevaDialog</class>
<widget class="QWidget" name="KevaDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>776</width>
<height>396</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="2">
<widget class="QLineEdit" name="nameSpace">
<property name="toolTip">
<string>The namespace ID with a prefix "N".</string>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Use this form to perform Keva database operations.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>The namespace ID with a prefix "N".</string>
</property>
<property name="text">
<string>Namespace:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>namespace</cstring>
</property>
</widget>
</item>
<item row="7" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="showContent">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show content of the namespace.</string>
</property>
<property name="text">
<string>Show</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/eye</normaloff>:/icons/eye</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createNamespace">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Create a new namespace</string>
</property>
<property name="text">
<string>&amp;Create namespace</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="listNamespaces">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<widget class="QFrame" name="frame2">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>List my namespaces</string>
</property>
<property name="text">
<string>&amp;My Namespaces</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/editpaste</normaloff>:/icons/editpaste</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bookmarksButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show bookmarks</string>
</property>
<property name="text">
<string>&amp;Bookmarks</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/address-book</normaloff>:/icons/address-book</iconset>
</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>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Content of namespace</string>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="kevaView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="showValueButton">
<property name="enabled">
<bool>false</bool>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show the selected request (does the same as double clicking an entry)</string>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="text">
<string>Show</string>
<property name="frameShadow">
<enum>QFrame::Sunken</enum>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/edit</normaloff>:/icons/edit</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove the selected entries from the list</string>
</property>
<property name="text">
<string>Remove</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>
<widget class="QPushButton" name="addKVButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Add new key-value pair</string>
</property>
<property name="text">
<string>Add key-value</string>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="4" column="2">
<layout class="QHBoxLayout" name="nsHLayout">
<item>
<widget class="QLineEdit" name="nameSpace">
<property name="toolTip">
<string>The namespace ID with a prefix "N".</string>
</property>
<property name="maximumWidth">
<number>600</number>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bookmarkNamespace">
<property name="toolTip">
<string>Bookmark this namespace</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/star_empty</normaloff>:/icons/star_empty
</iconset>
</property>
</widget>
</item>
<item>
<spacer name="horizontalBookmarkSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</spacer>
</item>
</layout>
</item>
<item row="2" column="2">
<widget class="QLabel" name="label_5">
<property name="text">
<string>Use this form to perform Keva database operations.</string>
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>The namespace ID with a prefix "N".</string>
</property>
<property name="text">
<string>Namespace:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>namespace</cstring>
</property>
</widget>
</item>
<item row="7" column="2">
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QPushButton" name="showContent">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show content of the namespace.</string>
</property>
<property name="text">
<string>Show</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/eye</normaloff>:/icons/eye</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="createNamespace">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Create a new namespace</string>
</property>
<property name="text">
<string>&amp;Create namespace</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="listNamespaces">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>List my namespaces</string>
</property>
<property name="text">
<string>&amp;My Namespaces</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/editpaste</normaloff>:/icons/editpaste</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="bookmarksButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Minimum" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Show bookmarks</string>
</property>
<property name="text">
<string>&amp;Bookmarks</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/address-book</normaloff>:/icons/address-book</iconset>
</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>
<item row="7" column="0">
<widget class="QLabel" name="label_7">
<property name="text">
<string/>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<spacer name="verticalSpacer_2">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>10</height>
</size>
</property>
<property name="autoDefault">
<bool>false</bool>
</spacer>
</item>
<item>
<widget class="QFrame" name="frame">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_2">
<property name="orientation">
<enum>Qt::Horizontal</enum>
<property name="frameShape">
<enum>QFrame::StyledPanel</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
<property name="frameShadow">
<enum>QFrame::Raised</enum>
</property>
</spacer>
</item>
</layout>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<widget class="QLabel" name="label_6">
<property name="font">
<font>
<weight>75</weight>
<bold>true</bold>
</font>
</property>
<property name="text">
<string>Content of namespace</string>
</property>
</widget>
</item>
<item>
<widget class="QTableView" name="kevaView">
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
<property name="tabKeyNavigation">
<bool>false</bool>
</property>
<property name="sortingEnabled">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QPushButton" name="showValueButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Show the selected request (does the same as double clicking an entry)</string>
</property>
<property name="text">
<string>Show</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/icons/edit</normaloff>:/icons/edit</iconset>
</property>
<property name="autoDefault">
<bool>false</bool>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Remove the selected entries from the list</string>
</property>
<property name="text">
<string>Remove</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>
<widget class="QPushButton" name="addKVButton">
<property name="enabled">
<bool>false</bool>
</property>
<property name="toolTip">
<string>Add new key-value pair</string>
</property>
<property name="text">
<string>Add key-value</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>
<spacer name="horizontalSpacer_2">
<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>
</layout>
</widget>
</item>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BitcoinAmountField</class>
<extends>QLineEdit</extends>
<header>qt/bitcoinamountfield.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>reqMessage</tabstop>
<tabstop>receiveButton</tabstop>
<tabstop>clearButton</tabstop>
<tabstop>recentRequestsView</tabstop>
<tabstop>showValueButton</tabstop>
<tabstop>removeButton</tabstop>
</tabstops>
<resources>
<include location="../bitcoin.qrc"/>
</resources>
<connections/>
</layout>
</widget>
<customwidgets>
<customwidget>
<class>BitcoinAmountField</class>
<extends>QLineEdit</extends>
<header>qt/bitcoinamountfield.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<tabstops>
<tabstop>reqMessage</tabstop>
<tabstop>receiveButton</tabstop>
<tabstop>clearButton</tabstop>
<tabstop>recentRequestsView</tabstop>
<tabstop>showValueButton</tabstop>
<tabstop>removeButton</tabstop>
</tabstops>
<resources>
<include location="../bitcoin.qrc"/>
</resources>
<connections/>
</ui>

60
src/qt/forms/kevaeditbookmarkdialog.ui

@ -0,0 +1,60 @@ @@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>KevaEditBookmarkDialog</class>
<widget class="QDialog" name="KevaEditBookmarkDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>100</height>
</rect>
</property>
<property name="windowTitle">
<string notr="true">Bookmark Name</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="2" column="0">
<widget class="QLabel" name="label_2">
<property name="toolTip">
<string>Bookmark name.</string>
</property>
<property name="text">
<string>Name:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
<property name="buddy">
<cstring>bookmarkName</cstring>
</property>
</widget>
</item>
<item row="2" column="2">
<widget class="QLineEdit" name="bookmarkName">
<property name="toolTip">
<string>This pane allows change of bookmark name</string>
</property>
<property name="readOnly">
<bool>false</bool>
</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::Save</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
</ui>

55
src/qt/kevabookmarksdialog.cpp

@ -4,6 +4,7 @@ @@ -4,6 +4,7 @@
#include <qt/kevabookmarksdialog.h>
#include <qt/forms/ui_kevabookmarksdialog.h>
#include <qt/kevaeditbookmarkdialog.h>
#include <qt/kevabookmarksmodel.h>
#include <qt/kevadialog.h>
@ -16,10 +17,14 @@ KevaBookmarksDialog::KevaBookmarksDialog(QWidget *parent) : @@ -16,10 +17,14 @@ KevaBookmarksDialog::KevaBookmarksDialog(QWidget *parent) :
ui(new Ui::KevaBookmarksDialog)
{
ui->setupUi(this);
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Apply)->setText(tr("Show"));
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->buttonBox->button(QDialogButtonBox::Apply), SIGNAL(clicked()), this, SLOT(apply()));
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("&Show"));
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
ui->buttonBox->button(QDialogButtonBox::Save)->setText(tr("&Edit"));
connect(ui->buttonBox->button(QDialogButtonBox::Close), SIGNAL(clicked()), this, SLOT(reject()));
connect(ui->buttonBox->button(QDialogButtonBox::Ok), SIGNAL(clicked()), this, SLOT(apply()));
connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(rename()));
}
void KevaBookmarksDialog::setModel(WalletModel *_model)
@ -48,7 +53,8 @@ void KevaBookmarksDialog::setModel(WalletModel *_model) @@ -48,7 +53,8 @@ void KevaBookmarksDialog::setModel(WalletModel *_model)
void KevaBookmarksDialog::namespaceView_selectionChanged()
{
bool enable = !ui->namespaceView->selectionModel()->selectedRows().isEmpty();
ui->buttonBox->button(QDialogButtonBox::Apply)->setEnabled(enable);
ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(enable);
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(enable);
if (enable) {
selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
@ -58,6 +64,12 @@ void KevaBookmarksDialog::namespaceView_selectionChanged() @@ -58,6 +64,12 @@ void KevaBookmarksDialog::namespaceView_selectionChanged()
}
}
void KevaBookmarksDialog::on_namespaceView_doubleClicked(const QModelIndex &index)
{
selectedIndex = index;
this->apply();
}
void KevaBookmarksDialog::apply()
{
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaBookmarksModel::Id);
@ -67,6 +79,39 @@ void KevaBookmarksDialog::apply() @@ -67,6 +79,39 @@ void KevaBookmarksDialog::apply()
QDialog::close();
}
void KevaBookmarksDialog::rename()
{
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaBookmarksModel::Id);
QString idStr = idIdx.data(Qt::DisplayRole).toString();
QModelIndex nameIdx = selectedIndex.sibling(selectedIndex.row(), KevaBookmarksModel::Name);
QString nameStr = nameIdx.data(Qt::DisplayRole).toString();
KevaEditBookmarkDialog *dialog = new KevaEditBookmarkDialog(this, idStr, nameStr);
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->show();
}
void KevaBookmarksDialog::saveName(const QString& id, const QString& name)
{
QJsonArray array;
KevaBookmarksModel* bookmarksModel = this->model->getKevaBookmarksModel();
bookmarksModel->loadBookmarks(array);
for (int i = 0; i < array.size(); ++i) {
QJsonObject obj = array[i].toObject();
BookmarkEntry entry;
QString idStr = obj["id"].toString();
if (idStr == id) {
QJsonObject entry;
entry["id"] = id;
entry["name"] = name;
array.replace(i, entry);
break;
}
}
bookmarksModel->saveBookmarks(array);
bookmarksModel->loadBookmarks();
}
void KevaBookmarksDialog::reject()
{
QDialog::reject();

4
src/qt/kevabookmarksdialog.h

@ -18,7 +18,6 @@ namespace Ui { @@ -18,7 +18,6 @@ namespace Ui {
class KevaBookmarksDialog;
}
/** Dialog showing namepsace creation. */
class KevaBookmarksDialog : public QDialog
{
@ -38,9 +37,12 @@ public: @@ -38,9 +37,12 @@ public:
public Q_SLOTS:
void apply();
void reject();
void rename();
void saveName(const QString& id, const QString& name);
private Q_SLOTS:
void namespaceView_selectionChanged();
void on_namespaceView_doubleClicked(const QModelIndex &index);
private:
Ui::KevaBookmarksDialog *ui;

10
src/qt/kevabookmarksmodel.cpp

@ -146,6 +146,16 @@ void KevaBookmarksModel::setBookmarks(QJsonArray &array) @@ -146,6 +146,16 @@ void KevaBookmarksModel::setBookmarks(QJsonArray &array)
setBookmarks(std::move(vBookmarEntries));
}
bool KevaBookmarksModel::isBookmarked(std::string& ns)
{
for (int i = 0; i < list.size(); ++i) {
if (list.at(i).id == ns) {
return true;
}
}
return false;
}
void KevaBookmarksModel::sort(int column, Qt::SortOrder order)
{
qSort(list.begin(), list.end(), BookmarkEntryLessThan(column, order));

1
src/qt/kevabookmarksmodel.h

@ -74,6 +74,7 @@ public: @@ -74,6 +74,7 @@ public:
int loadBookmarks();
int loadBookmarks(QJsonArray &json);
int saveBookmarks(QJsonArray &json);
bool isBookmarked(std::string& ns);
public Q_SLOTS:
void sort(int column, Qt::SortOrder order = Qt::AscendingOrder);

70
src/qt/kevadialog.cpp

@ -55,6 +55,15 @@ KevaDialog::KevaDialog(const PlatformStyle *_platformStyle, QWidget *parent) : @@ -55,6 +55,15 @@ KevaDialog::KevaDialog(const PlatformStyle *_platformStyle, QWidget *parent) :
QAction *copyMessageAction = new QAction(tr("Copy message"), this);
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
bookmarks = new KevaBookmarksModel(NULL, NULL);
bookmarks->loadBookmarks();
ui->kevaView->setTextElideMode(Qt::ElideRight);
ui->kevaView->setWordWrap(false);
QHeaderView *verticalHeader = ui->kevaView->verticalHeader();
verticalHeader->setSectionResizeMode(QHeaderView::Fixed);
verticalHeader->setDefaultSectionSize(36);
// context menu
contextMenu = new QMenu(this);
contextMenu->addAction(copyURIAction);
@ -147,10 +156,23 @@ void KevaDialog::onNamespaceChanged(const QString& nameSpace) @@ -147,10 +156,23 @@ void KevaDialog::onNamespaceChanged(const QString& nameSpace)
{
std::string namespaceStr = nameSpace.toStdString();
valtype nameSpaceVal;
bool isValidNamespace = false;
if (DecodeKevaNamespace(namespaceStr, Params(), nameSpaceVal)) {
ui->addKVButton->setEnabled(true);
isValidNamespace = true;
} else {
ui->addKVButton->setEnabled(false);
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star_empty"));
}
if (!isValidNamespace) {
return;
}
if (bookmarks->isBookmarked(namespaceStr)) {
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star"));
} else {
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star_empty"));
}
}
@ -213,6 +235,54 @@ void KevaDialog::on_kevaView_doubleClicked(const QModelIndex &index) @@ -213,6 +235,54 @@ void KevaDialog::on_kevaView_doubleClicked(const QModelIndex &index)
dialog->show();
}
void KevaDialog::on_bookmarkNamespace_clicked()
{
valtype namespaceVal;
QString nameSpace = ui->nameSpace->text();
std::string namespaceStr = nameSpace.toStdString();
if (!DecodeKevaNamespace(namespaceStr, Params(), namespaceVal)) {
return;
}
QJsonArray array;
bookmarks->loadBookmarks(array);
int index = -1;
for (int i = 0; i < array.size(); ++i) {
QJsonObject obj = array[i].toObject();
BookmarkEntry entry;
std::string id = obj["id"].toString().toStdString();
if (id == namespaceStr) {
index = i;
break;
}
}
if (index >= 0) {
// Remove bookmark
array.removeAt(index);
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star_empty"));
} else {
// Add bookmark
QJsonObject entry;
entry["id"] = namespaceStr.c_str();
entry["name"] = "";
std::vector<NamespaceEntry> vNamespaceEntries;
this->model->getNamespaceEntries(vNamespaceEntries);
for(auto it = vNamespaceEntries.begin(); it != vNamespaceEntries.end(); it++) {
if ((*it).id == namespaceStr) {
entry["name"] = (*it).name.c_str();
break;
}
}
array.prepend(entry);
ui->bookmarkNamespace->setIcon(QIcon(":/icons/star"));
}
bookmarks->saveBookmarks(array);
}
void KevaDialog::kevaView_selectionChanged()
{
// Enable Show/Remove buttons only if anything is selected.

3
src/qt/kevadialog.h

@ -17,6 +17,7 @@ @@ -17,6 +17,7 @@
class PlatformStyle;
class WalletModel;
class KevaBookmarksModel;
namespace Ui {
class KevaDialog;
@ -62,6 +63,7 @@ private: @@ -62,6 +63,7 @@ private:
WalletModel *model;
QMenu *contextMenu;
const PlatformStyle *platformStyle;
KevaBookmarksModel* bookmarks;
QModelIndex selectedRow();
void copyColumnToClipboard(int column);
@ -77,6 +79,7 @@ private Q_SLOTS: @@ -77,6 +79,7 @@ private Q_SLOTS:
void on_kevaView_doubleClicked(const QModelIndex &index);
void kevaView_selectionChanged();
void on_bookmarksButton_clicked();
void on_bookmarkNamespace_clicked();
void updateDisplayUnit();
void showMenu(const QPoint &point);
void copyURI();

53
src/qt/kevaeditbookmarkdialog.cpp

@ -0,0 +1,53 @@ @@ -0,0 +1,53 @@
// Copyright (c) 2011-2017 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 <qt/kevaeditbookmarkdialog.h>
#include <qt/forms/ui_kevaeditbookmarkdialog.h>
#include <qt/kevabookmarksdialog.h>
#include <qt/kevatablemodel.h>
#include <qt/kevadialog.h>
#include <QPushButton>
#include <QModelIndex>
KevaEditBookmarkDialog::KevaEditBookmarkDialog(QWidget *parent, const QString& id, const QString& name) :
QDialog(parent), id(id), name(name),
ui(new Ui::KevaEditBookmarkDialog)
{
ui->setupUi(this);
ui->bookmarkName->setText(name);
this->parentDialog = (KevaBookmarksDialog*)parent;
connect(ui->buttonBox->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), this, SLOT(close()));
connect(ui->buttonBox->button(QDialogButtonBox::Save), SIGNAL(clicked()), this, SLOT(save()));
connect(ui->bookmarkName, SIGNAL(textChanged(const QString &)), this, SLOT(onNameChanged(const QString &)));
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(false);
}
void KevaEditBookmarkDialog::onNameChanged(const QString & name)
{
int length = name.length();
bool enabled = length > 0;
ui->buttonBox->button(QDialogButtonBox::Save)->setEnabled(enabled);
this->name = name;
}
void KevaEditBookmarkDialog::save()
{
KevaDialog* dialog = (KevaDialog*)this->parentWidget();
QString bookmarkText = ui->bookmarkName->text();
this->parentDialog->saveName(id, name);
QDialog::close();
}
void KevaEditBookmarkDialog::close()
{
QDialog::close();
}
KevaEditBookmarkDialog::~KevaEditBookmarkDialog()
{
delete ui;
}

41
src/qt/kevaeditbookmarkdialog.h

@ -0,0 +1,41 @@ @@ -0,0 +1,41 @@
// 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_KEVAEDITBOOKMARKDIALOG_H
#define BITCOIN_QT_KEVAEDITBOOKMARKDIALOG_H
#include <QObject>
#include <QString>
#include <QDialog>
namespace Ui {
class KevaEditBookmarkDialog;
}
class KevaBookmarksDialog;
/** Dialog showing namepsace creation. */
class KevaEditBookmarkDialog : public QDialog
{
Q_OBJECT
public:
explicit KevaEditBookmarkDialog(QWidget *parent, const QString& id, const QString& name);
~KevaEditBookmarkDialog();
public Q_SLOTS:
void save();
void close();
void onNameChanged(const QString & ns);
private:
Ui::KevaEditBookmarkDialog *ui;
QString id;
QString name;
KevaBookmarksDialog* parentDialog;
};
#endif // BITCOIN_QT_KEVAEDITBOOKMARKDIALOG_H

6
src/qt/kevamynamespacesdialog.cpp

@ -60,6 +60,12 @@ void KevaMyNamespacesDialog::namespaceView_selectionChanged() @@ -60,6 +60,12 @@ void KevaMyNamespacesDialog::namespaceView_selectionChanged()
}
}
void KevaMyNamespacesDialog::on_namespaceView_doubleClicked(const QModelIndex &index)
{
selectedIndex = ui->namespaceView->selectionModel()->currentIndex();
this->apply();
}
void KevaMyNamespacesDialog::apply()
{
QModelIndex idIdx = selectedIndex.sibling(selectedIndex.row(), KevaNamespaceModel::Id);

1
src/qt/kevamynamespacesdialog.h

@ -41,6 +41,7 @@ public Q_SLOTS: @@ -41,6 +41,7 @@ public Q_SLOTS:
private Q_SLOTS:
void namespaceView_selectionChanged();
void on_namespaceView_doubleClicked(const QModelIndex &index);
private:
Ui::KevaMyNamespacesDialog *ui;

5
src/qt/kevatablemodel.cpp

@ -75,6 +75,11 @@ QVariant KevaTableModel::data(const QModelIndex &index, int role) const @@ -75,6 +75,11 @@ QVariant KevaTableModel::data(const QModelIndex &index, int role) const
{
if (index.column() == Block)
return (int)(Qt::AlignRight|Qt::AlignVCenter);
else if (index.column() == Value) {
#if (QT_VERSION >= QT_VERSION_CHECK(5, 12, 0))
return (int)(Qt::AlignLeft|Qt::AlignTop);
#endif
}
}
return QVariant();
}

39
src/qt/locale/bitcoin_en.ts

@ -1181,8 +1181,8 @@ @@ -1181,8 +1181,8 @@
<context>
<name>KevaBookmarksDialog</name>
<message>
<location filename="../kevabookmarksdialog.cpp" line="+20"/>
<source>Show</source>
<location filename="../kevabookmarksdialog.cpp" line="+23"/>
<source>&amp;Edit</source>
<translation type="unfinished"></translation>
</message>
</context>
@ -1215,7 +1215,7 @@ @@ -1215,7 +1215,7 @@
<context>
<name>KevaDialog</name>
<message>
<location filename="../forms/kevadialog.ui" line="+235"/>
<location filename="../forms/kevadialog.ui" line="+267"/>
<source>Show the selected request (does the same as double clicking an entry)</source>
<translation type="unfinished"></translation>
</message>
@ -1226,13 +1226,18 @@ @@ -1226,13 +1226,18 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="-204"/>
<location line="+14"/>
<location line="-234"/>
<location line="+44"/>
<source>The namespace ID with a prefix &quot;N&quot;.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="-7"/>
<location line="-34"/>
<source>Bookmark this namespace</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+27"/>
<source>Use this form to perform Keva database operations.</source>
<translation type="unfinished"></translation>
</message>
@ -1322,7 +1327,7 @@ @@ -1322,7 +1327,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="+192"/>
<location line="+259"/>
<source>Warning</source>
<translation type="unfinished">Warning</translation>
</message>
@ -1376,6 +1381,24 @@ @@ -1376,6 +1381,24 @@
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KevaEditBookmarkDialog</name>
<message>
<location filename="../forms/kevaeditbookmarkdialog.ui" line="+22"/>
<source>Bookmark name.</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+3"/>
<source>Name:</source>
<translation type="unfinished"></translation>
</message>
<message>
<location line="+13"/>
<source>This pane allows change of bookmark name</source>
<translation type="unfinished"></translation>
</message>
</context>
<context>
<name>KevaMyNamespacesDialog</name>
<message>
@ -1438,7 +1461,7 @@ @@ -1438,7 +1461,7 @@
<translation type="unfinished"></translation>
</message>
<message>
<location line="+81"/>
<location line="+88"/>
<source>Requested</source>
<translation type="unfinished"></translation>
</message>

6
src/qt/locale/bitcoin_zh_CN.ts

@ -925,9 +925,13 @@ @@ -925,9 +925,13 @@
<context>
<name>KevaBookmarksDialog</name>
<message>
<source>Show</source>
<source>&amp;Show</source>
<translation></translation>
</message>
<message>
<source>&amp;Edit</source>
<translation></translation>
</message>
</context>
<context>
<name>KevaBookmarksModel</name>

BIN
src/qt/res/icons/keva.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.3 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

BIN
src/qt/res/icons/star.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
src/qt/res/icons/star_empty.png

Binary file not shown.

Before

Width:  |  Height:  |  Size: 63 KiB

After

Width:  |  Height:  |  Size: 38 KiB

Loading…
Cancel
Save