Changeset View
Changeset View
Standalone View
Standalone View
plugins/grepview/grepdialog.h
Show All 21 Lines | |||||
22 | 22 | | |||
23 | class GrepViewPlugin; | 23 | class GrepViewPlugin; | ||
24 | 24 | | |||
25 | class GrepDialog : public QDialog, private Ui::GrepWidget | 25 | class GrepDialog : public QDialog, private Ui::GrepWidget | ||
26 | { | 26 | { | ||
27 | Q_OBJECT | 27 | Q_OBJECT | ||
28 | 28 | | |||
29 | public: | 29 | public: | ||
30 | explicit GrepDialog( GrepViewPlugin * plugin, QWidget *parent=nullptr ); | 30 | explicit GrepDialog(GrepViewPlugin *plugin, QWidget *parent = nullptr, bool show = true); | ||
31 | ~GrepDialog() override; | 31 | ~GrepDialog() override; | ||
32 | 32 | | |||
33 | void setSettings(const GrepJobSettings &settings); | 33 | void setSettings(const GrepJobSettings &settings); | ||
34 | GrepJobSettings settings() const; | 34 | GrepJobSettings settings() const; | ||
35 | ///Rerun all grep jobs from a list of settings, called by GrepOutputView | ||||
36 | void historySearch(QList<GrepJobSettings> &settingsHistory); | ||||
35 | 37 | | |||
36 | public Q_SLOTS: | 38 | public Q_SLOTS: | ||
39 | ///Start a new search | ||||
37 | void startSearch(); | 40 | void startSearch(); | ||
38 | 41 | | |||
39 | ///Sets directory(ies)/files to search in. Also it can be semicolon separated list of directories/files or one of special strings: allOpenFilesString, allOpenProjectsString | 42 | ///Sets directory(ies)/files to search in. Also it can be semicolon separated list of directories/files or one of special strings: allOpenFilesString, allOpenProjectsString | ||
40 | void setSearchLocations(const QString &dir); | 43 | void setSearchLocations(const QString &dir); | ||
41 | 44 | | |||
42 | private Q_SLOTS: | 45 | private Q_SLOTS: | ||
43 | void templateTypeComboActivated(int); | 46 | void templateTypeComboActivated(int); | ||
44 | void patternComboEditTextChanged( const QString& ); | 47 | void patternComboEditTextChanged(const QString&); | ||
45 | void directoryChanged(const QString &dir); | | |||
46 | QMenu* createSyncButtonMenu(); | 48 | QMenu* createSyncButtonMenu(); | ||
47 | void addUrlToMenu(QMenu* ret, const QUrl& url); | 49 | void addUrlToMenu(QMenu* ret, const QUrl& url); | ||
48 | void addStringToMenu(QMenu* ret, const QString& string); | 50 | void addStringToMenu(QMenu* ret, const QString& string); | ||
49 | void synchronizeDirActionTriggered(bool); | 51 | void synchronizeDirActionTriggered(bool); | ||
50 | 52 | | |||
53 | ///Check if all projects have been loaded | ||||
54 | bool checkProjectsOpened(); | ||||
55 | ///Call the next element in m_jobs_history or close the dialog if all jobs are done | ||||
56 | void nextHistory(); | ||||
57 | | ||||
51 | ///Opens the dialog to select a directory to search in, and inserts it into Location(s) field. | 58 | ///Opens the dialog to select a directory to search in, and inserts it into Location(s) field. | ||
52 | void selectDirectoryDialog(); | 59 | void selectDirectoryDialog(); | ||
53 | 60 | | |||
54 | protected: | 61 | protected: | ||
62 | ///Prevent showing the dialog if m_show is false | ||||
63 | void setVisible(bool visible) override; | ||||
55 | void closeEvent(QCloseEvent* closeEvent) override; | 64 | void closeEvent(QCloseEvent* closeEvent) override; | ||
56 | 65 | | |||
57 | private: | 66 | private: | ||
58 | // Returns the chosen directories or files (only the top directories, not subfiles) | 67 | ///Returns whether the given url is a subfile/subdirectory of one of the chosen directories/files | ||
59 | QList< QUrl > getDirectoryChoice() const; | 68 | /// | ||
60 | // Returns whether the given url is a subfile/subdirectory of one of the chosen directories/files | 69 | ///This is slow, so don't call it too often | ||
61 | // This is slow, so don't call it too often | | |||
62 | bool isPartOfChoice(QUrl url) const; | 70 | bool isPartOfChoice(QUrl url) const; | ||
63 | // Checks what a user has entered into the dialog and saves the data in m_settings | 71 | ///Checks what a user has entered into the dialog and saves the data in m_settings | ||
64 | void updateSettings(); | 72 | void updateSettings(); | ||
65 | 73 | | |||
66 | GrepViewPlugin * m_plugin; | 74 | GrepViewPlugin * m_plugin; | ||
75 | ///Allow to show a dialog | ||||
76 | const bool m_show; | ||||
77 | ///Current setting | ||||
67 | GrepJobSettings m_settings; | 78 | GrepJobSettings m_settings; | ||
79 | ///List of remaining grep job settings to be done | ||||
80 | QList<GrepJobSettings> m_historyJobSettings; | ||||
68 | }; | 81 | }; | ||
69 | 82 | | |||
70 | 83 | | |||
71 | #endif | 84 | #endif | ||
72 | 85 | |