KVIrc  4.9.2
DeveloperAPIs
Classes | Public Slots | Signals | Public Member Functions | Protected Member Functions | Protected Attributes | Static Protected Attributes | Properties | Private Slots | Private Member Functions | Static Private Member Functions | Friends | List of all members
KviInputEditor Class Reference

Input editor class. More...

#include <KviInputEditor.h>

+ Inheritance diagram for KviInputEditor:

Classes

class  EditCommand
 Holds the command used in the {un,re}do operations. More...
 

Public Slots

void clear ()
 Clears the input line. More...
 
void copyToClipboard ()
 Copies the text to the system clipboard. More...
 
void copyToSelection (bool bDonNotCopyToClipboard=true)
 Copies the text to the system clipboard. More...
 
void cut ()
 Cuts the selection from the input line. More...
 
void iconPopupActivated (QAction *pAction)
 Opens the icon popup with icon description. More...
 
void pasteClipboardWithConfirmation ()
 Pastes the text to the system clipboard. More...
 
void pasteFile ()
 Pastes a file to the buffer. More...
 
void pasteSelectionWithConfirmation ()
 Pastes the text to the system clipboard. More...
 
void pasteSlow ()
 Starts a slow paste in the buffer. More...
 
void redo ()
 Redo the last undo-ed action. More...
 
void removeSelected ()
 Removes the selected text. More...
 
void selectAll ()
 Selects all text in the input line. More...
 
void stopPasteSlow ()
 Stops a slow paste in the buffer. More...
 
void undo ()
 Undo the last action. More...
 

Signals

void enterPressed ()
 Called when the user press enter/return. More...
 
void escapePressed ()
 Called when the user press escape. More...
 

Public Member Functions

void applyOptions (bool bRefreshCachedMetrics=true)
 Applies the options and update. More...
 
void clearUndoStack ()
 Clears the undo stack. More...
 
int heightHint () const
 Returns the height of the editor. More...
 
void insertChar (QChar c)
 Inserts a character at the current position. More...
 
void insertText (const QString &szTxt)
 Inserts the text at the current position. More...
 
bool isReadOnly () const
 Returns true if the input line is in read only state. More...
 
 KviInputEditor (QWidget *pPar, KviWindow *pWnd, KviUserListView *pView=0)
 Constructs the input editor object. More...
 
void setMaxBufferSize (int iSize)
 Sets the maximum buffer size. More...
 
void setReadOnly (bool bReadOnly)
 Sets the read only state for the input line. More...
 
void setText (const QString szText)
 Sets the text in the input line. More...
 
QString text ()
 Returns the text in the buffer. More...
 
QString textBeforeCursor ()
 Returns the text before the cursor. More...
 
 ~KviInputEditor ()
 Destroys the Input editor object. More...
 

Protected Member Functions

bool checkWordSpelling (const QString &szWord)
 
void completionEscapeUnsafeToken (QString &szToken)
 
virtual void dragEnterEvent (QDragEnterEvent *e)
 
virtual void drawContents (QPainter *)
 
virtual void dropEvent (QDropEvent *e)
 
void fillSpellCheckerCorrectionsPopup ()
 
KviInputEditorSpellCheckerBlockfindSpellCheckerBlockAtCursor (KviPointerList< KviInputEditorSpellCheckerBlock > &lBlocks)
 
virtual void focusInEvent (QFocusEvent *e)
 
virtual void focusOutEvent (QFocusEvent *e)
 
virtual void inputMethodEvent (QInputMethodEvent *e)
 
virtual QVariant inputMethodQuery (Qt::InputMethodQuery query) const
 
void insertIconCode (const QString &szCode)
 
void installShortcuts ()
 
virtual void keyPressEvent (QKeyEvent *e)
 
virtual void keyReleaseEvent (QKeyEvent *e)
 
virtual void mouseDoubleClickEvent (QMouseEvent *e)
 
virtual void mousePressEvent (QMouseEvent *e)
 
virtual void mouseReleaseEvent (QMouseEvent *e)
 
virtual void paintEvent (QPaintEvent *e)
 
void rebuildTextBlocks ()
 
void splitTextIntoSpellCheckerBlocks (const QString &szText, KviPointerList< KviInputEditorSpellCheckerBlock > &lBuffer)
 
virtual void timerEvent (QTimerEvent *e)
 

Protected Attributes

bool m_bCursorOn
 
bool m_bIMComposing
 
bool m_bLastCompletionFinished
 
bool m_bReadOnly
 
bool m_bSpSlowFlag
 
bool m_bUpdatesEnabled
 
int m_iCurHistoryIdx
 
int m_iCursorPosition
 
int m_iCursorTimer
 
int m_iCursorWidth
 
int m_iDragTimer
 
int m_iIMLength
 
int m_iIMSelectionBegin
 
int m_iIMSelectionLength
 
int m_iIMStart
 
int m_iLastCompletionCursorPosition
 
int m_iMaxBufferSize
 
int m_iSelectionAnchorChar
 
int m_iSelectionBegin
 
int m_iSelectionEnd
 
KviInputEditorPrivatem_p
 
KviPointerList< QString > * m_pHistory
 
QMenu * m_pIconMenu
 
QWidget * m_pInputParent
 
KviWindowm_pKviWindow
 
KviPointerList< EditCommand > * m_pRedoStack
 The redo stack. More...
 
KviPointerList< EditCommand > * m_pUndoStack
 The undo stack. More...
 
KviUserListViewm_pUserListView
 
QMenu m_SpellCheckerPopup
 
