sistemata la gestione dei devices
[avrdudequi:avrdudequi.git] / mcu.h
1 /***************************************************************************
2  *   Copyright (C) 2011 by Maurilio                                        *
3  *   mau_ri_tec@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
22 #ifndef MCU_H
23 #define MCU_H
24
25 #include <QComboBox>
26 #include <QObject>
27 #include <QtUiTools>
28 #include <QCheckBox>
29 #include <QGroupBox>
30
31 #include "mtfusearray.h"
32
33 class Mcu : public QObject
34 {
35     Q_OBJECT
36
37 public:
38     static Mcu *instance() {
39         if (!m_instance)
40             m_instance = new Mcu;
41         return m_instance;
42     }
43
44     ~Mcu();
45     void fillMcu(QComboBox *cBoxMcu);
46     QString getMcu();
47     QString getAllFuse();
48     QString readAllFuse();
49     QString getBackEnd() { return backEnd; }
50     void setFuses(QMap<QString, QString> &);
51
52 private:
53     static Mcu *m_instance;
54     Mcu();
55
56     void setLFWidget();
57     void setHFWidget();
58     void setEFWidget();
59     QComboBox *_cBoxMcu;
60     QUiLoader *uiLoader;
61     QWidget *mcuWidget;
62     bool thereIsMcuWidget;
63     QComboBox *cBoxLowFuse;
64     QComboBox *cBoxHighFuse;
65     QComboBox *cBoxExtendedFuse;
66     QTabWidget *tabWidget;
67
68     QGroupBox  *gBoxLFuse;
69     QGroupBox  *gBoxHFuse;
70     QGroupBox  *gBoxEFuse;
71     QObjectList objList;
72
73     MtFuseArray lowFuses;
74     MtFuseArray highFuses;
75     MtFuseArray extendedFuses;
76
77     uint nBitLowFuse;
78     uint nBitHighFuse;
79     uint nBitExtendedFuse;
80     uint cBoxLFuseMask;
81     uint cBoxHFuseMask;
82     uint cBoxEFuseMask;
83
84     QString backEnd;
85     QString backend_arg_low;
86     QString backend_arg_high;
87     QString backend_arg_extended;
88
89     void resetPointer();
90
91
92 signals:
93     void currentWidgetChanged(QWidget *mcuWidget);
94
95 public slots:
96     void change(int);
97     void cBoxLowFuseIndexChanged(int);
98     void cBoxHighFuseIndexChanged(int);
99     void cBoxExtendedFuseIndexChanged(int);
100
101 private slots:
102     void gBoxLFuseContentsChanged(bool);
103     void gBoxHFuseContentsChanged(bool);
104     void gBoxEFuseContentsChanged(bool);
105 };
106
107 #endif // MCU_H