Skip to content

Add a command line option to open file as file-layer

Saurabh Kumar requested to merge confifu/krita:confifu/addFileLayer into master

These changes will add a command line option that would open an image as file layer. Link to the feature request.

Test Plan

  • open krita with path/to/krita --new-image laba, U16,1000,1000 --file-layer path/to/image.jpg to create a new image and add path/to/image.jpg as file layer to krita.
  • Open another terminal and run path/to/krita --file-layer path/to/image.jpg. If the Allow only one instance of Krita box in Settings->General->Window is checked the file will be added to existing image. If not a new instance of krita will open with the warning Check the Allow only one instance of Krita box in Settings->General->Window to import file as file Layer.
  • Open krita without any files and repeat step 2. If the mentioned box is checked you will see a warning in the terminal running the original instance No image to add file to as file-layer. Otherwise a new Krita window will be created with the warning in step 2.
  • Open krita with path/to/krita file1.kra --file-layer path/to/image.jpg to add the image as file layer to existing file file1.kra
  • Close all instances of Krita and open a new one using path/to/krita --file-layer path/to/image.jpg. Krita will open with a warning No image to add the file to as file-layer Either create new-file using --new-file or open an existing file.
  • If the file path/to/image.jpg does not exist a warning `Cannot add path/to/image.jpg as a file layer: the file does not exist.

Formalities Checklist

  • I confirmed this builds.
  • I confirmed Krita ran and the relevant functions work.
  • I tested the relevant unit tests and can confirm they are not broken. (If not possible, don't hesitate to ask for help!)
  • I made sure my commits build individually and have good descriptions as per KDE guidelines.
  • I made sure my code conforms to the standards set in the HACKING file.
  • I can confirm the code is licensed and attributed appropriately, and that unattributed code is mine, as per KDE Licensing Policy.

/label Needs Review

Edited by Saurabh Kumar

Merge request reports