Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

base fixes for a more recent Qt version #80

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions qamqp.pri
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
QAMQP_VERSION = 0.5.0
QAMQP_VERSION = 0.6.0

isEmpty(QAMQP_LIBRARY_TYPE) {
QAMQP_LIBRARY_TYPE = shared
Expand All @@ -8,7 +8,7 @@ QT += network
QAMQP_INCLUDEPATH = $${PWD}/src
QAMQP_LIBS = -lqamqp
CONFIG(debug, debug|release){
QAMQP_LIBS = -lqamqpd
win32:QAMQP_LIBS = -lqamqpd
}
contains(QAMQP_LIBRARY_TYPE, staticlib) {
DEFINES += QAMQP_STATIC
Expand Down
3 changes: 2 additions & 1 deletion src/qamqpInterface.pri
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
INCLUDEPATH += $${PWD}

CONFIG(debug, debug|release){
LIBS += -L$$PWD -lqamqpd
win32:LIBS += -L$$PWD -lqamqpd
unix:LIBS += -L$$PWD -lqamqp
} else {
LIBS += -L$$PWD -lqamqp
}
4 changes: 2 additions & 2 deletions src/qamqpauthenticator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ void QAmqpPlainAuthenticator::write(QDataStream &out)
{
QAmqpFrame::writeAmqpField(out, QAmqpMetaType::ShortString, type());
QAmqpTable response;
response["LOGIN"] = login_;
response["PASSWORD"] = password_;
response.insert("LOGIN", login_);
response.insert("PASSWORD", password_);
out << response;
}
3 changes: 2 additions & 1 deletion src/qamqpchannel.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ class QAMQP_EXPORT QAmqpChannel : public QObject
Q_OBJECT
Q_PROPERTY(int number READ channelNumber CONSTANT)
Q_PROPERTY(bool open READ isOpen CONSTANT)
Q_PROPERTY(QString name READ name WRITE setName)
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
public:
virtual ~QAmqpChannel();

Expand Down Expand Up @@ -61,6 +61,7 @@ public Q_SLOTS:
void paused();
void error(QAMQP::Error error);
void qosDefined();
void nameChanged(const QString &name);

protected:
virtual void channelOpened() = 0;
Expand Down
6 changes: 3 additions & 3 deletions src/qamqpclient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,9 @@ void QAmqpClientPrivate::startOk()
QDataStream stream(&arguments, QIODevice::WriteOnly);

QAmqpTable clientProperties;
clientProperties["version"] = QString(QAMQP_VERSION);
clientProperties["platform"] = QString("Qt %1").arg(qVersion());
clientProperties["product"] = QString("QAMQP");
clientProperties.insert("version", QString(QAMQP_VERSION));
clientProperties.insert("platform", QString("Qt %1").arg(qVersion()));
clientProperties.insert("product", QString("QAMQP"));
clientProperties.unite(customProperties);
stream << clientProperties;

Expand Down
28 changes: 19 additions & 9 deletions src/qamqpclient.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ class QAmqpClientPrivate;
class QAMQP_EXPORT QAmqpClient : public QObject
{
Q_OBJECT
Q_PROPERTY(quint32 port READ port WRITE setPort)
Q_PROPERTY(QString host READ host WRITE setHost)
Q_PROPERTY(QString virtualHost READ virtualHost WRITE setVirtualHost)
Q_PROPERTY(QString user READ username WRITE setUsername)
Q_PROPERTY(QString password READ password WRITE setPassword)
Q_PROPERTY(bool autoReconnect READ autoReconnect WRITE setAutoReconnect)
Q_PROPERTY(qint16 channelMax READ channelMax WRITE setChannelMax)
Q_PROPERTY(qint32 frameMax READ frameMax WRITE setFrameMax)
Q_PROPERTY(qint16 heartbeatDelay READ heartbeatDelay() WRITE setHeartbeatDelay)
Q_PROPERTY(quint32 port READ port WRITE setPort NOTIFY portChanged)
Q_PROPERTY(QString host READ host WRITE setHost NOTIFY hostChanged)
Q_PROPERTY(QString virtualHost READ virtualHost WRITE setVirtualHost NOTIFY virtualHostChanged)
Q_PROPERTY(QString user READ username WRITE setUsername NOTIFY userChanged)
Q_PROPERTY(QString password READ password WRITE setPassword NOTIFY passwordChanged)
Q_PROPERTY(bool autoReconnect READ autoReconnect WRITE setAutoReconnect NOTIFY autoReconnectChanged)
Q_PROPERTY(qint16 channelMax READ channelMax WRITE setChannelMax NOTIFY channelMaxChanged)
Q_PROPERTY(qint32 frameMax READ frameMax WRITE setFrameMax NOTIFY frameMaxChanged)
Q_PROPERTY(qint16 heartbeatDelay READ heartbeatDelay() WRITE setHeartbeatDelay NOTIFY heartbeatDelayChanged)

public:
explicit QAmqpClient(QObject *parent = 0);
Expand Down Expand Up @@ -119,6 +119,16 @@ class QAMQP_EXPORT QAmqpClient : public QObject
void socketStateChanged(QAbstractSocket::SocketState state);
void sslErrors(const QList<QSslError> &errors);

void portChanged(int);
void hostChanged(const QString &);
void virtualHostChanged(const QString &);
void userChanged(const QString &);
void passwordChanged(const QString &);
void autoReconnectChanged(bool value);
void channelMaxChanged(qint16 channelMax);
void frameMaxChanged(qint32 frameMax);
void heartbeatDelayChanged(qint16 delay);

public Q_SLOTS:
void ignoreSslErrors(const QList<QSslError> &errors);

Expand Down
8 changes: 4 additions & 4 deletions src/qamqpexchange.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ class QAMQP_EXPORT QAmqpExchange : public QAmqpChannel
Q_OBJECT
Q_PROPERTY(QString type READ type CONSTANT)
Q_PROPERTY(ExchangeOptions options READ options CONSTANT)
Q_ENUMS(ExchangeOptions)

public:
virtual ~QAmqpExchange();
Expand Down Expand Up @@ -68,6 +67,7 @@ class QAMQP_EXPORT QAmqpExchange : public QAmqpChannel
};
Q_DECLARE_FLAGS(ExchangeOptions, ExchangeOption)
ExchangeOptions options() const;
Q_ENUM(ExchangeOptions)

bool isDeclared() const;

Expand All @@ -83,11 +83,11 @@ class QAMQP_EXPORT QAmqpExchange : public QAmqpChannel

public Q_SLOTS:
// AMQP Exchange
void declare(ExchangeType type = Direct,
ExchangeOptions options = NoOptions,
void declare(QAmqpExchange::ExchangeType type = Direct,
QAmqpExchange::ExchangeOptions options = NoOptions,
const QAmqpTable &args = QAmqpTable());
void declare(const QString &type,
ExchangeOptions options = NoOptions,
QAmqpExchange::ExchangeOptions options = NoOptions,
const QAmqpTable &args = QAmqpTable());
void remove(int options = roIfUnused|roNoWait);

Expand Down
7 changes: 5 additions & 2 deletions src/qamqpframe.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,11 @@ qint32 QAmqpContentFrame::size() const
out << qlonglong(bodySize_);

qint16 prop_ = 0;
foreach (int p, properties_.keys())
prop_ |= p;
QHashIterator<QAmqpMessage::Property, QVariant> p(properties_);
while (p.hasNext()) {
p.next();
prop_ |= p.key();
}
out << prop_;

if (prop_ & QAmqpMessage::ContentType)
Expand Down
2 changes: 1 addition & 1 deletion src/qamqpglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
# define QAMQP_EXPORT
#endif

#define qAmqpDebug if (qgetenv("QAMQP_DEBUG").isEmpty()); else qDebug
#define qAmqpDebug if (qEnvironmentVariableIsEmpty("QAMQP_DEBUG")); else qDebug

namespace QAmqpMetaType {

Expand Down
12 changes: 7 additions & 5 deletions src/qamqpqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,8 @@ class QAmqpQueuePrivate;
class QAMQP_EXPORT QAmqpQueue : public QAmqpChannel, public QQueue<QAmqpMessage>
{
Q_OBJECT
Q_ENUMS(QueueOptions)
Q_PROPERTY(int options READ options CONSTANT)
Q_PROPERTY(QString consumerTag READ consumerTag WRITE setConsumerTag)
Q_ENUMS(QueueOption)
Q_ENUMS(ConsumeOption)
Q_ENUMS(RemoveOption)
Q_PROPERTY(QString consumerTag READ consumerTag WRITE setConsumerTag NOTIFY consumerTagChanged)

public:
enum QueueOption {
Expand Down Expand Up @@ -78,6 +74,11 @@ class QAMQP_EXPORT QAmqpQueue : public QAmqpChannel, public QQueue<QAmqpMessage>
qint32 messageCount() const;
qint32 consumerCount() const;

Q_ENUM(QueueOptions)
Q_ENUM(QueueOption)
Q_ENUM(ConsumeOption)
Q_ENUM(RemoveOption)

Q_SIGNALS:
void declared();
void bound();
Expand All @@ -89,6 +90,7 @@ class QAMQP_EXPORT QAmqpQueue : public QAmqpChannel, public QQueue<QAmqpMessage>
void empty();
void consuming(const QString &consumerTag);
void cancelled(const QString &consumerTag);
void consumerTagChanged(const QString &consumerTag);

public Q_SLOTS:
// AMQP Queue
Expand Down
2 changes: 1 addition & 1 deletion src/qamqptable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ QDataStream &operator>>(QDataStream &stream, QAmqpTable &table)
qint8 octet = 0;
QString field = QAmqpFrame::readAmqpField(tableStream, QAmqpMetaType::ShortString).toString();
tableStream >> octet;
table[field] = QAmqpTable::readFieldValue(tableStream, valueTypeForOctet(octet));
table.insert(field, QAmqpTable::readFieldValue(tableStream, valueTypeForOctet(octet)));
}

return stream;
Expand Down
6 changes: 3 additions & 3 deletions src/qamqptable.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@

#include "qamqpglobal.h"

class QAMQP_EXPORT QAmqpTable : public QVariantHash
class QAMQP_EXPORT QAmqpTable : public QMultiHash<QString, QVariant>
{
public:
QAmqpTable() {}
inline QAmqpTable(const QVariantHash &variantHash)
: QVariantHash(variantHash)
inline QAmqpTable(const QMultiHash<QString, QVariant> &variantHash)
: QMultiHash<QString, QVariant>(variantHash)
{
}

Expand Down
2 changes: 1 addition & 1 deletion src/src.pro
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ INCLUDEPATH += .
TEMPLATE = lib
TARGET = qamqp
build_pass:CONFIG(debug, debug|release) {
TARGET = $$join(TARGET,,,d)
win32:TARGET = $$join(TARGET,,,d)
}
QT += core network
QT -= gui
Expand Down