1
0
mirror of synced 2025-01-18 09:04:52 +01:00

impr: Code style

This commit is contained in:
WerWolv 2023-12-06 11:05:13 +01:00
parent 0b71568d97
commit ba8430d9e7
2 changed files with 9 additions and 9 deletions

View File

@ -47,7 +47,7 @@ namespace hex::plugin::builtin {
auto providerSettings = nlohmann::json::parse(tar.readString(basePath / hex::format("{}.json", id))); auto providerSettings = nlohmann::json::parse(tar.readString(basePath / hex::format("{}.json", id)));
auto providerType = providerSettings.at("type").get<std::string>(); auto providerType = providerSettings.at("type").get<std::string>();
auto provider = ImHexApi::Provider::createProvider(providerType, true, false); auto newProvider = ImHexApi::Provider::createProvider(providerType, true, false);
ON_SCOPE_EXIT { ON_SCOPE_EXIT {
if (!success) { if (!success) {
for (auto &task : TaskManager::getRunningTasks()) for (auto &task : TaskManager::getRunningTasks())
@ -60,7 +60,7 @@ namespace hex::plugin::builtin {
} }
}; };
if (provider == nullptr) { if (newProvider == nullptr) {
// If a provider is not created, it will be overwritten when saving the project, // If a provider is not created, it will be overwritten when saving the project,
// so we should prevent the project from loading at all // so we should prevent the project from loading at all
showError(hex::format("hex.builtin.popup.error.project.load"_lang, showError(hex::format("hex.builtin.popup.error.project.load"_lang,
@ -70,19 +70,19 @@ namespace hex::plugin::builtin {
break; break;
} }
provider->setID(id); newProvider->setID(id);
bool loaded = false; bool loaded = false;
try { try {
provider->loadSettings(providerSettings.at("settings")); newProvider->loadSettings(providerSettings.at("settings"));
loaded = true; loaded = true;
} catch (const std::exception &e){ } catch (const std::exception &e){
providerWarnings[provider] = e.what(); providerWarnings[newProvider] = e.what();
} }
if (loaded) { if (loaded) {
if (!provider->open() || !provider->isAvailable() || !provider->isReadable()) { if (!newProvider->open() || !newProvider->isAvailable() || !newProvider->isReadable()) {
providerWarnings[provider] = provider->getErrorMessage(); providerWarnings[newProvider] = newProvider->getErrorMessage();
} else } else
EventManager::post<EventProviderOpened>(provider); EventManager::post<EventProviderOpened>(newProvider);
} }
} }

View File

@ -255,8 +255,8 @@ namespace hex::plugin::builtin {
this->m_editing = false; this->m_editing = false;
ShortcutManager::resumeShortcuts(); ShortcutManager::resumeShortcuts();
if (!this->m_hasDuplicate) {
settingChanged = true; settingChanged = true;
if (!this->m_hasDuplicate) {
} }
} }
} }