mirror of
https://github.com/SatDump/SatDump
synced 2026-08-13 17:47:30 -04:00
Merge branch 'master' of https://github.com/SatDump/SatDump
This commit is contained in:
commit
4bc20b2465
1 changed files with 13 additions and 46 deletions
|
|
@ -639,53 +639,20 @@ namespace satdump
|
|||
handler_thread_pool.clear_queue();
|
||||
handler_thread_pool.push([this](int)
|
||||
{
|
||||
async_image_mutex.lock();
|
||||
is_updating = true;
|
||||
logger->info("Saving Image...");
|
||||
async_image_mutex.lock();
|
||||
is_updating = true;
|
||||
logger->info("Saving Image...");
|
||||
std::string default_path = config::main_cfg["satdump_directories"]["default_image_output_directory"]["value"].get<std::string>();
|
||||
std::string saved_at = save_image_dialog(products->instrument_name + "_" +
|
||||
(select_image_id == 0 ? "composite" : ("ch" + channel_numbers[select_image_id - 1])),
|
||||
default_path, "Save Image", ¤t_image, &viewer_app->save_type);
|
||||
|
||||
std::string default_path = config::main_cfg["satdump_directories"]["default_image_output_directory"]["value"].get<std::string>();
|
||||
time_t timevalue = 0;
|
||||
std::string formatted_timestamp = "";
|
||||
std::string filename_suffix = "";
|
||||
int suffix_num = 1;
|
||||
|
||||
if (products->has_product_timestamp())
|
||||
timevalue = products->get_product_timestamp();
|
||||
else if (products->has_timestamps)
|
||||
timevalue = get_median(products->get_timestamps());
|
||||
|
||||
if(timevalue != 0)
|
||||
{
|
||||
std::tm *timeReadable = gmtime(&timevalue);
|
||||
formatted_timestamp = std::to_string(timeReadable->tm_year + 1900) + "-" +
|
||||
(timeReadable->tm_mon + 1 > 9 ? std::to_string(timeReadable->tm_mon + 1) : "0" + std::to_string(timeReadable->tm_mon + 1)) + "-" +
|
||||
(timeReadable->tm_mday > 9 ? std::to_string(timeReadable->tm_mday) : "0" + std::to_string(timeReadable->tm_mday)) + "_" +
|
||||
(timeReadable->tm_hour > 9 ? std::to_string(timeReadable->tm_hour) : "0" + std::to_string(timeReadable->tm_hour)) + "-" +
|
||||
(timeReadable->tm_min > 9 ? std::to_string(timeReadable->tm_min) : "0" + std::to_string(timeReadable->tm_min)) + "-" +
|
||||
(timeReadable->tm_sec > 9 ? std::to_string(timeReadable->tm_sec) : "0" + std::to_string(timeReadable->tm_sec)) + "Z_";
|
||||
}
|
||||
|
||||
std::string file_name = formatted_timestamp + products->instrument_name + "_" +
|
||||
(select_image_id != 0 ? ("ch" + channel_numbers[select_image_id - 1]) :
|
||||
(std::string("composite_") + (select_rgb_presets == -1 ? "custom" : rgb_presets[select_rgb_presets].first)));
|
||||
|
||||
// To ensure composites with slashes or spaces don't end up in the filename
|
||||
std::replace(file_name.begin(), file_name.end(), ' ', '-');
|
||||
std::replace(file_name.begin(), file_name.end(), '/', '-');
|
||||
|
||||
// Make sure we never overwrite anything unintentinally
|
||||
while (std::filesystem::exists(default_path + "/" + file_name + filename_suffix + "." + viewer_app->save_type))
|
||||
filename_suffix = "_" + std::to_string(++suffix_num);
|
||||
file_name += filename_suffix;
|
||||
|
||||
std::string saved_at = save_image_dialog(file_name, default_path, "Save Image", ¤t_image, &viewer_app->save_type);
|
||||
|
||||
if (saved_at == "")
|
||||
logger->info("Save cancelled");
|
||||
else
|
||||
logger->info("Saved current image at %s", saved_at.c_str());
|
||||
is_updating = false;
|
||||
async_image_mutex.unlock(); });
|
||||
if (saved_at == "")
|
||||
logger->info("Save cancelled");
|
||||
else
|
||||
logger->info("Saved current image at %s", saved_at.c_str());
|
||||
is_updating = false;
|
||||
async_image_mutex.unlock(); });
|
||||
}
|
||||
if (save_disabled)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue