Skip to content

Commit

Permalink
Merge #2429: [Backport] 5.2.0 backports
Browse files Browse the repository at this point in the history
3344fb3 [CI] Remove Ubuntu 16.04 from GA workflow, has been deprecated by GA and will be removed on September 20, 2021. (furszy)
b5a8638 [GUI] Cleanup compiler warnings in qtutils.h/cpp (furszy)
73b56e9 [GUI] Fix invisible text due an invalid transparent selection color. (furszy)
df5d820 budget: fixing a possible race condition that could cause a good peer being banned. (furszy)
a5fd073 Fix minimize and close bugs (furszy)
b516e36 depends: update Qt 5.9 source url (Kittywhiskers Van Gogh)
18f4b4a BugFix: fix not updating GUI balance race condition. (furszy)
2c923ed scripted-diff: Replace 'NULL' with 'nullptr' in guiutil.cpp (random-zebra)
7b8b23a Fix memory leaks in qt/guiutil.cpp (Dan Raviv)
cbd5c78 Add search option to My Addresses list in receive widget (Volodia)
0dcbea2 [build] depends macOS: point --sysroot to SDK (Sjors Provoost)
3b542fc [Doc] remove old gitian keys. (furszy)
0f099e8 [GUI] Generate FAQ answer content programmatically (Fuzzbawls)
8483861 qt:Show the entire Window when double clicking on taskbar (ken2812221)
998c7e8 [GUI] fix QT 5.15 `currentIndexChanged(QString)` deprecated method call. (furszy)

Pull request description:

  List of straightforward PRs back ported from v6.0 into the v5.2 branch (ordered by merge date).

  * #2259.
  * #2260.
  * #2348
  * #2350
  * #2353
  * #2305
  * #2374
  * #2379
  * #2384
  * #2377
  * #2395
  * #2401
  * #2413

ACKs for top commit:
  random-zebra:
    utACK 3344fb3
  Fuzzbawls:
    utACK 3344fb3

Tree-SHA512: 4317e83d4c1228b8ae20dc1bc5c8e43ac87598d4d9d9244fdd032f2a0c5eccd1a7ed27bc29094c7411dd653b187c728ab31d732ea686abda15228920a390e4e1
  • Loading branch information
furszy committed Jun 19, 2021
2 parents e92cc73 + 3344fb3 commit 249e834
Show file tree
Hide file tree
Showing 20 changed files with 256 additions and 161 deletions.
15 changes: 2 additions & 13 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ jobs:
matrix:
config:
- name: Linux
os: ubuntu-16.04
packages: python3-zmq qtbase5-dev qttools5-dev-tools libqt5svg5-dev libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev libgmp-dev libsodium-dev cargo
os: ubuntu-18.04
packages: python3-zmq qttools5-dev qtbase5-dev qttools5-dev-tools libqt5svg5-dev libqt5charts5-dev libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev libgmp-dev libsodium-dev cargo
cc: gcc
cxx: g++

Expand Down Expand Up @@ -295,17 +295,6 @@ jobs:
test_runner_extra: "--legacywallet"
BITCOIN_CONFIG: "--enable-zmq --with-gui=no --enable-glibc-back-compat --enable-reduce-exports --disable-online-rust"

- name: x86_64 Linux [GOAL:install] [xenial] [no depends only system libs]
os: ubuntu-16.04
host: x86_64-unknown-linux-gnu
apt_get: python3-zmq qtbase5-dev qttools5-dev-tools libqt5svg5-dev libssl-dev libevent-dev bsdmainutils libboost-system-dev libboost-filesystem-dev libboost-chrono-dev libboost-program-options-dev libboost-test-dev libboost-thread-dev libdb5.3++-dev libminiupnpc-dev libzmq3-dev libprotobuf-dev protobuf-compiler libqrencode-dev libgmp-dev libsodium-dev cargo
unit_tests: true
functional_tests: true
no_depends: 1
goal: install
test_runner_extra: "--all --exclude feature_dbcrash"
BITCOIN_CONFIG: "--enable-zmq --with-incompatible-bdb --with-gui=qt5 CPPFLAGS=-DDEBUG_LOCKORDER --disable-hardening --disable-asm"

- name: x86_64 Linux [GOAL:install] [bionic] [no depends only system libs]
os: ubuntu-18.04
host: x86_64-unknown-linux-gnu
Expand Down
2 changes: 0 additions & 2 deletions contrib/gitian-keys/keys.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
03EFB47EAC111D0A669597D05DD23CCC686AA623 Furszy
6F993B250557E7B016ADE5713BDCDA2D87A881D9 Fuzzbawls
6BEEB3F378159D69F1F1FB6CFB3268F6FD9FC6CC Mrs-X
95FF81F36CC366492D67D9887E07C315C3BD9E93 Warrows
F18C56783E9C084826E17A203B40825F3926AFC4 random-zebra
4 changes: 2 additions & 2 deletions depends/builders/darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ build_darwin_SHA256SUM=shasum -a 256
build_darwin_DOWNLOAD=curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o

