Skip to content

Commit

Permalink
Added QRCode generation functions via libqrencode. Switch on with USE…
Browse files Browse the repository at this point in the history
…_QRENCODE=1.

Amended build docs for Linux and OSX, and OSX makefile.
Added package 'qrencode' to gitian.yml
  • Loading branch information
sje397 committed Dec 20, 2011
1 parent 3528650 commit 22123c8
Show file tree
Hide file tree
Showing 13 changed files with 434 additions and 7 deletions.
14 changes: 14 additions & 0 deletions bitcoin-qt.pro
Expand Up @@ -19,6 +19,14 @@ OBJECTS_DIR = build
MOC_DIR = build
UI_DIR = build

# use: qmake "USE_QRCODE=1"
# libqrencode (http://fukuchi.org/works/qrencode/index.en.html) must be installed for support
contains(USE_QRCODE, 1) {
message(Building with QRCode support)
DEFINES += USE_QRCODE
LIBS += -lqrencode
}

# use: qmake "RELEASE=1"
contains(RELEASE, 1) {
# Mac: compile for maximum compatibility (10.5, 32-bit)
Expand Down Expand Up @@ -199,6 +207,12 @@ FORMS += \
src/qt/forms/sendcoinsentry.ui \
src/qt/forms/askpassphrasedialog.ui

contains(USE_QRCODE, 1) {
HEADERS += src/qt/qrcodedialog.h
SOURCES += src/qt/qrcodedialog.cpp
FORMS += src/qt/forms/qrcodedialog.ui
}

CODECFORTR = UTF-8

# for lrelease/lupdate
Expand Down
1 change: 1 addition & 0 deletions contrib/gitian-descriptors/gitian.yml
Expand Up @@ -16,6 +16,7 @@ packages:
- "libssl-dev"
- "git-core"
- "unzip"
- "qrencode"
reference_datetime: "2011-01-30 00:00:00"
remotes:
- "url": "https://github.com/bitcoin/bitcoin.git"
Expand Down
3 changes: 3 additions & 0 deletions doc/build-osx.txt
Expand Up @@ -43,6 +43,9 @@ pushd bitcoin/contrib/minipupnpc; sudo port install; popd
(this will be unnecessary soon, you will just port install miniupnpc
along with the rest of the dependencies).

Optionally install qrencode (and set USE_QRCODE=1):
sudo port install qrencode

4. Now you should be able to build bitcoind:

cd bitcoin/src
Expand Down
20 changes: 13 additions & 7 deletions doc/build-unix.txt
Expand Up @@ -23,12 +23,13 @@ the graphical bitcoin.
Dependencies
------------

Library Purpose Description
------- ------- -----------
libssl SSL Support Secure communications
libdb4.8 Berkeley DB Blockchain & wallet storage
libboost Boost C++ Library
miniupnpc UPnP Support Optional firewall-jumping support
Library Purpose Description
------- ------- -----------
libssl SSL Support Secure communications
libdb4.8 Berkeley DB Blockchain & wallet storage
libboost Boost C++ Library
miniupnpc UPnP Support Optional firewall-jumping support
libqrencode QRCode generation Optional QRCode generation

miniupnpc may be used for UPnP port mapping. It can be downloaded from
http://miniupnp.tuxfamily.org/files/. UPnP support is compiled in and
Expand All @@ -37,6 +38,12 @@ turned off by default. Set USE_UPNP to a different value to control this:
USE_UPNP=0 (the default) UPnP support turned off by default at runtime
USE_UPNP=1 UPnP support turned on by default at runtime

libqrencode may be used for QRCode image generation. It can be downloaded
from http://fukuchi.org/works/qrencode/index.html.en, or installed via
your package manager. Set USE_QRCODE to control this:
USE_QRCODE=0 (the default) No QRCode support - libarcode not required
USE_QRCODE=1 QRCode support enabled

Licenses of statically linked libraries:
Berkeley DB New BSD license with additional requirement that linked
software must be free open source
Expand All @@ -50,7 +57,6 @@ Versions used in this release:
Boost 1.37
miniupnpc 1.6


Dependency Build Instructions: Ubuntu & Debian
----------------------------------------------
sudo apt-get install build-essential
Expand Down
4 changes: 4 additions & 0 deletions src/makefile.osx
Expand Up @@ -95,6 +95,10 @@ else
endif
endif

ifdef USE_QRCODE
DEFS += -DUSE_QRCODE=$(USE_QRCODE)
LIBS += -lqrencode
endif

all: bitcoind

Expand Down
30 changes: 30 additions & 0 deletions src/qt/addressbookpage.cpp
Expand Up @@ -10,6 +10,10 @@
#include <QFileDialog>
#include <QMessageBox>

#ifdef USE_QRCODE
#include "qrcodedialog.h"
#endif

AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
QDialog(parent),
ui(new Ui::AddressBookPage),
Expand All @@ -25,6 +29,10 @@ AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
ui->deleteButton->setIcon(QIcon());
#endif

#ifndef USE_QRCODE
ui->showQRCode->setVisible(false);
#endif

switch(mode)
{
case ForSending:
Expand Down Expand Up @@ -169,10 +177,12 @@ void AddressBookPage::selectionChanged()
break;
}
ui->copyToClipboard->setEnabled(true);
ui->showQRCode->setEnabled(true);
}
else
{
ui->deleteButton->setEnabled(false);
ui->showQRCode->setEnabled(false);
ui->copyToClipboard->setEnabled(false);
}
}
Expand Down Expand Up @@ -227,3 +237,23 @@ void AddressBookPage::exportClicked()
QMessageBox::Abort, QMessageBox::Abort);
}
}

void AddressBookPage::on_showQRCode_clicked()
{
#ifdef USE_QRCODE
QTableView *table = ui->tableView;
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);


QRCodeDialog *d;
foreach (QModelIndex index, indexes)
{
QString address = index.data().toString(),
label = index.sibling(index.row(), 0).data().toString(),
title = QString("%1 << %2 >>").arg(label).arg(address);

QRCodeDialog *d = new QRCodeDialog(title, address, label, tab == ReceivingTab, this);
d->show();
}
#endif
}
1 change: 1 addition & 0 deletions src/qt/addressbookpage.h
Expand Up @@ -54,6 +54,7 @@ private slots:
void on_newAddressButton_clicked();
void on_copyToClipboard_clicked();
void selectionChanged();
void on_showQRCode_clicked();
};

#endif // ADDRESSBOOKDIALOG_H
1 change: 1 addition & 0 deletions src/qt/bitcoin.qrc
Expand Up @@ -41,6 +41,7 @@
<qresource prefix="/images">
<file alias="about">res/images/about.png</file>
<file alias="splash">res/images/splash2.jpg</file>
<file alias="qrcode">res/images/qrcode.png</file>
</qresource>
<qresource prefix="/movies">
<file alias="update_spinner">res/movies/update_spinner.mng</file>
Expand Down
11 changes: 11 additions & 0 deletions src/qt/forms/addressbookpage.ui
Expand Up @@ -79,6 +79,17 @@
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="showQRCode">
<property name="text">
<string>Show &amp;QR Code</string>
</property>
<property name="icon">
<iconset resource="../bitcoin.qrc">
<normaloff>:/images/qrcode</normaloff>:/images/qrcode</iconset>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="deleteButton">
<property name="toolTip">
Expand Down

0 comments on commit 22123c8

Please sign in to comment.