X-Git-Url: https://sigrok.org/gitweb/?p=pulseview.git;a=blobdiff_plain;f=main.cpp;h=5c3e5b25818ffc70d1ac28a347e9b33cb91bda47;hp=07cfa2facfb9eefce062c243ad4f6d7ead0a417b;hb=686a9bf7f6f720f3ad431fbb0103444504709a80;hpb=0de8fb27ab376153db50bed98e643767e4eac1a4 diff --git a/main.cpp b/main.cpp index 07cfa2fa..5c3e5b25 100644 --- a/main.cpp +++ b/main.cpp @@ -18,25 +18,37 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +#ifdef ENABLE_DECODE #include /* First, so we avoid a _POSIX_C_SOURCE warning. */ +#endif #include #include #include -#include #include #ifdef ENABLE_SIGNALS #include "signalhandler.h" #endif +#include "pv/application.h" #include "pv/devicemanager.h" #include "pv/mainwindow.h" +#ifdef ANDROID +#include +#include "android/loghandler.h" +#endif #include "config.h" +#ifdef _WIN32 +// The static qsvg lib is required for SVG graphics/icons (on Windows). +#include +Q_IMPORT_PLUGIN(qsvg) +#endif + void usage() { fprintf(stdout, @@ -56,12 +68,12 @@ int main(int argc, char *argv[]) struct sr_context *sr_ctx = NULL; const char *open_file = NULL; - QApplication 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) { @@ -82,7 +94,10 @@ int main(int argc, char *argv[]) { const int loglevel = atoi(optarg); sr_log_loglevel_set(loglevel); + +#ifdef ENABLE_DECODE srd_log_loglevel_set(loglevel); +#endif break; } @@ -113,6 +128,7 @@ int main(int argc, char *argv[]) do { +#ifdef ENABLE_DECODE // Initialise libsigrokdecode if (srd_init(NULL) != SRD_OK) { qDebug() << "ERROR: libsigrokdecode init failed."; @@ -121,6 +137,7 @@ int main(int argc, char *argv[]) // Load the protocol decoders srd_decoder_load_all(); +#endif try { // Create the device manager, initialise the drivers @@ -153,8 +170,10 @@ int main(int argc, char *argv[]) qDebug() << e.what(); } +#ifdef ENABLE_DECODE // Destroy libsigrokdecode srd_exit(); +#endif } while (0);