apply some code analyzer recommendations
This commit is contained in:
@@ -5,23 +5,15 @@
|
|||||||
|
|
||||||
// GraphicType
|
// GraphicType
|
||||||
|
|
||||||
GraphicType::GraphicType(QString name_, QColor color, Qt::PenStyle style, double width, bool visible_) {
|
GraphicType::GraphicType(QString name_, QColor color, Qt::PenStyle style, double width, bool visible_): name(name_), visible(visible_) {
|
||||||
pen.setColor(color);
|
pen.setColor(color);
|
||||||
pen.setStyle(style);
|
pen.setStyle(style);
|
||||||
lines = true;
|
|
||||||
points = false;
|
|
||||||
fill = false;
|
|
||||||
fill_color = Qt::yellow;
|
|
||||||
if (qRound(width) == width)
|
if (qRound(width) == width)
|
||||||
pen.setWidth(qRound(width));
|
pen.setWidth(qRound(width));
|
||||||
else
|
else
|
||||||
pen.setWidthF(width);
|
pen.setWidthF(width);
|
||||||
pen.setWidth(1);
|
pen.setWidth(1);
|
||||||
pen.setCosmetic(true);
|
pen.setCosmetic(true);
|
||||||
max_x = 0.;
|
|
||||||
name = name_;
|
|
||||||
visible = visible_;
|
|
||||||
pointWidth = 2.;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -49,16 +49,16 @@ struct QAD_GRAPHIC_EXPORT GraphicType {
|
|||||||
QVector<QPolygonF> _lod;
|
QVector<QPolygonF> _lod;
|
||||||
QVector<QPolygonF> _lod_pause;
|
QVector<QPolygonF> _lod_pause;
|
||||||
QPen pen;
|
QPen pen;
|
||||||
QColor fill_color;
|
QColor fill_color = Qt::yellow;
|
||||||
bool lines;
|
bool lines = true;
|
||||||
bool points;
|
bool points = false;
|
||||||
bool fill;
|
bool fill = false;
|
||||||
double pointWidth;
|
double pointWidth = 2.;
|
||||||
double max_x;
|
double max_x = 0.;
|
||||||
double max_x_pause;
|
double max_x_pause = 0.;
|
||||||
QCheckBox * pb = nullptr;
|
QCheckBox * pb = nullptr;
|
||||||
QIcon icon;
|
QIcon icon;
|
||||||
bool visible;
|
bool visible = true;
|
||||||
QRectF cvrect;
|
QRectF cvrect;
|
||||||
int last_lod = 0;
|
int last_lod = 0;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
|
|||||||
conn = 0;
|
conn = 0;
|
||||||
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIODevice::DeviceMode");
|
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIODevice::DeviceMode");
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members)
|
for (const auto & e: ei->members)
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
ui->comboMode->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
|
ui->comboMode->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
|
||||||
QVariant::fromValue<int>(e.value));
|
QVariant::fromValue<int>(e.value));
|
||||||
@@ -31,7 +31,7 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
|
|||||||
ui->comboMode->setCurrentIndex(ui->comboMode->count() - 1);
|
ui->comboMode->setCurrentIndex(ui->comboMode->count() - 1);
|
||||||
ei = PICODEINFO::enums().value("PIIODevice::DeviceOption");
|
ei = PICODEINFO::enums().value("PIIODevice::DeviceOption");
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
|
for (const auto & e: ei->members) {
|
||||||
QCheckBox * cb = new QCheckBox();
|
QCheckBox * cb = new QCheckBox();
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
cb->setText(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"));
|
cb->setText(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"));
|
||||||
@@ -44,7 +44,7 @@ ConnectionEdit::ConnectionEdit(QWidget * parent): QDialog(parent) {
|
|||||||
}
|
}
|
||||||
ei = PICODEINFO::enums().value("PIPacketExtractor::SplitMode");
|
ei = PICODEINFO::enums().value("PIPacketExtractor::SplitMode");
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members)
|
for (const auto & e: ei->members)
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
ui->comboSplit->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
|
ui->comboSplit->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
|
||||||
QVariant::fromValue<int>(e.value));
|
QVariant::fromValue<int>(e.value));
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ void FilterItem::rename() {
|
|||||||
QString ms;
|
QString ms;
|
||||||
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIPacketExtractor::SplitMode", 0);
|
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIPacketExtractor::SplitMode", 0);
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & i, ei->members)
|
for (const auto & i: ei->members)
|
||||||
if (i.value == mode()) {
|
if (i.value == mode()) {
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
ms = PI2QString(i.name.toString());
|
ms = PI2QString(i.name.toString());
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ IODeviceEditDialog::IODeviceEditDialog(QWidget * parent): QDialog(parent) {
|
|||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIODevice::DeviceMode");
|
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIODevice::DeviceMode");
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members)
|
for (const auto & e: ei->members)
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
ui->comboMode->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
|
ui->comboMode->addItem(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"),
|
||||||
QVariant::fromValue<int>(e.value));
|
QVariant::fromValue<int>(e.value));
|
||||||
@@ -24,7 +24,7 @@ IODeviceEditDialog::IODeviceEditDialog(QWidget * parent): QDialog(parent) {
|
|||||||
ui->comboMode->setCurrentIndex(ui->comboMode->count() - 1);
|
ui->comboMode->setCurrentIndex(ui->comboMode->count() - 1);
|
||||||
ei = PICODEINFO::enums().value("PIIODevice::DeviceOption");
|
ei = PICODEINFO::enums().value("PIIODevice::DeviceOption");
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
|
for (const auto & e: ei->members) {
|
||||||
QCheckBox * cb = new QCheckBox();
|
QCheckBox * cb = new QCheckBox();
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
cb->setText(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"));
|
cb->setText(PI2QString(e.name.toString() + " (" + PIString::fromNumber(e.value) + ")"));
|
||||||
@@ -36,7 +36,7 @@ IODeviceEditDialog::IODeviceEditDialog(QWidget * parent): QDialog(parent) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
PIStringList pl = PIIODevice::availablePrefixes();
|
PIStringList pl = PIIODevice::availablePrefixes();
|
||||||
piForeachC(PIString & p, pl) {
|
for (const auto & p: pl) {
|
||||||
ui->comboType->addItem(PI2QString(p));
|
ui->comboType->addItem(PI2QString(p));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,10 +28,10 @@ ContainersModel::ContainersModel() {
|
|||||||
void ContainersModel::update(const PIVector<PIIntrospectionContainers::TypeInfo> & t) {
|
void ContainersModel::update(const PIVector<PIIntrospectionContainers::TypeInfo> & t) {
|
||||||
prev_data.clear();
|
prev_data.clear();
|
||||||
all.fill(0U);
|
all.fill(0U);
|
||||||
piForeachC(PIIntrospectionContainers::TypeInfo & i, cur_data) {
|
for (const auto & i: cur_data) {
|
||||||
prev_data[i.id] = i;
|
prev_data[i.id] = i;
|
||||||
}
|
}
|
||||||
piForeachC(PIIntrospectionContainers::TypeInfo & i, t) {
|
for (const auto & i: t) {
|
||||||
all[ccCount] += i.count;
|
all[ccCount] += i.count;
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 35, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 35, 0)
|
||||||
all[ccBytesAllocated] += i.allocated_bytes;
|
all[ccBytesAllocated] += i.allocated_bytes;
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ void ObjectsView::showObjects(const PIVector<PIIntrospection::ObjectInfo> & obje
|
|||||||
|
|
||||||
int vpos = treeObjects->verticalScrollBar()->value();
|
int vpos = treeObjects->verticalScrollBar()->value();
|
||||||
treeObjects->clear();
|
treeObjects->clear();
|
||||||
piForeachC(PIIntrospection::ObjectInfo & i, objects) {
|
for (const auto & i: objects) {
|
||||||
stat[PI2QString(i.classname)]++;
|
stat[PI2QString(i.classname)]++;
|
||||||
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
||||||
ti->setText(coClassName, PI2QString(i.classname));
|
ti->setText(coClassName, PI2QString(i.classname));
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ QPIIntrospector::QPIIntrospector(QWidget * parent): EMainWindow(parent), peer("_
|
|||||||
session.addEntry(tabWidgetMain);
|
session.addEntry(tabWidgetMain);
|
||||||
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIntrospection::InfoTypes");
|
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIntrospection::InfoTypes");
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
|
for (const auto & e: ei->members) {
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
QCheckBox * cb = new QCheckBox(PI2QString(e.name.mid(2).toString()));
|
QCheckBox * cb = new QCheckBox(PI2QString(e.name.mid(2).toString()));
|
||||||
#else
|
#else
|
||||||
@@ -83,7 +83,7 @@ void QPIIntrospector::buildTree(QByteArray d) {
|
|||||||
PIByteArray pd = Q2PIByteArray(d);
|
PIByteArray pd = Q2PIByteArray(d);
|
||||||
pd >> threads;
|
pd >> threads;
|
||||||
treeContainers->clear();
|
treeContainers->clear();
|
||||||
piForeachC (PIIntrospectionThreads::ThreadInfo & t, threads) {
|
for (const auto & t: threads) {
|
||||||
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
QTreeWidgetItem * ti = new QTreeWidgetItem();
|
||||||
ti->setText(0, QString(PI2QString(t.name) + " (%1)").arg(t.id));
|
ti->setText(0, QString(PI2QString(t.name) + " (%1)").arg(t.id));
|
||||||
treeContainers->addTopLevelItem(ti);
|
treeContainers->addTopLevelItem(ti);
|
||||||
@@ -241,7 +241,7 @@ void QPIIntrospector::peersChanged(const PIString & name) {
|
|||||||
QString cs = listApp->currentItem() ? listApp->currentItem()->text() : "";
|
QString cs = listApp->currentItem() ? listApp->currentItem()->text() : "";
|
||||||
listApp->clear();
|
listApp->clear();
|
||||||
peer.lock();
|
peer.lock();
|
||||||
piForeachC(PIPeer::PeerInfo & p, peer.allPeers()) {
|
for (const auto & p: peer.allPeers()) {
|
||||||
QString pn = PI2QString(p.name);
|
QString pn = PI2QString(p.name);
|
||||||
if (!pn.contains(tag)) continue;
|
if (!pn.contains(tag)) continue;
|
||||||
QListWidgetItem * li = new QListWidgetItem(pn.left(pn.indexOf(tag)));
|
QListWidgetItem * li = new QListWidgetItem(pn.left(pn.indexOf(tag)));
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ enum ColumnThreads {
|
|||||||
ThreadsModel::ThreadsModel() {
|
ThreadsModel::ThreadsModel() {
|
||||||
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIntrospectionThreads::ThreadState");
|
PICodeInfo::EnumInfo * ei = PICODEINFO::enums().value("PIIntrospectionThreads::ThreadState");
|
||||||
if (ei) {
|
if (ei) {
|
||||||
piForeachC(PICodeInfo::EnumeratorInfo & e, ei->members) {
|
for (const auto & e: ei->members) {
|
||||||
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
#if PIP_VERSION >= PIP_MAKE_VERSION(2, 39, 0)
|
||||||
state_names[e.value] = PI2QString(e.name.mid(1).toString());
|
state_names[e.value] = PI2QString(e.name.mid(1).toString());
|
||||||
#else
|
#else
|
||||||
@@ -118,7 +118,7 @@ QVariant ThreadsModel::data(const QModelIndex & index, int role) const {
|
|||||||
case ctDelay: return QString::number(ti.delay);
|
case ctDelay: return QString::number(ti.delay);
|
||||||
case ctState: return state_names.value(ti.state);
|
case ctState: return state_names.value(ti.state);
|
||||||
case ctLoad: {
|
case ctLoad: {
|
||||||
piForeachC(PISystemMonitor::ThreadStats & s, stat) {
|
for (const auto & s: stat) {
|
||||||
if (s.id == llong(ti.id)) {
|
if (s.id == llong(ti.id)) {
|
||||||
return QString::number(s.cpu_load_kernel + s.cpu_load_user, 'f', 2) + " %";
|
return QString::number(s.cpu_load_kernel + s.cpu_load_user, 'f', 2) + " %";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user