#darwin host on darwin builder. overrides darwin host preferences.
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION)
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION) --sysroot $(shell xcrun --show-sdk-path)
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++ --sysroot $(shell xcrun --show-sdk-path)
darwin_AR:=$(shell xcrun -f ar)
darwin_RANLIB:=$(shell xcrun -f ranlib)
darwin_STRIP:=$(shell xcrun -f strip)
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/qt.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PACKAGE=qt
$(package)_version=5.9.7
$(package)_download_path=https://download.qt.io/official_releases/qt/5.9/$($(package)_version)/submodules
$(package)_download_path=https://download.qt.io/archive/qt/5.9/$($(package)_version)/submodules
$(package)_suffix=opensource-src-$($(package)_version).tar.xz
$(package)_file_name=qtbase-$($(package)_suffix)
$(package)_sha256_hash=36dd9574f006eaa1e5af780e4b33d11fe39d09fd7c12f3b9d83294174bd28f00
Expand Down
6 changes: 2 additions & 4 deletions src/budget/budgetmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,16 +889,14 @@ void CBudgetManager::NewBlock(int height)
}
}
{
TRY_LOCK(cs_proposals, fBudgetNewBlock);
if (!fBudgetNewBlock) return;
LOCK(cs_proposals);
LogPrint(BCLog::MNBUDGET,"%s: mapProposals cleanup - size: %d\n", __func__, mapProposals.size());
for (auto& it: mapProposals) {
RemoveStaleVotesOnProposal(&it.second);
}
}
{
TRY_LOCK(cs_budgets, fBudgetNewBlock);
if (!fBudgetNewBlock) return;
LOCK(cs_budgets);
LogPrint(BCLog::MNBUDGET,"%s: mapFinalizedBudgets cleanup - size: %d\n", __func__, mapFinalizedBudgets.size());
for (auto& it: mapFinalizedBudgets) {
RemoveStaleVotesOnFinalBudget(&it.second);
Expand Down
49 changes: 34 additions & 15 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -650,7 +650,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
fs::remove(StartupShortcutPath());

if (fAutoStart) {
CoInitialize(NULL);
CoInitialize(nullptr);

// Get a pointer to the IShellLink interface.
IShellLinkW* psl = nullptr;
Expand Down Expand Up @@ -772,57 +772,76 @@ bool SetStartOnSystemStartup(bool fAutoStart)
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl);
LSSharedFileListItemRef findStartupItemInList(LSSharedFileListRef list, CFURLRef findUrl)
{
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, nullptr);
if (listSnapshot == nullptr) {
return nullptr;
}

// loop through the list of startup items and try to find the pivx app
CFArrayRef listSnapshot = LSSharedFileListCopySnapshot(list, NULL);
for (int i = 0; i < CFArrayGetCount(listSnapshot); i++) {
LSSharedFileListItemRef item = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(listSnapshot, i);
UInt32 resolutionFlags = kLSSharedFileListNoUserInteraction | kLSSharedFileListDoNotMountVolumes;
CFURLRef currentItemURL = NULL;
CFURLRef currentItemURL = nullptr;

#if defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 10100
if (&LSSharedFileListItemCopyResolvedURL)
currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, NULL);
currentItemURL = LSSharedFileListItemCopyResolvedURL(item, resolutionFlags, nullptr);
#if defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 10100
else
LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, NULL);
LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, nullptr);
#endif
#else
LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, NULL);
LSSharedFileListItemResolve(item, resolutionFlags, &currentItemURL, nullptr);
#endif

if (currentItemURL && CFEqual(currentItemURL, findUrl)) {
// found
CFRelease(currentItemURL);
return item;
}
if (currentItemURL) {
if (CFEqual(currentItemURL, findUrl)) {
// found
CFRelease(listSnapshot);
CFRelease(currentItemURL);
return item;
}
CFRelease(currentItemURL);
}
}
return NULL;

CFRelease(listSnapshot);
return nullptr;
}

bool GetStartOnSystemStartup()
{
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
if (bitcoinAppUrl == nullptr) {
return false;
}

LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr);
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);

CFRelease(bitcoinAppUrl);
return !!foundItem; // return boolified object
}

