Setting tooltip on construction. Closing transaction before doing other GUI actions.

This commit is contained in:
clemahieu 2017-04-16 12:46:37 -05:00
commit 50a93145e8

View file

@ -600,6 +600,7 @@ wallet (wallet_a)
rai_qt::status::status (rai_qt::wallet & wallet_a) : rai_qt::status::status (rai_qt::wallet & wallet_a) :
wallet (wallet_a) wallet (wallet_a)
{ {
wallet.status->setToolTip ("Wallet status, block count (blocks downloaded)");
active.insert (rai_qt::status_types::nominal); active.insert (rai_qt::status_types::nominal);
set_text (); set_text ();
} }
@ -622,17 +623,20 @@ void rai_qt::status::set_text ()
{ {
wallet.status->setText (text ().c_str ()); wallet.status->setText (text ().c_str ());
wallet.status->setStyleSheet ((std::string ("QLabel {") + color () + "}").c_str ()); wallet.status->setStyleSheet ((std::string ("QLabel {") + color () + "}").c_str ());
wallet.status->setToolTip("Wallet status and wallet block count (blocks remaining to sync)");
} }
std::string rai_qt::status::text () std::string rai_qt::status::text ()
{ {
assert (!active.empty ()); assert (!active.empty ());
std::string result; std::string result;
rai::transaction transaction (wallet.wallet_m->node.store.environment, nullptr, false); size_t unchecked (0);
auto size (wallet.wallet_m->node.store.block_count (transaction)); std::string count_string;
auto unchecked (wallet.wallet_m->node.store.unchecked_count (transaction)); {
auto count_string (std::to_string (size.sum ())); rai::transaction transaction (wallet.wallet_m->node.store.environment, nullptr, false);
auto size (wallet.wallet_m->node.store.block_count (transaction));
unchecked = wallet.wallet_m->node.store.unchecked_count (transaction);
count_string = std::to_string (size.sum ());
}
switch (*active.begin ()) switch (*active.begin ())
{ {
@ -1101,27 +1105,17 @@ wallet (wallet_a)
rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true); rai::transaction transaction (this->wallet.wallet_m->store.environment, nullptr, true);
if (this->wallet.wallet_m->store.valid_password (transaction)) if (this->wallet.wallet_m->store.valid_password (transaction))
{ {
if (new_password->text ().isEmpty()) if (new_password->text () == retype_password->text ())
{ {
this->wallet.wallet_m->store.rekey (transaction, std::string (new_password->text ().toLocal8Bit ()));
new_password->clear (); new_password->clear ();
new_password->setPlaceholderText ("Empty Password - try again: New password"); retype_password->clear ();
retype_password->clear (); retype_password->setPlaceholderText ("Retype password");
retype_password->setPlaceholderText ("Empty Password - try again: Retype password");
} }
else else
{ {
if (new_password->text () == retype_password->text ()) retype_password->clear ();
{ retype_password->setPlaceholderText ("Password mismatch");
this->wallet.wallet_m->store.rekey (transaction, std::string (new_password->text ().toLocal8Bit ()));
new_password->clear ();
retype_password->clear ();
retype_password->setPlaceholderText ("Retype password");
}
else
{
retype_password->clear ();
retype_password->setPlaceholderText ("Password mismatch");
}
} }
} }
}); });
@ -1328,6 +1322,7 @@ wallet (wallet_a)
}); });
refresh_ledger (); refresh_ledger ();
refresh_count (); refresh_count ();
block_count->setToolTip ("Block count (blocks downloaded)");
} }
void rai_qt::advanced_actions::refresh_count () void rai_qt::advanced_actions::refresh_count ()