okular: remove redundant icon loader glue

there is always only one icon loader and it is KIconLoader::global()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-20 18:49:23 +03:00
parent ca5dc4efc0
commit 11f661d034
4 changed files with 3 additions and 27 deletions

View file

@ -316,8 +316,6 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
// we need an instance
setComponentData( componentData );
GuiUtils::addIconLoader( iconLoader() );
m_sidebar = new Sidebar( parentWidget );
setWidget( m_sidebar );
connect( m_sidebar, SIGNAL(urlsDropped(KUrl::List)), SLOT(handleDroppedUrls(KUrl::List)) );
@ -801,7 +799,6 @@ void Part::setupActions()
Part::~Part()
{
GuiUtils::removeIconLoader( iconLoader() );
m_document->removeObserver( this );
m_document->removeObserver( m_toc );

View file

@ -23,8 +23,6 @@
#include "core/annotations.h"
#include "core/document.h"
K_GLOBAL_STATIC( QList<KIconLoader *>, s_data )
namespace GuiUtils {
QString captionForAnnotation( const Okular::Annotation * ann )
@ -134,7 +132,7 @@ QPixmap loadStamp( const QString& _name, const QSize& size, int iconSize )
return QPixmap(stampFile).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
}
QPixmap pixmap;
const KIconLoader * il = iconLoader();
const KIconLoader * il = KIconLoader::global();
QString path;
const int minSize = iconSize > 0 ? iconSize : qMin( size.width(), size.height() );
pixmap = il->loadIcon( name, KIconLoader::User, minSize, KIconLoader::DefaultState, QStringList(), &path, true );
@ -143,21 +141,6 @@ QPixmap loadStamp( const QString& _name, const QSize& size, int iconSize )
return pixmap;
}
void addIconLoader( KIconLoader * loader )
{
s_data->append( loader );
}
void removeIconLoader( KIconLoader * loader )
{
s_data->removeAll( loader );
}
KIconLoader* iconLoader()
{
return s_data->isEmpty() ? KIconLoader::global() : s_data->back();
}
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent )
{
const QString caption = i18n( "Where do you want to save %1?", ef->name() );

View file

@ -40,10 +40,6 @@ namespace GuiUtils
QPixmap loadStamp( const QString& name, const QSize& size, int iconSize = 0 );
void addIconLoader( KIconLoader * loader );
void removeIconLoader( KIconLoader * loader );
KIconLoader* iconLoader();
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent );
// colorize a gray image to the given color

View file

@ -646,9 +646,9 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula
{
// get pixmap, colorize and alpha-blend it
QString path;
QPixmap pixmap = GuiUtils::iconLoader()->loadIcon( text->textIcon().toLower(), KIconLoader::User, 32, KIconLoader::DefaultState, QStringList(), &path, true );
QPixmap pixmap = KIconLoader::global()->loadIcon( text->textIcon().toLower(), KIconLoader::User, 32, KIconLoader::DefaultState, QStringList(), &path, true );
if ( path.isEmpty() )
pixmap = GuiUtils::iconLoader()->loadIcon( text->textIcon().toLower(), KIconLoader::NoGroup, 32 );
pixmap = KIconLoader::global()->loadIcon( text->textIcon().toLower(), KIconLoader::NoGroup, 32 );
QImage scaledImage;
QRect annotBoundary2 = QRect( annotBoundary.topLeft(), QSize( TEXTANNOTATION_ICONSIZE, TEXTANNOTATION_ICONSIZE ) );
QRect annotRect2 = annotBoundary2.intersected( limits );