-
Notifications
You must be signed in to change notification settings - Fork 0
/
tagpanel.cpp
58 lines (50 loc) · 1.67 KB
/
tagpanel.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
#include "tagpanel.h"
TagPanel::TagPanel(QWidget *parent) : QWidget(parent)
{
setSize();
createLayout();
createSearchPanel();
createSelectedPanel();
relaySignals();
}
void TagPanel::setSize()
{
this->setFixedWidth(280);
}
void TagPanel::createLayout()
{
layout = new QVBoxLayout;
this->setLayout(layout);
}
void TagPanel::createSearchPanel()
{
searchPanel = new SearchPanel;
layout->addWidget(searchPanel);
}
void TagPanel::createSelectedPanel()
{
selectedPanel = new SelectedPanel;
selectedPanel->setEnabled(false);
layout->addWidget(selectedPanel);
}
void TagPanel::relaySignals()
{
connect(selectedPanel, SIGNAL (tagClicked(int)), searchPanel, SLOT (toggleTagInSearch(int)));
connect(searchPanel, SIGNAL (activeSearchTagsChanged(QList<int>, QList<int>)), this, SIGNAL (activeSearchTagsChanged(QList<int>, QList<int>)));
connect(selectedPanel, SIGNAL (tagAddedToSelectedFile(int)), searchPanel, SLOT (updateTagDictionary()));
connect(selectedPanel, SIGNAL (tagRemovedFromSelectedFile(int)), searchPanel, SLOT (updateTagDictionary()));
connect(selectedPanel, SIGNAL (tagAddedToSelectedFile(int)), this, SIGNAL (tagAddedToSelectedFile(int)));
connect(selectedPanel, SIGNAL (tagRemovedFromSelectedFile(int)), this, SIGNAL (tagRemovedFromSelectedFile(int)));
}
void TagPanel::selectionChanged(int selectedFile)
{
bool fileIsSelected = selectedFile != Selected::NONE;
selectedPanel->setEnabled(fileIsSelected);
selectedPanel->setSelectedFile(selectedFile);
selectedPanel->refreshTagList();
}
void TagPanel::updateTagDictionaries()
{
searchPanel->updateTagDictionary();
selectedPanel->updateTagDictionary();
}