void AlarmManagment::readExistingAlarms()
{
v_rewr->openRead2("./Config/Alarms.txt");
name: leituraall = v_rewr->Read();
vr_data = leituraall.section('\t',0,0);
vr_semana = leituraall.section('\t',1,1);
vr_hora = leituraall.section('\t',2,2);
vr_smalldescription = leituraall.section('\t',3,3);
if (!vector_String1.contains(vr_data))
{
vector_String1.push_back(vr_data);
addRoot(vr_data, vr_semana, vr_hora, vr_smalldescription);
qDebug() << "Item normal sendo colocado: " << vr_data;
}
else
{
a = ui->Listofalarms->findItems(vr_data,Qt::MatchExactly,1);
qDebug() << "item ja exite: " << vr_data;
addChild(a.front(),vr_semana,vr_hora,vr_smalldescription);
}
if (!v_rewr->attheEnd()) goto name;
}
{
itm->setText(0,data);
itm2->setText(0,semana);
itm2->setText(1,hora);
itm2->setText(2,smadesc);
itm->addChild(itm2);
}
{
itm2->setText(0,sem);
itm2->setText(1,hour);
itm2->setText(2,smaldescription);
parent->addChild(itm2);
}
void AlarmManagment::readExistingAlarms()
{
v_rewr->openRead2("./Config/Alarms.txt");
name: leituraall = v_rewr->Read();
vr_data = leituraall.section('\t',0,0);
vr_semana = leituraall.section('\t',1,1);
vr_hora = leituraall.section('\t',2,2);
vr_smalldescription = leituraall.section('\t',3,3);
if (!vector_String1.contains(vr_data))
{
vector_String1.push_back(vr_data);
addRoot(vr_data, vr_semana, vr_hora, vr_smalldescription);
qDebug() << "Item normal sendo colocado: " << vr_data;
}
else
{
a = ui->Listofalarms->findItems(vr_data,Qt::MatchExactly,1);
qDebug() << "item ja exite: " << vr_data;
addChild(a.front(),vr_semana,vr_hora,vr_smalldescription);
}
if (!v_rewr->attheEnd()) goto name;
}
void AlarmManagment::addRoot(QString data, QString semana, QString hora, QString smadesc)
{
QTreeWidgetItem *itm = new QTreeWidgetItem(ui->Listofalarms);
itm->setText(0,data);
QTreeWidgetItem *itm2 = new QTreeWidgetItem();
itm2->setText(0,semana);
itm2->setText(1,hora);
itm2->setText(2,smadesc);
itm->addChild(itm2);
}
void AlarmManagment::addChild(QTreeWidgetItem *parent, QString sem, QString hour, QString smaldescription)
{
QTreeWidgetItem *itm2 = new QTreeWidgetItem();
itm2->setText(0,sem);
itm2->setText(1,hour);
itm2->setText(2,smaldescription);
parent->addChild(itm2);
}
To copy to clipboard, switch view to plain text mode
Bookmarks