Skip to content

Commit 1daab39

Browse files
committed
fixed build on macos and renamed bitcoin to tapyrus where applicable
1 parent 5af9944 commit 1daab39

28 files changed

+209
-182
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@ option(BUILD_TAPYRUS_SEEDER "Build tapyrus-seeder" ON)
1515
option(BUILD_TAPYRUS_CLI "Build tapyrus-cli" ON)
1616
option(BUILD_TAPYRUS_GENESIS "Build tapyrus-genesis" ON)
1717
option(BUILD_TAPYRUS_TX "Build tapyrus-tx" ON)
18-
19-
# TODO: Fix qt building problem and turn ON.
20-
option(BUILD_TAPYRUS_QT "Build tapyrus-qt" ON)
18+
option(ENABLE_QRCODE "Build QR support in wallet" OFF)
2119

2220
# Ensure that WINDRES_PREPROC is enabled when using windres.
2321
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
@@ -308,4 +306,4 @@ if(BUILD_TAPYRUS_QT)
308306
add_subdirectory(qt)
309307
endif()
310308

311-
message(status "BUILD_TAPYRUS_QT=${BUILD_TAPYRUS_QT}")
309+
message(STATUS "BUILD_TAPYRUS_QT=${BUILD_TAPYRUS_QT}")

src/config/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,5 +150,12 @@ set(ENABLE_WALLET ${BUILD_TAPYRUS_WALLET})
150150
# Activate ZeroMQ
151151
set(ENABLE_ZMQ ${BUILD_TAPYRUS_ZMQ})
152152

153+
# Try to find libqrencode
154+
# Only used in the wallet GUI
155+
if(ENABLE_QRCODE AND BUILD_BITCOIN_WALLET AND BUILD_BITCOIN_QT)
156+
find_package(QREncode REQUIRED)
157+
set(USE_QRCODE 1 CACHE INTERNAL "QR code is enabled")
158+
endif()
159+
153160
# Generate the config
154161
configure_file(bitcoin-config.h.cmake.in bitcoin-config.h ESCAPE_QUOTES)

src/config/bitcoin-config.h.cmake.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,5 +60,6 @@
6060

6161
#cmakedefine ENABLE_WALLET 1
6262
#cmakedefine ENABLE_ZMQ 1
63+
#cmakedefine ENABLE_QRCODE 0
6364

6465
#endif // BITCOIN_BITCOIN_CONFIG_H

src/qt/CMakeLists.txt

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,14 @@
33
project(tapyrus-qt)
44

55
# This ensure that AUTOMOC doesn't run on generated files.
6-
cmake_policy(SET CMP0071 OLD)
6+
cmake_policy(SET CMP0071 NEW)
77

88
include(BrewHelper)
99
find_brew_prefix(QT5_PREFIX qt5)
1010

1111
set(QT_REQUIRED_COMPONENTS Core Widgets Network DBus Test)
1212
find_package(Qt5 COMPONENTS ${QT_REQUIRED_COMPONENTS} REQUIRED HINTS "${QT5_PREFIX}")
1313

14-
find_package(QREncode REQUIRED)
15-
1614
# Find out more about Qt. This is similar to
1715
# http://code.qt.io/cgit/qt/qtwebkit.git/tree/Source/cmake/OptionsQt.cmake
1816
get_target_property(QT_CORE_TYPE Qt5::Core TYPE)
@@ -157,30 +155,41 @@ add_library(tapyrus-qt-base
157155
qrc_tapyrus_locale.cpp
158156
)
159157

158+
# Linux support
159+
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
160+
list(APPEND QT_PLUGIN_COMPONENTS QXcbIntegrationPlugin)
161+
list(APPEND QT_PLUGIN_PLATFORM_DEFINITIONS -DQT_QPA_PLATFORM_XCB=1)
162+
endif()
160163
# Windows support
161164
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
165+
list(APPEND QT_PLUGIN_COMPONENTS QWindowsIntegrationPlugin)
166+
list(APPEND QT_PLUGIN_PLATFORM_DEFINITIONS -DQT_QPA_PLATFORM_WINDOWS=1)
162167
target_sources(tapyrus-qt-base PRIVATE winshutdownmonitor.cpp)
163168
endif()
164-
165-
target_include_directories(tapyrus-qt-base
166-
PUBLIC
167-
.
168-
${CMAKE_CURRENT_BINARY_DIR}
169-
${CMAKE_CURRENT_BINARY_DIR}/forms
170-
)
169+
# OSX support
170+
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
171+
list(APPEND QT_PLUGIN_COMPONENTS QCocoaIntegrationPlugin)
172+
list(APPEND QT_PLUGIN_PLATFORM_DEFINITIONS -DQT_QPA_PLATFORM_COCOA=1)
173+
target_sources(tapyrus-qt-base PRIVATE
174+
macdockiconhandler.mm
175+
macnotificationhandler.mm
176+
)
177+
set_property(TARGET tapyrus-qt-base PROPERTY AUTOMOC_MOC_OPTIONS "-DQ_OS_MAC")
178+
target_link_libraries(tapyrus-qt-base
179+
"-framework Foundation"
180+
"-framework ApplicationServices"
181+
"-framework AppKit"
182+
)
183+
endif()
171184