KviCString m_szAltKeyCode
 
QString m_szIMText
 
QString m_szLastCompletedNick
 
QString m_szLastCompletionBuffer
 
KviCString m_szSaveTextBuffer
 
QString m_szTextBuffer
 

Static Protected Attributes

static int g_iCachedHeight = 0
 
static int g_iInputFontCharWidth [256]
 
static int g_iInputInstances = 0
 
static QFontMetricsF * g_pLastFontMetrics = nullptr
 

Properties

int TransparencyCapable
 

Private Slots

void backspaceHit ()
 Run when backspace key is pressed. More...
 
void copyInternal ()
 Copies to clipboard. More...
 
void cutInternal ()
 Cuts to clipboard. More...
 
void deleteHit ()
 Run when delete key is pressed. More...
 
void deleteNextWord ()
 Deletes next word. More...
 
void deletePreviousWord ()
 Deletes previous word. More...
 
void dummy ()
 Does nothing but grabs some keys combinations. More...
 
void endInternal ()
 Moves the cursor at the end. More...
 
void endInternalSelection ()
 Selects until the end. More...
 
void escapeHit ()
 Run when escape key is pressed. More...
 
void historyNext ()
 Moves forward in the command history and in the history popup. More...
 
void historyPrev ()
 Moves backward in the command history and in the history popup. More...
 
void homeInternal ()
 Moves the cursor at the beginning. More...
 
void homeInternalSelection ()
 Selects until the beginning. More...
 
void insertBold ()
 Inserts bold control character. More...
 
void insertColor ()
 Inserts color control character. More...
 
void insertIcon ()
 Inserts icon control character. More...
 
void insertPlainText ()
 Inserts non-crypt (plain text) control character. More...
 
void insertReset ()
 Inserts reset control character. More...
 
void insertReverse ()
 Inserts reverse control character. More...
 
void insertUnderline ()
 Inserts underline control character. More...
 
void nextChar ()
 Moves to the next character. More...
 
void nextCharSelection ()
 Selects up to the next character. More...
 
void nextLine ()
 Scrolls the output window down one line. More...
 
void nextPage ()
 Scrolls the output window down one page. More...
 
void nextWord ()
 Moves to the end of the next word. More...
 
void nextWordSelection ()
 Selects up to the end of the next word. More...
 
void openHistory ()
 Opens the history popup. More...
 
void pasteInternal ()
 Pastes clipboard contents. More...
 
void popupTextIconWindow ()
 
void previousChar ()
 Moves to the previous character. More...
 
void previousCharSelection ()
 Selects up to the previous character. More...
 
void previousLine ()
 Scrolls the output window up one line. More...
 
void previousPage ()
 Scrolls the output window up one page. More...
 
void previousWord ()
 Moves to the beginning of the previous word. More...
 
void previousWordSelection ()
 Selects up to the beginning of the previous word. More...
 
void redoInternal ()
 Redoes last action. More...
 
void returnHit ()
 Run when return/enter key is pressed. More...
 
void scrollToLastReadLine ()
 Scrolls the ircview to the last read line. More...
 
void search ()
 Opens the search window. More...
 
void selectAllInternal ()
 Selects all. More...
 
void sendKvs ()
 Sends the message assuming it's kvs code. More...
 
void sendPlain ()
 Sends plain text, ignoring initial token starting with / (a command) More...
 
void showContextPopup (const QPoint &pos)
 
void showContextPopupHere ()
 
void showSpellCheckerCorrectionsPopup ()
 
void spellCheckerPopupCorrectionActionTriggered ()
 
void toggleCommandMode ()
 Toggles the commandline's KVS/User-friendly mode. More...
 
void toggleMultiLineEditor ()
 Toggles the multiline editor. More...
 
void undoInternal ()
 Undoes last action. More...
 
void zoomDefault ()
 Restore the ircview font (and its size) More...
 
void zoomIn ()
 Increase the ircview font size. More...
 
void zoomOut ()
 Decrease the ircview font size. More...
 

Private Member Functions

void addUndo (EditCommand *pCommand)
 Inserts one action in the undo stack. More...
 
int charIndexFromXPosition (qreal fXPos)
 Returns the current character from a given position. More...
 
void clearSelection ()
 
void completion (bool bShift)
 Autocompletion function. More...
 
void end ()
 Moves the cursor to the end of the input line. More...
 
void ensureCursorVisible ()
 Makes sure that the cursor is visible. More...
 
QFontMetricsF * getLastFontMetrics (const QFont &font)
 Returns the current input editor font metrics (globally shared) More...
 
void getWordBeforeCursor (QString &szBuffer, bool *bIsFirstWordInLine)
 Gets the word before the cursor and puts it to the buffer. More...
 
void handleDragSelection ()
 Handles the drag selection. More...
 
bool hasSelection ()
 Returns true if the input line has focus. More...
 
void home ()
 Moves the cursor to the start of the input line. More...
 
void internalCursorLeft (bool bShift)
 Moves the cursor one character to the left. More...
 
void internalCursorRight (bool bShift)
 Moves the cursor one character to the right. More...
 
bool isRedoAvailable () const
 Returns true is there are some action in the redo stack. More...
 
bool isUndoAvailable () const
 Returns true is there are some action in the undo stack. More...
 
void killDragTimer ()
 Kills the drag timer. More...
 
void moveCursorTo (int iIdx, bool bRepaint=true)
 Moves the cursor to the specified position. More...
 
void repaintWithCursorOn ()
 Repaints the input line with the visible cursor. More...
 
