QTfrontend/ui/widget/SmartLineEdit.h
author nemo
Mon, 30 Jan 2012 17:32:18 -0500
changeset 6616 f77bb02b669f
parent 6205 7764cbe4ddd7
child 6700 e04da46ee43c
permissions -rw-r--r--
astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     1
/*
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     2
 * Hedgewars, a free turn based strategy game
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     3
 * Copyright (c) 2006-2007 Igor Ulyanov <iulyanov@gmail.com>
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     4
 * Copyright (c) 2007-2011 Andrey Korotaev <unC0Rr@gmail.com>
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     5
 *
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     6
 * This program is free software; you can redistribute it and/or modify
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     7
 * it under the terms of the GNU General Public License as published by
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     8
 * the Free Software Foundation; version 2 of the License
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
     9
 *
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    10
 * This program is distributed in the hope that it will be useful,
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    13
 * GNU General Public License for more details.
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    14
 *
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    16
 * along with this program; if not, write to the Free Software
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    18
 */
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    19
6168
6f301dac12ff fix an include; fix/add comments
sheepluva
parents: 6163
diff changeset
    20
/**
6170
2b1748161278 fix multiplayer page layout, doc/comment fixes
sheepluva
parents: 6168
diff changeset
    21
 * @file
6168
6f301dac12ff fix an include; fix/add comments
sheepluva
parents: 6163
diff changeset
    22
 * @brief SmartLineEdit class definition
6f301dac12ff fix an include; fix/add comments
sheepluva
parents: 6163
diff changeset
    23
 */
6f301dac12ff fix an include; fix/add comments
sheepluva
parents: 6163
diff changeset
    24
6153
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6151
diff changeset
    25
#ifndef HEDGEWARS_SMARTLINEEDIT_H
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6151
diff changeset
    26
#define HEDGEWARS_SMARTLINEEDIT_H
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    27
6187
59ff93c0ae2d * adding destructors to my line edit subclasses
sheepluva
parents: 6170
diff changeset
    28
#include <QMap>
59ff93c0ae2d * adding destructors to my line edit subclasses
sheepluva
parents: 6170
diff changeset
    29
#include <QString>
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    30
#include <QStringList>
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    31
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    32
#include <QEvent>
6187
59ff93c0ae2d * adding destructors to my line edit subclasses
sheepluva
parents: 6170
diff changeset
    33
#include <QKeyEvent>
59ff93c0ae2d * adding destructors to my line edit subclasses
sheepluva
parents: 6170
diff changeset
    34
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    35
#include <QRegExp>
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    36
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6150
diff changeset
    37
#include "HistoryLineEdit.h"
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    38
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    39
/**
6200
6a4ace88d85a tweak and document abstract page
sheepluva
parents: 6188
diff changeset
    40
 * @brief {@link HistoryLineEdit} that features auto-completion with TAB key
6162
437116977d43 comment fixes
sheepluva
parents: 6161
diff changeset
    41
 *         and clear with ESC key.
6150
1d98752c1fba frontend chat input history, use arrow keys UP/DOWN
sheepluva
parents: 6149
diff changeset
    42
 *
6160
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6153
diff changeset
    43
 * Notes:
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6153
diff changeset
    44
 * <ul>
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6153
diff changeset
    45
 *   <li>A Keyword can either be a command (if first word) or
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6153
diff changeset
    46
 *       a nickname (completed regardless of position in text).</li>
863d3edf5690 cleaning up some more, also adding a WIP file. changes: hats in the hat selection are now sorted like this: NoHat, Reserved hats (alphabetically), All other hats (alphabeticall)
sheepluva
parents: 6153
diff changeset
    47
 * </ul>
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    48
 *
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    49
 * @author sheepluva
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    50
 * @since 0.9.17
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    51
 */
6151
9fd5b70acb1a give the room name edit box a history of previous room. however I hate that box from the bottom of my heart, it shall dieeeee... later...
sheepluva
parents: 6150
diff changeset
    52