172185
target_link_libraries(tapyrus-qt-base
173186
server
174187
rpcclient
175188
Qt5::Widgets
176189
Qt5::Network
177190
Qt5::DBus
178-
qrencode
179191
)
180192

181-
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
182-
set_property(TARGET tapyrus-qt-base PROPERTY AUTOMOC_MOC_OPTIONS "-DQ_OS_MAC")
183-
endif()
184193

185194
# Wallet
186195
if(BUILD_TAPYRUS_WALLET)
@@ -218,6 +227,11 @@ if(BUILD_TAPYRUS_WALLET)
218227
)
219228

220229
target_link_libraries(tapyrus-qt-base wallet)
230+
231+
if(ENABLE_QRCODE)
232+
find_package(QREncode REQUIRED)
233+
target_link_libraries(tapyrus-qt-base QREncode::qrencode)
234+
endif()
221235
endif()
222236

223237
# The executable

src/qt/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ Represents the view to a single wallet.
6060

6161
* UI elements like BitcoinAmountField, which inherit from QWidget.
6262
* `bitcoinstrings.cpp`: automatically generated
63-
* `bitcoinunits.(h/cpp)`: TPC / mTPC / etc handling
63+
* `TapyrusUnits.(h/cpp)`: TPC / mTPC / etc handling
6464
* `callback.h`
6565
* `guiconstants.h`: UI colors, app name, etc
6666
* `guiutil.h`: several helper functions

src/qt/clientmodel.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -247,13 +247,13 @@ static void BlockTipChanged(ClientModel *clientmodel, bool initialSync, int heig
247247
void ClientModel::subscribeToCoreSignals()
248248
{
249249
// Connect signals to client
250-
m_handler_show_progress = m_node.handleShowProgress(boost::bind(ShowProgress, this, _1, _2));
251-
m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(boost::bind(NotifyNumConnectionsChanged, this, _1));
252-
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(boost::bind(NotifyNetworkActiveChanged, this, _1));
250+
m_handler_show_progress = m_node.handleShowProgress(boost::bind(ShowProgress, this, boost::placeholders::_1, boost::placeholders::_2));
251+
m_handler_notify_num_connections_changed = m_node.handleNotifyNumConnectionsChanged(boost::bind(NotifyNumConnectionsChanged, this, boost::placeholders::_1));
252+
m_handler_notify_network_active_changed = m_node.handleNotifyNetworkActiveChanged(boost::bind(NotifyNetworkActiveChanged, this, boost::placeholders::_1));
253253
m_handler_notify_alert_changed = m_node.handleNotifyAlertChanged(boost::bind(NotifyAlertChanged, this));
254254
m_handler_banned_list_changed = m_node.handleBannedListChanged(boost::bind(BannedListChanged, this));
255-
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(boost::bind(BlockTipChanged, this, _1, _2, _3, _4, false));
256-
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(boost::bind(BlockTipChanged, this, _1, _2, _3, _4, true));
255+
m_handler_notify_block_tip = m_node.handleNotifyBlockTip(boost::bind(BlockTipChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, false));
256+
m_handler_notify_header_tip = m_node.handleNotifyHeaderTip(boost::bind(BlockTipChanged, this, boost::placeholders::_1, boost::placeholders::_2, boost::placeholders::_3, boost::placeholders::_4, true));
257257
}
258258

259259
void ClientModel::unsubscribeFromCoreSignals()

src/qt/coincontroldialog.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void CoinControlDialog::showMenu(const QPoint &point)
233233
// context menu action: copy amount
234234
void CoinControlDialog::copyAmount()
235235
{
236-
GUIUtil::setClipboard(BitcoinUnits::removeSpaces(contextMenuItem->text(COLUMN_AMOUNT)));
236+
GUIUtil::setClipboard(TapyrusUnits::removeSpaces(contextMenuItem->text(COLUMN_AMOUNT)));
237237
}
238238

239239
// context menu action: copy label
@@ -535,7 +535,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
535535
}
536536

