blob: bb57907376c88624be5269e7c4bcc64bfeb92b6d [file] [log] [blame]
Edric Milaret5cbf2b62015-07-09 11:36:53 -04001/***************************************************************************
2 * Copyright (C) 2015 by Savoir-Faire Linux *
3 * Author: Edric Ladent Milaret <edric.ladent-milaret@savoirfairelinux.com>*
4 * *
5 * This program 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. *
9 * *
10 * This program 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. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program. If not, see <http://www.gnu.org/licenses/>. *
17 **************************************************************************/
18
19#ifndef TRANSFERDIALOG_H
20#define TRANSFERDIALOG_H
21
22#include <QDialog>
23#include <QSortFilterProxyModel>
24
25#include "callmodel.h"
26
27namespace Ui {
28class TransferDialog;
29}
30
31class ActiveCallsProxyModel : public QSortFilterProxyModel
32{
33public:
34 ActiveCallsProxyModel(QAbstractItemModel* parent) : QSortFilterProxyModel(parent)
35 {
36 setSourceModel(parent);
37 }
38 virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const
39 {
40 return sourceModel()->index(source_row,0,source_parent)
41 .data(static_cast<int>(Call::Role::State)).value<Call::State>() != Call::State::CURRENT;
42 }
43};
44
45
46class TransferDialog : public QDialog
47{
48 Q_OBJECT
49
50public:
51 explicit TransferDialog(QWidget *parent = 0);
52 ~TransferDialog();
53
54//UI SLOTS
55protected slots:
56 void showEvent(QShowEvent *event);
57private slots:
58 void on_transferButton_clicked();
59 void on_activeCallsView_doubleClicked(const QModelIndex &index);
60 void on_activeCallsView_clicked(const QModelIndex &index);
61
62private:
63 Ui::TransferDialog *ui;
64 Call *selectedCall_;
65};
66
67#endif // TRANSFERDIALOG_H