Edric Milaret | 5cbf2b6 | 2015-07-09 11:36:53 -0400 | [diff] [blame] | 1 | /*************************************************************************** |
Edric Milaret | 5f316da | 2015-09-28 11:57:42 -0400 | [diff] [blame^] | 2 | * Copyright (C) 2015 by Savoir-faire Linux * |
Edric Milaret | 5cbf2b6 | 2015-07-09 11:36:53 -0400 | [diff] [blame] | 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 | |
Edric Milaret | 5f316da | 2015-09-28 11:57:42 -0400 | [diff] [blame^] | 19 | #pragma once |
Edric Milaret | 5cbf2b6 | 2015-07-09 11:36:53 -0400 | [diff] [blame] | 20 | |
| 21 | #include <QDialog> |
| 22 | #include <QSortFilterProxyModel> |
| 23 | |
| 24 | #include "callmodel.h" |
| 25 | |
| 26 | namespace Ui { |
| 27 | class TransferDialog; |
| 28 | } |
| 29 | |
| 30 | class ActiveCallsProxyModel : public QSortFilterProxyModel |
| 31 | { |
| 32 | public: |
| 33 | ActiveCallsProxyModel(QAbstractItemModel* parent) : QSortFilterProxyModel(parent) |
| 34 | { |
| 35 | setSourceModel(parent); |
| 36 | } |
| 37 | virtual bool filterAcceptsRow(int source_row, const QModelIndex& source_parent) const |
| 38 | { |
| 39 | return sourceModel()->index(source_row,0,source_parent) |
| 40 | .data(static_cast<int>(Call::Role::State)).value<Call::State>() != Call::State::CURRENT; |
| 41 | } |
| 42 | }; |
| 43 | |
| 44 | |
| 45 | class TransferDialog : public QDialog |
| 46 | { |
| 47 | Q_OBJECT |
| 48 | |
| 49 | public: |
| 50 | explicit TransferDialog(QWidget *parent = 0); |
| 51 | ~TransferDialog(); |
| 52 | |
| 53 | //UI SLOTS |
| 54 | protected slots: |
| 55 | void showEvent(QShowEvent *event); |
| 56 | private slots: |
| 57 | void on_transferButton_clicked(); |
| 58 | void on_activeCallsView_doubleClicked(const QModelIndex &index); |
| 59 | void on_activeCallsView_clicked(const QModelIndex &index); |
| 60 | |
| 61 | private: |
| 62 | Ui::TransferDialog *ui; |
| 63 | Call *selectedCall_; |
| 64 | }; |
| 65 | |