mirror of
https://github.com/GOSTSec/gostcoin
synced 2025-01-17 02:00:57 +00:00
add translation for paperwallet
This commit is contained in:
parent
b1a9901d48
commit
791eabd806
@ -346,12 +346,12 @@
|
|||||||
<name>BitcoinGUI</name>
|
<name>BitcoinGUI</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../bitcoingui.cpp" line="+77"/>
|
<location filename="../bitcoingui.cpp" line="+77"/>
|
||||||
<location line="+592"/>
|
<location line="+602"/>
|
||||||
<source>Gostcoin</source>
|
<source>Gostcoin</source>
|
||||||
<translation>ГОСТкойн</translation>
|
<translation>ГОСТкойн</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="-592"/>
|
<location line="-602"/>
|
||||||
<source>Wallet</source>
|
<source>Wallet</source>
|
||||||
<translation>Бумажник</translation>
|
<translation>Бумажник</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -516,12 +516,22 @@
|
|||||||
<translation>Открыть консоль отладки и диагностики</translation>
|
<translation>Открыть консоль отладки и диагностики</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+25"/>
|
<location line="+14"/>
|
||||||
|
<source>&Print paper wallet...</source>
|
||||||
|
<translation>&Распечатать бумажный кошелек</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+2"/>
|
||||||
|
<source>Generate new address and print</source>
|
||||||
|
<translation>Сгенерировать новый адрес и распечатать его</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location line="+16"/>
|
||||||
<source>&File</source>
|
<source>&File</source>
|
||||||
<translation>&Файл</translation>
|
<translation>&Файл</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location line="+7"/>
|
<location line="+11"/>
|
||||||
<source>&Settings</source>
|
<source>&Settings</source>
|
||||||
<translation>&Настройки</translation>
|
<translation>&Настройки</translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -15,104 +15,104 @@
|
|||||||
|
|
||||||
static void printAsQR(QPainter &painter, QString &vchKey, int shift)
|
static void printAsQR(QPainter &painter, QString &vchKey, int shift)
|
||||||
{
|
{
|
||||||
QRcode *qr = QRcode_encodeString(vchKey.toStdString().c_str(), 1, QR_ECLEVEL_L, QR_MODE_8, 1);
|
QRcode *qr = QRcode_encodeString(vchKey.toStdString().c_str(), 1, QR_ECLEVEL_L, QR_MODE_8, 1);
|
||||||
if (qr)
|
if (qr)
|
||||||
{
|
{
|
||||||
QPaintDevice *pd = painter.device();
|
QPaintDevice *pd = painter.device();
|
||||||
const double w = pd->width();
|
const double w = pd->width();
|
||||||
const double h = pd->height();
|
const double h = pd->height();
|
||||||
QColor bg("white");
|
QColor bg("white");
|
||||||
QColor fg("black");
|
QColor fg("black");
|
||||||
painter.setBrush(bg);
|
painter.setBrush(bg);
|
||||||
painter.fillRect(0, 0, w, h, bg);
|
painter.fillRect(0, 0, w, h, bg);
|
||||||
painter.setPen(Qt::SolidLine);
|
painter.setPen(Qt::SolidLine);
|
||||||
painter.setPen(fg);
|
painter.setPen(fg);
|
||||||
painter.setBrush(fg);
|
painter.setBrush(fg);
|
||||||
const int s=qr->width > 0 ? qr->width : 1;
|
const int s=qr->width > 0 ? qr->width : 1;
|
||||||
const double aspect = w / h;
|
const double aspect = w / h;
|
||||||
const double scale = ((aspect > 1.0) ? h : w) / s;// * 0.3;
|
const double scale = ((aspect > 1.0) ? h : w) / s;// * 0.3;
|
||||||
for(int y = 0; y < s; y++)
|
for(int y = 0; y < s; y++)
|
||||||
{
|
{
|
||||||
const int yy = y*s;
|
const int yy = y*s;
|
||||||
for(int x = 0; x < s; x++)
|
for(int x = 0; x < s; x++)
|
||||||
{
|
{
|
||||||
const int xx = yy + x;
|
const int xx = yy + x;
|
||||||
const unsigned char b = qr->data[xx];
|
const unsigned char b = qr->data[xx];
|
||||||
if(b & 0x01)
|
if(b & 0x01)
|
||||||
{
|
{
|
||||||
const double rx1 = x*scale, ry1 = y*scale;
|
const double rx1 = x*scale, ry1 = y*scale;
|
||||||
QRectF r(rx1 + shift, ry1, scale, scale);
|
QRectF r(rx1 + shift, ry1, scale, scale);
|
||||||
painter.drawRects(&r, 1);
|
painter.drawRects(&r, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QRcode_free(qr);
|
QRcode_free(qr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool readHtmlTemplate(const QString &res_name, QString &htmlContent)
|
static bool readHtmlTemplate(const QString &res_name, QString &htmlContent)
|
||||||
{
|
{
|
||||||
QFile htmlFile(res_name);
|
QFile htmlFile(res_name);
|
||||||
if (!htmlFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
if (!htmlFile.open(QIODevice::ReadOnly | QIODevice::Text))
|
||||||
{
|
{
|
||||||
printf("Cant open %s\n", res_name.toStdString().c_str ());
|
printf("Cant open %s\n", res_name.toStdString().c_str ());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QTextStream in(&htmlFile);
|
QTextStream in(&htmlFile);
|
||||||
in.setCodec("UTF-8");
|
in.setCodec("UTF-8");
|
||||||
htmlContent = in.readAll();
|
htmlContent = in.readAll();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintPaperWallet (QWidget * parent)
|
void PrintPaperWallet (QWidget * parent)
|
||||||
{
|
{
|
||||||
RandAddSeedPerfmon();
|
RandAddSeedPerfmon();
|
||||||
CKey secret;
|
CKey secret;
|
||||||
secret.MakeNewKey(true);
|
secret.MakeNewKey(true);
|
||||||
|
|
||||||
CPrivKey privkey = secret.GetPrivKey();
|
CPrivKey privkey = secret.GetPrivKey();
|
||||||
CPubKey pubkey = secret.GetPubKey();
|
CPubKey pubkey = secret.GetPubKey();
|
||||||
CKeyID keyid = pubkey.GetID();
|
CKeyID keyid = pubkey.GetID();
|
||||||
|
|
||||||
std::string secret_str = CBitcoinSecret(secret).ToString();
|
std::string secret_str = CBitcoinSecret(secret).ToString();
|
||||||
std::string address = CBitcoinAddress(keyid).ToString();
|
std::string address = CBitcoinAddress(keyid).ToString();
|
||||||
|
|
||||||
QString qsecret = QString::fromStdString(secret_str);
|
QString qsecret = QString::fromStdString(secret_str);
|
||||||
QString qaddress = QString::fromStdString(address);
|
QString qaddress = QString::fromStdString(address);
|
||||||
|
|
||||||
QPrinter printer(QPrinter::HighResolution);
|
QPrinter printer(QPrinter::HighResolution);
|
||||||
printer.setPageMargins(0, 10, 0, 0, QPrinter::Millimeter);
|
printer.setPageMargins(0, 10, 0, 0, QPrinter::Millimeter);
|
||||||
|
|
||||||
QPrintDialog dlg(&printer, parent);
|
QPrintDialog dlg(&printer, parent);
|
||||||
if(dlg.exec() == QDialog::Accepted)
|
if(dlg.exec() == QDialog::Accepted)
|
||||||
{
|
{
|
||||||
QImage img1(200, 200, QImage::Format_ARGB32);
|
QImage img1(200, 200, QImage::Format_ARGB32);
|
||||||
QImage img2(200, 200, QImage::Format_ARGB32);
|
QImage img2(200, 200, QImage::Format_ARGB32);
|
||||||
QPainter painter(&img1);
|
QPainter painter(&img1);
|
||||||
painter.setRenderHint(QPainter::Antialiasing, false);
|
painter.setRenderHint(QPainter::Antialiasing, false);
|
||||||
painter.setRenderHint(QPainter::TextAntialiasing, false);
|
painter.setRenderHint(QPainter::TextAntialiasing, false);
|
||||||
painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
painter.setRenderHint(QPainter::SmoothPixmapTransform, false);
|
||||||
painter.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
painter.setRenderHint(QPainter::HighQualityAntialiasing, false);
|
||||||
painter.setRenderHint(QPainter::NonCosmeticDefaultPen, false);
|
painter.setRenderHint(QPainter::NonCosmeticDefaultPen, false);
|
||||||
printAsQR(painter, qaddress, 0);
|
printAsQR(painter, qaddress, 0);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
painter.begin(&img2);
|
painter.begin(&img2);
|
||||||
printAsQR(painter, qsecret, 0);
|
printAsQR(painter, qsecret, 0);
|
||||||
painter.end();
|
painter.end();
|
||||||
|
|
||||||
QString html;
|
QString html;
|
||||||
readHtmlTemplate(":/html/paperwallet", html);
|
readHtmlTemplate(":/html/paperwallet", html);
|
||||||
|
|
||||||
html.replace("__ADDRESS__", qaddress);
|
html.replace("__ADDRESS__", qaddress);
|
||||||
html.replace("__PRIVATE__", qsecret);
|
html.replace("__PRIVATE__", qsecret);
|
||||||
|
|
||||||
QTextDocument document;
|
QTextDocument document;
|
||||||
document.addResource(QTextDocument::ImageResource, QUrl(":qr1.png" ), img1);
|
document.addResource(QTextDocument::ImageResource, QUrl(":qr1.png" ), img1);
|
||||||
document.addResource(QTextDocument::ImageResource, QUrl(":qr2.png" ), img2);
|
document.addResource(QTextDocument::ImageResource, QUrl(":qr2.png" ), img2);
|
||||||
document.setHtml(html);
|
document.setHtml(html);
|
||||||
document.setPageSize(QSizeF(printer.pageRect(QPrinter::Point).size()));
|
document.setPageSize(QSizeF(printer.pageRect(QPrinter::Point).size()));
|
||||||
document.print(&printer);
|
document.print(&printer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,12 @@
|
|||||||
<!DOCTYPE RCC><RCC version="1.0">
|
<!DOCTYPE RCC><RCC version="1.0">
|
||||||
<qresource prefix="/html">
|
<qresource prefix="/html" lang="en">
|
||||||
<file alias="paperwallet">res/html/paperwallet.html</file>
|
<file alias="paperwallet">res/html/paperwallet_en.html</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
<qresource prefix="/icons">
|
<qresource prefix="/html" lang="ru">
|
||||||
<file alias="cash">res/icons/cash.png</file>
|
<file alias="paperwallet">res/html/paperwallet_ru.html</file>
|
||||||
<file alias="cash_print">res/icons/cash_print.png</file>
|
</qresource>
|
||||||
</qresource>
|
<qresource prefix="/icons">
|
||||||
|
<file alias="cash">res/icons/cash.png</file>
|
||||||
|
<file alias="cash_print">res/icons/cash_print.png</file>
|
||||||
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -16,8 +16,8 @@
|
|||||||
__ADDRESS__
|
__ADDRESS__
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p>Use this address to deposit your Gostcoins. </p>
|
<p>Use this address to deposit your Gostcoins. </p>
|
||||||
<p>The balance and transactoin history you can find in public blockchain: <a href=«http://explorer.gostco.in»>http://explorer.gostco.in</a></p> <br /><br /><br /><br />
|
<p>The balance and transactoin history you can find in public blockchain: <a href=«http://explorer.gostco.in»>http://explorer.gostco.in</a></p> <br /><br /><br /><br />
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@ -31,7 +31,7 @@
|
|||||||
__PRIVATE__
|
__PRIVATE__
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<p>To send your Gostcoins you need to import this key into you wallet, using importprivkey command.</p>
|
<p>To send your Gostcoins you need to import this key into you wallet, using importprivkey command.</p>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@ -41,11 +41,11 @@
|
|||||||
Attention!
|
Attention!
|
||||||
</h3>
|
</h3>
|
||||||
<div>
|
<div>
|
||||||
<ul>
|
<ul>
|
||||||
<li> You should use a paper wallet only once. When you import your key it stays forever</li>
|
<li> You should use a paper wallet only once. When you import your key it stays forever</li>
|
||||||
<li>If you lose your key, you will lose your Gostcoins</li>
|
<li>If you lose your key, you will lose your Gostcoins</li>
|
||||||
<li>All transactions on the Gostcoin network irrevocable, they can not be canceled. Be careful when entering addresses to avoid typos. If possible, use the QR-code reading function.</li>
|
<li>All transactions on the Gostcoin network irrevocable, they can not be canceled. Be careful when entering addresses to avoid typos. If possible, use the QR-code reading function.</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
77
src/qt/res/html/paperwallet_ru.html
Normal file
77
src/qt/res/html/paperwallet_ru.html
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<head lang="ru">
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||||
|
<title></title>
|
||||||
|
</head>
|
||||||
|
<body style="font-family: sans-serif; font-size: 9px; height: 842px; width: 595px; margin-left: auto; margin-right: auto;">
|
||||||
|
<table style="width: 100%; margin-bottom: 10px" border="1px" cellpadding="10px">
|
||||||
|
<tr style="vertical-align: top">
|
||||||
|
<td align="left" width="50%">
|
||||||
|
<img src=":qr1.png"/>
|
||||||
|
<h4>
|
||||||
|
Ваш адрес пополнения:
|
||||||
|
</h4>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
__ADDRESS__
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>Используйте данный адрес для зачисления ГОСТКоинов. </p>
|
||||||
|
<p>Баланс и историю по данному адресу вы можете посмотреть в реестре сети: <a href=«http://explorer.gostco.in»>http://explorer.gostco.in</a></p> <br /><br /><br /><br />
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td align="left" width="50%">
|
||||||
|
<img src=":qr2.png"/>
|
||||||
|
<!--width="150" height="150"/>-->
|
||||||
|
<h4>
|
||||||
|
Ваш ключ для отправки ГОСТКоинов:
|
||||||
|
</h4>
|
||||||
|
<div style="margin-bottom: 10px">
|
||||||
|
__PRIVATE__
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<p>Чтобы отправить монеты вам необходимо импортировать данный ключ в кошелек, используя команду importprivkey.</p>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr style="margin-bottom: 20px">
|
||||||
|
<td colspan="2" >
|
||||||
|
<h3>
|
||||||
|
Внимание!
|
||||||
|
</h3>
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li>Старайтесь использовать бумажный кошелек однократно. В момент импортирования ключ сохраняется в кошельке навсегда</li>
|
||||||
|
<li>Если вы потеряете ключ, то не сможете воспользоваться монетами, зачисленными на адрес бумажного кошелька</li>
|
||||||
|
<li>Все транзакции в сети безотзывные, отменить их невозможно. Будьте внимательны при вводе адресов для пополнения и отправки монет. По возможности пользуйтесь функцией сканирования QR-кода при вводе ключа или адреса, чтобы избежать опечаток.</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<table style="margin-bottom: 10px; margin-top: 10px">
|
||||||
|
<tr>
|
||||||
|
<td width="200">
|
||||||
|
<div style="display: inline-block;">
|
||||||
|
<img src=":/icons/cash_print" width="160" height="107">
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
<div style="display: inline-block; vertical-align: top; margin-left: 20px">
|
||||||
|
<h2>ГОСТКоин (GST)</h2>
|
||||||
|
<div>
|
||||||
|
<h3>
|
||||||
|
Бумажный кошелек
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</body>
|
||||||
|
</html>
|
Loading…
x
Reference in New Issue
Block a user