int replaceSegment (int iStart, int iLength, const QString &szString)
 Replace characters in the buffer. More...
 
void replaceWordBeforeCursor (const QString &szWord, const QString &szReplacement, bool bRepaint=true)
 Replaces the word before the cursor. More...
 
void returnPressed (bool bRepaint=true)
 Adds the text to the history. More...
 
void standardNickCompletion (bool bAddMask, QString &szWord, bool bFirstWordInLine, bool bInCommand)
 Completes the nickname specified by szWord (inserts the completed text to the input line) More...
 
void standardNickCompletionInsertCompletedText (const QString &szReplacedWord, const QString &szCompletedText, bool bFirstWordInLine, bool bInCommand)
 Internal helper for standardNickCompletion() More...
 
qreal xPositionFromCharIndex (int iChIdx)
 Returns the current position from a given character. More...
 

Static Private Member Functions

static QChar getSubstituteChar (unsigned short uControlCode)
 Gets the substitute character for control codes. More...
 

Friends

class KviTextIconWindow
 
class KviTopicWidget
 

Detailed Description

Input editor class.

Constructor & Destructor Documentation

KviInputEditor::KviInputEditor ( QWidget *  pPar,
KviWindow pWnd,
KviUserListView pView = 0 
)
KviInputEditor::~KviInputEditor ( )

Member Function Documentation

void KviInputEditor::addUndo ( EditCommand pCommand)
private

Inserts one action in the undo stack.

Parameters
pCommandThe command representing the action
Returns
void

References KVI_INPUT_MAX_UNDO_SIZE, and m_pUndoStack.

Referenced by backspaceHit(), clear(), cut(), insertChar(), insertText(), removeSelected(), replaceSegment(), and setText().

void KviInputEditor::applyOptions ( bool  bRefreshCachedMetrics = true)
void KviInputEditor::backspaceHit ( )
privateslot
int KviInputEditor::charIndexFromXPosition ( qreal  fXPos)
private
bool KviInputEditor::checkWordSpelling ( const QString &  szWord)
protected
void KviInputEditor::clear ( )
slot
void KviInputEditor::clearSelection ( )
private
void KviInputEditor::clearUndoStack ( )

Clears the undo stack.

References m_pRedoStack, and m_pUndoStack.

Referenced by KviInput::inputEditorEnterPressed().

void KviInputEditor::completion ( bool  bShift)
private
void KviInputEditor::completionEscapeUnsafeToken ( QString &  szToken)
protected
void KviInputEditor::copyInternal ( )
privateslot

Copies to clipboard.

Returns
void

References copyToClipboard().

Referenced by installShortcuts().

void KviInputEditor::copyToClipboard ( )
slot

Copies the text to the system clipboard.

Returns
void

References hasSelection(), m_iSelectionBegin, m_iSelectionEnd, m_szTextBuffer, and repaintWithCursorOn().

Referenced by copyInternal(), and showContextPopup().

void KviInputEditor::copyToSelection ( bool  bDonNotCopyToClipboard = true)
slot

Copies the text to the system clipboard.

If the system supports the mouse clipboard, the text will be copied there

Parameters
bDonNotCopyToClipboardWhether to copy the text to the system clipboard
Returns
void

References hasSelection(), m_iSelectionBegin, m_iSelectionEnd, m_szTextBuffer, and repaintWithCursorOn().

Referenced by mouseReleaseEvent().

void KviInputEditor::cut ( )
slot
void KviInputEditor::cutInternal ( )
privateslot

Cuts to clipboard.

Returns
void

References cut(), and m_bReadOnly.

Referenced by installShortcuts().

void KviInputEditor::deleteHit ( )
privateslot
void KviInputEditor::deleteNextWord ( )
privateslot
void KviInputEditor::deletePreviousWord ( )
privateslot
void KviInputEditor::dragEnterEvent ( QDragEnterEvent *  e)
protectedvirtual
void KviInputEditor::drawContents ( QPainter *  p)
protectedvirtual
void KviInputEditor::dropEvent ( QDropEvent *  e)
protectedvirtual
void KviInputEditor::dummy ( )
privateslot

Does nothing but grabs some keys combinations.

Warning
This is an hack. The keys combinations grabbed by this function write a non-printable chars which cause some troubles, eg duplication of chars opening/closing more times the multiline
Returns
void

Referenced by installShortcuts().

void KviInputEditor::end ( )
private

Moves the cursor to the end of the input line.

Returns
void

References ensureCursorVisible(), m_iCursorPosition, m_szTextBuffer, and repaintWithCursorOn().

Referenced by endInternal(), endInternalSelection(), historyNext(), historyPrev(), selectAll(), and setText().

void KviInputEditor::endInternal ( )
privateslot

Moves the cursor at the end.

Returns
void

References clearSelection(), and end().

Referenced by installShortcuts().

void KviInputEditor::endInternalSelection ( )
privateslot
void KviInputEditor::ensureCursorVisible ( )
private
void KviInputEditor::enterPressed ( )
signal

Called when the user press enter/return.

Returns
void

Referenced by returnPressed().

void KviInputEditor::escapeHit ( )
privateslot

Run when escape key is pressed.

Returns
void

References escapePressed().

Referenced by installShortcuts().

void KviInputEditor::escapePressed ( )
signal

Called when the user press escape.

Returns
void

Referenced by escapeHit().

void KviInputEditor::fillSpellCheckerCorrectionsPopup ( )
protected
KviInputEditorSpellCheckerBlock * KviInputEditor::findSpellCheckerBlockAtCursor ( KviPointerList< KviInputEditorSpellCheckerBlock > &  lBlocks)
protected
void KviInputEditor::focusInEvent ( QFocusEvent *  e)
protectedvirtual
void KviInputEditor::focusOutEvent ( QFocusEvent *  e)
protectedvirtual

