Make Qt GUI to compile and run

Signed-off-by: Anthony Fieroni <bvbfan@abv.bg>
This commit is contained in:
Anthony Fieroni 2019-12-27 14:04:24 +02:00 committed by Brannon King
parent 03a72e4723
commit fbba425901
14 changed files with 43 additions and 40 deletions

View file

@ -443,10 +443,10 @@ CLEAN_QT = $(nodist_qt_libbitcoinqt_a_SOURCES) $(QT_QM) $(QT_FORMS_H) qt/*.gcda
CLEANFILES += $(CLEAN_QT)
bitcoin_qt_clean: FORCE
lbrycrd_qt_clean: FORCE
rm -f $(CLEAN_QT) $(qt_libbitcoinqt_a_OBJECTS) $(qt_lbrycrd_qt_OBJECTS) qt/lbrycrd-qt$(EXEEXT) $(LIBBITCOINQT)
bitcoin_qt : qt/lbrycrd-qt$(EXEEXT)
lbrycrd_qt : qt/lbrycrd-qt$(EXEEXT)
ui_%.h: %.ui
@test -f $(UIC)

View file

@ -4,6 +4,7 @@
bin_PROGRAMS += qt/test/test_lbrycrd-qt
TESTS += qt/test/test_lbrycrd-qt
TEST_QT_BINARY=qt/test/test_lbrycrd-qt$(EXEEXT)
TEST_QT_MOC_CPP = \
qt/test/moc_compattests.cpp \
@ -73,10 +74,10 @@ CLEAN_BITCOIN_QT_TEST = $(TEST_QT_MOC_CPP) qt/test/*.gcda qt/test/*.gcno
CLEANFILES += $(CLEAN_BITCOIN_QT_TEST)
test_lbrycrd_qt : qt/test/test_bitcoin-qt$(EXEEXT)
test_lbrycrd_qt : $(TEST_QT_BINARY)
test_lbrycrd_qt_check : qt/test/test_bitcoin-qt$(EXEEXT) FORCE
test_lbrycrd_qt_check : $(TEST_QT_BINARY) FORCE
$(MAKE) check-TESTS TESTS=$^
test_lbrycrd_qt_clean: FORCE
rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_lbrycrd_qt_OBJECTS)
rm -f $(CLEAN_BITCOIN_QT_TEST) $(qt_test_test_lbrycrd_qt_OBJECTS) $(TEST_QT_BINARY)

View file

@ -1,9 +1,9 @@
.PHONY: FORCE
all: FORCE
$(MAKE) -C .. bitcoin_qt test_bitcoin_qt
$(MAKE) -C .. lbrycrd_qt test_lbrycrd_qt
clean: FORCE
$(MAKE) -C .. bitcoin_qt_clean test_bitcoin_qt_clean
$(MAKE) -C .. lbrycrd_qt_clean test_lbrycrd_qt_clean
check: FORCE
$(MAKE) -C .. test_bitcoin_qt_check
bitcoin-qt bitcoin-qt.exe: FORCE
$(MAKE) -C .. bitcoin_qt
$(MAKE) -C .. test_lbrycrd_qt_check
lbrycrd-qt lbrycrd-qt.exe: FORCE
$(MAKE) -C .. lbrycrd_qt

View file

@ -1,4 +1,4 @@
This directory contains the BitcoinQT graphical user interface (GUI). It uses the cross-platform framework [Qt](https://www1.qt.io/developers/).
This directory contains the LBRY-QT graphical user interface (GUI). It uses the cross-platform framework [Qt](https://www1.qt.io/developers/).
The current precise version for Qt 5 is specified in [qt.mk](/depends/packages/qt.mk).
@ -9,7 +9,7 @@ See build instructions ([macOS](/doc/build-osx.md), [Windows](/doc/build-windows
To run:
```sh
./src/qt/bitcoin-qt
./src/qt/lbrycrd-qt
```
## Files and directories
@ -32,7 +32,7 @@ Tests.
### bitcoingui.(h/cpp)
Represents the main window of the Bitcoin UI.
Represents the main window of the LBRY UI.
### \*model.(h/cpp)
@ -86,10 +86,10 @@ Instructions for macOS:
1. Make sure you installed everything through Homebrew mentioned in the [macOS build instructions](/doc/build-osx.md)
2. Use `./configure` with the `--enable-debug` flag
3. In Qt Creator do "New Project" -> Import Project -> Import Existing Project
4. Enter "bitcoin-qt" as project name, enter src/qt as location
4. Enter "lbrycrd-qt" as project name, enter src/qt as location
5. Leave the file selection as it is
6. Confirm the "summary page"
7. In the "Projects" tab select "Manage Kits..."
8. Select the default "Desktop" kit and select "Clang (x86 64bit in /usr/bin)" as compiler
9. Select LLDB as debugger (you might need to set the path to your installation)
10. Start debugging with Qt Creator (you might need to the executable to "bitcoin-qt" under "Run", which is where you can also add command line arguments)
10. Start debugging with Qt Creator (you might need to the executable to "lbrycrd-qt" under "Run", which is where you can also add command line arguments)

View file

@ -564,7 +564,6 @@ int main(int argc, char *argv[])
Q_INIT_RESOURCE(bitcoin);
Q_INIT_RESOURCE(bitcoin_locale);
BitcoinApplication app(*node, argc, argv);
#if QT_VERSION > 0x050100
// Generate high-dpi pixmaps
QApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
@ -576,6 +575,7 @@ int main(int argc, char *argv[])
QApplication::setAttribute(Qt::AA_DontShowIconsInMenus);
#endif
BitcoinApplication app(*node, argc, argv);
// Register meta types used for QMetaObject::invokeMethod
qRegisterMetaType< bool* >();
// Need to pass name here as CAmount is a typedef (see http://qt-project.org/doc/qt-5/qmetatype.html#qRegisterMetaType)

View file

@ -46,10 +46,10 @@ static const int MAX_URI_LENGTH = 255;
/* Number of frames in spinner animation */
#define SPINNER_FRAMES 36
#define QAPP_ORG_NAME "Bitcoin"
#define QAPP_ORG_DOMAIN "bitcoin.org"
#define QAPP_APP_NAME_DEFAULT "Bitcoin-Qt"
#define QAPP_APP_NAME_TESTNET "Bitcoin-Qt-testnet"
#define QAPP_APP_NAME_REGTEST "Bitcoin-Qt-regtest"
#define QAPP_ORG_NAME "LBRY"
#define QAPP_ORG_DOMAIN "lbry.com"
#define QAPP_APP_NAME_DEFAULT QAPP_ORG_NAME "-Qt"
#define QAPP_APP_NAME_TESTNET QAPP_APP_NAME_DEFAULT "-testnet"
#define QAPP_APP_NAME_REGTEST QAPP_APP_NAME_DEFAULT "-regtest"
#endif // BITCOIN_QT_GUICONSTANTS_H

View file

@ -2,6 +2,7 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/bitcoinaddressvalidator.h>
@ -698,9 +699,9 @@ bool SetStartOnSystemStartup(bool fAutoStart)
optionFile << "[Desktop Entry]\n";
optionFile << "Type=Application\n";
if (chain == CBaseChainParams::MAIN)
optionFile << "Name=Bitcoin\n";
optionFile << "Name=" << QAPP_ORG_NAME << '\n';
else
optionFile << strprintf("Name=Bitcoin (%s)\n", chain);
optionFile << strprintf("Name=%s (%s)\n", QAPP_ORG_NAME, chain);
optionFile << "Exec=" << pszExePath << strprintf(" -min -testnet=%d -regtest=%d\n", gArgs.GetBoolArg("-testnet", false), gArgs.GetBoolArg("-regtest", false));
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";

View file

@ -2,15 +2,12 @@
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#if defined(HAVE_CONFIG_H)
#include <config/bitcoin-config.h>
#endif
#include <qt/optionsmodel.h>
#include <qt/bitcoinunits.h>
#include <qt/guiutil.h>
#include <clientversion.h>
#include <interfaces/node.h>
#include <validation.h> // For DEFAULT_SCRIPTCHECK_THREADS
#include <net.h>

View file

@ -1,6 +1,6 @@
all:
$(MAKE) -C ../../ test_bitcoin_qt
$(MAKE) -C ../../ test_lbrycrd_qt
clean:
$(MAKE) -C ../../ test_bitcoin_qt_clean
$(MAKE) -C ../../ test_lbrycrd_qt_clean
check:
$(MAKE) -C ../../ test_bitcoin_qt_check
$(MAKE) -C ../../ test_lbrycrd_qt_check

View file

