--- namecoin-nc0.3.75/namecoin-qt.pro +++ namecoin-nc0.3.75/namecoin-qt.pro @@ -3,7 +3,8 @@ macx:TARGET = "Namecoin-Qt" VERSION = 0.3.75 INCLUDEPATH += src src/json src/qt -QT += network +QT += core gui network +greaterThan(QT_MAJOR_VERSION, 4): QT += widgets DEFINES += GUI QT_GUI BOOST_THREAD_USE_LIB BOOST_SPIRIT_THREADSAFE CONFIG += no_include_pwd CONFIG += thread @@ -118,30 +119,27 @@ # Input DEPENDPATH += src src/json src/cryptopp src/qt -NAMECOIN_HEADERS = headers.h strlcpy.h serialize.h uint256.h util.h key.h bignum.h base58.h \ - script.h allocators.h db.h walletdb.h crypter.h net.h irc.h keystore.h main.h wallet.h bitcoinrpc.h uibase.h ui.h noui.h init.h auxpow.h +HEADERS += src/headers.h src/strlcpy.h src/serialize.h src/uint256.h src/util.h src/key.h src/bignum.h src/base58.h \ + src/script.h src/allocators.h src/db.h src/walletdb.h src/crypter.h src/net.h src/irc.h src/keystore.h src/main.h src/wallet.h src/bitcoinrpc.h src/uibase.h src/ui.h src/noui.h src/init.h src/auxpow.h -NAMECOIN_SOURCES = \ - auxpow.cpp \ - util.cpp \ - key.cpp \ - script.cpp \ - db.cpp \ - walletdb.cpp \ - crypter.cpp \ - net.cpp \ - irc.cpp \ - keystore.cpp \ - main.cpp \ - wallet.cpp \ - bitcoinrpc.cpp \ - init.cpp \ - cryptopp/sha.cpp \ - cryptopp/cpu.cpp \ - namecoin.cpp - -HEADERS += $$join(NAMECOIN_HEADERS, " src/", " src/",) -SOURCES += $$join(NAMECOIN_SOURCES, " src/", " src/",) +SOURCES += \ + src/auxpow.cpp \ + src/util.cpp \ + src/key.cpp \ + src/script.cpp \ + src/db.cpp \ + src/walletdb.cpp \ + src/crypter.cpp \ + src/net.cpp \ + src/irc.cpp \ + src/keystore.cpp \ + src/main.cpp \ + src/wallet.cpp \ + src/bitcoinrpc.cpp \ + src/init.cpp \ + src/cryptopp/sha.cpp \ + src/cryptopp/cpu.cpp \ + src/namecoin.cpp HEADERS += \ src/qt/netbase.h \ --- namecoin-nc0.3.75/src/qt/addressbookpage.cpp +++ namecoin-nc0.3.75.new/src/qt/addressbookpage.cpp @@ -140,8 +140,13 @@ // Set column widths ui->tableView->horizontalHeader()->resizeSection( AddressTableModel::Address, 320); +#if QT_VERSION < 0x050000 ui->tableView->horizontalHeader()->setResizeMode( AddressTableModel::Label, QHeaderView::Stretch); +#else + ui->tableView->horizontalHeader()->setSectionResizeMode( + AddressTableModel::Label, QHeaderView::Stretch); +#endif connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), this, SLOT(selectionChanged())); --- namecoin-nc0.3.75/src/qt/bitcoin.cpp +++ namecoin-nc0.3.75.new/src/qt/bitcoin.cpp @@ -20,7 +20,9 @@ #include #include +#if QT_VERSION < 0x050000 #include +#endif #include #include #include @@ -122,16 +124,14 @@ #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { - #ifndef WIN32 - SetupEnvironment(); - #endif - // Command-line options take precedence: ParseParameters(argc, argv); +#if QT_VERSION < 0x050000 // Internal string conversion is all UTF-8 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForCStrings(QTextCodec::codecForTr()); +#endif Q_INIT_RESOURCE(bitcoin); QApplication app(argc, argv); --- namecoin-nc0.3.75/src/qt/bitcoingui.cpp +++ namecoin-nc0.3.75.new/src/qt/bitcoingui.cpp @@ -49,10 +49,16 @@ #include #include #include +#if QT_VERSION < 0x050000 #include +#else +#include +#endif #include #include +#if QT_VERSION < 0x050000 #include +#endif #include #include @@ -933,7 +939,11 @@ void BitcoinGUI::backupWallet() { +#if QT_VERSION < 0x050000 QString saveDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); +#else + QString saveDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); +#endif QString filename = QFileDialog::getSaveFileName(this, tr("Backup Wallet"), saveDir, tr("Wallet Data (*.dat)")); if(!filename.isEmpty()) { if(!walletModel->backupWallet(filename)) { --- namecoin-nc0.3.75/src/qt/guiutil.cpp +++ namecoin-nc0.3.75.new/src/qt/guiutil.cpp @@ -14,8 +14,12 @@ #include #include #include +#if QT_VERSION >= 0x050000 +#include +#else #include -#include // For Qt::escape +#endif +#include // For Qt::mightBeRichText #include #include #include @@ -87,7 +91,12 @@ SendCoinsRecipient rv; rv.address = uri.path(); rv.amount = 0; +#if QT_VERSION < 0x050000 QList > items = uri.queryItems(); +#else + QUrlQuery uriQuery(uri); + QList > items = uriQuery.queryItems(); +#endif for (QList >::iterator i = items.begin(); i != items.end(); i++) { bool fShouldReturnFalse = false; @@ -140,7 +149,11 @@ QString HtmlEscape(const QString& str, bool fMultiLine) { +#if QT_VERSION < 0x050000 QString escaped = Qt::escape(str); +#else + QString escaped = str.toHtmlEscaped(); +#endif if(fMultiLine) { escaped = escaped.replace("\n", "
\n"); @@ -175,7 +188,11 @@ QString myDir; if(dir.isEmpty()) // Default to user documents location { +#if QT_VERSION < 0x050000 myDir = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); +#else + myDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation); +#endif } else { @@ -474,4 +491,4 @@ printf("SHGetSpecialFolderPathA() failed, could not obtain requested path.\n"); return fs::path(""); } -#endif \ No newline at end of file +#endif --- namecoin-nc0.3.75/src/qt/managenamespage.cpp +++ namecoin-nc0.3.75.new/src/qt/managenamespage.cpp @@ -162,8 +162,13 @@ // Set column widths ui->tableView->horizontalHeader()->resizeSection( NameTableModel::Name, COLUMN_WIDTH_NAME); +#if QT_VERSION < 0x050000 ui->tableView->horizontalHeader()->setResizeMode( NameTableModel::Value, QHeaderView::Stretch); +#else + ui->tableView->horizontalHeader()->setSectionResizeMode( + NameTableModel::Value, QHeaderView::Stretch); +#endif ui->tableView->horizontalHeader()->resizeSection( NameTableModel::Address, COLUMN_WIDTH_ADDRESS); ui->tableView->horizontalHeader()->resizeSection( --- namecoin-nc0.3.75/src/qt/overviewpage.cpp +++ namecoin-nc0.3.75.new/src/qt/overviewpage.cpp @@ -46,7 +46,11 @@ bool confirmed = index.data(TransactionTableModel::ConfirmedRole).toBool(); QVariant value = index.data(Qt::ForegroundRole); QColor foreground = option.palette.color(QPalette::Text); +#if QT_VERSION < 0x050000 if(qVariantCanConvert(value)) +#else + if(value.canConvert(QMetaType::QColor)) +#endif { foreground = qvariant_cast(value); } --- namecoin-nc0.3.75/src/qt/sendcoinsdialog.cpp +++ namecoin-nc0.3.75.new/src/qt/sendcoinsdialog.cpp @@ -94,7 +94,11 @@ QStringList formatted; foreach(const SendCoinsRecipient &rcp, recipients) { +#if QT_VERSION < 0x050000 formatted.append(tr("%1 to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), Qt::escape(rcp.label), rcp.address)); +#else + formatted.append(tr("%1 to %2 (%3)").arg(BitcoinUnits::formatWithUnit(BitcoinUnits::BTC, rcp.amount), rcp.label.toHtmlEscaped(), rcp.address)); +#endif } fNewRecipientAllowed = false; --- namecoin-nc0.3.75/src/qt/transactionview.cpp +++ namecoin-nc0.3.75.new/src/qt/transactionview.cpp @@ -174,7 +174,11 @@ transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Status, 23); transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Date, 120); transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Type, 120); +#if QT_VERSION < 0x050000 transactionView->horizontalHeader()->setResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch); +#else + transactionView->horizontalHeader()->setSectionResizeMode(TransactionTableModel::ToAddress, QHeaderView::Stretch); +#endif transactionView->horizontalHeader()->resizeSection(TransactionTableModel::Amount, 100); } }