updated to work with new gcc and avrlibc
[openmag.git] / src / dataviewer / DataViewer.cpp
blobaded58b276fa9dd430108fa44a1028b9a72b1442
1 /* Copyright (C) 2007, 2008 Sean D'Epagnier <sean@depagnier.com>
3 * This Program is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU General Public
5 * License as published by the Free Software Foundation; either
6 * version 3 of the License, or (at your option) any later version.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17 * For more information on the GPL, please go to:
18 * http://www.gnu.org/copyleft/gpl.html
21 #include <QtGui>
22 #include "DataViewer.h"
24 DataViewer::DataViewer()
26 ui.setupUi(this);
28 /* process */
29 process = new DataProcess(this);
30 connect(ui.respawnButton, SIGNAL(clicked()),
31 process, SLOT(respawn()));
33 /* settings */
34 settings = new Settings(this, ui.tree);
35 connect(settings, SIGNAL(DeviceName(QString)),
36 process, SLOT(setDeviceName(QString)));
38 /* menu */
39 connect(ui.actionSettings, SIGNAL(triggered()),
40 settings, SLOT(show()));
41 connect(ui.actionExit, SIGNAL(triggered()),
42 this, SLOT(close()));
43 connect(ui.action_About, SIGNAL(triggered()), this, SLOT(about()));
44 connect(ui.actionAbout_Qt, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
46 /* tree widget */
47 connect(process, SIGNAL(QueryResult(QString, QString)),
48 ui.tree, SLOT(QueryResult(QString, QString)));
49 connect(ui.tree, SIGNAL(Command(QString)),
50 process, SLOT(Command(QString)));
51 connect(ui.treePopulateButton, SIGNAL(clicked()),
52 ui.tree, SLOT(populate()));
53 connect(ui.treeGetValuesButton, SIGNAL(clicked()),
54 ui.tree, SLOT(getvalues()));
55 connect(ui.treeGetSelectedValuesButton, SIGNAL(clicked()),
56 ui.tree, SLOT(getselectedvalues()));
57 connect(ui.treeStopButton, SIGNAL(clicked()),
58 ui.tree, SLOT(stop()));
59 connect(ui.tree, SIGNAL(status(const QString&)),
60 ui.treeStatusLabel, SLOT(setText(const QString&)));
62 /* console widget */
63 connect(settings->ui.ConsoleScrollbackBox,
64 SIGNAL(valueChanged(int)),
65 ui.console, SLOT(setScrollbackLines(int)));
66 connect(process, SIGNAL(update(QString)),
67 ui.console, SLOT(update(QString)));
68 connect(ui.console, SIGNAL(RawData(QChar)),
69 process, SLOT(RawData(QChar)));
70 connect(ui.consoleClearButton, SIGNAL(clicked()),
71 ui.console, SLOT(clear()));
73 /* output widget */
74 connect(settings->ui.OutputScrollbackBox,
75 SIGNAL(valueChanged(int)),
76 ui.output, SLOT(setScrollbackLines(int)));
77 connect(process, SIGNAL(asyncUpdate(QString)),
78 ui.output, SLOT(update(QString)));
79 connect(ui.lockOutputBox, SIGNAL(stateChanged(int)),
80 ui.output, SLOT(setLocked(int)));
81 connect(ui.outputSaveButton, SIGNAL(clicked()),
82 ui.output, SLOT(save()));
83 connect(ui.outputClearButton, SIGNAL(clicked()),
84 ui.output, SLOT(clear()));
86 settings->Load();
87 process->respawn();
90 void DataViewer::about()
92 QMessageBox::about(this, tr("About DataViewer"),
93 tr("<p>The <b>DataViewer</b> program provides a graphical version "
94 "of the dataclient console application used to communicate to "
95 "devices implementing the data interface"
96 "<p>Written by Sean D'Epagnier (C) 2008"));