BuildLogViewer/Document.cpp
author Sebastian Brannstrom <sebastianb@symbian.org>
Wed, 11 Aug 2010 20:03:29 +0100
changeset 24 2e833c2a6782
parent 1 8e9c5760ce6f
permissions -rwxr-xr-x
Added csv file to sis exports; improved csv file location in main.cpp

#include <QFile>
#include <QFileInfo>
#include <QMessageBox>

#include "Document.h"

Document::Document(QWidget *parent, QString filename) : QTreeView (parent)
{
    setAttribute(Qt::WA_DeleteOnClose);

    QFile file(filename);
    QFileInfo fi(file);
    this->setWindowTitle(fi.baseName());

    if (!file.open(QIODevice::ReadOnly)) {
        QMessageBox::warning(this, tr("Build Log Viewer"), tr("Cannot open log."));
        return ;
    }
    QDomDocument *log = new QDomDocument("Build Log");
    if (!log->setContent(&file)) {
        QMessageBox::warning(this, tr("Build Log Viewer"), tr("Cannot set content."));
        delete log;
        file.close();
        return ;
    }
    file.close();
    model = new DomModel(log, this);
    this->setModel(model);
}