Skip to content

Commit 49703f6

Browse files
committed
topbar integrated
1 parent 9e40ba7 commit 49703f6

31 files changed

+2910
-278
lines changed

src/Makefile.qt.include

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,12 @@ QT_FORMS_UI = \
6666
qt/forms/signverifymessagedialog.ui \
6767
qt/forms/transactiondescdialog.ui \
6868
qt/forms/zpivcontroldialog.ui \
69-
qt/pivx/forms/navmenuwidget.ui
69+
qt/pivx/forms/navmenuwidget.ui \
70+
qt/pivx/forms/lockunlock.ui \
71+
qt/pivx/forms/expandablebutton.ui \
72+
qt/pivx/forms/receivedialog.ui \
73+
qt/pivx/forms/walletpassworddialog.ui \
74+
qt/pivx/forms/topbar.ui
7075

7176
QT_MOC_CPP = \
7277
qt/moc_addressbookpage.cpp \
@@ -123,7 +128,12 @@ QT_MOC_CPP = \
123128
qt/moc_walletmodel.cpp \
124129
qt/moc_walletview.cpp \
125130
qt/moc_zpivcontroldialog.cpp \
126-
qt/pivx/moc_navmenuwidget.cpp
131+
qt/pivx/moc_navmenuwidget.cpp \
132+
qt/pivx/moc_lockunlock.cpp \
133+
qt/pivx/moc_expandablebutton.cpp \
134+
qt/pivx/moc_receivedialog.cpp \
135+
qt/pivx/moc_walletpassworddialog.cpp \
136+
qt/pivx/moc_topbar.cpp
127137

128138
BITCOIN_MM = \
129139
qt/macdockiconhandler.mm \
@@ -207,7 +217,13 @@ BITCOIN_QT_H = \
207217
qt/walletview.h \
208218
qt/winshutdownmonitor.h \
209219
qt/zpivcontroldialog.h \
210-
qt/pivx/navmenuwidget.h
220+
qt/pivx/navmenuwidget.h \
221+
qt/pivx/lockunlock.h \
222+
qt/pivx/receivedialog.h \
223+
qt/pivx/qtutils.h \
224+
qt/pivx/expandablebutton.h \
225+
qt/pivx/walletpassworddialog.h \
226+
qt/pivx/topbar.h
211227

212228
RES_ICONS = \
213229
qt/res/icons/add.png \
@@ -485,7 +501,13 @@ BITCOIN_QT_WALLET_CPP = \
485501
qt/walletmodeltransaction.cpp \
486502
qt/walletview.cpp \
487503
qt/zpivcontroldialog.cpp \
488-
qt/pivx/navmenuwidget.cpp
504+
qt/pivx/navmenuwidget.cpp \
505+
qt/pivx/lockunlock.cpp \
506+
qt/pivx/receivedialog.cpp \
507+
qt/pivx/qtutils.cpp \
508+
qt/pivx/expandablebutton.cpp \
509+
qt/pivx/walletpassworddialog.cpp \
510+
qt/pivx/topbar.cpp
489511

490512
BITCOIN_QT_CPP = $(BITCOIN_QT_BASE_CPP)
491513
if TARGET_WINDOWS

src/qt/pivx/PIVXGUI.cpp

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ PIVXGUI::PIVXGUI(const NetworkStyle* networkStyle, QWidget* parent) :
6464
QHBoxLayout* centralWidgetLayouot = new QHBoxLayout();
6565
centralWidget->setLayout(centralWidgetLayouot);
6666
centralWidgetLayouot->setContentsMargins(0,0,0,0);
67+
centralWidgetLayouot->setSpacing(0);
6768

6869
centralWidget->setProperty("cssClass", "container");
6970

@@ -75,6 +76,7 @@ PIVXGUI::PIVXGUI(const NetworkStyle* networkStyle, QWidget* parent) :
7576
this->setContentsMargins(0,0,0,0);
7677

7778
QFrame *container = new QFrame(centralWidget);
79+
container->setContentsMargins(0,0,0,0);
7880
centralWidgetLayouot->addWidget(container);
7981

8082
// Then topbar + the stackedWidget
@@ -83,12 +85,16 @@ PIVXGUI::PIVXGUI(const NetworkStyle* networkStyle, QWidget* parent) :
8385
container->setLayout(baseScreensContainer);
8486

8587
// Insert the topbar
86-
//topbar = new TopBar(this);
87-
//baseScreensContainer->addWidget(topbar);
88+
topBar = new TopBar(this);
89+
topBar->setContentsMargins(0,0,0,0);
90+
baseScreensContainer->addWidget(topBar);
8891