bool SetStartOnSystemStartup(bool fAutoStart)
{
CFURLRef bitcoinAppUrl = CFBundleCopyBundleURL(CFBundleGetMainBundle());
LSSharedFileListRef loginItems = LSSharedFileListCreate(NULL, kLSSharedFileListSessionLoginItems, NULL);
if (bitcoinAppUrl == nullptr) {
return false;
}

LSSharedFileListRef loginItems = LSSharedFileListCreate(nullptr, kLSSharedFileListSessionLoginItems, nullptr);
LSSharedFileListItemRef foundItem = findStartupItemInList(loginItems, bitcoinAppUrl);

if (fAutoStart && !foundItem) {
// add pivx app to startup item list
LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, NULL, NULL, bitcoinAppUrl, NULL, NULL);
LSSharedFileListInsertItemURL(loginItems, kLSSharedFileListItemBeforeFirst, nullptr, nullptr, bitcoinAppUrl, nullptr, nullptr);
} else if (!fAutoStart && foundItem) {
// remove item
LSSharedFileListItemRemove(loginItems, foundItem);
}

CFRelease(bitcoinAppUrl);
return true;
}
#pragma GCC diagnostic pop
Expand Down
12 changes: 6 additions & 6 deletions src/qt/pivx/dashboardwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,9 @@ DashboardWidget::DashboardWidget(PIVXGUI* parent) :
setCssProperty({ui->comboBoxMonths, ui->comboBoxYears}, "btn-combo-chart-selected");

ui->comboBoxMonths->setView(new QListView());
ui->comboBoxMonths->setStyleSheet("selection-background-color:transparent; selection-color:transparent;");
ui->comboBoxMonths->setStyleSheet("selection-background-color:transparent;");
ui->comboBoxYears->setView(new QListView());
ui->comboBoxYears->setStyleSheet("selection-background-color:transparent; selection-color:transparent;");
ui->comboBoxYears->setStyleSheet("selection-background-color:transparent;");
ui->pushButtonYear->setChecked(true);

setCssProperty(ui->pushButtonChartArrow, "btn-chart-arrow");
Expand All @@ -80,7 +80,7 @@ DashboardWidget::DashboardWidget(PIVXGUI* parent) :
#ifdef USE_QTCHARTS
setCssProperty(ui->right, "container-right");
ui->right->setContentsMargins(20,20,20,0);
connect(ui->comboBoxYears, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
connect(ui->comboBoxYears, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
this, &DashboardWidget::onChartYearChanged);
#else
// hide charts container if not USE_QTCHARTS
Expand All @@ -91,14 +91,14 @@ DashboardWidget::DashboardWidget(PIVXGUI* parent) :
SortEdit* lineEdit = new SortEdit(ui->comboBoxSort);
connect(lineEdit, &SortEdit::Mouse_Pressed, [this](){ui->comboBoxSort->showPopup();});
setSortTx(ui->comboBoxSort, lineEdit);
connect(ui->comboBoxSort, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged), this, &DashboardWidget::onSortChanged);
connect(ui->comboBoxSort, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged), this, &DashboardWidget::onSortChanged);

// Sort type
SortEdit* lineEditType = new SortEdit(ui->comboBoxSortType);
connect(lineEditType, &SortEdit::Mouse_Pressed, [this](){ui->comboBoxSortType->showPopup();});
setSortTxTypeFilter(ui->comboBoxSortType, lineEditType);
ui->comboBoxSortType->setCurrentIndex(0);
connect(ui->comboBoxSortType, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
connect(ui->comboBoxSortType, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
this, &DashboardWidget::onSortTypeChanged);

// Transactions
Expand Down Expand Up @@ -397,7 +397,7 @@ void DashboardWidget::loadChart()
yearFilter = currentDate.year();
for (int i = 1; i < 13; ++i) ui->comboBoxMonths->addItem(QString(monthsNames[i-1]), QVariant(i));
ui->comboBoxMonths->setCurrentIndex(monthFilter - 1);
connect(ui->comboBoxMonths, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentIndexChanged),
connect(ui->comboBoxMonths, static_cast<void (QComboBox::*)(const QString&)>(&QComboBox::currentTextChanged),
this, &DashboardWidget::onChartMonthChanged);
connect(ui->pushButtonChartArrow, &QPushButton::clicked, [this](){ onChartArrowClicked(true); });
connect(ui->pushButtonChartRight, &QPushButton::clicked, [this](){ onChartArrowClicked(false); });
Expand Down
36 changes: 35 additions & 1 deletion src/qt/pivx/forms/receivewidget.ui
Original file line number Diff line number Diff line change
Expand Up @@ -510,14 +510,45 @@
<property name="bottomMargin">
<number>5</number>
</property>
<item>
<widget class="QLineEdit" name="lineEditFilter">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="minimumSize">
<size>
<width>0</width>
<height>0</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::DefaultContextMenu</enum>
</property>
<property name="acceptDrops">
<bool>false</bool>
</property>
<property name="maxLength">
<number>40</number>
</property>
<property name="placeholderText">
<string>Filter</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_3">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Preferred</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<width>20</width>
<height>20</height>
</size>
</property>
Expand Down Expand Up @@ -556,6 +587,9 @@
</widget>
</item>
</layout>
<zorder>comboBoxSort</zorder>
<zorder>comboBoxSortOrder</zorder>
<zorder>lineEditFilter</zorder>
</widget>
</item>
<item>
Expand Down
9 changes: 8 additions & 1 deletion src/qt/pivx/pivxgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,9 @@ void PIVXGUI::changeEvent(QEvent* e)
if (!(wsevt->oldState() & Qt::WindowMinimized) && isMinimized()) {
QTimer::singleShot(0, this, &PIVXGUI::hide);
e->ignore();
} else if ((wsevt->oldState() & Qt::WindowMinimized) && !isMinimized()) {
QTimer::singleShot(0, this, &PIVXGUI::show);
e->ignore();
}
}
}
Expand All @@ -349,10 +352,14 @@ void PIVXGUI::closeEvent(QCloseEvent* event)
if (clientModel && clientModel->getOptionsModel()) {
if (!clientModel->getOptionsModel()->getMinimizeOnClose()) {
QApplication::quit();
} else {
QMainWindow::showMinimized();
event->ignore();
}
}
#endif
#else
QMainWindow::closeEvent(event);
#endif
}