References m_bCursorOn, and m_iCursorTimer.

QFontMetricsF * KviInputEditor::getLastFontMetrics ( const QFont &  font)
private

Returns the current input editor font metrics (globally shared)

Parameters
fontThe current input editor font
Returns
QFontMetricsF *

References KviInputEditorPrivate::fFontElisionWidth, g_iCachedHeight, g_pLastFontMetrics, h, KVI_INPUT_MARGIN, KVI_INPUT_XTRAPADDING, m_p, KviInputEditorPrivate::szFontElision, and w.

Referenced by applyOptions(), charIndexFromXPosition(), drawContents(), ensureCursorVisible(), rebuildTextBlocks(), and xPositionFromCharIndex().

QChar KviInputEditor::getSubstituteChar ( unsigned short  uControlCode)
staticprivate

Gets the substitute character for control codes.

Parameters
uControlCodeThe control code inserted
Returns
QChar

References KviControlCodes::Bold, KviControlCodes::CryptEscape, KviControlCodes::Icon, KviControlCodes::Reset, KviControlCodes::Reverse, and KviControlCodes::Underline.

Referenced by rebuildTextBlocks().

void KviInputEditor::getWordBeforeCursor ( QString &  szBuffer,
bool *  bIsFirstWordInLine 
)
private

Gets the word before the cursor and puts it to the buffer.

Parameters
szBufferThe buffer where to put the word got
bIsFirstWordInLineReturns true if the word is the first
Returns
void

References m_iCursorPosition, and m_szTextBuffer.

Referenced by completion(), and standardNickCompletion().

void KviInputEditor::handleDragSelection ( )
private
bool KviInputEditor::hasSelection ( )
private
int KviInputEditor::heightHint ( ) const

Returns the height of the editor.

Returns
int

References g_iCachedHeight.

Referenced by KviInput::heightHint(), and showContextPopupHere().

void KviInputEditor::historyNext ( )
privateslot
void KviInputEditor::historyPrev ( )
privateslot
void KviInputEditor::home ( )
private

Moves the cursor to the start of the input line.

Returns
void

References ensureCursorVisible(), m_iCursorPosition, and repaintWithCursorOn().

Referenced by clear(), historyNext(), historyPrev(), homeInternal(), homeInternalSelection(), and KviTopicWidget::switchMode().

void KviInputEditor::homeInternal ( )
privateslot

Moves the cursor at the beginning.

Returns
void

References clearSelection(), home(), and m_iCursorPosition.

Referenced by installShortcuts().

void KviInputEditor::homeInternalSelection ( )
privateslot

Selects until the beginning.

Returns
void

References KviInputEditorPrivate::bTextBlocksDirty, home(), m_iCursorPosition, m_iSelectionBegin, m_iSelectionEnd, and m_p.

Referenced by installShortcuts().

void KviInputEditor::iconPopupActivated ( QAction *  pAction)
slot

Opens the icon popup with icon description.

Parameters
iIdThe id of the icon
Returns
void

References KviControlCodes::Icon, insertText(), and m_bReadOnly.

Referenced by KviInputEditor().

void KviInputEditor::inputMethodEvent ( QInputMethodEvent *  e)
protectedvirtual
virtual QVariant KviInputEditor::inputMethodQuery ( Qt::InputMethodQuery  query) const
protectedvirtual
void KviInputEditor::insertBold ( )
privateslot

Inserts bold control character.

Returns
void

References KviControlCodes::Bold, insertChar(), and m_bReadOnly.

Referenced by installShortcuts().

void KviInputEditor::insertChar ( QChar  c)
void KviInputEditor::insertColor ( )
privateslot

Inserts color control character.

Returns
void

References insertChar(), m_bReadOnly, m_iCursorPosition, KviColorWindow::popup(), and xPositionFromCharIndex().

Referenced by installShortcuts().

void KviInputEditor::insertIcon ( )
privateslot

Inserts icon control character.

Returns
void

References KviControlCodes::Icon, insertChar(), m_bReadOnly, and popupTextIconWindow().

Referenced by installShortcuts().

void KviInputEditor::insertIconCode ( const QString &  szCode)
protected
void KviInputEditor::insertPlainText ( )
privateslot

Inserts non-crypt (plain text) control character.

Returns
void

References KviControlCodes::CryptEscape, insertChar(), and m_bReadOnly.

Referenced by installShortcuts().

void KviInputEditor::insertReset ( )
privateslot

Inserts reset control character.

Returns
void

References insertChar(), m_bReadOnly, and KviControlCodes::Reset.

Referenced by installShortcuts().

void KviInputEditor::insertReverse ( )
privateslot

Inserts reverse control character.

Returns
void

References insertChar(), m_bReadOnly, and KviControlCodes::Reverse.

Referenced by installShortcuts().

void KviInputEditor::insertText ( const QString &  szTxt)
void KviInputEditor::insertUnderline ( )
privateslot

Inserts underline control character.

Returns
void

References insertChar(), m_bReadOnly, and KviControlCodes::Underline.

Referenced by installShortcuts().

void KviInputEditor::installShortcuts ( )
protected

