Skip to content

Commit

Permalink
Merge pull request #1035 from Necrosys/fix_issue_1016
Browse files Browse the repository at this point in the history
[GUI] Add a link to the "Looks like you are new here!" screen by a "?" icon in the navigation bar
  • Loading branch information
seanPhill authored Jun 10, 2023
2 parents ab9c6f5 + b868013 commit a8b27c6
Show file tree
Hide file tree
Showing 11 changed files with 87 additions and 8 deletions.
3 changes: 2 additions & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,8 @@ RES_ICONS = \
qt/res/icons/ic-locked.png \
qt/res/icons/ic-unlocked.png \
qt/res/icons/ic-menu.png \
qt/res/icons/verify.png
qt/res/icons/verify.png \
qt/res/icons/ic-information-white.png

BITCOIN_QT_BASE_CPP = \
qt/splashscreenveil.cpp \
Expand Down
20 changes: 20 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@ void BitcoinGUI::createActions()

tabGroup->addAction(settingsAction);

QIcon iconHelp(":/icons/ic-information-white");
helpAction = new QAction(iconHelp,tr("&Help"), this);
helpAction->setStatusTip(tr("Help"));
helpAction->setToolTip(helpAction->statusTip());
helpAction->setCheckable(true);
helpAction->setShortcut(QKeySequence(Qt::ALT + Qt::Key_7));
tabGroup->addAction(helpAction);

sendCoinsMenuAction = new QAction(platformStyle->TextColorIcon(":/icons/send"), sendCoinsAction->text(), this);
sendCoinsMenuAction->setStatusTip(sendCoinsAction->statusTip());
sendCoinsMenuAction->setToolTip(sendCoinsMenuAction->statusTip());
Expand Down Expand Up @@ -373,6 +381,8 @@ void BitcoinGUI::createActions()
connect(miningAction, SIGNAL(triggered()), this, SLOT(gotoMiningPage()));
connect(settingsAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(settingsAction, SIGNAL(triggered()), this, SLOT(gotoSettingsPage()));
connect(helpAction, SIGNAL(triggered()), this, SLOT(showNormalIfMinimized()));
connect(helpAction, SIGNAL(triggered()), this, SLOT(gotoHelpPage()));
}
#endif // ENABLE_WALLET

Expand Down Expand Up @@ -491,6 +501,8 @@ void BitcoinGUI::createToolBars()
toolbar->addAction(miningAction);
toolbar->addAction(addressesAction);
toolbar->addAction(settingsAction);
toolbar->addAction(helpAction);

overviewAction->setChecked(true);

toolbar->setIconSize(QSize(24,24));
Expand Down Expand Up @@ -843,6 +855,14 @@ void BitcoinGUI::gotoSettingsPage(){
if (walletFrame) walletFrame->gotoSettings();
}

void BitcoinGUI::gotoHelpPage(){
if(!enableWallet)
return;

helpAction->setChecked(true);
if (walletFrame) walletFrame->gotoHelpPage();
}

