iCub-main
selectioncheckbox.cpp
Go to the documentation of this file.
1 #include "selectioncheckbox.h"
2 #include <QtConcurrent/QtConcurrent>
3 
4 SelectionCheckBox::SelectionCheckBox(QWidget *parent) : QCheckBox(parent)
5 {
6 
7 }
8 
9 SelectionCheckBox::SelectionCheckBox(FirmwareUpdaterCore *core, QTreeWidgetItem *it, QWidget *parent) : QCheckBox(parent)
10 {
11  this->selected = false;
12  //this->core = core;
13 // isEth = false;
14 // isCan = false;
15 // treeNode = it;
16 
17 
18 
19 // if(treeNode->data(0,DEVICE_LEVEL).toInt() == 2){
20 // if(treeNode->parent()->text(DEVICE) == "ETH"){
21 // isEth = true;
22 // isCan = false;
23 // }else{
24 // isEth = false;
25 // isCan = true;
26 // }
27 // }else if(treeNode->data(0,DEVICE_LEVEL).toInt() == 3){
28 // isEth = false;
29 // isCan = true;
30 // }
31 
32  connect(this,SIGNAL(toggled(bool)),this,SLOT(onSelectionChanged(bool)));
33 
34 }
35 
36 
37 //bool SelectionCheckBox::boardIsEth()
38 //{
39 // return isEth && !isCan;
40 //}
41 
42 //bool SelectionCheckBox::boardIsCan()
43 //{
44 // return isCan && !isEth;
45 //}
46 
47 
48 void SelectionCheckBox::onSelectionChanged(bool selected)
49 {
50  setSelected(selected);
51 }
52 
53 void SelectionCheckBox::setSelected(bool selected)
54 {
55  //needLoading(true,selected);
56  this->selected = selected;
57  needChangeSelection(selected);
58 
59 
60 
61 // if(isEth){
62 // core->setSelectedEthBoard(getBoardIndex(),selected);
63 // }else{
64 // QString ethAddress;
65 // if(treeNode->data(0,DEVICE_LEVEL).toInt() == 3){
66 // ethAddress = treeNode->parent()->text(ADDRESS);
67 // }
68 // QtConcurrent::run(core,&FirmwareUpdaterCore::setSelectedCanBoard,getBoardIndex(),selected,ethAddress);
69 // //core->setSelectedCanBoard(getBoardIndex(),selected,ethAddress);
70 // }
71 
72 }
73 
75 {
76  //needLoading(false,false);
77  selectedChanged(selected);
78 }
79 
81 {
82  return selected;
83 }
84 
85 
86 
87 //QTreeWidgetItem *SelectionCheckBox::getTreeNode()
88 //{
89 // return treeNode;
90 //}
91 
92 
93 //QString SelectionCheckBox::getBoardType()
94 //{
95 // return treeNode->text(DEVICE);
96 //}
97 
98 //int SelectionCheckBox::getBoardIndex()
99 //{
100 // return treeNode->data(0,INDEX_OF_BOARD).toInt();
101 //}
SelectionCheckBox::onSelectEnded
void onSelectEnded()
Definition: selectioncheckbox.cpp:74
SelectionCheckBox::needChangeSelection
void needChangeSelection(bool)
SelectionCheckBox::setSelected
void setSelected(bool)
Definition: selectioncheckbox.cpp:53
SelectionCheckBox::isSelected
bool isSelected()
Definition: selectioncheckbox.cpp:80
SelectionCheckBox::selectedChanged
void selectedChanged(bool)
selectioncheckbox.h
FirmwareUpdaterCore
Definition: firmwareupdatercore.h:15
SelectionCheckBox::SelectionCheckBox
SelectionCheckBox(QWidget *=NULL)
Definition: selectioncheckbox.cpp:4