Commit 643a0804 authored by Kai Uwe Broulik's avatar Kai Uwe Broulik 🍇 Committed by Oliver Sander
Browse files

Port SearchLineWidget to use KBusyIndicatorWidget

It's a lot nicer than manually painting a KPixmapSequence and supports high dpi out of the box.

The new code requires Frameworks >= 5.61, it is therefore only enabled
if at least that Frameworks version is available.
parent 75aa4ad8
Pipeline #13251 passed with stage
in 10 minutes and 52 seconds
......@@ -17,10 +17,14 @@
#include <qapplication.h>
#include <qlayout.h>
#include <qtimer.h>
#include <kcolorscheme.h>
#include <kiconloader.h>
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 61, 0)
#include <kbusyindicatorwidget.h>
#else
#include <kpixmapsequence.h>
#include <kpixmapsequencewidget.h>
#endif
#include <kcolorscheme.h>
#include <kiconloader.h>
#include <kmessagebox.h>
#include <klocalizedstring.h>
......@@ -286,7 +290,11 @@ SearchLineWidget::SearchLineWidget( QWidget * parent, Okular::Document * documen
m_edit = new SearchLineEdit( this, document );
layout->addWidget( m_edit );
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 61, 0)
m_anim = new KBusyIndicatorWidget( this );
#else
m_anim = new KPixmapSequenceWidget( this );
#endif
m_anim->setFixedSize( 22, 22 );
layout->addWidget( m_anim );
m_anim->hide();
......@@ -317,6 +325,7 @@ void SearchLineWidget::slotSearchStopped()
void SearchLineWidget::slotTimedout()
{
#if KWIDGETSADDONS_VERSION < QT_VERSION_CHECK(5, 61, 0)
if ( m_anim->sequence().isEmpty() )
{
const KPixmapSequence seq = KIconLoader::global()->loadPixmapSequence(QStringLiteral("process-working"), 22);
......@@ -326,6 +335,7 @@ void SearchLineWidget::slotTimedout()
m_anim->setSequence( seq );
}
}
#endif
m_anim->show();
}
......
......@@ -15,8 +15,13 @@
#include <klineedit.h>
class QTimer;
#include <kwidgetsaddons_version.h>
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 61, 0)
class KBusyIndicatorWidget;
#else
class KPixmapSequenceWidget;
#endif
class QTimer;
/**
* @short A line edit for find-as-you-type search. Outputs to the Document.
......@@ -89,7 +94,11 @@ class SearchLineWidget : public QWidget
private:
SearchLineEdit *m_edit;
#if KWIDGETSADDONS_VERSION >= QT_VERSION_CHECK(5, 61, 0)
KBusyIndicatorWidget* m_anim;
#else
KPixmapSequenceWidget* m_anim;
#endif
QTimer *m_timer;
};
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment