Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Konsole
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
23
Merge Requests
23
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Utilities
Konsole
Commits
614580fb
Commit
614580fb
authored
Apr 11, 2017
by
Kurt Hindenburg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
move SearchDirection enum to general Enumeration file
parent
f841ddea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
27 deletions
+33
-27
src/Enumeration.h
src/Enumeration.h
+16
-0
src/SessionController.cpp
src/SessionController.cpp
+12
-12
src/SessionController.h
src/SessionController.h
+5
-15
No files found.
src/Enumeration.h
View file @
614580fb
...
...
@@ -119,6 +119,22 @@ public:
/** No bell effects */
NoBell
=
3
};
/**
* This enum describes the strategies available for searching
* through the session's output.
*/
enum
SearchDirection
{
/** Searches forwards through the output, starting at the
* current selection.
*/
ForwardsSearch
,
/** Searches backwards through the output, starting at the
* current selection.
*/
BackwardsSearch
};
};
}
#endif // ENUMERATION_H
...
...
src/SessionController.cpp
View file @
614580fb
...
...
@@ -1265,7 +1265,7 @@ void SessionController::searchTextChanged(const QString& text)
// update search. this is called even when the text is
// empty to clear the view's filters
beginSearch
(
text
,
reverseSearchChecked
()
?
SearchHistoryTask
::
BackwardsSearch
:
SearchHistoryTask
::
ForwardsSearch
);
beginSearch
(
text
,
reverseSearchChecked
()
?
Enum
::
BackwardsSearch
:
Enum
::
ForwardsSearch
);
}
void
SessionController
::
searchCompleted
(
bool
success
)
{
...
...
@@ -1275,7 +1275,7 @@ void SessionController::searchCompleted(bool success)
_searchBar
->
setFoundMatch
(
success
);
}
void
SessionController
::
beginSearch
(
const
QString
&
text
,
int
direction
)
void
SessionController
::
beginSearch
(
const
QString
&
text
,
Enum
::
SearchDirection
direction
)
{
Q_ASSERT
(
_searchBar
);
Q_ASSERT
(
_searchFilter
);
...
...
@@ -1284,7 +1284,7 @@ void SessionController::beginSearch(const QString& text , int direction)
_searchFilter
->
setRegExp
(
regExp
);
if
(
_searchStartLine
==
-
1
)
{
if
(
direction
==
SearchHistoryTask
::
ForwardsSearch
)
{
if
(
direction
==
Enum
::
ForwardsSearch
)
{
setSearchStartTo
(
_view
->
screenWindow
()
->
currentLine
());
}
else
{
setSearchStartTo
(
_view
->
screenWindow
()
->
currentLine
()
+
_view
->
screenWindow
()
->
windowLines
());
...
...
@@ -1298,7 +1298,7 @@ void SessionController::beginSearch(const QString& text , int direction)
connect
(
task
,
&
Konsole
::
SearchHistoryTask
::
completed
,
this
,
&
Konsole
::
SessionController
::
searchCompleted
);
task
->
setRegExp
(
regExp
);
task
->
setSearchDirection
(
(
SearchHistoryTask
::
SearchDirection
)
direction
);
task
->
setSearchDirection
(
direction
);
task
->
setAutoDelete
(
true
);
task
->
setStartLine
(
_searchStartLine
);
task
->
addScreenWindow
(
_session
,
_view
->
screenWindow
());
...
...
@@ -1333,7 +1333,7 @@ void SessionController::searchFrom()
}
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
SearchHistoryTask
::
BackwardsSearch
:
SearchHistoryTask
::
ForwardsSearch
);
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
Enum
::
BackwardsSearch
:
Enum
::
ForwardsSearch
);
}
void
SessionController
::
findNextInHistory
()
{
...
...
@@ -1342,7 +1342,7 @@ void SessionController::findNextInHistory()
setSearchStartTo
(
_prevSearchResultLine
);
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
SearchHistoryTask
::
BackwardsSearch
:
SearchHistoryTask
::
ForwardsSearch
);
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
Enum
::
BackwardsSearch
:
Enum
::
ForwardsSearch
);
}
void
SessionController
::
findPreviousInHistory
()
{
...
...
@@ -1351,7 +1351,7 @@ void SessionController::findPreviousInHistory()
setSearchStartTo
(
_prevSearchResultLine
);
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
SearchHistoryTask
::
ForwardsSearch
:
SearchHistoryTask
::
BackwardsSearch
);
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
Enum
::
ForwardsSearch
:
Enum
::
BackwardsSearch
);
}
void
SessionController
::
changeSearchMatch
()
{
...
...
@@ -1360,7 +1360,7 @@ void SessionController::changeSearchMatch()
// reset Selection for new case match
_view
->
screenWindow
()
->
clearSelection
();
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
SearchHistoryTask
::
BackwardsSearch
:
SearchHistoryTask
::
ForwardsSearch
);
beginSearch
(
_searchBar
->
searchText
(),
reverseSearchChecked
()
?
Enum
::
BackwardsSearch
:
Enum
::
ForwardsSearch
);
}
void
SessionController
::
showHistoryOptions
()
{
...
...
@@ -1839,7 +1839,7 @@ void SearchHistoryTask::executeOnScreenWindow(SessionPtr session , ScreenWindowP
if
(
!
_regExp
.
pattern
().
isEmpty
())
{
int
pos
=
-
1
;
const
bool
forwards
=
(
_direction
==
ForwardsSearch
);
const
bool
forwards
=
(
_direction
==
Enum
::
ForwardsSearch
);
const
int
lastLine
=
window
->
lineCount
()
-
1
;
int
startLine
;
...
...
@@ -1973,11 +1973,11 @@ void SearchHistoryTask::highlightResult(ScreenWindowPtr window , int findPos)
SearchHistoryTask
::
SearchHistoryTask
(
QObject
*
parent
)
:
SessionTask
(
parent
)
,
_direction
(
BackwardsSearch
)
,
_direction
(
Enum
::
BackwardsSearch
)
,
_startLine
(
0
)
{
}
void
SearchHistoryTask
::
setSearchDirection
(
SearchDirection
direction
)
void
SearchHistoryTask
::
setSearchDirection
(
Enum
::
SearchDirection
direction
)
{
_direction
=
direction
;
}
...
...
@@ -1985,7 +1985,7 @@ void SearchHistoryTask::setStartLine(int line)
{
_startLine
=
line
;
}
SearchHistoryTask
::
SearchDirection
SearchHistoryTask
::
searchDirection
()
const
Enum
::
SearchDirection
SearchHistoryTask
::
searchDirection
()
const
{
return
_direction
;
}
...
...
src/SessionController.h
View file @
614580fb
...
...
@@ -35,6 +35,7 @@
// Konsole
#include "ViewProperties.h"
#include "Profile.h"
#include "Enumeration.h"
namespace
KIO
{
...
...
@@ -298,7 +299,7 @@ private:
// text - pattern to search for
// direction - value from SearchHistoryTask::SearchDirection enum to specify
// the search direction
void
beginSearch
(
const
QString
&
text
,
int
direction
);
void
beginSearch
(
const
QString
&
text
,
Enum
::
SearchDirection
direction
);
QRegularExpression
regexpFromSearchBarOptions
()
const
;
bool
reverseSearchChecked
()
const
;
void
setupCommonActions
();
...
...
@@ -480,17 +481,6 @@ class SearchHistoryTask : public SessionTask
Q_OBJECT
public:
/**
* This enum describes the strategies available for searching through the
* session's output.
*/
enum
SearchDirection
{
/** Searches forwards through the output, starting at the current selection. */
ForwardsSearch
,
/** Searches backwards through the output, starting at the current selection. */
BackwardsSearch
};
/**
* Constructs a new search task.
*/
...
...
@@ -505,9 +495,9 @@ public:
QRegularExpression
regExp
()
const
;
/** Specifies the direction to search in when execute() is called. */
void
setSearchDirection
(
SearchDirection
direction
);
void
setSearchDirection
(
Enum
::
SearchDirection
direction
);
/** Returns the current search direction. See setSearchDirection(). */
SearchDirection
searchDirection
()
const
;
Enum
::
SearchDirection
searchDirection
()
const
;
/** The line from which the search will be done **/
void
setStartLine
(
int
startLine
);
...
...
@@ -532,7 +522,7 @@ private:
QMap
<
SessionPtr
,
ScreenWindowPtr
>
_windows
;
QRegularExpression
_regExp
;
SearchDirection
_direction
;
Enum
::
SearchDirection
_direction
;
int
_startLine
;
//static QPointer<SearchHistoryThread> _thread;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment