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
parent 10d0e58f9d
commit 423e158876
13 changed files with 37 additions and 46 deletions

View file

@ -377,10 +377,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_apptests.cpp \
@ -82,10 +83,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

@ -42,11 +42,11 @@ static const int TOOLTIP_WRAP_THRESHOLD = 80;
/* 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"
/* One gigabyte (GB) in bytes */
static constexpr uint64_t GB_BYTES{1000000000};

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>
@ -691,9 +692,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 -chain=%s\n", chain);
optionFile << "Terminal=false\n";
optionFile << "Hidden=false\n";

View file

@ -2,16 +2,13 @@
// 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/guiconstants.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

@ -146,7 +146,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 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
"with 'QT_QPA_PLATFORM=cocoa test_lbrycrd-qt' on mac, or else use a linux or windows build.");
return;
}
#endif

View file

@ -8,6 +8,7 @@
#include <interfaces/node.h>
#include <qt/bitcoin.h>
#include <qt/guiconstants.h>
#include <qt/test/apptests.h>
#include <qt/test/rpcnestedtests.h>
#include <qt/test/uritests.h>
@ -69,7 +70,7 @@ int main(int argc, char *argv[])
// Don't remove this, it's needed to access
// QApplication:: and QCoreApplication:: in the tests
BitcoinApplication app(*node);
app.setApplicationName("Bitcoin-Qt-test");
app.setApplicationName(QAPP_APP_NAME_DEFAULT "-test");
AppTests app_tests(app);
if (QTest::qExec(&app_tests) != 0) {

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:
//
// QT_QPA_PLATFORM=xcb src/qt/test/test_bitcoin-qt # Linux
// QT_QPA_PLATFORM=windows src/qt/test/test_bitcoin-qt # Windows
// QT_QPA_PLATFORM=cocoa src/qt/test/test_bitcoin-qt # macOS
// QT_QPA_PLATFORM=xcb src/qt/test/test_lbrycrd-qt # Linux
// QT_QPA_PLATFORM=windows src/qt/test/test_lbrycrd-qt # Windows
// QT_QPA_PLATFORM=cocoa src/qt/test/test_lbrycrd-qt # macOS
void TestGUI()
{
// Set up wallet and chain with 105 blocks (5 mature blocks for spending).
@ -256,11 +256,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 'QT_QPA_PLATFORM=cocoa test_bitcoin-qt' on mac, or else use a linux or windows build.");
"with 'QT_QPA_PLATFORM=cocoa test_lbrycrd-qt' 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

@ -68,7 +68,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

@ -72,14 +72,6 @@ std::ostream& operator<<(std::ostream& os, const CSupportValue& support)
BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
: m_path_root(fs::temp_directory_path() / "test_common_" PACKAGE_NAME / strprintf("%lu_%i", (unsigned long)GetTime(), (int)(InsecureRandRange(1 << 30))))
{
// 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) {
g_logger->m_print_to_console = true;
g_logger->m_log_time_micros = true;
g_logger->EnableCategory(BCLog::ALL);
CLogPrint::global().setLogger(g_logger);
}
fs::create_directories(m_path_root);
gArgs.ForceSetArg("-datadir", m_path_root.string());
ClearDatadirCache();
@ -87,7 +79,6 @@ BasicTestingSetup::BasicTestingSetup(const std::string& chainName)
gArgs.ForceSetArg("-printtoconsole", "0");
InitLogging();
LogInstance().StartLogging();
SHA256AutoDetect();
ECC_Start();
SetupEnvironment();