~ubuntu-branches/ubuntu/trusty/kvirc/trusty

« back to all changes in this revision

Viewing changes to src/kvirc/kernel/kvi_theme.h

  • Committer: Bazaar Package Importer
  • Author(s): Kai Wasserbäch, Kai Wasserbäch, Raúl Sánchez Siles
  • Date: 2011-02-12 10:40:21 UTC
  • mfrom: (14.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110212104021-5mh4f75jlku20mnt
The combined "Twisted Experiment" and "Nocturnal Raid" release.

[ Kai Wasserbäch ]
* Synced to upstream's SVN revision 5467.
* debian/rules:
  - Added .PHONY line.
  - Resurrect -DMANUAL_REVISION, got lost somewhere and we build SVN
    revisions again.
  - Replace "-DWITH_NO_EMBEDDED_CODE=YES" with "-DWANT_CRYPTOPP=YES".
  - Change the remaining -DWITH/-DWITHOUT to the new -DWANT syntax.
* debian/control:
  - Removed DMUA, I'm a DD now.
  - Changed my e-mail address.
  - Removed unneeded relationships (no upgrades over two releases are
    supported).
  - Fix Suggests for kvirc-dbg.
  - kvirc-data: Make the "Suggests: kvirc" a Recommends, doesn't make much
    sense to install the -data package without the program.
* debian/source/local-options: Added with "unapply-patches".
* debian/kvirc.lintian-overrides: Updated to work for 4.1.1.
* debian/patches/21_make_shared-mime-info_B-D_superfluous.patch: Updated.
* debian/kvirc-data.install: Added .notifyrc.

[ Raúl Sánchez Siles ]
* Stating the right version where kvirc-data break and replace should happen.
* Fixing link to license file.
* Added French and Portuguese man pages.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#ifndef _KVI_THEME_H_
2
 
#define _KVI_THEME_H_
3
 
 
4
 
//=============================================================================
5
 
//
6
 
//   File : kvi_theme.h
7
 
//   Creation date : Mon Jan 08 2007 03:23:00 CEST by Szymon Stefanek
8
 
//
9
 
//   This file is part of the KVirc irc client distribution
10
 
//   Copyright (C) 2007-2008 Szymon Stefanek (pragma at kvirc dot net)
11
 
//
12
 
//   This program is FREE software. You can redistribute it and/or
13
 
//   modify it under the terms of the GNU General Public License
14
 
//   as published by the Free Software Foundation; either version 2
15
 
//   of the License, or (at your opinion) any later version.
16
 
//
17
 
//   This program is distributed in the HOPE that it will be USEFUL,
18
 
//   but WITHOUT ANY WARRANTY; without even the implied warranty of
19
 
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
20
 
//   See the GNU General Public License for more details.
21
 
//
22
 
//   You should have received a copy of the GNU General Public License
23
 
//   along with this program. If not, write to the Free Software Foundation,
24
 
//   Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25
 
//
26
 
//=============================================================================
27
 
 
28
 
#include "kvi_settings.h"
29
 
#include "kvi_qstring.h"
30
 
#include "kvi_heapobject.h"
31
 
#include "kvi_fileextensions.h"
32
 
 
33
 
#include <QPixmap>
34
 
 
35
 
#define KVI_THEMEINFO_FILE_NAME "themeinfo" KVI_FILEEXTENSION_CONFIG
36
 
#define KVI_THEMEDATA_FILE_NAME "themedata" KVI_FILEEXTENSION_CONFIG
37
 
#define KVI_THEMEINFO_CONFIG_GROUP "ThemeInfo"
38
 
#define KVI_THEMEDATA_CONFIG_GROUP "ThemeData"
39
 
 
40
 
///
41
 
/// The current theme engine version: bump up if you make INCOMPATIBLE
42
 
/// changes in the method of saving the theme.
43
 
///
44
 
#define KVI_CURRENT_THEME_ENGINE_VERSION "1.0.0"
45
 
 
46
 
///
47
 
/// \class KviThemeInfo
48
 
///
49
 
/// \brief A set of information about a KVIrc theme
50
 
///
51
 
/// This object contains a set of information about
52
 
/// a theme that can be read and stored to a standard
53
 
/// KVIrc configuration file (which is usually named
54
 
/// themeinfo.kvc but this is not strictly necessary).
55
 
///
56
 
class KVIRC_API KviThemeInfo : public KviHeapObject
57
 
{
58
 
public:
59
 
        KviThemeInfo();
60
 
        ~KviThemeInfo();
61
 
protected:
62
 
        QString m_szName;               //< name of the theme
63
 
        QString m_szVersion;            //< version of the theme
64
 
        QString m_szSubdirectory;       //< subdirectory of $LOCALKVIRCDIR/themes where the theme is saved to (not always used)
65
 
        QString m_szAbsoluteDirectory;  //< absolute directory where the theme should be saved to (or is loaded from)
66
 
        QString m_szAuthor;             //< author of the theme
67
 
        QString m_szDescription;        //< description of the theme
68
 
        QString m_szDate;               //< theme creation date
69
 
        QString m_szApplication;        //< theme creation (KVIrc) version
70
 
        QString m_szThemeEngineVersion; //< the theme engine version that saved this theme
71
 
 
72
 
        QString m_szLastError;          //< reported when some function fails
73
 
 
74
 
        QPixmap m_pixScreenshotLarge;   //< the large screenshot pixmap
75
 
        QPixmap m_pixScreenshotMedium;  //< the medium screenshot pixmap
76
 
        QPixmap m_pixScreenshotSmall;   //< the small screenshot pixmap
77
 
public:
78
 
        ///
79
 
        /// load data from a specified theme config file
80
 
        ///
81
 
        bool load(const QString &szThemeFileName);
82
 
        ///
83
 
        /// save the currently defined theme configuration in the specified file
84
 
        ///
85
 
        bool save(const QString &szThemeFileName);
86
 
 
87
 
        const QString & lastError(){ return m_szLastError; };
88
 
        void setLastError(const QString &szLastError){ m_szLastError = szLastError; };
89
 
        const QString & name(){ return m_szName; };
90
 
        void setName(const QString &szName){ m_szName = szName; };
91
 
        const QString & version(){ return m_szVersion; };
92
 
        void setVersion(const QString &szVersion){ m_szVersion = szVersion; };
93
 
        const QString & subdirectory(){ return m_szSubdirectory; };
94
 
        void setSubdirectory(const QString &szSubdirectory){ m_szSubdirectory = szSubdirectory; };
95
 
        const QString & absoluteDirectory(){ return m_szAbsoluteDirectory; };
96
 
        void setAbsoluteDirectory(const QString &szAbsoluteDirectory){ m_szAbsoluteDirectory = szAbsoluteDirectory; }
97
 
        const QString & author(){ return m_szAuthor; };
98
 
        void setAuthor(const QString &szAuthor){ m_szAuthor = szAuthor; };
99
 
        const QString & description(){ return m_szDescription; };
100
 
        void setDescription(const QString &szDescription){ m_szDescription = szDescription; };
101
 
        const QString & date(){ return m_szDate; };
102
 
        void setDate(const QString &szDate){ m_szDate = szDate; };
103
 
        const QString & application(){ return m_szApplication; };
104
 
        void setApplication(const QString &szApplication){ m_szApplication = szApplication; };
105
 
        const QString & themeEngineVersion(){ return m_szThemeEngineVersion; };
106
 
        void setThemeEngineVersion(const QString &szThemeEngineVersion){ m_szThemeEngineVersion = szThemeEngineVersion; };
107
 
 
108
 
        ///
109
 
        /// Attempt to load a themeinfo.kvc file present in the specified directory.
110
 
        /// This function will fail if the directory contains a valid themeinfo.kvc
111
 
        /// file but no themedata.kvc file unless bIgnoreThemeData is set to true
112
 
        ///
113
 
        bool loadFromDirectory(const QString &szThemeDirectory,bool bIgnoreThemeData = false);
114
 
 
115
 
        ///
116
 
        /// Attempt to load the theme screenshot from THEMEDIR/screenshot_*.png
117
 
        /// This function will work only if the absoluteDirectory() of the theme
118
 
        /// has been set, otherwise the returned pixmap will be null.
119
 
        ///
120
 
        const QPixmap & smallScreenshot();
121
 
        ///
122
 
        /// Attempt to load the theme screenshot from THEMEDIR/screenshot_*.png
123
 
        /// This function will work only if the absoluteDirectory() of the theme
124
 
        /// has been set, otherwise the returned pixmap will be null.
125
 
        ///
126
 
        const QPixmap & mediumScreenshot();
127
 
        ///
128
 
        /// Attempt to load the theme screenshot from THEMEDIR/screenshot_*.png
129
 
        /// This function will work only if the absoluteDirectory() of the theme
130
 
        /// has been set, otherwise the returned pixmap will be null.
131
 
        ///
132
 
        const QPixmap & largeScreenshot();
133
 
        ///
134
 
        /// Attempt to load the theme screenshot from THEMEDIR/screenshot_*.png
135
 
        /// This function will work only if the absoluteDirectory() of the theme
136
 
        /// has been set, otherwise the returned pixmap will be null.
137
 
        ///
138
 
        QString smallScreenshotPath();
139
 
};
140
 
 
141
 
namespace KviTheme
142
 
{
143
 
        ///
144
 
        /// Attempt to load (apply) a theme in the specified directory
145
 
        /// Will return true on success and false on failure.
146
 
        /// On success this function will return the theme information in the buffer.
147
 
        /// On failure this function will also set buffer.lastError() to a meaningful value
148
 
        /// Note that for convenience this function is implemented in kvi_options.cpp
149
 
        ///
150
 
        bool KVIRC_API load(const QString &szThemeDir,KviThemeInfo &buffer);
151
 
        ///
152
 
        /// Save a theme given the specified options.
153
 
        /// Will return true on success and false on failure.
154
 
        /// On failure this function will also set options.lastError() to a meaningful value
155
 
        /// This function requires both absoluteDirectory() and subdirectory() to be
156
 
        /// set to the right values. In theory this function could save a theme
157
 
        /// in a directory different than $KVIRC_LOCAL_DIR/themes/subdirectory
158
 
        /// but this feature is actually unused.
159
 
        /// Note that for convenience this function is implemented in kvi_options.cpp
160
 
        ///
161
 
        bool KVIRC_API save(KviThemeInfo &options);
162
 
        ///
163
 
        /// Save the theme screenshots in the given EXISTING directory and given
164
 
        /// an existing screenshot on disk (usually in the tmp directory).
165
 
        ///
166
 
        bool KVIRC_API saveScreenshots(KviThemeInfo &options,const QString &szOriginalScreenshotPath);
167
 
}
168
 
 
169
 
 
170
 
#endif //_KVI_THEME_H_