almost ready to merge into master
[avrdudequi:avrdudequi.git] / runprocessdialog.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 RUNPROCESSDIALOG_H
23 #define RUNPROCESSDIALOG_H
24
25 #include <QProcess>
26 #include <QDialog>
27 #include <QTextEdit>
28 #include <QVBoxLayout>
29 #include <QDialogButtonBox>
30 #include <QPushButton>
31
32 static QString programName;
33
34 class RunProcessDialog : public QDialog
35 {
36     Q_OBJECT
37 public:
38     explicit RunProcessDialog(QString command, QWidget *parent = 0);
39     ~RunProcessDialog();
40     QStringList getOutput();
41
42
43 signals:
44
45 public slots:
46
47 private slots:
48     void error_proc();
49     void end_proc(int, QProcess::ExitStatus);
50     void print_output();
51     void print_error();
52     void reply();
53     void doneDialog();
54
55 private:
56     QStringList cmd;
57     QProcess *process;
58     QTextEdit *processOut;
59     QVBoxLayout *mainLayout;
60     QString program;
61     QString commandString;
62     QDialogButtonBox *standardButton;
63     QPushButton *replyButton;
64     QPushButton *closeButton;
65     QStringList lastOutput;
66     void run();
67
68
69 };
70
71 class ParserOutput
72 {
73     QMap<QString,QString> fuses;
74     QMap<QString,QString> lockBit;
75 public:
76     explicit ParserOutput(const QStringList &);
77     QMap<QString,QString> getAllFuseValue();
78     QMap<QString,QString> getLockBitValue();
79 };
80
81
82
83
84 #endif // RUNPROCESSDIALOG_H