Subversion Repositories svn1

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
156 - 1
#include "qmreportwindow.h"
168 david 2
#include <QtCore/QVariant>
3
#include <QtGui/QAction>
4
#include <QtGui/QApplication>
5
#include <QtGui/QButtonGroup>
6
#include <QtGui/QHeaderView>
7
#include <QtGui/QTabWidget>
8
#include <QtGui/QWidget>
9
#include <QtWebKit/QWebView>
10
#include <QVBoxLayout>
156 - 11
 
168 david 12
#include    "consts.h"
13
#include    "structs.h"
14
#include    "proto.h"
15
 
156 - 16
QmReportWindow::QmReportWindow(QWidget *parent) :
168 david 17
    QTabWidget(parent)
156 - 18
{
203 - 19
    QWebView *webView = new QWebView();
174 - 20
    webView->setUrl(QUrl(QString(filepath)+ filebase + "_index.html",QUrl::TolerantMode));
21
    qDebug("ReportUrl:%s", qPrintable(webView->url().path()));
203 - 22
    addTab(webView, "Index");
168 david 23
 
24
    setCurrentIndex(0);
156 - 25
}
26
 
203 - 27
void QmReportWindow::addReport(const QString &report, const QString &name)
28
{
29
    QWebView *webView = NULL;
30
    for( int index = 0; index < count(); index++)
31
    {
32
        if (tabText(index) == name)
33
        {
34
            webView = dynamic_cast<QWebView *>(widget(index));
35
            if (webView)
36
            {
37
                qDebug("Reuse Tab:%s", qPrintable(report));
38
                break;
39
            }
40
        }
41
    }
42
 
43
    if (webView == NULL)
44
    {
45
        webView = new QWebView();
46
        addTab(webView, name);
47
        qDebug("Adding:%s", qPrintable(report));
48
    }
49
    webView->setUrl(QUrl(report,QUrl::TolerantMode));
50
    addTab(webView, name);
51
 
52
}
53
 
156 - 54
QmReportWindow::~QmReportWindow()
55
{
56
}