References copyInternal(), KviShortcut::create(), cutInternal(), deleteNextWord(), deletePreviousWord(), dummy(), endInternal(), endInternalSelection(), escapeHit(), historyNext(), historyPrev(), homeInternal(), homeInternalSelection(), insertBold(), insertColor(), insertIcon(), insertPlainText(), insertReset(), insertReverse(), insertUnderline(), KVI_SHORTCUTS_INPUT_BOLD, KVI_SHORTCUTS_INPUT_COLOR, KVI_SHORTCUTS_INPUT_COMMANDLINE, KVI_SHORTCUTS_INPUT_COPY, KVI_SHORTCUTS_INPUT_CORRECT_SPELLING, KVI_SHORTCUTS_INPUT_CUT, KVI_SHORTCUTS_INPUT_DELETE_NEXT_WORD, KVI_SHORTCUTS_INPUT_DELETE_PREV_WORD, KVI_SHORTCUTS_INPUT_DUMMY, KVI_SHORTCUTS_INPUT_END, KVI_SHORTCUTS_INPUT_END_SELECT, KVI_SHORTCUTS_INPUT_ESCAPE, KVI_SHORTCUTS_INPUT_HISTORY, KVI_SHORTCUTS_INPUT_HISTORY_NEXT, KVI_SHORTCUTS_INPUT_HISTORY_PREV, KVI_SHORTCUTS_INPUT_HOME, KVI_SHORTCUTS_INPUT_HOME_SELECT, KVI_SHORTCUTS_INPUT_ICON, KVI_SHORTCUTS_INPUT_MENU, KVI_SHORTCUTS_INPUT_NEXT_CHAR, KVI_SHORTCUTS_INPUT_NEXT_CHAR_SELECT, KVI_SHORTCUTS_INPUT_NEXT_WORD, KVI_SHORTCUTS_INPUT_NEXT_WORD_SELECT, KVI_SHORTCUTS_INPUT_PASTE, KVI_SHORTCUTS_INPUT_PLAINTEXT, KVI_SHORTCUTS_INPUT_PREV_CHAR, KVI_SHORTCUTS_INPUT_PREV_CHAR_SELECT, KVI_SHORTCUTS_INPUT_PREV_WORD, KVI_SHORTCUTS_INPUT_PREV_WORD_SELECT, KVI_SHORTCUTS_INPUT_REDO, KVI_SHORTCUTS_INPUT_RESET, KVI_SHORTCUTS_INPUT_REVERSE, KVI_SHORTCUTS_INPUT_SELECT_ALL, KVI_SHORTCUTS_INPUT_SEND_PLAIN, KVI_SHORTCUTS_INPUT_SEND_PLAIN_2, KVI_SHORTCUTS_INPUT_UNDERLINE, KVI_SHORTCUTS_INPUT_UNDO, KVI_SHORTCUTS_WIN_NEXT_LINE, KVI_SHORTCUTS_WIN_NEXT_PAGE, KVI_SHORTCUTS_WIN_PREV_LINE, KVI_SHORTCUTS_WIN_PREV_PAGE, KVI_SHORTCUTS_WIN_SCROLL_TO_LAST_READ_LINE, KVI_SHORTCUTS_WIN_SEARCH, KVI_SHORTCUTS_WIN_ZOOM_DEFAULT, KVI_SHORTCUTS_WIN_ZOOM_IN, KVI_SHORTCUTS_WIN_ZOOM_OUT, nextChar(), nextCharSelection(), nextLine(), nextPage(), nextWord(), nextWordSelection(), openHistory(), pasteInternal(), previousChar(), previousCharSelection(), previousLine(), previousPage(), previousWord(), previousWordSelection(), redoInternal(), scrollToLastReadLine(), search(), selectAllInternal(), sendPlain(), showContextPopupHere(), showSpellCheckerCorrectionsPopup(), toggleCommandMode(), undoInternal(), zoomDefault(), zoomIn(), and zoomOut().

Referenced by KviInputEditor().

void KviInputEditor::internalCursorLeft ( bool  bShift)
private

Moves the cursor one character to the left.

Parameters
bShiftWhether to shift the selection
Returns
void

References KviInputEditorPrivate::bTextBlocksDirty, clearSelection(), ensureCursorVisible(), m_iCursorPosition, m_iSelectionBegin, m_iSelectionEnd, and m_p.

Referenced by previousChar(), previousCharSelection(), previousWord(), and previousWordSelection().

void KviInputEditor::internalCursorRight ( bool  bShift)
private

Moves the cursor one character to the right.

Parameters
bShiftWhether to shift the selection
Returns
void

References KviInputEditorPrivate::bTextBlocksDirty, clearSelection(), ensureCursorVisible(), m_iCursorPosition, m_iSelectionBegin, m_iSelectionEnd, m_p, and m_szTextBuffer.

Referenced by nextChar(), nextCharSelection(), nextWord(), and nextWordSelection().

bool KviInputEditor::isReadOnly ( ) const
inline

Returns true if the input line is in read only state.

Returns
bool

Referenced by KviTopicWidget::acceptClicked().

bool KviInputEditor::isRedoAvailable ( ) const
inlineprivate

Returns true is there are some action in the redo stack.

Returns
bool

Referenced by redo(), and showContextPopup().

bool KviInputEditor::isUndoAvailable ( ) const
inlineprivate

Returns true is there are some action in the undo stack.

Returns
bool

Referenced by showContextPopup(), and undo().

void KviInputEditor::keyPressEvent ( QKeyEvent *  e)
protectedvirtual
void KviInputEditor::keyReleaseEvent ( QKeyEvent *  e)
protectedvirtual
void KviInputEditor::killDragTimer ( )
private

Kills the drag timer.

Returns
void

References m_iDragTimer.