class SmartLineEdit : public HistoryLineEdit
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    53
{
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    54
        Q_OBJECT
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    55
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    56
    public:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    57
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    58
        * @brief Class constructor.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    59
        * @param parent parent QWidget.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    60
        * @param maxHistorySize maximum amount of history entries kept.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    61
        */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    62
        SmartLineEdit(QWidget * parent = 0, int maxHistorySize = 64);
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    63
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    64
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    65
        * @brief Class destructor.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    66
        */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    67
        ~SmartLineEdit();
6187
59ff93c0ae2d * adding destructors to my line edit subclasses
sheepluva
parents: 6170
diff changeset
    68
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    69
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    70
         * @brief Adds commands to the auto-completion feature.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    71
         * @param commands list of commands to be added.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    72
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    73
        void addCommands(const QStringList & commands);
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    74
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    75
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    76
         * @brief Adds a single nickname to the auto-completion feature.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    77
         * @param nickname name to be added.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    78
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    79
        void addNickname(const QString & nickname);
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    80
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    81
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    82
         * @brief Removes commands from the auto-completion feature.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    83
         * @param commands list of commands to be removed.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    84
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    85
        void removeCommands(const QStringList & commands);
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    86
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    87
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    88
         * @brief Removes a single nickname from the auto-completion feature.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    89
         * @param nickname name to be removed.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    90
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    91
        void removeNickname(const QString & nickname);
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
    92
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    93
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    94
         * @brief Forget all keywords and input history.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    95
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    96
        void reset();
6150
1d98752c1fba frontend chat input history, use arrow keys UP/DOWN
sheepluva
parents: 6149
diff changeset
    97
1d98752c1fba frontend chat input history, use arrow keys UP/DOWN
sheepluva
parents: 6149
diff changeset
    98
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
    99
    protected:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   100
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   101
         * @brief Overrides method of parent class.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   102
         * Forward pressed TAB to parent class' method (for focus handling etc)
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   103
         * only if line is empty.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   104
         *
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   105
         * @param event the event.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   106
         * @return returns true if the event was recognized.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   107
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   108
        virtual bool event(QEvent * event);
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   109
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   110
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   111
         * @brief Overrides method of parent class.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   112
         * Autocompletes if TAB is reported as pressed key in the key event,
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   113
         * ESC leads to the contents being cleared.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   114
         *
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   115
         * Other keys are forwarded to parent method.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   116
         *
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   117
         * @param event the key event.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   118
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   119
        virtual void keyPressEvent(QKeyEvent * event);
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   120
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   121
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   122
    private:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   123
        QRegExp m_whitespace; ///< regexp that matches a whitespace
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   124
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   125
        QStringList * m_cmds;  ///< list of recognized commands
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   126
        QStringList * m_nicks; ///< list of recognized nicknames
6188
e48280142001 doxygen seems to get confused if a ///< line is followed by a /// line
sheepluva
parents: 6187
diff changeset
   127
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   128
        /// recognized nicknames, sorted case-insensitive
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   129
        QMap<QString, QString> * m_sorted_nicks;
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   130
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   131
        // these variables contain information about the last replacement
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   132
        // they get reset whenever cursor is moved or text is changed
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   133
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   134
        QString m_beforeMatch; ///< the string that was just matched
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   135
        bool m_hasJustMatched; ///< whether this widget just did an auto-completion
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   136
        QString m_prefix; ///< prefix of the text replacement this widget just did
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   137
        QString m_postfix; ///< postfix of the text replacement this widget just did
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   138
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   139
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   140
         * @brief Autocompletes the contents based on the known commands and/or names.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   141
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   142
        void autoComplete();
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   143
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   144
6616
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   145
    private slots:
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   146
        /**
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   147
         * @brief Resets the information about the last match and text replacement.
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   148
         */
f77bb02b669f astyle -C -S -L -N --style=allman --recursive "QTfrontend/*.cpp" "QTfrontend/*.h"
nemo
parents: 6205
diff changeset
   149
        void resetAutoCompletionStatus();
6147
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   150
};
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   151
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   152
b4d7d8d62feb feature-pimpin'-up the chat input line in frontend:
sheepluva
parents:
diff changeset
   153
6153
3881126e06e8 allow changing number of hogs or weapons with mousewheel
sheepluva
parents: 6151
diff changeset
   154
#endif // HEDGEWARS_SMARTLINEEDIT_H