14#include <QtCore/qstringlist.h>
31namespace ot {
class Splitter; }
36 FARMatch(
const QString& _fullPath,
int _line,
const QString& _text) : m_fullPath(_fullPath), m_line(_line), m_text(_text) {};
37 FARMatch(
const FARMatch& _other) : m_text(_other.m_text), m_fullPath(_other.m_fullPath), m_line(_other.m_line) {};
39 void setText(
const QString& _text) { m_text = _text; };
40 const QString&
text(
void)
const {
return m_text; };
42 void setLine(
int _line) { m_line = _line; };
43 int line(
void)
const {
return m_line; };
45 void setFullPath(
const QString& _path) { m_fullPath = _path; };
46 const QString&
fullPath(
void)
const {
return m_fullPath; };
100 QStringList m_whitelistFiles;
102 QStringList m_blacklistFiles;
104 QStringList m_whitelistDirectories;
106 QStringList m_blacklistDirectories;
113 FARFile(
const QString& _fullPath);
122 bool findText(
const QString& _text,
FARFilter::FilterFlags _textFilter, std::list<FARMatch>& _matches,
int& _longestText,
int& _longestPath)
const;
124 bool replaceText(
const QString& _text,
const QString& _newText,
FARFilter::FilterFlags _textFilter, std::list<FARMatch>& _matches,
int& _longestText,
int& _longestPath);
126 void setFullPath(
const QString& _fullPath) { m_fullPath = _fullPath; };
127 const QString&
fullPath(
void)
const {
return m_fullPath; };
130 const QString&
nameOnly(
void)
const {
return m_nameOnly; };
135 void setTextLines(
const QStringList& _lines) { m_textLines = _lines; };
136 const QStringList&
textLines(
void)
const {
return m_textLines; };
141 QString m_fileExtension;
142 QStringList m_textLines;
173 bool scanAll(
const FARFilter& _filter,
int& _fileCounter,
int& _directoryCounter,
bool _topLevelOnly =
true,
bool _readFiles =
false);
175 bool findText(
const QString& _text,
FARFilter::FilterFlags _textFilter, std::list<FARMatch>& _matches,
int& _longestText,
int& _longestPath,
bool _topLevelOnly =
true)
const;
177 bool replaceText(
const QString& _text,
const QString& _newText,
FARFilter::FilterFlags _textFilter, std::list<FARMatch>& _matches,
int& _longestText,
int& _longestPath,
bool _topLevelOnly =
true);
180 const QString&
fullPath(
void)
const {
return m_fullPath; };
183 const QString&
nameOnly(
void)
const {
return m_nameOnly; };
185 void setFiles(
const std::list<FARFile>& _files) { m_files = _files; };
186 const std::list<FARFile>&
files(
void)
const {
return m_files; };
188 void setDirectories(
const std::list<FARDirectory>& _directories) { m_directories = _directories; };
189 const std::list<FARDirectory>&
directories(
void)
const {
return m_directories; };
194 std::list<FARFile> m_files;
195 std::list<FARDirectory> m_directories;
221 void slotBrowseRoot(
void);
222 void slotFindText(
void);
223 void slotReplaceText(
void);
225 void slotUnlock(
void);
230 QPlainTextEdit* edit;
231 QCheckBox* checkCase;
240 void setupFilter(
FARFilter& _filter)
const;
247 void workerReplaceTextLogic(
const QString& _root,
const QString& _text,
const QString& _newText,
FARFilter::FilterFlags _textFilter,
FARFilter _filter);
249 FilterGroup createFilterGroup(
const QString& _labelText, QGridLayout* _layout,
int _row);
250 void restoreFilterGroupSettings(FilterGroup& _group,
const QString& _settingsKey, QSettings& _settings);
252 void saveFilterGroup(
const FilterGroup& _group,
const QString& _settingsKey, QSettings& _settings);
256 QWidget* m_leftGridW;
257 QGridLayout* m_leftGrid;
261 FilterGroup m_whitelistFiles;
262 FilterGroup m_blacklistFiles;
263 FilterGroup m_whitelistDirectories;
264 FilterGroup m_blacklistDirectories;
266 QWidget* m_rightLayoutW;
267 QVBoxLayout* m_rightLayout;
269 QHBoxLayout* m_rightTopLayout;
272 QLineEdit* m_rootDir;
273 QPushButton* m_browseRootDir;
275 QTabWidget* m_findModeTab;
277 QWidget* m_findTextLayoutW;
278 QVBoxLayout* m_findTextLayout;
279 QGridLayout* m_findTextTopLayout;
280 QHBoxLayout* m_findTextButtonLayout;
282 QLineEdit* m_findText;
283 QLabel* m_findTextMode;
284 QCheckBox* m_findTextCaseSensitive;
285 QCheckBox* m_findTextStartsWith;
286 QCheckBox* m_findTextContains;
287 QCheckBox* m_findTextEndsWith;
288 QCheckBox* m_findTextRegex;
289 QPushButton* m_findTextBtn;
291 QWidget* m_replaceTextLayoutW;
292 QVBoxLayout* m_replaceTextLayout;
293 QGridLayout* m_replaceTextTopLayout;
294 QHBoxLayout* m_replaceTextButtonLayout;
295 QLabel* m_replaceTextL;
296 QLineEdit* m_replaceText;
297 QCheckBox* m_replaceTextCaseSensitive;
298 QLabel* m_replaceWithTextL;
299 QLineEdit* m_replaceWithText;
300 QPushButton* m_replaceTextBtn;
#define OT_ADD_FLAG_FUNCTIONS(___enumName)
Will add the default bitwise operations for the provided private 32/64 bit bitfield....
Definition Flags.h:129
This file contains defines that may be used simplyfy class creation.
bool exists(void) const
Definition FAR.cpp:331
void setDirectories(const std::list< FARDirectory > &_directories)
Definition FAR.h:188
const QString & fullPath(void) const
Definition FAR.h:180
void setNameOnly(const QString &_name)
Definition FAR.h:182
const std::list< FARFile > & files(void) const
Definition FAR.h:186
bool scanFiles(const FARFilter &_filter, int &_counter)
Find all files in this directory. Result is buffered.
Definition FAR.cpp:336
bool readAllFiles(bool _topLevelOnly=true)
Read all the files found in this directory. Note that scan files must be called first if the files ar...
Definition FAR.cpp:358
bool findText(const QString &_text, FARFilter::FilterFlags _textFilter, std::list< FARMatch > &_matches, int &_longestText, int &_longestPath, bool _topLevelOnly=true) const
Definition FAR.cpp:424
FARDirectory(const QString &_fullPath)
Definition FAR.cpp:316
const std::list< FARDirectory > & directories(void) const
Definition FAR.h:189
void setFullPath(const QString &_path)
Definition FAR.h:179
const QString & nameOnly(void) const
Definition FAR.h:183
bool scanAll(const FARFilter &_filter, int &_fileCounter, int &_directoryCounter, bool _topLevelOnly=true, bool _readFiles=false)
Find all files and directories in this directory. Result is buffered.
Definition FAR.cpp:397
bool scanDirectories(const FARFilter &_filter, int &_counter, bool _topLevelOnly=true)
Find all the child directories in this directory. Result is buffered.
Definition FAR.cpp:370
bool replaceText(const QString &_text, const QString &_newText, FARFilter::FilterFlags _textFilter, std::list< FARMatch > &_matches, int &_longestText, int &_longestPath, bool _topLevelOnly=true)
Definition FAR.cpp:438
void setFiles(const std::list< FARFile > &_files)
Definition FAR.h:185
void setTextLines(const QStringList &_lines)
Definition FAR.h:135
bool readAll(void)
Definition FAR.cpp:194
const QString & nameOnly(void) const
Definition FAR.h:130
void setFileExtension(const QString &_extension)
Definition FAR.h:132
void setFullPath(const QString &_fullPath)
Definition FAR.h:126
const QStringList & textLines(void) const
Definition FAR.h:136
bool replaceText(const QString &_text, const QString &_newText, FARFilter::FilterFlags _textFilter, std::list< FARMatch > &_matches, int &_longestText, int &_longestPath)
Definition FAR.cpp:285
bool exists(void) const
Definition FAR.cpp:236
const QString & fileExtension(void) const
Definition FAR.h:133
const QString & fullPath(void) const
Definition FAR.h:127
bool findText(const QString &_text, FARFilter::FilterFlags _textFilter, std::list< FARMatch > &_matches, int &_longestText, int &_longestPath) const
Definition FAR.cpp:241
bool writeAll(void)
Definition FAR.cpp:219
FARFile(const QString &_fullPath)
Definition FAR.cpp:185
void setNameOnly(const QString &_name)
Definition FAR.h:129
void setBlacklistDirectoriesFlags(FilterFlags _flags)
Definition FAR.h:96
FilterFlags whitelistFilesFlags(void) const
Definition FAR.h:79
void setWhitelistFiles(const QStringList &_whitelist)
Definition FAR.h:75
void setWhitelistFilesFlags(FilterFlags _flags)
Definition FAR.h:78
void setBlacklistDirectories(const QStringList &_blacklist)
Definition FAR.h:93
FilterFlags blacklistFilesFlags(void) const
Definition FAR.h:85
void setBlacklistFiles(const QStringList &_blacklist)
Definition FAR.h:81
const QStringList & blacklistFiles(void) const
Definition FAR.h:82
const QStringList & blacklistDirectories(void) const
Definition FAR.h:94
void setWhitelistDirectories(const QStringList &_whitelist)
Definition FAR.h:87
FilterFlag
Definition FAR.h:59
@ StartsWith
Definition FAR.h:61
@ AsRegex
Definition FAR.h:64
@ CheckCase
Definition FAR.h:65
@ EndsWith
Definition FAR.h:63
@ NoFlags
Definition FAR.h:60
@ Contains
Definition FAR.h:62
void setWhitelistDirectoriesFlags(FilterFlags _flags)
Definition FAR.h:90
bool validate(const FARFile &_file) const
Definition FAR.cpp:56
FARFilter()
Definition FAR.cpp:41
FilterFlags whitelistDirectoriesFlags(void) const
Definition FAR.h:91
FilterFlags blacklistDirectoriesFlags(void) const
Definition FAR.h:97
ot::Flags< FilterFlag > FilterFlags
Definition FAR.h:67
const QStringList & whitelistFiles(void) const
Definition FAR.h:76
const QStringList & whitelistDirectories(void) const
Definition FAR.h:88
void setBlacklistFilesFlags(FilterFlags _flags)
Definition FAR.h:84
virtual ~FAR()
Definition FAR.cpp:462
FAR()
Definition FAR.cpp:458
virtual void restoreToolSettings(QSettings &_settings) override
Definition FAR.cpp:611
virtual QString getToolName(void) const override
Return the unique tool name The name will be used to create all required menu entries.
Definition FAR.cpp:470
virtual bool prepareToolShutdown(QSettings &_settings) override
Stop all the logic of this tool.
Definition FAR.cpp:631
virtual bool runTool(QMenu *_rootMenu, otoolkit::ToolWidgets &_content) override
Create the central widget that will be displayed to the user in the main tab view.
Definition FAR.cpp:474
void setFullPath(const QString &_path)
Definition FAR.h:45
FARMatch(const QString &_fullPath, int _line, const QString &_text)
Definition FAR.h:36
FARMatch()
Definition FAR.h:35
FARMatch(const FARMatch &_other)
Definition FAR.h:37
int line(void) const
Definition FAR.h:43
const QString & text(void) const
Definition FAR.h:40
void setLine(int _line)
Definition FAR.h:42
const QString & fullPath(void) const
Definition FAR.h:46
void setText(const QString &_text)
Definition FAR.h:39
The Flags class is a wrapper around a enum that allows bitwise operations (flags)....
Definition Flags.h:214