Browse Source

change orange color

pull/130/head
DenioD 4 years ago
parent
commit
385f864d9d
  1. 1
      application.qrc
  2. 841
      lib/Cargo.lock
  3. 2
      lib/Cargo.toml
  4. 34
      src/Model/ChatItem.cpp
  5. 7
      src/Model/ChatItem.h
  6. 61
      src/controller.cpp
  7. 5
      src/controller.h
  8. 3
      src/mainwindow.ui

1
application.qrc

@ -39,6 +39,7 @@
<file>res/lock.svg</file>
<file>res/lock.png</file>
<file>res/lock_green.png</file>
<file>res/lock_orange.png</file>
<file>res/unlocked.png</file>
<file>res/getAddrWhite.png</file>
<file>res/send-white.png</file>

841
lib/Cargo.lock

File diff suppressed because it is too large

2
lib/Cargo.toml

@ -11,4 +11,4 @@ crate-type = ["staticlib"]
[dependencies]
libc = "0.2.58"
lazy_static = "1.4.0"
silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "91c8d18d17aa5b67dc5dc8a5f8cfe4e323fdda30" }
silentdragonlitelib = { git = "https://github.com/DenioD/silentdragonlite-cli", rev = "fb07cae93c706cce929beef98690109e5f2d7592" }

34
src/Model/ChatItem.cpp

@ -5,7 +5,7 @@
ChatItem::ChatItem() {}
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations)
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize)
{
_timestamp = timestamp;
_address = address;
@ -17,9 +17,10 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_txid = txid;
_confirmations = confirmations;
_outgoing = false;
_notarize = notarize;
}
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing)
ChatItem::ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize)
{
_timestamp = timestamp;
_address = address;
@ -31,6 +32,7 @@ ChatItem::ChatItem(long timestamp, QString address, QString contact, QString mem
_txid = txid;
_confirmations = confirmations;
_outgoing = outgoing;
_notarize = notarize;
}
long ChatItem::getTimestamp()
@ -81,6 +83,11 @@ bool ChatItem::isOutgoing()
return _outgoing;
}
bool ChatItem::isNotarized()
{
return _notarize;
}
void ChatItem::setTimestamp(long timestamp)
{
_timestamp = timestamp;
@ -128,6 +135,10 @@ void ChatItem::toggleOutgo()
{
_outgoing = true;
}
void ChatItem::notarized()
{
_notarize = false;
}
QString ChatItem::toChatLine()
@ -136,14 +147,25 @@ QString ChatItem::toChatLine()
QString lock;
myDateTime.setTime_t(_timestamp);
if (_confirmations == 0){
if (_notarize == true)
{
lock = "<b> <img src=':/icons/res/lock_orange.png'><b>";
}else{
lock = "<b> <img src=':/icons/res/unlocked.png'><b>";
}else{
}
if ((_confirmations > 0) && (_notarize == false))
{
lock = "<b> <img src=':/icons/res/lock_green.png'><b>";
}
}
qDebug()<<_notarize;
QString line = QString("<small>") + myDateTime.toString("dd.MM.yyyy hh:mm");
line += QString(lock) + QString("</small>");
line += QString("<p>") + _memo.toHtmlEscaped() + QString("</p>");

7
src/Model/ChatItem.h

@ -20,11 +20,12 @@ class ChatItem
QString _txid;
int _confirmations;
bool _outgoing = false;
bool _notarize = false;
public:
ChatItem();
ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations);
ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing);
ChatItem(long timestamp, QString address, QString contact, QString memo,QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool notarize);
ChatItem(long timestamp, QString address, QString contact, QString memo, QString requestZaddr, QString type, QString cid, QString txid, int confirmations, bool outgoing, bool notarize);
long getTimestamp();
QString getAddress();
QString getContact();
@ -35,6 +36,7 @@ class ChatItem
QString getTxid();
int getConfirmations();
bool isOutgoing();
bool isNotarized();
void setTimestamp(long timestamp);
void setAddress(QString address);
void setContact(QString contact);
@ -45,6 +47,7 @@ class ChatItem
void setTxid(QString txid);
void setConfirmations(int confirmations);
void toggleOutgo();
void notarized();
QString toChatLine();
json toJson();
~ChatItem();

61
src/controller.cpp