537537
// actually update labels
538-
int nDisplayUnit = BitcoinUnits::TPC;
538+
int nDisplayUnit = TapyrusUnits::TPC;
539539
if (model && model->getOptionsModel())
540540
nDisplayUnit = model->getOptionsModel()->getDisplayUnit();
541541

@@ -555,12 +555,12 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
555555

556556
// stats
557557
l1->setText(QString::number(nQuantity)); // Quantity
558-
l2->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAmount)); // Amount
559-
l3->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee
560-
l4->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee
558+
l2->setText(TapyrusUnits::formatWithUnit(nDisplayUnit, nAmount)); // Amount
559+
l3->setText(TapyrusUnits::formatWithUnit(nDisplayUnit, nPayFee)); // Fee
560+
l4->setText(TapyrusUnits::formatWithUnit(nDisplayUnit, nAfterFee)); // After Fee
561561
l5->setText(((nBytes > 0) ? ASYMP_UTF8 : "") + QString::number(nBytes)); // Bytes
562562
l7->setText(fDust ? tr("yes") : tr("no")); // Dust
563-
l8->setText(BitcoinUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
563+
l8->setText(TapyrusUnits::formatWithUnit(nDisplayUnit, nChange)); // Change
564564
if (nPayFee > 0)
565565
{
566566
l3->setText(ASYMP_UTF8 + l3->text());
@@ -682,7 +682,7 @@ void CoinControlDialog::updateView()
682682
}
683683

684684
// amount
685-
itemOutput->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, out.txout.nValue));
685+
itemOutput->setText(COLUMN_AMOUNT, TapyrusUnits::format(nDisplayUnit, out.txout.nValue));
686686
itemOutput->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)out.txout.nValue)); // padding so that sorting works correctly
687687

688688
// date
@@ -716,7 +716,7 @@ void CoinControlDialog::updateView()
716716
if (treeMode)
717717
{
718718
itemWalletAddress->setText(COLUMN_CHECKBOX, "(" + QString::number(nChildren) + ")");
719-
itemWalletAddress->setText(COLUMN_AMOUNT, BitcoinUnits::format(nDisplayUnit, nSum));
719+
itemWalletAddress->setText(COLUMN_AMOUNT, TapyrusUnits::format(nDisplayUnit, nSum));
720720
itemWalletAddress->setData(COLUMN_AMOUNT, Qt::UserRole, QVariant((qlonglong)nSum));
721721
}
722722
}

src/qt/guiutil.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ bool parseTapyrusURI(const QUrl &uri, SendCoinsRecipient *out)
158158
{
159159
if(!i->second.isEmpty())
160160
{
161-
if(!BitcoinUnits::parse(BitcoinUnits::TPC, i->second, &rv.amount))
161+
if(!TapyrusUnits::parse(TapyrusUnits::TPC, i->second, &rv.amount))
162162
{
163163
return false;
164164
}
@@ -189,7 +189,7 @@ QString formatTapyrusURI(const SendCoinsRecipient &info)
189189

190190
if (info.amount)
191191
{
192-
ret += QString("?amount=%1").arg(BitcoinUnits::format(BitcoinUnits::TPC, info.amount, false, BitcoinUnits::separatorNever));
192+
ret += QString("?amount=%1").arg(TapyrusUnits::format(TapyrusUnits::TPC, info.amount, false, TapyrusUnits::separatorNever));
193193
paramCount++;
194194
}
195195

src/qt/optionsdialog.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) :
108108
}
109109
ui->thirdPartyTxUrls->setPlaceholderText("https://example.com/tx/%s");
110110

111-
ui->unit->setModel(new BitcoinUnits(this));
111+
ui->unit->setModel(new TapyrusUnits(this));
112112

113113
/* Widget-to-option mapper */
114114
mapper = new QDataWidgetMapper(this);

src/qt/optionsmodel.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ void OptionsModel::Init(bool resetSettings)
6767

6868
// Display
6969
if (!settings.contains("nDisplayUnit"))
70-
settings.setValue("nDisplayUnit", BitcoinUnits::TPC);
70+
settings.setValue("nDisplayUnit", TapyrusUnits::TPC);
7171
nDisplayUnit = settings.value("nDisplayUnit").toInt();
7272

7373
if (!settings.contains("strThirdPartyTxUrls"))

0 commit comments

Comments
 (0)