mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-24 02:42:52 +00:00
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:
parent
ca5dc4efc0
commit
11f661d034
4 changed files with 3 additions and 27 deletions
|
@ -316,8 +316,6 @@ m_cliPresentation(false), m_cliPrint(false), m_embedMode(detectEmbedMode(parentW
|
||||||
// we need an instance
|
// we need an instance
|
||||||
setComponentData( componentData );
|
setComponentData( componentData );
|
||||||
|
|
||||||
GuiUtils::addIconLoader( iconLoader() );
|
|
||||||
|
|
||||||
m_sidebar = new Sidebar( parentWidget );
|
m_sidebar = new Sidebar( parentWidget );
|
||||||
setWidget( m_sidebar );
|
setWidget( m_sidebar );
|
||||||
connect( m_sidebar, SIGNAL(urlsDropped(KUrl::List)), SLOT(handleDroppedUrls(KUrl::List)) );
|
connect( m_sidebar, SIGNAL(urlsDropped(KUrl::List)), SLOT(handleDroppedUrls(KUrl::List)) );
|
||||||
|
@ -801,7 +799,6 @@ void Part::setupActions()
|
||||||
|
|
||||||
Part::~Part()
|
Part::~Part()
|
||||||
{
|
{
|
||||||
GuiUtils::removeIconLoader( iconLoader() );
|
|
||||||
m_document->removeObserver( this );
|
m_document->removeObserver( this );
|
||||||
m_document->removeObserver( m_toc );
|
m_document->removeObserver( m_toc );
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,6 @@
|
||||||
#include "core/annotations.h"
|
#include "core/annotations.h"
|
||||||
#include "core/document.h"
|
#include "core/document.h"
|
||||||
|
|
||||||
K_GLOBAL_STATIC( QList<KIconLoader *>, s_data )
|
|
||||||
|
|
||||||
namespace GuiUtils {
|
namespace GuiUtils {
|
||||||
|
|
||||||
QString captionForAnnotation( const Okular::Annotation * ann )
|
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);
|
return QPixmap(stampFile).scaled(size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
}
|
}
|
||||||
QPixmap pixmap;
|
QPixmap pixmap;
|
||||||
const KIconLoader * il = iconLoader();
|
const KIconLoader * il = KIconLoader::global();
|
||||||
QString path;
|
QString path;
|
||||||
const int minSize = iconSize > 0 ? iconSize : qMin( size.width(), size.height() );
|
const int minSize = iconSize > 0 ? iconSize : qMin( size.width(), size.height() );
|
||||||
pixmap = il->loadIcon( name, KIconLoader::User, minSize, KIconLoader::DefaultState, QStringList(), &path, true );
|
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;
|
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 )
|
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent )
|
||||||
{
|
{
|
||||||
const QString caption = i18n( "Where do you want to save %1?", ef->name() );
|
const QString caption = i18n( "Where do you want to save %1?", ef->name() );
|
||||||
|
|
|
@ -40,10 +40,6 @@ namespace GuiUtils
|
||||||
|
|
||||||
QPixmap loadStamp( const QString& name, const QSize& size, int iconSize = 0 );
|
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 );
|
void saveEmbeddedFile( Okular::EmbeddedFile *ef, QWidget *parent );
|
||||||
|
|
||||||
// colorize a gray image to the given color
|
// colorize a gray image to the given color
|
||||||
|
|
|
@ -646,9 +646,9 @@ void PagePainter::paintCroppedPageOnPainter( QPainter * destPainter, const Okula
|
||||||
{
|
{
|
||||||
// get pixmap, colorize and alpha-blend it
|
// get pixmap, colorize and alpha-blend it
|
||||||
QString path;
|
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() )
|
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;
|
QImage scaledImage;
|
||||||
QRect annotBoundary2 = QRect( annotBoundary.topLeft(), QSize( TEXTANNOTATION_ICONSIZE, TEXTANNOTATION_ICONSIZE ) );
|
QRect annotBoundary2 = QRect( annotBoundary.topLeft(), QSize( TEXTANNOTATION_ICONSIZE, TEXTANNOTATION_ICONSIZE ) );
|
||||||
QRect annotRect2 = annotBoundary2.intersected( limits );
|
QRect annotRect2 = annotBoundary2.intersected( limits );
|
||||||
|
|
Loading…
Add table
Reference in a new issue