Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ What gets stored (if allowed): cookies.
| Window transparency | ✅ | ❌ | See-through websites |
| Full-page snapshots | ✅ | ❌ | Possible with plug-ins |
| Transparent snapshots | ✅ | ❌ | See-through snapshots of websites |
| Vector snapshots | ❌ | ❌ | Experimental feature, SVG |
| Vector snapshots | ✅ | ❌ | Experimental feature, SVG with selectable text |
| Ability to save pages as monolithic HTML files | ❌ | ❌ | Possible with plug-ins |
| Complete absence of pop-up windows | ✅ | ❌ | Can be optionally disabled in most browsers |
| Ability to completely disable JS | ✅ | ✅ | |
Expand Down Expand Up @@ -61,6 +61,7 @@ What gets stored (if allowed): cookies.
| Stop loading / exit from full-screen mode | `Esc` | |
| Take snapshot | `Ctrl`+`T` | |
| Take full-page snapshot | `Ctrl`+`Shift`+`T` | |
| Take vector snapshot (SVG) | `Ctrl`+`Shift`+`S` | |
| Toggle window size lock | `Ctrl`+`L` | |
| Toggle mute | `Ctrl`+`M` | |
| Refresh current page | `Ctrl`+`R` | |
Expand Down
10 changes: 7 additions & 3 deletions inc/liquidappwindow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ public slots:
void stopLoadingOrExitFullScreenMode(void);
void takeSnapshotSlot(void);
void takeSnapshotFullPageSlot(void);
void takeVectorSnapshot(void);
void toggleFullScreenMode(void);
void toggleWindowGeometryLock(void);
void updateWindowTitle(const QString title);
Expand All @@ -60,11 +61,13 @@ public slots:
void takeSnapshot(const bool fullPage);
QImage captureFullPage(void);
void renderSnapshot(QPainter* painter);
void flash(void);
static QString getSnapshotsDirPath(void);
static bool isUserInputEvent(const QEvent::Type eventType);
static bool isEscapeKeyEvent(QEvent* event);
QVariant runJavaScriptSync(const QString& js, const int timeoutMs = 5000);
void waitForNextFrame(void);
const QString colorToRgba(const QColor color);
bool waitForDocumentToFinishLoading(void);

QString* liquidAppName;

Expand All @@ -84,8 +87,8 @@ public slots:
bool pageHasError = false;
bool pageIsLoading = false;
bool windowGeometryIsLocked = false;
bool isCapturingFullPage = false;
bool fullPageCaptureCancelled = false;
bool isTakingSnapshot = false;
bool snapshotCancelled = false;

QNetworkProxy* proxy = Q_NULLPTR;

Expand All @@ -103,6 +106,7 @@ public slots:
QAction* stopLoadingOrExitFullScreenModeAction;
QAction* takeSnapshotAction;
QAction* takeSnapshotFullPageAction;
QAction* takeSnapshotVectorAction;
QAction* toggleFullScreenModeAction;
QAction* toggleFullScreenModeAction2;
QAction* toggleGeometryLockAction;
Expand Down
5 changes: 4 additions & 1 deletion inc/lqd.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
#define LQD_SNAPSHOT_FLASH_HOLD 50 // Milliseconds at full brightness
#define LQD_SNAPSHOT_FLASH_FADE 300 // Milliseconds to fade out
#define LQD_SNAPSHOT_FLASH_OPACITY 0.8
#define LQD_FRAME_WAIT_WITHOUT_JS 200 // Milliseconds, used by full-page snapshots when JS is disabled
#define LQD_SNAPSHOT_LOAD_WAIT_TIMEOUT 30000 // Milliseconds, for how long snapshots wait for the page to finish loading
#define LQD_VECTOR_SNAPSHOT_TIMEOUT 60000 // Milliseconds
#define LQD_SNAPSHOT_MAX_PIXELS 134217728 // Full-page snapshot size limit, in logical pixels (128 megapixels, 512 MB of RAM)
#define LQD_ZOOM_LVL_MIN 0.25
#define LQD_ZOOM_LVL_MAX 5.0 // Limited to 5.0 by Chromium
Expand Down Expand Up @@ -93,7 +96,7 @@
#define LQD_KBD_SEQ_QUIT "Ctrl+Q"
#define LQD_KBD_SEQ_QUIT_2 "Ctrl+W"
#define LQD_KBD_SEQ_SAVE_PAGE "Ctrl+S"
#define LQD_KBD_SEQ_SAVE_PAGE_AS "Ctrl+Shift+S" // TODO
#define LQD_KBD_SEQ_TAKE_SNAPSHOT_VECTOR "Ctrl+Shift+S"
#define LQD_KBD_SEQ_ZOOM_LVL_INC "Ctrl+="
#define LQD_KBD_SEQ_ZOOM_LVL_INC_FINE "Ctrl+Shift+="
#define LQD_KBD_SEQ_ZOOM_LVL_DEC "Ctrl+-"
Expand Down
18 changes: 18 additions & 0 deletions inc/svgsnapshot.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#pragma once

#include <QByteArray>
#include <QColor>
#include <QString>

// Turns the output of html2svg.js (a JSON list of primitive shapes) into an SVG document.
//
// The page that the shapes came from is untrusted, so nothing gets copied from it into the SVG as-is:
// only a fixed set of elements and attributes ever gets written, every value gets validated,
// and embedded images get decoded and re-encoded. The result has no scripts, no event handlers,
// no external references, and no embedded HTML, i.e. it's a harmless, frozen picture of the page.
class SvgSnapshot
{
public:
// Returns an empty array (and sets the error, if provided) upon failure
static QByteArray build(const QByteArray& json, const QColor& backdropColor, const qreal zoomFactor, QString* error = Q_NULLPTR);
};
2 changes: 2 additions & 0 deletions liquid.pro
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ HEADERS += inc/lqd.h \
inc/liquidappwindow.hpp \
inc/mainwindow.hpp \
inc/singleinstance.hpp \
inc/svgsnapshot.hpp \

SOURCES += src/liquid.cpp \
src/liquidappcookiejar.cpp \
Expand All @@ -39,6 +40,7 @@ SOURCES += src/liquid.cpp \
src/main.cpp \
src/mainwindow.cpp \
src/singleinstance.cpp \
src/svgsnapshot.cpp \

RESOURCES = res/resources.qrc

Expand Down
Loading
Loading