1 /**
2  * \file eventcodedelegate.cpp
3  * Delegate for event timing codes.
4  *
5  * \b Project: Kid3
6  * \author Urs Fleisch
7  * \date 14 Mar 2014
8  *
9  * Copyright (C) 2014-2018  Urs Fleisch
10  *
11  * This file is part of Kid3.
12  *
13  * Kid3 is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License as published by
15  * the Free Software Foundation; either version 2 of the License, or
16  * (at your option) any later version.
17  *
18  * Kid3 is distributed in the hope that it will be useful,
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
21  * GNU General Public License for more details.
22  *
23  * You should have received a copy of the GNU General Public License
24  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
25  */
26 
27 #include "eventcodedelegate.h"
28 #include "eventtimingcode.h"
29 
30 /**
31  * @brief Constructor.
32  * @param parent parent object
33  */
EventCodeDelegate(QObject * parent)34 EventCodeDelegate::EventCodeDelegate(QObject* parent) : EnumDelegate(parent)
35 {
36 }
37 
getEnumStrings() const38 QStringList EventCodeDelegate::getEnumStrings() const
39 {
40   return EventTimeCode::getTranslatedStrings();
41 }
42 
getStringForEnum(int enumNr) const43 QString EventCodeDelegate::getStringForEnum(int enumNr) const
44 {
45   return EventTimeCode(enumNr).toTranslatedString();
46 }
47 
getIndexForEnum(int enumNr) const48 int EventCodeDelegate::getIndexForEnum(int enumNr) const
49 {
50   return EventTimeCode(enumNr).toIndex();
51 }
52 
getEnumForIndex(int index) const53 int EventCodeDelegate::getEnumForIndex(int index) const
54 {
55   return EventTimeCode::fromIndex(index).getCode();
56 }
57