Expand Down
33 changes: 11 additions & 22 deletions src/qt/pivx/qtutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <QFile>
#include <QGraphicsDropShadowEffect>
#include <QListView>
#include <QStyle>

Qt::Modifier SHORT_KEY
#ifdef Q_OS_MAC
Expand Down Expand Up @@ -100,7 +99,7 @@ bool openDialogWithOpaqueBackgroundFullScreen(QDialog* widget, PIVXGUI* gui)
return res;
}

QPixmap encodeToQr(QString str, QString& errorStr, QColor qrColor)
QPixmap encodeToQr(const QString& str, QString& errorStr, const QColor& qrColor)
{
if (!str.isEmpty()) {
// limit URI length
Expand Down Expand Up @@ -230,35 +229,25 @@ void updateStyle(QWidget* widget)

QColor getRowColor(bool isLightTheme, bool isHovered, bool isSelected)
{
if (isLightTheme) {
if (isSelected) {
return QColor("#25b088ff");
} else if (isHovered) {
return QColor("#25bababa");
} else {
return QColor("#ffffff");
}
if (isSelected) {
return QColor("#25b088ff");
} else if (isHovered) {
return QColor("#25bababa");
} else {
if (isSelected) {
return QColor("#25b088ff");
} else if (isHovered) {
return QColor("#25bababa");
} else {
return QColor("#0f0b16");
}
return isLightTheme ? QColor("#ffffff") : QColor("#0f0b16");
}
}

void initComboBox(QComboBox* combo, QLineEdit* lineEdit, QString cssClass)
{
setCssProperty(combo, cssClass);
setCssProperty(combo, std::move(cssClass));
combo->setEditable(true);
if (lineEdit) {
lineEdit->setReadOnly(true);
lineEdit->setAlignment(Qt::AlignRight);
combo->setLineEdit(lineEdit);
}
combo->setStyleSheet("selection-background-color:transparent; selection-color:transparent;");
combo->setStyleSheet("selection-background-color:transparent;");
combo->setView(new QListView());
}

Expand All @@ -284,7 +273,7 @@ void initCssEditLine(QLineEdit* edit, bool isDialog)
else
setCssEditLine(edit, true, false);
setShadow(edit);
edit->setAttribute(Qt::WA_MacShowFocusRect, 0);
edit->setAttribute(Qt::WA_MacShowFocusRect, false);
}

void setCssEditLine(QLineEdit* edit, bool isValid, bool forceUpdate)
Expand Down Expand Up @@ -339,14 +328,14 @@ void setCssSubtitleScreen(QWidget* wid)
setCssProperty(wid, "text-subtitle", false);
}

void setCssProperty(std::initializer_list<QWidget*> args, QString value)
void setCssProperty(std::initializer_list<QWidget*> args, const QString& value)
{
for (QWidget* w : args) {
setCssProperty(w, value);
}
}

void setCssProperty(QWidget* wid, QString value, bool forceUpdate)
void setCssProperty(QWidget* wid, const QString& value, bool forceUpdate)
{
wid->setProperty("cssClass", value);
forceUpdateStyle(wid, forceUpdate);
Expand Down
Loading

0 comments on commit 249e834

Please sign in to comment.