Skip to content

Commit

Permalink
Add the batch of release v2.0.4 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
developer-at-bcn committed May 9, 2018
1 parent 3dfae46 commit 2682192
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 40 deletions.
31 changes: 20 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,19 @@
# bytecoin-gui

## Requirements

1. Qt5 libraries</br>
To install all required packages on Ubuntu use the following command:
```
sudo apt install qt5-qmake qtbase5-dev qtbase5-dev-tools
```

## How to build binaries from source code

### Windows

TODO
To build the gui you must have built bytecoin core, so please do all steps from [here](https://github.com/bcndev/bytecoin#building-on-windows) before proceed. Install [QtCreator](https://www.qt.io/download-thank-you?os=windows), open the project file bytecoin-gui/src/bytecoin-gui.pro in QtCreator and build it using MSVS kit (you must have MSVS installed already to build bytecoin core).

### MacOS

TODO
To build the gui you must have built bytecoin core, so please do all steps from [here](https://github.com/bcndev/bytecoin#building-on-mac-osx) before proceed. Install [QtCreator](https://www.qt.io/download-thank-you?os=macos), open the project file bytecoin-gui/src/bytecoin-gui.pro in QtCreator and build it using clang kit (you must have XCode installed already to build bytecoin core).

### Linux
```
# To install all required packages on Ubuntu use the following command:
$ sudo apt install qt5-qmake qtbase5-dev qtbase5-dev-tools
$ git clone https://github.com/bcndev/bytecoin.git
$ cd bytecoin
$ mkdir -p build
Expand All @@ -34,3 +28,18 @@ $ cd build
$ cmake ..
$ make -j4
```
Alternative way:
```
# Install QtCreator:
$ sudo apt install qtcreator
$ git clone https://github.com/bcndev/bytecoin.git
$ cd bytecoin
$ mkdir -p build
$ cd build
$ cmake ..
$ make -j4 bytecoin-crypto
$ cd ../..
$ git clone https://github.com/bcndev/bytecoin-gui.git
```
Now open the project file bytecoin-gui/src/bytecoin-gui.pro in QtCreator and build it.
7 changes: 7 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
## Release Notes

### v2.0.4

- Updated Bytecoin daemons.
- Fixed window file path on MacOS.
- Fixed bug in transaction list.
- Fixed minor GUI fixes.

### v2.0.2

- Fixed `walletd` crashes when reopening wallet.
Expand Down
2 changes: 1 addition & 1 deletion src/bytecoin-gui.pro
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ TEMPLATE = app
macx: QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.11
macx: ICON = images/bytecoin.icns
win32: RC_ICONS = images/bytecoin.ico
win32: VERSION = 2.18.4.4
win32: VERSION = 2.18.5.9

#QMAKE_CXXFLAGS += -fno-omit-frame-pointer -fsanitize=address,undefined
#LIBS += -lasan -lubsan
Expand Down
21 changes: 9 additions & 12 deletions src/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,18 @@ void MainWindow::showLog()

void MainWindow::setTitle()
{
clearTitle();
#ifdef Q_OS_MAC
if (Settings::instance().getConnectionMethod() == ConnectionMethod::BUILTIN)
setWindowFilePath(Settings::instance().getWalletFile());
else
setWindowTitle(Settings::instance().getRpcEndPoint());
#else
const QString fileName =
Settings::instance().getConnectionMethod() == ConnectionMethod::BUILTIN ?
Settings::instance().getWalletFile() :
Settings::instance().getRpcEndPoint();
#ifdef Q_OS_MAC
setWindowFilePath(fileName);
#else

setWindowTitle(fileName);
#endif
}
Expand All @@ -349,6 +354,7 @@ void MainWindow::clearTitle()
{
#ifdef Q_OS_MAC
setWindowFilePath(QString{});
setWindowTitle(QString{});
#else
setWindowTitle(QString{});
#endif
Expand All @@ -365,12 +371,6 @@ void MainWindow::setConnectedState()
m_ui->m_overviewButton->click();

setTitle();
#ifdef Q_OS_MAC
if (Settings::instance().getConnectionMethod() == ConnectionMethod::BUILTIN)
setWindowFilePath(Settings::instance().getWalletFile());
else
setWindowFilePath(Settings::instance().getRpcEndPoint());
#endif
}

void MainWindow::setDisconnectedState()
Expand All @@ -392,9 +392,6 @@ void MainWindow::setDisconnectedState()
m_ui->m_exportViewOnlyKeysAction->setEnabled(false);

clearTitle();
#ifdef Q_OS_MAC
setWindowFilePath(QString());
#endif
}

void MainWindow::builtinRun()
Expand Down
2 changes: 1 addition & 1 deletion src/rpcapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ CreateTransaction::Request::toJson() const

RPCAPI_SERIALIZE_STRUCT(value, json, transaction);

RPCAPI_SERIALIZE_FIELD(value, json, spend_address);
RPCAPI_SERIALIZE_FIELD(value, json, spend_addresses);
RPCAPI_SERIALIZE_FIELD(value, json, any_spend_address);
RPCAPI_SERIALIZE_FIELD(value, json, change_address);
RPCAPI_SERIALIZE_FIELD(value, json, confirmed_height_or_depth);
Expand Down
2 changes: 1 addition & 1 deletion src/rpcapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ struct CreateTransaction
struct Request
{
Transaction transaction;
QString spend_address;
QStringList spend_addresses;
bool any_spend_address = false;
QString change_address;
HeightOrDepth confirmed_height_or_depth = -DEFAULT_CONFIRMATIONS - 1;
Expand Down
4 changes: 2 additions & 2 deletions src/version.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#ifndef VERSION_H
#define VERSION_H

constexpr char VERSION[] = "2.0.2";
constexpr char VERSION[] = "2.0.4";
constexpr char VERSION_SUFFIX[] = "stable";
constexpr char REVISION[] = "20180404";
constexpr char REVISION[] = "20180509";

#endif // VERSION_H
51 changes: 39 additions & 12 deletions src/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ struct WalletModelState
bool viewOnly = false;

RemoteWalletd::State walletdState = RemoteWalletd::State::STOPPED;
int unconfimedSize = 0;
int unconfirmedSize = 0;
bool canFetchMore = true;
};

Expand Down Expand Up @@ -90,6 +90,8 @@ QVariant WalletModel::headerData(int section, Qt::Orientation orientation, int r
return tr("Fee");
case COLUMN_ADDRESS:
return tr("Address");
case COLUMN_PROOF:
return tr("Proof");
}
break;
case Qt::TextAlignmentRole:
Expand Down Expand Up @@ -191,22 +193,45 @@ void WalletModel::addressesReceived(const RpcApi::Addresses& response)
void WalletModel::transfersReceived(const RpcApi::Transfers& history)
{
const quint32 highestConfirmedBlock = getHighestKnownConfirmedBlock();
if (history.next_from_height >= highestConfirmedBlock)
// const quint32 highestConfirmedBlock = pimpl_->highestConfirmedBlockDuringRequest;
// QList<RpcApi::Transaction> txs;
// QList<RpcApi::Transaction> unconfirmedTxs;
// for (const RpcApi::Block& block : history.blocks)
// {
// if (block.header.height > highestConfirmedBlock)
// unconfirmedTxs.append(block.transactions);
// else
// txs.append(block.transactions);
// }
// QList<RpcApi::Transaction> newTxs = unconfirmedTxs;
// newTxs.append(txs);
// newTxs.append(pimpl_->txs.mid(pimpl_->unconfirmedSize)); // cut unconfirmed and save confirmed only

// pimpl_->unconfirmedSize = unconfirmedTxs.size();
// containerReceived(pimpl_->txs, newTxs, pimpl_->addresses.size());

if (history.next_from_height >= highestConfirmedBlock) // unconfirmed
{
// pimpl_->txs.erase(pimpl_->txs.begin(), pimpl_->txs.begin() + pimpl_->unconfirmedSize);
// pimpl_->unconfirmedSize = 0;

QList<RpcApi::Transaction> txs;
for (const RpcApi::Block& block : history.blocks)
txs.append(block.transactions);

if (txs == pimpl_->txs.mid(0, pimpl_->unconfimedSize))
if (txs == pimpl_->txs.mid(0, pimpl_->unconfirmedSize))
return;

const QList<RpcApi::Transaction>& confirmedTxs = pimpl_->txs.mid(pimpl_->unconfimedSize);
pimpl_->unconfimedSize = txs.size();
const QList<RpcApi::Transaction>& confirmedTxs = pimpl_->txs.mid(pimpl_->unconfirmedSize);
pimpl_->unconfirmedSize = txs.size();
txs.append(confirmedTxs);
containerReceived(pimpl_->txs, txs, pimpl_->addresses.size());
}
else if (history.next_to_height < highestConfirmedBlock)
else if (history.next_to_height < highestConfirmedBlock) // confirmed
{
// pimpl_->txs.erase(pimpl_->txs.begin(), pimpl_->txs.begin() + pimpl_->unconfirmedSize);
// pimpl_->unconfirmedSize = 0;

QList<RpcApi::Transaction> txs;
for (const RpcApi::Block& block : history.blocks)
txs.append(block.transactions);
Expand All @@ -222,9 +247,10 @@ void WalletModel::transfersReceived(const RpcApi::Transfers& history)
}
else if (txs.last().block_height > getTopConfirmedBlock())
{
QList<RpcApi::Transaction> newTxs = pimpl_->txs.mid(0, pimpl_->unconfimedSize);
QList<RpcApi::Transaction> newTxs = pimpl_->txs.mid(0, pimpl_->unconfirmedSize);
newTxs.append(txs);
newTxs.append(pimpl_->txs.mid(pimpl_->unconfimedSize));
// QList<RpcApi::Transaction> newTxs = txs;
newTxs.append(pimpl_->txs.mid(pimpl_->unconfirmedSize));
containerReceived(pimpl_->txs, newTxs, pimpl_->addresses.size());
}
}
Expand Down Expand Up @@ -319,17 +345,18 @@ void WalletModel::statusReceived(const RpcApi::Status& status)

quint32 WalletModel::getTopConfirmedBlock() const
{
return pimpl_->unconfimedSize < pimpl_->txs.size() ? pimpl_->txs[pimpl_->unconfimedSize].block_height : 0;
return pimpl_->unconfirmedSize < pimpl_->txs.size() ? pimpl_->txs[pimpl_->unconfirmedSize].block_height : 0;
}

quint32 WalletModel::getBottomConfirmedBlock() const
{
return pimpl_->unconfimedSize < pimpl_->txs.size() ? pimpl_->txs.last().block_height : std::numeric_limits<quint32>::max();
return pimpl_->unconfirmedSize < pimpl_->txs.size() ? pimpl_->txs.last().block_height : std::numeric_limits<quint32>::max();
}

quint32 WalletModel::getHighestKnownConfirmedBlock() const
{
const quint32 topKnownBlockHeight = pimpl_->status.top_known_block_height;
// const quint32 topKnownBlockHeight = pimpl_->status.top_known_block_height;
const quint32 topKnownBlockHeight = pimpl_->status.top_block_height;
return topKnownBlockHeight < CONFIRMATIONS + 2 ? 0 : topKnownBlockHeight - CONFIRMATIONS - 2;
}

Expand Down Expand Up @@ -563,7 +590,7 @@ QVariant WalletModel::getDisplayRoleHistory(const QModelIndex& index) const
break;
}
}
return pimpl_->viewOnly ? QVariant{} : proof ? QVariant(tr("Proof")) : QVariant(tr("Try"));
return pimpl_->viewOnly ? QVariant{} : proof ? QVariant(tr("Get")) : QVariant(tr("Try"));
}
}

Expand Down

0 comments on commit 2682192

Please sign in to comment.