OrcaSlicer latest
OrcaSlicer
Loading...
Searching...
No Matches
Slic3r::GUI::SortItem Struct Reference

#include </home/runner/work/OrcaSlicer/OrcaSlicer/src/slic3r/GUI/MultiMachine.hpp>

Collaboration diagram for Slic3r::GUI::SortItem:

Public Types

enum  SortRule : uint8_t {
  SR_None = 0 , SR_DEV_NAME = 1 , SR_ONLINE , SR_PRINTABLE ,
  SR_EN_AMS , SR_DEV_STATE , SR_LOCAL_TASK_STATE , SR_CLOUD_TASK_STATE ,
  SR_SEND_TIME , SR_MACHINE_NAME , SR_MACHINE_STATE , SR_COUNT
}
typedef std::function< bool(DeviceItem *, DeviceItem *)> SortCallBack
typedef std::function< bool(ObjState s1, ObjState s2) > SortMultiMachineCB

Public Member Functions

 SortItem ()
 SortItem (SortRule sr)
SortCallBack get_call_back ()
void set_role (SortRule rule, bool big)
void set_role (SortMultiMachineCB cb, SortRule rl, bool big)
SortMultiMachineCB get_machine_call_back () const

Public Attributes

SortRule rule { SortRule::SR_None }
bool big { true }
std::unordered_map< SortRule, SortCallBack > sort_map
SortMultiMachineCB cb

Detailed Description

Member Typedef Documentation

◆ SortCallBack

◆ SortMultiMachineCB

typedef std::function<bool(ObjState s1, ObjState s2) > Slic3r::GUI::SortItem::SortMultiMachineCB

Member Enumeration Documentation

◆ SortRule

Enumerator
SR_None 
SR_DEV_NAME 
SR_ONLINE 
SR_PRINTABLE 
SR_EN_AMS 
SR_DEV_STATE 
SR_LOCAL_TASK_STATE 
SR_CLOUD_TASK_STATE 
SR_SEND_TIME 
SR_MACHINE_NAME 
SR_MACHINE_STATE 
SR_COUNT 
86 {
87 SR_None = 0,
88 SR_DEV_NAME = 1,
99 };
@ SR_DEV_STATE
Definition MultiMachine.hpp:92
@ SR_DEV_NAME
Definition MultiMachine.hpp:88
@ SR_ONLINE
Definition MultiMachine.hpp:89
@ SR_COUNT
Definition MultiMachine.hpp:98
@ SR_CLOUD_TASK_STATE
Definition MultiMachine.hpp:94
@ SR_MACHINE_NAME
Definition MultiMachine.hpp:96
@ SR_PRINTABLE
Definition MultiMachine.hpp:90
@ SR_None
Definition MultiMachine.hpp:87
@ SR_SEND_TIME
Definition MultiMachine.hpp:95
@ SR_LOCAL_TASK_STATE
Definition MultiMachine.hpp:93
@ SR_MACHINE_STATE
Definition MultiMachine.hpp:97
@ SR_EN_AMS
Definition MultiMachine.hpp:91

Constructor & Destructor Documentation

◆ SortItem() [1/2]

