-
-
Notifications
You must be signed in to change notification settings - Fork 564
WIP: Liteprinter #4679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
WIP: Liteprinter #4679
Conversation
Signed-off-by: Robert C. Helling <[email protected]>
Signed-off-by: Robert C. Helling <[email protected]>
Signed-off-by: Robert C. Helling <[email protected]>
Signed-off-by: Robert C. Helling <[email protected]>
|
I'm traveling (actually diving, so not complaining), it may take be a couple of days before I get to this. |
|
Artifacts: |
|
OK, I didn't review the code, and I didn't update your PR, but if you apply this: you should get a qlitehtml library with the latest litehtml code. |
dirkhh
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments, mostly pointless.
This looks like a really promising start, Robert.
Thanks for working on this!
| #if defined(USE_WEBKIT) | ||
| webView(new QWebView), | ||
| printOptions(printOptions), | ||
| templateOptions(templateOptions), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just doing a quick read-through before heading to the harbor...
since you #ifdef that code, why are you removing those two lines? Or is that an unrelated change?
desktop-widgets/printer.cpp
Outdated
| # include <qlitehtmlwidget.h> | ||
| #elif defined(USE_WEBKIT) | ||
| # include <QtWebKitWidgetst> | ||
| #include <QtWebKitWidgetst> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
odd whitespace change? either we do the space indent, or we don't?
desktop-widgets/printer.cpp
Outdated
| templateOptions(templateOptions), | ||
| printMode(printMode), | ||
| singleDive(singleDive), | ||
| printOptions(printOptions), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I think this explains what my first comment was about... but then it should happen at the same time, in the same commit, no?
| webView->setHtml(t.generateStatistics()); | ||
| #else | ||
| ; | ||
| #endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not my favorite way to express this -- why not just #ifdef the whole if/else-if?
What am I missing?
| return QByteArray(); | ||
| }); | ||
| previewWidget.setGeometry(QRect(0,0,1600,1000)); | ||
| previewWidget.setGeometry(QRect(0,0,1200,1000)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
frankly, neither of these hard coded values is the right thing to do. Something-something based on the current window size? But that's me just being annoying, this is good for now
| previewWidget.setHtml(content); | ||
| // QFile file("/Users/Helling_1/logbuch.html"); | ||
| // if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) | ||
| // return; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😁
maybe not in the final version?
| // previewWidget.setHtml(in.readAll()); | ||
|
|
||
| QString repl = QString("<img height=\"30%\" width=\"30%\" src=\"file:///%1/dive_\\1.png\">").arg(printDir.path()); | ||
| content.replace(QRegularExpression("<div\\s+class=\"diveProfile\"\\s+id=\"dive_([^\"]*)\"\\s*>\\s*</div>"), repl); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brute force, but not wrong. And better than making it crazy complex and bringing in more dependencies, maybe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can probably provide some XSLT to do this in a more robust way, adding support for things like self-closing elements, or additional properties on the element itself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See atdotde#5 for a way to do the html transformation with XSLT.
|
clearly missing a widget in order to build... |
mikeller
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this is pulling in some likely unwanted libdivecomputer changes - you probably need to make sure that libdivecomputer is on the latest version of Subsurface-DS9 in your branch.
Signed-off-by: Robert C. Helling <[email protected]>
|
Artifacts: |
|
Artifacts: |
|
Artifacts: |
|
If QLiteHtml is supported on all platforms, I would suggest replacing the old code instead of adding ifdef-ery complexity. |
| previewWidget.setStyleSheet(QString( | ||
| "QLiteHtmlWidget" | ||
| " { selection-background-color: %1; selection-color: %2; }") | ||
| .arg(colorBack).arg(colorText)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does .arg(colorBack, colorText) not work?
Yeah, this is not performance sensitive, but still...
These are the first steps using QLiteHtml for printing logbook pages in Qt6.
State of affairs: It prints logbook pages but all sizes are wrong. But I think it looks promising.
It does not try to really parse the html (which was a show stopper in the past) but simply uses a regex to do the
div class="diveProfile" to img replacement. This could also be done with xslt but not by me.
It requires the latest version of litehtml which contains a fix for a bug that would overlap tables. Maybe @dirkhh could update his QLiteHtml branch.
Describe the pull request:
Pull request long description:
Changes made:
Related issues:
Additional information:
Documentation change:
Mentions: