2 * Copyright (C) 2013 Canonical, Ltd.
5 * Pawel Stolowski <pawel.stolowski@canonical.com>
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 3.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20#include "combinedfilteroptions.h"
21#include "combinedfilteroption.h"
23CombinedFilterOptions::CombinedFilterOptions(const std::vector<unity::dash::FilterOption::Ptr>& list, QObject *parent)
24 : GenericListModel(parent)
29void CombinedFilterOptions::initList(const std::vector<unity::dash::FilterOption::Ptr>& list)
31 // combine options, e.g. A, B, C becomes A-B, B-C, C
33 while (i < list.size() - 1) {
34 unity::dash::FilterOption::Ptr option1 = list[i];
35 unity::dash::FilterOption::Ptr option2 = list[i+1];
36 auto co = new CombinedFilterOption(option1, option2, this);
37 connect(co, SIGNAL(activeChanged(bool)), this, SLOT(onActiveChanged(bool)));
41 if (list.size() > 0) {
42 auto co = new CombinedFilterOption(list[i], NULL, this);
47void CombinedFilterOptions::onActiveChanged(bool state)
49 // if option became active, need to disable all other options
51 CombinedFilterOption *option = dynamic_cast<CombinedFilterOption*>(QObject::sender());
53 Q_FOREACH (auto fo, m_list) {
55 CombinedFilterOption *other = dynamic_cast<CombinedFilterOption*>(fo);
57 // note that changing state will result in onActiveChanged signal for that option, but
58 // since it will be 'false', we won't end up in an infinite loop
59 other->setInactive(*option);
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list