printing: add more debug output
This makes it easier to see what's going on during the printing process. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
47f52cd4d1
commit
e5915ca4f2
@ -24,18 +24,22 @@ Printer::Printer(QPaintDevice *paintDevice, print_options &printOptions, templat
|
|||||||
{
|
{
|
||||||
webView = new QWebEngineView(parent);
|
webView = new QWebEngineView(parent);
|
||||||
connect(webView, &QWebEngineView::loadFinished, this, &Printer::onLoadFinished);
|
connect(webView, &QWebEngineView::loadFinished, this, &Printer::onLoadFinished);
|
||||||
if (printMode == PRINT)
|
if (printMode == PRINT) {
|
||||||
connect(this, &Printer::profilesInserted, this, &Printer::printing);
|
connect(this, &Printer::profilesInserted, this, &Printer::printing);
|
||||||
|
connect(this, &Printer::jobDone, this, &Printer::printFinished);
|
||||||
|
}
|
||||||
profilesMissing = true;
|
profilesMissing = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Printer::~Printer()
|
Printer::~Printer()
|
||||||
{
|
{
|
||||||
|
qDebug() << "deleting Printer object";
|
||||||
delete webView;
|
delete webView;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Printer::onLoadFinished()
|
void Printer::onLoadFinished()
|
||||||
{
|
{
|
||||||
|
qDebug() << "onLoadFinished called with profilesMissing" << profilesMissing << "and URL" << webView->url().toString();
|
||||||
if (profilesMissing) {
|
if (profilesMissing) {
|
||||||
QString jsText(" var profiles = document.getElementsByClassName(\"diveProfile\");\
|
QString jsText(" var profiles = document.getElementsByClassName(\"diveProfile\");\
|
||||||
for (let profile of profiles) { \
|
for (let profile of profiles) { \
|
||||||
@ -150,3 +154,17 @@ void Printer::print()
|
|||||||
printer.setResolution(dpi);
|
printer.setResolution(dpi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Printer::printFinished()
|
||||||
|
{
|
||||||
|
qDebug() << "received the jobDone signal, closing the dialog; page should have referenced:";
|
||||||
|
webView->page()->toHtml([](const QString h){
|
||||||
|
QRegularExpression img("img src=([^ ]+) ");
|
||||||
|
QRegularExpressionMatchIterator iter = img.globalMatch(h);
|
||||||
|
while(iter.hasNext()) {
|
||||||
|
QRegularExpressionMatch match = iter.next();
|
||||||
|
QString filename = match.captured(1).replace("file://", "");
|
||||||
|
qDebug() << filename << (QFile(filename).exists() ? "which does" : "which doesn't") << "exist";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@ -40,6 +40,7 @@ private:
|
|||||||
private slots:
|
private slots:
|
||||||
void templateProgessUpdated(int value);
|
void templateProgessUpdated(int value);
|
||||||
void printing();
|
void printing();
|
||||||
|
void printFinished();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Printer(QPaintDevice *paintDevice, print_options &printOptions, template_options &templateOptions, PrintMode printMode, bool inPlanner, QWidget *parent);
|
Printer(QPaintDevice *paintDevice, print_options &printOptions, template_options &templateOptions, PrintMode printMode, bool inPlanner, QWidget *parent);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user