| 1 | /***************************************************************************** |
| 2 | ** QNapi |
| 3 | ** Copyright (C) 2008-2017 Piotr KrzemiĆski <[email protected]> |
| 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 2 of the License, or |
| 8 | ** (at your option) any later version. |
| 9 | ** |
| 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
| 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
| 12 | ** |
| 13 | *****************************************************************************/ |
| 14 | |
| 15 | #include "subdatawidget.h" |
| 16 | |
| 17 | subDataWidget::subDataWidget(QWidget *parent) |
| 18 | : QWidget(parent), ui(new Ui::subDataWidget) { |
| 19 | ui->setupUi(this); |
| 20 | } |
| 21 | |
| 22 | subDataWidget::~subDataWidget() { delete ui; } |
| 23 | |
| 24 | void subDataWidget::clearAll() { |
| 25 | ui->place1->clear(); |
| 26 | ui->place2->clear(); |
| 27 | ui->place3->clear(); |
| 28 | ui->place4->clear(); |
| 29 | } |
| 30 | |
| 31 | void subDataWidget::setSubData(const QIcon &stateIcon, QString name, |
| 32 | const QIcon &langIcon, const QIcon &engineIcon) { |
| 33 | ui->place1->setPixmap(stateIcon.pixmap(16)); |
| 34 | ui->place2->setText(name); |
| 35 | ui->place3->setPixmap(langIcon.pixmap(16)); |
| 36 | ui->place4->setPixmap(engineIcon.pixmap(16)); |
| 37 | } |
| 38 | |
| 39 | void subDataWidget::setSubData(const QIcon &stateIcon, QString name) { |
| 40 | this->clearAll(); |
| 41 | |
| 42 | ui->place3->hide(); |
| 43 | ui->place4->hide(); |
| 44 | |
| 45 | ui->place1->setPixmap(stateIcon.pixmap(16)); |
| 46 | ui->place2->setText(name); |
| 47 | } |
| 48 | |
| 49 | void subDataWidget::setSubData(QString name, QString ext, const QIcon &langIcon, |
| 50 | const QIcon &engineIcon) { |
| 51 | this->clearAll(); |
| 52 | |
| 53 | ui->place1->setSizePolicy(QSizePolicy::MinimumExpanding, |
| 54 | QSizePolicy::Preferred); |
| 55 | ui->place2->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Preferred); |
| 56 | |
| 57 | ui->place1->setText(name); |
| 58 | ui->place2->setText(ext); |
| 59 | ui->place3->setPixmap(langIcon.pixmap(16)); |
| 60 | ui->place4->setPixmap(engineIcon.pixmap(16)); |
| 61 | } |