GNU Octave  6.2.0
A high-level interpreted language, primarily intended for numerical computations, mostly compatible with Matlab
find-dialog.h
Go to the documentation of this file.
1 // Find dialog derived from an example from Qt Toolkit (license below (**))
2 
3 ////////////////////////////////////////////////////////////////////////
4 //
5 // Copyright (C) 2009-2021 The Octave Project Developers
6 //
7 // See the file COPYRIGHT.md in the top-level directory of this
8 // or <https://octave.org/copyright/>.
9 //
10 // All rights reserved.
11 // Contact: Nokia Corporation (qt-info@nokia.com)
12 //
13 // This file is part of Octave.
14 //
15 // Octave is free software: you can redistribute it and/or modify it
16 // under the terms of the GNU General Public License as published by
17 // the Free Software Foundation, either version 3 of the License, or
18 // (at your option) any later version.
19 //
20 // Octave is distributed in the hope that it will be useful, but
21 // WITHOUT ANY WARRANTY; without even the implied warranty of
22 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 // GNU General Public License for more details.
24 //
25 // You should have received a copy of the GNU General Public License
26 // along with Octave; see the file COPYING. If not, see
27 // <https://www.gnu.org/licenses/>.
28 //
29 // ** This file is part of the examples of the Qt Toolkit.
30 // **
31 // ** $QT_BEGIN_LICENSE:LGPL$
32 // ** Commercial Usage
33 // ** Licensees holding valid Qt Commercial licenses may use this file in
34 // ** accordance with the Qt Commercial License Agreement provided with the
35 // ** Software or, alternatively, in accordance with the terms contained in
36 // ** a written agreement between you and Nokia.
37 // **
38 // ** GNU Lesser General Public License Usage
39 // ** Alternatively, this file may be used under the terms of the GNU Lesser
40 // ** General Public License version 2.1 as published by the Free Software
41 // ** Foundation and appearing in the file LICENSE.LGPL included in the
42 // ** packaging of this file. Please review the following information to
43 // ** ensure the GNU Lesser General Public License version 2.1 requirements
44 // ** will be met: https://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
45 // **
46 // ** In addition, as a special exception, Nokia gives you certain additional
47 // ** rights. These rights are described in the Nokia Qt LGPL Exception
48 // ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
49 // **
50 // ** GNU General Public License Usage
51 // ** Alternatively, this file may be used under the terms of the GNU
52 // ** General Public License version 3.0 as published by the Free Software
53 // ** Foundation and appearing in the file LICENSE.GPL included in the
54 // ** packaging of this file. Please review the following information to
55 // ** ensure the GNU General Public License version 3.0 requirements will be
56 // ** met: https://www.gnu.org/copyleft/gpl.html.
57 // **
58 // ** If you have questions regarding the use of this file, please contact
59 // ** Nokia at qt-info@nokia.com.
60 // ** $QT_END_LICENSE$
61 //
62 ////////////////////////////////////////////////////////////////////////
63 
64 #if ! defined (octave_find_dialog_h)
65 #define octave_find_dialog_h 1
66 
67 #include <QDialog>
68 #include <QComboBox>
69 
70 #include "octave-qscintilla.h"
71 #include "octave-dock-widget.h"
72 
73 class QCheckBox;
74 class QDialogButtonBox;
75 class QGroupBox;
76 class QLabel;
77 class QLineEdit;
78 class QPushButton;
79 
80 namespace octave
81 {
82  class base_qobject;
83  class file_editor;
84 
85  class find_dialog : public QDialog
86  {
87  Q_OBJECT
88 
89  public:
90 
92 
93  //! Set dialog visible or not and storing the new visibility state
94  void set_visible (bool visible);
95 
96  //! Init the search text with the selected text in the editor tab
97  void init_search_text (void);
98 
99  //! Restore position and the search options from the given settings
100  //! where def_pos is the default position suitable for the current
101  //! editor position
102  void restore_settings (QPoint def_pos);
103 
104  public slots:
105 
106  void find_next (void);
107  void find_prev (void);
108 
109  //! Slot for updating the edit area when the active tab has changed
111 
112  private slots:
113 
114  void handle_sel_search_changed (int);
115  void handle_selection_changed (bool has_selected);
116 
118 
119  void find (bool forward = true);
120  void replace (void);
121  void replace_all (void);
122 
123  private:
124 
126 
127  //! Save position and the search options in the given settings
128  void save_settings ();
129 
130  //! Reimplemented slot: close instead of hiding
131  void reject ();
132 
133  //! Reimplemented close event
134  void closeEvent (QCloseEvent* e);
135 
136  //! Update mru lists with new entry
137  void mru_update (QComboBox *mru);
138 
139  void no_matches_message (void);
140  void do_replace (void);
141 
142  void handle_search_text_changed (void);
143  void handle_replace_text_changed (void);
144 
146 
147  QLabel *_search_label;
148  QComboBox *_search_line_edit;
149  QLabel *_replace_label;
150  QComboBox *_replace_line_edit;
151  QCheckBox *_case_check_box;
153  QCheckBox *_wrap_check_box;
155  QCheckBox *_regex_check_box;
158  QDialogButtonBox *_button_box;
167  int _rep_all;
169 
170  bool m_in_sel;
173 
175 
176  const int m_mru_length = 10;
177  };
178 }
179 
180 #endif
Base class for Octave interfaces that use Qt.
QDialogButtonBox * _button_box
Definition: find-dialog.h:158
QCheckBox * _wrap_check_box
Definition: find-dialog.h:153
QCheckBox * _regex_check_box
Definition: find-dialog.h:155
QPushButton * _replace_button
Definition: find-dialog.h:161
QCheckBox * _backward_check_box
Definition: find-dialog.h:157
QComboBox * _search_line_edit
Definition: find-dialog.h:148
find_dialog(base_qobject &oct_qobj, octave_dock_widget *ed, QWidget *p)
Definition: find-dialog.cc:91
void handle_selection_changed(bool has_selected)
Definition: find-dialog.cc:384
void reject()
Reimplemented slot: close instead of hiding.
Definition: find-dialog.cc:665
void handle_replace_text_changed(void)
Definition: find-dialog.cc:342
base_qobject & m_octave_qobj
Definition: find-dialog.h:125
QCheckBox * _case_check_box
Definition: find-dialog.h:151
void save_settings()
Save position and the search options in the given settings.
Definition: find-dialog.cc:220
QPushButton * _replace_all_button
Definition: find-dialog.h:162
void set_visible(bool visible)
Set dialog visible or not and storing the new visibility state.
Definition: find-dialog.cc:678
void init_search_text(void)
Init the search text with the selected text in the editor tab.
Definition: find-dialog.cc:394
void handle_backward_search_changed(int)
Definition: find-dialog.cc:320
void do_replace(void)
Definition: find-dialog.cc:590
QWidget * _extension
Definition: find-dialog.h:164
void find(bool forward=true)
Definition: find-dialog.cc:437
QComboBox * _replace_line_edit
Definition: find-dialog.h:150
QLabel * _search_label
Definition: find-dialog.h:147
octave_qscintilla * _edit_area
Definition: find-dialog.h:165
QPushButton * _find_next_button
Definition: find-dialog.h:159
QCheckBox * _search_selection_check_box
Definition: find-dialog.h:156
void mru_update(QComboBox *mru)
Update mru lists with new entry.
Definition: find-dialog.cc:352
void find_prev(void)
Definition: find-dialog.cc:432
QLabel * _replace_label
Definition: find-dialog.h:149
QCheckBox * _whole_words_check_box
Definition: find-dialog.h:154
void update_edit_area(octave_qscintilla *)
Slot for updating the edit area when the active tab has changed.
Definition: find-dialog.cc:210
void handle_search_text_changed(void)
Definition: find-dialog.cc:329
void find_next(void)
Definition: find-dialog.cc:427
QCheckBox * _from_start_check_box
Definition: find-dialog.h:152
void handle_sel_search_changed(int)
Definition: find-dialog.cc:378
octave_dock_widget * m_editor
Definition: find-dialog.h:145
const int m_mru_length
Definition: find-dialog.h:176
QPushButton * _more_button
Definition: find-dialog.h:163
QPushButton * _find_prev_button
Definition: find-dialog.h:160
void closeEvent(QCloseEvent *e)
Reimplemented close event.
Definition: find-dialog.cc:670
void replace_all(void)
Definition: find-dialog.cc:623
void no_matches_message(void)
Definition: find-dialog.cc:658
void restore_settings(QPoint def_pos)
Restore position and the search options from the given settings where def_pos is the default position...
Definition: find-dialog.cc:268