mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-11 16:57:53 -06:00
Physical printers: Delete selected printer
+ Added context menu for the cog-button near the printer presets
This commit is contained in:
parent
89035febfa
commit
8ac839f427
4 changed files with 76 additions and 22 deletions
|
@ -1489,17 +1489,32 @@ void PhysicalPrinterCollection::save_printer(const PhysicalPrinter& edited_print
|
|||
bool PhysicalPrinterCollection::delete_printer(const std::string& name)
|
||||
{
|
||||
auto it = this->find_printer_internal(name);
|
||||
if (it == m_printers.end())
|
||||
return false;
|
||||
|
||||
const PhysicalPrinter& printer = *it;
|
||||
if (it == m_printers.end())
|
||||
return false;
|
||||
|
||||
// Erase the preset file.
|
||||
boost::nowide::remove(printer.file.c_str());
|
||||
m_printers.erase(it);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool PhysicalPrinterCollection::delete_selected_printer()
|
||||
{
|
||||
if (!has_selection())
|
||||
return false;
|
||||
const PhysicalPrinter& printer = this->get_selected_printer();
|
||||
|
||||
// Erase the preset file.
|
||||
boost::nowide::remove(printer.file.c_str());
|
||||
// Remove the preset from the list.
|
||||
m_printers.erase(m_printers.begin() + m_idx_selected);
|
||||
// unselect all printers
|
||||
unselect_printer();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
PhysicalPrinter& PhysicalPrinterCollection::select_printer_by_name(const std::string& name)
|
||||
{
|
||||
auto it = this->find_printer_internal(name);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue