2
* Copyright (C) 2011 Canonical Ltd
4
* This program is free software: you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License version 3 as
6
* published by the Free Software Foundation.
8
* This program is distributed in the hope that it will be useful,
9
* but WITHOUT ANY WARRANTY; without even the implied warranty of
10
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
* GNU General Public License for more details.
13
* You should have received a copy of the GNU General Public License
14
* along with this program. If not, see <http://www.gnu.org/licenses/>.
17
* Jim Nelson <jim@yorba.org>
18
* Lucas Beeler <lucas@yorba.org>
21
#include "checkerboard-agent.h"
23
#include <QDeclarativeView>
24
#include <QDeclarativeItem>
26
#include "qml-media-model.h"
28
CheckerboardAgent::CheckerboardAgent(QDeclarativeView* view) {
29
// TODO: Clean this up
30
QDeclarativeItem* item =
31
qobject_cast<QDeclarativeItem*>(view->rootObject());
32
Q_ASSERT(item != NULL);
34
QObject* loader = item->findChild<QObject*>("loader");
35
Q_ASSERT(loader != NULL);
37
QObject* checkerboard = loader->findChild<QObject*>("checkerboard");
38
Q_ASSERT(checkerboard != NULL);
40
QObject::connect(checkerboard, SIGNAL(activated(int)), this,
41
SIGNAL(activated(int)));
43
QObject::connect(checkerboard, SIGNAL(selection_toggled(int)), this,
44
SIGNAL(selection_toggled(int)));
46
QObject::connect(checkerboard, SIGNAL(unselect_all()), this,
47
SIGNAL(unselect_all()));
49
grid_ = checkerboard->findChild<QObject*>("grid");
50
Q_ASSERT(grid_ != NULL);