File indexing completed on 2024-04-21 04:05:22
0001 /* 0002 This file is part of the KDE games library 0003 SPDX-FileCopyrightText: 2008 Andreas Pakulat <apaku@gmx.de> 0004 0005 SPDX-License-Identifier: LGPL-2.0-only 0006 */ 0007 0008 #ifndef CARDDECKINFO_H 0009 #define CARDDECKINFO_H 0010 0011 #include <QString> 0012 #include <QStringList> 0013 0014 class KConfigGroup; 0015 0016 /** 0017 * \headerfile carddeckinfo.h <KCardDeckInfo> 0018 * 0019 * Namespace to supply access to card deck information, such as a list of all 0020 * card decks as well as allowing to access the actual files to render the 0021 * decks. 0022 */ 0023 namespace CardDeckInfo 0024 { 0025 /** 0026 * Retrieve the SVG file belonging to the given card deck (back side). 0027 * @param name The untranslated name of the back deck. 0028 * @return The file name and path to the SVG file or QString() if not available. 0029 */ 0030 QString backSVGFilePath(const QString &name); 0031 0032 /** 0033 * Retrieve the SVG file belonging to the given card set (front side). 0034 * The SVG IDs used for the card back is '1_club' for Ace of clubs, '10_spade' 0035 * for 10 of spades, 'queen_heart' for Queen of Hearts, '2_diamond' for 2 of 0036 * diamonds and so on. 0037 * @param name The untranslated name of the card set. 0038 * @return The file name and path to the SVG file or QString() if not available. 0039 */ 0040 QString svgFilePath(const QString &name); 0041 0042 /** 0043 * Retrieve the untranslated name of the default card set (front side). 0044 * @return The default card set name. 0045 */ 0046 QString defaultDeckName(); 0047 0048 /** 0049 * Retrieve the untranslated name of the default card deck (back side). 0050 * @return The default card deck name. 0051 */ 0052 QString defaultBackName(); 0053 0054 /** 0055 * Retrieve a untranslated name random card set (front side). 0056 * @return A random card set name. 0057 */ 0058 QString randomDeckName(); 0059 0060 /** 0061 * Retrieve a untranslated name random card deck (back side). 0062 * @return A random card deck name. 0063 */ 0064 QString randomBackName(); 0065 0066 /** 0067 * Retrieve the filename of the card back side. 0068 * For SVG decks use @ref backSVGFilePath. 0069 * @param name The untranslated name of the card deck. 0070 * @return The filename. 0071 */ 0072 QString backFilename(const QString &name); 0073 0074 /** 0075 * retrieve a list of the untranslated names of all installed backsides 0076 * @returns a list of backside names, which can be used as input to the 0077 * other functions. 0078 */ 0079 QStringList backNames(); 0080 0081 /** 0082 * retrieve a list of the untranslated names of all installed frontsides 0083 * @return a list of frontside names, which can be used as input to the 0084 * other functions. 0085 */ 0086 QStringList deckNames(); 0087 0088 /** 0089 * retrieve the configured front side untranslated theme name from the @p group 0090 * @param group the KConfigGroup to read from 0091 * @param defaultTheme the default theme to return if the config group has no setting for this 0092 * @returns the name of the front side theme name 0093 */ 0094 QString deckName(const KConfigGroup &group, const QString &defaultTheme = defaultDeckName()); 0095 0096 /** 0097 * retrieve the configured back side untranslated theme name from the @p group 0098 * @param group the KConfigGroup to read from 0099 * @param defaultTheme the default theme to return if the config group has no setting for this 0100 * @returns the name of the back side theme name 0101 */ 0102 QString backTheme(const KConfigGroup &group, const QString &defaultTheme = defaultBackName()); 0103 0104 /** 0105 * retrieve the current value for the lock front-to-backside option 0106 * from the @p group 0107 * @param group the KConfigGroup to read from 0108 * @param lockDefault the default value in case the group has no setting 0109 * @returns true when front and backside theme are locked together, else false 0110 */ 0111 bool lockFrontToBackside(const KConfigGroup &group, bool lockDefault = true); 0112 0113 /** 0114 * store the given frontside @p theme name in the @p group 0115 * @param group the KConfigGroup to write to from 0116 * @param theme the theme untranslated name to store 0117 */ 0118 void writeDeckName(KConfigGroup &group, const QString &theme); 0119 0120 /** 0121 * store the given backside @p theme name in the @p group 0122 * @param group the KConfigGroup to write to from 0123 * @param theme the theme untranslated name to store 0124 */ 0125 void writeBackTheme(KConfigGroup &group, const QString &theme); 0126 0127 /** 0128 * store the whether front and backside theme selection is locked 0129 * to the @p group 0130 * @param group the KConfigGroup to write to from 0131 * @param lock whether front and backside theme selection is locked 0132 */ 0133 void writeLockFrontToBackside(KConfigGroup &group, bool lock); 0134 } 0135 0136 #endif