8992
// Now stacked widget
90-
//stackedContainer = new QStackedWidget(this);
91-
//baseScreensContainer->addWidget(stackedContainer);
93+
stackedContainer = new QStackedWidget(this);
94+
QSizePolicy sizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
95+
stackedContainer->setSizePolicy(sizePolicy);
96+
stackedContainer->setContentsMargins(0,0,0,0);
97+
baseScreensContainer->addWidget(stackedContainer);
9298

9399
} else
94100
#endif

src/qt/pivx/PIVXGUI.h

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
#endif
1111

1212
#include <QMainWindow>
13+
#include <QStackedWidget>
1314

1415
#include "qt/pivx/navmenuwidget.h"
16+
#include "qt/pivx/topbar.h"
1517

1618

1719
class ClientModel;
@@ -38,6 +40,14 @@ class PIVXGUI : public QMainWindow
3840
*/
3941
void setClientModel(ClientModel* clientModel);
4042

43+
void showHide(bool show){
44+
// TODO: Implement me.
45+
}
46+
// TODO: Change me..
47+
int getNavWidth(){
48+
return 100;
49+
}
50+
4151
#ifdef ENABLE_WALLET
4252
/** Set the wallet model.
4353
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
@@ -66,6 +76,8 @@ class PIVXGUI : public QMainWindow
6676

6777
// Frame
6878
NavMenuWidget *navMenu;
79+
TopBar *topBar;
80+
QStackedWidget *stackedContainer;
6981

7082
signals:
7183
/** Signal raised when a URI was entered or dragged to the GUI */

src/qt/pivx/expandablebutton.cpp

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
#include "qt/pivx/expandablebutton.h"
2+
#include "qt/pivx/forms/ui_expandablebutton.h"
3+
#include <QParallelAnimationGroup>
4+
#include <QPropertyAnimation>
5+
#include <QStyle>
6+
#include <iostream>
7+
8+
ExpandableButton::ExpandableButton(QWidget *parent) :
9+
QWidget(parent),
10+
ui(new Ui::ExpandableButton),
11+
isAnimating(false)
12+
{
13+
ui->setupUi(this);
14+
15+
this->setStyleSheet(parent->styleSheet());
16+
ui->pushButton->setCheckable(true);
17+
this->layout()->setSizeConstraint(QLayout::SetFixedSize);
18+
19+
connect(ui->pushButton, SIGNAL(clicked()), this, SLOT(mousePressEvent()));
20+
}
21+
22+
void ExpandableButton::setButtonClassStyle(const char *name, const QVariant &value, bool forceUpdate){
23+
ui->pushButton->setProperty(name, value);
24+
if(forceUpdate){
25+
ui->pushButton->style()->unpolish(ui->pushButton);
26+
ui->pushButton->style()->polish(ui->pushButton);
27+
ui->pushButton->update();
28+
}
29+
}
30+
31+
void ExpandableButton::setButtonText(const QString _text){
32+
this->text = _text;
33+
}
34+
35+
void ExpandableButton::setText2(QString text2)
36+
{
37+
this->text = text2;
38+
ui->pushButton->setText(text2);
39+
}
40+
41+
ExpandableButton::~ExpandableButton()
42+
{
43+
delete ui;
44+
}
45+
46+
bool ExpandableButton::isChecked(){
47+
return ui->pushButton->isChecked();
48+
}
49+
50+
void ExpandableButton::setChecked(bool check){
51+
ui->pushButton->setChecked(check);
52+
}
53+
54+
void ExpandableButton::setSmall()
55+
{
56+
ui->pushButton->setText("");
57+
this->setMaximumWidth(36);
58+
update();
59+
}
60+
61+
void ExpandableButton::enterEvent(QEvent *) {
62+
if(!this->isAnimating){
63+
this->isAnimating = true;
64+
this->setMaximumWidth(100);
65+
66+
// animation = new QPropertyAnimation(this, "maximumWidth");
67+
// animation->setDuration(3000);
68+
// animation->setStartValue(36);
69+
// animation->setEndValue(100);
70+
71+
// QPropertyAnimation *animation2 = new QPropertyAnimation(this, "text2");
72+
// animation2->setDuration(2000);
73+
// animation2->setStartValue("Wallet Unlocked");
74+
// animation2->setEndValue("Wallet Unlocked");
75+
76+
// QParallelAnimationGroup *group = new QParallelAnimationGroup;
77+
// group->addAnimation(animation);
78+
// group->addAnimation(animation2);
79+
80+
// group->start(QAbstractAnimation::DeleteWhenStopped);
81+
82+
ui->pushButton->setText(text);
83+
//animation->start(QAbstractAnimation::DeleteWhenStopped);
84+
this->isAnimating = false;
85+
emit Mouse_Hover();
86+
}
87+
update();
88+
}
89+
90+
void ExpandableButton::leaveEvent(QEvent *) {
91+
// if(animation){
92+
// animation->stop();
93+
// animation = nullptr;
94+
// }
95+
96+
if(!keepExpanded){
97+
this->setSmall();
98+
}
99+
emit Mouse_HoverLeave();
100+
}
101+
102+
void ExpandableButton::mousePressEvent(){
103+
emit Mouse_Pressed();
104+
}
105+
106+
void ExpandableButton::mousePressEvent(QMouseEvent *ev)
107+
{
108+
emit Mouse_Pressed();
109+
}
110+
111+
void ExpandableButton::on_pushButton_clicked(bool checked)
112+
{
113+
// TODO: Add callback event
114+
}

