Bayeux  3.4.1
Core Foundation library for SuperNEMO
variant_registry_viewer.h
Go to the documentation of this file.
1 /* Author(s) : Francois Mauger <mauger@lpccaen.in2p3.fr>
3  * Creation date : 2014-10-06
4  * Last modified : 2014-10-06
5  *
6  * Copyright (C) 2014 Francois Mauger <mauger@lpccaen.in2p3.fr>
7  *
8  * This program is free software; you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation; either version 3 of the License, or (at
11  * your option) any later version.
12  *
13  * This program is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16  * General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with this program; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor,
21  * Boston, MA 02110-1301, USA.
22  *
23  * Description:
24  *
25  * A viewer/editor widget for configuration variant registry.
26  *
27  */
28 
29 #ifndef DATATOOLS_CONFIGURATION_UI_VARIANT_REGISTRY_VIEWER_H
30 #define DATATOOLS_CONFIGURATION_UI_VARIANT_REGISTRY_VIEWER_H
31 
32 // Standard library:
33 #include <string>
34 
35 // Third party:
36 // - Qt:
37 #include <QWidget>
38 #include <QObject>
39 
40 // This project:
41 #include <datatools/logger.h>
42 
43 // Forward declarations:
44 class QLabel;
45 class QTreeView;
46 class QCheckBox;
47 class QPushButton;
48 class QComboBox;
49 class QModelIndex;
50 
51 namespace datatools {
52 
53  namespace qt {
54 
55  // Forward declaration:
56  class led;
57 
58  }
59 
60  namespace configuration {
61 
62  class variant_registry;
63 
64  namespace ui {
65 
66  // Forward declarations:
67  class variant_registry_tree_model;
68  class parameter_item_delegate;
69 
71  class variant_registry_viewer : public QWidget
72  {
73  Q_OBJECT
74 
75  public:
76 
78  variant_registry_viewer(QWidget * parent_ = 0);
79 
81  virtual ~variant_registry_viewer();
82 
84  void set_registry_tree_model(variant_registry_tree_model &, bool devel_mode_ = false);
85 
87  bool has_registry_tree_model() const;
88 
91 
94 
97 
100 
101  public slots:
102 
104  void slot_update_read_only_cb(bool read_only_);
105 
107  void slot_update_model_read_only_from_check_state(int check_state_);
108 
110  void slot_dump_registry();
111 
113  void slot_dump_model();
114 
116  void slot_update_logging(const QString &);
117 
120 
122  void slot_expand_all();
123 
126 
128  void slot_compute_expand(const QModelIndex & index_);
129 
131  void slot_compute_expand2(const QModelIndex & top_left_index_,
132  const QModelIndex & bottom_right_index_);
133 
135  void slot_collapse_all();
136 
138  void slot_update_leds();
139 
141  void slot_snapshot();
142 
144  void slot_restore();
145 
147  void slot_load_from_file();
148 
150  void slot_store_to_file() const;
151 
152  signals:
153 
155  void sig_model_changed();
156 
159 
161  void sig_read_only_changed(bool);
162 
163  protected:
164 
166  void _construct();
167 
169  void _construct_devel();
170 
171  private:
172 
173  bool _devel_mode_;
174  datatools::logger::priority _logging_;
175  variant_registry_tree_model * _registry_tree_model_;
176  QLabel * _registry_name_title_label_;
177  QLabel * _registry_name_display_label_;
178  QLabel * _accomplished_label_;
179  datatools::qt::led * _accomplished_led_;
180  QCheckBox * _read_only_cb_;
181  QTreeView * _tree_view_;
182  parameter_item_delegate * _value_delegate_;
183  QPushButton * _expand_all_button_;
184  QPushButton * _expand_only_active_button_;
185  QPushButton * _collapse_all_button_;
186  QPushButton * _dump_button_;
187  QLabel * _logging_label_;
188  QComboBox * _logging_combo_;
189 
190  };
191 
192  } // end of namespace ui
193 
194  } // end of namespace configuration
195 
196 } // end of namespace datatools
197 
198 #endif // DATATOOLS_CONFIGURATION_UI_VARIANT_REGISTRY_VIEWER_H
199 
200 // Local Variables: --
201 // mode: c++ --
202 // c-file-style: "gnu" --
203 // tab-width: 2 --
204 // End: --
Registry of configuration variant parameters and associated variants.
Definition: variant_registry.h:53
void set_logging(datatools::logger::priority p_)
Set the logging priority.
priority
Priority levels for logging from most to least critical.
Definition: logger.h:82
void slot_dump_model()
Slot: dump the registry model.
Qt tree model for configuration variant registry.
Definition: variant_registry_tree_model.h:158
void slot_dump_registry()
Slot: dump the registry.
void slot_update_read_only_cb(bool read_only_)
Slot: set the checkbox state from the model read-only flag.
void _construct_devel()
Construct the development part of the GUI.
void sig_read_only_changed(bool)
Signal: emitted when the read-only state has changed.
void slot_update_model_read_only_from_check_state(int check_state_)
Slot: set the model read-only flag from the checkbox state.
const variant_registry_tree_model & get_registry_tree_model() const
Return a reference to the non mutable registry tree model.
A widget to browse/edit a configuration variant registry.
Definition: variant_registry_viewer.h:71
bool has_registry_tree_model() const
Check if a registry tree model is handled.
void slot_store_to_file() const
Slot: store the registry in a file.
void slot_restore()
Slot: load the current status from a buffer.
void slot_compute_expand(const QModelIndex &index_)
Slot: adapt the view.
void slot_load_from_file()
Slot: load the registry from a file.
A LED widget with ON/OFF(/INDETERMINATE) status.
Definition: led.h:59
Item delegate for parameter value.
Definition: parameter_item_delegate.h:160
void slot_update_logging_combo(datatools::logger::priority)
Slot: update the logging priority.
void slot_update_logging(const QString &)
Slot: set the logging priority.
variant_registry_viewer(QWidget *parent_=0)
Default constructor.
void sig_model_changed()
Signal: emitted when the model has changed.
void sig_logging_changed(datatools::logger::priority)
Signal: emitted when the logging has changed.
void set_registry_tree_model(variant_registry_tree_model &, bool devel_mode_=false)
Set the registry tree model.
The Bayeux/datatools library top-level namespace.
Definition: algo.h:13
Utilities for logging information.
const datatools::configuration::variant_registry & get_registry() const
Return a reference to the non mutable registry.
void slot_snapshot()
Slot: store the current status to a buffer.
void slot_compute_expand2(const QModelIndex &top_left_index_, const QModelIndex &bottom_right_index_)
Slot: adapt the view.
variant_registry_tree_model & grab_registry_tree_model()
Return a reference to the mutable registry tree model.