Skip to content

Commit

Permalink
Merge pull request #59 from HTHcoin/code-clean-up
Browse files Browse the repository at this point in the history
Code clean up
  • Loading branch information
MichaelHDesigns authored May 19, 2020
2 parents fc6b7c1 + 5930055 commit a607267
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 1 deletion.
29 changes: 29 additions & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
prevBlocks(0),
spinnerFrame(0),
governanceAction(0),
externalDonate(0),
platformStyle(_platformStyle)
{
/* Open CSS when configured */
Expand Down Expand Up @@ -595,6 +596,11 @@ void BitcoinGUI::createActions()
showPrivateSendHelpAction->setStatusTip(tr("Show the PrivateSend basic information"));


// HTHW Donate
externalDonate = new QAction(QIcon(":/icons/" + theme + "/about"), tr("Donate To HTHW"), this);
externalDonate->setStatusTip(tr("Donate to Help The Homeless Worldwide"));


connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
connect(aboutQtAction, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
Expand All @@ -603,6 +609,10 @@ void BitcoinGUI::createActions()
connect(showHelpMessageAction, SIGNAL(triggered()), this, SLOT(showHelpMessageClicked()));
connect(showPrivateSendHelpAction, SIGNAL(triggered()), this, SLOT(showPrivateSendHelpClicked()));


// HTHW Donate
connect(externalDonate, SIGNAL(triggered()), this, SLOT(openDonate()));

// Jump directly to tabs in RPC-console
connect(openInfoAction, SIGNAL(triggered()), this, SLOT(showInfo()));
connect(openRPCConsoleAction, SIGNAL(triggered()), this, SLOT(showConsole()));
Expand Down Expand Up @@ -693,6 +703,8 @@ void BitcoinGUI::createMenuBar()

}

QMenu* donate = appMenuBar->addMenu(tr("&HTHW Donate"));
donate->addAction(externalDonate);

QMenu *help = appMenuBar->addMenu(tr("&Help"));
help->addAction(showHelpMessageAction);
Expand Down Expand Up @@ -1024,6 +1036,23 @@ void BitcoinGUI::openClicked()
}
}

void BitcoinGUI::openDonate()
{
openExternalURL("https://helpthehomelessworldwide.org/donate");
}

void BitcoinGUI::openExternalURL(QString url)
{
QMessageBox::StandardButton reply = QMessageBox::question(this, tr("Notice – External Link"),
QStringLiteral("This action will open up the following website in your default browser:<br><br><p>HTH PayPal Donation Page</p><br><br>To continue, hit your Enter key or press <b>Ok</b>.<br><b>Remember, never share your personal information or private keys on any social website.</b>").arg(url),
QMessageBox::Cancel | QMessageBox::Ok,
QMessageBox::Ok);

if (reply == QMessageBox::Ok) {
QDesktopServices::openUrl(QUrl(url));
}
}

void BitcoinGUI::gotoGovernancePage()
{
governanceAction->setChecked(true);
Expand Down
4 changes: 4 additions & 0 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ class BitcoinGUI : public QMainWindow

QMenuBar *appMenuBar;

QAction* externalDonate;
QAction *governanceAction;
QAction* overviewaAction;
QAction *overviewAction;
Expand Down Expand Up @@ -259,6 +260,9 @@ private Q_SLOTS:
void aboutClicked();
/** Show debug window */
void showDebugWindow();
/** Open external URL */
void openDonate();
void openExternalURL(QString url = "");

/** Show debug window and set focus to the appropriate tab */
void showInfo();
Expand Down
53 changes: 52 additions & 1 deletion src/qt/forms/sendcoinsentry.ui
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@
<widget class="QWidget" name="layoutWidget">
<property name="geometry">
<rect>
<x>260</x>
<x>10</x>
<y>10</y>
<width>291</width>
<height>31</height>
Expand Down Expand Up @@ -302,6 +302,57 @@
</item>
</layout>
</widget>
<widget class="QPushButton" name="pushButton_Donate">
<property name="geometry">
<rect>
<x>380</x>
<y>10</y>
<width>120</width>
<height>30</height>
</rect>
</property>
<property name="minimumSize">
<size>
<width>100</width>
<height>30</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>120</width>
<height>30</height>
</size>
</property>
<property name="toolTip">
<string>Visit Help The Homeless Coin Explorer and Track Your HTH Coins</string>
</property>
<property name="styleSheet">
<string notr="true">border-style: solid;
border-width: 2px;
border-color: #34bcaa;
border-radius: 10px;
font-size: 11px;</string>
</property>
<property name="text">
<string>HTH PayPal</string>
</property>
</widget>
<widget class="QLabel" name="label">
<property name="geometry">
<rect>
<x>510</x>
<y>15</y>
<width>161</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>Donate using PayPal!</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</widget>
</item>
</layout>
Expand Down
8 changes: 8 additions & 0 deletions src/qt/sendcoinsentry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

#include <QApplication>
#include <QClipboard>
#include <QDesktopServices>

SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, QWidget *parent) :
QStackedWidget(parent),
Expand Down Expand Up @@ -285,3 +286,10 @@ bool SendCoinsEntry::updateLabel(const QString &address)

return false;
}


void SendCoinsEntry::on_pushButton_Donate_clicked() { // HTH Partners

QDesktopServices::openUrl(QUrl("https://www.paypal.com/donate/?token=FobylA07oFyKxjbW63UkRTP5eZETbFORbodTooL86A-C7cAfVJOUE-MBCM2dM80l_sBm00&country.x=US&locale.x=US", QUrl::TolerantMode));

}
1 change: 1 addition & 0 deletions src/qt/sendcoinsentry.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ private Q_SLOTS:
void on_pasteButton_clicked();
void updateDisplayUnit();
void updateFoundationAddress();
void on_pushButton_Donate_clicked();

private:
SendCoinsRecipient recipient;
Expand Down

0 comments on commit a607267

Please sign in to comment.