mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-02 22:23:43 +00:00
f15e8568a5
Summary: Configuration: - Add push button to select custom stamp image - Check if loaded image is usable as stamp or throw error - Keep image proportions in previewer - Move previewer below the combobox to display larger preview Annotation tool: - Keep stamp image proportion in annotation preview (while left mouse button is down) - Adding the annotation with one-click (without holding the left mouse button and dragging) adds the stamp with original proportions BUG: 370381 BUG: 383652 CCBUG: 383651 FIXED-IN: 1.9.0 Closes T8074 TODO: - [ ] Check if filters in file chooser make sense / propose better alternative - [x] Update doc ( @yurchor will do it after we merge this) Test Plan: From stamp annotation configuration dialog: - Show a warning regarding limitations of the feature's current implementation - Click push button next to combo box opens a file selector - Selecting a corrupted image file should throw an error - Selecting a good image file shows the preview of the image - Select a horizontal image shows a large clear preview - Select a vertical image file shows a smaller preview without messing up the visual of the config dialog - Input a valid icon name in the combobox and the preview of the icon is shown From page view, select the stamp annotation with horizontal image file (not squared): - Click and hold. The preview maintains proportions - Single click. The stamp image in the pdf maintains proportions and has the same size of the click and hold preview. - Add an annotation of the Okular custom stamps (internal SVG so treated slightly differently) do not create problems Reviewers: #okular, ngraham Reviewed By: ngraham Subscribers: pino, aacid, yurchor, ngraham, okular-devel Tags: #okular Maniphest Tasks: T8074 Differential Revision: https://phabricator.kde.org/D22064
71 lines
2.4 KiB
C++
71 lines
2.4 KiB
C++
/***************************************************************************
|
|
* Copyright (C) 2006-2007 by Pino Toscano <pino@kde.org> *
|
|
* *
|
|
* This program is free software; you can redistribute it and/or modify *
|
|
* it under the terms of the GNU General Public License as published by *
|
|
* the Free Software Foundation; either version 2 of the License, or *
|
|
* (at your option) any later version. *
|
|
***************************************************************************/
|
|
|
|
#ifndef OKULAR_GUIUTILS_H
|
|
#define OKULAR_GUIUTILS_H
|
|
|
|
#include <QString>
|
|
|
|
class QColor;
|
|
class QImage;
|
|
class QPixmap;
|
|
class QSize;
|
|
class QWidget;
|
|
class QFile;
|
|
class KIconLoader;
|
|
|
|
namespace Okular {
|
|
class Annotation;
|
|
class EmbeddedFile;
|
|
class Movie;
|
|
class ScreenAnnotation;
|
|
}
|
|
|
|
namespace GuiUtils
|
|
{
|
|
/**
|
|
* Returns the translated string with the type of the given @p annotation.
|
|
*/
|
|
QString captionForAnnotation( const Okular::Annotation * annotation );
|
|
QString authorForAnnotation( const Okular::Annotation * annotation );
|
|
|
|
QString contentsHtml( const Okular::Annotation * annotation );
|
|
|
|
QString prettyToolTip( const Okular::Annotation * annotation );
|
|
|
|
/**
|
|
* Returns a pixmap for a stamp symbol
|
|
*
|
|
* @p name Name of a Okular stamp symbol, icon or path to an image
|
|
* @p size Size of the pixmap (ignore aspect ratio). Takes precedence over @p iconSize
|
|
* @p iconSize Maximum size of the pixmap (keep aspect ratio)
|
|
*/
|
|
QPixmap loadStamp( const QString& nameOrPath, int size, bool keepAspectRatio = true );
|
|
|
|
void addIconLoader( KIconLoader * loader );
|
|
void removeIconLoader( KIconLoader * loader );
|
|
KIconLoader* iconLoader();
|
|
|
|
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent );
|
|
void writeEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent, QFile& targetFile );
|
|
|
|
/**
|
|
* Returns the movie object that is referenced by a rendition action of the passed screen @p annotation
|
|
* or @c 0 if the screen annotation has no rendition action set or the rendition action does not contain
|
|
* a media rendition.
|
|
*/
|
|
Okular::Movie* renditionMovieFromScreenAnnotation( const Okular::ScreenAnnotation * annotation );
|
|
|
|
// colorize a gray image to the given color
|
|
void colorizeImage( QImage & image, const QColor & color, unsigned int alpha = 255 );
|
|
}
|
|
|
|
|
|
#endif
|