7#include "ui_qosconfigdialog.h"
8#include <qmessagebox.h>
14 QosConfigDialog::edge = edge;
16 ui->treeWidgetProperty->setStyleSheet(
"QTreeWidget::item { border-right: 1px dotted grey;}");
17 ui->treeWidgetProperty->setSelectionMode(QAbstractItemView::NoSelection);
18 connect(ui->applyButton,
SIGNAL(clicked()),
this, SLOT(apply()));
19 connect(ui->resetButton,
SIGNAL(clicked()),
this, SLOT(reset()));
29void QosConfigDialog::createGui() {
30 QTreeWidgetItemIterator it(ui->treeWidgetProperty);
32 srcPacketProCombo =
new QComboBox(
this);
33 srcPacketProCombo->addItems(QStringList() <<
"LOW" <<
"NORMAL" <<
"HIGH" <<
"CRITIC");
40 srcPacketProCombo->setCurrentIndex(1);
43 srcPacketProCombo->setCurrentIndex(0);
46 srcPacketProCombo->setCurrentIndex(2);
49 srcPacketProCombo->setCurrentIndex(3);
52 srcPacketProCombo->setCurrentIndex(1);
54 ui->treeWidgetProperty->setItemWidget(*it++, 1, srcPacketProCombo);
57 srcThreadPro =
new QLineEdit;
58 srcThreadPro->setValidator(
new QIntValidator(-100, 100,
this) );
60 srcThreadPro->setText(QString::number(edge->
property.
find(
"FromThreadPriority").
asInt32()));
62 srcThreadPro->setText(QString::number(0));
64 ui->treeWidgetProperty->setItemWidget(*it++, 1, srcThreadPro);
66 srcThreadPolicy =
new QLineEdit;
67 srcThreadPolicy->setValidator(
new QIntValidator(-100, 100,
this) );
69 srcThreadPolicy->setText(QString::number(edge->
property.
find(
"FromThreadPolicy").
asInt32()));
71 srcThreadPolicy->setText(QString::number(0));
73 ui->treeWidgetProperty->setItemWidget(*it++, 1, srcThreadPolicy);
77 dstPacketProCombo =
new QComboBox(
this);
78 dstPacketProCombo->addItems(QStringList() <<
"LOW" <<
"NORMAL" <<
"HIGH" <<
"CRITIC");
87 dstPacketProCombo->setCurrentIndex(1);
90 dstPacketProCombo->setCurrentIndex(0);
93 dstPacketProCombo->setCurrentIndex(2);
96 dstPacketProCombo->setCurrentIndex(3);
99 dstPacketProCombo->setCurrentIndex(1);
101 ui->treeWidgetProperty->setItemWidget(*it++, 1, dstPacketProCombo);
104 dstThreadPro =
new QLineEdit;
105 dstThreadPro->setValidator(
new QIntValidator(-100, 100,
this) );
109 dstThreadPro->setText(QString::number(0));
111 ui->treeWidgetProperty->setItemWidget(*it++, 1, dstThreadPro);
113 dstThreadPolicy =
new QLineEdit;
114 dstThreadPolicy->setValidator(
new QIntValidator(-100, 100,
this) );
116 dstThreadPolicy->setText(QString::number(edge->
property.
find(
"ToThreadPolicy").
asInt32()));
118 dstThreadPolicy->setText(QString::number(0));
120 ui->treeWidgetProperty->setItemWidget(*it++, 1, dstThreadPolicy);
123void QosConfigDialog::reset() {
124 srcPacketProCombo->setCurrentIndex(1);
125 srcThreadPro->setText(
"0");
126 srcThreadPolicy->setText(
"0");
127 dstPacketProCombo->setCurrentIndex(1);
128 dstThreadPro->setText(
"0");
129 dstThreadPolicy->setText(
"0");
134 int itemLevel = srcPacketProCombo->currentIndex();
155 itemLevel = dstPacketProCombo->currentIndex();
178void QosConfigDialog::apply() {
181 setResult(QDialog::Accepted);
196 QMessageBox messageBox;
197 messageBox.critical(
nullptr,
"Error",
"An error has occurred while applying the QoS configuration! \n Please check the QoS parameters carefully.");
198 messageBox.setFixedSize(500,200);
int SIGNAL(int pid, int signum)
QosConfigDialog(yarp::profiler::graph::Edge *edge, QWidget *parent=0)
bool getUserQosStyles(yarp::os::QosStyle &srcStyle, yarp::os::QosStyle &dstStyle)
static bool setConnectionQos(const std::string &src, const std::string &dest, const QosStyle &srcStyle, const QosStyle &destStyle, bool quiet=true)
Adjust the Qos preferences of a connection.
Value & find(const std::string &key) const override
Gets a value corresponding to a given keyword.
Preferences for the port's Quality of Service.
void setThreadPriority(int priority)
sets the communication thread priority level
void setThreadPolicy(int policy)
sets the communication thread scheduling policy
PacketPriorityLevel
The PacketPriorityLevel defines the packets quality of service (priority) levels.
void setPacketPriorityByLevel(PacketPriorityLevel level)
sets the packet priority given as PacketPriorityLevel
virtual std::int32_t asInt32() const
Get 32-bit integer value.
virtual std::string asString() const
Get string value.
The yarp::profiler::graph::Edge class.
const yarp::profiler::graph::Vertex & second() const
yarp::os::Property property
const yarp::profiler::graph::Vertex & first() const
yarp::os::Property property