Referenced by mouseDoubleClickEvent(), mousePressEvent(), mouseReleaseEvent(), and ~KviInputEditor().

void KviInputEditor::mouseDoubleClickEvent ( QMouseEvent *  e)
protectedvirtual
void KviInputEditor::mousePressEvent ( QMouseEvent *  e)
protectedvirtual
void KviInputEditor::mouseReleaseEvent ( QMouseEvent *  e)
protectedvirtual
void KviInputEditor::moveCursorTo ( int  iIdx,
bool  bRepaint = true 
)
private

Moves the cursor to the specified position.

Parameters
iIdxThe index of the character to move the cursor to
bRepaintWhether to repaint the input line
Returns
void

References ensureCursorVisible(), m_iCursorPosition, m_szTextBuffer, and repaintWithCursorOn().

Referenced by cut(), inputMethodEvent(), insertText(), mouseDoubleClickEvent(), redo(), removeSelected(), replaceWordBeforeCursor(), and undo().

void KviInputEditor::nextChar ( )
privateslot

Moves to the next character.

Returns
void

References internalCursorRight(), and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::nextCharSelection ( )
privateslot

Selects up to the next character.

Returns
void

References internalCursorRight(), m_iCursorPosition, m_szTextBuffer, and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::nextLine ( )
privateslot

Scrolls the output window down one line.

Returns
void

References m_pKviWindow, KviIrcView::nextLine(), and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::nextPage ( )
privateslot

Scrolls the output window down one page.

Returns
void

References m_pKviWindow, KviIrcView::nextPage(), and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::nextWord ( )
privateslot

Moves to the end of the next word.

Returns
void

References internalCursorRight(), m_iCursorPosition, m_szTextBuffer, and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::nextWordSelection ( )
privateslot

Selects up to the end of the next word.

Returns
void

References internalCursorRight(), m_iCursorPosition, m_szTextBuffer, and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::openHistory ( )
privateslot

Opens the history popup.

Returns
void

References KVI_OPTION_BOOL, KviOption_boolEnableInputHistory, and m_pInputParent.

Referenced by installShortcuts().

void KviInputEditor::paintEvent ( QPaintEvent *  e)
protectedvirtual
void KviInputEditor::pasteClipboardWithConfirmation ( )
slot

Pastes the text to the system clipboard.

Returns
void

References KviWindow::id(), insertText(), KviEvent_OnInputBarPaste, KVS_TRIGGER_EVENT_2_HALTED, m_pInputParent, and m_pKviWindow.

Referenced by pasteInternal(), and showContextPopup().

void KviInputEditor::pasteFile ( )
slot

Pastes a file to the buffer.

Returns
void

References KviQString::escapeKvs(), KviQString::EscapeSpace, g_pActiveWindow, m_bSpSlowFlag, and KviKvsScript::run().

Referenced by showContextPopup().

void KviInputEditor::pasteInternal ( )
privateslot

Pastes clipboard contents.

Returns
void

References m_bReadOnly, and pasteClipboardWithConfirmation().

Referenced by installShortcuts().

void KviInputEditor::pasteSelectionWithConfirmation ( )
slot

Pastes the text to the system clipboard.

If the system supports the mouse clipboard, the text will be copied there

Returns
void

References KviWindow::id(), insertText(), KviEvent_OnInputBarPaste, KVS_TRIGGER_EVENT_2_HALTED, m_pInputParent, and m_pKviWindow.

Referenced by mousePressEvent().

void KviInputEditor::pasteSlow ( )
slot

Starts a slow paste in the buffer.

Returns
void

References g_pActiveWindow, m_bSpSlowFlag, and KviKvsScript::run().

Referenced by showContextPopup().

void KviInputEditor::popupTextIconWindow ( )
privateslot
void KviInputEditor::previousChar ( )
privateslot

Moves to the previous character.

Returns
void

References internalCursorLeft(), and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::previousCharSelection ( )
privateslot

Selects up to the previous character.

Returns
void

References internalCursorLeft(), m_iCursorPosition, and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::previousLine ( )
privateslot

Scrolls the output window up one line.

Returns
void

References m_pKviWindow, KviIrcView::prevLine(), and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::previousPage ( )
privateslot

Scrolls the output window up one page.

Returns
void

References m_pKviWindow, KviIrcView::prevPage(), and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::previousWord ( )
privateslot

Moves to the beginning of the previous word.

Returns
void

References internalCursorLeft(), m_iCursorPosition, m_szTextBuffer, and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::previousWordSelection ( )
privateslot

Selects up to the beginning of the previous word.

Returns
void

References internalCursorLeft(), m_iCursorPosition, m_szTextBuffer, and repaintWithCursorOn().

Referenced by installShortcuts().

void KviInputEditor::rebuildTextBlocks ( )
protected
void KviInputEditor::redo ( )
slot
void KviInputEditor::redoInternal ( )
privateslot

Redoes last action.

Returns
void

References m_bReadOnly, and redo().

Referenced by installShortcuts().

void KviInputEditor::removeSelected ( )
slot
void KviInputEditor::repaintWithCursorOn ( )
private
int KviInputEditor::replaceSegment ( int  iStart,
int  iLength,
const QString &  szString 
)
private

Replace characters in the buffer.

