Removed redundant 'Bloom' namespace from entire codebase
This commit is contained in:
@@ -14,271 +14,268 @@
|
||||
#include "InsightWorker/Tasks/GetTargetState.hpp"
|
||||
#include "InsightWorker/Tasks/GetTargetDescriptor.hpp"
|
||||
|
||||
namespace Bloom
|
||||
using namespace Exceptions;
|
||||
using Targets::TargetState;
|
||||
|
||||
Insight::Insight(
|
||||
EventListener& eventListener,
|
||||
const ProjectConfig& projectConfig,
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
QApplication* parent
|
||||
)
|
||||
: QObject(parent)
|
||||
, eventListener(eventListener)
|
||||
, projectConfig(projectConfig)
|
||||
, environmentConfig(environmentConfig)
|
||||
, insightConfig(insightConfig)
|
||||
, insightProjectSettings(insightProjectSettings)
|
||||
{
|
||||
using namespace Bloom::Exceptions;
|
||||
using Bloom::Targets::TargetState;
|
||||
Logger::info("Starting Insight");
|
||||
|
||||
Insight::Insight(
|
||||
EventListener& eventListener,
|
||||
const ProjectConfig& projectConfig,
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
QApplication* parent
|
||||
)
|
||||
: QObject(parent)
|
||||
, eventListener(eventListener)
|
||||
, projectConfig(projectConfig)
|
||||
, environmentConfig(environmentConfig)
|
||||
, insightConfig(insightConfig)
|
||||
, insightProjectSettings(insightProjectSettings)
|
||||
{
|
||||
Logger::info("Starting Insight");
|
||||
this->eventListener.registerCallbackForEventType<Events::TargetExecutionStopped>(
|
||||
std::bind(&Insight::onTargetStoppedEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::TargetExecutionStopped>(
|
||||
std::bind(&Insight::onTargetStoppedEvent, this, std::placeholders::_1)
|
||||
this->eventListener.registerCallbackForEventType<Events::TargetExecutionResumed>(
|
||||
std::bind(&Insight::onTargetResumedEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::TargetReset>(
|
||||
std::bind(&Insight::onTargetResetEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::RegistersWrittenToTarget>(
|
||||
std::bind(&Insight::onTargetRegistersWrittenEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::MemoryWrittenToTarget>(
|
||||
std::bind(&Insight::onTargetMemoryWrittenEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeEnabled>(
|
||||
std::bind(&Insight::onProgrammingModeEnabledEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeDisabled>(
|
||||
std::bind(&Insight::onProgrammingModeDisabledEvent, this, std::placeholders::_1)
|
||||
);
|
||||
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
QApplication::setStyle(new BloomProxyStyle());
|
||||
|
||||
qRegisterMetaType<Targets::TargetDescriptor>();
|
||||
qRegisterMetaType<Targets::TargetPinDescriptor>();
|
||||
qRegisterMetaType<Targets::TargetPinState>();
|
||||
qRegisterMetaType<Targets::TargetState>();
|
||||
qRegisterMetaType<std::map<int, Targets::TargetPinState>>();
|
||||
|
||||
// Load Ubuntu fonts
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-B.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-BI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-C.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-L.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-LI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-M.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-MI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-B.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-BI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-R.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-RI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-R.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-RI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-Th.ttf")
|
||||
);
|
||||
|
||||
auto globalStylesheet = QFile(
|
||||
QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath() + "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss"
|
||||
)
|
||||
);
|
||||
|
||||
if (!globalStylesheet.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open global stylesheet file");
|
||||
}
|
||||
|
||||
this->globalStylesheet = globalStylesheet.readAll();
|
||||
|
||||
// Construct and start worker threads
|
||||
for (std::uint8_t i = 0; i < Insight::INSIGHT_WORKER_COUNT; ++i) {
|
||||
auto* insightWorker = new InsightWorker();
|
||||
auto* workerThread = new QThread();
|
||||
|
||||
workerThread->setObjectName("IW" + QString::number(insightWorker->id));
|
||||
insightWorker->moveToThread(workerThread);
|
||||
QObject::connect(workerThread, &QThread::started, insightWorker, &InsightWorker::startup);
|
||||
QObject::connect(workerThread, &QThread::finished, insightWorker, &QObject::deleteLater);
|
||||
QObject::connect(workerThread, &QThread::finished, workerThread, &QThread::deleteLater);
|
||||
|
||||
this->insightWorkersById[insightWorker->id] = std::pair(insightWorker, workerThread);
|
||||
|
||||
Logger::debug("Starting InsightWorker" + std::to_string(insightWorker->id));
|
||||
workerThread->start();
|
||||
}
|
||||
|
||||
this->activateMainWindow();
|
||||
}
|
||||
|
||||
void Insight::activateMainWindow() {
|
||||
if (this->mainWindow == nullptr) {
|
||||
this->mainWindow = new InsightWindow(
|
||||
this->environmentConfig,
|
||||
this->insightConfig,
|
||||
this->insightProjectSettings,
|
||||
this->targetDescriptor
|
||||
);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::TargetExecutionResumed>(
|
||||
std::bind(&Insight::onTargetResumedEvent, this, std::placeholders::_1)
|
||||
);
|
||||
this->mainWindow->setStyleSheet(this->globalStylesheet);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::TargetReset>(
|
||||
std::bind(&Insight::onTargetResetEvent, this, std::placeholders::_1)
|
||||
);
|
||||
QObject::connect(this->mainWindow, &QObject::destroyed, this, &Insight::onInsightWindowDestroyed);
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::RegistersWrittenToTarget>(
|
||||
std::bind(&Insight::onTargetRegistersWrittenEvent, this, std::placeholders::_1)
|
||||
);
|
||||
this->refreshTargetState();
|
||||
}
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::MemoryWrittenToTarget>(
|
||||
std::bind(&Insight::onTargetMemoryWrittenEvent, this, std::placeholders::_1)
|
||||
);
|
||||
this->mainWindow->show();
|
||||
this->mainWindow->activateWindow();
|
||||
}
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeEnabled>(
|
||||
std::bind(&Insight::onProgrammingModeEnabledEvent, this, std::placeholders::_1)
|
||||
);
|
||||
void Insight::shutdown() {
|
||||
Logger::info("Shutting down Insight");
|
||||
|
||||
this->eventListener.registerCallbackForEventType<Events::ProgrammingModeDisabled>(
|
||||
std::bind(&Insight::onProgrammingModeDisabledEvent, this, std::placeholders::_1)
|
||||
);
|
||||
if (this->mainWindow != nullptr) {
|
||||
this->mainWindow->close();
|
||||
}
|
||||
|
||||
QApplication::setQuitOnLastWindowClosed(false);
|
||||
QApplication::setStyle(new BloomProxyStyle());
|
||||
for (auto& [workerId, workerPair] : this->insightWorkersById) {
|
||||
auto* workerThread = workerPair.second;
|
||||
|
||||
qRegisterMetaType<Bloom::Targets::TargetDescriptor>();
|
||||
qRegisterMetaType<Bloom::Targets::TargetPinDescriptor>();
|
||||
qRegisterMetaType<Bloom::Targets::TargetPinState>();
|
||||
qRegisterMetaType<Bloom::Targets::TargetState>();
|
||||
qRegisterMetaType<std::map<int, Bloom::Targets::TargetPinState>>();
|
||||
|
||||
// Load Ubuntu fonts
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-B.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-BI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-C.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-L.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-LI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-M.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-MI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-B.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-BI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-R.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/UbuntuMono-RI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-R.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-RI.ttf")
|
||||
);
|
||||
QFontDatabase::addApplicationFont(
|
||||
QString::fromStdString(Services::PathService::resourcesDirPath() + "/fonts/Ubuntu/Ubuntu-Th.ttf")
|
||||
);
|
||||
|
||||
auto globalStylesheet = QFile(
|
||||
QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath() + "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/Global.qss"
|
||||
)
|
||||
);
|
||||
|
||||
if (!globalStylesheet.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open global stylesheet file");
|
||||
if (workerThread != nullptr && workerThread->isRunning()) {
|
||||
Logger::debug("Stopping InsightWorker" + std::to_string(workerId));
|
||||
workerThread->quit();
|
||||
Logger::debug("Waiting for InsightWorker" + std::to_string(workerId) + " to stop");
|
||||
workerThread->wait();
|
||||
}
|
||||
|
||||
this->globalStylesheet = globalStylesheet.readAll();
|
||||
|
||||
// Construct and start worker threads
|
||||
for (std::uint8_t i = 0; i < Insight::INSIGHT_WORKER_COUNT; ++i) {
|
||||
auto* insightWorker = new InsightWorker();
|
||||
auto* workerThread = new QThread();
|
||||
|
||||
workerThread->setObjectName("IW" + QString::number(insightWorker->id));
|
||||
insightWorker->moveToThread(workerThread);
|
||||
QObject::connect(workerThread, &QThread::started, insightWorker, &InsightWorker::startup);
|
||||
QObject::connect(workerThread, &QThread::finished, insightWorker, &QObject::deleteLater);
|
||||
QObject::connect(workerThread, &QThread::finished, workerThread, &QThread::deleteLater);
|
||||
|
||||
this->insightWorkersById[insightWorker->id] = std::pair(insightWorker, workerThread);
|
||||
|
||||
Logger::debug("Starting InsightWorker" + std::to_string(insightWorker->id));
|
||||
workerThread->start();
|
||||
}
|
||||
|
||||
this->activateMainWindow();
|
||||
}
|
||||
|
||||
void Insight::activateMainWindow() {
|
||||
if (this->mainWindow == nullptr) {
|
||||
this->mainWindow = new InsightWindow(
|
||||
this->environmentConfig,
|
||||
this->insightConfig,
|
||||
this->insightProjectSettings,
|
||||
this->targetDescriptor
|
||||
);
|
||||
|
||||
this->mainWindow->setStyleSheet(this->globalStylesheet);
|
||||
|
||||
QObject::connect(this->mainWindow, &QObject::destroyed, this, &Insight::onInsightWindowDestroyed);
|
||||
|
||||
this->refreshTargetState();
|
||||
}
|
||||
|
||||
this->mainWindow->show();
|
||||
this->mainWindow->activateWindow();
|
||||
}
|
||||
|
||||
void Insight::shutdown() {
|
||||
Logger::info("Shutting down Insight");
|
||||
|
||||
if (this->mainWindow != nullptr) {
|
||||
this->mainWindow->close();
|
||||
}
|
||||
|
||||
for (auto& [workerId, workerPair] : this->insightWorkersById) {
|
||||
auto* workerThread = workerPair.second;
|
||||
|
||||
if (workerThread != nullptr && workerThread->isRunning()) {
|
||||
Logger::debug("Stopping InsightWorker" + std::to_string(workerId));
|
||||
workerThread->quit();
|
||||
Logger::debug("Waiting for InsightWorker" + std::to_string(workerId) + " to stop");
|
||||
workerThread->wait();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Insight::refreshTargetState() {
|
||||
const auto getTargetStateTask = QSharedPointer<GetTargetState>(new GetTargetState(), &QObject::deleteLater);
|
||||
QObject::connect(
|
||||
getTargetStateTask.get(),
|
||||
&GetTargetState::targetState,
|
||||
this,
|
||||
[this] (Targets::TargetState targetState) {
|
||||
this->lastTargetState = targetState;
|
||||
emit this->insightSignals->targetStateUpdated(this->lastTargetState);
|
||||
}
|
||||
);
|
||||
|
||||
InsightWorker::queueTask(getTargetStateTask);
|
||||
}
|
||||
|
||||
void Insight::onInsightWindowDestroyed() {
|
||||
this->mainWindow = nullptr;
|
||||
EventManager::triggerEvent(std::make_shared<Events::InsightMainWindowClosed>());
|
||||
}
|
||||
|
||||
void Insight::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) {
|
||||
if (this->lastTargetState == TargetState::STOPPED) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->lastTargetState = TargetState::STOPPED;
|
||||
|
||||
if (this->targetStepping) {
|
||||
if (this->targetResumeTimer == nullptr) {
|
||||
this->targetResumeTimer = new QTimer(this);
|
||||
this->targetResumeTimer->setSingleShot(true);
|
||||
|
||||
this->targetResumeTimer->callOnTimeout(this, [this] {
|
||||
if (this->lastTargetState != TargetState::STOPPED) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||
});
|
||||
}
|
||||
|
||||
this->targetResumeTimer->start(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->targetResumeTimer != nullptr && this->targetResumeTimer->isActive()) {
|
||||
this->targetResumeTimer->stop();
|
||||
}
|
||||
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||
}
|
||||
|
||||
void Insight::onTargetResumedEvent(const Events::TargetExecutionResumed& event) {
|
||||
this->targetStepping = event.stepping;
|
||||
|
||||
if (this->lastTargetState != TargetState::RUNNING) {
|
||||
this->lastTargetState = TargetState::RUNNING;
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::RUNNING);
|
||||
}
|
||||
}
|
||||
|
||||
void Insight::onTargetResetEvent(const Events::TargetReset& event) {
|
||||
try {
|
||||
if (this->lastTargetState != TargetState::STOPPED) {
|
||||
this->lastTargetState = TargetState::STOPPED;
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||
}
|
||||
|
||||
emit this->insightSignals->targetReset();
|
||||
|
||||
} catch (const Exceptions::Exception& exception) {
|
||||
Logger::debug("Error handling TargetReset event - " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void Insight::onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event) {
|
||||
emit this->insightSignals->targetRegistersWritten(event.registers, event.createdTimestamp);
|
||||
}
|
||||
|
||||
void Insight::onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event) {
|
||||
emit this->insightSignals->targetMemoryWritten(
|
||||
event.memoryType,
|
||||
Targets::TargetMemoryAddressRange(event.startAddress, event.startAddress + (event.size - 1))
|
||||
);
|
||||
}
|
||||
|
||||
void Insight::onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event) {
|
||||
emit this->insightSignals->programmingModeEnabled();
|
||||
}
|
||||
|
||||
void Insight::onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event) {
|
||||
emit this->insightSignals->programmingModeDisabled();
|
||||
}
|
||||
}
|
||||
|
||||
void Insight::refreshTargetState() {
|
||||
const auto getTargetStateTask = QSharedPointer<GetTargetState>(new GetTargetState(), &QObject::deleteLater);
|
||||
QObject::connect(
|
||||
getTargetStateTask.get(),
|
||||
&GetTargetState::targetState,
|
||||
this,
|
||||
[this] (Targets::TargetState targetState) {
|
||||
this->lastTargetState = targetState;
|
||||
emit this->insightSignals->targetStateUpdated(this->lastTargetState);
|
||||
}
|
||||
);
|
||||
|
||||
InsightWorker::queueTask(getTargetStateTask);
|
||||
}
|
||||
|
||||
void Insight::onInsightWindowDestroyed() {
|
||||
this->mainWindow = nullptr;
|
||||
EventManager::triggerEvent(std::make_shared<Events::InsightMainWindowClosed>());
|
||||
}
|
||||
|
||||
void Insight::onTargetStoppedEvent(const Events::TargetExecutionStopped& event) {
|
||||
if (this->lastTargetState == TargetState::STOPPED) {
|
||||
return;
|
||||
}
|
||||
|
||||
this->lastTargetState = TargetState::STOPPED;
|
||||
|
||||
if (this->targetStepping) {
|
||||
if (this->targetResumeTimer == nullptr) {
|
||||
this->targetResumeTimer = new QTimer(this);
|
||||
this->targetResumeTimer->setSingleShot(true);
|
||||
|
||||
this->targetResumeTimer->callOnTimeout(this, [this] {
|
||||
if (this->lastTargetState != TargetState::STOPPED) {
|
||||
return;
|
||||
}
|
||||
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||
});
|
||||
}
|
||||
|
||||
this->targetResumeTimer->start(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (this->targetResumeTimer != nullptr && this->targetResumeTimer->isActive()) {
|
||||
this->targetResumeTimer->stop();
|
||||
}
|
||||
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||
}
|
||||
|
||||
void Insight::onTargetResumedEvent(const Events::TargetExecutionResumed& event) {
|
||||
this->targetStepping = event.stepping;
|
||||
|
||||
if (this->lastTargetState != TargetState::RUNNING) {
|
||||
this->lastTargetState = TargetState::RUNNING;
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::RUNNING);
|
||||
}
|
||||
}
|
||||
|
||||
void Insight::onTargetResetEvent(const Events::TargetReset& event) {
|
||||
try {
|
||||
if (this->lastTargetState != TargetState::STOPPED) {
|
||||
this->lastTargetState = TargetState::STOPPED;
|
||||
emit this->insightSignals->targetStateUpdated(TargetState::STOPPED);
|
||||
}
|
||||
|
||||
emit this->insightSignals->targetReset();
|
||||
|
||||
} catch (const Exceptions::Exception& exception) {
|
||||
Logger::debug("Error handling TargetReset event - " + exception.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
void Insight::onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event) {
|
||||
emit this->insightSignals->targetRegistersWritten(event.registers, event.createdTimestamp);
|
||||
}
|
||||
|
||||
void Insight::onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event) {
|
||||
emit this->insightSignals->targetMemoryWritten(
|
||||
event.memoryType,
|
||||
Targets::TargetMemoryAddressRange(event.startAddress, event.startAddress + (event.size - 1))
|
||||
);
|
||||
}
|
||||
|
||||
void Insight::onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event) {
|
||||
emit this->insightSignals->programmingModeEnabled();
|
||||
}
|
||||
|
||||
void Insight::onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event) {
|
||||
emit this->insightSignals->programmingModeDisabled();
|
||||
}
|
||||
|
||||
@@ -24,81 +24,78 @@
|
||||
#include "InsightWorker/InsightWorker.hpp"
|
||||
#include "UserInterfaces/InsightWindow/InsightWindow.hpp"
|
||||
|
||||
namespace Bloom
|
||||
/**
|
||||
* The Insight component provides a GUI for insight into the target's GPIO state.
|
||||
* Insight relies heavily on the Qt framework - it's practically a small Qt application. Each supported target
|
||||
* package variant implements a custom Qt widget that presents the user with the current state of the target's GPIO
|
||||
* pins, as well as the ability to manipulate the pin states of output pins by clicking on them.
|
||||
*
|
||||
* The Insight component occupies the Bloom's main thread. See Application::run() for more.
|
||||
*/
|
||||
class Insight: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/**
|
||||
* The Insight component provides a GUI for insight into the target's GPIO state.
|
||||
* Insight relies heavily on the Qt framework - it's practically a small Qt application. Each supported target
|
||||
* package variant implements a custom Qt widget that presents the user with the current state of the target's GPIO
|
||||
* pins, as well as the ability to manipulate the pin states of output pins by clicking on them.
|
||||
* Insight constructor.
|
||||
*
|
||||
* The Insight component occupies the Bloom's main thread. See Application::run() for more.
|
||||
* Note: We use the comma operator in the application() initializer to set the Qt::AA_ShareOpenGLContexts
|
||||
* attribute, as this is required by Qt before creating a QCoreApplication instance.
|
||||
*
|
||||
* @param eventManager
|
||||
*/
|
||||
class Insight: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
explicit Insight(
|
||||
EventListener& eventListener,
|
||||
const ProjectConfig& projectConfig,
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
QApplication* parent
|
||||
);
|
||||
|
||||
public:
|
||||
/**
|
||||
* Insight constructor.
|
||||
*
|
||||
* Note: We use the comma operator in the application() initializer to set the Qt::AA_ShareOpenGLContexts
|
||||
* attribute, as this is required by Qt before creating a QCoreApplication instance.
|
||||
*
|
||||
* @param eventManager
|
||||
*/
|
||||
explicit Insight(
|
||||
EventListener& eventListener,
|
||||
const ProjectConfig& projectConfig,
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
QApplication* parent
|
||||
);
|
||||
/**
|
||||
* Opens main window and obtains focus.
|
||||
*/
|
||||
void activateMainWindow();
|
||||
|
||||
/**
|
||||
* Opens main window and obtains focus.
|
||||
*/
|
||||
void activateMainWindow();
|
||||
/**
|
||||
* Shuts down Insight. Called when the user closes the Insight window or a ShutdownApplication event is fired.
|
||||
*/
|
||||
void shutdown();
|
||||
|
||||
/**
|
||||
* Shuts down Insight. Called when the user closes the Insight window or a ShutdownApplication event is fired.
|
||||
*/
|
||||
void shutdown();
|
||||
private:
|
||||
static constexpr std::uint8_t INSIGHT_WORKER_COUNT = 3;
|
||||
|
||||
private:
|
||||
static constexpr std::uint8_t INSIGHT_WORKER_COUNT = 3;
|
||||
ProjectConfig projectConfig;
|
||||
EnvironmentConfig environmentConfig;
|
||||
InsightConfig insightConfig;
|
||||
|
||||
ProjectConfig projectConfig;
|
||||
EnvironmentConfig environmentConfig;
|
||||
InsightConfig insightConfig;
|
||||
InsightProjectSettings& insightProjectSettings;
|
||||
|
||||
InsightProjectSettings& insightProjectSettings;
|
||||
EventListener& eventListener;
|
||||
Services::TargetControllerService targetControllerService = Services::TargetControllerService();
|
||||
|
||||
EventListener& eventListener;
|
||||
Services::TargetControllerService targetControllerService = Services::TargetControllerService();
|
||||
Targets::TargetDescriptor targetDescriptor = this->targetControllerService.getTargetDescriptor();
|
||||
|
||||
Targets::TargetDescriptor targetDescriptor = this->targetControllerService.getTargetDescriptor();
|
||||
QString globalStylesheet;
|
||||
|
||||
QString globalStylesheet;
|
||||
std::map<decltype(InsightWorker::id), std::pair<InsightWorker*, QThread*>> insightWorkersById;
|
||||
InsightWindow* mainWindow = nullptr;
|
||||
|
||||
std::map<decltype(InsightWorker::id), std::pair<InsightWorker*, QThread*>> insightWorkersById;
|
||||
InsightWindow* mainWindow = nullptr;
|
||||
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
|
||||
bool targetStepping = false;
|
||||
QTimer* targetResumeTimer = nullptr;
|
||||
|
||||
Targets::TargetState lastTargetState = Targets::TargetState::UNKNOWN;
|
||||
bool targetStepping = false;
|
||||
QTimer* targetResumeTimer = nullptr;
|
||||
InsightSignals* insightSignals = InsightSignals::instance();
|
||||
|
||||
InsightSignals* insightSignals = InsightSignals::instance();
|
||||
|
||||
void refreshTargetState();
|
||||
void onInsightWindowDestroyed();
|
||||
void onTargetStoppedEvent(const Events::TargetExecutionStopped& event);
|
||||
void onTargetResumedEvent(const Events::TargetExecutionResumed& event);
|
||||
void onTargetResetEvent(const Events::TargetReset& event);
|
||||
void onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event);
|
||||
void onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event);
|
||||
void onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event);
|
||||
void onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event);
|
||||
};
|
||||
}
|
||||
void refreshTargetState();
|
||||
void onInsightWindowDestroyed();
|
||||
void onTargetStoppedEvent(const Events::TargetExecutionStopped& event);
|
||||
void onTargetResumedEvent(const Events::TargetExecutionResumed& event);
|
||||
void onTargetResetEvent(const Events::TargetReset& event);
|
||||
void onTargetRegistersWrittenEvent(const Events::RegistersWrittenToTarget& event);
|
||||
void onTargetMemoryWrittenEvent(const Events::MemoryWrittenToTarget& event);
|
||||
void onProgrammingModeEnabledEvent(const Events::ProgrammingModeEnabled& event);
|
||||
void onProgrammingModeDisabledEvent(const Events::ProgrammingModeDisabled& event);
|
||||
};
|
||||
|
||||
@@ -10,37 +10,34 @@
|
||||
|
||||
#include "InsightWorker/Tasks/InsightWorkerTask.hpp"
|
||||
|
||||
namespace Bloom
|
||||
/**
|
||||
* Singleton class providing global signals to all Insight widgets that require them. The signals are emitted via
|
||||
* the Insight class and InsightWorkerTasks.
|
||||
*/
|
||||
class InsightSignals: public QObject
|
||||
{
|
||||
/**
|
||||
* Singleton class providing global signals to all Insight widgets that require them. The signals are emitted via
|
||||
* the Insight class and InsightWorkerTasks.
|
||||
*/
|
||||
class InsightSignals: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
static InsightSignals* instance() {
|
||||
static auto instance = InsightSignals();
|
||||
return &instance;
|
||||
}
|
||||
public:
|
||||
static InsightSignals* instance() {
|
||||
static auto instance = InsightSignals();
|
||||
return &instance;
|
||||
}
|
||||
|
||||
InsightSignals(const InsightSignals&) = delete;
|
||||
void operator = (const InsightSignals&) = delete;
|
||||
InsightSignals(const InsightSignals&) = delete;
|
||||
void operator = (const InsightSignals&) = delete;
|
||||
|
||||
signals:
|
||||
void taskQueued(QSharedPointer<InsightWorkerTask> task);
|
||||
void taskProcessed(QSharedPointer<InsightWorkerTask> task);
|
||||
signals:
|
||||
void taskQueued(QSharedPointer<InsightWorkerTask> task);
|
||||
void taskProcessed(QSharedPointer<InsightWorkerTask> task);
|
||||
|
||||
void targetStateUpdated(Bloom::Targets::TargetState newState);
|
||||
void targetReset();
|
||||
void targetRegistersWritten(const Bloom::Targets::TargetRegisters& targetRegisters, const QDateTime& timestamp);
|
||||
void targetMemoryWritten(Bloom::Targets::TargetMemoryType memoryType, Targets::TargetMemoryAddressRange addressRange);
|
||||
void programmingModeEnabled();
|
||||
void programmingModeDisabled();
|
||||
void targetStateUpdated(Targets::TargetState newState);
|
||||
void targetReset();
|
||||
void targetRegistersWritten(const Targets::TargetRegisters& targetRegisters, const QDateTime& timestamp);
|
||||
void targetMemoryWritten(Targets::TargetMemoryType memoryType, Targets::TargetMemoryAddressRange addressRange);
|
||||
void programmingModeEnabled();
|
||||
void programmingModeDisabled();
|
||||
|
||||
private:
|
||||
InsightSignals() = default;
|
||||
};
|
||||
}
|
||||
private:
|
||||
InsightSignals() = default;
|
||||
};
|
||||
|
||||
@@ -5,88 +5,85 @@
|
||||
#include "src/Insight/InsightSignals.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using namespace Bloom::Exceptions;
|
||||
using namespace Exceptions;
|
||||
|
||||
using Bloom::Targets::TargetState;
|
||||
using Targets::TargetState;
|
||||
|
||||
void InsightWorker::startup() {
|
||||
auto* insightSignals = InsightSignals::instance();
|
||||
void InsightWorker::startup() {
|
||||
auto* insightSignals = InsightSignals::instance();
|
||||
|
||||
QObject::connect(
|
||||
insightSignals,
|
||||
&InsightSignals::taskQueued,
|
||||
this,
|
||||
&InsightWorker::executeTasks,
|
||||
Qt::ConnectionType::QueuedConnection
|
||||
);
|
||||
QObject::connect(
|
||||
insightSignals,
|
||||
&InsightSignals::taskProcessed,
|
||||
this,
|
||||
&InsightWorker::executeTasks,
|
||||
Qt::ConnectionType::QueuedConnection
|
||||
);
|
||||
QObject::connect(
|
||||
insightSignals,
|
||||
&InsightSignals::taskQueued,
|
||||
this,
|
||||
&InsightWorker::executeTasks,
|
||||
Qt::ConnectionType::QueuedConnection
|
||||
);
|
||||
QObject::connect(
|
||||
insightSignals,
|
||||
&InsightSignals::taskProcessed,
|
||||
this,
|
||||
&InsightWorker::executeTasks,
|
||||
Qt::ConnectionType::QueuedConnection
|
||||
);
|
||||
|
||||
Logger::debug("InsightWorker" + std::to_string(this->id) + " ready");
|
||||
emit this->ready();
|
||||
}
|
||||
Logger::debug("InsightWorker" + std::to_string(this->id) + " ready");
|
||||
emit this->ready();
|
||||
}
|
||||
|
||||
void InsightWorker::queueTask(const QSharedPointer<InsightWorkerTask>& task) {
|
||||
task->moveToThread(nullptr);
|
||||
void InsightWorker::queueTask(const QSharedPointer<InsightWorkerTask>& task) {
|
||||
task->moveToThread(nullptr);
|
||||
|
||||
InsightWorker::queuedTasksById.accessor()->emplace(task->id, task);
|
||||
InsightWorker::queuedTasksById.accessor()->emplace(task->id, task);
|
||||
|
||||
emit InsightSignals::instance()->taskQueued(task);
|
||||
}
|
||||
emit InsightSignals::instance()->taskQueued(task);
|
||||
}
|
||||
|
||||
void InsightWorker::executeTasks() {
|
||||
static const auto getQueuedTask = [] () -> std::optional<QSharedPointer<InsightWorkerTask>> {
|
||||
auto queuedTasks = InsightWorker::queuedTasksById.accessor();
|
||||
void InsightWorker::executeTasks() {
|
||||
static const auto getQueuedTask = [] () -> std::optional<QSharedPointer<InsightWorkerTask>> {
|
||||
auto queuedTasks = InsightWorker::queuedTasksById.accessor();
|
||||
|
||||
if (!queuedTasks->empty()) {
|
||||
auto taskGroupsInExecution = InsightWorker::taskGroupsInExecution.accessor();
|
||||
if (!queuedTasks->empty()) {
|
||||
auto taskGroupsInExecution = InsightWorker::taskGroupsInExecution.accessor();
|
||||
|
||||
const auto canExecuteTask = [&taskGroupsInExecution] (const QSharedPointer<InsightWorkerTask>& task) {
|
||||
for (const auto taskGroup : task->taskGroups()) {
|
||||
if (taskGroupsInExecution->contains(taskGroup)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
for (auto [queuedTaskId, task] : *queuedTasks) {
|
||||
if (canExecuteTask(task)) {
|
||||
const auto taskGroups = task->taskGroups();
|
||||
taskGroupsInExecution->insert(taskGroups.begin(), taskGroups.end());
|
||||
queuedTasks->erase(queuedTaskId);
|
||||
return task;
|
||||
const auto canExecuteTask = [&taskGroupsInExecution] (const QSharedPointer<InsightWorkerTask>& task) {
|
||||
for (const auto taskGroup : task->taskGroups()) {
|
||||
if (taskGroupsInExecution->contains(taskGroup)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
};
|
||||
return true;
|
||||
};
|
||||
|
||||
auto queuedTask = std::optional<QSharedPointer<InsightWorkerTask>>();
|
||||
|
||||
while ((queuedTask = getQueuedTask())) {
|
||||
auto& task = *queuedTask;
|
||||
task->moveToThread(this->thread());
|
||||
task->execute(this->targetControllerService);
|
||||
|
||||
{
|
||||
auto taskGroupsInExecution = InsightWorker::taskGroupsInExecution.accessor();
|
||||
|
||||
for (const auto& taskGroup : task->taskGroups()) {
|
||||
taskGroupsInExecution->erase(taskGroup);
|
||||
for (auto [queuedTaskId, task] : *queuedTasks) {
|
||||
if (canExecuteTask(task)) {
|
||||
const auto taskGroups = task->taskGroups();
|
||||
taskGroupsInExecution->insert(taskGroups.begin(), taskGroups.end());
|
||||
queuedTasks->erase(queuedTaskId);
|
||||
return task;
|
||||
}
|
||||
}
|
||||
|
||||
emit InsightSignals::instance()->taskProcessed(task);
|
||||
}
|
||||
|
||||
return std::nullopt;
|
||||
};
|
||||
|
||||
auto queuedTask = std::optional<QSharedPointer<InsightWorkerTask>>();
|
||||
|
||||
while ((queuedTask = getQueuedTask())) {
|
||||
auto& task = *queuedTask;
|
||||
task->moveToThread(this->thread());
|
||||
task->execute(this->targetControllerService);
|
||||
|
||||
{
|
||||
auto taskGroupsInExecution = InsightWorker::taskGroupsInExecution.accessor();
|
||||
|
||||
for (const auto& taskGroup : task->taskGroups()) {
|
||||
taskGroupsInExecution->erase(taskGroup);
|
||||
}
|
||||
}
|
||||
|
||||
emit InsightSignals::instance()->taskProcessed(task);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,35 +12,32 @@
|
||||
#include "src/Helpers/Synchronised.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
namespace Bloom
|
||||
static_assert(std::atomic<std::uint8_t>::is_always_lock_free);
|
||||
|
||||
/**
|
||||
* The InsightWorker runs on a separate thread to the main GUI thread. Its purpose is to handle any
|
||||
* blocking/time-expensive operations.
|
||||
*/
|
||||
class InsightWorker: public QObject
|
||||
{
|
||||
static_assert(std::atomic<std::uint8_t>::is_always_lock_free);
|
||||
Q_OBJECT
|
||||
|
||||
/**
|
||||
* The InsightWorker runs on a separate thread to the main GUI thread. Its purpose is to handle any
|
||||
* blocking/time-expensive operations.
|
||||
*/
|
||||
class InsightWorker: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
const std::uint8_t id = ++(InsightWorker::lastWorkerId);
|
||||
|
||||
public:
|
||||
const std::uint8_t id = ++(InsightWorker::lastWorkerId);
|
||||
InsightWorker() = default;
|
||||
void startup();
|
||||
static void queueTask(const QSharedPointer<InsightWorkerTask>& task);
|
||||
|
||||
InsightWorker() = default;
|
||||
void startup();
|
||||
static void queueTask(const QSharedPointer<InsightWorkerTask>& task);
|
||||
signals:
|
||||
void ready();
|
||||
|
||||
signals:
|
||||
void ready();
|
||||
private:
|
||||
static inline std::atomic<std::uint8_t> lastWorkerId = 0;
|
||||
static inline Synchronised<std::map<InsightWorkerTask::IdType, QSharedPointer<InsightWorkerTask>>> queuedTasksById = {};
|
||||
static inline Synchronised<TaskGroups> taskGroupsInExecution = {};
|
||||
|
||||
private:
|
||||
static inline std::atomic<std::uint8_t> lastWorkerId = 0;
|
||||
static inline Synchronised<std::map<InsightWorkerTask::IdType, QSharedPointer<InsightWorkerTask>>> queuedTasksById = {};
|
||||
static inline Synchronised<TaskGroups> taskGroupsInExecution = {};
|
||||
Services::TargetControllerService targetControllerService = Services::TargetControllerService();
|
||||
|
||||
Services::TargetControllerService targetControllerService = Services::TargetControllerService();
|
||||
|
||||
void executeTasks();
|
||||
};
|
||||
}
|
||||
void executeTasks();
|
||||
};
|
||||
|
||||
@@ -8,104 +8,101 @@
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
CaptureMemorySnapshot::CaptureMemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions,
|
||||
const std::optional<Targets::TargetMemoryBuffer>& data
|
||||
)
|
||||
: name(name)
|
||||
, description(description)
|
||||
, memoryType(memoryType)
|
||||
, focusedRegions(focusedRegions)
|
||||
, excludedRegions(excludedRegions)
|
||||
, data(data)
|
||||
{}
|
||||
CaptureMemorySnapshot::CaptureMemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions,
|
||||
const std::optional<Targets::TargetMemoryBuffer>& data
|
||||
)
|
||||
: name(name)
|
||||
, description(description)
|
||||
, memoryType(memoryType)
|
||||
, focusedRegions(focusedRegions)
|
||||
, excludedRegions(excludedRegions)
|
||||
, data(data)
|
||||
{}
|
||||
|
||||
void CaptureMemorySnapshot::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
void CaptureMemorySnapshot::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
|
||||
Logger::info("Capturing snapshot");
|
||||
Logger::info("Capturing snapshot");
|
||||
|
||||
const auto& targetDescriptor = targetControllerService.getTargetDescriptor();
|
||||
const auto memoryDescriptorIt = targetDescriptor.memoryDescriptorsByType.find(this->memoryType);
|
||||
const auto& targetDescriptor = targetControllerService.getTargetDescriptor();
|
||||
const auto memoryDescriptorIt = targetDescriptor.memoryDescriptorsByType.find(this->memoryType);
|
||||
|
||||
if (memoryDescriptorIt == targetDescriptor.memoryDescriptorsByType.end()) {
|
||||
throw Exceptions::Exception("Invalid memory type");
|
||||
}
|
||||
if (memoryDescriptorIt == targetDescriptor.memoryDescriptorsByType.end()) {
|
||||
throw Exceptions::Exception("Invalid memory type");
|
||||
}
|
||||
|
||||
const auto& memoryDescriptor = memoryDescriptorIt->second;
|
||||
const auto memorySize = memoryDescriptor.size();
|
||||
const auto& memoryDescriptor = memoryDescriptorIt->second;
|
||||
const auto memorySize = memoryDescriptor.size();
|
||||
|
||||
if (!this->data.has_value()) {
|
||||
Logger::info("Reading data for snapshot capture");
|
||||
if (!this->data.has_value()) {
|
||||
Logger::info("Reading data for snapshot capture");
|
||||
|
||||
this->data = Targets::TargetMemoryBuffer();
|
||||
this->data->reserve(memorySize);
|
||||
this->data = Targets::TargetMemoryBuffer();
|
||||
this->data->reserve(memorySize);
|
||||
|
||||
const auto readSize = std::max(
|
||||
TargetMemorySize(256),
|
||||
memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
|
||||
);
|
||||
const auto readsRequired = static_cast<std::uint32_t>(
|
||||
std::ceil(static_cast<float>(memorySize) / static_cast<float>(readSize))
|
||||
);
|
||||
|
||||
for (std::uint32_t i = 0; i < readsRequired; i++) {
|
||||
auto dataSegment = targetControllerService.readMemory(
|
||||
this->memoryType,
|
||||
memoryDescriptor.addressRange.startAddress + static_cast<Targets::TargetMemoryAddress>(readSize * i),
|
||||
(memorySize - this->data->size()) >= readSize
|
||||
? readSize
|
||||
: static_cast<Targets::TargetMemorySize>(memorySize - this->data->size()),
|
||||
{}
|
||||
);
|
||||
|
||||
std::move(dataSegment.begin(), dataSegment.end(), std::back_inserter(*this->data));
|
||||
this->setProgressPercentage(static_cast<std::uint8_t>(
|
||||
(static_cast<float>(i) + 1) / (static_cast<float>(readsRequired + 1) / 100)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
assert(this->data->size() == memorySize);
|
||||
|
||||
auto snapshot = MemorySnapshot(
|
||||
std::move(this->name),
|
||||
std::move(this->description),
|
||||
this->memoryType,
|
||||
std::move(*this->data),
|
||||
targetControllerService.getProgramCounter(),
|
||||
targetControllerService.getStackPointer(),
|
||||
std::move(this->focusedRegions),
|
||||
std::move(this->excludedRegions)
|
||||
const auto readSize = std::max(
|
||||
TargetMemorySize(256),
|
||||
memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
|
||||
);
|
||||
const auto readsRequired = static_cast<std::uint32_t>(
|
||||
std::ceil(static_cast<float>(memorySize) / static_cast<float>(readSize))
|
||||
);
|
||||
|
||||
const auto snapshotDirPath = QString::fromStdString(Services::PathService::projectSettingsDirPath())
|
||||
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(snapshot.memoryType);
|
||||
for (std::uint32_t i = 0; i < readsRequired; i++) {
|
||||
auto dataSegment = targetControllerService.readMemory(
|
||||
this->memoryType,
|
||||
memoryDescriptor.addressRange.startAddress + static_cast<Targets::TargetMemoryAddress>(readSize * i),
|
||||
(memorySize - this->data->size()) >= readSize
|
||||
? readSize
|
||||
: static_cast<Targets::TargetMemorySize>(memorySize - this->data->size()),
|
||||
{}
|
||||
);
|
||||
|
||||
QDir().mkpath(snapshotDirPath);
|
||||
|
||||
const auto snapshotFilePath = snapshotDirPath + "/" + snapshot.id + ".json";
|
||||
|
||||
auto outputFile = QFile(snapshotFilePath);
|
||||
|
||||
if (!outputFile.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) {
|
||||
Logger::error("Failed to save snapshot - cannot open " + snapshotFilePath.toStdString());
|
||||
return;
|
||||
std::move(dataSegment.begin(), dataSegment.end(), std::back_inserter(*this->data));
|
||||
this->setProgressPercentage(static_cast<std::uint8_t>(
|
||||
(static_cast<float>(i) + 1) / (static_cast<float>(readsRequired + 1) / 100)
|
||||
));
|
||||
}
|
||||
|
||||
outputFile.write(QJsonDocument(snapshot.toJson()).toJson(QJsonDocument::JsonFormat::Compact));
|
||||
outputFile.close();
|
||||
|
||||
Logger::info("Snapshot captured - UUID: " + snapshot.id.toStdString());
|
||||
|
||||
emit this->memorySnapshotCaptured(std::move(snapshot));
|
||||
}
|
||||
|
||||
assert(this->data->size() == memorySize);
|
||||
|
||||
auto snapshot = MemorySnapshot(
|
||||
std::move(this->name),
|
||||
std::move(this->description),
|
||||
this->memoryType,
|
||||
std::move(*this->data),
|
||||
targetControllerService.getProgramCounter(),
|
||||
targetControllerService.getStackPointer(),
|
||||
std::move(this->focusedRegions),
|
||||
std::move(this->excludedRegions)
|
||||
);
|
||||
|
||||
const auto snapshotDirPath = QString::fromStdString(Services::PathService::projectSettingsDirPath())
|
||||
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(snapshot.memoryType);
|
||||
|
||||
QDir().mkpath(snapshotDirPath);
|
||||
|
||||
const auto snapshotFilePath = snapshotDirPath + "/" + snapshot.id + ".json";
|
||||
|
||||
auto outputFile = QFile(snapshotFilePath);
|
||||
|
||||
if (!outputFile.open(QIODevice::ReadWrite | QIODevice::Truncate | QIODevice::Text)) {
|
||||
Logger::error("Failed to save snapshot - cannot open " + snapshotFilePath.toStdString());
|
||||
return;
|
||||
}
|
||||
|
||||
outputFile.write(QJsonDocument(snapshot.toJson()).toJson(QJsonDocument::JsonFormat::Compact));
|
||||
outputFile.close();
|
||||
|
||||
Logger::info("Snapshot captured - UUID: " + snapshot.id.toStdString());
|
||||
|
||||
emit this->memorySnapshotCaptured(std::move(snapshot));
|
||||
}
|
||||
|
||||
@@ -8,45 +8,42 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class CaptureMemorySnapshot: public InsightWorkerTask
|
||||
{
|
||||
class CaptureMemorySnapshot: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CaptureMemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions,
|
||||
const std::optional<Targets::TargetMemoryBuffer>& data
|
||||
);
|
||||
public:
|
||||
CaptureMemorySnapshot(
|
||||
const QString& name,
|
||||
const QString& description,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const std::vector<FocusedMemoryRegion>& focusedRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedRegions,
|
||||
const std::optional<Targets::TargetMemoryBuffer>& data
|
||||
);
|
||||
|
||||
QString brief() const override {
|
||||
return "Capturing memory snapshot";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Capturing memory snapshot";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void memorySnapshotCaptured(MemorySnapshot snapshot);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
QString name;
|
||||
QString description;
|
||||
Targets::TargetMemoryType memoryType;
|
||||
std::vector<FocusedMemoryRegion> focusedRegions;
|
||||
std::vector<ExcludedMemoryRegion> excludedRegions;
|
||||
|
||||
std::optional<Targets::TargetMemoryBuffer> data;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void memorySnapshotCaptured(MemorySnapshot snapshot);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
QString name;
|
||||
QString description;
|
||||
Targets::TargetMemoryType memoryType;
|
||||
std::vector<FocusedMemoryRegion> focusedRegions;
|
||||
std::vector<ExcludedMemoryRegion> excludedRegions;
|
||||
|
||||
std::optional<Targets::TargetMemoryBuffer> data;
|
||||
};
|
||||
|
||||
@@ -1,25 +1,22 @@
|
||||
#include "ConstructHexViewerTopLevelGroupItem.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
ConstructHexViewerTopLevelGroupItem::ConstructHexViewerTopLevelGroupItem(
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const Widgets::HexViewerSharedState& hexViewerState
|
||||
)
|
||||
: focusedMemoryRegions(focusedMemoryRegions)
|
||||
, excludedMemoryRegions(excludedMemoryRegions)
|
||||
, hexViewerState(hexViewerState)
|
||||
{}
|
||||
ConstructHexViewerTopLevelGroupItem::ConstructHexViewerTopLevelGroupItem(
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const Widgets::HexViewerSharedState& hexViewerState
|
||||
)
|
||||
: focusedMemoryRegions(focusedMemoryRegions)
|
||||
, excludedMemoryRegions(excludedMemoryRegions)
|
||||
, hexViewerState(hexViewerState)
|
||||
{}
|
||||
|
||||
void ConstructHexViewerTopLevelGroupItem::run(Services::TargetControllerService&) {
|
||||
auto* item = new Widgets::TopLevelGroupItem(
|
||||
this->focusedMemoryRegions,
|
||||
this->excludedMemoryRegions,
|
||||
this->hexViewerState
|
||||
);
|
||||
item->rebuildItemHierarchy();
|
||||
void ConstructHexViewerTopLevelGroupItem::run(Services::TargetControllerService&) {
|
||||
auto* item = new Widgets::TopLevelGroupItem(
|
||||
this->focusedMemoryRegions,
|
||||
this->excludedMemoryRegions,
|
||||
this->hexViewerState
|
||||
);
|
||||
item->rebuildItemHierarchy();
|
||||
|
||||
emit this->topLevelGroupItem(item);
|
||||
}
|
||||
emit this->topLevelGroupItem(item);
|
||||
}
|
||||
|
||||
@@ -8,36 +8,33 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/TopLevelGroupItem.hpp"
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/HexViewerWidget/HexViewerSharedState.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class ConstructHexViewerTopLevelGroupItem: public InsightWorkerTask
|
||||
{
|
||||
class ConstructHexViewerTopLevelGroupItem: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ConstructHexViewerTopLevelGroupItem(
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const Widgets::HexViewerSharedState& hexViewerState
|
||||
);
|
||||
public:
|
||||
ConstructHexViewerTopLevelGroupItem(
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions,
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions,
|
||||
const Widgets::HexViewerSharedState& hexViewerState
|
||||
);
|
||||
|
||||
QString brief() const override {
|
||||
return "Preparing hex viewer";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Preparing hex viewer";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups();
|
||||
};
|
||||
|
||||
signals:
|
||||
void topLevelGroupItem(Widgets::TopLevelGroupItem* item);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService&) override;
|
||||
|
||||
private:
|
||||
const Widgets::HexViewerSharedState& hexViewerState;
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions;
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups();
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void topLevelGroupItem(Widgets::TopLevelGroupItem* item);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService&) override;
|
||||
|
||||
private:
|
||||
const Widgets::HexViewerSharedState& hexViewerState;
|
||||
const std::vector<FocusedMemoryRegion>& focusedMemoryRegions;
|
||||
const std::vector<ExcludedMemoryRegion>& excludedMemoryRegions;
|
||||
};
|
||||
|
||||
@@ -6,37 +6,34 @@
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
DeleteMemorySnapshot::DeleteMemorySnapshot(
|
||||
const QString& snapshotId,
|
||||
Targets::TargetMemoryType memoryType
|
||||
)
|
||||
: snapshotId(snapshotId)
|
||||
, memoryType(memoryType)
|
||||
{}
|
||||
DeleteMemorySnapshot::DeleteMemorySnapshot(
|
||||
const QString& snapshotId,
|
||||
Targets::TargetMemoryType memoryType
|
||||
)
|
||||
: snapshotId(snapshotId)
|
||||
, memoryType(memoryType)
|
||||
{}
|
||||
|
||||
void DeleteMemorySnapshot::run(TargetControllerService&) {
|
||||
using Targets::TargetMemorySize;
|
||||
void DeleteMemorySnapshot::run(TargetControllerService&) {
|
||||
using Targets::TargetMemorySize;
|
||||
|
||||
Logger::info("Deleting snapshot " + this->snapshotId.toStdString());
|
||||
Logger::info("Deleting snapshot " + this->snapshotId.toStdString());
|
||||
|
||||
const auto snapshotFilePath = QString::fromStdString(Services::PathService::projectSettingsDirPath())
|
||||
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(this->memoryType) + "/"
|
||||
+ this->snapshotId + ".json";
|
||||
const auto snapshotFilePath = QString::fromStdString(Services::PathService::projectSettingsDirPath())
|
||||
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(this->memoryType) + "/"
|
||||
+ this->snapshotId + ".json";
|
||||
|
||||
auto snapshotFile = QFile(snapshotFilePath);
|
||||
auto snapshotFile = QFile(snapshotFilePath);
|
||||
|
||||
if (!snapshotFile.exists()) {
|
||||
Logger::warning(
|
||||
"Could not find snapshot file for " + this->snapshotId.toStdString() + " - expected path: "
|
||||
+ snapshotFilePath.toStdString()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
snapshotFile.remove();
|
||||
if (!snapshotFile.exists()) {
|
||||
Logger::warning(
|
||||
"Could not find snapshot file for " + this->snapshotId.toStdString() + " - expected path: "
|
||||
+ snapshotFilePath.toStdString()
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
snapshotFile.remove();
|
||||
}
|
||||
|
||||
@@ -6,24 +6,21 @@
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class DeleteMemorySnapshot: public InsightWorkerTask
|
||||
{
|
||||
class DeleteMemorySnapshot: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DeleteMemorySnapshot(const QString& snapshotId, Targets::TargetMemoryType memoryType);
|
||||
public:
|
||||
DeleteMemorySnapshot(const QString& snapshotId, Targets::TargetMemoryType memoryType);
|
||||
|
||||
QString brief() const override {
|
||||
return "Deleting memory snapshot " + this->snapshotId;
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Deleting memory snapshot " + this->snapshotId;
|
||||
}
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
QString snapshotId;
|
||||
Targets::TargetMemoryType memoryType;
|
||||
};
|
||||
}
|
||||
private:
|
||||
QString snapshotId;
|
||||
Targets::TargetMemoryType memoryType;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "GetTargetDescriptor.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void GetTargetDescriptor::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetDescriptor(targetControllerService.getTargetDescriptor());
|
||||
}
|
||||
void GetTargetDescriptor::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetDescriptor(targetControllerService.getTargetDescriptor());
|
||||
}
|
||||
|
||||
@@ -4,29 +4,26 @@
|
||||
|
||||
#include "src/Targets/TargetDescriptor.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class GetTargetDescriptor: public InsightWorkerTask
|
||||
{
|
||||
class GetTargetDescriptor: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GetTargetDescriptor() = default;
|
||||
public:
|
||||
GetTargetDescriptor() = default;
|
||||
|
||||
QString brief() const override {
|
||||
return "Obtaining target descriptor";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Obtaining target descriptor";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void targetDescriptor(Targets::TargetDescriptor targetDescriptor);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void targetDescriptor(Targets::TargetDescriptor targetDescriptor);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "GetTargetState.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void GetTargetState::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetState(targetControllerService.getTargetState());
|
||||
}
|
||||
void GetTargetState::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetState(targetControllerService.getTargetState());
|
||||
}
|
||||
|
||||
@@ -4,29 +4,26 @@
|
||||
|
||||
#include "src/Targets/TargetState.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class GetTargetState: public InsightWorkerTask
|
||||
{
|
||||
class GetTargetState: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
GetTargetState() = default;
|
||||
public:
|
||||
GetTargetState() = default;
|
||||
|
||||
QString brief() const override {
|
||||
return "Obtaining target state";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Obtaining target state";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void targetState(Targets::TargetState state);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void targetState(Targets::TargetState state);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
|
||||
@@ -2,36 +2,33 @@
|
||||
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
InsightWorkerTask::InsightWorkerTask()
|
||||
: QObject(nullptr)
|
||||
{}
|
||||
InsightWorkerTask::InsightWorkerTask()
|
||||
: QObject(nullptr)
|
||||
{}
|
||||
|
||||
void InsightWorkerTask::execute(TargetControllerService& targetControllerService) {
|
||||
try {
|
||||
this->state = InsightWorkerTaskState::STARTED;
|
||||
emit this->started();
|
||||
void InsightWorkerTask::execute(TargetControllerService& targetControllerService) {
|
||||
try {
|
||||
this->state = InsightWorkerTaskState::STARTED;
|
||||
emit this->started();
|
||||
|
||||
this->run(targetControllerService);
|
||||
this->run(targetControllerService);
|
||||
|
||||
this->state = InsightWorkerTaskState::COMPLETED;
|
||||
this->setProgressPercentage(100);
|
||||
emit this->completed();
|
||||
this->state = InsightWorkerTaskState::COMPLETED;
|
||||
this->setProgressPercentage(100);
|
||||
emit this->completed();
|
||||
|
||||
} catch (std::exception& exception) {
|
||||
this->state = InsightWorkerTaskState::FAILED;
|
||||
Logger::debug("InsightWorker task failed - " + std::string(exception.what()));
|
||||
emit this->failed(QString::fromStdString(exception.what()));
|
||||
}
|
||||
|
||||
emit this->finished();
|
||||
} catch (std::exception& exception) {
|
||||
this->state = InsightWorkerTaskState::FAILED;
|
||||
Logger::debug("InsightWorker task failed - " + std::string(exception.what()));
|
||||
emit this->failed(QString::fromStdString(exception.what()));
|
||||
}
|
||||
|
||||
void InsightWorkerTask::setProgressPercentage(std::uint8_t percentage) {
|
||||
this->progressPercentage = percentage;
|
||||
emit this->progressUpdate(this->progressPercentage);
|
||||
}
|
||||
emit this->finished();
|
||||
}
|
||||
|
||||
void InsightWorkerTask::setProgressPercentage(std::uint8_t percentage) {
|
||||
this->progressPercentage = percentage;
|
||||
emit this->progressUpdate(this->progressPercentage);
|
||||
}
|
||||
|
||||
@@ -8,81 +8,78 @@
|
||||
#include "TaskGroup.hpp"
|
||||
#include "src/Services/TargetControllerService.hpp"
|
||||
|
||||
namespace Bloom
|
||||
enum class InsightWorkerTaskState: std::uint8_t
|
||||
{
|
||||
enum class InsightWorkerTaskState: std::uint8_t
|
||||
{
|
||||
CREATED,
|
||||
STARTED,
|
||||
FAILED,
|
||||
COMPLETED,
|
||||
CREATED,
|
||||
STARTED,
|
||||
FAILED,
|
||||
COMPLETED,
|
||||
};
|
||||
|
||||
static_assert(std::atomic<InsightWorkerTaskState>::is_always_lock_free);
|
||||
static_assert(std::atomic<std::uint8_t>::is_always_lock_free);
|
||||
|
||||
class InsightWorkerTask: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
using IdType = std::uint64_t;
|
||||
const InsightWorkerTask::IdType id = ++(InsightWorkerTask::lastId);
|
||||
std::atomic<InsightWorkerTaskState> state = InsightWorkerTaskState::CREATED;
|
||||
std::atomic<std::uint8_t> progressPercentage = 0;
|
||||
|
||||
InsightWorkerTask();
|
||||
|
||||
virtual QString brief() const = 0;
|
||||
|
||||
virtual TaskGroups taskGroups() const {
|
||||
return TaskGroups();
|
||||
};
|
||||
|
||||
static_assert(std::atomic<InsightWorkerTaskState>::is_always_lock_free);
|
||||
static_assert(std::atomic<std::uint8_t>::is_always_lock_free);
|
||||
void execute(Services::TargetControllerService& targetControllerService);
|
||||
|
||||
class InsightWorkerTask: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
signals:
|
||||
/**
|
||||
* The InsightWorkerTask::started() signal will be emitted once the task has started (InsightWorker::run() is
|
||||
* called)
|
||||
*/
|
||||
void started();
|
||||
|
||||
public:
|
||||
using IdType = std::uint64_t;
|
||||
const InsightWorkerTask::IdType id = ++(InsightWorkerTask::lastId);
|
||||
std::atomic<InsightWorkerTaskState> state = InsightWorkerTaskState::CREATED;
|
||||
std::atomic<std::uint8_t> progressPercentage = 0;
|
||||
/**
|
||||
* Some tasks will emit an InsightWorkerTask::progressUpdate() signal to provide an update on their progress.
|
||||
*
|
||||
* This is used for progress bar widgets.
|
||||
*
|
||||
* NOTE: A task doesn't have to emit this signal. Currently, the time-expensive tasks (like ReadTargetMemory)
|
||||
* emit this signal.
|
||||
*
|
||||
* @param progressPercentage
|
||||
* The task's current progress.
|
||||
*/
|
||||
void progressUpdate(std::uint8_t progressPercentage);
|
||||
|
||||
InsightWorkerTask();
|
||||
/**
|
||||
* The InsightWorkerTask::completed() signal will be emitted once the task has successfully completed.
|
||||
*/
|
||||
void completed();
|
||||
|
||||
virtual QString brief() const = 0;
|
||||
/**
|
||||
* The InsightWorkerTask::failed() signal will be emitted when the task fails (InsightWorkerTask::run() throws
|
||||
* an exception).
|
||||
*/
|
||||
void failed(QString errorMessage);
|
||||
|
||||
virtual TaskGroups taskGroups() const {
|
||||
return TaskGroups();
|
||||
};
|
||||
/**
|
||||
* The InsightWorkerTask::finished() signal will be emitted at the end of the task, regardless to whether it
|
||||
* completed successfully or failed.
|
||||
*/
|
||||
void finished();
|
||||
|
||||
void execute(Services::TargetControllerService& targetControllerService);
|
||||
protected:
|
||||
virtual void run(Services::TargetControllerService& targetControllerService) = 0;
|
||||
void setProgressPercentage(std::uint8_t percentage);
|
||||
|
||||
signals:
|
||||
/**
|
||||
* The InsightWorkerTask::started() signal will be emitted once the task has started (InsightWorker::run() is
|
||||
* called)
|
||||
*/
|
||||
void started();
|
||||
|
||||
/**
|
||||
* Some tasks will emit an InsightWorkerTask::progressUpdate() signal to provide an update on their progress.
|
||||
*
|
||||
* This is used for progress bar widgets.
|
||||
*
|
||||
* NOTE: A task doesn't have to emit this signal. Currently, the time-expensive tasks (like ReadTargetMemory)
|
||||
* emit this signal.
|
||||
*
|
||||
* @param progressPercentage
|
||||
* The task's current progress.
|
||||
*/
|
||||
void progressUpdate(std::uint8_t progressPercentage);
|
||||
|
||||
/**
|
||||
* The InsightWorkerTask::completed() signal will be emitted once the task has successfully completed.
|
||||
*/
|
||||
void completed();
|
||||
|
||||
/**
|
||||
* The InsightWorkerTask::failed() signal will be emitted when the task fails (InsightWorkerTask::run() throws
|
||||
* an exception).
|
||||
*/
|
||||
void failed(QString errorMessage);
|
||||
|
||||
/**
|
||||
* The InsightWorkerTask::finished() signal will be emitted at the end of the task, regardless to whether it
|
||||
* completed successfully or failed.
|
||||
*/
|
||||
void finished();
|
||||
|
||||
protected:
|
||||
virtual void run(Services::TargetControllerService& targetControllerService) = 0;
|
||||
void setProgressPercentage(std::uint8_t percentage);
|
||||
|
||||
private:
|
||||
static inline std::atomic<InsightWorkerTask::IdType> lastId = 0;
|
||||
};
|
||||
}
|
||||
private:
|
||||
static inline std::atomic<InsightWorkerTask::IdType> lastId = 0;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "ReadProgramCounter.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadProgramCounter::run(TargetControllerService& targetControllerService) {
|
||||
emit this->programCounterRead(targetControllerService.getProgramCounter());
|
||||
}
|
||||
void ReadProgramCounter::run(TargetControllerService& targetControllerService) {
|
||||
emit this->programCounterRead(targetControllerService.getProgramCounter());
|
||||
}
|
||||
|
||||
@@ -4,29 +4,26 @@
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class ReadProgramCounter: public InsightWorkerTask
|
||||
{
|
||||
class ReadProgramCounter: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ReadProgramCounter() = default;
|
||||
public:
|
||||
ReadProgramCounter() = default;
|
||||
|
||||
QString brief() const override {
|
||||
return "Reading program counter";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Reading program counter";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void programCounterRead(Targets::TargetProgramCounter programCounter);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void programCounterRead(Targets::TargetProgramCounter programCounter);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "ReadStackPointer.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadStackPointer::run(TargetControllerService& targetControllerService) {
|
||||
emit this->stackPointerRead(targetControllerService.getStackPointer());
|
||||
}
|
||||
void ReadStackPointer::run(TargetControllerService& targetControllerService) {
|
||||
emit this->stackPointerRead(targetControllerService.getStackPointer());
|
||||
}
|
||||
|
||||
@@ -4,29 +4,26 @@
|
||||
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class ReadStackPointer: public InsightWorkerTask
|
||||
{
|
||||
class ReadStackPointer: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ReadStackPointer() = default;
|
||||
public:
|
||||
ReadStackPointer() = default;
|
||||
|
||||
QString brief() const override {
|
||||
return "Reading stack pointer";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Reading stack pointer";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void stackPointerRead(Targets::TargetStackPointer stackPointer);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void stackPointerRead(Targets::TargetStackPointer stackPointer);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
};
|
||||
|
||||
@@ -6,54 +6,51 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadTargetMemory::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
void ReadTargetMemory::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
|
||||
const auto& targetDescriptor = targetControllerService.getTargetDescriptor();
|
||||
const auto memoryDescriptorIt = targetDescriptor.memoryDescriptorsByType.find(this->memoryType);
|
||||
const auto& targetDescriptor = targetControllerService.getTargetDescriptor();
|
||||
const auto memoryDescriptorIt = targetDescriptor.memoryDescriptorsByType.find(this->memoryType);
|
||||
|
||||
if (memoryDescriptorIt == targetDescriptor.memoryDescriptorsByType.end()) {
|
||||
throw Exceptions::Exception("Invalid memory type");
|
||||
}
|
||||
|
||||
const auto& memoryDescriptor = memoryDescriptorIt->second;
|
||||
|
||||
/*
|
||||
* To prevent locking up the TargetController for too long, we split the read into numerous reads.
|
||||
*
|
||||
* This allows the TargetController to service other commands in-between reads, reducing the likelihood of
|
||||
* command timeouts when we're reading lots of data.
|
||||
*/
|
||||
const auto readSize = std::max(
|
||||
TargetMemorySize(256),
|
||||
memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
|
||||
);
|
||||
const auto readsRequired = static_cast<std::uint32_t>(
|
||||
std::ceil(static_cast<float>(this->size) / static_cast<float>(readSize))
|
||||
);
|
||||
|
||||
Targets::TargetMemoryBuffer data;
|
||||
|
||||
for (std::uint32_t i = 0; i < readsRequired; i++) {
|
||||
auto dataSegment = targetControllerService.readMemory(
|
||||
this->memoryType,
|
||||
this->startAddress + static_cast<Targets::TargetMemoryAddress>(readSize * i),
|
||||
(this->size - data.size()) >= readSize
|
||||
? readSize
|
||||
: static_cast<Targets::TargetMemorySize>(this->size - data.size()),
|
||||
this->excludedAddressRanges
|
||||
);
|
||||
|
||||
std::move(dataSegment.begin(), dataSegment.end(), std::back_inserter(data));
|
||||
this->setProgressPercentage(static_cast<std::uint8_t>(
|
||||
(static_cast<float>(i) + 1) / (static_cast<float>(readsRequired) / 100)
|
||||
));
|
||||
}
|
||||
|
||||
emit this->targetMemoryRead(data);
|
||||
if (memoryDescriptorIt == targetDescriptor.memoryDescriptorsByType.end()) {
|
||||
throw Exceptions::Exception("Invalid memory type");
|
||||
}
|
||||
|
||||
const auto& memoryDescriptor = memoryDescriptorIt->second;
|
||||
|
||||
/*
|
||||
* To prevent locking up the TargetController for too long, we split the read into numerous reads.
|
||||
*
|
||||
* This allows the TargetController to service other commands in-between reads, reducing the likelihood of
|
||||
* command timeouts when we're reading lots of data.
|
||||
*/
|
||||
const auto readSize = std::max(
|
||||
TargetMemorySize(256),
|
||||
memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
|
||||
);
|
||||
const auto readsRequired = static_cast<std::uint32_t>(
|
||||
std::ceil(static_cast<float>(this->size) / static_cast<float>(readSize))
|
||||
);
|
||||
|
||||
Targets::TargetMemoryBuffer data;
|
||||
|
||||
for (std::uint32_t i = 0; i < readsRequired; i++) {
|
||||
auto dataSegment = targetControllerService.readMemory(
|
||||
this->memoryType,
|
||||
this->startAddress + static_cast<Targets::TargetMemoryAddress>(readSize * i),
|
||||
(this->size - data.size()) >= readSize
|
||||
? readSize
|
||||
: static_cast<Targets::TargetMemorySize>(this->size - data.size()),
|
||||
this->excludedAddressRanges
|
||||
);
|
||||
|
||||
std::move(dataSegment.begin(), dataSegment.end(), std::back_inserter(data));
|
||||
this->setProgressPercentage(static_cast<std::uint8_t>(
|
||||
(static_cast<float>(i) + 1) / (static_cast<float>(readsRequired) / 100)
|
||||
));
|
||||
}
|
||||
|
||||
emit this->targetMemoryRead(data);
|
||||
}
|
||||
|
||||
@@ -7,45 +7,42 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class ReadTargetMemory: public InsightWorkerTask
|
||||
{
|
||||
class ReadTargetMemory: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
ReadTargetMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
Targets::TargetMemorySize size,
|
||||
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
|
||||
)
|
||||
: memoryType(memoryType)
|
||||
, startAddress(startAddress)
|
||||
, size(size)
|
||||
, excludedAddressRanges(excludedAddressRanges)
|
||||
{}
|
||||
public:
|
||||
ReadTargetMemory(
|
||||
Targets::TargetMemoryType memoryType,
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
Targets::TargetMemorySize size,
|
||||
const std::set<Targets::TargetMemoryAddressRange>& excludedAddressRanges = {}
|
||||
)
|
||||
: memoryType(memoryType)
|
||||
, startAddress(startAddress)
|
||||
, size(size)
|
||||
, excludedAddressRanges(excludedAddressRanges)
|
||||
{}
|
||||
|
||||
QString brief() const override {
|
||||
return "Reading target " + EnumToStringMappings::targetMemoryTypes.at(this->memoryType).toUpper();
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Reading target " + EnumToStringMappings::targetMemoryTypes.at(this->memoryType).toUpper();
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void targetMemoryRead(Targets::TargetMemoryBuffer buffer);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetMemoryType memoryType;
|
||||
Targets::TargetMemoryAddress startAddress;
|
||||
Targets::TargetMemorySize size;
|
||||
std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void targetMemoryRead(Targets::TargetMemoryBuffer buffer);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetMemoryType memoryType;
|
||||
Targets::TargetMemoryAddress startAddress;
|
||||
Targets::TargetMemorySize size;
|
||||
std::set<Targets::TargetMemoryAddressRange> excludedAddressRanges;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "ReadTargetRegisters.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void ReadTargetRegisters::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetRegistersRead(targetControllerService.readRegisters(this->descriptorIds));
|
||||
}
|
||||
void ReadTargetRegisters::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetRegistersRead(targetControllerService.readRegisters(this->descriptorIds));
|
||||
}
|
||||
|
||||
@@ -3,34 +3,31 @@
|
||||
#include "InsightWorkerTask.hpp"
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class ReadTargetRegisters: public InsightWorkerTask
|
||||
{
|
||||
class ReadTargetRegisters: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit ReadTargetRegisters(const Targets::TargetRegisterDescriptorIds& descriptorIds)
|
||||
: descriptorIds(descriptorIds)
|
||||
{}
|
||||
public:
|
||||
explicit ReadTargetRegisters(const Targets::TargetRegisterDescriptorIds& descriptorIds)
|
||||
: descriptorIds(descriptorIds)
|
||||
{}
|
||||
|
||||
QString brief() const override {
|
||||
return "Reading " + QString::number(this->descriptorIds.size()) + " target register(s)";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Reading " + QString::number(this->descriptorIds.size()) + " target register(s)";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void targetRegistersRead(Targets::TargetRegisters registers);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetRegisterDescriptorIds descriptorIds;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void targetRegistersRead(Targets::TargetRegisters registers);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetRegisterDescriptorIds descriptorIds;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "RefreshTargetPinStates.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void RefreshTargetPinStates::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetPinStatesRetrieved(targetControllerService.getPinStates(this->variantId));
|
||||
}
|
||||
void RefreshTargetPinStates::run(TargetControllerService& targetControllerService) {
|
||||
emit this->targetPinStatesRetrieved(targetControllerService.getPinStates(this->variantId));
|
||||
}
|
||||
|
||||
@@ -4,34 +4,31 @@
|
||||
#include "src/Targets/TargetVariant.hpp"
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class RefreshTargetPinStates: public InsightWorkerTask
|
||||
{
|
||||
class RefreshTargetPinStates: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit RefreshTargetPinStates(int variantId)
|
||||
: variantId(variantId)
|
||||
{}
|
||||
public:
|
||||
explicit RefreshTargetPinStates(int variantId)
|
||||
: variantId(variantId)
|
||||
{}
|
||||
|
||||
QString brief() const override {
|
||||
return "Reading target pin states";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Reading target pin states";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
signals:
|
||||
void targetPinStatesRetrieved(Bloom::Targets::TargetPinStateMapping pinStatesByNumber);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
int variantId;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
signals:
|
||||
void targetPinStatesRetrieved(Targets::TargetPinStateMapping pinStatesByNumber);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
int variantId;
|
||||
};
|
||||
|
||||
@@ -10,64 +10,61 @@
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
#include "src/Logger/Logger.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
RetrieveMemorySnapshots::RetrieveMemorySnapshots(Targets::TargetMemoryType memoryType)
|
||||
: memoryType(memoryType)
|
||||
{}
|
||||
RetrieveMemorySnapshots::RetrieveMemorySnapshots(Targets::TargetMemoryType memoryType)
|
||||
: memoryType(memoryType)
|
||||
{}
|
||||
|
||||
void RetrieveMemorySnapshots::run(TargetControllerService& targetControllerService) {
|
||||
emit this->memorySnapshotsRetrieved(this->getSnapshots(this->memoryType));
|
||||
}
|
||||
|
||||
std::vector<MemorySnapshot> RetrieveMemorySnapshots::getSnapshots(Targets::TargetMemoryType memoryType) {
|
||||
constexpr auto MAX_SNAPSHOTS = 30;
|
||||
auto snapshotDir = QDir(QString::fromStdString(Services::PathService::projectSettingsDirPath())
|
||||
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(memoryType));
|
||||
|
||||
if (!snapshotDir.exists()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto snapshots = std::vector<MemorySnapshot>();
|
||||
|
||||
const auto snapshotFileEntries = snapshotDir.entryInfoList(
|
||||
QStringList("*.json"),
|
||||
QDir::Files,
|
||||
QDir::SortFlag::Time
|
||||
);
|
||||
|
||||
for (const auto& snapshotFileEntry : snapshotFileEntries) {
|
||||
auto snapshotFile = QFile(snapshotFileEntry.absoluteFilePath());
|
||||
|
||||
if (snapshots.size() >= MAX_SNAPSHOTS) {
|
||||
Logger::warning(
|
||||
"The total number of " + EnumToStringMappings::targetMemoryTypes.at(memoryType).toUpper().toStdString()
|
||||
+ " snapshots exceeds the hard limit of " + std::to_string(MAX_SNAPSHOTS)
|
||||
+ ". Only the most recent " + std::to_string(MAX_SNAPSHOTS) + " snapshots will be loaded."
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!snapshotFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
throw Exceptions::Exception("Failed to open snapshot file");
|
||||
}
|
||||
|
||||
snapshots.emplace_back(QJsonDocument::fromJson(snapshotFile.readAll()).object());
|
||||
|
||||
} catch (const Exceptions::Exception& exception) {
|
||||
Logger::error(
|
||||
"Failed to load snapshot " + snapshotFileEntry.absoluteFilePath().toStdString() + " - "
|
||||
+ exception.getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
snapshotFile.close();
|
||||
}
|
||||
|
||||
return snapshots;
|
||||
}
|
||||
void RetrieveMemorySnapshots::run(TargetControllerService& targetControllerService) {
|
||||
emit this->memorySnapshotsRetrieved(this->getSnapshots(this->memoryType));
|
||||
}
|
||||
|
||||
std::vector<MemorySnapshot> RetrieveMemorySnapshots::getSnapshots(Targets::TargetMemoryType memoryType) {
|
||||
constexpr auto MAX_SNAPSHOTS = 30;
|
||||
auto snapshotDir = QDir(QString::fromStdString(Services::PathService::projectSettingsDirPath())
|
||||
+ "/memory_snapshots/" + EnumToStringMappings::targetMemoryTypes.at(memoryType));
|
||||
|
||||
if (!snapshotDir.exists()) {
|
||||
return {};
|
||||
}
|
||||
|
||||
auto snapshots = std::vector<MemorySnapshot>();
|
||||
|
||||
const auto snapshotFileEntries = snapshotDir.entryInfoList(
|
||||
QStringList("*.json"),
|
||||
QDir::Files,
|
||||
QDir::SortFlag::Time
|
||||
);
|
||||
|
||||
for (const auto& snapshotFileEntry : snapshotFileEntries) {
|
||||
auto snapshotFile = QFile(snapshotFileEntry.absoluteFilePath());
|
||||
|
||||
if (snapshots.size() >= MAX_SNAPSHOTS) {
|
||||
Logger::warning(
|
||||
"The total number of " + EnumToStringMappings::targetMemoryTypes.at(memoryType).toUpper().toStdString()
|
||||
+ " snapshots exceeds the hard limit of " + std::to_string(MAX_SNAPSHOTS)
|
||||
+ ". Only the most recent " + std::to_string(MAX_SNAPSHOTS) + " snapshots will be loaded."
|
||||
);
|
||||
break;
|
||||
}
|
||||
|
||||
try {
|
||||
if (!snapshotFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
throw Exceptions::Exception("Failed to open snapshot file");
|
||||
}
|
||||
|
||||
snapshots.emplace_back(QJsonDocument::fromJson(snapshotFile.readAll()).object());
|
||||
|
||||
} catch (const Exceptions::Exception& exception) {
|
||||
Logger::error(
|
||||
"Failed to load snapshot " + snapshotFileEntry.absoluteFilePath().toStdString() + " - "
|
||||
+ exception.getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
snapshotFile.close();
|
||||
}
|
||||
|
||||
return snapshots;
|
||||
}
|
||||
|
||||
@@ -8,29 +8,26 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/MemorySnapshot.hpp"
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class RetrieveMemorySnapshots: public InsightWorkerTask
|
||||
{
|
||||
class RetrieveMemorySnapshots: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
RetrieveMemorySnapshots(Targets::TargetMemoryType memoryType);
|
||||
public:
|
||||
RetrieveMemorySnapshots(Targets::TargetMemoryType memoryType);
|
||||
|
||||
QString brief() const override {
|
||||
return "Loading saved " + EnumToStringMappings::targetMemoryTypes.at(this->memoryType).toUpper()
|
||||
+ " memory snapshots";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Loading saved " + EnumToStringMappings::targetMemoryTypes.at(this->memoryType).toUpper()
|
||||
+ " memory snapshots";
|
||||
}
|
||||
|
||||
signals:
|
||||
void memorySnapshotsRetrieved(std::vector<MemorySnapshot> snapshots);
|
||||
signals:
|
||||
void memorySnapshotsRetrieved(std::vector<MemorySnapshot> snapshots);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetMemoryType memoryType;
|
||||
private:
|
||||
Targets::TargetMemoryType memoryType;
|
||||
|
||||
std::vector<MemorySnapshot> getSnapshots(Targets::TargetMemoryType memoryType);
|
||||
};
|
||||
}
|
||||
std::vector<MemorySnapshot> getSnapshots(Targets::TargetMemoryType memoryType);
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "SetTargetPinState.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void SetTargetPinState::run(TargetControllerService& targetControllerService) {
|
||||
targetControllerService.setPinState(this->pinDescriptor, this->pinState);
|
||||
}
|
||||
void SetTargetPinState::run(TargetControllerService& targetControllerService) {
|
||||
targetControllerService.setPinState(this->pinDescriptor, this->pinState);
|
||||
}
|
||||
|
||||
@@ -3,33 +3,30 @@
|
||||
#include "InsightWorkerTask.hpp"
|
||||
#include "src/Targets/TargetPinDescriptor.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class SetTargetPinState: public InsightWorkerTask
|
||||
{
|
||||
class SetTargetPinState: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
SetTargetPinState(const Targets::TargetPinDescriptor& pinDescriptor, const Targets::TargetPinState& pinState)
|
||||
: pinDescriptor(pinDescriptor)
|
||||
, pinState(pinState)
|
||||
{}
|
||||
public:
|
||||
SetTargetPinState(const Targets::TargetPinDescriptor& pinDescriptor, const Targets::TargetPinState& pinState)
|
||||
: pinDescriptor(pinDescriptor)
|
||||
, pinState(pinState)
|
||||
{}
|
||||
|
||||
QString brief() const override {
|
||||
return "Updating target pin state";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Updating target pin state";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
Targets::TargetPinState pinState;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetPinDescriptor pinDescriptor;
|
||||
Targets::TargetPinState pinState;
|
||||
};
|
||||
|
||||
@@ -3,12 +3,9 @@
|
||||
#include <cstdint>
|
||||
#include <set>
|
||||
|
||||
namespace Bloom
|
||||
enum class TaskGroup: std::uint16_t
|
||||
{
|
||||
enum class TaskGroup: std::uint16_t
|
||||
{
|
||||
USES_TARGET_CONTROLLER,
|
||||
};
|
||||
USES_TARGET_CONTROLLER,
|
||||
};
|
||||
|
||||
using TaskGroups = std::set<TaskGroup>;
|
||||
}
|
||||
using TaskGroups = std::set<TaskGroup>;
|
||||
|
||||
@@ -6,69 +6,66 @@
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void WriteTargetMemory::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
void WriteTargetMemory::run(TargetControllerService& targetControllerService) {
|
||||
using Targets::TargetMemorySize;
|
||||
|
||||
if (!this->memoryDescriptor.access.writeableDuringDebugSession) {
|
||||
throw Exceptions::Exception("Invalid request - cannot write to this memory type during a debug session.");
|
||||
}
|
||||
|
||||
/*
|
||||
* To prevent locking up the TargetController for too long, we split the write operation into numerous
|
||||
* operations.
|
||||
*
|
||||
* This allows the TargetController to service other commands in-between reads, reducing the likelihood of
|
||||
* command timeouts when we're writing lots of data.
|
||||
*/
|
||||
const auto maxBlockSize = std::max(
|
||||
TargetMemorySize(256),
|
||||
this->memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
|
||||
);
|
||||
|
||||
const TargetMemorySize totalBytesToWrite = std::accumulate(
|
||||
this->blocks.begin(),
|
||||
this->blocks.end(),
|
||||
TargetMemorySize{0},
|
||||
[] (TargetMemorySize bytes, const Block& block) {
|
||||
return bytes + block.data.size();
|
||||
}
|
||||
);
|
||||
|
||||
TargetMemorySize totalBytesWritten = 0;
|
||||
|
||||
for (const auto& block : this->blocks) {
|
||||
const auto totalBytes = block.data.size();
|
||||
|
||||
TargetMemorySize bytesWritten = 0;
|
||||
|
||||
while (bytesWritten < totalBytes) {
|
||||
const auto bytesToWrite = std::min(
|
||||
maxBlockSize,
|
||||
static_cast<decltype(maxBlockSize)>(totalBytes - bytesWritten)
|
||||
);
|
||||
|
||||
targetControllerService.writeMemory(
|
||||
this->memoryDescriptor.type,
|
||||
block.startAddress + bytesWritten,
|
||||
Targets::TargetMemoryBuffer(
|
||||
block.data.begin() + bytesWritten,
|
||||
block.data.begin() + bytesWritten + bytesToWrite
|
||||
)
|
||||
);
|
||||
|
||||
bytesWritten += bytesToWrite;
|
||||
totalBytesWritten += bytesToWrite;
|
||||
|
||||
this->setProgressPercentage(static_cast<std::uint8_t>(
|
||||
(static_cast<float>(totalBytesWritten) + 1) / (static_cast<float>(totalBytesToWrite) / 100)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
emit this->targetMemoryWritten(totalBytesWritten);
|
||||
if (!this->memoryDescriptor.access.writeableDuringDebugSession) {
|
||||
throw Exceptions::Exception("Invalid request - cannot write to this memory type during a debug session.");
|
||||
}
|
||||
|
||||
/*
|
||||
* To prevent locking up the TargetController for too long, we split the write operation into numerous
|
||||
* operations.
|
||||
*
|
||||
* This allows the TargetController to service other commands in-between reads, reducing the likelihood of
|
||||
* command timeouts when we're writing lots of data.
|
||||
*/
|
||||
const auto maxBlockSize = std::max(
|
||||
TargetMemorySize(256),
|
||||
this->memoryDescriptor.pageSize.value_or(TargetMemorySize(0))
|
||||
);
|
||||
|
||||
const TargetMemorySize totalBytesToWrite = std::accumulate(
|
||||
this->blocks.begin(),
|
||||
this->blocks.end(),
|
||||
TargetMemorySize{0},
|
||||
[] (TargetMemorySize bytes, const Block& block) {
|
||||
return bytes + block.data.size();
|
||||
}
|
||||
);
|
||||
|
||||
TargetMemorySize totalBytesWritten = 0;
|
||||
|
||||
for (const auto& block : this->blocks) {
|
||||
const auto totalBytes = block.data.size();
|
||||
|
||||
TargetMemorySize bytesWritten = 0;
|
||||
|
||||
while (bytesWritten < totalBytes) {
|
||||
const auto bytesToWrite = std::min(
|
||||
maxBlockSize,
|
||||
static_cast<decltype(maxBlockSize)>(totalBytes - bytesWritten)
|
||||
);
|
||||
|
||||
targetControllerService.writeMemory(
|
||||
this->memoryDescriptor.type,
|
||||
block.startAddress + bytesWritten,
|
||||
Targets::TargetMemoryBuffer(
|
||||
block.data.begin() + bytesWritten,
|
||||
block.data.begin() + bytesWritten + bytesToWrite
|
||||
)
|
||||
);
|
||||
|
||||
bytesWritten += bytesToWrite;
|
||||
totalBytesWritten += bytesToWrite;
|
||||
|
||||
this->setProgressPercentage(static_cast<std::uint8_t>(
|
||||
(static_cast<float>(totalBytesWritten) + 1) / (static_cast<float>(totalBytesToWrite) / 100)
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
emit this->targetMemoryWritten(totalBytesWritten);
|
||||
}
|
||||
|
||||
@@ -7,67 +7,64 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "src/Helpers/EnumToStringMappings.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class WriteTargetMemory: public InsightWorkerTask
|
||||
{
|
||||
class WriteTargetMemory: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
/*
|
||||
* A Block is just a block of contiguous data to write. A single WriteTargetMemory task can write multiple
|
||||
* blocks to a particular memory.
|
||||
*/
|
||||
struct Block {
|
||||
Targets::TargetMemoryAddress startAddress;
|
||||
const Targets::TargetMemoryBuffer data;
|
||||
public:
|
||||
/*
|
||||
* A Block is just a block of contiguous data to write. A single WriteTargetMemory task can write multiple
|
||||
* blocks to a particular memory.
|
||||
*/
|
||||
struct Block {
|
||||
Targets::TargetMemoryAddress startAddress;
|
||||
const Targets::TargetMemoryBuffer data;
|
||||
|
||||
Block(
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
const Targets::TargetMemoryBuffer& data
|
||||
)
|
||||
: startAddress(startAddress)
|
||||
, data(data)
|
||||
{}
|
||||
};
|
||||
|
||||
WriteTargetMemory(
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
std::vector<Block>&& blocks
|
||||
)
|
||||
: memoryDescriptor(memoryDescriptor)
|
||||
, blocks(std::move(blocks))
|
||||
{}
|
||||
|
||||
WriteTargetMemory(
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
Block(
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
const Targets::TargetMemoryBuffer& data
|
||||
)
|
||||
: WriteTargetMemory(memoryDescriptor, std::vector<Block>({{startAddress, data}}))
|
||||
: startAddress(startAddress)
|
||||
, data(data)
|
||||
{}
|
||||
|
||||
QString brief() const override {
|
||||
return
|
||||
"Writing to target " + EnumToStringMappings::targetMemoryTypes.at(
|
||||
this->memoryDescriptor.type
|
||||
).toUpper();
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
}
|
||||
|
||||
signals:
|
||||
void targetMemoryWritten(Targets::TargetMemorySize bytesWritten);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetMemoryDescriptor memoryDescriptor;
|
||||
std::vector<Block> blocks;
|
||||
};
|
||||
}
|
||||
|
||||
WriteTargetMemory(
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
std::vector<Block>&& blocks
|
||||
)
|
||||
: memoryDescriptor(memoryDescriptor)
|
||||
, blocks(std::move(blocks))
|
||||
{}
|
||||
|
||||
WriteTargetMemory(
|
||||
const Targets::TargetMemoryDescriptor& memoryDescriptor,
|
||||
Targets::TargetMemoryAddress startAddress,
|
||||
const Targets::TargetMemoryBuffer& data
|
||||
)
|
||||
: WriteTargetMemory(memoryDescriptor, std::vector<Block>({{startAddress, data}}))
|
||||
{}
|
||||
|
||||
QString brief() const override {
|
||||
return
|
||||
"Writing to target " + EnumToStringMappings::targetMemoryTypes.at(
|
||||
this->memoryDescriptor.type
|
||||
).toUpper();
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
}
|
||||
|
||||
signals:
|
||||
void targetMemoryWritten(Targets::TargetMemorySize bytesWritten);
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetMemoryDescriptor memoryDescriptor;
|
||||
std::vector<Block> blocks;
|
||||
};
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
#include "WriteTargetRegister.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using Services::TargetControllerService;
|
||||
using Services::TargetControllerService;
|
||||
|
||||
void WriteTargetRegister::run(TargetControllerService& targetControllerService) {
|
||||
targetControllerService.writeRegisters({this->targetRegister});
|
||||
}
|
||||
void WriteTargetRegister::run(TargetControllerService& targetControllerService) {
|
||||
targetControllerService.writeRegisters({this->targetRegister});
|
||||
}
|
||||
|
||||
@@ -3,31 +3,28 @@
|
||||
#include "InsightWorkerTask.hpp"
|
||||
#include "src/Targets/TargetRegister.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class WriteTargetRegister: public InsightWorkerTask
|
||||
{
|
||||
class WriteTargetRegister: public InsightWorkerTask
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit WriteTargetRegister(const Targets::TargetRegister& targetRegister)
|
||||
: targetRegister(targetRegister)
|
||||
{}
|
||||
public:
|
||||
explicit WriteTargetRegister(const Targets::TargetRegister& targetRegister)
|
||||
: targetRegister(targetRegister)
|
||||
{}
|
||||
|
||||
QString brief() const override {
|
||||
return "Writing target register";
|
||||
}
|
||||
QString brief() const override {
|
||||
return "Writing target register";
|
||||
}
|
||||
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetRegister targetRegister;
|
||||
TaskGroups taskGroups() const override {
|
||||
return TaskGroups({
|
||||
TaskGroup::USES_TARGET_CONTROLLER,
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
protected:
|
||||
void run(Services::TargetControllerService& targetControllerService) override;
|
||||
|
||||
private:
|
||||
Targets::TargetRegister targetRegister;
|
||||
};
|
||||
|
||||
@@ -8,39 +8,36 @@
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Application.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using namespace Exceptions;
|
||||
using namespace Exceptions;
|
||||
|
||||
AboutWindow::AboutWindow(QWidget* parent): QObject(parent) {
|
||||
auto aboutWindowUiFile = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui"
|
||||
)
|
||||
);
|
||||
auto aboutWindowStylesheet = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss"
|
||||
)
|
||||
);
|
||||
AboutWindow::AboutWindow(QWidget* parent): QObject(parent) {
|
||||
auto aboutWindowUiFile = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/UiFiles/AboutWindow.ui"
|
||||
)
|
||||
);
|
||||
auto aboutWindowStylesheet = QFile(QString::fromStdString(
|
||||
Services::PathService::compiledResourcesPath()
|
||||
+ "/src/Insight/UserInterfaces/InsightWindow/Stylesheets/AboutWindow.qss"
|
||||
)
|
||||
);
|
||||
|
||||
if (!aboutWindowUiFile.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow UI file");
|
||||
}
|
||||
if (!aboutWindowUiFile.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow UI file");
|
||||
}
|
||||
|
||||
if (!aboutWindowStylesheet.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow QSS file");
|
||||
}
|
||||
if (!aboutWindowStylesheet.open(QFile::ReadOnly)) {
|
||||
throw Exception("Failed to open AboutWindow QSS file");
|
||||
}
|
||||
|
||||
auto uiLoader = UiLoader(this);
|
||||
this->windowWidget = uiLoader.load(&aboutWindowUiFile, parent);
|
||||
this->windowWidget->setStyleSheet(aboutWindowStylesheet.readAll());
|
||||
this->windowWidget->setFixedSize(400, 300);
|
||||
auto uiLoader = UiLoader(this);
|
||||
this->windowWidget = uiLoader.load(&aboutWindowUiFile, parent);
|
||||
this->windowWidget->setStyleSheet(aboutWindowStylesheet.readAll());
|
||||
this->windowWidget->setFixedSize(400, 300);
|
||||
|
||||
auto versionLabel = this->windowWidget->findChild<Widgets::Label*>("version-label");
|
||||
auto versionLabel = this->windowWidget->findChild<Widgets::Label*>("version-label");
|
||||
|
||||
if (versionLabel != nullptr) {
|
||||
versionLabel->setText("Bloom v" + QString::fromStdString(Application::VERSION.toString()));
|
||||
}
|
||||
if (versionLabel != nullptr) {
|
||||
versionLabel->setText("Bloom v" + QString::fromStdString(Application::VERSION.toString()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,25 +5,22 @@
|
||||
#include <QtUiTools/QtUiTools>
|
||||
#include <memory>
|
||||
|
||||
namespace Bloom
|
||||
class AboutWindow: public QObject
|
||||
{
|
||||
class AboutWindow: public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit AboutWindow(QWidget* parent);
|
||||
public:
|
||||
explicit AboutWindow(QWidget* parent);
|
||||
|
||||
void show() {
|
||||
if (this->windowWidget != nullptr) {
|
||||
this->windowWidget->move(
|
||||
this->windowWidget->parentWidget()->geometry().center() - this->windowWidget->rect().center()
|
||||
);
|
||||
this->windowWidget->show();
|
||||
}
|
||||
void show() {
|
||||
if (this->windowWidget != nullptr) {
|
||||
this->windowWidget->move(
|
||||
this->windowWidget->parentWidget()->geometry().center() - this->windowWidget->rect().center()
|
||||
);
|
||||
this->windowWidget->show();
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
QWidget* windowWidget = nullptr;
|
||||
};
|
||||
}
|
||||
private:
|
||||
QWidget* windowWidget = nullptr;
|
||||
};
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
#include "BloomProxyStyle.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
int BloomProxyStyle::styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option,
|
||||
const QWidget* widget,
|
||||
QStyleHintReturn* returnData
|
||||
) const {
|
||||
if (hint == QStyle::SH_ComboBox_Popup) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
int BloomProxyStyle::styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option,
|
||||
const QWidget* widget,
|
||||
QStyleHintReturn* returnData
|
||||
) const {
|
||||
if (hint == QStyle::SH_ComboBox_Popup) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||
}
|
||||
|
||||
@@ -2,18 +2,15 @@
|
||||
|
||||
#include <QProxyStyle>
|
||||
|
||||
namespace Bloom
|
||||
class BloomProxyStyle: public QProxyStyle
|
||||
{
|
||||
class BloomProxyStyle: public QProxyStyle
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
int styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option = nullptr,
|
||||
const QWidget* widget = nullptr,
|
||||
QStyleHintReturn* returnData = nullptr
|
||||
) const override;
|
||||
};
|
||||
}
|
||||
public:
|
||||
int styleHint(
|
||||
StyleHint hint,
|
||||
const QStyleOption* option = nullptr,
|
||||
const QWidget* widget = nullptr,
|
||||
QStyleHintReturn* returnData = nullptr
|
||||
) const override;
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -25,107 +25,104 @@
|
||||
#include "Widgets/TaskIndicator/TaskIndicator.hpp"
|
||||
#include "AboutWindow.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class InsightWindow: public QMainWindow
|
||||
{
|
||||
class InsightWindow: public QMainWindow
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
InsightWindow(
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
const Targets::TargetDescriptor& targetDescriptor
|
||||
);
|
||||
public:
|
||||
InsightWindow(
|
||||
const EnvironmentConfig& environmentConfig,
|
||||
const InsightConfig& insightConfig,
|
||||
InsightProjectSettings& insightProjectSettings,
|
||||
const Targets::TargetDescriptor& targetDescriptor
|
||||
);
|
||||
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent* event) override;
|
||||
void showEvent(QShowEvent* event) override;
|
||||
void closeEvent(QCloseEvent* event) override;
|
||||
|
||||
private:
|
||||
InsightProjectSettings& insightProjectSettings;
|
||||
private:
|
||||
InsightProjectSettings& insightProjectSettings;
|
||||
|
||||
InsightConfig insightConfig;
|
||||
EnvironmentConfig environmentConfig;
|
||||
TargetConfig targetConfig;
|
||||
InsightConfig insightConfig;
|
||||
EnvironmentConfig environmentConfig;
|
||||
TargetConfig targetConfig;
|
||||
|
||||
const Targets::TargetDescriptor& targetDescriptor;
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
const Targets::TargetDescriptor& targetDescriptor;
|
||||
Targets::TargetState targetState = Targets::TargetState::UNKNOWN;
|
||||
|
||||
QWidget* windowContainer = nullptr;
|
||||
QMenuBar* mainMenuBar = nullptr;
|
||||
QWidget* layoutContainer = nullptr;
|
||||
QWidget* container = nullptr;
|
||||
QMenu* variantMenu = nullptr;
|
||||
Widgets::Label* targetNameLabel = nullptr;
|
||||
Widgets::Label* targetIdLabel = nullptr;
|
||||
AboutWindow* aboutWindowWidget = nullptr;
|
||||
QWidget* windowContainer = nullptr;
|
||||
QMenuBar* mainMenuBar = nullptr;
|
||||
QWidget* layoutContainer = nullptr;
|
||||
QWidget* container = nullptr;
|
||||
QMenu* variantMenu = nullptr;
|
||||
Widgets::Label* targetNameLabel = nullptr;
|
||||
Widgets::Label* targetIdLabel = nullptr;
|
||||
AboutWindow* aboutWindowWidget = nullptr;
|
||||
|
||||
QWidget* header = nullptr;
|
||||
Widgets::SvgToolButton* refreshIoInspectionButton = nullptr;
|
||||
QWidget* header = nullptr;
|
||||
Widgets::SvgToolButton* refreshIoInspectionButton = nullptr;
|
||||
|
||||
QWidget* leftMenuBar = nullptr;
|
||||
Widgets::PanelWidget* leftPanel = nullptr;
|
||||
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
||||
QToolButton* targetRegistersButton = nullptr;
|
||||
QWidget* leftMenuBar = nullptr;
|
||||
Widgets::PanelWidget* leftPanel = nullptr;
|
||||
Widgets::TargetRegistersPaneWidget* targetRegistersSidePane = nullptr;
|
||||
QToolButton* targetRegistersButton = nullptr;
|
||||
|
||||
Widgets::Label* ioUnavailableWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
||||
Widgets::Label* ioUnavailableWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidgetContainer* ioContainerWidget = nullptr;
|
||||
Widgets::InsightTargetWidgets::TargetPackageWidget* targetPackageWidget = nullptr;
|
||||
|
||||
QWidget* bottomMenuBar = nullptr;
|
||||
Widgets::PanelWidget* bottomPanel = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* ramInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* eepromInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* flashInspectionPane = nullptr;
|
||||
std::map<
|
||||
Targets::TargetMemoryType,
|
||||
Widgets::TargetMemoryInspectionPaneSettings
|
||||
> memoryInspectionPaneSettingsByMemoryType;
|
||||
QToolButton* ramInspectionButton = nullptr;
|
||||
QToolButton* eepromInspectionButton = nullptr;
|
||||
QToolButton* flashInspectionButton = nullptr;
|
||||
QWidget* bottomMenuBar = nullptr;
|
||||
Widgets::PanelWidget* bottomPanel = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* ramInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* eepromInspectionPane = nullptr;
|
||||
Widgets::TargetMemoryInspectionPane* flashInspectionPane = nullptr;
|
||||
std::map<
|
||||
Targets::TargetMemoryType,
|
||||
Widgets::TargetMemoryInspectionPaneSettings
|
||||
> memoryInspectionPaneSettingsByMemoryType;
|
||||
QToolButton* ramInspectionButton = nullptr;
|
||||
QToolButton* eepromInspectionButton = nullptr;
|
||||
QToolButton* flashInspectionButton = nullptr;
|
||||
|
||||
QWidget* footer = nullptr;
|
||||
Widgets::Label* targetStatusLabel = nullptr;
|
||||
Widgets::Label* programCounterValueLabel = nullptr;
|
||||
Widgets::TaskIndicator* taskIndicator = nullptr;
|
||||
QWidget* footer = nullptr;
|
||||
Widgets::Label* targetStatusLabel = nullptr;
|
||||
Widgets::Label* programCounterValueLabel = nullptr;
|
||||
Widgets::TaskIndicator* taskIndicator = nullptr;
|
||||
|
||||
std::map<QString, Targets::TargetVariant> supportedVariantsByName;
|
||||
const Targets::TargetVariant* selectedVariant = nullptr;
|
||||
std::optional<Targets::TargetVariant> previouslySelectedVariant;
|
||||
bool uiDisabled = false;
|
||||
std::map<QString, Targets::TargetVariant> supportedVariantsByName;
|
||||
const Targets::TargetVariant* selectedVariant = nullptr;
|
||||
std::optional<Targets::TargetVariant> previouslySelectedVariant;
|
||||
bool uiDisabled = false;
|
||||
|
||||
static bool isVariantSupported(const Targets::TargetVariant& variant);
|
||||
static bool isVariantSupported(const Targets::TargetVariant& variant);
|
||||
|
||||
void setUiDisabled(bool disable);
|
||||
void setUiDisabled(bool disable);
|
||||
|
||||
void populateVariantMenu();
|
||||
void selectDefaultVariant();
|
||||
void selectVariant(const Targets::TargetVariant* variant);
|
||||
void createPanes();
|
||||
void populateVariantMenu();
|
||||
void selectDefaultVariant();
|
||||
void selectVariant(const Targets::TargetVariant* variant);
|
||||
void createPanes();
|
||||
|
||||
void adjustPanels();
|
||||
void adjustMinimumSize();
|
||||
void adjustPanels();
|
||||
void adjustMinimumSize();
|
||||
|
||||
void onTargetStateUpdate(Targets::TargetState newState);
|
||||
void refresh();
|
||||
void refreshPinStates();
|
||||
void refreshProgramCounter(std::optional<std::function<void(void)>> callback = std::nullopt);
|
||||
void openReportIssuesUrl();
|
||||
void openGettingStartedUrl();
|
||||
void openAboutWindow();
|
||||
void toggleTargetRegistersPane();
|
||||
void toggleRamInspectionPane();
|
||||
void toggleEepromInspectionPane();
|
||||
void toggleFlashInspectionPane();
|
||||
void onRegistersPaneStateChanged();
|
||||
void onRamInspectionPaneStateChanged();
|
||||
void onEepromInspectionPaneStateChanged();
|
||||
void onFlashInspectionPaneStateChanged();
|
||||
void onProgrammingModeEnabled();
|
||||
void onProgrammingModeDisabled();
|
||||
};
|
||||
}
|
||||
void onTargetStateUpdate(Targets::TargetState newState);
|
||||
void refresh();
|
||||
void refreshPinStates();
|
||||
void refreshProgramCounter(std::optional<std::function<void(void)>> callback = std::nullopt);
|
||||
void openReportIssuesUrl();
|
||||
void openGettingStartedUrl();
|
||||
void openAboutWindow();
|
||||
void toggleTargetRegistersPane();
|
||||
void toggleRamInspectionPane();
|
||||
void toggleEepromInspectionPane();
|
||||
void toggleFlashInspectionPane();
|
||||
void onRegistersPaneStateChanged();
|
||||
void onRamInspectionPaneStateChanged();
|
||||
void onEepromInspectionPaneStateChanged();
|
||||
void onFlashInspectionPaneStateChanged();
|
||||
void onProgrammingModeEnabled();
|
||||
void onProgrammingModeDisabled();
|
||||
};
|
||||
|
||||
@@ -14,113 +14,110 @@
|
||||
#include "Widgets/ExpandingHeightScrollAreaWidget.hpp"
|
||||
#include "Widgets/TargetWidgets/TargetPackageWidgetContainer.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
using namespace Bloom::Widgets;
|
||||
using namespace Widgets;
|
||||
|
||||
UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
this->customWidgetConstructorsByWidgetName = {
|
||||
{
|
||||
"Label",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new Label(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"RotatableLabel",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new RotatableLabel("", parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"LabeledSeparator",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new LabeledSeparator(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TextInput",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new TextInput(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PlainTextEdit",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PlainTextEdit(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PushButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PushButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"ExpandingHeightScrollAreaWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new ExpandingHeightScrollAreaWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgToolButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgToolButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TargetPackageWidgetContainer",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new InsightTargetWidgets::TargetPackageWidgetContainer(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
QWidget* UiLoader::createWidget(const QString& className, QWidget* parent, const QString& name) {
|
||||
const auto widgetConstructorIt = this->customWidgetConstructorsByWidgetName.find(className);
|
||||
|
||||
if (widgetConstructorIt != this->customWidgetConstructorsByWidgetName.end()) {
|
||||
// This is a custom widget - call the mapped constructor
|
||||
return widgetConstructorIt->second(parent, name);
|
||||
}
|
||||
|
||||
return QUiLoader::createWidget(className, parent, name);
|
||||
}
|
||||
UiLoader::UiLoader(QObject* parent): QUiLoader(parent) {
|
||||
this->customWidgetConstructorsByWidgetName = {
|
||||
{
|
||||
"Label",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new Label(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"RotatableLabel",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new RotatableLabel("", parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"LabeledSeparator",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new LabeledSeparator(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TextInput",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new TextInput(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PlainTextEdit",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PlainTextEdit(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"PushButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new PushButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"ExpandingHeightScrollAreaWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new ExpandingHeightScrollAreaWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgWidget",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgWidget(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"SvgToolButton",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new SvgToolButton(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
{
|
||||
"TargetPackageWidgetContainer",
|
||||
[this] (QWidget* parent, const QString& name) {
|
||||
auto* widget = new InsightTargetWidgets::TargetPackageWidgetContainer(parent);
|
||||
widget->setObjectName(name);
|
||||
widget->setStyleSheet(parent->styleSheet());
|
||||
return widget;
|
||||
}
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
QWidget* UiLoader::createWidget(const QString& className, QWidget* parent, const QString& name) {
|
||||
const auto widgetConstructorIt = this->customWidgetConstructorsByWidgetName.find(className);
|
||||
|
||||
if (widgetConstructorIt != this->customWidgetConstructorsByWidgetName.end()) {
|
||||
// This is a custom widget - call the mapped constructor
|
||||
return widgetConstructorIt->second(parent, name);
|
||||
}
|
||||
|
||||
return QUiLoader::createWidget(className, parent, name);
|
||||
}
|
||||
|
||||
@@ -3,21 +3,18 @@
|
||||
#include <QUiLoader>
|
||||
#include <QSize>
|
||||
|
||||
namespace Bloom
|
||||
class UiLoader: public QUiLoader
|
||||
{
|
||||
class UiLoader: public QUiLoader
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
explicit UiLoader(QObject* parent);
|
||||
public:
|
||||
explicit UiLoader(QObject* parent);
|
||||
|
||||
QWidget* createWidget(const QString& className, QWidget* parent, const QString& name) override;
|
||||
QWidget* createWidget(const QString& className, QWidget* parent, const QString& name) override;
|
||||
|
||||
private:
|
||||
std::map<
|
||||
QString,
|
||||
std::function<QWidget*(QWidget* parent, const QString& name)>
|
||||
> customWidgetConstructorsByWidgetName = {};
|
||||
};
|
||||
}
|
||||
private:
|
||||
std::map<
|
||||
QString,
|
||||
std::function<QWidget*(QWidget* parent, const QString& name)>
|
||||
> customWidgetConstructorsByWidgetName = {};
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ClickableWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
void ClickableWidget::mouseReleaseEvent(QMouseEvent* event) {
|
||||
if (event->button() == Qt::MouseButton::LeftButton) {
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QEvent>
|
||||
#include <QMouseEvent>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ClickableWidget: public QFrame
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ConfirmationDialog.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ConfirmationDialog::ConfirmationDialog(
|
||||
const QString& windowTitle,
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "Dialog/Dialog.hpp"
|
||||
#include "PushButton.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ConfirmationDialog: public Dialog
|
||||
{
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Bloom::Exceptions::Exception;
|
||||
using Exceptions::Exception;
|
||||
|
||||
Dialog::Dialog(
|
||||
const QString& windowTitle,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class Dialog: public QDialog
|
||||
{
|
||||
|
||||
@@ -7,9 +7,9 @@
|
||||
#include "src/Services/PathService.hpp"
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
using Bloom::Exceptions::Exception;
|
||||
using Exceptions::Exception;
|
||||
|
||||
ErrorDialogue::ErrorDialogue(
|
||||
const QString& windowTitle,
|
||||
|
||||
@@ -6,11 +6,11 @@
|
||||
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/Label.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
/**
|
||||
* @deprecated
|
||||
* TODO: Bin this. Replace all usages with Bloom::Widgets::Dialog.
|
||||
* TODO: Bin this. Replace all usages with Widgets::Dialog.
|
||||
*/
|
||||
class ErrorDialogue: public QDialog
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QScrollArea>
|
||||
#include <QSize>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ExpandingHeightScrollAreaWidget: public QScrollArea
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class Label: public QLabel
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "LabeledSeparator.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
LabeledSeparator::LabeledSeparator(QString title, QWidget* parent): title(std::move(title)), QWidget(parent) {
|
||||
this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QPaintEvent>
|
||||
#include <QPainter>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class LabeledSeparator: public QWidget
|
||||
{
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <QGraphicsView>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ListItem: public QGraphicsItem
|
||||
{
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include <QByteArray>
|
||||
#include <algorithm>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ListScene::ListScene(
|
||||
ListScene::ListItemSetType&& items,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
#include "ListItem.hpp"
|
||||
#include "src/Helpers/DereferenceLessComparator.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ListScene: public QGraphicsScene
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ListView.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ListView::ListView(
|
||||
ListScene::ListItemSetType&& items,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "ListScene.hpp"
|
||||
#include "ListItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ListView: public QGraphicsView
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
#include <QPoint>
|
||||
#include <optional>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct DetachedWindowState
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "PaneWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PaneWidget::PaneWidget(PaneState& state, PanelWidget* parent)
|
||||
: state(state)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "PanelWidget.hpp"
|
||||
#include "PaneState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class PaneWidget: public QWidget
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
struct PanelState
|
||||
{
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "PaneWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PanelWidget::PanelWidget(PanelWidgetType type, PanelState& state, QWidget* parent)
|
||||
: panelType(type)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "PanelState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
Q_NAMESPACE
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QMenu>
|
||||
#include <QAction>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PlainTextEdit::PlainTextEdit(QWidget* parent)
|
||||
: QPlainTextEdit(parent)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QPlainTextEdit>
|
||||
#include <QContextMenuEvent>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class PlainTextEdit: public QPlainTextEdit
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "PushButton.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
PushButton::PushButton(QWidget* parent)
|
||||
: QPushButton(parent)
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QPushButton>
|
||||
#include <QString>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class PushButton: public QPushButton
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <QPainter>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
void RotatableLabel::paintEvent(QPaintEvent* event) {
|
||||
auto painter = QPainter(this);
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include "Label.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class RotatableLabel: public Label
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "SvgToolButton.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
SvgToolButton::SvgToolButton(QWidget* parent): QToolButton(parent) {
|
||||
this->setButtonWidth(10);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "SvgWidget.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class SvgToolButton: public QToolButton
|
||||
{
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QPainter>
|
||||
#include <cmath>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
SvgWidget::SvgWidget(QWidget* parent): QFrame(parent) {
|
||||
this->renderer.setAspectRatioMode(Qt::AspectRatioMode::KeepAspectRatioByExpanding);
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <QSize>
|
||||
#include <QPropertyAnimation>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class SvgWidget: public QFrame
|
||||
{
|
||||
|
||||
@@ -2,11 +2,8 @@
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Bloom
|
||||
enum class AddressType: std::uint8_t
|
||||
{
|
||||
enum class AddressType: std::uint8_t
|
||||
{
|
||||
ABSOLUTE,
|
||||
RELATIVE,
|
||||
};
|
||||
}
|
||||
ABSOLUTE,
|
||||
RELATIVE,
|
||||
};
|
||||
|
||||
@@ -2,21 +2,18 @@
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
{
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::EXCLUDED, addressRange)
|
||||
{}
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::EXCLUDED, addressRange)
|
||||
{}
|
||||
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
if (this->type != MemoryRegionType::EXCLUDED) {
|
||||
throw Exceptions::Exception("Invalid memory region type");
|
||||
}
|
||||
ExcludedMemoryRegion::ExcludedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
if (this->type != MemoryRegionType::EXCLUDED) {
|
||||
throw Exceptions::Exception("Invalid memory region type");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,14 @@
|
||||
|
||||
#include "MemoryRegion.hpp"
|
||||
|
||||
namespace Bloom
|
||||
class ExcludedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
class ExcludedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
public:
|
||||
ExcludedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
ExcludedMemoryRegion(const QJsonObject& jsonObject);
|
||||
};
|
||||
}
|
||||
ExcludedMemoryRegion(const QJsonObject& jsonObject);
|
||||
};
|
||||
|
||||
@@ -2,38 +2,35 @@
|
||||
|
||||
#include "src/Exceptions/Exception.hpp"
|
||||
|
||||
namespace Bloom
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::FOCUSED, addressRange)
|
||||
{}
|
||||
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
)
|
||||
: MemoryRegion(name, memoryType, MemoryRegionType::FOCUSED, addressRange)
|
||||
{}
|
||||
using Exceptions::Exception;
|
||||
|
||||
FocusedMemoryRegion::FocusedMemoryRegion(const QJsonObject& jsonObject)
|
||||
: MemoryRegion(jsonObject)
|
||||
{
|
||||
using Exceptions::Exception;
|
||||
|
||||
if (this->type != MemoryRegionType::FOCUSED) {
|
||||
throw Exception("Invalid memory region type");
|
||||
}
|
||||
|
||||
if (!jsonObject.contains("dataType") || !jsonObject.contains("endianness")) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
this->dataType = FocusedMemoryRegion::regionDataTypesByName.at(jsonObject.find("dataType")->toString());
|
||||
this->endianness = FocusedMemoryRegion::regionEndiannessByName.at(jsonObject.find("endianness")->toString());
|
||||
if (this->type != MemoryRegionType::FOCUSED) {
|
||||
throw Exception("Invalid memory region type");
|
||||
}
|
||||
|
||||
QJsonObject FocusedMemoryRegion::toJson() const {
|
||||
auto jsonObject = MemoryRegion::toJson();
|
||||
jsonObject.insert("dataType", FocusedMemoryRegion::regionDataTypesByName.at(this->dataType));
|
||||
jsonObject.insert("endianness", FocusedMemoryRegion::regionEndiannessByName.at(this->endianness));
|
||||
|
||||
return jsonObject;
|
||||
if (!jsonObject.contains("dataType") || !jsonObject.contains("endianness")) {
|
||||
throw Exception("Missing data");
|
||||
}
|
||||
|
||||
this->dataType = FocusedMemoryRegion::regionDataTypesByName.at(jsonObject.find("dataType")->toString());
|
||||
this->endianness = FocusedMemoryRegion::regionEndiannessByName.at(jsonObject.find("endianness")->toString());
|
||||
}
|
||||
|
||||
QJsonObject FocusedMemoryRegion::toJson() const {
|
||||
auto jsonObject = MemoryRegion::toJson();
|
||||
jsonObject.insert("dataType", FocusedMemoryRegion::regionDataTypesByName.at(this->dataType));
|
||||
jsonObject.insert("endianness", FocusedMemoryRegion::regionEndiannessByName.at(this->endianness));
|
||||
|
||||
return jsonObject;
|
||||
}
|
||||
|
||||
@@ -6,43 +6,40 @@
|
||||
|
||||
#include "src/Helpers/BiMap.hpp"
|
||||
|
||||
namespace Bloom
|
||||
enum class MemoryRegionDataType: std::uint8_t
|
||||
{
|
||||
enum class MemoryRegionDataType: std::uint8_t
|
||||
{
|
||||
UNKNOWN,
|
||||
UNSIGNED_INTEGER,
|
||||
SIGNED_INTEGER,
|
||||
ASCII_STRING,
|
||||
UNKNOWN,
|
||||
UNSIGNED_INTEGER,
|
||||
SIGNED_INTEGER,
|
||||
ASCII_STRING,
|
||||
};
|
||||
|
||||
class FocusedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
MemoryRegionDataType dataType = MemoryRegionDataType::UNKNOWN;
|
||||
Targets::TargetMemoryEndianness endianness = Targets::TargetMemoryEndianness::LITTLE;
|
||||
|
||||
FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
FocusedMemoryRegion(const QJsonObject& jsonObject);
|
||||
|
||||
QJsonObject toJson() const override;
|
||||
|
||||
private:
|
||||
static const inline BiMap<MemoryRegionDataType, QString> regionDataTypesByName = {
|
||||
{MemoryRegionDataType::UNKNOWN, "other"},
|
||||
{MemoryRegionDataType::UNSIGNED_INTEGER, "unsigned_int"},
|
||||
{MemoryRegionDataType::SIGNED_INTEGER, "signed_int"},
|
||||
{MemoryRegionDataType::ASCII_STRING, "ascii_string"},
|
||||
};
|
||||
|
||||
class FocusedMemoryRegion: public MemoryRegion
|
||||
{
|
||||
public:
|
||||
MemoryRegionDataType dataType = MemoryRegionDataType::UNKNOWN;
|
||||
Targets::TargetMemoryEndianness endianness = Targets::TargetMemoryEndianness::LITTLE;
|
||||
|
||||
FocusedMemoryRegion(
|
||||
const QString& name,
|
||||
Targets::TargetMemoryType memoryType,
|
||||
const Targets::TargetMemoryAddressRange& addressRange
|
||||
);
|
||||
|
||||
FocusedMemoryRegion(const QJsonObject& jsonObject);
|
||||
|
||||
QJsonObject toJson() const override;
|
||||
|
||||
private:
|
||||
static const inline BiMap<MemoryRegionDataType, QString> regionDataTypesByName = {
|
||||
{MemoryRegionDataType::UNKNOWN, "other"},
|
||||
{MemoryRegionDataType::UNSIGNED_INTEGER, "unsigned_int"},
|
||||
{MemoryRegionDataType::SIGNED_INTEGER, "signed_int"},
|
||||
{MemoryRegionDataType::ASCII_STRING, "ascii_string"},
|
||||
};
|
||||
|
||||
static const inline BiMap<Targets::TargetMemoryEndianness, QString> regionEndiannessByName = {
|
||||
{Targets::TargetMemoryEndianness::LITTLE, "little"},
|
||||
{Targets::TargetMemoryEndianness::BIG, "big"},
|
||||
};
|
||||
static const inline BiMap<Targets::TargetMemoryEndianness, QString> regionEndiannessByName = {
|
||||
{Targets::TargetMemoryEndianness::LITTLE, "little"},
|
||||
{Targets::TargetMemoryEndianness::BIG, "big"},
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ByteAddressContainer.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ByteAddressContainer::ByteAddressContainer(const HexViewerSharedState& hexViewerState)
|
||||
: hexViewerState(hexViewerState)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "HexViewerSharedState.hpp"
|
||||
#include "ByteAddressItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ByteAddressContainer: public QGraphicsItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ByteAddressItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ByteAddressItem::ByteAddressItem(const HexViewerSharedState& hexViewerState, QGraphicsItem* parent)
|
||||
: hexViewerState(hexViewerState)
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
#include "ByteItem.hpp"
|
||||
#include "HexViewerSharedState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ByteAddressItem: public QGraphicsItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ByteItem::ByteItem(Targets::TargetMemoryAddress address)
|
||||
: HexViewerItem(address)
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
#include "HexViewerItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
#pragma pack(push, 1)
|
||||
class ByteItem: public HexViewerItem
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "ContextMenuAction.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
ContextMenuAction::ContextMenuAction(
|
||||
const QString& text,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class ContextMenuAction: public QAction
|
||||
{
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <cassert>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
FocusedRegionGroupItem::FocusedRegionGroupItem(
|
||||
const FocusedMemoryRegion& focusedRegion,
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#include "src/Insight/UserInterfaces/InsightWindow/Widgets/TargetMemoryInspectionPane/FocusedMemoryRegion.hpp"
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class FocusedRegionGroupItem: public GroupItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "GroupItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
GroupItem::~GroupItem() {
|
||||
for (auto& byteItem : this->items) {
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "HexViewerSharedState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class GroupItem: public HexViewerItem
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#include "HexViewerItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
HexViewerItem::HexViewerItem(Targets::TargetMemoryAddress startAddress, HexViewerItem* parent)
|
||||
: startAddress(startAddress)
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#include "src/Targets/TargetMemory.hpp"
|
||||
#include "HexViewerSharedState.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
class GraphicsItem;
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <cassert>
|
||||
#include <cmath>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
HexViewerItemIndex::HexViewerItemIndex(
|
||||
const TopLevelGroupItem* topLevelGroupItem,
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "TopLevelGroupItem.hpp"
|
||||
#include "ByteItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
/**
|
||||
* This class maintains indices of hex viewer item positions and provides fast lookups for items within certain
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
#include <QScrollBar>
|
||||
#include <QColor>
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
HexViewerItemRenderer::HexViewerItemRenderer(
|
||||
const HexViewerSharedState& hexViewerState,
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
#include "FocusedRegionGroupItem.hpp"
|
||||
#include "StackMemoryGroupItem.hpp"
|
||||
|
||||
namespace Bloom::Widgets
|
||||
namespace Widgets
|
||||
{
|
||||
/**
|
||||
* Renders hex viewer items in a QGraphicsScene.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user