feat: wxWidgets gui

This commit is contained in:
CLARATION committed 2026-06-19 17:51:51 -07:00
1 parent 7ee6976c7d
commit fa05fd34e1
53 files changed
+2494 -296

No files matched your search

+72
View File
@@ -0,0 +1,72 @@
#ifdef WITH_GUI
#include "ExploitPanel.hpp"
#include <thread>
#include <wx/wx.h>
#include "AppFrame.hpp"
#include "DevicePanel.hpp"
#include "../state.hpp"
#include "../utils/log.h"
ExploitPanel::ExploitPanel(MainFrame* frame, wxWindow* parent)
: DevicePanel(frame, parent)
{
auto* root = new wxBoxSizer(wxVERTICAL);
auto* text = new wxStaticText(this, wxID_ANY,
"Installing jailbreak, this will take a moment. If the device asks for a passcode\nplease enter it. Do not disconnect the device until finished.");
m_statusText = new wxStaticText(this, wxID_ANY, "");
root->Add(text, 0, wxALL, 10);
root->Add(m_statusText, 0, wxALL, 10);
m_backButton = new wxButton(this, wxID_ANY, "Back");
m_backButton->Disable();
m_backButton->Bind(wxEVT_BUTTON, [frame](wxCommandEvent&)
{
frame->ShowMain();
});
auto* bottomRow = new wxBoxSizer(wxHORIZONTAL);
bottomRow->AddStretchSpacer();
bottomRow->Add(m_backButton, 0, wxALL, 10);
root->AddStretchSpacer();
root->Add(bottomRow, 0, wxEXPAND);
SetSizer(root);
}
void ExploitPanel::SetDeviceState(const DeviceState& state)
{
DevicePanel::SetDeviceState(state);
if (!(this->IsShown()))
return;
if (state.mode == DeviceMode::Normal)
{
m_statusText->SetLabel("Done.");
m_backButton->Enable();
}
}
void ExploitPanel::StartExploit()
{
m_statusText->SetLabel("Exploiting device...");
m_backButton->Disable();
std::thread([this]()
{
const auto state = GetDeviceState();
if (!state.connected || state.mode != DeviceMode::DFU)
return;
LOG("Starting exploit on worker thread...");
}).detach();
}
#endif // WITH_GUI