Пример #1
0
void Segments::calculateDurationNewSegment(Segment *segment){
    if (segments.size()==0){
        segment->setBeginTemperature(beginTemperature);
    } else{
        Segment * prevSegment = segments[segments.size()-1].data();
        segment->setBeginTemperature(prevSegment->endTemperature());
    }
    segment->calculateDuration();
}
Пример #2
0
void Segments::save(const QString &fileName){
    if (fileName.isEmpty())return;
    QFile file(fileName);
    if(!file.open(QIODevice::WriteOnly))
        return;
    QDataStream out(&file);
    for (int i=0;i<segments.size();++i){
        Segment * segment = segments.at(i).data();
        out << (qint32)segment->type()
            << segment->velocity()
            << segment->endTemperature()
            << segment->duration();
    }
}