File indexing completed on 2024-05-12 05:09:22
0001 /*************************************************************************** 0002 Copyright (C) 2005-2009 Robby Stephenson <robby@periapsis.org> 0003 Copyright (C) 2005-2009 Steve Beattie <sbeattie@suse.de> 0004 ***************************************************************************/ 0005 0006 /*************************************************************************** 0007 * * 0008 * This program is free software; you can redistribute it and/or * 0009 * modify it under the terms of the GNU General Public License as * 0010 * published by the Free Software Foundation; either version 2 of * 0011 * the License or (at your option) version 3 or any later version * 0012 * accepted by the membership of KDE e.V. (or its successor approved * 0013 * by the membership of KDE e.V.), which shall act as a proxy * 0014 * defined in Section 14 of version 3 of the license. * 0015 * * 0016 * This program is distributed in the hope that it will be useful, * 0017 * but WITHOUT ANY WARRANTY; without even the implied warranty of * 0018 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * 0019 * GNU General Public License for more details. * 0020 * * 0021 * You should have received a copy of the GNU General Public License * 0022 * along with this program. If not, see <http://www.gnu.org/licenses/>. * 0023 * * 0024 ***************************************************************************/ 0025 0026 #include "boardgamecollection.h" 0027 0028 #include <KLocalizedString> 0029 0030 namespace { 0031 static const char* boardgame_general = I18N_NOOP("General"); 0032 static const char* boardgame_personal = I18N_NOOP("Personal"); 0033 } 0034 0035 using Tellico::Data::BoardGameCollection; 0036 0037 BoardGameCollection::BoardGameCollection(bool addDefaultFields_, const QString& title_) 0038 : Collection(title_.isEmpty() ? i18n("My Board Games") : title_) { 0039 setDefaultGroupField(QStringLiteral("genre")); 0040 if(addDefaultFields_) { 0041 addFields(defaultFields()); 0042 } 0043 } 0044 0045 Tellico::Data::FieldList BoardGameCollection::defaultFields() { 0046 FieldList list; 0047 FieldPtr field; 0048 0049 list.append(Field::createDefaultField(Field::TitleField)); 0050 0051 field = new Field(QStringLiteral("genre"), i18n("Genre")); 0052 field->setCategory(i18n(boardgame_general)); 0053 field->setFlags(Field::AllowCompletion | Field::AllowMultiple | Field::AllowGrouped); 0054 field->setFormatType(FieldFormat::FormatPlain); 0055 list.append(field); 0056 0057 field = new Field(QStringLiteral("mechanism"), i18n("Mechanism")); 0058 field->setCategory(i18n(boardgame_general)); 0059 field->setFlags(Field::AllowCompletion | Field::AllowMultiple | Field::AllowGrouped); 0060 field->setFormatType(FieldFormat::FormatPlain); 0061 list.append(field); 0062 0063 field = new Field(QStringLiteral("year"), i18n("Release Year"), Field::Number); 0064 field->setCategory(i18n(boardgame_general)); 0065 field->setFlags(Field::AllowGrouped); 0066 list.append(field); 0067 0068 field = new Field(QStringLiteral("publisher"), i18n("Publisher")); 0069 field->setCategory(i18n(boardgame_general)); 0070 field->setFlags(Field::AllowCompletion | Field::AllowMultiple | Field::AllowGrouped); 0071 field->setFormatType(FieldFormat::FormatPlain); 0072 list.append(field); 0073 0074 field = new Field(QStringLiteral("designer"), i18n("Designer")); 0075 field->setCategory(i18n(boardgame_general)); 0076 field->setFlags(Field::AllowCompletion | Field::AllowMultiple | Field::AllowGrouped); 0077 field->setFormatType(FieldFormat::FormatPlain); 0078 list.append(field); 0079 0080 field = new Field(QStringLiteral("num-player"), i18n("Number of Players"), Field::Number); 0081 field->setCategory(i18n(boardgame_general)); 0082 field->setFlags(Field::AllowMultiple | Field::AllowGrouped); 0083 list.append(field); 0084 0085 field = new Field(QStringLiteral("playing-time"), i18n("Playing Time"), Field::Number); 0086 field->setCategory(i18n(boardgame_general)); 0087 field->setFlags(Field::AllowGrouped); 0088 list.append(field); 0089 0090 field = new Field(QStringLiteral("minimum-age"), i18n("Minimum Age"), Field::Number); 0091 field->setCategory(i18n(boardgame_general)); 0092 field->setFlags(Field::AllowGrouped); 0093 list.append(field); 0094 0095 field = new Field(QStringLiteral("description"), i18n("Description"), Field::Para); 0096 list.append(field); 0097 0098 field = new Field(QStringLiteral("rating"), i18n("Rating"), Field::Rating); 0099 field->setCategory(i18n(boardgame_personal)); 0100 field->setFlags(Field::AllowGrouped); 0101 list.append(field); 0102 0103 field = new Field(QStringLiteral("pur_date"), i18n("Purchase Date")); 0104 field->setCategory(i18n(boardgame_personal)); 0105 field->setFormatType(FieldFormat::FormatDate); 0106 list.append(field); 0107 0108 field = new Field(QStringLiteral("gift"), i18n("Gift"), Field::Bool); 0109 field->setCategory(i18n(boardgame_personal)); 0110 list.append(field); 0111 0112 field = new Field(QStringLiteral("pur_price"), i18n("Purchase Price")); 0113 field->setCategory(i18n(boardgame_personal)); 0114 list.append(field); 0115 0116 field = new Field(QStringLiteral("loaned"), i18n("Loaned"), Field::Bool); 0117 field->setCategory(i18n(boardgame_personal)); 0118 list.append(field); 0119 0120 field = new Field(QStringLiteral("cover"), i18n("Cover"), Field::Image); 0121 list.append(field); 0122 0123 field = new Field(QStringLiteral("comments"), i18n("Comments"), Field::Para); 0124 field->setCategory(i18n(boardgame_personal)); 0125 list.append(field); 0126 0127 list.append(Field::createDefaultField(Field::IDField)); 0128 list.append(Field::createDefaultField(Field::CreatedDateField)); 0129 list.append(Field::createDefaultField(Field::ModifiedDateField)); 0130 0131 return list; 0132 }