]> cloud.milkyroute.net Git - dolphin.git/blob - src/search/dolphinfacetswidget.cpp
Fix search-UI issues in combination with the new places entries
[dolphin.git] / src / search / dolphinfacetswidget.cpp
1 /***************************************************************************
2 * Copyright (C) 2012 by Peter Penz <peter.penz19@gmail.com> *
3 * *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; either version 2 of the License, or *
7 * (at your option) any later version. *
8 * *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
13 * *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA *
18 * **************************************************************************/
19
20 #include "dolphinfacetswidget.h"
21
22 #include <KLocale>
23 #include <QCheckBox>
24 #include <QRadioButton>
25 #include <QHBoxLayout>
26 #include <QVBoxLayout>
27
28 DolphinFacetsWidget::DolphinFacetsWidget(QWidget* parent) :
29 QWidget(parent),
30 m_documents(0),
31 m_images(0),
32 m_audio(0),
33 m_videos(0),
34 m_anytime(0),
35 m_today(0),
36 m_yesterday(0),
37 m_thisWeek(0),
38 m_thisMonth(0),
39 m_thisYear(0),
40 m_anyRating(0),
41 m_oneOrMore(0),
42 m_twoOrMore(0),
43 m_threeOrMore(0),
44 m_fourOrMore(0),
45 m_maxRating(0)
46 {
47 m_documents = new QCheckBox(i18nc("@option:check", "Documents"));
48 m_images = new QCheckBox(i18nc("@option:check", "Images"));
49 m_audio = new QCheckBox(i18nc("@option:check", "Audio"));
50 m_videos = new QCheckBox(i18nc("@option:check", "Videos"));
51
52 QVBoxLayout* typeLayout = new QVBoxLayout();
53 typeLayout->setSpacing(0);
54 typeLayout->addWidget(m_documents);
55 typeLayout->addWidget(m_images);
56 typeLayout->addWidget(m_audio);
57 typeLayout->addWidget(m_videos);
58 typeLayout->addStretch();
59
60 m_anytime = new QRadioButton(i18nc("@option:option", "Anytime"));
61 m_today = new QRadioButton(i18nc("@option:option", "Today"));
62 m_yesterday = new QRadioButton(i18nc("@option:option", "Yesterday"));
63 m_thisWeek = new QRadioButton(i18nc("@option:option", "This Week"));
64 m_thisMonth = new QRadioButton(i18nc("@option:option", "This Month"));
65 m_thisYear = new QRadioButton(i18nc("@option:option", "This Year"));
66
67 QVBoxLayout* timespanLayout = new QVBoxLayout();
68 timespanLayout->setSpacing(0);
69 timespanLayout->addWidget(m_anytime);
70 timespanLayout->addWidget(m_today);
71 timespanLayout->addWidget(m_yesterday);
72 timespanLayout->addWidget(m_thisWeek);
73 timespanLayout->addWidget(m_thisMonth);
74 timespanLayout->addWidget(m_thisYear);
75 timespanLayout->addStretch();
76
77 m_anyRating = new QRadioButton(i18nc("@option:option", "Any Rating"));
78 m_oneOrMore = new QRadioButton(i18nc("@option:option", "1 or more"));
79 m_twoOrMore = new QRadioButton(i18nc("@option:option", "2 or more"));
80 m_threeOrMore = new QRadioButton(i18nc("@option:option", "3 or more"));
81 m_fourOrMore = new QRadioButton(i18nc("@option:option", "4 or more"));
82 m_maxRating = new QRadioButton(i18nc("@option:option", "Maximum Rating"));
83
84 QVBoxLayout* ratingLayout = new QVBoxLayout();
85 ratingLayout->setSpacing(0);
86 ratingLayout->addWidget(m_anyRating);
87 ratingLayout->addWidget(m_oneOrMore);
88 ratingLayout->addWidget(m_twoOrMore);
89 ratingLayout->addWidget(m_threeOrMore);
90 ratingLayout->addWidget(m_fourOrMore);
91 ratingLayout->addWidget(m_maxRating);
92
93 QHBoxLayout* topLayout = new QHBoxLayout(this);
94 topLayout->addLayout(typeLayout);
95 topLayout->addLayout(timespanLayout);
96 topLayout->addLayout(ratingLayout);
97 topLayout->addStretch();
98
99 // TODO:
100 m_anytime->setChecked(true);
101 m_anyRating->setChecked(true);
102 }
103
104 DolphinFacetsWidget::~DolphinFacetsWidget()
105 {
106 }
107
108 #include "dolphinfacetswidget.moc"