-
Notifications
You must be signed in to change notification settings - Fork 92
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Staking reward setup GUI #605
Merged
proletesseract
merged 23 commits into
navcoin:master
from
aguycalled:split-staking-rewards
Oct 8, 2019
Merged
Changes from 22 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
6da6366
gui for splitting staking rewards
6341cfb
skip invalid address/empty json object
a6d2b4e
combobox with addresses
bfba552
fix dialog
d27c584
show coldstaking by staking address
244ad8a
fix gui tx list
c64bab1
fix listtransactions rpc accounting
6054aae
fix line wrap
05d3956
ignore 0% addresses
84b7727
fix typo
6a57745
ignore empty entries
5f13c6e
move some checks
fa2e2e4
populate list from AvailableCoinsForStaking
0b4055c
fix lookup key
1c89196
undo remove getobjmap
51957f8
remove log
a687f47
fix lookup key
89a9a3e
show popup when no coins left
ee64269
fix text
93445c2
fix calculation reward
93b5fdb
add mxaddict address
7b3003f
added "setup staking rewards" button on the overview page and also my…
proletesseract 869676c
changed pushbutton name to be more descriptive
proletesseract File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/*********************************************** | ||
Copyright (C) 2014 Schutz Sacha | ||
This file is part of QJsonModel (https://github.com/dridk/QJsonmodel). | ||
|
||
QJsonModel 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. | ||
|
||
QJsonModel 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 QJsonModel. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
**********************************************/ | ||
|
||
#include "qjsonitem.h" | ||
|
||
QJsonTreeItem::QJsonTreeItem(QJsonTreeItem *parent) | ||
{ | ||
|
||
mParent = parent; | ||
|
||
|
||
} | ||
|
||
QJsonTreeItem::~QJsonTreeItem() | ||
{ | ||
qDeleteAll(mChilds); | ||
|
||
} | ||
|
||
void QJsonTreeItem::appendChild(QJsonTreeItem *item) | ||
{ | ||
mChilds.append(item); | ||
} | ||
|
||
QJsonTreeItem *QJsonTreeItem::child(int row) | ||
{ | ||
return mChilds.value(row); | ||
} | ||
|
||
QJsonTreeItem *QJsonTreeItem::parent() | ||
{ | ||
return mParent; | ||
} | ||
|
||
int QJsonTreeItem::childCount() const | ||
{ | ||
return mChilds.count(); | ||
} | ||
|
||
int QJsonTreeItem::row() const | ||
{ | ||
if (mParent) | ||
return mParent->mChilds.indexOf(const_cast<QJsonTreeItem*>(this)); | ||
|
||
return 0; | ||
} | ||
|
||
void QJsonTreeItem::setKey(const QString &key) | ||
{ | ||
mKey = key; | ||
} | ||
|
||
void QJsonTreeItem::setValue(const QString &value) | ||
{ | ||
mValue = value; | ||
} | ||
|
||
void QJsonTreeItem::setType(const QJsonValue::Type &type) | ||
{ | ||
mType = type; | ||
} | ||
|
||
QString QJsonTreeItem::key() const | ||
{ | ||
return mKey; | ||
} | ||
|
||
QString QJsonTreeItem::value() const | ||
{ | ||
return mValue; | ||
} | ||
|
||
QJsonValue::Type QJsonTreeItem::type() const | ||
{ | ||
return mType; | ||
} | ||
|
||
QJsonTreeItem* QJsonTreeItem::load(const QJsonValue& value, QJsonTreeItem* parent) | ||
{ | ||
|
||
|
||
QJsonTreeItem * rootItem = new QJsonTreeItem(parent); | ||
rootItem->setKey("root"); | ||
|
||
if ( value.isObject()) | ||
{ | ||
|
||
//Get all QJsonValue childs | ||
for (QString key: value.toObject().keys()){ | ||
QJsonValue v = value.toObject().value(key); | ||
QJsonTreeItem * child = load(v,rootItem); | ||
child->setKey(key); | ||
child->setType(v.type()); | ||
rootItem->appendChild(child); | ||
|
||
} | ||
|
||
} | ||
|
||
else if ( value.isArray()) | ||
{ | ||
//Get all QJsonValue childs | ||
int index = 0; | ||
for (QJsonValue v: value.toArray()){ | ||
|
||
QJsonTreeItem * child = load(v,rootItem); | ||
child->setKey(QString::number(index)); | ||
child->setType(v.type()); | ||
rootItem->appendChild(child); | ||
++index; | ||
} | ||
} | ||
else | ||
{ | ||
rootItem->setValue(value.toVariant().toString()); | ||
rootItem->setType(value.type()); | ||
} | ||
|
||
return rootItem; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
#ifndef JSONITEM_H | ||
#define JSONITEM_H | ||
|
||
#include <QtCore> | ||
#include <QJsonValue> | ||
#include <QJsonArray> | ||
#include <QJsonObject> | ||
|
||
class QJsonTreeItem | ||
{ | ||
public: | ||
QJsonTreeItem(QJsonTreeItem * parent = 0); | ||
~QJsonTreeItem(); | ||
void appendChild(QJsonTreeItem * item); | ||
QJsonTreeItem *child(int row); | ||
QJsonTreeItem *parent(); | ||
int childCount() const; | ||
int row() const; | ||
void setKey(const QString& key); | ||
void setValue(const QString& value); | ||
void setType(const QJsonValue::Type& type); | ||
QString key() const; | ||
QString value() const; | ||
QJsonValue::Type type() const; | ||
|
||
|
||
static QJsonTreeItem* load(const QJsonValue& value, QJsonTreeItem * parent = 0); | ||
|
||
protected: | ||
|
||
|
||
private: | ||
QString mKey; | ||
QString mValue; | ||
QJsonValue::Type mType; | ||
|
||
QList<QJsonTreeItem*> mChilds; | ||
QJsonTreeItem * mParent; | ||
|
||
|
||
}; | ||
|
||
#endif // JSONITEM_H |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@proletesseract could we maybe use another name for this method? it reads very generic and does not refer to its real meaning
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, that was just what was autogenerated by QT Creator. I'll commit the change when i get a chance.