]> cvs.zerfleddert.de Git - proxmark3-svn/blame - client/proxgui.cpp
Merge pull request #488 from pwpiwi/fix_usbpower
[proxmark3-svn] / client / proxgui.cpp
CommitLineData
a553f267 1//-----------------------------------------------------------------------------
212ef3a0 2// Copyright (C) 2009 Michael Gernoth <michael at gernoth.net>
3//
a553f267 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
6// the license.
7//-----------------------------------------------------------------------------
8// GUI functions
9//-----------------------------------------------------------------------------
10
6658905f 11#include "proxgui.h"
12#include "proxguiqt.h"
5acd195d 13#include "proxmark3.h"
6658905f 14
15static ProxGuiQT *gui = NULL;
5acd195d 16static WorkerThread *main_loop_thread = NULL;
17
3851172d 18WorkerThread::WorkerThread(char *script_cmds_file, char *script_cmd, bool usb_present) : script_cmds_file(script_cmds_file), script_cmd(script_cmd), usb_present(usb_present)
5acd195d 19{
20}
21
22WorkerThread::~WorkerThread()
23{
24}
25
26void WorkerThread::run() {
3851172d 27 main_loop(script_cmds_file, script_cmd, usb_present);
5acd195d 28}
6658905f 29
30extern "C" void ShowGraphWindow(void)
31{
7fe9b0b7 32 if (!gui)
33 return;
34
35 gui->ShowGraphWindow();
6658905f 36}
37
38extern "C" void HideGraphWindow(void)
39{
7fe9b0b7 40 if (!gui)
41 return;
42
43 gui->HideGraphWindow();
6658905f 44}
45
46extern "C" void RepaintGraphWindow(void)
47{
7fe9b0b7 48 if (!gui)
49 return;
6658905f 50
7fe9b0b7 51 gui->RepaintGraphWindow();
6658905f 52}
53
54extern "C" void MainGraphics(void)
55{
5acd195d 56 if (!gui)
57 return;
6658905f 58
5acd195d 59 gui->MainLoop();
6658905f 60}
61
3851172d 62extern "C" void InitGraphics(int argc, char **argv, char *script_cmds_file, char *script_cmd, bool usb_present)
6658905f 63{
64#ifdef Q_WS_X11
5acd195d 65 bool useGUI = getenv("DISPLAY") != 0;
6658905f 66#else
5acd195d 67 bool useGUI = true;
6658905f 68#endif
5acd195d 69 if (!useGUI)
70 return;
6658905f 71
3851172d 72 main_loop_thread = new WorkerThread(script_cmds_file, script_cmd, usb_present);
aa757f71 73 gui = new ProxGuiQT(argc, argv, main_loop_thread);
6658905f 74}
75
76extern "C" void ExitGraphics(void)
77{
aa757f71
OM
78 if (!gui)
79 return;
7fe9b0b7 80
aa757f71
OM
81 gui->Exit();
82 gui = NULL;
6658905f 83}
Impressum, Datenschutz