Pharao Release
Version 4.0.0.4 - refactored code - migrated vom Qt4 to Qt5 - added secure messaging
This commit is contained in:
+22
-21
@@ -1,7 +1,7 @@
|
||||
#include "guiutil.h"
|
||||
#include "bitcoinaddressvalidator.h"
|
||||
#include "trianglesaddressvalidator.h"
|
||||
#include "walletmodel.h"
|
||||
#include "bitcoinunits.h"
|
||||
#include "trianglesunits.h"
|
||||
#include "util.h"
|
||||
#include "init.h"
|
||||
|
||||
@@ -52,7 +52,7 @@ QString dateTimeStr(qint64 nTime)
|
||||
return dateTimeStr(QDateTime::fromTime_t((qint32)nTime));
|
||||
}
|
||||
|
||||
QFont bitcoinAddressFont()
|
||||
QFont trianglesAddressFont()
|
||||
{
|
||||
QFont font("Monospace");
|
||||
font.setStyleHint(QFont::TypeWriter);
|
||||
@@ -61,9 +61,9 @@ QFont bitcoinAddressFont()
|
||||
|
||||
void setupAddressWidget(QLineEdit *widget, QWidget *parent)
|
||||
{
|
||||
widget->setMaxLength(BitcoinAddressValidator::MaxAddressLength);
|
||||
widget->setValidator(new BitcoinAddressValidator(parent));
|
||||
widget->setFont(bitcoinAddressFont());
|
||||
widget->setMaxLength(TrianglesAddressValidator::MaxAddressLength);
|
||||
widget->setValidator(new TrianglesAddressValidator(parent));
|
||||
widget->setFont(trianglesAddressFont());
|
||||
}
|
||||
|
||||
void setupAmountWidget(QLineEdit *widget, QWidget *parent)
|
||||
@@ -75,9 +75,10 @@ void setupAmountWidget(QLineEdit *widget, QWidget *parent)
|
||||
widget->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
|
||||
}
|
||||
|
||||
bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
bool parseTrianglesURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
{
|
||||
if(uri.scheme() != QString("bitcoin"))
|
||||
// triangles: check prefix
|
||||
if(uri.scheme() != QString("Triangles"))
|
||||
return false;
|
||||
|
||||
SendCoinsRecipient rv;
|
||||
@@ -102,7 +103,7 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
{
|
||||
if(!i->second.isEmpty())
|
||||
{
|
||||
if(!BitcoinUnits::parse(BitcoinUnits::BTC, i->second, &rv.amount))
|
||||
if(!TrianglesUnits::parse(TrianglesUnits::TRI, i->second, &rv.amount))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
@@ -120,18 +121,18 @@ bool parseBitcoinURI(const QUrl &uri, SendCoinsRecipient *out)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool parseBitcoinURI(QString uri, SendCoinsRecipient *out)
|
||||
bool parseTrianglesURI(QString uri, SendCoinsRecipient *out)
|
||||
{
|
||||
// Convert bitcoin:// to bitcoin:
|
||||
// Convert Triangles:// to Triangles:
|
||||
//
|
||||
// Cannot handle this later, because bitcoin:// will cause Qt to see the part after // as host,
|
||||
// Cannot handle this later, because Triangles:// will cause Qt to see the part after // as host,
|
||||
// which will lower-case it (and thus invalidate the address).
|
||||
if(uri.startsWith("bitcoin://"))
|
||||
if(uri.startsWith("Triangles://"))
|
||||
{
|
||||
uri.replace(0, 10, "bitcoin:");
|
||||
uri.replace(0, 12, "Triangles:");
|
||||
}
|
||||
QUrl uriInstance(uri);
|
||||
return parseBitcoinURI(uriInstance, out);
|
||||
return parseTrianglesURI(uriInstance, out);
|
||||
}
|
||||
|
||||
QString HtmlEscape(const QString& str, bool fMultiLine)
|
||||
@@ -257,11 +258,11 @@ bool ToolTipToRichTextFilter::eventFilter(QObject *obj, QEvent *evt)
|
||||
{
|
||||
QWidget *widget = static_cast<QWidget*>(obj);
|
||||
QString tooltip = widget->toolTip();
|
||||
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt/>") && !Qt::mightBeRichText(tooltip))
|
||||
if(tooltip.size() > size_threshold && !tooltip.startsWith("<qt>") && !Qt::mightBeRichText(tooltip))
|
||||
{
|
||||
// Prefix <qt/> to make sure Qt detects this as rich text
|
||||
// Escape the current message as HTML and replace \n by <br>
|
||||
tooltip = "<qt/>" + HtmlEscape(tooltip, true);
|
||||
tooltip = "<qt>" + HtmlEscape(tooltip, true) + "<qt/>";
|
||||
widget->setToolTip(tooltip);
|
||||
return true;
|
||||
}
|
||||
@@ -277,7 +278,7 @@ boost::filesystem::path static StartupShortcutPath()
|
||||
|
||||
bool GetStartOnSystemStartup()
|
||||
{
|
||||
// check for Bitcoin.lnk
|
||||
// check for triangles.lnk
|
||||
return boost::filesystem::exists(StartupShortcutPath());
|
||||
}
|
||||
|
||||
@@ -392,7 +393,7 @@ bool SetStartOnSystemStartup(bool fAutoStart)
|
||||
boost::filesystem::ofstream optionFile(GetAutostartFilePath(), std::ios_base::out|std::ios_base::trunc);
|
||||
if (!optionFile.good())
|
||||
return false;
|
||||
// Write a bitcoin.desktop file to the autostart directory:
|
||||
// Write a triangles.desktop file to the autostart directory:
|
||||
optionFile << "[Desktop Entry]\n";
|
||||
optionFile << "Type=Application\n";
|
||||
optionFile << "Name=triangles\n";
|
||||
@@ -416,7 +417,7 @@ bool SetStartOnSystemStartup(bool fAutoStart) { return false; }
|
||||
HelpMessageBox::HelpMessageBox(QWidget *parent) :
|
||||
QMessageBox(parent)
|
||||
{
|
||||
header = tr("triangles-qt") + " " + tr("version") + " " +
|
||||
header = tr("Triangles-Qt") + " " + tr("version") + " " +
|
||||
QString::fromStdString(FormatFullVersion()) + "\n\n" +
|
||||
tr("Usage:") + "\n" +
|
||||
" triangles-qt [" + tr("command-line options") + "] " + "\n";
|
||||
@@ -428,7 +429,7 @@ HelpMessageBox::HelpMessageBox(QWidget *parent) :
|
||||
" -min " + tr("Start minimized") + "\n" +
|
||||
" -splash " + tr("Show splash screen on startup (default: 1)") + "\n";
|
||||
|
||||
setWindowTitle(tr("triangles-qt"));
|
||||
setWindowTitle(tr("Triangles-Qt"));
|
||||
setTextFormat(Qt::PlainText);
|
||||
// setMinimumWidth is ignored for QMessageBox so put in non-breaking spaces to make it wider.
|
||||
setText(header + QString(QChar(0x2003)).repeated(50));
|
||||
|
||||
Reference in New Issue
Block a user