forked from qt-creator/qt-creator
qmlprofiler: ui and style
Change-Id: I2153ef00f8d3c6d1cc4d39648916cad865b5a9be Reviewed-on: http://codereview.qt.nokia.com/54 Reviewed-by: hjk
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
|
||||
namespace QmlJsDebugClient {
|
||||
|
||||
#define MAX_PACKET_SIZE 0x7FFFFFFF
|
||||
static const unsigned int MAX_PACKET_SIZE = 0x7FFFFFFF;
|
||||
|
||||
/*!
|
||||
\class QPacketProtocol
|
||||
@@ -100,9 +100,10 @@ namespace QmlJsDebugClient {
|
||||
|
||||
class QPacketProtocolPrivate : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
QPacketProtocolPrivate(QPacketProtocol * parent, QIODevice * _dev)
|
||||
QPacketProtocolPrivate(QPacketProtocol *parent, QIODevice *_dev)
|
||||
: QObject(parent), inProgressSize(-1), maxPacketSize(MAX_PACKET_SIZE),
|
||||
dev(_dev)
|
||||
{
|
||||
@@ -139,8 +140,8 @@ public Q_SLOTS:
|
||||
{
|
||||
Q_ASSERT(!sendingPackets.isEmpty());
|
||||
|
||||
while(bytes) {
|
||||
if(sendingPackets.at(0) > bytes) {
|
||||
while (bytes) {
|
||||
if (sendingPackets.at(0) > bytes) {
|
||||
sendingPackets[0] -= bytes;
|
||||
bytes = 0;
|
||||
} else {
|
||||
@@ -153,11 +154,11 @@ public Q_SLOTS:
|
||||
|
||||
void readyToRead()
|
||||
{
|
||||
while(true) {
|
||||
while (true) {
|
||||
// Need to get trailing data
|
||||
if(-1 == inProgressSize) {
|
||||
if (-1 == inProgressSize) {
|
||||
// We need a size header of sizeof(qint32)
|
||||
if(sizeof(qint32) > (uint)dev->bytesAvailable())
|
||||
if (sizeof(qint32) > (uint)dev->bytesAvailable())
|
||||
return;
|
||||
|
||||
// Read size header
|
||||
@@ -166,7 +167,7 @@ public Q_SLOTS:
|
||||
Q_UNUSED(read);
|
||||
|
||||
// Check sizing constraints
|
||||
if(inProgressSize > maxPacketSize) {
|
||||
if (inProgressSize > maxPacketSize) {
|
||||
QObject::disconnect(dev, SIGNAL(readyRead()),
|
||||
this, SLOT(readyToRead()));
|
||||
QObject::disconnect(dev, SIGNAL(aboutToClose()),
|
||||
@@ -182,7 +183,7 @@ public Q_SLOTS:
|
||||
} else {
|
||||
inProgress.append(dev->read(inProgressSize - inProgress.size()));
|
||||
|
||||
if(inProgressSize == inProgress.size()) {
|
||||
if (inProgressSize == inProgress.size()) {
|
||||
// Packet has arrived!
|
||||
packets.append(inProgress);
|
||||
inProgressSize = -1;
|
||||
@@ -242,7 +243,7 @@ qint32 QPacketProtocol::maximumPacketSize() const
|
||||
*/
|
||||
qint32 QPacketProtocol::setMaximumPacketSize(qint32 max)
|
||||
{
|
||||
if(max > (signed)sizeof(qint32))
|
||||
if (max > (signed)sizeof(qint32))
|
||||
d->maxPacketSize = max;
|
||||
return d->maxPacketSize;
|
||||
}
|
||||
@@ -269,7 +270,7 @@ QPacketAutoSend QPacketProtocol::send()
|
||||
*/
|
||||
void QPacketProtocol::send(const QPacket & p)
|
||||
{
|
||||
if(p.b.isEmpty())
|
||||
if (p.b.isEmpty())
|
||||
return; // We don't send empty packets
|
||||
|
||||
qint64 sendSize = p.b.size() + sizeof(qint32);
|
||||
@@ -304,7 +305,7 @@ void QPacketProtocol::clear()
|
||||
*/
|
||||
QPacket QPacketProtocol::read()
|
||||
{
|
||||
if(0 == d->packets.count())
|
||||
if (0 == d->packets.count())
|
||||
return QPacket();
|
||||
|
||||
QPacket rv(d->packets.at(0));
|
||||
@@ -402,7 +403,7 @@ QPacket::QPacket()
|
||||
*/
|
||||
QPacket::~QPacket()
|
||||
{
|
||||
if(buf) {
|
||||
if (buf) {
|
||||
delete buf;
|
||||
buf = 0;
|
||||
}
|
||||
@@ -477,10 +478,10 @@ QPacketAutoSend::QPacketAutoSend(QPacketProtocol * _p)
|
||||
|
||||
QPacketAutoSend::~QPacketAutoSend()
|
||||
{
|
||||
if(!b.isEmpty())
|
||||
if (!b.isEmpty())
|
||||
p->send(*this);
|
||||
}
|
||||
|
||||
}
|
||||
} // namespace QmlJsDebugClient
|
||||
|
||||
#include <qpacketprotocol.moc>
|
||||
|
||||
Reference in New Issue
Block a user