mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
qt: define QT_NO_KEYWORDS
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.
This commit is contained in:
@@ -60,10 +60,10 @@ class RPCExecutor : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public slots:
|
||||
public Q_SLOTS:
|
||||
void request(const QString &command);
|
||||
|
||||
signals:
|
||||
Q_SIGNALS:
|
||||
void reply(int category, const QString &command);
|
||||
};
|
||||
|
||||
@@ -95,7 +95,7 @@ bool parseCommandLine(std::vector<std::string> &args, const std::string &strComm
|
||||
STATE_ESCAPE_DOUBLEQUOTED
|
||||
} state = STATE_EATING_SPACES;
|
||||
std::string curarg;
|
||||
foreach(char ch, strCommand)
|
||||
Q_FOREACH(char ch, strCommand)
|
||||
{
|
||||
switch(state)
|
||||
{
|
||||
@@ -158,7 +158,7 @@ void RPCExecutor::request(const QString &command)
|
||||
std::vector<std::string> args;
|
||||
if(!parseCommandLine(args, command.toStdString()))
|
||||
{
|
||||
emit reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \""));
|
||||
Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Parse error: unbalanced ' or \""));
|
||||
return;
|
||||
}
|
||||
if(args.empty())
|
||||
@@ -180,7 +180,7 @@ void RPCExecutor::request(const QString &command)
|
||||
else
|
||||
strPrint = result.write(2);
|
||||
|
||||
emit reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
|
||||
Q_EMIT reply(RPCConsole::CMD_REPLY, QString::fromStdString(strPrint));
|
||||
}
|
||||
catch (UniValue& objError)
|
||||
{
|
||||
@@ -188,16 +188,16 @@ void RPCExecutor::request(const QString &command)
|
||||
{
|
||||
int code = find_value(objError, "code").get_int();
|
||||
std::string message = find_value(objError, "message").get_str();
|
||||
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")");
|
||||
Q_EMIT reply(RPCConsole::CMD_ERROR, QString::fromStdString(message) + " (code " + QString::number(code) + ")");
|
||||
}
|
||||
catch (const std::runtime_error&) // raised when converting to invalid type, i.e. missing code or message
|
||||
{ // Show raw JSON object
|
||||
emit reply(RPCConsole::CMD_ERROR, QString::fromStdString(objError.write()));
|
||||
Q_EMIT reply(RPCConsole::CMD_ERROR, QString::fromStdString(objError.write()));
|
||||
}
|
||||
}
|
||||
catch (const std::exception& e)
|
||||
{
|
||||
emit reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
|
||||
Q_EMIT reply(RPCConsole::CMD_ERROR, QString("Error: ") + QString::fromStdString(e.what()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -245,7 +245,7 @@ RPCConsole::RPCConsole(QWidget *parent) :
|
||||
RPCConsole::~RPCConsole()
|
||||
{
|
||||
GUIUtil::saveWindowGeometry("nRPCConsoleWindow", this);
|
||||
emit stopExecutor();
|
||||
Q_EMIT stopExecutor();
|
||||
delete ui;
|
||||
}
|
||||
|
||||
@@ -431,7 +431,7 @@ void RPCConsole::on_lineEdit_returnPressed()
|
||||
if(!cmd.isEmpty())
|
||||
{
|
||||
message(CMD_REQUEST, cmd);
|
||||
emit cmdRequest(cmd);
|
||||
Q_EMIT cmdRequest(cmd);
|
||||
// Remove command, if already in history
|
||||
history.removeOne(cmd);
|
||||
// Append command to history
|
||||
|
||||
Reference in New Issue
Block a user