Small performance improvements

This commit is contained in:
Albert Astals Cid 2019-10-05 20:18:28 +02:00
parent 92232d81ba
commit da21543a50
8 changed files with 9 additions and 9 deletions

View File

@ -32,7 +32,7 @@ class MessageBoxHelper : public QObject
public:
MessageBoxHelper(QMessageBox::StandardButton b, QString message, QMessageBox::Icon icon, QString title, bool hasCheckBox )
: m_button(b), m_clicked(false), m_message(message), m_icon(icon), m_title(title), m_checkBox(hasCheckBox)
: m_button(b), m_clicked(false), m_message(std::move(message)), m_icon(icon), m_title(std::move(title)), m_checkBox(hasCheckBox)
{
QTimer::singleShot(0, this, &MessageBoxHelper::closeMessageBox);
}

View File

@ -21,7 +21,7 @@ namespace TestingUtils
return annotXmlString;
}
bool pointListsAlmostEqual( QLinkedList< Okular::NormalizedPoint > points1, QLinkedList< Okular::NormalizedPoint > points2 ) {
bool pointListsAlmostEqual( const QLinkedList< Okular::NormalizedPoint > &points1, const QLinkedList< Okular::NormalizedPoint > &points2 ) {
QLinkedListIterator<Okular::NormalizedPoint> it1( points1 );
QLinkedListIterator<Okular::NormalizedPoint> it2( points2 );

View File

@ -30,7 +30,7 @@ namespace TestingUtils
* Returns true if the pairwise comparison coordinates of points in @p points1 and @p points2 are almost
* equal (according to qFuzzyCompare)
*/
bool pointListsAlmostEqual( QLinkedList< Okular::NormalizedPoint > points1, QLinkedList< Okular::NormalizedPoint > points2 );
bool pointListsAlmostEqual( const QLinkedList< Okular::NormalizedPoint > &points1, const QLinkedList< Okular::NormalizedPoint > &points2 );
/*
* The AnnotationDisposeWatcher class provides a static disposeAnnotation function

View File

@ -2298,7 +2298,7 @@ int DocumentPrivate::findFieldPageNumber( Okular::FormField *field )
return foundPage;
}
void DocumentPrivate::executeScriptEvent( std::shared_ptr< Event > event, const Okular::ScriptAction * linkscript )
void DocumentPrivate::executeScriptEvent( const std::shared_ptr< Event > &event, const Okular::ScriptAction * linkscript )
{
if ( !m_scripter )
{

View File

@ -234,7 +234,7 @@ class DocumentPrivate
/*
* Executes a ScriptAction with the event passed as parameter.
*/
void executeScriptEvent( std::shared_ptr< Event > event, const Okular::ScriptAction * linkscript );
void executeScriptEvent( const std::shared_ptr< Event > &event, const Okular::ScriptAction * linkscript );
/*
* Find the corresponding page number for the form field passed as parameter.

View File

@ -1760,7 +1760,7 @@ static RegionTextList XYCutForBoundingBoxes(const QList<WordWithCharacters> &wor
{
for( int j = 0 ; j < list.length() ; ++j )
{
const WordWithCharacters word = list.at(j);
const WordWithCharacters &word = list.at(j);
const QRect wordRect = word.area().geometry(pageWidth,pageHeight);
if(topRect.intersects(wordRect))
@ -1781,7 +1781,7 @@ static RegionTextList XYCutForBoundingBoxes(const QList<WordWithCharacters> &wor
{
for( int j = 0 ; j < list.length() ; ++j )
{
const WordWithCharacters word = list.at(j);
const WordWithCharacters &word = list.at(j);
const QRect wordRect = word.area().geometry(pageWidth,pageHeight);
if(leftRect.intersects(wordRect))

View File

@ -31,7 +31,7 @@ Converter::~Converter()
{
}
void Converter::handleMetadata(const QMap<Mobipocket::Document::MetaKey,QString> metadata)
void Converter::handleMetadata(const QMap<Mobipocket::Document::MetaKey,QString> &metadata)
{
QMapIterator<Mobipocket::Document::MetaKey,QString> it(metadata);
while (it.hasNext()) {

View File

@ -25,7 +25,7 @@ namespace Mobi {
QTextDocument *convert( const QString &fileName ) override;
private:
void handleMetadata(const QMap<Mobipocket::Document::MetaKey, QString> metadata);
void handleMetadata(const QMap<Mobipocket::Document::MetaKey, QString> &metadata);
};
}