2012-09-03 20:20:51 +08:00
|
|
|
/*
|
2012-10-13 04:20:44 +08:00
|
|
|
* This file is part of the PulseView project.
|
2012-09-03 20:20:51 +08:00
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Joel Holdsworth <joel@airwebreathe.org.uk>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 2 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
|
|
|
*/
|
|
|
|
|
2012-05-11 16:48:50 +08:00
|
|
|
extern "C" {
|
|
|
|
#include <sigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
|
|
|
|
#include <stdint.h>
|
|
|
|
#include <libsigrok/libsigrok.h>
|
|
|
|
}
|
|
|
|
|
2012-09-03 20:20:51 +08:00
|
|
|
#include <QtGui/QApplication>
|
2012-05-11 16:48:50 +08:00
|
|
|
#include <QDebug>
|
2012-10-13 05:41:01 +08:00
|
|
|
#include "pv/mainwindow.h"
|
2012-09-03 20:20:51 +08:00
|
|
|
|
|
|
|
int main(int argc, char *argv[])
|
|
|
|
{
|
|
|
|
QApplication a(argc, argv);
|
|
|
|
|
2012-05-11 16:40:27 +08:00
|
|
|
/* Set some application metadata. */
|
|
|
|
QApplication::setApplicationVersion(APP_VERSION);
|
2012-10-08 03:15:15 +08:00
|
|
|
QApplication::setApplicationName("PulseView");
|
2012-05-11 16:40:27 +08:00
|
|
|
QApplication::setOrganizationDomain("http://www.sigrok.org");
|
|
|
|
|
2012-05-11 16:48:50 +08:00
|
|
|
/* Initialise libsigrok */
|
|
|
|
if (sr_init() != SR_OK) {
|
|
|
|
qDebug() << "ERROR: libsigrok init failed.";
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Initialise libsigrokdecode */
|
|
|
|
if (srd_init(NULL) != SRD_OK) {
|
|
|
|
qDebug() << "ERROR: libsigrokdecode init failed.";
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Load the protocol decoders */
|
|
|
|
srd_decoder_load_all();
|
|
|
|
|
2012-06-28 05:36:23 +08:00
|
|
|
/* Initialize all libsigrok drivers. */
|
|
|
|
sr_dev_driver **const drivers = sr_driver_list();
|
|
|
|
for (sr_dev_driver **driver = drivers; *driver; driver++) {
|
|
|
|
if (sr_driver_init(*driver) != SR_OK) {
|
|
|
|
qDebug("Failed to initialize driver %s",
|
|
|
|
(*driver)->name);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-05-11 16:48:50 +08:00
|
|
|
/* Initialise the main window */
|
2012-10-13 05:41:01 +08:00
|
|
|
pv::MainWindow w;
|
2012-05-11 16:48:50 +08:00
|
|
|
w.show();
|
|
|
|
|
|
|
|
/* Run the application */
|
|
|
|
const int ret = a.exec();
|
|
|
|
|
|
|
|
/* Destroy libsigrokdecode and libsigrok */
|
|
|
|
srd_exit();
|
|
|
|
sr_exit();
|
|
|
|
|
|
|
|
return ret;
|
2012-09-03 20:20:51 +08:00
|
|
|
}
|