-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathSequenceEntry.cpp
60 lines (50 loc) · 1.8 KB
/
SequenceEntry.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "SequenceEntry.h"
#include <QtGui/QPushButton>
#include <QtGui/QLineEdit>
/** ***************************************
SequenceEntry is a minor helper class used exclusively by HighlightDisplay.
Each SequenceEntry widget is one line in the HighlightDisplay::settingsUi()
tab. The constructor is called by HighlightDisplay::addNewSequence().
The class keeps track of its sequence, its color, and whether or not it has
been removed.
******************************************/
SequenceEntry::SequenceEntry(QLabel* Label, QLineEdit* line)
{
label = Label;
lineEdit = line;
removeButton = new QPushButton("Delete");
seq = line->text().toStdString();
colorBox = new ColorListEditor(this);
changeColor();
connect(removeButton, SIGNAL(clicked()), this, SLOT(removeSequence()) );
connect(lineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(setHighlightSequence(const QString&)));
connect(colorBox, SIGNAL(currentIndexChanged(int)), this, SLOT(changeColor()));
}
void SequenceEntry::changeColor()
{
QColor val = colorBox->color();
int r, g, b;
val.getRgb(&r, &g, &b);
matchColor = color(r,g,b);
mismatchColor = matchColor * 0.4;
emit colorChanged();
}
void SequenceEntry::setHighlightSequence(const QString& high_C)
{
string high = high_C.toStdString();
if(high.compare(seq) == 0)
return;
for(int l = 0; l < (int)high.size(); l++)
if(high[l] >= 97 && high[l] <= 122) high[l] -= 32;//cast to uppercase
seq = high;
// if(reverseCheck->isChecked())
// targets.push_back( reverseComplement(high) );
//ui->print("Number of strings currently highlighted: ", targets.size());
QString copy(high.c_str());
lineEdit->setText(copy);
}
void SequenceEntry::removeSequence()
{
emit removeEntry( this );
//delete this;
}