diff --git a/src/Emulation.cpp b/src/Emulation.cpp index 04e57f785..74ac77e3c 100644 --- a/src/Emulation.cpp +++ b/src/Emulation.cpp @@ -156,7 +156,7 @@ void Emulation::setHistory(const HistoryType& t) showBulk(); } -const HistoryType& Emulation::history() +const HistoryType& Emulation::history() const { return _screen[0]->getScroll(); } @@ -187,7 +187,7 @@ void Emulation::setKeyBindings(const QString& name) _keyTranslator = KeyboardTranslatorManager::instance()->findTranslator(name); } -QString Emulation::keyBindings() +QString Emulation::keyBindings() const { return _keyTranslator->name(); } @@ -338,47 +338,6 @@ void Emulation::receiveData(const char* text, int length) } }*/ -// Selection --------------------------------------------------------------- -- - -#if 0 -void Emulation::onSelectionBegin(const int x, const int y, const bool columnmode) { - if (!connected) return; - _currentScreen->setSelectionStart( x,y,columnmode); - showBulk(); -} - -void Emulation::onSelectionExtend(const int x, const int y) { - if (!connected) return; - _currentScreen->setSelectionEnd(x,y); - showBulk(); -} - -void Emulation::setSelection(const bool preserve_line_breaks) { - if (!connected) return; - QString t = _currentScreen->selectedText(preserve_line_breaks); - if (!t.isNull()) - { - QListIterator< TerminalDisplay* > viewIter(_views); - - while (viewIter.hasNext()) - viewIter.next()->setSelection(t); - } -} - -void Emulation::testIsSelected(const int x, const int y, bool &selected) -{ - if (!connected) return; - selected=_currentScreen->isSelected(x,y); -} - -void Emulation::clearSelection() { - if (!connected) return; - _currentScreen->clearSelection(); - showBulk(); -} - -#endif - void Emulation::writeToStream( TerminalCharacterDecoder* _decoder , int startLine , int endLine) @@ -386,7 +345,7 @@ void Emulation::writeToStream( TerminalCharacterDecoder* _decoder , _currentScreen->writeToStream(_decoder,startLine,endLine); } -int Emulation::lineCount() +int Emulation::lineCount() const { // sum number of lines currently on _screen plus number of lines in history return _currentScreen->getLines() + _currentScreen->getHistLines(); @@ -397,8 +356,6 @@ int Emulation::lineCount() #define BULK_TIMEOUT1 10 #define BULK_TIMEOUT2 40 -/*! -*/ void Emulation::showBulk() { _bulkTimer1.stop(); @@ -448,7 +405,7 @@ void Emulation::setImageSize(int lines, int columns) bufferedUpdate(); } -QSize Emulation::imageSize() +QSize Emulation::imageSize() const { return QSize(_currentScreen->getColumns(), _currentScreen->getLines()); } diff --git a/src/Emulation.h b/src/Emulation.h index affb070be..872171579 100644 --- a/src/Emulation.h +++ b/src/Emulation.h @@ -135,14 +135,13 @@ public: ScreenWindow* createWindow(); /** Returns the size of the screen image which the emulation produces */ - QSize imageSize(); + QSize imageSize() const; /** * Returns the total number of lines, including those stored in the history. */ - int lineCount(); + int lineCount() const; - /** * Sets the history store used by this emulation. When new lines * are added to the output, older lines at the top of the screen are transferred to a history @@ -153,7 +152,7 @@ public: */ void setHistory(const HistoryType&); /** Returns the history store used by this emulation. See setHistory() */ - const HistoryType& history(); + const HistoryType& history() const; /** Clears the history scroll. */ void clearHistory(); @@ -169,9 +168,8 @@ public: */ virtual void writeToStream(TerminalCharacterDecoder* decoder,int startLine,int endLine); - /** Returns the codec used to decode incoming characters. See setCodec() */ - const QTextCodec* codec() { return _codec; } + const QTextCodec* codec() const { return _codec; } /** Sets the codec used to decode incoming characters. */ void setCodec(const QTextCodec*); @@ -180,7 +178,8 @@ public: * Returns true if the current codec used to decode incoming * characters is UTF-8 */ - bool utf8() { Q_ASSERT(_codec); return _codec->mibEnum() == 106; } + bool utf8() const + { Q_ASSERT(_codec); return _codec->mibEnum() == 106; } /** TODO Document me */ @@ -196,7 +195,7 @@ public: * Returns the name of the emulation's current key bindings. * See setKeyBindings() */ - QString keyBindings(); + QString keyBindings() const; /** * Copies the current image into the history and clears the screen. @@ -397,10 +396,10 @@ signals: void flowControlKeyPressed(bool suspendKeyPressed); protected: - virtual void setMode (int mode) = 0; + virtual void setMode(int mode) = 0; virtual void resetMode(int mode) = 0; - /** + /** * Processes an incoming character. See receiveData() * @p ch A unicode character code. */ @@ -438,7 +437,6 @@ protected: //the current text codec. (this allows for rendering of non-ASCII characters in text files etc.) const QTextCodec* _codec; QTextDecoder* _decoder; - const KeyboardTranslator* _keyTranslator; // the keyboard layout protected slots: @@ -458,7 +456,6 @@ private slots: void usesMouseChanged(bool usesMouse); private: - bool _usesMouse; QTimer _bulkTimer1; QTimer _bulkTimer2;