2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2006-2007 Pino Toscano <pino@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2006-12-27 23:56:38 +00:00
|
|
|
|
2007-12-24 00:54:21 +00:00
|
|
|
#ifndef OKULAR_GUIUTILS_H
|
|
|
|
#define OKULAR_GUIUTILS_H
|
2006-12-27 23:56:38 +00:00
|
|
|
|
2020-09-03 11:02:13 +00:00
|
|
|
#include <QColor>
|
|
|
|
#include <QIcon>
|
2016-07-21 19:53:54 +00:00
|
|
|
#include <QString>
|
2007-04-19 18:30:20 +00:00
|
|
|
|
2012-06-12 10:19:21 +00:00
|
|
|
class QImage;
|
2008-09-19 20:21:57 +00:00
|
|
|
class QPixmap;
|
|
|
|
class QSize;
|
2008-04-14 22:31:28 +00:00
|
|
|
class QWidget;
|
2016-03-23 00:58:38 +00:00
|
|
|
class QFile;
|
2007-12-24 15:02:32 +00:00
|
|
|
|
2006-12-27 23:56:38 +00:00
|
|
|
namespace Okular
|
|
|
|
{
|
|
|
|
class Annotation;
|
2008-04-14 22:31:28 +00:00
|
|
|
class EmbeddedFile;
|
2012-09-27 12:14:03 +00:00
|
|
|
class Movie;
|
|
|
|
class ScreenAnnotation;
|
2006-12-27 23:56:38 +00:00
|
|
|
}
|
|
|
|
|
2007-12-24 00:54:21 +00:00
|
|
|
namespace GuiUtils
|
2006-12-27 23:56:38 +00:00
|
|
|
{
|
2007-09-08 14:44:21 +00:00
|
|
|
/**
|
|
|
|
* Returns the translated string with the type of the given @p annotation.
|
|
|
|
*/
|
|
|
|
QString captionForAnnotation(const Okular::Annotation *annotation);
|
|
|
|
QString authorForAnnotation(const Okular::Annotation *annotation);
|
2006-12-28 00:40:09 +00:00
|
|
|
|
2007-09-08 14:44:21 +00:00
|
|
|
QString contentsHtml(const Okular::Annotation *annotation);
|
2007-07-17 20:58:38 +00:00
|
|
|
|
2007-09-08 14:44:21 +00:00
|
|
|
QString prettyToolTip(const Okular::Annotation *annotation);
|
2007-09-08 14:41:40 +00:00
|
|
|
|
2008-04-14 22:31:28 +00:00
|
|
|
void saveEmbeddedFile(Okular::EmbeddedFile *ef, QWidget *parent);
|
2016-03-23 00:58:38 +00:00
|
|
|
void writeEmbeddedFile(Okular::EmbeddedFile *ef, QWidget *parent, QFile &targetFile);
|
2012-09-27 12:14:03 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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);
|
2012-06-12 10:19:21 +00:00
|
|
|
|
|
|
|
// colorize a gray image to the given color
|
|
|
|
void colorizeImage(QImage &image, const QColor &color, unsigned int alpha = 255);
|
2020-09-03 11:02:13 +00:00
|
|
|
|
|
|
|
enum ColorIconFlags {
|
|
|
|
NoFlags = 0x0,
|
|
|
|
VisualizeTransparent = 0x1 ///< Visualizes Qt::transparent with a cross.
|
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Paints color rectangles on the lower 25% of an icon.
|
|
|
|
*
|
|
|
|
* If no icon is given, the whole icon square is filled, and a 1px border is added.
|
|
|
|
*
|
|
|
|
* Examples:
|
|
|
|
* * Different icons for different kinds of color selection, like fill and outline.
|
|
|
|
* * Selection of a color scheme preset, where each scheme has a different icon and ~1..3 specific colors.
|
|
|
|
*
|
|
|
|
* @param colors Which color rectangles to paint, from left to right (even on RTL). Colors may be transparent. Invalid colors are skipped.
|
|
|
|
* @param background Which icon to use as background.
|
|
|
|
* @param flags Special wishes.
|
|
|
|
*
|
|
|
|
* @returns A newly created QIcon.
|
|
|
|
*/
|
|
|
|
QIcon createColorIcon(const QList<QColor> &colors, const QIcon &background = QIcon(), ColorIconFlags flags = NoFlags);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Creates an opacity icon, using QPalette foreground color
|
|
|
|
* painted on top of a checkerboard pattern using @p opacity.
|
|
|
|
*
|
|
|
|
* @param opacity 0 = invisible, 1 = opaque.
|
|
|
|
*/
|
|
|
|
QIcon createOpacityIcon(qreal opacity);
|
|
|
|
|
2007-09-08 14:44:21 +00:00
|
|
|
}
|
2006-12-27 23:56:38 +00:00
|
|
|
|
|
|
|
#endif
|