1 ////////////////////////////////////////////////////////////////////////
2 //
3 // Copyright (C) 2013-2021 The Octave Project Developers
4 //
5 // See the file COPYRIGHT.md in the top-level directory of this
6 // distribution or <https://octave.org/copyright/>.
7 //
8 // This file is part of Octave.
9 //
10 // Octave is free software: you can redistribute it and/or modify it
11 // under the terms of the GNU General Public License as published by
12 // the Free Software Foundation, either version 3 of the License, or
13 // (at your option) any later version.
14 //
15 // Octave is distributed in the hope that it will be useful, but
16 // WITHOUT ANY WARRANTY; without even the implied warranty of
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 // GNU General Public License for more details.
19 //
20 // You should have received a copy of the GNU General Public License
21 // along with Octave; see the file COPYING.  If not, see
22 // <https://www.gnu.org/licenses/>.
23 //
24 ////////////////////////////////////////////////////////////////////////
25 #if ! defined (octave_find_files_dialog_h)
26 #define octave_find_files_dialog_h 1
27 
28 #include <QDialog>
29 #include <QFileInfo>
30 #include <QModelIndex>
31 
32 class QCheckBox;
33 class QDirIterator;
34 class QLineEdit;
35 class QPushButton;
36 class QStatusBar;
37 class QTableView;
38 class QTimer;
39 
40 namespace octave
41 {
42   class base_qobject;
43 
44   class find_files_dialog : public QDialog
45   {
46     Q_OBJECT
47 
48   public:
49 
50     find_files_dialog (QWidget *parent, base_qobject& oct_qobj);
51 
52     virtual ~find_files_dialog (void);
53 
54     void save_settings (void);
55 
56   signals:
57 
58     void file_selected (const QString& fileName);
59     void dir_selected (const QString& fileName);
60 
61   public slots:
62 
63     void set_search_dir (const QString& dir);
64 
65   private slots:
66 
67     void start_find (void);
68     void stop_find (void);
69     void browse_folders (void);
70     void look_for_files (void);
71     void item_double_clicked (const QModelIndex&);
72     void handle_done (int);
73 
74   private:
75 
76     bool is_match (const QFileInfo& info);
77 
78     base_qobject& m_octave_qobj;
79 
80     QLineEdit *m_start_dir_edit;
81     QLineEdit *m_file_name_edit;
82     QPushButton *m_stop_button;
83     QPushButton *m_find_button;
84     QPushButton *m_close_button;
85     QPushButton *m_browse_button;
86     QTableView *m_file_list;
87     QTimer *m_timer;
88     QCheckBox *m_recurse_dirs_check;
89     QCheckBox *m_include_dirs_check;
90     QCheckBox *m_name_case_check;
91     QCheckBox *m_contains_text_check;
92     QCheckBox *m_content_case_check;
93     QLineEdit *m_contains_text_edit;
94     QDirIterator *m_dir_iterator;
95     QStatusBar *m_status_bar;
96   };
97 }
98 
99 #endif
100