Changeset View
Changeset View
Standalone View
Standalone View
plugins/grepview/grepjob.h
Show All 30 Lines | 30 | { | |||
---|---|---|---|---|---|
31 | class IProject; | 31 | class IProject; | ||
32 | class ProcessLineMaker; | 32 | class ProcessLineMaker; | ||
33 | } | 33 | } | ||
34 | 34 | | |||
35 | class QRegExp; | 35 | class QRegExp; | ||
36 | class GrepViewPlugin; | 36 | class GrepViewPlugin; | ||
37 | class FindReplaceTest; //FIXME: this is useful only for tests | 37 | class FindReplaceTest; //FIXME: this is useful only for tests | ||
38 | 38 | | |||
39 | struct GrepJobSettings | ||||
kfunk: Minor style issue: Newline before `{` | |||||
40 | { | ||||
41 | bool projectFilesOnly = false; | ||||
42 | bool caseSensitive = true; | ||||
43 | bool regexp = true; | ||||
44 | | ||||
45 | int depth = -1; | ||||
46 | | ||||
47 | QString pattern; | ||||
Maybe some more readable name? Something like "template" or maybe "searchTemplate". ematirov: Maybe some more readable name? Something like "template" or maybe "searchTemplate". | |||||
48 | QString searchTemplate; | ||||
49 | QString replacementTemplate; | ||||
50 | QString files; | ||||
51 | QString exclude; | ||||
52 | }; | ||||
53 | | ||||
39 | class GrepJob : public KJob, public KDevelop::IStatus | 54 | class GrepJob : public KJob, public KDevelop::IStatus | ||
40 | { | 55 | { | ||
41 | Q_OBJECT | 56 | Q_OBJECT | ||
42 | Q_INTERFACES( KDevelop::IStatus ) | 57 | Q_INTERFACES( KDevelop::IStatus ) | ||
43 | 58 | | |||
44 | friend class GrepViewPlugin; | 59 | friend class GrepViewPlugin; | ||
45 | friend class FindReplaceTest; | 60 | friend class FindReplaceTest; | ||
46 | 61 | | |||
47 | private: | 62 | private: | ||
48 | ///Job can only be instanciated by plugin | 63 | ///Job can only be instanciated by plugin | ||
49 | explicit GrepJob( QObject *parent = nullptr ); | 64 | explicit GrepJob( QObject *parent = nullptr ); | ||
50 | 65 | | |||
51 | public: | 66 | public: | ||
67 | void setSettings(const GrepJobSettings& settings); | ||||
68 | GrepJobSettings settings() const; | ||||
What's point of using comments here? It's not necessary since old version still be available on git in case it'll be needed. ematirov: What's point of using comments here? It's not necessary since old version still be available on… | |||||
52 | 69 | | |||
53 | void setOutputModel(GrepOutputModel * model); | 70 | void setOutputModel(GrepOutputModel * model); | ||
54 | void setPatternString(const QString& patternString); | | |||
55 | void setTemplateString(const QString &templateString); | | |||
56 | void setReplacementTemplateString(const QString &replTmplString); | | |||
57 | void setFilesString(const QString &filesString); | | |||
58 | void setExcludeString(const QString &excludeString); | | |||
59 | void setDirectoryChoice(const QList<QUrl> &choice); | 71 | void setDirectoryChoice(const QList<QUrl> &choice); | ||
60 | void setDepth(int depth); | | |||
61 | void setRegexpFlag(bool regexpFlag); | | |||
62 | void setCaseSensitive(bool caseSensitive); | | |||
63 | void setProjectFilesFlag(bool projectFilesFlag); | | |||
64 | 72 | | |||
65 | void start() override; | 73 | void start() override; | ||
66 | 74 | | |||
67 | QString statusName() const override; | 75 | QString statusName() const override; | ||
68 | protected: | 76 | protected: | ||
69 | bool doKill() override; | 77 | bool doKill() override; | ||
70 | 78 | | |||
71 | // GrepOutputModel* model() const; | 79 | // GrepOutputModel* model() const; | ||
72 | 80 | | |||
73 | private Q_SLOTS: | 81 | private Q_SLOTS: | ||
74 | void slotFindFinished(); | 82 | void slotFindFinished(); | ||
75 | void testFinishState(KJob *job); | 83 | void testFinishState(KJob *job); | ||
76 | 84 | | |||
77 | Q_SIGNALS: | 85 | Q_SIGNALS: | ||
78 | void clearMessage( KDevelop::IStatus* ) override; | 86 | void clearMessage( KDevelop::IStatus* ) override; | ||
79 | void showMessage( KDevelop::IStatus*, const QString & message, int timeout = 0) override; | 87 | void showMessage( KDevelop::IStatus*, const QString & message, int timeout = 0) override; | ||
80 | void showErrorMessage(const QString & message, int timeout = 0) override; | 88 | void showErrorMessage(const QString & message, int timeout = 0) override; | ||
81 | void hideProgress( KDevelop::IStatus* ) override; | 89 | void hideProgress( KDevelop::IStatus* ) override; | ||
82 | void showProgress( KDevelop::IStatus*, int minimum, int maximum, int value) override; | 90 | void showProgress( KDevelop::IStatus*, int minimum, int maximum, int value) override; | ||
83 | void foundMatches( const QString& filename, const GrepOutputItem::List& matches); | 91 | void foundMatches( const QString& filename, const GrepOutputItem::List& matches); | ||
84 | 92 | | |||
85 | private: | 93 | private: | ||
86 | Q_INVOKABLE void slotWork(); | 94 | Q_INVOKABLE void slotWork(); | ||
87 | 95 | | |||
88 | QString m_patternString; | 96 | QList<QUrl> m_directoryChoice; | ||
97 | QString m_errorMessage; | ||||
98 | | ||||
89 | QRegExp m_regExp; | 99 | QRegExp m_regExp; | ||
90 | QString m_regExpSimple; | 100 | QString m_regExpSimple; | ||
91 | GrepOutputModel *m_outputModel; | 101 | GrepOutputModel *m_outputModel; | ||
92 | 102 | | |||
93 | enum { | 103 | enum { | ||
94 | WorkCollectFiles, | 104 | WorkCollectFiles, | ||
95 | WorkGrep, | 105 | WorkGrep, | ||
96 | WorkIdle, | 106 | WorkIdle, | ||
97 | WorkCancelled | 107 | WorkCancelled | ||
98 | } m_workState; | 108 | } m_workState; | ||
99 | 109 | | |||
100 | QList<QUrl> m_fileList; | 110 | QList<QUrl> m_fileList; | ||
101 | int m_fileIndex; | 111 | int m_fileIndex; | ||
102 | QPointer<GrepFindFilesThread> m_findThread; | 112 | QPointer<GrepFindFilesThread> m_findThread; | ||
103 | 113 | | |||
104 | QString m_errorMessage; | 114 | GrepJobSettings m_settings; | ||
105 | QString m_templateString; | | |||
106 | QString m_replacementTemplateString; | | |||
107 | QString m_filesString; | | |||
108 | QString m_excludeString; | | |||
109 | QList<QUrl> m_directoryChoice; | | |||
110 | | ||||
111 | bool m_useProjectFilesFlag; | | |||
112 | bool m_regexpFlag; | | |||
113 | bool m_caseSensitiveFlag; | | |||
114 | int m_depthValue; | | |||
115 | 115 | | |||
116 | bool m_findSomething; | 116 | bool m_findSomething; | ||
117 | }; | 117 | }; | ||
118 | 118 | | |||
119 | //FIXME: this function is used externally only for tests, find a way to keep it | 119 | //FIXME: this function is used externally only for tests, find a way to keep it | ||
120 | // static for a regular compilation | 120 | // static for a regular compilation | ||
121 | GrepOutputItem::List grepFile(const QString &filename, const QRegExp &re); | 121 | GrepOutputItem::List grepFile(const QString &filename, const QRegExp &re); | ||
ematirov: Same there. Indentation issue. | |||||
122 | 122 | | |||
123 | #endif | 123 | #endif | ||
ematirov: Is m_templateString used somewhere now? If no, please remove it. |
Minor style issue: Newline before {