Debian Codegraph @

src/views/listview.cc

raw
1 /*
2 This file is part of Icecream.
3
4 Copyright (c) 2003 Frerich Raabe <[email protected]>
5 Copyright (c) 2003,2004 Stephan Kulow <[email protected]>
6 Copyright (c) 2004 Andre Wöbbeking <[email protected]>
7 Copyright (c) 2014 Allan Sandfeld Jensen <[email protected]>
8
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 2 of the License, or
12 (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License along
20 with this program; if not, write to the Free Software Foundation, Inc.,
21 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
22 */
23
24 #include "listview.h"
25
26 #include "joblistview.h"
27 #include "models/joblistmodel.h"
28
29 #include <QBoxLayout>
30
31 ListStatusView::ListStatusView(QObject *parent)
32 : StatusView(parent)
33 , m_widget(new QWidget)
34 , mJobsListView(new JobListView(m_widget.data()))
35 {
36 mJobsListModel = new JobListModel(this);
37 mSortedJobsListModel = new JobListSortFilterProxyModel(this);
38 mSortedJobsListModel->setDynamicSortFilter(true);
39 mSortedJobsListModel->setSourceModel(mJobsListModel);
40
41 mJobsListView->setModel(mSortedJobsListModel);
42
43 auto topLayout = new QVBoxLayout(m_widget.data());
44 topLayout->setContentsMargins({});
45 topLayout->addWidget(mJobsListView);
46 }
47
48 StatusView::Options ListStatusView::options() const
49 {
50 return RememberJobsOption;
51 }
52
53 QWidget *ListStatusView::widget() const
54 {
55 return m_widget.data();
56 }
57
58 void ListStatusView::setMonitor(Monitor *monitor)
59 {
60 StatusView::setMonitor(monitor);
61
62 mJobsListModel->setMonitor(monitor);
63 }