Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test qt patch stability #3

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 34 additions & 0 deletions depends/patches/qt/fix_android_get_drawable.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Android 13: Fix warnings on starting an application

On Android 13, currently in beta, android triggers a warning because it
is using a deprecated getDrawable function.
The patch changes it to use the non-deprecated alternative as suggested
in the warning.

Fixes: QTBUG-103568

Upstream commits:
- Qt 5.15.11 backport: unavailable
- Qt 6.5: e07fea6fb405c6e9affe6e377ad99a98a740c5be


--- old/qtbase/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
+++ new/qtbase/src/android/jar/src/org/qtproject/qt5/android/QtActivityDelegate.java
@@ -787,7 +787,7 @@
m_splashScreenSticky = info.metaData.containsKey("android.app.splash_screen_sticky") && info.metaData.getBoolean("android.app.splash_screen_sticky");
int id = info.metaData.getInt(splashScreenKey);
m_splashScreen = new ImageView(m_activity);
- m_splashScreen.setImageDrawable(m_activity.getResources().getDrawable(id));
+ m_splashScreen.setImageDrawable(m_activity.getResources().getDrawable(id, m_activity.getTheme()));
m_splashScreen.setScaleType(ImageView.ScaleType.FIT_XY);
m_splashScreen.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT));
m_layout.addView(m_splashScreen);
@@ -1209,7 +1209,7 @@
if (attr.type >= TypedValue.TYPE_FIRST_COLOR_INT && attr.type <= TypedValue.TYPE_LAST_COLOR_INT) {
m_activity.getWindow().setBackgroundDrawable(new ColorDrawable(attr.data));
} else {
- m_activity.getWindow().setBackgroundDrawable(m_activity.getResources().getDrawable(attr.resourceId));
+ m_activity.getWindow().setBackgroundDrawable(m_activity.getResources().getDrawable(attr.resourceId, m_activity.getTheme()));
}
if (m_dummyView != null) {
m_layout.removeView(m_dummyView);
1 change: 1 addition & 0 deletions src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,7 @@ bitcoin_qt_apk: FORCE
cp $(dir $(lastword $(CC)))../sysroot/usr/lib/$(host_alias)/libc++_shared.so $(APK_LIB_DIR)
tar xf $(QT_BASE_PATH) -C qt/android/src/ $(QT_BASE_TLD)src/android/jar/src --strip-components=5
tar xf $(QT_BASE_PATH) -C qt/android/src/ $(QT_BASE_TLD)src/android/java/src --strip-components=5
patch -i ../depends/patches/qt/fix_android_get_drawable.patch qt/android/src/org/qtproject/qt5/android/QtActivityDelegate.java
cp qt/bitcoin-qt $(APK_LIB_DIR)/libbitcoin-qt_$(ANDROID_ARCH).so
cd qt/android && gradle wrapper --gradle-version=6.6.1
cd qt/android && ./gradlew build
Expand Down
44 changes: 29 additions & 15 deletions src/qml/components/BlockClock.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,11 @@ import "../controls"

Item {
id: root
property real parentWidth: 600
property real parentHeight: 600

implicitWidth: 200
implicitHeight: 200
width: dial.width
height: dial.height + networkIndicator.height + networkIndicator.anchors.topMargin

property alias header: mainText.text
property alias headerSize: mainText.font.pixelSize
Expand All @@ -28,7 +30,10 @@ Item {

BlockClockDial {
id: dial
anchors.fill: parent
anchors.horizontalCenter: root.horizontalCenter
width: Math.min((root.parentWidth / 2), (root.parentHeight / 2))
height: dial.width
penWidth: dial.width / 50
timeRatioList: chainModel.timeRatioList
verificationProgress: nodeModel.verificationProgress
paused: root.paused
Expand Down Expand Up @@ -56,8 +61,8 @@ Item {
background: null
icon.source: "image://images/bitcoin-circle"
icon.color: Theme.color.neutral9
icon.width: 40
icon.height: 40
icon.width: Math.max(dial.width / 5, 1)
icon.height: Math.max(dial.width / 5, 1)
anchors.bottom: mainText.top
anchors.horizontalCenter: root.horizontalCenter

Expand All @@ -68,10 +73,10 @@ Item {

Label {
id: mainText
anchors.centerIn: parent
anchors.centerIn: dial
font.family: "Inter"
font.styleName: "Semi Bold"
font.pixelSize: 32
font.pixelSize: dial.width * (4/25)
color: Theme.color.neutral9

Behavior on color {
Expand All @@ -85,7 +90,7 @@ Item {
anchors.horizontalCenter: root.horizontalCenter
font.family: "Inter"
font.styleName: "Semi Bold"
font.pixelSize: 18
font.pixelSize: dial.width * (9/100)
color: Theme.color.neutral4

Behavior on color {
Expand All @@ -95,13 +100,22 @@ Item {

PeersIndicator {
anchors.top: subText.bottom
anchors.topMargin: 20
anchors.topMargin: dial.width / 10
anchors.horizontalCenter: root.horizontalCenter
numOutboundPeers: nodeModel.numOutboundPeers
maxNumOutboundPeers: nodeModel.maxNumOutboundPeers
indicatorDimensions: dial.width * (3/200)
indicatorSpacing: dial.width / 40
paused: root.paused
}

NetworkIndicator {
id: networkIndicator
anchors.top: dial.bottom
anchors.topMargin: networkIndicator.visible ? 30 : 0
anchors.horizontalCenter: root.horizontalCenter
}

MouseArea {
anchors.fill: dial
cursorShape: Qt.PointingHandCursor
Expand Down Expand Up @@ -138,16 +152,16 @@ Item {
PropertyChanges {
target: root
header: "Paused"
headerSize: 24
headerSize: dial.width * (3/25)
subText: "Tap to resume"
}
PropertyChanges {
target: bitcoinIcon
anchors.bottomMargin: 5
anchors.bottomMargin: dial.width / 40
}
PropertyChanges {
target: subText
anchors.topMargin: 4
anchors.topMargin: dial.width / 50
}
},

Expand All @@ -156,16 +170,16 @@ Item {
PropertyChanges {
target: root
header: "Connecting"
headerSize: 24
headerSize: dial.width * (3/25)
subText: "Please wait"
}
PropertyChanges {
target: bitcoinIcon
anchors.bottomMargin: 5
anchors.bottomMargin: dial.width / 40
}
PropertyChanges {
target: subText
anchors.topMargin: 4
anchors.topMargin: dial.width / 50
}
}
]
Expand Down
13 changes: 8 additions & 5 deletions src/qml/components/PeersIndicator.qml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@
// file COPYING or http://www.opensource.org/licenses/mit-license.php.

import QtQuick 2.15
import QtQuick.Layouts 1.15
import "../controls"

RowLayout {
Row {
id: root
required property int numOutboundPeers
required property int maxNumOutboundPeers
required property bool paused
property int size: 5
property real indicatorDimensions: 3
property real indicatorSpacing: 5

spacing: 5
height: root.indicatorDimensions

spacing: root.indicatorSpacing
Repeater {
model: 5
Rectangle {
width: 3
height: 3
width: root.indicatorDimensions
height: root.indicatorDimensions
radius: width / 2
color: Theme.color.neutral9
opacity: (index === 0 && root.numOutboundPeers > 0) || (index + 1 <= root.size * root.numOutboundPeers / root.maxNumOutboundPeers) ? 0.95 : 0.45
Expand Down
22 changes: 15 additions & 7 deletions src/qml/components/blockclockdial.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@
#include <QConicalGradient>
#include <QPen>
#include <QtMath>
#include <QtGlobal>

BlockClockDial::BlockClockDial(QQuickItem *parent)
: QQuickPaintedItem(parent)
, m_time_ratio_list{0.0}
, m_pen_width{4}
, m_background_color{QColor("#2D2D2D")}
, m_confirmation_colors{QList<QColor>{}}
, m_time_tick_color{QColor("#000000")}
Expand Down Expand Up @@ -132,6 +134,12 @@ void BlockClockDial::setPaused(bool paused)
}
}

void BlockClockDial::setPenWidth(qreal width)
{
m_pen_width = width;
update();
}

void BlockClockDial::setBackgroundColor(QColor color)
{
m_background_color = color;
Expand Down Expand Up @@ -183,7 +191,7 @@ void BlockClockDial::paintBlocks(QPainter * painter)
}

QPen pen(m_confirmation_colors[5]);
pen.setWidth(4);
pen.setWidthF(m_pen_width);
pen.setCapStyle(Qt::FlatCap);
const QRectF bounds = getBoundsForPen(pen);
painter->setPen(pen);
Expand All @@ -196,7 +204,7 @@ void BlockClockDial::paintBlocks(QPainter * painter)
for (int i = 1; i < numberOfBlocks; i++) {
if (numberOfBlocks - i <= 6) {
QPen pen(m_confirmation_colors[numberOfBlocks - i - 1]);
pen.setWidth(4);
pen.setWidthF(m_pen_width);
pen.setCapStyle(Qt::FlatCap);
painter->setPen(pen);
}
Expand Down Expand Up @@ -227,7 +235,7 @@ void BlockClockDial::paintBlocks(QPainter * painter)
void BlockClockDial::paintProgress(QPainter * painter)
{
QPen pen(m_confirmation_colors[5]);
pen.setWidthF(4);
pen.setWidthF(m_pen_width);
pen.setCapStyle(Qt::RoundCap);
const QRectF bounds = getBoundsForPen(pen);
painter->setPen(pen);
Expand All @@ -250,7 +258,7 @@ void BlockClockDial::paintProgress(QPainter * painter)
void BlockClockDial::paintConnectingAnimation(QPainter * painter)
{
QPen pen;
pen.setWidthF(4);
pen.setWidthF(m_pen_width);
setupConnectingGradient(pen);
pen.setBrush(QBrush(m_connecting_gradient));
pen.setCapStyle(Qt::RoundCap);
Expand All @@ -267,7 +275,7 @@ void BlockClockDial::paintConnectingAnimation(QPainter * painter)
void BlockClockDial::paintBackground(QPainter * painter)
{
QPen pen(m_background_color);
pen.setWidthF(4);
pen.setWidthF(m_pen_width);
const QRectF bounds = getBoundsForPen(pen);
painter->setPen(pen);

Expand All @@ -283,12 +291,12 @@ double BlockClockDial::degreesPerPixel()
void BlockClockDial::paintTimeTicks(QPainter * painter)
{
QPen pen(m_time_tick_color);
pen.setWidthF(4);
pen.setWidthF(m_pen_width);
// Calculate bound based on width of default pen
const QRectF bounds = getBoundsForPen(pen);

QPen time_tick_pen = QPen(m_time_tick_color);
time_tick_pen.setWidth(2);
time_tick_pen.setWidthF(m_pen_width / 2);
time_tick_pen.setCapStyle(Qt::RoundCap);
painter->setPen(time_tick_pen);
for (double angle = 0; angle < 360; angle += 30) {
Expand Down
5 changes: 5 additions & 0 deletions src/qml/components/blockclockdial.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include <QConicalGradient>
#include <QPainter>
#include <QTimer>
#include <QtGlobal>

class BlockClockDial : public QQuickPaintedItem
{
Expand All @@ -18,6 +19,7 @@ class BlockClockDial : public QQuickPaintedItem
Q_PROPERTY(bool connected READ connected WRITE setConnected)
Q_PROPERTY(bool synced READ synced WRITE setSynced)
Q_PROPERTY(bool paused READ paused WRITE setPaused)
Q_PROPERTY(qreal penWidth READ penWidth WRITE setPenWidth)
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
Q_PROPERTY(QList<QColor> confirmationColors READ confirmationColors WRITE setConfirmationColors )
Q_PROPERTY(QColor timeTickColor READ timeTickColor WRITE setTimeTickColor)
Expand All @@ -31,6 +33,7 @@ class BlockClockDial : public QQuickPaintedItem
bool connected() const { return m_is_connected; };
bool synced() const { return m_is_synced; };
bool paused() const { return m_is_paused; };
qreal penWidth() const { return m_pen_width; };
QColor backgroundColor() const { return m_background_color; };
QList<QColor> confirmationColors() const { return m_confirmation_colors; };
QColor timeTickColor() const { return m_time_tick_color; };
Expand All @@ -41,6 +44,7 @@ public Q_SLOTS:
void setConnected(bool connected);
void setSynced(bool synced);
void setPaused(bool paused);
void setPenWidth(qreal width);
void setBackgroundColor(QColor color);
void setConfirmationColors(QList<QColor> colorList);
void setTimeTickColor(QColor color);
Expand All @@ -63,6 +67,7 @@ public Q_SLOTS:
bool m_is_connected;
bool m_is_synced;
bool m_is_paused;
qreal m_pen_width;
QColor m_background_color;
QConicalGradient m_connecting_gradient;
qreal m_connecting_start_angle = 90;
Expand Down
11 changes: 3 additions & 8 deletions src/qml/pages/node/NodeRunner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,9 @@ Page {

Component.onCompleted: nodeModel.startNodeInitializionThread();

ColumnLayout {
spacing: 30
BlockClock {
parentWidth: parent.width - 40
parentHeight: parent.height
anchors.centerIn: parent
BlockClock {
Layout.alignment: Qt.AlignCenter
}
NetworkIndicator {
Layout.alignment: Qt.AlignCenter
}
}
}
Binary file modified src/qml/res/icons/bitcoin-circle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/qt/android/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>

<meta-data android:name="android.app.arguments" android:value="-signet"/>
<meta-data android:name="android.app.arguments" android:value=""/>
<meta-data android:name="android.app.lib_name" android:value="bitcoin-qt"/>
<meta-data android:name="android.app.repository" android:value="default"/>
<meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/>
Expand Down