@ -239,6 +239,12 @@ void Controller::getInfoThenRefresh(bool force)
int curBlock = reply["latest_block_height"].get<json::number_integer_t>();
int longestchain = reply["longestchain"].get<json::number_integer_t>();
int notarized = reply["notarized"].get<json::number_integer_t>();
int lag = longestchain - notarized ;
qDebug()<<"Lag :" << lag;
int difficulty = reply["difficulty"].get<json::number_integer_t>();
int blocks_until_halving= 340000 - curBlock;
int halving_days = (blocks_until_halving * 150) / (60*60*24) ;
@ -258,7 +264,11 @@ void Controller::getInfoThenRefresh(bool force)
);
ui->longestchain->setText(
"Block: " + QLocale(QLocale::German).toString(longestchain)
);
this->setLag(lag);
ui->difficulty->setText(
QLocale(QLocale::German).toString(difficulty)
);
@ -285,6 +295,8 @@ void Controller::getInfoThenRefresh(bool force)
(QLocale(QLocale::English).toString(blocks_until_halving)) +
" Blocks or , " + (QLocale(QLocale::English).toString(halving_days) + " days" )
);
this->setLag(lag);
}
ui->Version->setText(
@ -293,6 +305,7 @@ void Controller::getInfoThenRefresh(bool force)
ui->Vendor->setText(
QString::fromStdString(reply["vendor"].get<json::string_t>())
);
this->setLag(lag);
main->logger->write(
QString("Refresh. curblock ") % QString::number(curBlock) % ", update=" % (doUpdate ? "true" : "false")
);
@ -562,6 +575,20 @@ void Controller::getInfoThenRefresh(bool force)
});
}
int Controller::getLag()
{
return _lag;
}
void Controller::setLag(int lag)
{
_lag = lag;
}
void Controller::refreshAddresses()
{
if (!zrpc->haveConnection())
@ -877,6 +904,15 @@ void Controller::refreshTransactions() {
memo = QString::fromStdString(o["memo"]);
QString cid;
bool isNotarized;
if (confirmations > getLag())
{
isNotarized = true;
}else{
isNotarized = false;
}
ChatItem item = ChatItem(
datetime,
@ -888,10 +924,11 @@ void Controller::refreshTransactions() {
cid,
txid,
confirmations,
true
true,
isNotarized
);
// qDebug()<<"Memo : " <<memo;
// qDebug()<<"Confirmation :" << confirmations;
qDebug()<< "Notarized Outgoing : " << isNotarized;
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
@ -973,8 +1010,20 @@ void Controller::refreshTransactions() {
requestZaddr = chatModel->getrequestZaddrByTx(txid);
}else{
requestZaddr = "";
}
}
position = it["position"].get<json::number_integer_t>();
bool isNotarized;
if (confirmations > getLag())
{
isNotarized = true;
}else{
isNotarized = false;
}
ChatItem item = ChatItem(
datetime,
address,
@ -985,9 +1034,10 @@ void Controller::refreshTransactions() {
cid,
txid,
confirmations,
false
false,
isNotarized
);
// qDebug()<< "Position : " << position;
qDebug()<< "Notarized : " << isNotarized;
// qDebug()<<"Confirmation :" << confirmations;
DataStore::getChatDataStore()->setData(ChatIDGenerator::getInstance()->generateID(item), item);
@ -995,6 +1045,7 @@ void Controller::refreshTransactions() {
}
}
qDebug()<< getLag();
// Calculate the total unspent amount that's pending. This will need to be
// shown in the UI so the user can keep track of pending funds

5
src/controller.h

@ -37,7 +37,10 @@ public:
Connection* getConnection() { return zrpc->getConnection(); }
void setConnection(Connection* c);
void refresh(bool force = false);
void refreshAddresses();
void refreshAddresses();
int getLag();
void setLag(int lag);
int _lag;
void checkForUpdate(bool silent = true);
void refreshZECPrice();

3
src/mainwindow.ui

@ -1505,6 +1505,9 @@
<height>521</height>
</rect>
</property>
<property name="toolTip">
<string>The locks shows you the status of the message. Red lock = unconfirmed, green lock = min. 1 confirmations, orange lock = message is notarized</string>
</property>
<property name="verticalScrollBarPolicy">
<enum>Qt::ScrollBarAsNeeded</enum>
</property>

Loading…
Cancel
Save