void BitcoinGUI::gotoSignMessageTab(QString addr)
{
if(!enableWallet)
Expand Down
3 changes: 3 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ class BitcoinGUI : public QMainWindow
QAction* settingsAction = nullptr;
QAction* settingsAction2 = nullptr;
QAction* miningAction = nullptr;
QAction* helpAction = nullptr;
//QAction* historyAction = nullptr;
QAction* quitAction = nullptr;
QAction* sendCoinsAction = nullptr;
Expand Down Expand Up @@ -296,6 +297,8 @@ private Q_SLOTS:
void gotoAddressesPage();
/** Switch to settings page */
void gotoSettingsPage();
/** Switch to help page */
void gotoHelpPage();

/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
Expand Down
45 changes: 38 additions & 7 deletions src/qt/overviewpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -513,14 +513,12 @@ void OverviewPage::setWalletModel(WalletModel *model)

interfaces::Wallet& wallet = model->wallet();

if(wallet.getWalletTxs().size() == 0 ){
// show empty view
ui->containerEmpty->setVisible(true);
ui->listTransactions->setVisible(false);
if(isNewWallet()){
showHelp();

connect(model, SIGNAL(balanceChanged(interfaces::WalletBalances)), this, SLOT(updateTxesView()));
}else{
ui->containerEmpty->setVisible(false);
hideHelp();
}

// Keep up to date with wallet
Expand All @@ -541,8 +539,7 @@ void OverviewPage::setWalletModel(WalletModel *model)

void OverviewPage::updateTxesView(){
if(ui->containerEmpty->isVisible()){
ui->containerEmpty->setVisible(false);
ui->listTransactions->setVisible(true);
hideHelp();
disconnect(this, SLOT(updateTxesView()));
}
}
Expand Down Expand Up @@ -610,3 +607,37 @@ void OverviewPage::hideEvent(QHideEvent *event){
a->setEasingCurve(QEasingCurve::OutBack);
a->start(QPropertyAnimation::DeleteWhenStopped);
}

void OverviewPage::showHelp()
{
// show empty view
ui->containerEmpty->setVisible(true);
ui->listTransactions->setVisible(false);
}

void OverviewPage::hideHelp()
{
ui->containerEmpty->setVisible(false);
ui->listTransactions->setVisible(true);
}

bool OverviewPage::isNewWallet()
{
bool retVal = true;

if(this->walletModel)
{
interfaces::Wallet& wallet = this->walletModel->wallet();

if(wallet.getWalletTxs().size() == 0)
{
retVal = true;
}
else
{
retVal = false;
}
}

return retVal;
}
3 changes: 3 additions & 0 deletions src/qt/overviewpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ class OverviewPage : public QWidget
void setClientModel(ClientModel *clientModel);
void setWalletModel(WalletModel *walletModel);
void showOutOfSyncWarning(bool fShow);
void showHelp();
void hideHelp();
bool isNewWallet();

Q_SIGNALS:
void transactionClicked(const QModelIndex &index);
Expand Down
Binary file added src/qt/res/icons/ic-information-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/qt/veil.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,7 @@
<file alias="ic-locked-png">res/icons/ic-locked.png</file>
<file alias="ic-unlocked-png">res/icons/ic-unlocked.png</file>
<file alias="ic-menu-png">res/icons/ic-menu.png</file>
<file alias="ic-information-white">res/icons/ic-information-white.png</file>
</qresource>
<qresource prefix="/movies">
<file alias="spinner-000">res/movies/spinner-000.png</file>
Expand Down
6 changes: 6 additions & 0 deletions src/qt/walletframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,12 @@ void WalletFrame::gotoSettings(){
i.value()->gotoSettingsPage();
}

void WalletFrame::gotoHelpPage(){
QMap<QString, WalletView*>::const_iterator i;
for (i = mapWalletViews.constBegin(); i != mapWalletViews.constEnd(); ++i)
i.value()->gotoHelpPage();
}

void WalletFrame::gotoSignMessageTab(QString addr)
{
WalletView *walletView = currentWalletView();
Expand Down
2 changes: 2 additions & 0 deletions src/qt/walletframe.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@ public Q_SLOTS:
void gotoAddressesPage();
/** Switch to settings page */
void gotoSettings();
/** Switch to help page */
void gotoHelpPage();

/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
Expand Down
10 changes: 10 additions & 0 deletions src/qt/walletview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,10 @@ void WalletView::processNewTransaction(const QModelIndex& parent, int start, int

void WalletView::gotoOverviewPage()
{
if(!(overviewPage->isNewWallet()))
{
overviewPage->hideHelp();
}
setCurrentWidget(overviewPage);
}

Expand Down Expand Up @@ -239,6 +243,12 @@ void WalletView::gotoSettingsPage(){
setCurrentWidget(settingsWidget);
}

void WalletView::gotoHelpPage()
{
overviewPage->showHelp();
setCurrentWidget(overviewPage);
}

void WalletView::gotoSignMessageTab(QString addr)
{
// calls show() in showTab_SM()
Expand Down
2 changes: 2 additions & 0 deletions src/qt/walletview.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@ public Q_SLOTS:
void gotoAddressesPage();
/** Switch to settings page */
void gotoSettingsPage();
/** Switch to help page */
void gotoHelpPage();

/** Show Sign/Verify Message dialog and switch to sign message tab */
void gotoSignMessageTab(QString addr = "");
Expand Down

0 comments on commit a8b27c6

Please sign in to comment.