1 /**
2 * UGENE - Integrated Bioinformatics Tools.
3 * Copyright (C) 2008-2021 UniPro <ugene@unipro.ru>
4 * http://ugene.net
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
19 * MA 02110-1301, USA.
20 */
21
22 #include <cassert>
23
24 #include "Descriptor.h"
25
26 namespace U2 {
27
28 /**************************
29 * Descriptor
30 **************************/
Descriptor(const QString & id,const QString & name,const QString & doc)31 Descriptor::Descriptor(const QString &id, const QString &name, const QString &doc)
32 : id(id), name(name), desc(doc) {
33 }
34
Descriptor(const QString & _id)35 Descriptor::Descriptor(const QString &_id)
36 : id(_id), name(_id), desc(_id) {
37 }
38
Descriptor(const char * _id)39 Descriptor::Descriptor(const char *_id)
40 : id(_id), name(_id), desc(_id) {
41 }
42
Descriptor()43 Descriptor::Descriptor() {
44 }
45
getId() const46 QString Descriptor::getId() const {
47 return id;
48 }
49
getDisplayName() const50 QString Descriptor::getDisplayName() const {
51 return name;
52 }
53
getDocumentation() const54 QString Descriptor::getDocumentation() const {
55 return desc;
56 }
57
setId(const QString & i)58 void Descriptor::setId(const QString &i) {
59 id = i;
60 }
61
setDocumentation(const QString & d)62 void Descriptor::setDocumentation(const QString &d) {
63 desc = d;
64 }
65
setDisplayName(const QString & n)66 void Descriptor::setDisplayName(const QString &n) {
67 name = n;
68 }
69
70 /**************************
71 * VisualDescriptor
72 **************************/
VisualDescriptor(const Descriptor & d,const QString & _iconPath)73 VisualDescriptor::VisualDescriptor(const Descriptor &d, const QString &_iconPath)
74 : Descriptor(d), iconPath(_iconPath) {
75 }
76
setIconPath(const QString & ip)77 void VisualDescriptor::setIconPath(const QString &ip) {
78 iconPath = ip;
79 }
80
getIcon()81 QIcon VisualDescriptor::getIcon() {
82 if (icon.isNull() && !iconPath.isEmpty()) {
83 icon = QIcon(iconPath);
84 }
85 return icon;
86 }
87
setIcon(QIcon i)88 void VisualDescriptor::setIcon(QIcon i) {
89 assert(iconPath.isEmpty());
90 icon = i;
91 }
92
93 } // namespace U2
94