Skip to content

Commit

Permalink
qt: define QT_NO_KEYWORDS
Browse files Browse the repository at this point in the history
QT_NO_KEYWORDS prevents Qt from defining the `foreach`, `signals`,
`slots` and `emit` macros.

Avoid overlap between Qt macros and boost - for example #undef hackiness
in #6421.
  • Loading branch information
laanwj committed Jul 15, 2015
1 parent fd5dfda commit d29ec6c
Show file tree
Hide file tree
Showing 66 changed files with 184 additions and 184 deletions.
2 changes: 1 addition & 1 deletion src/Makefile.qt.include
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ RES_MOVIES = $(wildcard qt/res/movies/spinner-*.png)
BITCOIN_RC = qt/res/bitcoin-qt-res.rc

BITCOIN_QT_INCLUDES = -I$(builddir)/qt -I$(srcdir)/qt -I$(srcdir)/qt/forms \
-I$(builddir)/qt/forms
-I$(builddir)/qt/forms -DQT_NO_KEYWORDS

qt_libbitcoinqt_a_CPPFLAGS = $(BITCOIN_INCLUDES) $(BITCOIN_QT_INCLUDES) \
$(QT_INCLUDES) $(QT_DBUS_INCLUDES) $(PROTOBUF_CFLAGS) $(QR_CFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion src/qt/addressbookpage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void AddressBookPage::done(int retval)
// Figure out which address was selected, and return it
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);

foreach (const QModelIndex& index, indexes) {
Q_FOREACH (const QModelIndex& index, indexes) {
QVariant address = table->model()->data(index);
returnValue = address.toString();
}
Expand Down
6 changes: 3 additions & 3 deletions src/qt/addressbookpage.h
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ class AddressBookPage : public QDialog
void setModel(AddressTableModel *model);
const QString &getReturnValue() const { return returnValue; }

public slots:
public Q_SLOTS:
void done(int retval);

private:
Expand All @@ -59,7 +59,7 @@ public slots:
QAction *deleteAction; // to be able to explicitly disable it
QString newAddressToSelect;

private slots:
private Q_SLOTS:
/** Delete currently selected address entry */
void on_deleteAddress_clicked();
/** Create a new address for receiving coins and / or add a new address book entry */
Expand All @@ -80,7 +80,7 @@ private slots:
/** New entry/entries were added to address table */
void selectNewAddress(const QModelIndex &parent, int begin, int /*end*/);

signals:
Q_SIGNALS:
void sendCoins(QString addr);
};

Expand Down
2 changes: 1 addition & 1 deletion src/qt/addresstablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -450,5 +450,5 @@ int AddressTableModel::lookupAddress(const QString &address) const

void AddressTableModel::emitDataChanged(int idx)
{
emit dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length()-1, QModelIndex()));
Q_EMIT dataChanged(index(idx, 0, QModelIndex()), index(idx, columns.length()-1, QModelIndex()));
}
2 changes: 1 addition & 1 deletion src/qt/addresstablemodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ class AddressTableModel : public QAbstractTableModel
/** Notify listeners that data changed. */
void emitDataChanged(int index);

public slots:
public Q_SLOTS:
/* Update address list from core.
*/
void updateEntry(const QString &address, const QString &label, bool isMine, const QString &purpose, int status);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/askpassphrasedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class AskPassphraseDialog : public QDialog
WalletModel *model;
bool fCapsLock;

private slots:
private Q_SLOTS:
void textChanged();

protected:
Expand Down
22 changes: 11 additions & 11 deletions src/qt/bitcoin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,11 +169,11 @@ class BitcoinCore: public QObject
public:
explicit BitcoinCore();

public slots:
public Q_SLOTS:
void initialize();
void shutdown();

signals:
Q_SIGNALS:
void initializeResult(int retval);
void shutdownResult(int retval);
void runawayException(const QString &message);
Expand Down Expand Up @@ -216,13 +216,13 @@ class BitcoinApplication: public QApplication
/// Get window identifier of QMainWindow (BitcoinGUI)
WId getMainWinId() const;

public slots:
public Q_SLOTS:
void initializeResult(int retval);
void shutdownResult(int retval);
/// Handle runaway exceptions. Shows a message box with the problem and quits the program.
void handleRunawayException(const QString &message);

signals:
Q_SIGNALS:
void requestedInitialize();
void requestedShutdown();
void stopThread();
Expand Down Expand Up @@ -253,7 +253,7 @@ BitcoinCore::BitcoinCore():
void BitcoinCore::handleRunawayException(const std::exception *e)
{
PrintExceptionContinue(e, "Runaway exception");
emit runawayException(QString::fromStdString(strMiscWarning));
Q_EMIT runawayException(QString::fromStdString(strMiscWarning));
}

