From 4dd62f8a87f1504c7dc2fe8df85a218863d214f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lu=C3=ADs=20Pereira?= Date: Thu, 4 Mar 2021 19:47:56 +0000 Subject: [PATCH] Make some member functions const --- lib/History.cpp | 2 +- lib/History.h | 2 +- lib/KeyboardTranslator.cpp | 2 +- lib/KeyboardTranslator.h | 2 +- lib/Session.cpp | 6 +++--- lib/Session.h | 6 +++--- lib/TerminalDisplay.cpp | 4 ++-- lib/TerminalDisplay.h | 4 ++-- 8 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lib/History.cpp b/lib/History.cpp index 71a7095..ec3536b 100644 --- a/lib/History.cpp +++ b/lib/History.cpp @@ -401,7 +401,7 @@ void HistoryScrollBuffer::setMaxNbLines(unsigned int lineCount) dynamic_cast(m_histType)->m_nbLines = lineCount; } -int HistoryScrollBuffer::bufferIndex(int lineNumber) +int HistoryScrollBuffer::bufferIndex(int lineNumber) const { Q_ASSERT( lineNumber >= 0 ); Q_ASSERT( lineNumber < _maxLineCount ); diff --git a/lib/History.h b/lib/History.h index 59da314..eb8c9e1 100644 --- a/lib/History.h +++ b/lib/History.h @@ -184,7 +184,7 @@ public: private: - int bufferIndex(int lineNumber); + int bufferIndex(int lineNumber) const; HistoryLine* _historyBuffer; QBitArray _wrappedLine; diff --git a/lib/KeyboardTranslator.cpp b/lib/KeyboardTranslator.cpp index 0e9a0cf..c37ec48 100644 --- a/lib/KeyboardTranslator.cpp +++ b/lib/KeyboardTranslator.cpp @@ -475,7 +475,7 @@ QString KeyboardTranslatorReader::description() const { return _description; } -bool KeyboardTranslatorReader::hasNextEntry() +bool KeyboardTranslatorReader::hasNextEntry() const { return _hasNext; } diff --git a/lib/KeyboardTranslator.h b/lib/KeyboardTranslator.h index ac2fe99..4ca6b86 100644 --- a/lib/KeyboardTranslator.h +++ b/lib/KeyboardTranslator.h @@ -369,7 +369,7 @@ public: QString description() const; /** Returns true if there is another entry in the source stream */ - bool hasNextEntry(); + bool hasNextEntry() const; /** Returns the next entry found in the source stream */ KeyboardTranslator::Entry nextEntry(); diff --git a/lib/Session.cpp b/lib/Session.cpp index faec5e7..4891e4e 100644 --- a/lib/Session.cpp +++ b/lib/Session.cpp @@ -143,7 +143,7 @@ bool Session::isRunning() const return _shellProcess->state() == QProcess::Running; } -void Session::setCodec(QTextCodec * codec) +void Session::setCodec(QTextCodec * codec) const { emulation()->setCodec(codec); } @@ -1034,7 +1034,7 @@ void SessionGroup::setMasterStatus(Session * session, bool master) } } -void SessionGroup::connectPair(Session * master , Session * other) +void SessionGroup::connectPair(Session * master , Session * other) const { // qDebug() << k_funcinfo; @@ -1045,7 +1045,7 @@ void SessionGroup::connectPair(Session * master , Session * other) SLOT(sendString(const char *,int)) ); } } -void SessionGroup::disconnectPair(Session * master , Session * other) +void SessionGroup::disconnectPair(Session * master , Session * other) const { // qDebug() << k_funcinfo; diff --git a/lib/Session.h b/lib/Session.h index a09a2d2..b2a4d6a 100644 --- a/lib/Session.h +++ b/lib/Session.h @@ -340,7 +340,7 @@ public: void setSize(const QSize & size); /** Sets the text codec used by this session's terminal emulation. */ - void setCodec(QTextCodec * codec); + void setCodec(QTextCodec * codec) const; /** * Sets whether the session has a dark background or not. The session @@ -633,8 +633,8 @@ public: int masterMode() const; private: - void connectPair(Session * master , Session * other); - void disconnectPair(Session * master , Session * other); + void connectPair(Session * master , Session * other) const; + void disconnectPair(Session * master , Session * other) const; void connectAll(bool connect); QList masters() const; diff --git a/lib/TerminalDisplay.cpp b/lib/TerminalDisplay.cpp index e321a54..3f8edaa 100644 --- a/lib/TerminalDisplay.cpp +++ b/lib/TerminalDisplay.cpp @@ -649,7 +649,7 @@ static void drawOtherChar(QPainter& paint, int x, int y, int w, int h, uchar cod } void TerminalDisplay::drawLineCharString( QPainter& painter, int x, int y, const std::wstring& str, - const Character* attributes) + const Character* attributes) const { const QPen& currentPen = painter.pen(); @@ -2791,7 +2791,7 @@ void TerminalDisplay::emitSelection(bool useXselection,bool appendReturn) } } -void TerminalDisplay::bracketText(QString& text) +void TerminalDisplay::bracketText(QString& text) const { if (bracketedPasteMode() && !_disabledBracketedPasteMode) { diff --git a/lib/TerminalDisplay.h b/lib/TerminalDisplay.h index 3f6972b..9450c93 100644 --- a/lib/TerminalDisplay.h +++ b/lib/TerminalDisplay.h @@ -206,7 +206,7 @@ public: void emitSelection(bool useXselection,bool appendReturn); /** change and wrap text corresponding to paste mode **/ - void bracketText(QString& text); + void bracketText(QString& text) const; /** * Sets the shape of the keyboard cursor. This is the cursor drawn @@ -672,7 +672,7 @@ private: const Character* style, bool invertCharacterColor); // draws a string of line graphics void drawLineCharString(QPainter& painter, int x, int y, - const std::wstring& str, const Character* attributes); + const std::wstring& str, const Character* attributes) const; // draws the preedit string for input methods void drawInputMethodPreeditString(QPainter& painter , const QRect& rect);