configurationwidget.h
1 /***************************************************************************
2  * Copyright (C) 2008 by Tomassino Ferrauto *
3  * t_ferrauto@yahoo.it *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19  ***************************************************************************/
20 
21 #ifndef CONFIGURATION_WIDGET_H
22 #define CONFIGURATION_WIDGET_H
23 
24 #include <QSplitter>
25 #include <QTreeWidget>
26 #include <QTreeWidgetItem>
27 #include <QTableWidget>
28 #include <QTableWidgetItem>
29 #include "configurationparameters.h"
30 
31 namespace farsa {
32 
45 class ConfigurationWidget : public QSplitter
46 {
47  Q_OBJECT
48 
49 public:
56  ConfigurationWidget(QWidget *parent = NULL);
57 
62 
68  void setConfigurationParameters(ConfigurationParameters *conf);
69 
77  ConfigurationParameters* getConfigurationParameters()
78  {
79  return m_configurationParameters;
80  }
81 
89  const ConfigurationParameters* getCurrentParameters()
90  {
91  return &m_tmpParameters;
92  }
93 
100  void updateParameters();
101 
108  void setReadOnly(bool readOnly);
109 
115  bool readOnly() const
116  {
117  return m_readOnly;
118  }
119 
123  void store();
124 
131  void restore();
132 
140  bool valuesChanged() const
141  {
142  return m_valuesChanged;
143  }
144 
145 signals:
153  void valueHasChanged(QString parameter, QString oldValue, QString newValue);
154 
155 private slots:
159  void changeTableContent(QTreeWidgetItem *item, int column);
160 
164  void storeChangedItem(QTableWidgetItem *item);
165 
166 private:
174  void fillWidgetTree( QString groupName, QString groupFullPath, QTreeWidgetItem* root);
175 
180  ConfigurationParameters *m_configurationParameters;
181 
185  ConfigurationParameters m_tmpParameters;
186 
191  bool m_readOnly;
192 
197  bool m_valuesChanged;
198 
205  QTreeWidget *m_treeWidget;
206 
210  QTableWidget *m_tableWidget;
211 };
212 
213 } // end namespace farsa
214 
215 #endif