@ -147,7 +147,7 @@ void AddressBookTests::addressBookTests()
// and fails to handle returned nulls
// (https://bugreports.qt.io/browse/QTBUG-49686).
QWARN("Skipping AddressBookTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
"with 'test_bitcoin-qt -platform cocoa' on mac, or else use a linux or windows build.");
"with 'test_lbrycrd-qt -platform cocoa' on mac, or else use a linux or windows build.");
return;
}
#endif

View file

@ -7,6 +7,7 @@
#endif
#include <chainparams.h>
#include <qt/guiconstants.h>
#include <qt/test/rpcnestedtests.h>
#include <util.h>
#include <qt/test/uritests.h>
@ -48,7 +49,7 @@ int main(int argc, char *argv[])
SelectParams(CBaseChainParams::MAIN);
noui_connect();
ClearDatadirCache();
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_bitcoin-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
fs::path pathTemp = fs::temp_directory_path() / strprintf("test_lbrycrd-qt_%lu_%i", (unsigned long)GetTime(), (int)GetRand(100000));
fs::create_directories(pathTemp);
gArgs.ForceSetArg("-datadir", pathTemp.string());
@ -66,7 +67,7 @@ int main(int argc, char *argv[])
// Don't remove this, it's needed to access
// QApplication:: and QCoreApplication:: in the tests
QApplication app(argc, argv);
app.setApplicationName("Bitcoin-Qt-test");
app.setApplicationName(QAPP_APP_NAME_DEFAULT "-test");
SSL_library_init();

View file

@ -123,9 +123,9 @@ void BumpFee(TransactionView& view, const uint256& txid, bool expectDisabled, st
//
// This also requires overriding the default minimal Qt platform:
//
// src/qt/test/test_bitcoin-qt -platform xcb # Linux
// src/qt/test/test_bitcoin-qt -platform windows # Windows
// src/qt/test/test_bitcoin-qt -platform cocoa # macOS
// src/qt/test/test_lbrycrd-qt -platform xcb # Linux
// src/qt/test/test_lbrycrd-qt -platform windows # Windows
// src/qt/test/test_lbrycrd-qt -platform cocoa # macOS
void TestGUI()
{
// Set up wallet and chain with 105 blocks (5 mature blocks for spending).
@ -250,11 +250,11 @@ void WalletTests::walletTests()
// and fails to handle returned nulls
// (https://bugreports.qt.io/browse/QTBUG-49686).
QWARN("Skipping WalletTests on mac build with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
"with 'test_bitcoin-qt -platform cocoa' on mac, or else use a linux or windows build.");
"with 'test_lbrycrd-qt -platform cocoa' on mac, or else use a linux or windows build.");
return;
}
#endif
//TestGUI();
QWARN("Skipping WalletTests with 'minimal' platform set due to Qt bugs. To run AppTests, invoke "
"with 'test_bitcoin-qt -platform cocoa' on mac, or else use a linux or windows build.");
"with 'test_lbrycrd-qt -platform cocoa' on mac, or else use a linux or windows build.");
}

View file

@ -70,7 +70,7 @@ HelpMessageDialog::HelpMessageDialog(interfaces::Node& node, QWidget *parent, bo
ui->helpMessage->setVisible(false);
} else {
setWindowTitle(tr("Command-line options"));
QString header = "Usage: bitcoin-qt [command-line options] \n";
QString header = "Usage: lbrycrd-qt [command-line options] \n";
QTextCursor cursor(ui->helpMessage->document());
cursor.insertText(version);
cursor.insertBlock();

View file

@ -22,8 +22,10 @@
#include <script/sigcache.h>
#include <txdb.h>
#ifdef BOOST_TEST_DYN_LINK // do not include in qt
#include <boost/test/unit_test.hpp>
#include <boost/test/unit_test_parameters.hpp>
#endif
void CConnmanTest::AddNode(CNode& node)
{
@ -78,6 +80,7 @@ std::ostream& operator<<(std::ostream& os, const CSupportValue& support)
BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
: m_path_root(fs::temp_directory_path() / "test_lbrycrd" / strprintf("%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(1 << 30))))
{
#ifdef BOOST_TEST_DYN_LINK // do not include in qt
// for debugging:
if (boost::unit_test::runtime_config::get<boost::unit_test::log_level>(boost::unit_test::runtime_config::btrt_log_level)
<= boost::unit_test::log_level::log_messages) {
@ -86,7 +89,7 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
g_logger->EnableCategory(BCLog::ALL);
CLogPrint::global().setLogger(g_logger);
}
#endif
SHA256AutoDetect();
RandomInit();
ECC_Start();