Skip to content

Commit dd35979

Browse files
committed
snackbar message
1 parent e8f7960 commit dd35979

File tree

4 files changed

+17
-4
lines changed

4 files changed

+17
-4
lines changed

src/qt/pivx/PIVXGUI.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ void PIVXGUI::setClientModel(ClientModel* clientModel) {
224224
}
225225

226226

227+
void PIVXGUI::messageInfo(const QString& text){
228+
if(!this->snackBar) this->snackBar = new SnackBar(this, this);
229+
this->snackBar->setText(text);
230+
this->snackBar->resize(this->width(), snackBar->height());
231+
openDialog(this->snackBar, this);
232+
}
233+
227234
/**
228235
* TODO remove QMessageBox for the snackbar..
229236
*/

src/qt/pivx/PIVXGUI.h

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "qt/pivx/receivewidget.h"
2222
#include "qt/pivx/addresseswidget.h"
2323
#include "qt/pivx/privacywidget.h"
24+
#include "qt/pivx/snackbar.h"
2425
#include "qt/pivx/settings/settingswidget.h"
2526
#include "qt/rpcconsole.h"
2627

@@ -75,7 +76,7 @@ public slots:
7576
@param[in] ret pointer to a bool that will be modified to whether Ok was clicked (modal only)
7677
*/
7778
void message(const QString& title, const QString& message, unsigned int style, bool* ret = nullptr);
78-
79+
void messageInfo(const QString& message);
7980
#ifdef ENABLE_WALLET
8081
/** Set the wallet model.
8182
The wallet model represents a bitcoin wallet, and offers access to the list of transactions, address book and sending
@@ -113,6 +114,8 @@ public slots:
113114
PrivacyWidget *privacyWidget = nullptr;
114115
SettingsWidget* settingsWidget = nullptr;
115116

117+
SnackBar *snackBar = nullptr;
118+
116119
RPCConsole* rpcConsole = nullptr;
117120

118121
//

src/qt/pivx/pwidget.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ class PWidget : public QWidget
1616
public:
1717
explicit PWidget(PIVXGUI* _window = nullptr, QWidget *parent = nullptr);
1818

19+
signals:
20+
void message(QString &message);
21+
1922
protected slots:
2023
void changeTheme(bool isLightTheme, QString &theme);
2124

src/qt/pivx/receivewidget.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -191,18 +191,18 @@ void ReceiveWidget::onLabelClicked(){
191191
) {
192192
// Show snackbar
193193
// update label status (icon color)
194-
194+
window->messageInfo(tr("Address label saved"));
195195
} else {
196196
// Show snackbar error
197+
window->messageInfo(tr("Error storing address label"));
197198
}
198199
}
199200
}
200201
}
201202

202203
void ReceiveWidget::onCopyClicked(){
203204
GUIUtil::setClipboard(GUIUtil::formatBitcoinURI(*info));
204-
// TODO: Add snackbar..
205-
//openToastDialog("Address copied", mainWindow->getGUI());
205+
window->messageInfo(tr("Address copied"));
206206
}
207207

208208

0 commit comments

Comments
 (0)