| Line 8... |
Line 8... |
| 8 |
#include <QHBoxLayout>
|
8 |
#include <QHBoxLayout>
|
| 9 |
#include <QLabel>
|
9 |
#include <QLabel>
|
| 10 |
#include <QSpacerItem>
|
10 |
#include <QSpacerItem>
|
| 11 |
#include <QToolBar>
|
11 |
#include <QToolBar>
|
| 12 |
#include <QPrintDialog>
|
12 |
#include <QPrintDialog>
|
| - |
|
13 |
#include <QPrinter>
|
| 13 |
#include <QPrintPreviewDialog>
|
14 |
#include <QPrintPreviewDialog>
|
| 14 |
|
15 |
|
| 15 |
#include <QDirIterator>
|
16 |
#include <QDirIterator>
|
| 16 |
#include <QtDebug>
|
17 |
#include <QtDebug>
|
| 17 |
|
18 |
|
| Line 20... |
Line 21... |
| 20 |
#include "proto.h"
|
21 |
#include "proto.h"
|
| 21 |
|
22 |
|
| 22 |
QmReportWindow::QmReportWindow(QWidget *parent) : QWidget(parent)
|
23 |
QmReportWindow::QmReportWindow(QWidget *parent) : QWidget(parent)
|
| 23 |
{
|
24 |
{
|
| 24 |
currentWebView = NULL;
|
25 |
currentWebView = NULL;
|
| - |
|
26 |
currentWebViewPrinter = NULL;
|
| - |
|
27 |
printPreviewDialog = NULL;
|
| 25 |
|
28 |
|
| - |
|
29 |
// Allocate one printer for the entire widget
|
| - |
|
30 |
// Setting made to the printer will then be used in all reports
|
| - |
|
31 |
//
|
| - |
|
32 |
printer = new QPrinter();
|
| - |
|
33 |
printer->setPageMargins(10,10,10,10,QPrinter::Millimeter);
|
| - |
|
34 |
|
| 26 |
printPreviewDialog = new QPrintPreviewDialog(this);
|
35 |
// printPreviewDialog = new QPrintPreviewDialog(this);
|
| 27 |
printPreviewDialog->setModal ( true );
|
36 |
// printPreviewDialog->setModal ( true );
|
| 28 |
connect(printPreviewDialog,SIGNAL(paintRequested(QPrinter *)), this , SLOT(printPreview(QPrinter *)) );
|
37 |
// connect(printPreviewDialog,SIGNAL(paintRequested(QPrinter *)), this , SLOT(printPreview(QPrinter *)) );
|
| 29 |
|
38 |
|
| 30 |
QVBoxLayout *verticalLayout;
|
39 |
QVBoxLayout *verticalLayout;
|
| 31 |
QLabel *label;
|
40 |
QLabel *label;
|
| 32 |
QToolBar *tb;
|
41 |
QToolBar *tb;
|
| 33 |
|
42 |
|
| Line 39... |
Line 48... |
| 39 |
pb_original = tb->addAction ( QIcon(":/webkit/inspector/Images/reloadButtonGlyph.png"),"Home", this, SLOT(home()));
|
48 |
pb_original = tb->addAction ( QIcon(":/webkit/inspector/Images/reloadButtonGlyph.png"),"Home", this, SLOT(home()));
|
| 40 |
pb_back = tb->addAction ( QIcon(":/trolltech/styles/commonstyle/images/left-32.png"),"Back", this, SLOT(back()));
|
49 |
pb_back = tb->addAction ( QIcon(":/trolltech/styles/commonstyle/images/left-32.png"),"Back", this, SLOT(back()));
|
| 41 |
pb_forward = tb->addAction ( QIcon(":/trolltech/styles/commonstyle/images/right-32.png"),"Forward", this, SLOT(forward()));
|
50 |
pb_forward = tb->addAction ( QIcon(":/trolltech/styles/commonstyle/images/right-32.png"),"Forward", this, SLOT(forward()));
|
| 42 |
pb_print = tb->addAction ( QIcon(":/trolltech/dialogs/qprintpreviewdialog/images/print-32.png" ),"Print", this, SLOT(print()));
|
51 |
pb_print = tb->addAction ( QIcon(":/trolltech/dialogs/qprintpreviewdialog/images/print-32.png" ),"Print", this, SLOT(print()));
|
| 43 |
tb->addSeparator();
|
52 |
tb->addSeparator();
|
| - |
|
53 |
pb_size = new QDoubleSpinBox();
|
| - |
|
54 |
pb_size->setSingleStep (0.05);
|
| - |
|
55 |
pb_size->setValue(1.4);
|
| - |
|
56 |
pb_size->setToolTip("Printer Scaling Size");
|
| - |
|
57 |
tb->addWidget(pb_size);
|
| 44 |
label = new QLabel("Path");
|
58 |
label = new QLabel("Path");
|
| 45 |
tb->addWidget(label);
|
59 |
tb->addWidget(label);
|
| 46 |
tabPath = new QLineEdit();
|
60 |
tabPath = new QLineEdit();
|
| 47 |
tabPath->setReadOnly(true);
|
61 |
tabPath->setReadOnly(true);
|
| 48 |
tb->addWidget(tabPath);
|
62 |
tb->addWidget(tabPath);
|
| Line 54... |
Line 68... |
| 54 |
|
68 |
|
| 55 |
connect(tabWidget,SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
69 |
connect(tabWidget,SIGNAL(currentChanged(int)), this, SLOT(tabChanged(int)));
|
| 56 |
connect(tabWidget,SIGNAL(tabCloseRequested(int)), this, SLOT(deleteTab(int)));
|
70 |
connect(tabWidget,SIGNAL(tabCloseRequested(int)), this, SLOT(deleteTab(int)));
|
| 57 |
|
71 |
|
| 58 |
addReport(QString(filepath)+ filebase + "_index.html", "Index");
|
72 |
addReport(QString(filepath)+ filebase + "_index.html", "Index");
|
| - |
|
73 |
//addReport(QString(filepath) + "brmr2011_l2_2.txt", "Starters Report 2");
|
| 59 |
tabWidget->setCurrentIndex(0);
|
74 |
tabWidget->setCurrentIndex(0);
|
| 60 |
|
75 |
|
| 61 |
// {
|
76 |
// {
|
| 62 |
// QDirIterator it(":", QDirIterator::Subdirectories);
|
77 |
// QDirIterator it(":", QDirIterator::Subdirectories);
|
| 63 |
// while (it.hasNext())
|
78 |
// while (it.hasNext())
|
| Line 154... |
Line 169... |
| 154 |
|
169 |
|
| 155 |
void QmReportWindow::print(void)
|
170 |
void QmReportWindow::print(void)
|
| 156 |
{
|
171 |
{
|
| 157 |
if ( currentWebView )
|
172 |
if ( currentWebView )
|
| 158 |
{
|
173 |
{
|
| - |
|
174 |
// Delete printer preview if we are previewing a different page
|
| - |
|
175 |
//
|
| - |
|
176 |
if ( printPreviewDialog /* && currentWebViewPrinter != currentWebView */)
|
| - |
|
177 |
{
|
| - |
|
178 |
delete printPreviewDialog;
|
| - |
|
179 |
printPreviewDialog = NULL;
|
| - |
|
180 |
currentWebViewPrinter = NULL;
|
| - |
|
181 |
}
|
| - |
|
182 |
|
| - |
|
183 |
// Allocate Printer Preview if we don't have one
|
| - |
|
184 |
if (printPreviewDialog == NULL)
|
| - |
|
185 |
{
|
| - |
|
186 |
currentWebViewPrinter = currentWebView;
|
| - |
|
187 |
printPreviewDialog = new QPrintPreviewDialog(printer, this);
|
| - |
|
188 |
printPreviewDialog->setModal ( true );
|
| - |
|
189 |
printPreviewDialog->setSizeGripEnabled(true);
|
| - |
|
190 |
printer->setDocName(currentWebView->url().toString());
|
| - |
|
191 |
}
|
| - |
|
192 |
|
| 159 |
// printPreviewDialog->open(this,SLOT(fred()));
|
193 |
// printPreviewDialog->open(this,SLOT(fred()));
|
| 160 |
//currentWebView->setStyleSheet("*{font 50px;}");
|
194 |
//currentWebView->setStyleSheet("*{font-size:250%;}");
|
| 161 |
//currentWebView->setZoomFactor(2.0);
|
195 |
//currentWebView->setZoomFactor(2.0);
|
| - |
|
196 |
currentWebView->setTextSizeMultiplier ( pb_size->value() );
|
| - |
|
197 |
qDebug("setTextSizeMultiplier:%f", pb_size->value());
|
| - |
|
198 |
|
| - |
|
199 |
connect(printPreviewDialog,SIGNAL(paintRequested(QPrinter *)), this , SLOT(printPreview(QPrinter *)) );
|
| 162 |
printPreviewDialog->exec();
|
200 |
printPreviewDialog->exec();
|
| - |
|
201 |
|
| - |
|
202 |
currentWebView->setTextSizeMultiplier ( 1.0 );
|
| 163 |
|
203 |
|
| 164 |
// QPrintDialog printDialog(this);
|
204 |
// QPrintDialog printDialog(this);
|
| 165 |
// if (printDialog.exec() == QDialog::Accepted) {
|
205 |
// if (printDialog.exec() == QDialog::Accepted) {
|
| 166 |
// QPrinter * printer = printDialog.printer();
|
206 |
// QPrinter * printer = printDialog.printer();
|
| 167 |
// currentWebView->print(printer);
|
207 |
// currentWebView->print(printer);
|