Skip to content

Commit

Permalink
Add the batch of release v3.5.0 commits
Browse files Browse the repository at this point in the history
  • Loading branch information
developer-at-bcn committed Jul 4, 2019
1 parent 4559563 commit 0353f6d
Show file tree
Hide file tree
Showing 72 changed files with 2,203 additions and 692 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ build-bytecoin-gui*

*~
CMakeLists.txt.user*
*.pro.user
*.pro.user*

# Mac specific
.DS_Store
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# bytecoin-gui

[![Build Status](https://dev.azure.com/bcndev/bytecoin/_apis/build/status/bytecoin-desktop?branchName=releases/3.4.5)](https://dev.azure.com/bcndev/bytecoin/_build/latest?definitionId=2&branchName=releases/3.4.5)
[![Build Status](https://dev.azure.com/bcndev/bytecoin/_apis/build/status/bytecoin-desktop?branchName=releases/3.5.0)](https://dev.azure.com/bcndev/bytecoin/_build/latest?definitionId=2&branchName=releases/3.5.0)

## How to build binaries from source code

Expand Down
8 changes: 8 additions & 0 deletions ReleaseNotes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
## Release Notes

### v3.5.0 (Beryl)

- Made many visual improvements to the graphical elements of the app.
- Added a full-value support for multiple addresses.
- Implemented an integration with the official Bytecoin explorer (it's opened when clicking either transaction/block hashes or block heights).
- Fixed bugs.
- Updated the Bytecoin daemons.

### v3.4.5 (Amethyst)

- Disabled asking passwords for wallets with empty passwords.
Expand Down
23 changes: 2 additions & 21 deletions src/addressbookframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
#include <QClipboard>
#include <QMenu>
#include <QMessageBox>
#include <QLabel>

#include "addressbookframe.h"
#include "addressbookdelegate.h"
#include "addressbookmanager.h"
#include "questiondialog.h"
#include "addressbookmodel.h"
Expand All @@ -25,17 +25,12 @@ AddressBookFrame::AddressBookFrame(QWidget* parent)
, mainWindow_(nullptr)
, m_sortedAddressBookModel(nullptr)
, m_helperLabel(new QLabel(this))
, m_addressBookDelegate(new AddressBookDelegate(this))
{
m_ui->setupUi(this);
QPixmap helperPixmap(":images/add_address_helper");
m_helperLabel->setGeometry(helperPixmap.rect());
m_helperLabel->setPixmap(helperPixmap);
// m_ui->m_addressBookView->setHoverIsVisible(true);
m_ui->m_addressBookView->setItemDelegateForColumn(AddressBookModel::COLUMN_ACTION, m_addressBookDelegate);
connect(m_addressBookDelegate, &AddressBookDelegate::sendToSignal, this, &AddressBookFrame::sendToSignal);
connect(m_addressBookDelegate, &AddressBookDelegate::editSignal, this, &AddressBookFrame::editClicked);
connect(m_addressBookDelegate, &AddressBookDelegate::deleteSignal, this, &AddressBookFrame::deleteClicked);
// connect(this, &AddressBookFrame::sendToSignal, this, &AddressBookFrame::sendToClicked);
}

Expand All @@ -59,20 +54,11 @@ void AddressBookFrame::setSortedAddressBookModel(QAbstractItemModel* _model) {
// m_ui->m_addressBookView->setItemDelegateForColumn(AddressBookModel::COLUMN_ADDRESS, new RightAlignmentColumnDelegate(false, this));
m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_LABEL, QHeaderView::Fixed);
m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_ADDRESS, QHeaderView::Stretch);
// m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_DONATION, QHeaderView::Fixed);
m_ui->m_addressBookView->header()->setSectionResizeMode(AddressBookModel::COLUMN_ACTION, QHeaderView::Fixed);
m_ui->m_addressBookView->header()->setResizeContentsPrecision(-1);
m_ui->m_addressBookView->header()->resizeSection(AddressBookModel::COLUMN_LABEL, 250);
// m_ui->m_addressBookView->header()->resizeSection(AddressBookModel::COLUMN_DONATION, 90);
m_ui->m_addressBookView->header()->resizeSection(AddressBookModel::COLUMN_ACTION, 40);
connect(m_sortedAddressBookModel, &QAbstractItemModel::rowsInserted, this, &AddressBookFrame::rowsInserted);
connect(m_sortedAddressBookModel, &QAbstractItemModel::rowsRemoved, this, &AddressBookFrame::rowsRemoved);

for (int i = 0; i < m_sortedAddressBookModel->rowCount(); ++i) {
QPersistentModelIndex index = m_sortedAddressBookModel->index(i, AddressBookModel::COLUMN_ACTION);
m_ui->m_addressBookView->openPersistentEditor(index);
}

if (m_sortedAddressBookModel->rowCount() > 0) {
m_helperLabel->hide();
}
Expand All @@ -89,12 +75,7 @@ void AddressBookFrame::resizeEvent(QResizeEvent* /*_event*/) {
m_helperLabel->raise();
}

void AddressBookFrame::rowsInserted(const QModelIndex& /*_parent*/, int _first, int _last) {
for (int i = _first; i <= _last; ++i) {
QPersistentModelIndex index = m_sortedAddressBookModel->index(i, AddressBookModel::COLUMN_ACTION);
m_ui->m_addressBookView->openPersistentEditor(index);
}

void AddressBookFrame::rowsInserted(const QModelIndex& /*_parent*/, int /*_first*/, int /*_last*/) {
m_helperLabel->hide();
}

Expand Down
1 change: 0 additions & 1 deletion src/addressbookframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ class AddressBookFrame : public QFrame
MainWindow* mainWindow_;
QAbstractItemModel* m_sortedAddressBookModel;
QLabel* m_helperLabel;
AddressBookDelegate* m_addressBookDelegate;

void rowsInserted(const QModelIndex& _parent, int _first, int _last);
void rowsRemoved(const QModelIndex& _parent, int _first, int _last);
Expand Down
20 changes: 0 additions & 20 deletions src/addressbookframe.ui
Original file line number Diff line number Diff line change
Expand Up @@ -46,26 +46,6 @@
<property name="rightMargin">
<number>6</number>
</property>
<item>
<widget class="QLabel" name="m_addressBookTextLabel">
<property name="text">
<string>Contacts</string>
</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>
<item>
Expand Down
122 changes: 121 additions & 1 deletion src/addressbookmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ constexpr const char ADDRESS_ITEM_ADDRESS_TAG_NAME[] = "address";
}

AddressBookManager::AddressBookManager(QObject* _parent)
: QObject(_parent)
: IAddressBookManager(_parent)
{
const QString jsonFile = Settings::instance().getDefaultWorkDir().absoluteFilePath("address_book.json");

Expand Down Expand Up @@ -157,4 +157,124 @@ void AddressBookManager::buildIndexes() {
}
}

MyAddressesManager::MyAddressesManager(QObject* parent)
: IAddressBookManager(parent)
, firstTime_(true)
{}

MyAddressesManager::~MyAddressesManager()
{}

void MyAddressesManager::connectedToWalletd()
{
WalletLogger::debug(tr("[WalletAddressBook] Connected to walletd."));
firstTime_ = true;
addressBook_.clear();
requestAddresses();
}

void MyAddressesManager::disconnectedFromWalletd()
{
emit addressBookClosedSignal();
}

void MyAddressesManager::requestAddresses(quint32 index, quint32 count)
{
emit getWalletRecordsSignal(RpcApi::GetWalletRecords::Request{false, false, index, count});
}

void MyAddressesManager::createAddress(const QString& label)
{
emit createAddressSignal(label);
}

void MyAddressesManager::setAddressLabel(const QString& address, const QString& label)
{
emit setAddressLabelSignal(RpcApi::SetAddressLabel::Request{address, label});
}

void MyAddressesManager::walletRecordsReceived(const RpcApi::WalletRecords& records)
{
WalletLogger::debug(tr("[WalletAddressBook] Wallet records received."));
for (const RpcApi::WalletRecord& rec: records.records)
{
addressBook_ << AddressItem{rec.label, rec.address};
const AddressIndex index = addressBook_.size() - 1;
addressIndexes_[rec.address] = index;
WalletLogger::debug(tr("[WalletAddressBook] Wallet record indexed."));
if (!firstTime_)
emit addressAddedSignal(index);
}

if (firstTime_)
{
firstTime_ = false;
emit addressBookOpenedSignal();
}
}

void MyAddressesManager::addressLabelSetReceived(const QString& address, const QString& label)
{
const AddressIndex index = findAddressByAddress(address);
if (index == INVALID_ADDRESS_INDEX)
{
WalletLogger::warning(tr("[WalletAddressBook] Failed to find address %1.").arg(address));
return;
}
addressBook_[index].label = label;
WalletLogger::debug(tr("[WalletAddressBook] Label changed."));
emit addressEditedSignal(index);
}

AddressIndex MyAddressesManager::getAddressCount() const
{
return addressBook_.size();
}

AddressItem MyAddressesManager::getAddress(AddressIndex addressIndex) const
{
Q_ASSERT(addressIndex < getAddressCount());
return addressBook_[addressIndex];
}

void MyAddressesManager::addAddress(const QString& label, const QString& address)
{
Q_ASSERT(address.isEmpty());
createAddress(label);
}

void MyAddressesManager::addressCreatedReceived(const RpcApi::CreatedAddresses& addrs)
{
Q_ASSERT(addrs.addresses.size() == 1);
WalletLogger::debug(tr("[WalletAddressBook] New address created."));
requestAddresses(addressBook_.size(), 1);
}

void MyAddressesManager::editAddress(AddressIndex addressIndex, const QString& label, const QString& address)
{
Q_ASSERT(addressIndex < getAddressCount());
Q_ASSERT(address.isEmpty());
setAddressLabel(addressBook_[addressIndex].address, label);
}

void MyAddressesManager::removeAddress(AddressIndex /*addressIndex*/)
{
Q_ASSERT(false); // addresses cannot be removed from wallet
}

//void MyAddressesManager::buildIndexes()
//{
// for (int i = 0, size = addressBook_.size(); i < size; ++i)
// {
// const AddressItem& item = addressBook_[i];
// addressIndexes_[item.address] = i;
// }
//}

AddressIndex MyAddressesManager::findAddressByAddress(const QString& address) const
{
return addressIndexes_.value(address, INVALID_ADDRESS_INDEX);
}


}
Loading

0 comments on commit 0353f6d

Please sign in to comment.