void BitcoinCore::initialize()
Expand All @@ -269,7 +269,7 @@ void BitcoinCore::initialize()
*/
StartDummyRPCThread();
}
emit initializeResult(rv);
Q_EMIT initializeResult(rv);
} catch (const std::exception& e) {
handleRunawayException(&e);
} catch (...) {
Expand All @@ -286,7 +286,7 @@ void BitcoinCore::shutdown()
threadGroup.join_all();
Shutdown();
qDebug() << __func__ << ": Shutdown finished";
emit shutdownResult(1);
Q_EMIT shutdownResult(1);
} catch (const std::exception& e) {
handleRunawayException(&e);
} catch (...) {
Expand Down Expand Up @@ -315,7 +315,7 @@ BitcoinApplication::~BitcoinApplication()
if(coreThread)
{
qDebug() << __func__ << ": Stopping thread";
emit stopThread();
Q_EMIT stopThread();
coreThread->wait();
qDebug() << __func__ << ": Stopped thread";
}
Expand Down Expand Up @@ -386,7 +386,7 @@ void BitcoinApplication::requestInitialize()
{
qDebug() << __func__ << ": Requesting initialize";
startThread();
emit requestedInitialize();
Q_EMIT requestedInitialize();
}

void BitcoinApplication::requestShutdown()
Expand All @@ -409,7 +409,7 @@ void BitcoinApplication::requestShutdown()
ShutdownWindow::showShutdownWindow(window);

// Request shutdown from core thread
emit requestedShutdown();
Q_EMIT requestedShutdown();
}

void BitcoinApplication::initializeResult(int retval)
Expand Down Expand Up @@ -449,7 +449,7 @@ void BitcoinApplication::initializeResult(int retval)
{
window->show();
}
emit splashFinished(window);
Q_EMIT splashFinished(window);

#ifdef ENABLE_WALLET
// Now that initialization/startup is done, process any command-line
Expand Down
4 changes: 2 additions & 2 deletions src/qt/bitcoinamountfield.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class AmountSpinBox: public QAbstractSpinBox
void setValue(const CAmount& value)
{
lineEdit()->setText(BitcoinUnits::format(currentUnit, value, false, BitcoinUnits::separatorAlways));
emit valueChanged();
Q_EMIT valueChanged();
}

void stepBy(int steps)
Expand Down Expand Up @@ -184,7 +184,7 @@ class AmountSpinBox: public QAbstractSpinBox
return rv;
}

signals:
Q_SIGNALS:
void valueChanged();
};

Expand Down
4 changes: 2 additions & 2 deletions src/qt/bitcoinamountfield.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class BitcoinAmountField: public QWidget
*/
QWidget *setupTabChain(QWidget *prev);

signals:
Q_SIGNALS:
void valueChanged();

protected:
Expand All @@ -67,7 +67,7 @@ class BitcoinAmountField: public QWidget
AmountSpinBox *amount;
QValueComboBox *unit;

private slots:
private Q_SLOTS:
void unitChanged(int idx);

};
Expand Down
10 changes: 5 additions & 5 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -600,7 +600,7 @@ void BitcoinGUI::openClicked()
OpenURIDialog dlg(this);
if(dlg.exec())
{
emit receivedURI(dlg.getURI());
Q_EMIT receivedURI(dlg.getURI());
}
}

Expand Down Expand Up @@ -886,9 +886,9 @@ void BitcoinGUI::dropEvent(QDropEvent *event)
{
if(event->mimeData()->hasUrls())
{
foreach(const QUrl &uri, event->mimeData()->urls())
Q_FOREACH(const QUrl &uri, event->mimeData()->urls())
{
emit receivedURI(uri.toString());
Q_EMIT receivedURI(uri.toString());
}
}
event->acceptProposedAction();
Expand Down Expand Up @@ -1050,7 +1050,7 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() :
QList<BitcoinUnits::Unit> units = BitcoinUnits::availableUnits();
int max_width = 0;
const QFontMetrics fm(font());
foreach (const BitcoinUnits::Unit unit, units)
Q_FOREACH (const BitcoinUnits::Unit unit, units)
{
max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit)));
}
Expand All @@ -1069,7 +1069,7 @@ void UnitDisplayStatusBarControl::mousePressEvent(QMouseEvent *event)
void UnitDisplayStatusBarControl::createContextMenu()
{
menu = new QMenu();
foreach(BitcoinUnits::Unit u, BitcoinUnits::availableUnits())
Q_FOREACH(BitcoinUnits::Unit u, BitcoinUnits::availableUnits())
{
QAction *menuAction = new QAction(QString(BitcoinUnits::name(u)), this);
menuAction->setData(QVariant(u));
Expand Down
8 changes: 4 additions & 4 deletions src/qt/bitcoingui.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,11 @@ class BitcoinGUI : public QMainWindow
/** Disconnect core signals from GUI client */
void unsubscribeFromCoreSignals();

signals:
Q_SIGNALS:
/** Signal raised when a URI was entered or dragged to the GUI */
void receivedURI(const QString &uri);

public slots:
public Q_SLOTS:
/** Set number of connections shown in the UI */
void setNumConnections(int count);
/** Set number of blocks and last block date shown in the UI */
Expand Down Expand Up @@ -168,7 +168,7 @@ public slots:
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, const QString& label);
#endif // ENABLE_WALLET

private slots:
private Q_SLOTS:
#ifdef ENABLE_WALLET
/** Switch to overview (home) page */
void gotoOverviewPage();
Expand Down Expand Up @@ -232,7 +232,7 @@ class UnitDisplayStatusBarControl : public QLabel
/** Creates context menu, its actions, and wires up all the relevant signals for mouse events. */
void createContextMenu();

private slots:
private Q_SLOTS:
/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */
void updateDisplayUnit(int newUnits);
/** Tells underlying optionsModel to update its current display unit. */
Expand Down
10 changes: 5 additions & 5 deletions src/qt/clientmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,15 @@ void ClientModel::updateTimer()
cachedReindexing = fReindex;
cachedImporting = fImporting;

emit numBlocksChanged(newNumBlocks, newBlockDate);
Q_EMIT numBlocksChanged(newNumBlocks, newBlockDate);
}