Returns the length of the text inserted (different from text.length() only if the buffer was truncated.

Parameters
iStartThe starting character
iLengthThe length of the string to replace
szStringThe string to replace with
Returns
int

References addUndo(), KviInputEditorPrivate::bTextBlocksDirty, KviInputEditor::EditCommand::InsertText, m_iMaxBufferSize, m_p, m_szTextBuffer, and repaintWithCursorOn().

Referenced by inputMethodEvent().

void KviInputEditor::replaceWordBeforeCursor ( const QString &  szWord,
const QString &  szReplacement,
bool  bRepaint = true 
)
private

Replaces the word before the cursor.

Parameters
szWordThe word to replace
szReplacementThe new word to use
bRepaintWhether to repain the input line
Returns
void

References KviInputEditorPrivate::bTextBlocksDirty, clearSelection(), m_iCursorPosition, m_iMaxBufferSize, m_p, m_szTextBuffer, moveCursorTo(), and repaintWithCursorOn().

Referenced by completion(), and standardNickCompletionInsertCompletedText().

void KviInputEditor::returnHit ( )
privateslot

Run when return/enter key is pressed.

Returns
void

References returnPressed().

Referenced by keyPressEvent().

void KviInputEditor::returnPressed ( bool  bRepaint = true)
private

Adds the text to the history.

Triggered when the user press return

Parameters
bRepaintWhether to repain the input line
Returns
void

References KviInputHistory::add(), KviPointerList< T >::count(), enterPressed(), KviPointerList< T >::insert(), KviInputHistory::instance(), KVI_ASSERT, KVI_INPUT_MAX_LOCAL_HISTORY_ENTRIES, m_iCurHistoryIdx, m_pHistory, m_pInputParent, m_szTextBuffer, and KviPointerList< T >::removeLast().

Referenced by insertText(), and returnHit().

void KviInputEditor::scrollToLastReadLine ( )
privateslot

Scrolls the ircview to the last read line.

Returns
void

References KviIrcView::hasLineMark(), m_pKviWindow, KviIrcView::scrollToMarker(), and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::search ( )
privateslot

Opens the search window.

Returns
void

References m_pKviWindow, KviIrcView::toggleToolWidget(), and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::selectAll ( )
slot

Selects all text in the input line.

Returns
void

References KviInputEditorPrivate::bTextBlocksDirty, end(), m_iSelectionBegin, m_iSelectionEnd, m_p, and m_szTextBuffer.

Referenced by showContextPopup().

void KviInputEditor::selectAllInternal ( )
privateslot
void KviInputEditor::sendKvs ( )
privateslot
void KviInputEditor::sendPlain ( )
privateslot
void KviInputEditor::setMaxBufferSize ( int  iSize)
inline

Sets the maximum buffer size.

Parameters
iSizeThe size of the buffer to set
Returns
void

Referenced by KviTopicWidget::switchMode().

void KviInputEditor::setReadOnly ( bool  bReadOnly)
inline

Sets the read only state for the input line.

Parameters
bReadOnlyWhether to set the read only state
Returns
void

Referenced by KviTopicWidget::switchMode().

void KviInputEditor::setText ( const QString  szText)
void KviInputEditor::showContextPopup ( const QPoint &  pos)
privateslot
void KviInputEditor::showContextPopupHere ( )
privateslot

Shows the context popup menu at the current cursor position

References heightHint(), KVI_INPUT_MARGIN, KVI_INPUT_XTRAPADDING, m_iCursorPosition, showContextPopup(), and xPositionFromCharIndex().

Referenced by installShortcuts().

void KviInputEditor::showSpellCheckerCorrectionsPopup ( )
privateslot

Show the spell checker corrections popup.

References fillSpellCheckerCorrectionsPopup(), m_iCursorPosition, m_SpellCheckerPopup, and xPositionFromCharIndex().

Referenced by installShortcuts().

void KviInputEditor::spellCheckerPopupCorrectionActionTriggered ( )
privateslot
void KviInputEditor::splitTextIntoSpellCheckerBlocks ( const QString &  szText,
KviPointerList< KviInputEditorSpellCheckerBlock > &  lBuffer 
)
protected
void KviInputEditor::standardNickCompletion ( bool  bAddMask,
QString &  szWord,
bool  bFirstWordInLine,
bool  bInCommand 
)
private

Completes the nickname specified by szWord (inserts the completed text to the input line)

Parameters
bAddMaskWhether to complete with the mask of the nickname
szWordThe nickname to complete
bFirstWordInLineWhether the word to complete is the first word in the text line (so the suffix from option panel is added)
bInCommandWhether the completion happens inside a kvs command (and thus the completed word should be kvs-escaped)
Returns
void

References KviInputEditorPrivate::bTextBlocksDirty, clearSelection(), KviUserListView::completeNickStandard(), getWordBeforeCursor(), m_bLastCompletionFinished, m_iCursorPosition, m_iLastCompletionCursorPosition, m_p, m_pUserListView, m_szLastCompletedNick, m_szLastCompletionBuffer, m_szTextBuffer, standardNickCompletionInsertCompletedText(), and szBuffer.

Referenced by completion().

void KviInputEditor::standardNickCompletionInsertCompletedText ( const QString &  szReplacedWord,
const QString &  szCompletedText,
bool  bFirstWordInLine,
bool  bInCommand 
)
private

Internal helper for standardNickCompletion()

Parameters
szReplacedWordThe word replaced before the cursor
szCompletedTextThe text to be completed
bFirstWordInLineWhether the word to complete is the first word in the text line (so the suffix from option panel is added)
bInCommandWhether the completion happens inside a kvs command (and thus the completed word should be kvs-escaped)
Returns
void

References completionEscapeUnsafeToken(), KVI_OPTION_BOOL, KVI_OPTION_STRING, KviOption_boolUseNickCompletionPostfixForFirstWordOnly, KviOption_stringNickCompletionPostfix, replaceWordBeforeCursor(), and szBuffer.

Referenced by standardNickCompletion().

void KviInputEditor::stopPasteSlow ( )
slot

Stops a slow paste in the buffer.

Returns
void

References g_pActiveWindow, m_bSpSlowFlag, and KviKvsScript::run().

Referenced by showContextPopup().

QString KviInputEditor::text ( )
inline
QString KviInputEditor::textBeforeCursor ( )

Returns the text before the cursor.

References m_iCursorPosition, and m_szTextBuffer.

void KviInputEditor::timerEvent ( QTimerEvent *  e)
protectedvirtual
void KviInputEditor::toggleCommandMode ( )
privateslot

Toggles the commandline's KVS/User-friendly mode.

Returns
void

References m_pInputParent.

Referenced by installShortcuts().

void KviInputEditor::toggleMultiLineEditor ( )
privateslot

Toggles the multiline editor.

Returns
void

References clear(), m_pInputParent, and m_szTextBuffer.

void KviInputEditor::undo ( )
slot
void KviInputEditor::undoInternal ( )
privateslot

Undoes last action.

Returns
void

References m_bReadOnly, and undo().

Referenced by installShortcuts().

qreal KviInputEditor::xPositionFromCharIndex ( int  iChIdx)
private
void KviInputEditor::zoomDefault ( )
privateslot

Restore the ircview font (and its size)

Returns
void

References m_pKviWindow, KviIrcView::resetDefaultFont(), and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::zoomIn ( )
privateslot

Increase the ircview font size.

Returns
void

References KviIrcView::increaseFontSize(), m_pKviWindow, and KviWindow::view().

Referenced by installShortcuts().

void KviInputEditor::zoomOut ( )
privateslot

Decrease the ircview font size.

Returns
void

References KviIrcView::decreaseFontSize(), m_pKviWindow, and KviWindow::view().

Referenced by installShortcuts().

Friends And Related Function Documentation

friend class KviTextIconWindow
friend

Referenced by popupTextIconWindow().

friend class KviTopicWidget
friend

Member Data Documentation

int KviInputEditor::g_iCachedHeight = 0
staticprotected

Referenced by getLastFontMetrics(), and heightHint().

int KviInputEditor::g_iInputFontCharWidth[256]
staticprotected
int KviInputEditor::g_iInputInstances = 0
staticprotected

Referenced by KviInputEditor(), and ~KviInputEditor().

QFontMetricsF * KviInputEditor::g_pLastFontMetrics = nullptr
staticprotected
bool KviInputEditor::m_bCursorOn
protected
bool KviInputEditor::m_bIMComposing
protected
bool KviInputEditor::m_bLastCompletionFinished
protected
bool KviInputEditor::m_bReadOnly
protected
bool KviInputEditor::m_bSpSlowFlag
protected
bool KviInputEditor::m_bUpdatesEnabled
protected
int KviInputEditor::m_iCurHistoryIdx
protected
int KviInputEditor::m_iCursorPosition
protected
int KviInputEditor::m_iCursorTimer
protected
int KviInputEditor::m_iCursorWidth
protected

Referenced by applyOptions(), and drawContents().

int KviInputEditor::m_iDragTimer
protected
int KviInputEditor::m_iIMLength
protected
int KviInputEditor::m_iIMSelectionBegin
protected
int KviInputEditor::m_iIMSelectionLength
protected
int KviInputEditor::m_iIMStart
protected
int KviInputEditor::m_iLastCompletionCursorPosition
protected

Referenced by standardNickCompletion().

int KviInputEditor::m_iMaxBufferSize
protected
int KviInputEditor::m_iSelectionAnchorChar
protected
int KviInputEditor::m_iSelectionBegin
protected
int KviInputEditor::m_iSelectionEnd
protected
KviInputEditorPrivate* KviInputEditor::m_p
protected
KviPointerList<QString>* KviInputEditor::m_pHistory
protected
QMenu* KviInputEditor::m_pIconMenu
protected

Referenced by KviInputEditor(), and ~KviInputEditor().

QWidget* KviInputEditor::m_pInputParent
protected
KviWindow* KviInputEditor::m_pKviWindow
protected
KviInputEditor::m_pRedoStack
protected

The redo stack.

Contains owned pointers and has autodelete set to true. The most recently undone command is at the end. Null when no redo is available.

Referenced by clearUndoStack(), KviInputEditor(), redo(), undo(), and ~KviInputEditor().

KviInputEditor::m_pUndoStack
protected

The undo stack.

Contains owned pointers and has autodelete set to true. The most recent command is at the end. Null when no undo is available.

Referenced by addUndo(), clearUndoStack(), KviInputEditor(), redo(), undo(), and ~KviInputEditor().

KviUserListView* KviInputEditor::m_pUserListView
protected
QMenu KviInputEditor::m_SpellCheckerPopup
protected
KviCString KviInputEditor::m_szAltKeyCode
protected

Referenced by keyPressEvent(), and keyReleaseEvent().

QString KviInputEditor::m_szIMText
protected
QString KviInputEditor::m_szLastCompletedNick
protected
QString KviInputEditor::m_szLastCompletionBuffer
protected

Referenced by standardNickCompletion().

KviCString KviInputEditor::m_szSaveTextBuffer
protected

Referenced by historyNext(), and historyPrev().

QString KviInputEditor::m_szTextBuffer
protected

Property Documentation

int KviInputEditor::TransparencyCapable
read

The documentation for this class was generated from the following files: