Add opening a file via the command line.
ClosedPublic

Authored by woltherav on Oct 4 2018, 7:07 PM.

Details

Summary

This adds a positional argument to peruse's command line, which accepts a file url, which will then be opened upon the opening of the mainwindow qml file.

Of course, the real reason we'd want this is that this also makes opening a file directly from Dolphin or other such sources possible :)

Test Plan

After building/applying patch, open a file like Peruse bla.cbz, or try opening via dolphin.

Diff Detail

Repository
R157 Peruse
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
woltherav requested review of this revision.Oct 4 2018, 7:07 PM
woltherav created this revision.
pino requested changes to this revision.Oct 4 2018, 7:13 PM
pino added a subscriber: pino.

Also, please append the %f placeholder to the command in the Exec of the two .desktop files: this way, it will be possible to select peruse (and perusecreator) as application for opening the comics.

src/app/main.cpp
49

no need to initialize it explicitly, just QString filename; is enough

src/app/qml/PeruseMain.qml
305

unneeded change

src/common/peruse_helpers.h
11

const & for "filename"

src/creator/main.cpp
43

same as in peruse

This revision now requires changes to proceed.Oct 4 2018, 7:13 PM
leinir added inline comments.Oct 5 2018, 11:30 AM
src/app/qml/PeruseMain.qml
317

Always was a bit worried that something like this might adversely affect the experience, since the scanner will be going in the background... have you noticed anything while working on this?

woltherav added inline comments.Oct 5 2018, 12:32 PM
src/app/qml/PeruseMain.qml
317

I haven't but then, that's also why I am not pushing it directly, because I am not sure what the consequences might be?

leinir added inline comments.Oct 5 2018, 12:45 PM
src/app/qml/PeruseMain.qml
317

Really, the only consequence should be that it would be slow for the first while, until the scan is completed... If there are other side effects, then they would want fixing, because obviously, we don't want to postpone much later than this :)

woltherav updated this revision to Diff 42919.Oct 5 2018, 1:00 PM
woltherav marked 4 inline comments as done.

Added fixes @pino requested. I hope I did the desktop file one correctly.

This comment was removed by woltherav.
leinir accepted this revision.Oct 8 2018, 10:57 AM

Looks good from here - unless @pino has further to add, go for it :)

This revision was not accepted when it landed; it landed in state Needs Review.Oct 8 2018, 11:29 AM
This revision was automatically updated to reflect the committed changes.