emit bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
Q_EMIT bytesChanged(getTotalBytesRecv(), getTotalBytesSent());
}

void ClientModel::updateNumConnections(int numConnections)
{
emit numConnectionsChanged(numConnections);
Q_EMIT numConnectionsChanged(numConnections);
}

void ClientModel::updateAlert(const QString &hash, int status)
Expand All @@ -138,11 +138,11 @@ void ClientModel::updateAlert(const QString &hash, int status)
CAlert alert = CAlert::getAlertByHash(hash_256);
if(!alert.IsNull())
{
emit message(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), CClientUIInterface::ICON_ERROR);
Q_EMIT message(tr("Network Alert"), QString::fromStdString(alert.strStatusBar), CClientUIInterface::ICON_ERROR);
}
}

emit alertsChanged(getStatusBarWarnings());
Q_EMIT alertsChanged(getStatusBarWarnings());
}

bool ClientModel::inInitialBlockDownload() const
Expand Down
4 changes: 2 additions & 2 deletions src/qt/clientmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ClientModel : public QObject
void subscribeToCoreSignals();
void unsubscribeFromCoreSignals();

signals:
Q_SIGNALS:
void numConnectionsChanged(int count);
void numBlocksChanged(int count, const QDateTime& blockDate);
void alertsChanged(const QString &warnings);
Expand All @@ -94,7 +94,7 @@ class ClientModel : public QObject
// Show progress dialog e.g. for verifychain
void showProgress(const QString &title, int nProgress);

public slots:
public Q_SLOTS:
void updateTimer();
void updateNumConnections(int numConnections);
void updateAlert(const QString &hash, int status);
Expand Down
2 changes: 1 addition & 1 deletion src/qt/coincontroldialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -461,7 +461,7 @@ void CoinControlDialog::updateLabels(WalletModel *model, QDialog* dialog)
CAmount nPayAmount = 0;
bool fDust = false;
CMutableTransaction txDummy;
foreach(const CAmount &amount, CoinControlDialog::payAmounts)
Q_FOREACH(const CAmount &amount, CoinControlDialog::payAmounts)
{
nPayAmount += amount;

Expand Down
2 changes: 1 addition & 1 deletion src/qt/coincontroldialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class CoinControlDialog : public QDialog
return column;
}

private slots:
private Q_SLOTS:
void showMenu(const QPoint &);
void copyAmount();
void copyLabel();
Expand Down
2 changes: 1 addition & 1 deletion src/qt/editaddressdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class EditAddressDialog : public QDialog
QString getAddress() const;
void setAddress(const QString &address);

public slots:
public Q_SLOTS:
void accept();

private:
Expand Down
2 changes: 1 addition & 1 deletion src/qt/guiutil.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ namespace GUIUtil
void setViewHeaderResizeMode(int logicalIndex, QHeaderView::ResizeMode resizeMode);
void resizeColumn(int nColumnIndex, int width);

private slots:
private Q_SLOTS:
void on_sectionResized(int logicalIndex, int oldSize, int newSize);
void on_geometriesChanged();
};
Expand Down
10 changes: 5 additions & 5 deletions src/qt/intro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ class FreespaceChecker : public QObject
ST_ERROR
};

public slots:
public Q_SLOTS:
void check();

signals:
Q_SIGNALS:
void reply(int status, const QString &message, quint64 available);

private:
Expand Down Expand Up @@ -102,7 +102,7 @@ void FreespaceChecker::check()
replyStatus = ST_ERROR;
replyMessage = tr("Cannot create data directory here.");
}
emit reply(replyStatus, replyMessage, freeBytesAvailable);
Q_EMIT reply(replyStatus, replyMessage, freeBytesAvailable);
}


Expand All @@ -121,7 +121,7 @@ Intro::~Intro()
{
delete ui;
/* Ensure thread is finished before it is deleted */
emit stopThread();
Q_EMIT stopThread();
thread->wait();
}

Expand Down Expand Up @@ -277,7 +277,7 @@ void Intro::checkPath(const QString &dataDir)
if(!signalled)
{
signalled = true;
emit requestCheck();
Q_EMIT requestCheck();
}
mutex.unlock();
}
Expand Down
Loading

0 comments on commit d29ec6c

Please sign in to comment.