diff --git a/src/logdata/include/linetypes.h b/src/logdata/include/linetypes.h index c8689d688..70d6c230a 100644 --- a/src/logdata/include/linetypes.h +++ b/src/logdata/include/linetypes.h @@ -306,7 +306,7 @@ class FilePosition { // Length of a tab stop constexpr int TabStop = 8; -inline QString untabify( QString&& line, LineColumn initialPosition = 0_lcol ) +inline QString untabify( QString&& line, const LineColumn& initialPosition = 0_lcol ) { line.replace( QChar::Null, QChar::Space ); diff --git a/src/logdata/include/logdataworker.h b/src/logdata/include/logdataworker.h index 56dcc751f..1a84ebfaf 100644 --- a/src/logdata/include/logdataworker.h +++ b/src/logdata/include/logdataworker.h @@ -216,7 +216,7 @@ class IndexingData { // Atomically add to all the existing // indexing data. - void addAll( const klogg::vector& block, LineLength length, + void addAll( const klogg::vector& block, const LineLength& length, const FastLinePositionArray& linePosition, QTextCodec* encoding ); // Completely clear the indexing data. diff --git a/src/logdata/include/logfiltereddataworker.h b/src/logdata/include/logfiltereddataworker.h index 688cbf1b0..56686f6b2 100644 --- a/src/logdata/include/logfiltereddataworker.h +++ b/src/logdata/include/logfiltereddataworker.h @@ -101,6 +101,7 @@ class SearchData { // Atomically add to all the existing search data. void addAll( LineLength length, const SearchResultArray& matches, LinesCount nbMatches, LinesCount nbLinesProcessed ); + // Get the number of matches LinesCount getNbMatches() const; // Get the last matched line number diff --git a/src/logdata/src/logdataworker.cpp b/src/logdata/src/logdataworker.cpp index dcdeb8f20..e9df49cf3 100644 --- a/src/logdata/src/logdataworker.cpp +++ b/src/logdata/src/logdataworker.cpp @@ -126,7 +126,6 @@ QTextCodec* IndexingData::getForcedEncoding() const void IndexingData::addAll( const klogg::vector& block, LineLength length, const FastLinePositionArray& newLinePosition, QTextCodec* encoding ) - { maxLength_ = std::max( maxLength_, length ); std::visit( diff --git a/src/ui/include/abstractlogview.h b/src/ui/include/abstractlogview.h index de1a5867a..c7e7f5ed3 100644 --- a/src/ui/include/abstractlogview.h +++ b/src/ui/include/abstractlogview.h @@ -247,8 +247,8 @@ class AbstractLogView : public QAbstractScrollArea, public SearchableWidgetInter // Scrolling as necessary void trySelectLine( LineNumber newLine ); void selectAndDisplayLine( LineNumber line ); - void selectPortionAndDisplayLine( LineNumber line, LinesCount nLines, LineColumn startCol, - LineLength nSymbols ); + void selectPortionAndDisplayLine( LineNumber line, LinesCount nLines, const LineColumn& startCol, + const LineLength& nSymbols ); // Use the current QFP to go and select the next match. void searchForward() override; @@ -487,7 +487,7 @@ class AbstractLogView : public QAbstractScrollArea, public SearchableWidgetInter // Utils functions void updateGlobalSelection(); - void selectAndDisplayRange( FilePosition pos ); + void selectAndDisplayRange( const FilePosition& pos ); }; #endif diff --git a/src/ui/include/crawlerwidget.h b/src/ui/include/crawlerwidget.h index 7fe1a4dd6..bc44bbacf 100644 --- a/src/ui/include/crawlerwidget.h +++ b/src/ui/include/crawlerwidget.h @@ -198,11 +198,11 @@ class CrawlerWidget : public QSplitter, void updateFilteredView( LinesCount nbMatches, int progress, LineNumber initialPosition ); // Called when a new line has been selected in the filtered view, // to instruct the main view to jump to the matching line. - void jumpToMatchingLine( LineNumber filteredLineNb, LinesCount nLines, LineColumn startCol, - LineLength nSymbols ); + void jumpToMatchingLine( LineNumber filteredLineNb, LinesCount nLines, const LineColumn& startCol, + const LineLength& nSymbols ); // Called when the main view is on a new line number - void updateLineNumberHandler( LineNumber line, LinesCount nLines, LineColumn startCol, - LineLength nSymbols ); + void updateLineNumberHandler( LineNumber line, LinesCount nLines, const LineColumn& startCol, + const LineLength& nSymbols ); // Mark a line that has been clicked on the main (top) view. void markLinesFromMain( const klogg::vector& lines ); // Mark a line that has been clicked on the filtered (bottom) view. diff --git a/src/ui/include/mainwindow.h b/src/ui/include/mainwindow.h index 5ef9f2282..229899883 100644 --- a/src/ui/include/mainwindow.h +++ b/src/ui/include/mainwindow.h @@ -146,8 +146,8 @@ class MainWindow : public QMainWindow { // Update the selection information displayed in the status bar. // Must be passed as the internal (starts at 0) line number. - void lineNumberHandler( LineNumber startLine, LinesCount nLines, LineColumn startCol, - LineLength nSymbols ); + void lineNumberHandler( LineNumber startLine, LinesCount nLines, const LineColumn& startCol, + const LineLength& nSymbols ); // Save current search in line edit as predefined filter. // Opens dialog with new entry. diff --git a/src/ui/include/quickfind.h b/src/ui/include/quickfind.h index 57a8af566..94e5ac3f9 100644 --- a/src/ui/include/quickfind.h +++ b/src/ui/include/quickfind.h @@ -152,7 +152,7 @@ class QuickFind : public QObject { class LastMatchPosition { public: - void set( LineNumber line, LineColumn column ); + void set( LineNumber line, const LineColumn& column ); void set( const FilePosition& position ); void reset() { @@ -160,10 +160,10 @@ class QuickFind : public QObject { column_ = LineColumn{-1}; } // Does the passed position come after the recorded one - bool isLater( OptionalLineNumber line, LineColumn column ) const; + bool isLater( OptionalLineNumber line, const LineColumn& column ) const; bool isLater( const FilePosition& position ) const; // Does the passed position come before the recorded one - bool isSooner( OptionalLineNumber line, LineColumn column ) const; + bool isSooner( OptionalLineNumber line, const LineColumn& column ) const; bool isSooner( const FilePosition& position ) const; private: diff --git a/src/ui/include/quickfindpattern.h b/src/ui/include/quickfindpattern.h index e26d3dc0f..8a3bff263 100644 --- a/src/ui/include/quickfindpattern.h +++ b/src/ui/include/quickfindpattern.h @@ -69,10 +69,10 @@ class QuickFindMatcher { // Returns whether there is a match in the passed line, starting at // the passed column. // Results are stored internally. - bool isLineMatching( const QString& line, LineColumn column = 0_lcol ) const; + bool isLineMatching( const QString& line, const LineColumn& column = 0_lcol ) const; // Same as isLineMatching but search backward - bool isLineMatchingBackward( const QString& line, LineColumn column = LineColumn{-1} ) const; + bool isLineMatchingBackward( const QString& line, const LineColumn& column = LineColumn{-1} ) const; // Must be called when isLineMatching returns 'true', returns // the position of the first match found. diff --git a/src/ui/include/selection.h b/src/ui/include/selection.h index fddd43e8f..36acd10ae 100644 --- a/src/ui/include/selection.h +++ b/src/ui/include/selection.h @@ -94,7 +94,7 @@ class Selection { selectedLine_ = line; } // Select a portion of line (both start and end included) - void selectPortion( LineNumber line, LineColumn startColumn, LineColumn endColumn ); + void selectPortion( LineNumber line, const LineColumn& startColumn, const LineColumn& endColumn ); void selectPortion( const Portion& selection ) { selectPortion( selection.line(), selection.startColumn(), selection.endColumn() ); @@ -145,7 +145,7 @@ class Selection { bool isLineSelected( LineNumber line ) const; // Returns wether the line passed is selected in certain range. - bool isPortionSelected( LineNumber line, LineColumn startColumn, LineColumn endColumn ) const; + bool isPortionSelected( LineNumber line, const LineColumn& startColumn, const LineColumn& endColumn ) const; // Returns the line selected or -1 if not a single line selection OptionalLineNumber selectedLine() const; diff --git a/src/ui/src/abstractlogview.cpp b/src/ui/src/abstractlogview.cpp index f53d457eb..517fb64d7 100644 --- a/src/ui/src/abstractlogview.cpp +++ b/src/ui/src/abstractlogview.cpp @@ -10,7 +10,7 @@ * (at your option) any later version. * * glogg is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of + * but WITHOUT ANY WARRANTY; without even the implied warranty o * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * @@ -1686,7 +1686,7 @@ void AbstractLogView::selectAndDisplayLine( LineNumber line ) } void AbstractLogView::selectPortionAndDisplayLine( LineNumber line, LinesCount nLines, - LineColumn startCol, LineLength nSymbols ) + const LineColumn& startCol, const LineLength& nSymbols ) { disableFollow(); selection_.selectLine( line ); @@ -1981,7 +1981,7 @@ void AbstractLogView::updateGlobalSelection() } } -void AbstractLogView::selectAndDisplayRange( FilePosition pos ) +void AbstractLogView::selectAndDisplayRange( const FilePosition& pos ) { disableFollow(); selection_.selectRange( selectionStartPos_.line(), pos.line() ); diff --git a/src/ui/src/crawlerwidget.cpp b/src/ui/src/crawlerwidget.cpp index 707e101a8..cc82511bf 100644 --- a/src/ui/src/crawlerwidget.cpp +++ b/src/ui/src/crawlerwidget.cpp @@ -545,7 +545,7 @@ void CrawlerWidget::updateFilteredView( LinesCount nbMatches, int progress, } void CrawlerWidget::jumpToMatchingLine( LineNumber filteredLineNb, LinesCount nLines, - LineColumn startCol, LineLength nSymbols ) + const LineColumn& startCol, const LineLength& nSymbols ) { const auto mainViewLine = logFilteredData_->getMatchingLineNumber( filteredLineNb ); logMainView_->selectPortionAndDisplayLine( mainViewLine, nLines, startCol, @@ -553,7 +553,7 @@ void CrawlerWidget::jumpToMatchingLine( LineNumber filteredLineNb, LinesCount nL } void CrawlerWidget::updateLineNumberHandler( LineNumber line, LinesCount nLines, - LineColumn startCol, LineLength nSymbols ) + const LineColumn& startCol, const LineLength& nSymbols ) { currentLineNumber_ = line; Q_EMIT newSelection( line, nLines, startCol, nSymbols ); diff --git a/src/ui/src/mainwindow.cpp b/src/ui/src/mainwindow.cpp index e53066863..29d519942 100644 --- a/src/ui/src/mainwindow.cpp +++ b/src/ui/src/mainwindow.cpp @@ -1319,8 +1319,8 @@ void MainWindow::changeFollowMode( bool follow ) followAction->setChecked( follow ); } -void MainWindow::lineNumberHandler( LineNumber startLine, LinesCount nLines, LineColumn startCol, - LineLength nSymbols ) +void MainWindow::lineNumberHandler( LineNumber startLine, LinesCount nLines, const LineColumn& startCol, + const LineLength& nSymbols ) { // The line number received is the internal (starts at 0) uint64_t fileSize{}; diff --git a/src/ui/src/quickfind.cpp b/src/ui/src/quickfind.cpp index 0e3beebed..bb4b0f46e 100644 --- a/src/ui/src/quickfind.cpp +++ b/src/ui/src/quickfind.cpp @@ -71,7 +71,7 @@ void SearchingNotifier::sendNotification( LineNumber current_line, LinesCount nb startTime_ = QTime::currentTime().addMSecs( -800 ); } -void QuickFind::LastMatchPosition::set( LineNumber line, LineColumn column ) +void QuickFind::LastMatchPosition::set( LineNumber line, const LineColumn& column ) { if ( ( !line_.has_value() ) || ( ( line <= *line_ ) && ( column < column_ ) ) ) { line_ = line; @@ -84,7 +84,7 @@ void QuickFind::LastMatchPosition::set( const FilePosition& position ) set( position.line(), position.column() ); } -bool QuickFind::LastMatchPosition::isLater( OptionalLineNumber line, LineColumn column ) const +bool QuickFind::LastMatchPosition::isLater( OptionalLineNumber line, const LineColumn& column ) const { if ( !line_.has_value() || !line.has_value() ) return false; @@ -101,7 +101,7 @@ bool QuickFind::LastMatchPosition::isLater( const FilePosition& position ) const return isLater( position.line(), position.column() ); } -bool QuickFind::LastMatchPosition::isSooner( OptionalLineNumber line, LineColumn column ) const +bool QuickFind::LastMatchPosition::isSooner( OptionalLineNumber line, const LineColumn& column ) const { if ( !line_.has_value() || !line.has_value() ) return false; diff --git a/src/ui/src/quickfindpattern.cpp b/src/ui/src/quickfindpattern.cpp index ebf85e293..8e85484e7 100644 --- a/src/ui/src/quickfindpattern.cpp +++ b/src/ui/src/quickfindpattern.cpp @@ -52,7 +52,7 @@ constexpr Qt::GlobalColor QfForeColor = Qt::black; -bool QuickFindMatcher::isLineMatching( const QString& line, LineColumn column ) const +bool QuickFindMatcher::isLineMatching( const QString& line, const LineColumn& column ) const { if ( !isActive_ ) return false; @@ -68,7 +68,7 @@ bool QuickFindMatcher::isLineMatching( const QString& line, LineColumn column ) } } -bool QuickFindMatcher::isLineMatchingBackward( const QString& line, LineColumn column ) const +bool QuickFindMatcher::isLineMatchingBackward( const QString& line, const LineColumn& column ) const { if ( !isActive_ ) return false; diff --git a/src/ui/src/selection.cpp b/src/ui/src/selection.cpp index 348d997a6..39b49abc2 100644 --- a/src/ui/src/selection.cpp +++ b/src/ui/src/selection.cpp @@ -39,7 +39,7 @@ Selection::Selection() selectedRange_.endLine = 0_lnum; } -void Selection::selectPortion( LineNumber line, LineColumn startColumn, LineColumn endColumn ) +void Selection::selectPortion( LineNumber line, const LineColumn& startColumn, const LineColumn& endColumn ) { // First unselect any whole line or range selectedLine_ = {}; @@ -113,8 +113,8 @@ bool Selection::isLineSelected( LineNumber line ) const return false; } -bool Selection::isPortionSelected( LineNumber line, LineColumn startColumn, - LineColumn endColumn ) const +bool Selection::isPortionSelected( LineNumber line, const LineColumn& startColumn, + const LineColumn& endColumn ) const { if ( isLineSelected( line ) ) { return true; diff --git a/src/utils/include/crc32.h b/src/utils/include/crc32.h index 51f8646f1..c2de9fdef 100644 --- a/src/utils/include/crc32.h +++ b/src/utils/include/crc32.h @@ -24,7 +24,7 @@ class Crc32 { public: - static quint32 calculate( QByteArray text ) + static quint32 calculate( const QByteArray& text ) { quint32 crc32 = 0xffffffff; for ( auto i = 0; i < text.size(); ++i ) { @@ -76,4 +76,4 @@ class Crc32 { 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d }; }; -#endif \ No newline at end of file +#endif diff --git a/src/versioncheck/include/versionchecker.h b/src/versioncheck/include/versionchecker.h index 486e25eeb..8025f31e4 100644 --- a/src/versioncheck/include/versionchecker.h +++ b/src/versioncheck/include/versionchecker.h @@ -94,7 +94,7 @@ class VersionChecker : public QObject { void downloadFinished( QNetworkReply* ); private: - void checkVersionData( QByteArray versionData ); + void checkVersionData( const QByteArray& versionData ); private: QNetworkAccessManager* manager_ = nullptr; diff --git a/src/versioncheck/src/versionchecker.cpp b/src/versioncheck/src/versionchecker.cpp index c41fda24f..8518bf9b6 100644 --- a/src/versioncheck/src/versionchecker.cpp +++ b/src/versioncheck/src/versionchecker.cpp @@ -150,7 +150,7 @@ void VersionChecker::downloadFinished( QNetworkReply* reply ) config.save(); } -void VersionChecker::checkVersionData( QByteArray versionData ) +void VersionChecker::checkVersionData( const QByteArray& versionData ) { LOG_DEBUG << "Version reply: " << QString::fromUtf8( versionData ); @@ -194,4 +194,4 @@ void VersionChecker::checkVersionData( QByteArray versionData ) Q_EMIT newVersionFound( latestVersion, url, changes ); } -} \ No newline at end of file +}