KVIrc 5.2.6
Developer APIs
KviTheme.h
Go to the documentation of this file.
1#ifndef _KVI_THEME_H_
2#define _KVI_THEME_H_
3//=============================================================================
4//
5// File : KviTheme.h
6// Creation date : Mon Jan 08 2007 03:23:00 CEST by Szymon Stefanek
7//
8// This file is part of the KVIrc IRC client distribution
9// Copyright (C) 2007-2010 Szymon Stefanek (pragma at kvirc dot net)
10//
11// This program is FREE software. You can redistribute it and/or
12// modify it under the terms of the GNU General Public License
13// as published by the Free Software Foundation; either version 2
14// of the License, or (at your option) any later version.
15//
16// This program is distributed in the HOPE that it will be USEFUL,
17// but WITHOUT ANY WARRANTY; without even the implied warranty of
18// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
19// See the GNU General Public License for more details.
20//
21// You should have received a copy of the GNU General Public License
22// along with this program. If not, write to the Free Software Foundation,
23// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
24//
25//=============================================================================
26
27#include "kvi_settings.h"
28#include "KviHeapObject.h"
29#include "kvi_fileextensions.h"
30#include "KviApplication.h"
31#include "KviFileUtils.h"
32
33#include <QPixmap>
34#include <QString>
35
36#define KVI_THEMEINFO_FILE_NAME "themeinfo" KVI_FILEEXTENSION_CONFIG
37#define KVI_THEMEDATA_FILE_NAME "themedata" KVI_FILEEXTENSION_CONFIG
38#define KVI_THEMEINFO_CONFIG_GROUP "ThemeInfo"
39#define KVI_THEMEDATA_CONFIG_GROUP "ThemeData"
40
45#define KVI_CURRENT_THEME_ENGINE_VERSION "1.1.0"
46
58{
59public:
62
63public:
65 {
69 Builtin = 0,
73 User = 1,
77 External = 3,
81 Auto = 4
82 };
83
84protected:
85 QString m_szName; //< name of the theme
86 QString m_szVersion; //< version of the theme
87
88 QString m_szDirectory; //< the absolute directory of the theme
89 QString m_szSubdirectory; //< the last component of m_szDirectory (this is needed when the theme is installed)
90 Location m_eLocation; //< the location of the theme
91
92 QString m_szAuthor; //< author of the theme
93 QString m_szDescription; //< description of the theme
94 QString m_szDate; //< theme creation date
95 QString m_szApplication; //< theme creation (KVIrc) version
96 QString m_szThemeEngineVersion; //< the theme engine version that saved this theme
97
98 QString m_szLastError; //< reported when some function fails
99
100 QPixmap m_pixScreenshotLarge; //< the large screenshot pixmap
101 QPixmap m_pixScreenshotMedium; //< the medium screenshot pixmap
102 QPixmap m_pixScreenshotSmall; //< the small screenshot pixmap
103
104public:
111 bool load(const QString & szDirectory, Location eLocation);
112
116 bool save(const QString & szThemeFileName);
117
118 const QString & lastError() { return m_szLastError; }
119 void setLastError(const QString & szLastError) { m_szLastError = szLastError; }
120 const QString & name() { return m_szName; }
121 void setName(const QString & szName) { m_szName = szName; }
122 const QString & version() { return m_szVersion; }
123 void setVersion(const QString & szVersion) { m_szVersion = szVersion; }
124
125 const QString & directory() const
126 {
127 return m_szDirectory;
128 }
129
130 const QString & subdirectory() const
131 {
132 return m_szSubdirectory;
133 }
134
136 {
137 return m_eLocation;
138 }
139
140 void setDirectoryAndLocation(const QString & szDirectory, Location eLocation);
141
143 {
144 return m_eLocation == KviThemeInfo::Builtin;
145 }
146
147 const QString & author() { return m_szAuthor; }
148 void setAuthor(const QString & szAuthor) { m_szAuthor = szAuthor; }
149 const QString & description() { return m_szDescription; }
150 void setDescription(const QString & szDescription) { m_szDescription = szDescription; }
151 const QString & date() { return m_szDate; }
152 void setDate(const QString & szDate) { m_szDate = szDate; }
153 const QString & application() { return m_szApplication; }
154 void setApplication(const QString & szApplication) { m_szApplication = szApplication; }
155 const QString & themeEngineVersion() { return m_szThemeEngineVersion; }
156 void setThemeEngineVersion(const QString & szThemeEngineVersion) { m_szThemeEngineVersion = szThemeEngineVersion; }
157
163 const QPixmap & smallScreenshot();
169 const QPixmap & mediumScreenshot();
175 const QPixmap & largeScreenshot();
181 QString smallScreenshotPath();
182};
183
184namespace KviTheme
185{
196 bool KVIRC_API apply(const QString & szThemeDirectory, KviThemeInfo::Location eLocation, KviThemeInfo & buffer);
197
208 bool KVIRC_API save(KviThemeInfo & options, bool bSaveIcons);
209
214 bool KVIRC_API saveScreenshots(KviThemeInfo & options, const QString & szOriginalScreenshotPath);
215
219 void KVIRC_API installedThemeDirectories(QStringList & slThemes, KviThemeInfo::Location eLocation);
220}
221
222#endif //_KVI_THEME_H_
File utilities functions.
Heap Object.
Definition KviHeapObject.h:119
A set of information about a KVIrc theme.
Definition KviTheme.h:58
QPixmap m_pixScreenshotSmall
Definition KviTheme.h:102
void setThemeEngineVersion(const QString &szThemeEngineVersion)
Definition KviTheme.h:156
const QString & subdirectory() const
Definition KviTheme.h:130
QPixmap m_pixScreenshotLarge
Definition KviTheme.h:100
const QString & author()
Definition KviTheme.h:147
QString m_szDescription
Definition KviTheme.h:93
bool isBuiltin()
Definition KviTheme.h:142
void setDescription(const QString &szDescription)
Definition KviTheme.h:150
void setDate(const QString &szDate)
Definition KviTheme.h:152
QString m_szApplication
Definition KviTheme.h:95
QString m_szDirectory
Definition KviTheme.h:88
const QString & date()
Definition KviTheme.h:151
const QString & version()
Definition KviTheme.h:122
const QString & description()
Definition KviTheme.h:149
Location
Definition KviTheme.h:65
@ Builtin
Definition KviTheme.h:69
QPixmap m_pixScreenshotMedium
Definition KviTheme.h:101
QString m_szVersion
Definition KviTheme.h:86
const QString & name()
Definition KviTheme.h:120
QString m_szSubdirectory
Definition KviTheme.h:89
QString m_szLastError
Definition KviTheme.h:98
void setLastError(const QString &szLastError)
Definition KviTheme.h:119
QString m_szThemeEngineVersion
Definition KviTheme.h:96
QString m_szName
Definition KviTheme.h:85
const QString & application()
Definition KviTheme.h:153
void setApplication(const QString &szApplication)
Definition KviTheme.h:154
void setAuthor(const QString &szAuthor)
Definition KviTheme.h:148
QString m_szDate
Definition KviTheme.h:94
void setVersion(const QString &szVersion)
Definition KviTheme.h:123
QString m_szAuthor
Definition KviTheme.h:92
Location m_eLocation
Definition KviTheme.h:90
void setName(const QString &szName)
Definition KviTheme.h:121
const QString & lastError()
Definition KviTheme.h:118
Location location() const
Definition KviTheme.h:135
const QString & themeEngineVersion()
Definition KviTheme.h:155
const QString & directory() const
Definition KviTheme.h:125
This file contains the file extensions and filters used by KVIrc.
This file contains compile time settings.
#define KVIRC_API
Definition kvi_settings.h:127
Definition KviOptions.cpp:995
bool saveScreenshots(KviThemeInfo &options, const QString &szOriginalScreenshotPath)
Definition KviTheme.cpp:268
void installedThemeDirectories(QStringList &slThemes, KviThemeInfo::Location eLocation)
Definition KviTheme.cpp:318
bool save(KviThemeInfo &options, bool bSaveIcons)
Definition KviOptions.cpp:998
bool apply(const QString &szThemeDir, KviThemeInfo::Location eLocation, KviThemeInfo &buffer)
Definition KviOptions.cpp:1131