Slic3r::GUI::SortItem::SortItem ( )
202{
203 sort_map.emplace(std::make_pair(SortRule::SR_None, [](const DeviceItem* d1, const DeviceItem* d2) {
204 return d1->state_dev_name > d2->state_dev_name;
205 }));
206 sort_map.emplace(std::make_pair(SortRule::SR_DEV_NAME, [this](const DeviceItem* d1, const DeviceItem* d2) {
207 return this->big ? d1->state_dev_name > d2->state_dev_name : d1->state_dev_name < d2->state_dev_name;
208 }));
209 sort_map.emplace(std::make_pair(SortRule::SR_ONLINE, [this](const DeviceItem* d1, const DeviceItem* d2) {
210 return this->big ? d1->state_online > d2->state_online : d1->state_online < d2->state_online;
211 }));
212 sort_map.emplace(std::make_pair(SortRule::SR_PRINTABLE, [this](const DeviceItem* d1, const DeviceItem* d2) {
213 return this->big ? d1->state_printable > d2->state_printable : d1->state_printable < d2->state_printable;
214 }));
215 sort_map.emplace(std::make_pair(SortRule::SR_EN_AMS, [this](const DeviceItem* d1, const DeviceItem* d2) {
216 return this->big ? d1->state_enable_ams > d2->state_enable_ams : d1->state_enable_ams < d2->state_enable_ams;
217 }));
218 sort_map.emplace(std::make_pair(SortRule::SR_DEV_STATE, [this](const DeviceItem* d1, const DeviceItem* d2) {
219 return this->big ? d1->state_device > d2->state_device : d1->state_device < d2->state_device;
220 }));
221 sort_map.emplace(std::make_pair(SortRule::SR_LOCAL_TASK_STATE, [this](const DeviceItem* d1, const DeviceItem* d2) {
222 return this->big ? d1->state_local_task > d2->state_local_task : d1->state_local_task < d2->state_local_task;
223 }));
224 sort_map.emplace(std::make_pair(SortRule::SR_CLOUD_TASK_STATE, [this](const DeviceItem* d1, const DeviceItem* d2) {
225 return this->big ? d1->state_cloud_task > d2->state_cloud_task : d1->state_cloud_task < d2->state_cloud_task;
226 }));
227 sort_map.emplace(std::make_pair(SortRule::SR_SEND_TIME, [this](const DeviceItem* d1, const DeviceItem* d2) {
228 return this->big ? d1->m_send_time > d2->m_send_time : d1->m_send_time < d2->m_send_time;
229 }));
230}
bool big
Definition MultiMachine.hpp:102
std::unordered_map< SortRule, SortCallBack > sort_map
Definition MultiMachine.hpp:103

References big, Slic3r::GUI::DeviceItem::m_send_time, sort_map, SR_CLOUD_TASK_STATE, SR_DEV_NAME, SR_DEV_STATE, SR_EN_AMS, SR_LOCAL_TASK_STATE, SR_None, SR_ONLINE, SR_PRINTABLE, SR_SEND_TIME, Slic3r::GUI::DeviceItem::state_cloud_task, Slic3r::GUI::DeviceItem::state_dev_name, Slic3r::GUI::DeviceItem::state_device, Slic3r::GUI::DeviceItem::state_enable_ams, Slic3r::GUI::DeviceItem::state_local_task, Slic3r::GUI::DeviceItem::state_online, and Slic3r::GUI::DeviceItem::state_printable.

◆ SortItem() [2/2]

Slic3r::GUI::SortItem::SortItem ( SortRule sr)
inline
107{ rule = sr; }
SortRule rule
Definition MultiMachine.hpp:101

References rule.

Member Function Documentation

◆ get_call_back()

SortItem::SortCallBack Slic3r::GUI::SortItem::get_call_back ( )
233{
234 return sort_map[rule];
235}

References rule, and sort_map.

◆ get_machine_call_back()

SortMultiMachineCB Slic3r::GUI::SortItem::get_machine_call_back ( ) const
inline
112{ return cb; }
SortMultiMachineCB cb
Definition MultiMachine.hpp:104

References cb.

◆ set_role() [1/2]

void Slic3r::GUI::SortItem::set_role ( SortMultiMachineCB cb,
SortRule rl,
bool big )
244{
245 this->cb = cb;
246 this->rule = rl;
247 this->big = big;
248}

References big, cb, and rule.

◆ set_role() [2/2]

void Slic3r::GUI::SortItem::set_role ( SortRule rule,
bool big )
238{
239 this->rule = rule;
240 this->big = big;
241}

References big, and rule.

Member Data Documentation

◆ big

bool Slic3r::GUI::SortItem::big { true }
102{ true };

Referenced by SortItem(), set_role(), and set_role().

◆ cb

SortMultiMachineCB Slic3r::GUI::SortItem::cb

Referenced by get_machine_call_back(), and set_role().

◆ rule

SortRule Slic3r::GUI::SortItem::rule { SortRule::SR_None }

◆ sort_map

std::unordered_map<SortRule, SortCallBack> Slic3r::GUI::SortItem::sort_map

Referenced by SortItem(), and get_call_back().


The documentation for this struct was generated from the following files: