Mercurial > octave
annotate libgui/src/find-files-dialog.cc @ 22022:278fc29b69ca
maint: Eliminate unnecessary double newline blocks (only whitespace changes).
* Figure.cc, annotation-dialog.cc, dialog.cc, dialog.h, files-dock-widget.cc,
find-files-dialog.cc, find-files-model.cc, file-editor-tab.cc, file-editor.cc,
find-dialog.cc, octave-qscintilla.cc, octave-txt-lexer.cc, main-window.cc,
main-window.h, octave-cmd.cc, octave-cmd.h, octave-dock-widget.cc,
octave-qt-link.cc, parser.h, webinfo.cc, settings-dialog.cc,
shortcut-manager.cc, shortcut-manager.h, welcome-wizard.cc, workspace-model.cc,
__ilu__.cc, __lin_interpn__.cc, besselj.cc, bsxfun.cc, cellfun.cc, conv2.cc,
data.cc, debug.cc, debug.h, dynamic-ld.cc, fft2.cc, file-io.cc,
ft-text-renderer.cc, gl-render.cc, gl2ps-print.cc, graphics.cc, graphics.in.h,
help.cc, jit-typeinfo.cc, jit-typeinfo.h, kron.cc, ls-ascii-helper.cc,
ls-hdf5.cc, ls-hdf5.h, ls-mat5.cc, max.cc, oct-map.cc, oct-map.h,
oct-stream.cc, octave-link.h, pr-output.cc, pt-jit.cc, qz.cc, sparse-xdiv.cc,
sparse-xpow.cc, strfind.cc, strfns.cc, symtab.h, toplev.cc, toplev.h,
typecast.cc, utils.cc, variables.cc, xdiv.h, xpow.cc, xpow.h, zfstream.cc,
__eigs__.cc, __init_fltk__.cc, audioread.cc, ccolamd.cc, chol.cc, qr.cc,
ov-base-diag.cc, ov-base-int.cc, ov-base-sparse.cc, ov-base.cc, ov-base.h,
ov-bool-mat.cc, ov-bool-mat.h, ov-bool-sparse.cc, ov-bool-sparse.h, ov-bool.cc,
ov-bool.h, ov-builtin.h, ov-cell.cc, ov-cell.h, ov-class.cc, ov-class.h,
ov-classdef.cc, ov-complex.cc, ov-complex.h, ov-cs-list.cc, ov-cs-list.h,
ov-cx-diag.cc, ov-cx-diag.h, ov-cx-mat.cc, ov-cx-mat.h, ov-cx-sparse.cc,
ov-cx-sparse.h, ov-dld-fcn.cc, ov-dld-fcn.h, ov-fcn-handle.h, ov-fcn-inline.h,
ov-float.cc, ov-float.h, ov-flt-complex.cc, ov-flt-complex.h,
ov-flt-cx-diag.cc, ov-flt-cx-diag.h, ov-flt-cx-mat.cc, ov-flt-cx-mat.h,
ov-flt-re-diag.cc, ov-flt-re-diag.h, ov-flt-re-mat.cc, ov-int16.cc,
ov-int32.cc, ov-int64.cc, ov-int8.cc, ov-intx.h, ov-lazy-idx.cc, ov-lazy-idx.h,
ov-mex-fcn.h, ov-null-mat.h, ov-perm.cc, ov-perm.h, ov-range.cc, ov-range.h,
ov-re-diag.cc, ov-re-diag.h, ov-re-mat.cc, ov-re-sparse.cc, ov-re-sparse.h,
ov-scalar.cc, ov-scalar.h, ov-str-mat.h, ov-struct.cc, ov-struct.h,
ov-type-conv.h, ov-uint16.cc, ov-uint32.cc, ov-uint64.cc, ov-uint8.cc,
ov-usr-fcn.cc, ov-usr-fcn.h, ov.h, op-cm-m.cc, op-fcm-fm.cc, op-fm-fm.cc,
op-int.h, op-m-m.cc, op-pm-template.cc, pt-binop.h, pt-select.cc, pt-stmt.cc,
pt-unop.h, Array-util.cc, Array.cc, Array.h, CColVector.cc, CMatrix.cc,
CMatrix.h, CSparse.cc, MArray.cc, MSparse.cc, MatrixType.cc, PermMatrix.cc,
Range.cc, Sparse-C.cc, Sparse.cc, dMatrix.cc, dim-vector.h, fCColVector.cc,
fCMatrix.cc, fMatrix.cc, fMatrix.h, idx-vector.cc, idx-vector.h, blaswrap.c,
f77-fcn.h, DASPK.cc, eigs-base.cc, hess.cc, lo-specfun.cc, oct-fftw.cc,
oct-norm.cc, oct-rand.cc, oct-rand.h, qr.cc, qrp.cc, randmtzig.cc,
randpoisson.cc, sparse-lu.cc, sparse-lu.h, sparse-qr.cc, Sparse-op-defs.h,
mx-inlines.cc, oct-env.h, cmd-edit.cc, f2c-main.c, lo-array-errwarn.cc,
lo-array-errwarn.h, lo-array-gripes.cc, lo-array-gripes.h, lo-ieee.h,
lo-regexp.cc, oct-binmap.h, oct-inttypes.cc, oct-inttypes.h, oct-sort.cc,
oct-sort.h, mkoctfile.in.cc:
maint: Eliminate unnecessary double newline blocks (only whitespace changes).
author | Rik <rik@octave.org> |
---|---|
date | Fri, 01 Jul 2016 19:48:35 -0700 |
parents | aba2e6293dd8 |
children | 6e9f5408c0db |
rev | line source |
---|---|
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
1 /* |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
2 |
19697
4197fc428c7d
maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents:
18345
diff
changeset
|
3 Copyright (C) 2013-2015 John Donoghue |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
4 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
5 This file is part of Octave. |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
6 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
7 Octave is free software; you can redistribute it and/or modify it |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
8 under the terms of the GNU General Public License as published by the |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
9 Free Software Foundation; either version 3 of the License, or (at your |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
10 option) any later version. |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
11 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
12 Octave is distributed in the hope that it will be useful, but WITHOUT |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
15 for more details. |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
16 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
17 You should have received a copy of the GNU General Public License |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
18 along with Octave; see the file COPYING. If not, see |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
19 <http://www.gnu.org/licenses/>. |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
20 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
21 */ |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
22 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21662
diff
changeset
|
23 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21203
diff
changeset
|
24 # include "config.h" |
17921
2a4acd6548c6
include config.h in more files in libgui
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
25 #endif |
2a4acd6548c6
include config.h in more files in libgui
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
26 |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
27 #include <QPushButton> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
28 #include <QDialogButtonBox> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
29 #include <QGridLayout> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
30 #include <QLabel> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
31 #include <QLineEdit> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
32 #include <QComboBox> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
33 #include <QCheckBox> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
34 #include <QHeaderView> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
35 #include <QTableView> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
36 #include <QFileDialog> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
37 #include <QStatusBar> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
38 #include <QIcon> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
39 #include <QFileInfo> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
40 #include <QTimer> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
41 #include <QDirIterator> |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
42 #include <QTextStream> |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
43 #include <QGroupBox> |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
44 |
17921
2a4acd6548c6
include config.h in more files in libgui
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
45 #include "find-files-dialog.h" |
2a4acd6548c6
include config.h in more files in libgui
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
46 #include "find-files-model.h" |
2a4acd6548c6
include config.h in more files in libgui
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
47 #include "resource-manager.h" |
2a4acd6548c6
include config.h in more files in libgui
John W. Eaton <jwe@octave.org>
parents:
17790
diff
changeset
|
48 |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
49 find_files_dialog::find_files_dialog (QWidget * p) |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
50 : QDialog (p) |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
51 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
52 setWindowTitle (tr ("Find Files")); |
19899 | 53 setWindowIcon (resource_manager::icon ("edit-find")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
54 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
55 _dir_iterator = 0; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
56 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
57 _timer = new QTimer (this); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
58 connect (_timer, SIGNAL (timeout ()), this, SLOT (look_for_files ())); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
59 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
60 QSettings *settings = resource_manager::get_settings (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
61 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
62 QLabel * file_name_label = new QLabel (tr ("Named:")); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
63 _file_name_edit = new QLineEdit; |
18345
dfc6ef6ac455
some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents:
18283
diff
changeset
|
64 _file_name_edit->setToolTip (tr ("Enter the filename search expression")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
65 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
66 _file_name_edit->setText (settings->value ("findfiles/file_name", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
67 "*").toString ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
68 file_name_label->setBuddy (_file_name_edit); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
69 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
70 QLabel * start_dir_label = new QLabel (tr ("Start in:")); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
71 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
72 _start_dir_edit = new QLineEdit; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
73 _start_dir_edit->setText (settings->value ("findfiles/start_dir", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
74 QDir::currentPath ()).toString ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
75 _start_dir_edit->setToolTip (tr ("Enter the start directory")); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
76 start_dir_label->setBuddy (_start_dir_edit); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
77 |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
78 _browse_button = new QPushButton (tr ("Browse...")); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
79 _browse_button->setToolTip (tr ("Browse for start directory")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
80 connect (_browse_button, SIGNAL (clicked ()), this, SLOT (browse_folders ())); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
81 |
18345
dfc6ef6ac455
some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents:
18283
diff
changeset
|
82 _recurse_dirs_check = new QCheckBox (tr ("Search subdirectories")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
83 _recurse_dirs_check->setChecked (settings->value ("findfiles/recurse_dirs", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
84 false).toBool ()); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
85 _recurse_dirs_check->setToolTip ( |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
86 tr ("Search recursively through directories for matching files")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
87 |
18345
dfc6ef6ac455
some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents:
18283
diff
changeset
|
88 _include_dirs_check = new QCheckBox (tr ("Include directory names")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
89 _include_dirs_check->setChecked (settings->value ("findfiles/include_dirs", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
90 false).toBool ()); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
91 _include_dirs_check->setToolTip ( |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
92 tr ("Include matching directories in search results")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
93 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
94 _name_case_check = new QCheckBox (tr ("Name case insensitive")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
95 _name_case_check->setChecked (settings->value ("findfiles/name_case", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
96 false).toBool ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
97 _name_case_check->setToolTip (tr ("Set matching name is case insensitive")); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
98 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
99 _contains_text_check = new QCheckBox (tr ("Contains text:")); |
18345
dfc6ef6ac455
some text improvements in the gui (#bug 41201)
Torsten <ttl@justmail.de>
parents:
18283
diff
changeset
|
100 _contains_text_check->setToolTip (tr ("Enter the file content search expression")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
101 _contains_text_check->setChecked (settings->value ("findfiles/check_text", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
102 false).toBool ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
103 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
104 _contains_text_edit = new QLineEdit (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
105 _contains_text_edit->setToolTip (tr ("Text to match")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
106 _contains_text_edit->setText (settings->value ("findfiles/contains_text", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
107 "").toString ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
108 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
109 _content_case_check = new QCheckBox (tr ("Text case insensitive")); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
110 _content_case_check->setChecked (settings->value ("findfiles/content_case", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
111 false).toBool ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
112 _content_case_check->setToolTip (tr ("Set text content is case insensitive")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
113 |
16997
90d50e56a06a
Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents:
16823
diff
changeset
|
114 find_files_model * model = new find_files_model (this); |
90d50e56a06a
Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents:
16823
diff
changeset
|
115 |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
116 _file_list = new QTableView; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
117 _file_list->setWordWrap (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
118 _file_list->setModel (model); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
119 _file_list->setShowGrid (false); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
120 _file_list->setSelectionBehavior (QAbstractItemView::SelectRows); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
121 _file_list->setSelectionMode (QAbstractItemView::SingleSelection); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
122 _file_list->setAlternatingRowColors (true); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
123 _file_list->setToolTip (tr ("Search results")); |
16997
90d50e56a06a
Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents:
16823
diff
changeset
|
124 _file_list->setSortingEnabled (true); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
125 _file_list->horizontalHeader ()->restoreState ( |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
126 settings->value ("findfiles/column_state").toByteArray ()); |
16997
90d50e56a06a
Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents:
16823
diff
changeset
|
127 _file_list->horizontalHeader ()->setSortIndicatorShown (true); |
90d50e56a06a
Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents:
16823
diff
changeset
|
128 _file_list->horizontalHeader ()->setClickable (true); |
16823
ffc246701137
make the result list in find files dialog always fill its layout
Torsten <ttl@justmail.de>
parents:
16544
diff
changeset
|
129 _file_list->horizontalHeader ()->setStretchLastSection (true); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
130 _file_list->sortByColumn ( |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
131 settings->value ("findfiles/sort_files_by_column",0).toInt (), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
132 static_cast<Qt::SortOrder> |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
133 (settings->value ("findfiles/sort_files_by_order", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
134 Qt::AscendingOrder).toUInt ())); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
135 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
136 connect (_file_list, SIGNAL (doubleClicked (const QModelIndex&)), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
137 this, SLOT (item_double_clicked (const QModelIndex &))); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
138 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
139 _status_bar = new QStatusBar; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
140 _status_bar->showMessage (tr ("Idle.")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
141 |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
142 _find_button = new QPushButton (tr ("Find")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
143 _find_button->setToolTip (tr ("Start search for matching files")); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
144 connect (_find_button, SIGNAL (clicked ()), this, SLOT (start_find ())); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
145 |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
146 _stop_button = new QPushButton (tr ("Stop")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
147 _stop_button->setToolTip (tr ("Stop searching")); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
148 _stop_button->setEnabled (false); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
149 connect (_stop_button, SIGNAL (clicked ()), this, SLOT (stop_find ())); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
150 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
151 // layout everything |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
152 QDialogButtonBox * button_box = new QDialogButtonBox (Qt::Vertical); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
153 button_box->addButton (_find_button, QDialogButtonBox::ActionRole); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
154 button_box->addButton (_stop_button, QDialogButtonBox::ActionRole); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
155 |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
156 // add dialog close button |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
157 _close_button = button_box->addButton (QDialogButtonBox::Close); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
158 connect (button_box, SIGNAL (rejected ()), |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
159 this, SLOT (close ())); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
160 |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
161 // name options |
20713
2469d78a1d8b
Consistently use 'filename' rather than 'file name' throughout code base.
Rik <rik@octave.org>
parents:
19899
diff
changeset
|
162 QGroupBox * name_group = new QGroupBox (tr ("Filename/location")); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
163 QGridLayout * name_layout = new QGridLayout; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
164 name_group->setLayout (name_layout); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
165 |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
166 name_layout->addWidget (file_name_label,1,1, 1,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
167 name_layout->addWidget (_file_name_edit,1,2, 1,-1); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
168 |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
169 name_layout->addWidget (start_dir_label,2,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
170 name_layout->addWidget (_start_dir_edit,2,2,1,3); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
171 name_layout->addWidget (_browse_button,2,5); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
172 name_layout->setColumnStretch (2,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
173 |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
174 name_layout->addWidget (_recurse_dirs_check,3,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
175 name_layout->addWidget (_include_dirs_check,3,2); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
176 name_layout->addWidget (_name_case_check,3,3); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
177 |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
178 // content options |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
179 QGroupBox * content_group = new QGroupBox (tr ("File contents")); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
180 QGridLayout * content_layout = new QGridLayout; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
181 content_group->setLayout (content_layout); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
182 content_layout->addWidget (_contains_text_check,4,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
183 content_layout->addWidget (_contains_text_edit,4,2,1,3); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
184 content_layout->setColumnStretch (2,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
185 content_layout->addWidget (_content_case_check,5,1); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
186 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
187 QGridLayout *main_layout = new QGridLayout; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
188 main_layout->setSizeConstraint (QLayout::SetFixedSize); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
189 main_layout->addWidget (name_group, 0, 0); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
190 main_layout->addWidget (content_group, 1, 0); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
191 main_layout->addWidget (button_box, 0, 1,3,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
192 main_layout->addWidget (_file_list,2,0); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
193 main_layout->setRowStretch (2,1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
194 main_layout->addWidget (_status_bar,3,0,1,-1); |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
195 |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
196 setLayout (main_layout); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
197 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
198 connect (this, SIGNAL (finished (int)), this, SLOT (handle_done (int))); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
199 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
200 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
201 find_files_dialog::~find_files_dialog () |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
202 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
203 QSettings *settings = resource_manager::get_settings (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
204 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
205 int sort_column = _file_list->horizontalHeader ()->sortIndicatorSection (); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
206 Qt::SortOrder sort_order |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
207 = _file_list->horizontalHeader ()->sortIndicatorOrder (); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
208 settings->setValue ("findfiles/sort_files_by_column", sort_column); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
209 settings->setValue ("findfiles/sort_files_by_order", sort_order); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
210 settings->setValue ("findfiles/column_state", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
211 _file_list->horizontalHeader ()->saveState ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
212 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
213 settings->setValue ("findfiles/file_name", _file_name_edit->text ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
214 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
215 settings->setValue ("findfiles/start_dir", _start_dir_edit->text ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
216 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
217 settings->setValue ("findfiles/recurse_dirs", _recurse_dirs_check->text ()); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
218 settings->setValue ("findfiles/include_dirs", _include_dirs_check->text ()); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
219 settings->setValue ("findfiles/name_case", _name_case_check->text ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
220 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
221 settings->setValue ("findfiles/contains_text", _contains_text_edit->text ()); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
222 settings->setValue ("findfiles/check_text", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
223 _contains_text_check->isChecked ()); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
224 settings->setValue ("findfiles/content_case", |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
225 _content_case_check->isChecked ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
226 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
227 settings->sync (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
228 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
229 if (_dir_iterator) |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
230 delete _dir_iterator; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
231 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
232 |
16823
ffc246701137
make the result list in find files dialog always fill its layout
Torsten <ttl@justmail.de>
parents:
16544
diff
changeset
|
233 void find_files_dialog::handle_done (int) |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
234 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
235 // make sure we stopped processing |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
236 stop_find (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
237 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
238 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
239 void find_files_dialog::set_search_dir (const QString &dir) |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
240 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
241 stop_find (); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
242 _start_dir_edit->setText (dir); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
243 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
244 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
245 void |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
246 find_files_dialog::start_find () |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
247 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
248 stop_find (); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
249 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
250 find_files_model *m = static_cast<find_files_model *> (_file_list->model ()); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
251 m->clear (); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
252 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
253 QDirIterator::IteratorFlags flags = QDirIterator::NoIteratorFlags; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
254 if (_recurse_dirs_check->isChecked ()) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
255 flags |= QDirIterator::Subdirectories; |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
256 |
21662
5b9868c2e212
maint: Octave coding convention cleanups.
Rik <rik@octave.org>
parents:
21568
diff
changeset
|
257 QDir::Filters filters = QDir::Dirs | QDir::NoDotAndDotDot | QDir::Files; |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
258 if (! _name_case_check->isChecked ()) |
21568
3d60ed163b70
maint: Eliminate bad spacing around '='.
Rik <rik@octave.org>
parents:
21301
diff
changeset
|
259 filters |= QDir::CaseSensitive; |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
260 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
261 QStringList nameFilters; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
262 nameFilters.append (_file_name_edit->text ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
263 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
264 if (_dir_iterator) delete _dir_iterator; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
265 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
266 _dir_iterator = new QDirIterator (_start_dir_edit->text (), nameFilters, |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
267 filters, flags); |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
268 |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
269 // enable/disable widgets |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
270 _find_button->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
271 _stop_button->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
272 _close_button->setEnabled (false); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
273 _browse_button->setEnabled (false); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
274 _start_dir_edit->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
275 _file_name_edit->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
276 _recurse_dirs_check->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
277 _include_dirs_check->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
278 _name_case_check->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
279 _contains_text_check->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
280 _content_case_check->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
281 _contains_text_edit->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
282 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
283 _status_bar->showMessage (tr ("Searching...")); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
284 _timer->start (0); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
285 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
286 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
287 void |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
288 find_files_dialog::stop_find () |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
289 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
290 _timer->stop (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
291 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
292 _find_button->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
293 _stop_button->setEnabled (false); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
294 _close_button->setEnabled (true); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
295 _browse_button->setEnabled (true); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
296 _start_dir_edit->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
297 _file_name_edit->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
298 _recurse_dirs_check->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
299 _include_dirs_check->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
300 _name_case_check->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
301 _contains_text_check->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
302 _content_case_check->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
303 _contains_text_edit->setEnabled (true); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
304 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
305 find_files_model *m = static_cast<find_files_model *> (_file_list->model ()); |
18283
12291fb903de
fix missing translations (bug #41200)
Torsten <ttl@justmail.de>
parents:
17921
diff
changeset
|
306 QString res_str = QString (tr("%1 match(es)")).arg (m->rowCount ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
307 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
308 _status_bar->showMessage (res_str); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
309 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
310 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
311 void |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
312 find_files_dialog::browse_folders () |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
313 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
314 QString dir = |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
315 QFileDialog::getExistingDirectory (this, tr ("Set search directory"), |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
316 _start_dir_edit->text ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
317 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
318 if (! dir.isEmpty ()) |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
319 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
320 _start_dir_edit->setText (dir); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
321 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
322 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
323 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
324 void |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
325 find_files_dialog::item_double_clicked (const QModelIndex &idx) |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
326 { |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
327 find_files_model *m = static_cast<find_files_model *> (_file_list->model ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
328 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
329 QFileInfo info = m->fileInfo (idx); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
330 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
331 if (idx.column () == 1) |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
332 { |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
333 // clicked in directory part |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
334 emit dir_selected (info.absolutePath ()); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
335 } |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
336 else |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
337 { |
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
338 // clicked in filename part |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
339 if (info.isDir ()) |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
340 emit dir_selected (info.absoluteFilePath ()); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
341 else |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
342 emit file_selected (info.absoluteFilePath ()); |
16544
ced9b101723c
Updates to find-file-dialog usage
John Donoghue <john.donoghue@ieee.org>
parents:
16519
diff
changeset
|
343 } |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
344 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
345 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
346 void |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
347 find_files_dialog::look_for_files () |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
348 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
349 if (_dir_iterator && _dir_iterator->hasNext ()) |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
350 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
351 QFileInfo info (_dir_iterator->next ()); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
352 |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
353 find_files_model *m |
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
354 = static_cast<find_files_model *> (_file_list->model ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
355 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
356 if (is_match (info)) |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
357 m->addFile (info); |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
358 } |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
359 else |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
360 { |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
361 stop_find (); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
362 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
363 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
364 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
365 bool find_files_dialog::is_match (const QFileInfo &info) |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
366 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
367 bool match = true; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
368 if (info.isDir ()) |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
369 { |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
370 if (! _include_dirs_check->isChecked ()) match = false; |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
371 if (_contains_text_check->isChecked ()) match = false; |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
372 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
373 else |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
374 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
375 // a file |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
376 if (_contains_text_check->isChecked ()) |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
377 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
378 match = false; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
379 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
380 QFile file (info.absoluteFilePath ()); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
381 if (file.open (QIODevice::ReadOnly)) |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
382 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
383 QTextStream stream (&file); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
384 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
385 QString line; |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
386 QString match_str = _contains_text_edit->text (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
387 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
388 Qt::CaseSensitivity cs = _content_case_check->isChecked () ? |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
389 Qt::CaseInsensitive : Qt::CaseSensitive; |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
390 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
391 do |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
392 { |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
393 line = stream.readLine (); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
394 match = line.contains (match_str, cs); |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
395 } |
20955
77f5591878bf
maint: Use '! expr' rather than '!expr' to conform to coding guidelines.
Rik <rik@octave.org>
parents:
20713
diff
changeset
|
396 while (! line.isNull () && match == false); |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
397 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
398 |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
399 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
400 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
401 |
17790
86c6ae5f969e
Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents:
16997
diff
changeset
|
402 return match; |
16519
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
403 } |
3e8fd0c479b4
Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff
changeset
|
404 |