Isa Nanic | 6e4a39a | 2018-12-04 14:26:02 -0500 | [diff] [blame] | 1 | /**************************************************************************** |
Sébastien Blin | 68abac9 | 2019-01-02 17:41:31 -0500 | [diff] [blame] | 2 | * Copyright (C) 2018-2019 Savoir-faire Linux Inc. * |
Isa Nanic | 6e4a39a | 2018-12-04 14:26:02 -0500 | [diff] [blame] | 3 | * Author: Isa Nanic <isa.nanic@savoirfairelinux.com> * |
| 4 | * * |
| 5 | * This library is free software; you can redistribute it and/or * |
| 6 | * modify it under the terms of the GNU Lesser General Public * |
| 7 | * License as published by the Free Software Foundation; either * |
| 8 | * version 2.1 of the License, or (at your option) any later version. * |
| 9 | * * |
| 10 | * This library 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 GNU * |
| 13 | * Lesser 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 | #include <QListWidgetItem> |
| 19 | #include <QLineEdit> |
| 20 | #include <QLabel> |
| 21 | #include <QPushButton> |
| 22 | |
| 23 | |
| 24 | |
| 25 | class SettingsItemWidget : public QListWidgetItem |
| 26 | { |
| 27 | public: |
| 28 | SettingsItemWidget(int height, int index, bool banned, QListWidget* parent = nullptr); |
| 29 | ~SettingsItemWidget(); |
| 30 | |
| 31 | QPushButton* button_; |
| 32 | |
| 33 | private: |
| 34 | bool selected_ = false; |
| 35 | bool banned_ = false; |
| 36 | const int index_; |
| 37 | const int height_; |
| 38 | |
| 39 | const int horMargin_ = 15; |
| 40 | const int verMargin_ = 8; |
| 41 | |
| 42 | QLineEdit* nameEdit_; |
| 43 | QLabel* idlabel_; |
| 44 | |
| 45 | void toggleEditable(); |
| 46 | void finishEdit(); |
| 47 | |
| 48 | bool editable_ = false; |
| 49 | }; |
| 50 | |