~verzegnassi-stefano/+junk/ubuntu-terminal-app-uitk13

« back to all changes in this revision

Viewing changes to src/plugin/qmltermwidget/qtermwidget/lib/HistorySearch.h

  • Committer: Filippo Scognamiglio
  • Date: 2014-10-25 04:42:31 UTC
  • Revision ID: flscogna@gmail.com-20141025044231-javjhusbqa171127
Initial reboot commit.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright 2013 Christian Surlykke
 
3
 
 
4
    This program is free software; you can redistribute it and/or modify
 
5
    it under the terms of the GNU General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or
 
7
    (at your option) any later version.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
    GNU General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU General Public License
 
15
    along with this program; if not, write to the Free Software
 
16
    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
 
17
    02110-1301  USA.
 
18
*/
 
19
#ifndef TASK_H
 
20
#define TASK_H
 
21
 
 
22
#include <QObject>
 
23
#include <QPointer>
 
24
#include <QMap>
 
25
 
 
26
#include <Session.h>
 
27
#include <ScreenWindow.h>
 
28
 
 
29
#include "Emulation.h"
 
30
#include "TerminalCharacterDecoder.h"
 
31
 
 
32
using namespace Konsole;
 
33
 
 
34
typedef QPointer<Emulation> EmulationPtr;
 
35
 
 
36
class HistorySearch : public QObject
 
37
{
 
38
    Q_OBJECT
 
39
 
 
40
public:
 
41
    explicit HistorySearch(EmulationPtr emulation, QRegExp regExp, bool forwards, 
 
42
                           int startColumn, int startLine, QObject* parent);
 
43
 
 
44
    ~HistorySearch();
 
45
 
 
46
    void search();
 
47
 
 
48
signals:
 
49
    void matchFound(int startColumn, int startLine, int endColumn, int endLine);
 
50
    void noMatchFound();
 
51
 
 
52
private: 
 
53
    bool search(int startColumn, int startLine, int endColumn, int endLine);
 
54
    int findLineNumberInString(QList<int> linePositions, int position);
 
55
   
 
56
    
 
57
    EmulationPtr m_emulation;
 
58
    QRegExp m_regExp;
 
59
    bool m_forwards;
 
60
    int m_startColumn;
 
61
    int m_startLine;
 
62
 
 
63
    int m_foundStartColumn;
 
64
    int m_foundStartLine;
 
65
    int m_foundEndColumn;
 
66
    int m_foundEndLine;
 
67
};
 
68
 
 
69
#endif  /* TASK_H */
 
70