Celil
14 years ago
35 changed files with 932 additions and 329 deletions
Binary file not shown.
After Width: | Height: | Size: 905 B |
@ -0,0 +1,41 @@
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python |
||||
# W.J. van der Laan, 2011 |
||||
# Make spinning .mng animation from a .png |
||||
# Requires imagemagick 6.7+ |
||||
from __future__ import division |
||||
from os import path |
||||
from PIL import Image |
||||
from subprocess import Popen |
||||
|
||||
SRC='img/reload_scaled.png' |
||||
DST='../src/qt/res/movies/update_spinner.mng' |
||||
TMPDIR='/tmp' |
||||
TMPNAME='tmp-%03i.png' |
||||
NUMFRAMES=35 |
||||
FRAMERATE=10.0 |
||||
CONVERT='convert' |
||||
CLOCKWISE=True |
||||
|
||||
im_src = Image.open(SRC) |
||||
|
||||
if CLOCKWISE: |
||||
im_src = im_src.transpose(Image.FLIP_LEFT_RIGHT) |
||||
|
||||
def frame_to_filename(frame): |
||||
return path.join(TMPDIR, TMPNAME % frame) |
||||
|
||||
frame_files = [] |
||||
for frame in xrange(NUMFRAMES): |
||||
rotation = (frame + 0.5) / NUMFRAMES * 360.0 |
||||
if CLOCKWISE: |
||||
rotation = -rotation |
||||
im_new = im_src.rotate(rotation, Image.BICUBIC) |
||||
outfile = frame_to_filename(frame) |
||||
im_new.save(outfile, 'png') |
||||
frame_files.append(outfile) |
||||
|
||||
p = Popen([CONVERT, "-delay", str(FRAMERATE), "-dispose", "2"] + frame_files + [DST]) |
||||
p.communicate() |
||||
|
||||
|
||||
|
@ -0,0 +1,175 @@
@@ -0,0 +1,175 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?> |
||||
<ui version="4.0"> |
||||
<class>SendCoinsEntry</class> |
||||
<widget class="QFrame" name="SendCoinsEntry"> |
||||
<property name="geometry"> |
||||
<rect> |
||||
<x>0</x> |
||||
<y>0</y> |
||||
<width>729</width> |
||||
<height>136</height> |
||||
</rect> |
||||
</property> |
||||
<property name="windowTitle"> |
||||
<string>Form</string> |
||||
</property> |
||||
<property name="frameShape"> |
||||
<enum>QFrame::StyledPanel</enum> |
||||
</property> |
||||
<property name="frameShadow"> |
||||
<enum>QFrame::Sunken</enum> |
||||
</property> |
||||
<layout class="QGridLayout" name="gridLayout"> |
||||
<property name="spacing"> |
||||
<number>12</number> |
||||
</property> |
||||
<item row="5" column="0"> |
||||
<widget class="QLabel" name="label"> |
||||
<property name="text"> |
||||
<string>A&mount:</string> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
<property name="buddy"> |
||||
<cstring>payAmount</cstring> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="0"> |
||||
<widget class="QLabel" name="label_2"> |
||||
<property name="text"> |
||||
<string>Pay &To:</string> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
<property name="buddy"> |
||||
<cstring>payTo</cstring> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="5" column="1"> |
||||
<widget class="BitcoinAmountField" name="payAmount"/> |
||||
</item> |
||||
<item row="4" column="1"> |
||||
<layout class="QHBoxLayout" name="horizontalLayout_2"> |
||||
<property name="spacing"> |
||||
<number>0</number> |
||||
</property> |
||||
<item> |
||||
<widget class="QValidatedLineEdit" name="addAsLabel"> |
||||
<property name="enabled"> |
||||
<bool>true</bool> |
||||
</property> |
||||
<property name="toolTip"> |
||||
<string>Enter a label for this address to add it to your address book</string> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
<item row="4" column="0"> |
||||
<widget class="QLabel" name="label_4"> |
||||
<property name="text"> |
||||
<string>&Label:</string> |
||||
</property> |
||||
<property name="alignment"> |
||||
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> |
||||
</property> |
||||
<property name="buddy"> |
||||
<cstring>addAsLabel</cstring> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item row="3" column="1"> |
||||
<layout class="QHBoxLayout" name="horizontalLayout_3"> |
||||
<property name="spacing"> |
||||
<number>0</number> |
||||
</property> |
||||
<item> |
||||
<widget class="QValidatedLineEdit" name="payTo"> |
||||
<property name="toolTip"> |
||||
<string>The address to send the payment to (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)</string> |
||||
</property> |
||||
<property name="maxLength"> |
||||
<number>34</number> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="addressBookButton"> |
||||
<property name="toolTip"> |
||||
<string>Look up adress in address book</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../bitcoin.qrc"> |
||||
<normaloff>:/icons/address-book</normaloff>:/icons/address-book</iconset> |
||||
</property> |
||||
<property name="shortcut"> |
||||
<string>Alt+A</string> |
||||
</property> |
||||
<property name="autoDefault"> |
||||
<bool>false</bool> |
||||
</property> |
||||
<property name="flat"> |
||||
<bool>false</bool> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="pasteButton"> |
||||
<property name="toolTip"> |
||||
<string>Paste address from system clipboard</string> |
||||
</property> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../bitcoin.qrc"> |
||||
<normaloff>:/icons/editpaste</normaloff>:/icons/editpaste</iconset> |
||||
</property> |
||||
<property name="shortcut"> |
||||
<string>Alt+P</string> |
||||
</property> |
||||
<property name="autoDefault"> |
||||
<bool>false</bool> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
<item> |
||||
<widget class="QPushButton" name="deleteButton"> |
||||
<property name="text"> |
||||
<string/> |
||||
</property> |
||||
<property name="icon"> |
||||
<iconset resource="../bitcoin.qrc"> |
||||
<normaloff>:/icons/remove</normaloff>:/icons/remove</iconset> |
||||
</property> |
||||
</widget> |
||||
</item> |
||||
</layout> |
||||
</item> |
||||
</layout> |
||||
</widget> |
||||
<customwidgets> |
||||
<customwidget> |
||||
<class>BitcoinAmountField</class> |
||||
<extends>QLineEdit</extends> |
||||
<header>bitcoinamountfield.h</header> |
||||
<container>1</container> |
||||
</customwidget> |
||||
<customwidget> |
||||
<class>QValidatedLineEdit</class> |
||||
<extends>QLineEdit</extends> |
||||
<header>qvalidatedlineedit.h</header> |
||||
</customwidget> |
||||
</customwidgets> |
||||
<resources> |
||||
<include location="../bitcoin.qrc"/> |
||||
</resources> |
||||
<connections/> |
||||
</ui> |
@ -0,0 +1,37 @@
@@ -0,0 +1,37 @@
|
||||
#include "qvalidatedlineedit.h" |
||||
|
||||
QValidatedLineEdit::QValidatedLineEdit(QWidget *parent) : |
||||
QLineEdit(parent), valid(true) |
||||
{ |
||||
connect(this, SIGNAL(textChanged(QString)), this, SLOT(markValid())); |
||||
} |
||||
|
||||
void QValidatedLineEdit::setValid(bool valid) |
||||
{ |
||||
if(valid == this->valid) |
||||
{ |
||||
return; |
||||
} |
||||
|
||||
if(valid) |
||||
{ |
||||
setStyleSheet(""); |
||||
} |
||||
else |
||||
{ |
||||
setStyleSheet("background:#FF8080"); |
||||
} |
||||
this->valid = valid; |
||||
} |
||||
|
||||
void QValidatedLineEdit::focusInEvent(QFocusEvent *evt) |
||||
{ |
||||
// Clear invalid flag on focus
|
||||
setValid(true); |
||||
QLineEdit::focusInEvent(evt); |
||||
} |
||||
|
||||
void QValidatedLineEdit::markValid() |
||||
{ |
||||
setValid(true); |
||||
} |
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
#ifndef QVALIDATEDLINEEDIT_H |
||||
#define QVALIDATEDLINEEDIT_H |
||||
|
||||
#include <QLineEdit> |
||||
|
||||
// Line edit that can be marked as "invalid". When marked as invalid,
|
||||
// it will get a red background until it is focused.
|
||||
class QValidatedLineEdit : public QLineEdit |
||||
{ |
||||
Q_OBJECT |
||||
public: |
||||
explicit QValidatedLineEdit(QWidget *parent = 0); |
||||
|
||||
protected: |
||||
void focusInEvent(QFocusEvent *evt); |
||||
|
||||
private: |
||||
bool valid; |
||||
|
||||
public slots: |
||||
void setValid(bool valid); |
||||
|
||||
private slots: |
||||
void markValid(); |
||||
}; |
||||
|
||||
#endif // QVALIDATEDLINEEDIT_H
|
Before Width: | Height: | Size: 1.3 KiB |
After Width: | Height: | Size: 1.2 KiB |
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 698 B |
Binary file not shown.
@ -0,0 +1,119 @@
@@ -0,0 +1,119 @@
|
||||
#include "sendcoinsentry.h" |
||||
#include "ui_sendcoinsentry.h" |
||||
#include "guiutil.h" |
||||
#include "addressbookpage.h" |
||||
#include "walletmodel.h" |
||||
#include "addresstablemodel.h" |
||||
|
||||
#include "qapplication.h" |
||||
#include "qclipboard.h" |
||||
|
||||
#include <QDebug> |
||||
|
||||
SendCoinsEntry::SendCoinsEntry(QWidget *parent) : |
||||
QFrame(parent), |
||||
ui(new Ui::SendCoinsEntry), |
||||
model(0) |
||||
{ |
||||
ui->setupUi(this); |
||||
|
||||
#if QT_VERSION >= 0x040700 |
||||
ui->payTo->setPlaceholderText(tr("Enter a Bitcoin address (e.g. 1NS17iag9jJgTHD1VXjvLCEnZuQ3rJDE9L)")); |
||||
ui->addAsLabel->setPlaceholderText(tr("Enter a label for this address to add it to your address book")); |
||||
#endif |
||||
setFocusPolicy(Qt::TabFocus); |
||||
setFocusProxy(ui->payTo); |
||||
|
||||
GUIUtil::setupAddressWidget(ui->payTo, this); |
||||
} |
||||
|
||||
SendCoinsEntry::~SendCoinsEntry() |
||||
{ |
||||
delete ui; |
||||
} |
||||
|
||||
void SendCoinsEntry::on_pasteButton_clicked() |
||||
{ |
||||
// Paste text from clipboard into recipient field
|
||||
ui->payTo->setText(QApplication::clipboard()->text()); |
||||
} |
||||
|
||||
void SendCoinsEntry::on_addressBookButton_clicked() |
||||
{ |
||||
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab, this); |
||||
dlg.setModel(model->getAddressTableModel()); |
||||
if(dlg.exec()) |
||||
{ |
||||
ui->payTo->setText(dlg.getReturnValue()); |
||||
ui->payAmount->setFocus(); |
||||
} |
||||
} |
||||
|
||||
void SendCoinsEntry::on_payTo_textChanged(const QString &address) |
||||
{ |
||||
ui->addAsLabel->setText(model->getAddressTableModel()->labelForAddress(address)); |
||||
} |
||||
|
||||
void SendCoinsEntry::setModel(WalletModel *model) |
||||
{ |
||||
this->model = model; |
||||
} |
||||
|
||||
void SendCoinsEntry::setRemoveEnabled(bool enabled) |
||||
{ |
||||
ui->deleteButton->setEnabled(enabled); |
||||
} |
||||
|
||||
void SendCoinsEntry::clear() |
||||
{ |
||||
ui->payTo->clear(); |
||||
ui->addAsLabel->clear(); |
||||
ui->payAmount->setText(QString()); |
||||
ui->payTo->setFocus(); |
||||
} |
||||
|
||||
void SendCoinsEntry::on_deleteButton_clicked() |
||||
{ |
||||
emit removeEntry(this); |
||||
} |
||||
|
||||
bool SendCoinsEntry::validate() |
||||
{ |
||||
// Check input validity
|
||||
bool retval = true; |
||||
|
||||
if(!ui->payAmount->validate()) |
||||
{ |
||||
retval = false; |
||||
} |
||||
|
||||
if(!ui->payTo->hasAcceptableInput() || |
||||
(model && !model->validateAddress(ui->payTo->text()))) |
||||
{ |
||||
ui->payTo->setValid(false); |
||||
retval = false; |
||||
} |
||||
|
||||
return retval; |
||||
} |
||||
|
||||
SendCoinsRecipient SendCoinsEntry::getValue() |
||||
{ |
||||
SendCoinsRecipient rv; |
||||
|
||||
rv.address = ui->payTo->text(); |
||||
rv.label = ui->addAsLabel->text(); |
||||
GUIUtil::parseMoney(ui->payAmount->text(), &rv.amount); |
||||
|
||||
return rv; |
||||
} |
||||
|
||||
QWidget *SendCoinsEntry::setupTabChain(QWidget *prev) |
||||
{ |
||||
QWidget::setTabOrder(prev, ui->payTo); |
||||
QWidget::setTabOrder(ui->payTo, ui->addressBookButton); |
||||
QWidget::setTabOrder(ui->addressBookButton, ui->pasteButton); |
||||
QWidget::setTabOrder(ui->pasteButton, ui->deleteButton); |
||||
QWidget::setTabOrder(ui->deleteButton, ui->addAsLabel); |
||||
return ui->payAmount->setupTabChain(ui->addAsLabel); |
||||
} |
@ -0,0 +1,45 @@
@@ -0,0 +1,45 @@
|
||||
#ifndef SENDCOINSENTRY_H |
||||
#define SENDCOINSENTRY_H |
||||
|
||||
#include <QFrame> |
||||
|
||||
namespace Ui { |
||||
class SendCoinsEntry; |
||||
} |
||||
class WalletModel; |
||||
class SendCoinsRecipient; |
||||
|
||||
class SendCoinsEntry : public QFrame |
||||
{ |
||||
Q_OBJECT |
||||
|
||||
public: |
||||
explicit SendCoinsEntry(QWidget *parent = 0); |
||||
~SendCoinsEntry(); |
||||
|
||||
void setModel(WalletModel *model); |
||||
bool validate(); |
||||
SendCoinsRecipient getValue(); |
||||
// Qt messes up the tab chain by default in some cases (issue http://bugreports.qt.nokia.com/browse/QTBUG-10907)
|
||||
// Hence we have to set it up manually
|
||||
QWidget *setupTabChain(QWidget *prev); |
||||
|
||||
public slots: |
||||
void setRemoveEnabled(bool enabled); |
||||
void clear(); |
||||
|
||||
signals: |
||||
void removeEntry(SendCoinsEntry *entry); |
||||
|
||||
private slots: |
||||
void on_deleteButton_clicked(); |
||||
void on_payTo_textChanged(const QString &address); |
||||
void on_addressBookButton_clicked(); |
||||
void on_pasteButton_clicked(); |
||||
|
||||
private: |
||||
Ui::SendCoinsEntry *ui; |
||||
WalletModel *model; |
||||
}; |
||||
|
||||
#endif // SENDCOINSENTRY_H
|
Loading…
Reference in new issue