| 1 |
/* |
| 2 |
* Copyright (C) 2013 National University of Defense Technology(NUDT) & Kylin Ltd. |
| 3 |
* |
| 4 |
* Authors: |
| 5 |
* lenky gao [email protected]/[email protected] |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; version 3. |
| 10 |
* |
| 11 |
* This program is distributed in the hope that it will be useful, |
| 12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 |
* GNU General Public License for more details. |
| 15 |
* |
| 16 |
* You should have received a copy of the GNU General Public License |
| 17 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 18 |
*/ |
| 19 |
|
| 20 |
#ifndef __SKIN_BASE_H__ |
| 21 |
#define __SKIN_BASE_H__ |
| 22 |
|
| 23 |
#include <QColor> |
| 24 |
|
| 25 |
class SkinBase : public QObject |
| 26 |
{ |
| 27 |
Q_OBJECT |
| 28 |
//SkinInfo |
| 29 |
Q_PROPERTY(QString skinName READ skinName WRITE setSkinName |
| 30 |
NOTIFY skinNameChanged) |
| 31 |
Q_PROPERTY(QString skinVersion READ skinVersion WRITE setSkinVersion |
| 32 |
NOTIFY skinVersionChanged) |
| 33 |
Q_PROPERTY(QString skinAuthor READ skinAuthor WRITE setSkinAuthor |
| 34 |
NOTIFY skinAuthorChanged) |
| 35 |
|
| 36 |
//SkinInputBar |
| 37 |
Q_PROPERTY(QString inputBackImg READ inputBackImg WRITE setInputBackImg |
| 38 |
NOTIFY inputBackImgChanged) |
| 39 |
Q_PROPERTY(QString tipsImg READ tipsImg WRITE setTipsImg |
| 40 |
NOTIFY tipsImgChanged) |
| 41 |
Q_PROPERTY(int marginLeft READ marginLeft WRITE setMarginLeft |
| 42 |
NOTIFY marginLeftChanged) |
| 43 |
Q_PROPERTY(int marginRight READ marginRight WRITE setMarginRight |
| 44 |
NOTIFY marginRightChanged) |
| 45 |
Q_PROPERTY(int marginTop READ marginTop WRITE setMarginTop |
| 46 |
NOTIFY marginTopChanged) |
| 47 |
Q_PROPERTY(int marginBottom READ marginBottom WRITE setMarginBottom |
| 48 |
NOTIFY marginBottomChanged) |
| 49 |
Q_PROPERTY(QString backArrowImg READ backArrowImg WRITE setBackArrowImg |
| 50 |
NOTIFY backArrowImgChanged) |
| 51 |
Q_PROPERTY(QString forwardArrowImg READ forwardArrowImg WRITE setForwardArrowImg |
| 52 |
NOTIFY forwardArrowImgChanged) |
| 53 |
|
| 54 |
Q_PROPERTY(int fontSize READ fontSize WRITE setFontSize |
| 55 |
NOTIFY fontSizeChanged) |
| 56 |
Q_PROPERTY(int candFontSize READ candFontSize WRITE setCandFontSize |
| 57 |
NOTIFY candFontSizeChanged) |
| 58 |
Q_PROPERTY(QColor inputColor READ inputColor WRITE setInputColor |
| 59 |
NOTIFY inputColorChanged) |
| 60 |
Q_PROPERTY(QColor indexColor READ indexColor WRITE setIndexColor |
| 61 |
NOTIFY indexColorChanged) |
| 62 |
Q_PROPERTY(QColor firstCandColor READ firstCandColor WRITE setFirstCandColor |
| 63 |
NOTIFY firstCandColorChanged) |
| 64 |
Q_PROPERTY(QColor otherColor READ otherColor WRITE setOtherColor |
| 65 |
NOTIFY otherColorChanged) |
| 66 |
|
| 67 |
public: |
| 68 |
//SkinInfo |
| 69 |
void setSkinName(const QString skinName); |
| 70 |
QString skinName()const; |
| 71 |
void setSkinVersion(const QString skinVersion); |
| 72 |
QString skinVersion() const; |
| 73 |
void setSkinAuthor(const QString skinAuthor); |
| 74 |
QString skinAuthor() const; |
| 75 |
//SkinInputBar |
| 76 |
void setInputBackImg(const QString inputBackImg); |
| 77 |
QString inputBackImg() const; |
| 78 |
void setTipsImg(const QString tipsImg); |
| 79 |
QString tipsImg() const; |
| 80 |
void setMarginLeft(const int marginLeft); |
| 81 |
int marginLeft() const; |
| 82 |
void setMarginRight(const int marginRight); |
| 83 |
int marginRight() const; |
| 84 |
void setMarginTop(const int marginTop); |
| 85 |
int marginTop() const; |
| 86 |
void setMarginBottom(const int marginBottom); |
| 87 |
int marginBottom() const; |
| 88 |
void setBackArrowImg(const QString backArrowImg); |
| 89 |
QString backArrowImg() const; |
| 90 |
void setForwardArrowImg(const QString forwardArrowImg); |
| 91 |
QString forwardArrowImg() const; |
| 92 |
void setFontSize(const int fontSize); |
| 93 |
int fontSize() const; |
| 94 |
void setCandFontSize(const int candFontSize); |
| 95 |
int candFontSize() const; |
| 96 |
void setInputColor(const QColor inputColor); |
| 97 |
QColor inputColor() const; |
| 98 |
void setIndexColor(const QColor indexColor); |
| 99 |
QColor indexColor() const; |
| 100 |
void setFirstCandColor(const QColor firstCandColor); |
| 101 |
QColor firstCandColor() const; |
| 102 |
void setOtherColor(const QColor otherColor); |
| 103 |
QColor otherColor() const; |
| 104 |
|
| 105 |
signals: |
| 106 |
void skinNameChanged(); |
| 107 |
void skinVersionChanged(); |
| 108 |
void skinAuthorChanged(); |
| 109 |
|
| 110 |
void inputBackImgChanged(); |
| 111 |
void tipsImgChanged(); |
| 112 |
void marginLeftChanged(); |
| 113 |
void marginRightChanged(); |
| 114 |
void marginTopChanged(); |
| 115 |
void marginBottomChanged(); |
| 116 |
void backArrowImgChanged(); |
| 117 |
void forwardArrowImgChanged(); |
| 118 |
void fontSizeChanged(); |
| 119 |
void candFontSizeChanged(); |
| 120 |
void inputColorChanged(); |
| 121 |
void indexColorChanged(); |
| 122 |
void firstCandColorChanged(); |
| 123 |
void otherColorChanged(); |
| 124 |
|
| 125 |
private: |
| 126 |
//Fcitx SkinInfo |
| 127 |
QString mSkinName; |
| 128 |
QString mSkinVersion; |
| 129 |
QString mSkinAuthor; |
| 130 |
QString mSkinDesc; |
| 131 |
|
| 132 |
//Fcitx SkinInputBar |
| 133 |
QString mInputBackImg; |
| 134 |
QString mTipsImg; |
| 135 |
int mMarginLeft; |
| 136 |
int mMarginRight; |
| 137 |
int mMarginTop; |
| 138 |
int mMarginBottom; |
| 139 |
QString mBackArrowImg; |
| 140 |
QString mForwardArrowImg; |
| 141 |
|
| 142 |
//Fcitx SkinFont |
| 143 |
int mFontSize; |
| 144 |
int mCandFontSize; |
| 145 |
QColor mInputColor; |
| 146 |
QColor mIndexColor; |
| 147 |
QColor mFirstCandColor; |
| 148 |
QColor mOtherColor; |
| 149 |
|
| 150 |
public: |
| 151 |
Q_PROPERTY(int inputStringPosX READ inputStringPosX WRITE setInputStringPosX |
| 152 |
NOTIFY inputStringPosXChanged) |
| 153 |
void setInputStringPosX(const int inputStringPosX); |
| 154 |
int inputStringPosX() const; |
| 155 |
signals: |
| 156 |
void inputStringPosXChanged(); |
| 157 |
private: |
| 158 |
int mInputStringPosX; |
| 159 |
|
| 160 |
public: |
| 161 |
Q_PROPERTY(int inputStringPosY READ inputStringPosY WRITE setInputStringPosY |
| 162 |
NOTIFY inputStringPosYChanged) |
| 163 |
void setInputStringPosY(const int inputStringPosY); |
| 164 |
int inputStringPosY() const; |
| 165 |
signals: |
| 166 |
void inputStringPosYChanged(); |
| 167 |
private: |
| 168 |
int mInputStringPosY; |
| 169 |
|
| 170 |
public: |
| 171 |
Q_PROPERTY(int outputCandPosX READ outputCandPosX WRITE setOutputCandPosX |
| 172 |
NOTIFY outputCandPosXChanged) |
| 173 |
void setOutputCandPosX(const int outputCandPosX); |
| 174 |
int outputCandPosX() const; |
| 175 |
signals: |
| 176 |
void outputCandPosXChanged(); |
| 177 |
private: |
| 178 |
int mOutputCandPosX; |
| 179 |
|
| 180 |
public: |
| 181 |
Q_PROPERTY(int outputCandPosY READ outputCandPosY WRITE setOutputCandPosY |
| 182 |
NOTIFY outputCandPosYChanged) |
| 183 |
void setOutputCandPosY(const int outputCandPosY); |
| 184 |
int outputCandPosY() const; |
| 185 |
signals: |
| 186 |
void outputCandPosYChanged(); |
| 187 |
private: |
| 188 |
int mOutputCandPosY; |
| 189 |
|
| 190 |
public: |
| 191 |
Q_PROPERTY(int backArrowPosX READ backArrowPosX WRITE setBackArrowPosX |
| 192 |
NOTIFY backArrowPosXChanged) |
| 193 |
void setBackArrowPosX(const int backArrowPosX); |
| 194 |
int backArrowPosX() const; |
| 195 |
signals: |
| 196 |
void backArrowPosXChanged(); |
| 197 |
private: |
| 198 |
int mBackArrowPosX; |
| 199 |
|
| 200 |
public: |
| 201 |
Q_PROPERTY(int backArrowPosY READ backArrowPosY WRITE setBackArrowPosY |
| 202 |
NOTIFY backArrowPosYChanged) |
| 203 |
void setBackArrowPosY(const int backArrowPosY); |
| 204 |
int backArrowPosY() const; |
| 205 |
signals: |
| 206 |
void backArrowPosYChanged(); |
| 207 |
private: |
| 208 |
int mBackArrowPosY; |
| 209 |
|
| 210 |
public: |
| 211 |
Q_PROPERTY(int forwardArrowPosX READ forwardArrowPosX WRITE setForwardArrowPosX |
| 212 |
NOTIFY forwardArrowPosXChanged) |
| 213 |
void setForwardArrowPosX(const int forwardArrowPosX); |
| 214 |
int forwardArrowPosX() const; |
| 215 |
signals: |
| 216 |
void forwardArrowPosXChanged(); |
| 217 |
private: |
| 218 |
int mForwardArrowPosX; |
| 219 |
|
| 220 |
public: |
| 221 |
Q_PROPERTY(int forwardArrowPosY READ forwardArrowPosY WRITE setForwardArrowPosY |
| 222 |
NOTIFY forwardArrowPosYChanged) |
| 223 |
void setForwardArrowPosY(const int forwardArrowPosY); |
| 224 |
int forwardArrowPosY() const; |
| 225 |
signals: |
| 226 |
void forwardArrowPosYChanged(); |
| 227 |
private: |
| 228 |
int mForwardArrowPosY; |
| 229 |
|
| 230 |
public: |
| 231 |
Q_PROPERTY(int adjustWidth READ adjustWidth WRITE setAdjustWidth |
| 232 |
NOTIFY adjustWidthChanged) |
| 233 |
void setAdjustWidth(const int adjustWidth); |
| 234 |
int adjustWidth() const; |
| 235 |
signals: |
| 236 |
void adjustWidthChanged(); |
| 237 |
private: |
| 238 |
int mAdjustWidth; |
| 239 |
|
| 240 |
public: |
| 241 |
Q_PROPERTY(int adjustHeight READ adjustHeight WRITE setAdjustHeight |
| 242 |
NOTIFY adjustHeightChanged) |
| 243 |
void setAdjustHeight(const int adjustHeight); |
| 244 |
int adjustHeight() const; |
| 245 |
signals: |
| 246 |
void adjustHeightChanged(); |
| 247 |
private: |
| 248 |
int mAdjustHeight; |
| 249 |
|
| 250 |
public: |
| 251 |
Q_PROPERTY(QString horizontalTileMode READ horizontalTileMode WRITE setHorizontalTileMode |
| 252 |
NOTIFY horizontalTileModeChanged) |
| 253 |
void setHorizontalTileMode(const QString horizontalTileMode); |
| 254 |
QString horizontalTileMode() const; |
| 255 |
signals: |
| 256 |
void horizontalTileModeChanged(); |
| 257 |
private: |
| 258 |
QString mHorizontalTileMode; |
| 259 |
|
| 260 |
public: |
| 261 |
Q_PROPERTY(QString verticalTileMode READ verticalTileMode WRITE setVerticalTileMode |
| 262 |
NOTIFY verticalTileModeChanged) |
| 263 |
void setVerticalTileMode(const QString verticalTileMode); |
| 264 |
QString verticalTileMode() const; |
| 265 |
signals: |
| 266 |
void verticalTileModeChanged(); |
| 267 |
private: |
| 268 |
QString mVerticalTileMode; |
| 269 |
|
| 270 |
//=================================================================================================== |
| 271 |
private: |
| 272 |
//Fcitx SkinInputBar |
| 273 |
QString mInputBackImgVertical; |
| 274 |
QString mTipsImgVertical; |
| 275 |
int mMarginLeftVertical; |
| 276 |
int mMarginRightVertical; |
| 277 |
int mMarginTopVertical; |
| 278 |
int mMarginBottomVertical; |
| 279 |
QString mBackArrowImgVertical; |
| 280 |
QString mForwardArrowImgVertical; |
| 281 |
|
| 282 |
//Fcitx SkinFont |
| 283 |
int mFontSizeVertical; |
| 284 |
int mCandFontSizeVertical; |
| 285 |
QColor mInputColorVertical; |
| 286 |
QColor mIndexColorVertical; |
| 287 |
QColor mFirstCandColorVertical; |
| 288 |
QColor mOtherColorVertical; |
| 289 |
|
| 290 |
int mInputStringPosXVertical; |
| 291 |
int mInputStringPosYVertical; |
| 292 |
int mOutputCandPosXVertical; |
| 293 |
int mOutputCandPosYVertical; |
| 294 |
int mBackArrowPosXVertical; |
| 295 |
int mBackArrowPosYVertical; |
| 296 |
int mForwardArrowPosXVertical; |
| 297 |
int mForwardArrowPosYVertical; |
| 298 |
|
| 299 |
int mAdjustWidthVertical; |
| 300 |
int mAdjustHeightVertical; |
| 301 |
QString mHorizontalTileModeVertical; |
| 302 |
QString mVerticalTileModeVertical; |
| 303 |
|
| 304 |
public: |
| 305 |
#define DEFINE_SET_PROPERTY(read, type, property) \ |
| 306 |
void set##property(const type read); |
| 307 |
|
| 308 |
DEFINE_SET_PROPERTY(inputBackImgVertical, QString, InputBackImgVertical) |
| 309 |
DEFINE_SET_PROPERTY(tipsImgVertical, QString, TipsImgVertical) |
| 310 |
DEFINE_SET_PROPERTY(marginLeftVertical, int, MarginLeftVertical) |
| 311 |
|
| 312 |
DEFINE_SET_PROPERTY(marginRightVertical, int, MarginRightVertical) |
| 313 |
DEFINE_SET_PROPERTY(marginTopVertical, int, MarginTopVertical) |
| 314 |
DEFINE_SET_PROPERTY(marginBottomVertical, int, MarginBottomVertical) |
| 315 |
DEFINE_SET_PROPERTY(backArrowImgVertical, QString, BackArrowImgVertical) |
| 316 |
DEFINE_SET_PROPERTY(forwardArrowImgVertical, QString, ForwardArrowImgVertical) |
| 317 |
DEFINE_SET_PROPERTY(fontSizeVertical, int, FontSizeVertical) |
| 318 |
DEFINE_SET_PROPERTY(candFontSizeVertical, int, CandFontSizeVertical) |
| 319 |
DEFINE_SET_PROPERTY(inputColorVertical, QColor, InputColorVertical) |
| 320 |
DEFINE_SET_PROPERTY(indexColorVertical, QColor, IndexColorVertical) |
| 321 |
DEFINE_SET_PROPERTY(firstCandColorVertical, QColor, FirstCandColorVertical) |
| 322 |
DEFINE_SET_PROPERTY(otherColorVertical, QColor, OtherColorVertical) |
| 323 |
|
| 324 |
|
| 325 |
DEFINE_SET_PROPERTY(inputStringPosXVertical, int, InputStringPosXVertical) |
| 326 |
DEFINE_SET_PROPERTY(inputStringPosYVertical, int, InputStringPosYVertical) |
| 327 |
DEFINE_SET_PROPERTY(outputCandPosXVertical, int, OutputCandPosXVertical) |
| 328 |
DEFINE_SET_PROPERTY(outputCandPosYVertical, int, OutputCandPosYVertical) |
| 329 |
DEFINE_SET_PROPERTY(backArrowPosXVertical, int, BackArrowPosXVertical) |
| 330 |
DEFINE_SET_PROPERTY(backArrowPosYVertical, int, BackArrowPosYVertical) |
| 331 |
DEFINE_SET_PROPERTY(forwardArrowPosXVertical, int, ForwardArrowPosXVertical) |
| 332 |
DEFINE_SET_PROPERTY(forwardArrowPosYVertical, int, ForwardArrowPosYVertical) |
| 333 |
|
| 334 |
DEFINE_SET_PROPERTY(adjustWidthVertical, int, AdjustWidthVertical) |
| 335 |
DEFINE_SET_PROPERTY(adjustHeightVertical, int, AdjustHeightVertical) |
| 336 |
DEFINE_SET_PROPERTY(horizontalTileModeVertical, QString, HorizontalTileModeVertical) |
| 337 |
DEFINE_SET_PROPERTY(verticalTileModeVertical, QString, VerticalTileModeVertical) |
| 338 |
#undef DEFINE_SET_PROPERTY |
| 339 |
//=================================================================================================== |
| 340 |
|
| 341 |
public: |
| 342 |
SkinBase(); |
| 343 |
virtual ~SkinBase(); |
| 344 |
void reloadSkin(); |
| 345 |
void init(); |
| 346 |
|
| 347 |
protected: |
| 348 |
QColor value2color(const QString& value); |
| 349 |
}; |
| 350 |
|
| 351 |
#endif //__SKIN_BASE_H__ |