projects
/
pulseview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Snapshot: Renamed to Segment
[pulseview.git]
/
main.cpp
diff --git
a/main.cpp
b/main.cpp
index 07cfa2facfb9eefce062c243ad4f6d7ead0a417b..74d13fdc4af1b0eeb9e9b3d3e1d64169597b8dd9 100644
(file)
--- a/
main.cpp
+++ b/
main.cpp
@@
-18,25
+18,37
@@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
+#ifdef ENABLE_DECODE
#include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
#include <libsigrokdecode/libsigrokdecode.h> /* First, so we avoid a _POSIX_C_SOURCE warning. */
+#endif
#include <stdint.h>
#include <stdint.h>
-#include <libsigrok/libsigrok.h>
+#include <libsigrok/libsigrok.h
pp
>
#include <getopt.h>
#include <getopt.h>
-#include <QtGui/QApplication>
#include <QDebug>
#ifdef ENABLE_SIGNALS
#include <QDebug>
#ifdef ENABLE_SIGNALS
-#include "signalhandler.h"
+#include "signalhandler.h
pp
"
#endif
#endif
-#include "pv/devicemanager.h"
-#include "pv/mainwindow.h"
+#include "pv/application.hpp"
+#include "pv/devicemanager.hpp"
+#include "pv/mainwindow.hpp"
+#ifdef ANDROID
+#include <libsigrokandroidutils/libsigrokandroidutils.h>
+#include "android/loghandler.hpp"
+#endif
#include "config.h"
#include "config.h"
+#ifdef _WIN32
+// The static qsvg lib is required for SVG graphics/icons (on Windows).
+#include <QtPlugin>
+Q_IMPORT_PLUGIN(qsvg)
+#endif
+
void usage()
{
fprintf(stdout,
void usage()
{
fprintf(stdout,
@@
-53,15
+65,15
@@
void usage()
int main(int argc, char *argv[])
{
int ret = 0;
int main(int argc, char *argv[])
{
int ret = 0;
- st
ruct sr_context *sr_ctx = NULL
;
+ st
d::shared_ptr<sigrok::Context> context
;
const char *open_file = NULL;
const char *open_file = NULL;
-
Q
Application a(argc, argv);
+ Application a(argc, argv);
- // Set some application metadata
-
QApplication::setApplicationVersion(PV_VERSION_STRING
);
-
QApplication::setApplicationName("PulseView"
);
- QApplication::setOrganizationDomain("http://www.sigrok.org");
+#ifdef ANDROID
+
srau_init_environment(
);
+
pv::AndroidLogHandler::install_callbacks(
);
+#endif
// Parse arguments
while (1) {
// Parse arguments
while (1) {
@@
-81,8
+93,11
@@
int main(int argc, char *argv[])
case 'l':
{
const int loglevel = atoi(optarg);
case 'l':
{
const int loglevel = atoi(optarg);
- sr_log_loglevel_set(loglevel);
+ context->set_log_level(sigrok::LogLevel::get(loglevel));
+
+#ifdef ENABLE_DECODE
srd_log_loglevel_set(loglevel);
srd_log_loglevel_set(loglevel);
+#endif
break;
}
break;
}
@@
-106,13
+121,11
@@
int main(int argc, char *argv[])
open_file = argv[argc - 1];
// Initialise libsigrok
open_file = argv[argc - 1];
// Initialise libsigrok
- if (sr_init(&sr_ctx) != SR_OK) {
- qDebug() << "ERROR: libsigrok init failed.";
- return 1;
- }
+ context = sigrok::Context::create();
do {
do {
+#ifdef ENABLE_DECODE
// Initialise libsigrokdecode
if (srd_init(NULL) != SRD_OK) {
qDebug() << "ERROR: libsigrokdecode init failed.";
// Initialise libsigrokdecode
if (srd_init(NULL) != SRD_OK) {
qDebug() << "ERROR: libsigrokdecode init failed.";
@@
-121,10
+134,11
@@
int main(int argc, char *argv[])
// Load the protocol decoders
srd_decoder_load_all();
// Load the protocol decoders
srd_decoder_load_all();
+#endif
try {
// Create the device manager, initialise the drivers
try {
// Create the device manager, initialise the drivers
- pv::DeviceManager device_manager(
sr_ctx
);
+ pv::DeviceManager device_manager(
context
);
// Initialise the main window
pv::MainWindow w(device_manager, open_file);
// Initialise the main window
pv::MainWindow w(device_manager, open_file);
@@
-140,7
+154,7
@@
int main(int argc, char *argv[])
QObject::connect(handler,
SIGNAL(term_received()),
&w, SLOT(close()));
QObject::connect(handler,
SIGNAL(term_received()),
&w, SLOT(close()));
- } else {
+ } else {
qWarning() <<
"Could not prepare signal handler.";
}
qWarning() <<
"Could not prepare signal handler.";
}
@@
-153,14
+167,12
@@
int main(int argc, char *argv[])
qDebug() << e.what();
}
qDebug() << e.what();
}
+#ifdef ENABLE_DECODE
// Destroy libsigrokdecode
srd_exit();
// Destroy libsigrokdecode
srd_exit();
+#endif
} while (0);
} while (0);
- // Destroy libsigrok
- if (sr_ctx)
- sr_exit(sr_ctx);
-
return ret;
}
return ret;
}