1 //-----------------------------------------------------------------------------
2 // Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
4 // This code is licensed to you under the terms of the GNU GPL, version 2 or,
5 // at your option, any later version. See the LICENSE.txt file for the text of
7 //-----------------------------------------------------------------------------
9 //-----------------------------------------------------------------------------
14 #include "proxguiqt.h"
15 #include "proxmark3.h"
16 #include "ui.h" // for prints
18 static ProxGuiQT
*gui
= NULL
;
19 static WorkerThread
*main_loop_thread
= NULL
;
21 WorkerThread::WorkerThread(char *script_cmds_file
, char *script_cmd
, bool stayInCommandLoop
) : script_cmds_file(script_cmds_file
), script_cmd(script_cmd
), stayInCommandLoop(stayInCommandLoop
) {
24 WorkerThread::~WorkerThread() {
27 void WorkerThread::run() {
28 main_loop(script_cmds_file
, script_cmd
, stayInCommandLoop
);
31 extern "C" void ShowGraphWindow(void) {
33 // Show a notice if X11/XQuartz isn't available
34 #if defined(__MACH__) && defined(__APPLE__)
35 PrintAndLogEx(WARNING
, "You appear to be on a MacOS device without XQuartz.\nYou may need to install XQuartz (https://www.xquartz.org/) to make the plot work.");
37 PrintAndLogEx(WARNING
, "You appear to be on an environment without an X11 server or without DISPLAY environment variable set.\nPlot may not work until you resolve these issues.");
42 gui
->ShowGraphWindow();
45 extern "C" void HideGraphWindow(void) {
49 gui
->HideGraphWindow();
52 extern "C" void RepaintGraphWindow(void) {
56 gui
->RepaintGraphWindow();
59 extern "C" void MainGraphics(void) {
66 extern "C" void InitGraphics(int argc
, char **argv
, char *script_cmds_file
, char *script_cmd
, bool stayInCommandLoop
) {
68 if (getenv("DISPLAY") == NULL
)
71 #if QT_VERSION >= 0x050100
72 qunsetenv("SESSION_MANAGER");
74 main_loop_thread
= new WorkerThread(script_cmds_file
, script_cmd
, stayInCommandLoop
);
75 gui
= new ProxGuiQT(argc
, argv
, main_loop_thread
);
78 extern "C" void ExitGraphics(void) {