1 // Copyright 2010 Jochen Becher
3 // This file is part of MovieSchedule.
5 // MovieSchedule is free software: you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation, either version 3 of the License, or
8 // (at your option) any later version.
10 // MovieSchedule is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with MovieSchedule. If not, see <http://www.gnu.org/licenses/>.
18 #include "itemmodelsortclient.h"
20 #include "itemmodelsortproxy.h"
21 #include "itemmodelsortcontroller.h"
25 ItemModelSortClient::ItemModelSortClient(ItemModelSortController *controller, QObject *parent)
27 _proxy(new ItemModelSortProxy(controller)),
32 connect(this, SIGNAL(Sort(QAbstractItemModel*)), _proxy, SLOT(Sort(QAbstractItemModel*)));
33 connect(_proxy, SIGNAL(SortFinished(QAbstractItemModel*)), this, SLOT(SortFinished(QAbstractItemModel*)));
34 _proxy->moveToThread(controller->thread());
37 void ItemModelSortClient::Sort(QAbstractItemModel *model, int task_id, bool intermediate)
41 _intermediate = intermediate;
42 //std::cout << "Start sorting model " << model << " with intermediate = " << intermediate << std::endl;
46 void ItemModelSortClient::SortFinished(QAbstractItemModel *model)
48 //std::cout << "Finished sorting model " << model << " with intermediate = " << _intermediate << std::endl;
49 emit SortFinished(model, _task_id, _intermediate);