annotate libgui/src/find-files-model.h @ 20605:734d446560a8

possibility to hide filters in history and workspace view (bug#45428) * history_dock_widget.cc(construct): use settings file for show/hide the filter; (~history_dock_widget): save current filter state to settings file; (ctxMenu): add menu entry for showing/hiding the filter; (handle_contextmenu_filter): slot for the new menu entry * history-dock-widget.h: new slot for new menu entry, new class variables for filter and show/hide-state * workspace-view.cc(workspace_view): use settings file for show/hide the filter; (~workspace_view): save current filter state to settings file; (contextmenu_requested): add menu entry for showing/hiding the filter; (handle_contextmenu_filter): slot for the new menu entry * workspace-view.h: new slot for new menu entry, new class variables for filter and show/hide-state
author Torsten <ttl@justmail.de>
date Wed, 07 Oct 2015 21:01:25 +0200
parents 4197fc428c7d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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
19731
4197fc428c7d maint: Update copyright notices for 2015.
John W. Eaton <jwe@octave.org>
parents: 17822
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 */
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17790
diff changeset
22 #if !defined (octave_find_files_model_h)
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17790
diff changeset
23 #define octave_find_files_model_h
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
24
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
25 #include <QAbstractListModel>
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
26 #include <QStringList>
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
27 #include <QList>
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
28 #include <QFileInfo>
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
29 #include <QIcon>
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
30
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
31
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
32 class find_files_model : public QAbstractListModel
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
33 {
16820
f98e1e5b0618 add macro Q_OBJECT to find_files_model in order to make tr () work
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
34 Q_OBJECT
f98e1e5b0618 add macro Q_OBJECT to find_files_model in order to make tr () work
Torsten <ttl@justmail.de>
parents: 16519
diff changeset
35
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
36 public:
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 16997
diff changeset
37 find_files_model (QObject *p=0);
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
38 ~find_files_model ();
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
39
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 16997
diff changeset
40 void clear ();
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
41
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 16997
diff changeset
42 void addFile (const QFileInfo &info);
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
43
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 16997
diff changeset
44 int rowCount (const QModelIndex & p=QModelIndex ()) const;
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
45
17790
86c6ae5f969e Use GNU style coding conventions for code in libgui/
Rik <rik@octave.org>
parents: 16997
diff changeset
46 int columnCount (const QModelIndex & p=QModelIndex ()) const;
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
47
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
48 QVariant data (const QModelIndex& idx, int role) const;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
49
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
50 QVariant headerData (int section, Qt::Orientation orientation,
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
51 int role = Qt::DisplayRole) const;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
52
16997
90d50e56a06a Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents: 16820
diff changeset
53 void sort (int column, Qt::SortOrder order=Qt::AscendingOrder);
90d50e56a06a Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents: 16820
diff changeset
54
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
55 QFileInfo fileInfo (const QModelIndex & p) const;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
56 QIcon fileIcon (const QModelIndex &p) const;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
57 private:
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
58 QList<QFileInfo> _files;
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
59 QStringList _columnNames;
16997
90d50e56a06a Add sortable table headers to find_files_dialog results
John Donoghue <john.donoghue@ieee.org>
parents: 16820
diff changeset
60 int _sortorder;
16519
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
17822
ebb3ef964372 maint: Use common #define syntax "octave_filename_h" in h_files.
Rik <rik@octave.org>
parents: 17790
diff changeset
63 #endif // octave_find_files_model_h
16519
3e8fd0c479b4 Add find files implemtation to main window menu
John Donoghue <john.donoghue@ieee.org>
parents:
diff changeset
64