Remove legacy GENERAL log channel

Add some more log channels instead.
This commit is contained in:
Nekotekina 2020-02-01 07:15:50 +03:00
parent efafda2650
commit d9a0619ddd
26 changed files with 269 additions and 221 deletions

View file

@ -31,6 +31,8 @@
#endif
#endif
LOG_CHANNEL(screenshot);
constexpr auto qstr = QString::fromStdString;
gs_frame::gs_frame(const QString& title, const QRect& geometry, const QIcon& appIcon, const std::shared_ptr<gui_settings>& gui_settings)
@ -131,7 +133,7 @@ void gs_frame::keyPressEvent(QKeyEvent *keyEvent)
switch (keyEvent->key())
{
case Qt::Key_L:
if (keyEvent->modifiers() == Qt::AltModifier) { static int count = 0; LOG_SUCCESS(GENERAL, "Made forced mark %d in log", ++count); }
if (keyEvent->modifiers() == Qt::AltModifier) { static int count = 0; screenshot.success("Made forced mark %d in log", ++count); }
break;
case Qt::Key_Return:
if (keyEvent->modifiers() == Qt::AltModifier) { toggle_fullscreen(); return; }
@ -330,7 +332,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
if (!fs::create_dir(screen_path) && fs::g_tls_error != fs::error::exist)
{
LOG_ERROR(GENERAL, "Failed to create screenshot path \"%s\" : %s", screen_path, fs::g_tls_error);
screenshot.error("Failed to create screenshot path \"%s\" : %s", screen_path, fs::g_tls_error);
return;
}
@ -339,7 +341,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
fs::file sshot_file(filename, fs::open_mode::create + fs::open_mode::write + fs::open_mode::excl);
if (!sshot_file)
{
LOG_ERROR(GENERAL, "[Screenshot] Failed to save screenshot \"%s\" : %s", filename, fs::g_tls_error);
screenshot.error("[Screenshot] Failed to save screenshot \"%s\" : %s", filename, fs::g_tls_error);
return;
}
@ -378,7 +380,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
sshot_file.write(encoded_png.data(), encoded_png.size());
LOG_SUCCESS(GENERAL, "[Screenshot] Successfully saved screenshot to %s", filename);
screenshot.success("[Screenshot] Successfully saved screenshot to %s", filename);
const auto fxo = g_fxo->get<screenshot_manager>();
@ -387,25 +389,25 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
const std::string cell_sshot_filename = fxo->get_screenshot_path();
const std::string cell_sshot_dir = fs::get_parent_dir(cell_sshot_filename);
LOG_NOTICE(GENERAL, "[Screenshot] Saving cell screenshot to %s", cell_sshot_filename);
screenshot.notice("[Screenshot] Saving cell screenshot to %s", cell_sshot_filename);
if (!fs::create_path(cell_sshot_dir) && fs::g_tls_error != fs::error::exist)
{
LOG_ERROR(GENERAL, "Failed to create cell screenshot dir \"%s\" : %s", cell_sshot_dir, fs::g_tls_error);
screenshot.error("Failed to create cell screenshot dir \"%s\" : %s", cell_sshot_dir, fs::g_tls_error);
return;
}
fs::file cell_sshot_file(cell_sshot_filename, fs::open_mode::create + fs::open_mode::write + fs::open_mode::excl);
if (!cell_sshot_file)
{
LOG_ERROR(GENERAL, "[Screenshot] Failed to save cell screenshot \"%s\" : %s", cell_sshot_filename, fs::g_tls_error);
screenshot.error("[Screenshot] Failed to save cell screenshot \"%s\" : %s", cell_sshot_filename, fs::g_tls_error);
return;
}
const std::string cell_sshot_overlay_path = fxo->get_overlay_path();
if (fs::is_file(cell_sshot_overlay_path))
{
LOG_NOTICE(GENERAL, "[Screenshot] Adding overlay to cell screenshot from %s", cell_sshot_overlay_path);
screenshot.notice("[Screenshot] Adding overlay to cell screenshot from %s", cell_sshot_overlay_path);
// TODO: add overlay to screenshot
}
@ -414,7 +416,7 @@ void gs_frame::take_screenshot(const std::vector<u8> sshot_data, const u32 sshot
cell_sshot_file.write(encoded_png.data(), encoded_png.size());
LOG_SUCCESS(GENERAL, "[Screenshot] Successfully saved cell screenshot to %s", cell_sshot_filename);
screenshot.success("[Screenshot] Successfully saved cell screenshot to %s", cell_sshot_filename);
}
return;