src/qt/pivx/expandablebutton.h

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
#ifndef EXPANDABLEBUTTON2_H
2+
#define EXPANDABLEBUTTON2_H
3+
4+
#include <QWidget>
5+
#include <QEvent>
6+
#include <QString>
7+
#include <iostream>
8+
9+
#include <QPropertyAnimation>
10+
#include <atomic>
11+
12+
namespace Ui {
13+
class ExpandableButton;
14+
}
15+
16+
class ExpandableButton : public QWidget
17+
{
18+
Q_OBJECT
19+
20+
public:
21+
explicit ExpandableButton(QWidget *parent = nullptr);
22+
~ExpandableButton();
23+
24+
void setButtonClassStyle(const char *name, const QVariant &value, bool forceUpdate = false);
25+
void setButtonText(const QString _text);
26+
27+
bool isChecked();
28+
void setChecked(bool check);
29+
void setKeepExpanded(bool _keepExpended){
30+
this->keepExpanded = _keepExpended;
31+
}
32+
void setSmall();
33+
signals:
34+
void Mouse_Pressed();
35+
void Mouse_Hover();
36+
void Mouse_HoverLeave();
37+
38+
public slots:
39+
void setText2(QString text2);
40+
41+
QString getText(){
42+
return this->text;
43+
}
44+
45+
protected:
46+
virtual void enterEvent(QEvent *);
47+
virtual void leaveEvent(QEvent *);
48+
49+
//virtual void mouseMoveEvent(QMouseEvent *ev);
50+
virtual void mousePressEvent(QMouseEvent *ev);
51+
52+
private slots:
53+
54+
void on_pushButton_clicked(bool checked);
55+
56+
void mousePressEvent();
57+
private:
58+
Ui::ExpandableButton *ui;
59+
QString text;
60+
std::atomic<bool> isAnimating;
61+
QPropertyAnimation *animation = nullptr;
62+
63+
bool keepExpanded = false;
64+
};
65+
66+
#endif // EXPANDABLEBUTTON2_H
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>ExpandableButton</class>
4+
<widget class="QWidget" name="ExpandableButton">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>48</width>
10+
<height>42</height>
11+
</rect>
12+
</property>
13+
<property name="sizePolicy">
14+
<sizepolicy hsizetype="Expanding" vsizetype="Expanding">
15+
<horstretch>0</horstretch>
16+
<verstretch>0</verstretch>
17+
</sizepolicy>
18+
</property>
19+
<property name="minimumSize">
20+
<size>
21+
<width>36</width>
22+
<height>0</height>
23+
</size>
24+
</property>
25+
<property name="windowTitle">
26+
<string>Form</string>
27+
</property>
28+
<layout class="QHBoxLayout" name="horizontalLayout" stretch="0">
29+
<property name="spacing">
30+
<number>0</number>
31+
</property>
32+
<property name="leftMargin">
33+
<number>0</number>
34+
</property>
35+
<property name="topMargin">
36+
<number>0</number>
37+
</property>
38+
<property name="rightMargin">
39+
<number>0</number>
40+
</property>
41+
<property name="bottomMargin">
42+
<number>0</number>
43+
</property>
44+
<item>
45+
<widget class="QPushButton" name="pushButton">
46+
<property name="minimumSize">
47+
<size>
48+
<width>36</width>
49+
<height>36</height>
50+
</size>
51+
</property>
52+
<property name="baseSize">
53+
<size>
54+
<width>36</width>
55+
<height>36</height>
56+
</size>
57+
</property>
58+
<property name="styleSheet">
59+
<string notr="true">padding-right:5px;padding-left:5px;</string>
60+
</property>
61+
<property name="text">
62+
<string/>
63+
</property>
64+
<property name="iconSize">
65+
<size>
66+
<width>32</width>
67+
<height>32</height>
68+
</size>
69+
</property>
70+
<property name="checkable">
71+
<bool>true</bool>
72+
</property>
73+
</widget>
74+
</item>
75+
</layout>
76+
</widget>
77+
<resources/>
78+
<connections/>
79+
</ui>

0 commit comments

Comments
 (0)