Esempio n. 1
0
void Segments::calculateTotalDuration(){
    double duration = 0;
    Segment * segment;
    for (int i = 0;i < segments.size();++i){
        segment = segments.at(i).data();
        duration+=segment->duration();
    }
    emit totalDuration(duration);

}
Esempio n. 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();
    }
}