kopete/libkopete
kopeteappearancesettings.h
Go to the documentation of this file.00001
00002
00003 #ifndef KOPETE_APPEARANCESETTINGS_H
00004 #define KOPETE_APPEARANCESETTINGS_H
00005
00006 #include <kopete_export.h>
00007
00008 #include <kconfigskeleton.h>
00009 #include <kdebug.h>
00010
00011 #include <kstandarddirs.h>
00012 #include <kglobalsettings.h>
00013 #include <kcolorscheme.h>
00014 namespace Kopete {
00015
00016 class KOPETE_EXPORT AppearanceSettings : public KConfigSkeleton
00017 {
00018 Q_OBJECT
00019 public:
00020 class EnumContactListDisplayMode
00021 {
00022 public:
00023 enum type { Classic, RightAligned, Detailed, COUNT };
00024 };
00025 class EnumContactListIconMode
00026 {
00027 public:
00028 enum type { IconPic, IconPhoto, COUNT };
00029 };
00030 class EnumContactListResizeAnchor
00031 {
00032 public:
00033 enum type { Top, Bottom, COUNT };
00034 };
00035
00036 enum {
00037 signalAppearanceChanged = 0x1,
00038 signalMessageOverridesChanged = 0x2,
00039 signalContactListAppearanceChanged = 0x4
00040 };
00041
00042 static AppearanceSettings *self();
00043 ~AppearanceSettings();
00044
00048 static
00049 void setUseEmoticons( bool v )
00050 {
00051 if (!self()->isImmutable( QString::fromLatin1 ( "useEmoticons" ) )) {
00052 self()->mUseEmoticons = v;
00053 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00054 self()->mSettingsChanged |= signalMessageOverridesChanged;
00055 }
00056 }
00057
00061 static
00062 bool useEmoticons()
00063 {
00064 return self()->mUseEmoticons;
00065 }
00066
00070 ItemBool *useEmoticonsItem()
00071 {
00072 return mUseEmoticonsItem;
00073 }
00074
00078 static
00079 void setHighlightForegroundColor( const QColor & v )
00080 {
00081 if (!self()->isImmutable( QString::fromLatin1 ( "highlightForegroundColor" ) )) {
00082 self()->mHighlightForegroundColor = v;
00083 self()->mSettingsChanged |= signalAppearanceChanged;
00084 }
00085 }
00086
00090 static
00091 QColor highlightForegroundColor()
00092 {
00093 return self()->mHighlightForegroundColor;
00094 }
00095
00099 ItemColor *highlightForegroundColorItem()
00100 {
00101 return mHighlightForegroundColorItem;
00102 }
00103
00107 static
00108 void setHighlightBackgroundColor( const QColor & v )
00109 {
00110 if (!self()->isImmutable( QString::fromLatin1 ( "highlightBackgroundColor" ) )) {
00111 self()->mHighlightBackgroundColor = v;
00112 self()->mSettingsChanged |= signalAppearanceChanged;
00113 }
00114 }
00115
00119 static
00120 QColor highlightBackgroundColor()
00121 {
00122 return self()->mHighlightBackgroundColor;
00123 }
00124
00128 ItemColor *highlightBackgroundColorItem()
00129 {
00130 return mHighlightBackgroundColorItem;
00131 }
00132
00136 static
00137 void setChatBgOverride( bool v )
00138 {
00139 if (!self()->isImmutable( QString::fromLatin1 ( "chatBgOverride" ) )) {
00140 self()->mChatBgOverride = v;
00141 self()->mSettingsChanged |= signalMessageOverridesChanged;
00142 }
00143 }
00144
00148 static
00149 bool chatBgOverride()
00150 {
00151 return self()->mChatBgOverride;
00152 }
00153
00157 ItemBool *chatBgOverrideItem()
00158 {
00159 return mChatBgOverrideItem;
00160 }
00161
00165 static
00166 void setChatFgOverride( bool v )
00167 {
00168 if (!self()->isImmutable( QString::fromLatin1 ( "chatFgOverride" ) )) {
00169 self()->mChatFgOverride = v;
00170 self()->mSettingsChanged |= signalMessageOverridesChanged;
00171 }
00172 }
00173
00177 static
00178 bool chatFgOverride()
00179 {
00180 return self()->mChatFgOverride;
00181 }
00182
00186 ItemBool *chatFgOverrideItem()
00187 {
00188 return mChatFgOverrideItem;
00189 }
00190
00194 static
00195 void setChatRtfOverride( bool v )
00196 {
00197 if (!self()->isImmutable( QString::fromLatin1 ( "chatRtfOverride" ) )) {
00198 self()->mChatRtfOverride = v;
00199 self()->mSettingsChanged |= signalMessageOverridesChanged;
00200 }
00201 }
00202
00206 static
00207 bool chatRtfOverride()
00208 {
00209 return self()->mChatRtfOverride;
00210 }
00211
00215 ItemBool *chatRtfOverrideItem()
00216 {
00217 return mChatRtfOverrideItem;
00218 }
00219
00223 static
00224 void setChatTextColor( const QColor & v )
00225 {
00226 if (!self()->isImmutable( QString::fromLatin1 ( "chatTextColor" ) )) {
00227 self()->mChatTextColor = v;
00228 self()->mSettingsChanged |= signalAppearanceChanged;
00229 }
00230 }
00231
00235 static
00236 QColor chatTextColor()
00237 {
00238 return self()->mChatTextColor;
00239 }
00240
00244 ItemColor *chatTextColorItem()
00245 {
00246 return mChatTextColorItem;
00247 }
00248
00252 static
00253 void setChatBackgroundColor( const QColor & v )
00254 {
00255 if (!self()->isImmutable( QString::fromLatin1 ( "chatBackgroundColor" ) )) {
00256 self()->mChatBackgroundColor = v;
00257 self()->mSettingsChanged |= signalAppearanceChanged;
00258 }
00259 }
00260
00264 static
00265 QColor chatBackgroundColor()
00266 {
00267 return self()->mChatBackgroundColor;
00268 }
00269
00273 ItemColor *chatBackgroundColorItem()
00274 {
00275 return mChatBackgroundColorItem;
00276 }
00277
00281 static
00282 void setChatLinkColor( const QColor & v )
00283 {
00284 if (!self()->isImmutable( QString::fromLatin1 ( "chatLinkColor" ) )) {
00285 self()->mChatLinkColor = v;
00286 self()->mSettingsChanged |= signalAppearanceChanged;
00287 }
00288 }
00289
00293 static
00294 QColor chatLinkColor()
00295 {
00296 return self()->mChatLinkColor;
00297 }
00298
00302 ItemColor *chatLinkColorItem()
00303 {
00304 return mChatLinkColorItem;
00305 }
00306
00310 static
00311 void setChatFont( const QFont & v )
00312 {
00313 if (!self()->isImmutable( QString::fromLatin1 ( "chatFont" ) )) {
00314 self()->mChatFont = v;
00315 self()->mSettingsChanged |= signalAppearanceChanged;
00316 }
00317 }
00318
00322 static
00323 QFont chatFont()
00324 {
00325 return self()->mChatFont;
00326 }
00327
00331 ItemFont *chatFontItem()
00332 {
00333 return mChatFontItem;
00334 }
00335
00339 static
00340 void setIdleContactColor( const QColor & v )
00341 {
00342 if (!self()->isImmutable( QString::fromLatin1 ( "idleContactColor" ) )) {
00343 self()->mIdleContactColor = v;
00344 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00345 }
00346 }
00347
00351 static
00352 QColor idleContactColor()
00353 {
00354 return self()->mIdleContactColor;
00355 }
00356
00360 ItemColor *idleContactColorItem()
00361 {
00362 return mIdleContactColorItem;
00363 }
00364
00368 static
00369 void setGreyIdleMetaContacts( bool v )
00370 {
00371 if (!self()->isImmutable( QString::fromLatin1 ( "greyIdleMetaContacts" ) )) {
00372 self()->mGreyIdleMetaContacts = v;
00373 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00374 }
00375 }
00376
00380 static
00381 bool greyIdleMetaContacts()
00382 {
00383 return self()->mGreyIdleMetaContacts;
00384 }
00385
00389 ItemBool *greyIdleMetaContactsItem()
00390 {
00391 return mGreyIdleMetaContactsItem;
00392 }
00393
00397 static
00398 void setToolTipContents( const QStringList & v )
00399 {
00400 if (!self()->isImmutable( QString::fromLatin1 ( "toolTipContents" ) ))
00401 self()->mToolTipContents = v;
00402 }
00403
00407 static
00408 QStringList toolTipContents()
00409 {
00410 return self()->mToolTipContents;
00411 }
00412
00416 ItemStringList *toolTipContentsItem()
00417 {
00418 return mToolTipContentsItem;
00419 }
00420
00424 static
00425 void setContactListDisplayMode( int v )
00426 {
00427 if (!self()->isImmutable( QString::fromLatin1 ( "contactListDisplayMode" ) )) {
00428 self()->mContactListDisplayMode = v;
00429 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00430 }
00431 }
00432
00436 static
00437 int contactListDisplayMode()
00438 {
00439 return self()->mContactListDisplayMode;
00440 }
00441
00445 ItemEnum *contactListDisplayModeItem()
00446 {
00447 return mContactListDisplayModeItem;
00448 }
00449
00453 static
00454 void setContactListIconMode( int v )
00455 {
00456 if (!self()->isImmutable( QString::fromLatin1 ( "contactListIconMode" ) )) {
00457 self()->mContactListIconMode = v;
00458 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00459 }
00460 }
00461
00465 static
00466 int contactListIconMode()
00467 {
00468 return self()->mContactListIconMode;
00469 }
00470
00474 ItemEnum *contactListIconModeItem()
00475 {
00476 return mContactListIconModeItem;
00477 }
00478
00482 static
00483 void setContactListTreeView( bool v )
00484 {
00485 if (!self()->isImmutable( QString::fromLatin1 ( "contactListTreeView" ) )) {
00486 self()->mContactListTreeView = v;
00487 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00488 }
00489 }
00490
00494 static
00495 bool contactListTreeView()
00496 {
00497 return self()->mContactListTreeView;
00498 }
00499
00503 ItemBool *contactListTreeViewItem()
00504 {
00505 return mContactListTreeViewItem;
00506 }
00507
00511 static
00512 void setContactListIndentContact( bool v )
00513 {
00514 if (!self()->isImmutable( QString::fromLatin1 ( "contactListIndentContact" ) )) {
00515 self()->mContactListIndentContact = v;
00516 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00517 }
00518 }
00519
00523 static
00524 bool contactListIndentContact()
00525 {
00526 return self()->mContactListIndentContact;
00527 }
00528
00532 ItemBool *contactListIndentContactItem()
00533 {
00534 return mContactListIndentContactItem;
00535 }
00536
00540 static
00541 void setContactListHideVerticalScrollBar( bool v )
00542 {
00543 if (!self()->isImmutable( QString::fromLatin1 ( "contactListHideVerticalScrollBar" ) )) {
00544 self()->mContactListHideVerticalScrollBar = v;
00545 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00546 }
00547 }
00548
00552 static
00553 bool contactListHideVerticalScrollBar()
00554 {
00555 return self()->mContactListHideVerticalScrollBar;
00556 }
00557
00561 ItemBool *contactListHideVerticalScrollBarItem()
00562 {
00563 return mContactListHideVerticalScrollBarItem;
00564 }
00565
00569 static
00570 void setGroupContactByGroup( bool v )
00571 {
00572 if (!self()->isImmutable( QString::fromLatin1 ( "groupContactByGroup" ) )) {
00573 self()->mGroupContactByGroup = v;
00574 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00575 }
00576 }
00577
00581 static
00582 bool groupContactByGroup()
00583 {
00584 return self()->mGroupContactByGroup;
00585 }
00586
00590 ItemBool *groupContactByGroupItem()
00591 {
00592 return mGroupContactByGroupItem;
00593 }
00594
00598 static
00599 void setContactListUseCustomFont( bool v )
00600 {
00601 if (!self()->isImmutable( QString::fromLatin1 ( "contactListUseCustomFont" ) )) {
00602 self()->mContactListUseCustomFont = v;
00603 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00604 }
00605 }
00606
00610 static
00611 bool contactListUseCustomFont()
00612 {
00613 return self()->mContactListUseCustomFont;
00614 }
00615
00619 ItemBool *contactListUseCustomFontItem()
00620 {
00621 return mContactListUseCustomFontItem;
00622 }
00623
00627 static
00628 void setContactListAutoResize( bool v )
00629 {
00630 if (!self()->isImmutable( QString::fromLatin1 ( "contactListAutoResize" ) )) {
00631 self()->mContactListAutoResize = v;
00632 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00633 }
00634 }
00635
00639 static
00640 bool contactListAutoResize()
00641 {
00642 return self()->mContactListAutoResize;
00643 }
00644
00648 ItemBool *contactListAutoResizeItem()
00649 {
00650 return mContactListAutoResizeItem;
00651 }
00652
00656 static
00657 void setContactListResizeAnchor( int v )
00658 {
00659 if (!self()->isImmutable( QString::fromLatin1 ( "contactListResizeAnchor" ) )) {
00660 self()->mContactListResizeAnchor = v;
00661 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00662 }
00663 }
00664
00668 static
00669 int contactListResizeAnchor()
00670 {
00671 return self()->mContactListResizeAnchor;
00672 }
00673
00677 ItemEnum *contactListResizeAnchorItem()
00678 {
00679 return mContactListResizeAnchorItem;
00680 }
00681
00685 static
00686 void setContactListNormalFont( const QFont & v )
00687 {
00688 if (!self()->isImmutable( QString::fromLatin1 ( "contactListNormalFont" ) )) {
00689 self()->mContactListNormalFont = v;
00690 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00691 }
00692 }
00693
00697 static
00698 QFont contactListNormalFont()
00699 {
00700 return self()->mContactListNormalFont;
00701 }
00702
00706 ItemFont *contactListNormalFontItem()
00707 {
00708 return mContactListNormalFontItem;
00709 }
00710
00714 static
00715 void setContactListSmallFont( const QFont & v )
00716 {
00717 if (!self()->isImmutable( QString::fromLatin1 ( "contactListSmallFont" ) )) {
00718 self()->mContactListSmallFont = v;
00719 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00720 }
00721 }
00722
00726 static
00727 QFont contactListSmallFont()
00728 {
00729 return self()->mContactListSmallFont;
00730 }
00731
00735 ItemFont *contactListSmallFontItem()
00736 {
00737 return mContactListSmallFontItem;
00738 }
00739
00743 static
00744 void setGroupNameColor( const QColor & v )
00745 {
00746 if (!self()->isImmutable( QString::fromLatin1 ( "groupNameColor" ) )) {
00747 self()->mGroupNameColor = v;
00748 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00749 }
00750 }
00751
00755 static
00756 QColor groupNameColor()
00757 {
00758 return self()->mGroupNameColor;
00759 }
00760
00764 ItemColor *groupNameColorItem()
00765 {
00766 return mGroupNameColorItem;
00767 }
00768
00772 static
00773 void setContactListAnimateChange( bool v )
00774 {
00775 if (!self()->isImmutable( QString::fromLatin1 ( "contactListAnimateChange" ) )) {
00776 self()->mContactListAnimateChange = v;
00777 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00778 }
00779 }
00780
00784 static
00785 bool contactListAnimateChange()
00786 {
00787 return self()->mContactListAnimateChange;
00788 }
00789
00793 ItemBool *contactListAnimateChangeItem()
00794 {
00795 return mContactListAnimateChangeItem;
00796 }
00797
00801 static
00802 void setContactListFading( bool v )
00803 {
00804 if (!self()->isImmutable( QString::fromLatin1 ( "contactListFading" ) )) {
00805 self()->mContactListFading = v;
00806 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00807 }
00808 }
00809
00813 static
00814 bool contactListFading()
00815 {
00816 return self()->mContactListFading;
00817 }
00818
00822 ItemBool *contactListFadingItem()
00823 {
00824 return mContactListFadingItem;
00825 }
00826
00830 static
00831 void setContactListFolding( bool v )
00832 {
00833 if (!self()->isImmutable( QString::fromLatin1 ( "contactListFolding" ) )) {
00834 self()->mContactListFolding = v;
00835 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00836 }
00837 }
00838
00842 static
00843 bool contactListFolding()
00844 {
00845 return self()->mContactListFolding;
00846 }
00847
00851 ItemBool *contactListFoldingItem()
00852 {
00853 return mContactListFoldingItem;
00854 }
00855
00859 static
00860 void setContactListAutoHide( bool v )
00861 {
00862 if (!self()->isImmutable( QString::fromLatin1 ( "contactListAutoHide" ) )) {
00863 self()->mContactListAutoHide = v;
00864 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00865 }
00866 }
00867
00871 static
00872 bool contactListAutoHide()
00873 {
00874 return self()->mContactListAutoHide;
00875 }
00876
00880 ItemBool *contactListAutoHideItem()
00881 {
00882 return mContactListAutoHideItem;
00883 }
00884
00888 static
00889 void setContactListAutoHideVScroll( bool v )
00890 {
00891 if (!self()->isImmutable( QString::fromLatin1 ( "contactListAutoHideVScroll" ) )) {
00892 self()->mContactListAutoHideVScroll = v;
00893 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00894 }
00895 }
00896
00900 static
00901 bool contactListAutoHideVScroll()
00902 {
00903 return self()->mContactListAutoHideVScroll;
00904 }
00905
00909 ItemBool *contactListAutoHideVScrollItem()
00910 {
00911 return mContactListAutoHideVScrollItem;
00912 }
00913
00917 static
00918 void setContactListAutoHideTimeout( uint v )
00919 {
00920 if (!self()->isImmutable( QString::fromLatin1 ( "contactListAutoHideTimeout" ) )) {
00921 self()->mContactListAutoHideTimeout = v;
00922 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00923 }
00924 }
00925
00929 static
00930 uint contactListAutoHideTimeout()
00931 {
00932 return self()->mContactListAutoHideTimeout;
00933 }
00934
00938 ItemUInt *contactListAutoHideTimeoutItem()
00939 {
00940 return mContactListAutoHideTimeoutItem;
00941 }
00942
00946 static
00947 void setShowOfflineUsers( bool v )
00948 {
00949 if (!self()->isImmutable( QString::fromLatin1 ( "showOfflineUsers" ) )) {
00950 self()->mShowOfflineUsers = v;
00951 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00952 }
00953 }
00954
00958 static
00959 bool showOfflineUsers()
00960 {
00961 return self()->mShowOfflineUsers;
00962 }
00963
00967 ItemBool *showOfflineUsersItem()
00968 {
00969 return mShowOfflineUsersItem;
00970 }
00971
00975 static
00976 void setShowEmptyGroups( bool v )
00977 {
00978 if (!self()->isImmutable( QString::fromLatin1 ( "showEmptyGroups" ) )) {
00979 self()->mShowEmptyGroups = v;
00980 self()->mSettingsChanged |= signalContactListAppearanceChanged;
00981 }
00982 }
00983
00987 static
00988 bool showEmptyGroups()
00989 {
00990 return self()->mShowEmptyGroups;
00991 }
00992
00996 ItemBool *showEmptyGroupsItem()
00997 {
00998 return mShowEmptyGroupsItem;
00999 }
01000
01001
01002 Q_SIGNALS:
01006 void appearanceChanged();
01007
01011 void messageOverridesChanged();
01012
01016 void contactListAppearanceChanged();
01017
01018 protected:
01019 AppearanceSettings();
01020 friend class AppearanceSettingsHelper;
01021
01022 virtual void usrWriteConfig();
01023
01024
01025 bool mUseEmoticons;
01026 QColor mHighlightForegroundColor;
01027 QColor mHighlightBackgroundColor;
01028 bool mChatBgOverride;
01029 bool mChatFgOverride;
01030 bool mChatRtfOverride;
01031 QColor mChatTextColor;
01032 QColor mChatBackgroundColor;
01033 QColor mChatLinkColor;
01034 QFont mChatFont;
01035 QColor mIdleContactColor;
01036 bool mGreyIdleMetaContacts;
01037 QStringList mToolTipContents;
01038
01039
01040 int mContactListDisplayMode;
01041 int mContactListIconMode;
01042 bool mContactListTreeView;
01043 bool mContactListIndentContact;
01044 bool mContactListHideVerticalScrollBar;
01045 bool mGroupContactByGroup;
01046 bool mContactListUseCustomFont;
01047 bool mContactListAutoResize;
01048 int mContactListResizeAnchor;
01049 QFont mContactListNormalFont;
01050 QFont mContactListSmallFont;
01051 QColor mGroupNameColor;
01052 bool mContactListAnimateChange;
01053 bool mContactListFading;
01054 bool mContactListFolding;
01055 bool mContactListAutoHide;
01056 bool mContactListAutoHideVScroll;
01057 uint mContactListAutoHideTimeout;
01058 bool mShowOfflineUsers;
01059 bool mShowEmptyGroups;
01060
01061 private:
01062 ItemBool *mUseEmoticonsItem;
01063 ItemColor *mHighlightForegroundColorItem;
01064 ItemColor *mHighlightBackgroundColorItem;
01065 ItemBool *mChatBgOverrideItem;
01066 ItemBool *mChatFgOverrideItem;
01067 ItemBool *mChatRtfOverrideItem;
01068 ItemColor *mChatTextColorItem;
01069 ItemColor *mChatBackgroundColorItem;
01070 ItemColor *mChatLinkColorItem;
01071 ItemFont *mChatFontItem;
01072 ItemColor *mIdleContactColorItem;
01073 ItemBool *mGreyIdleMetaContactsItem;
01074 ItemStringList *mToolTipContentsItem;
01075 ItemEnum *mContactListDisplayModeItem;
01076 ItemEnum *mContactListIconModeItem;
01077 ItemBool *mContactListTreeViewItem;
01078 ItemBool *mContactListIndentContactItem;
01079 ItemBool *mContactListHideVerticalScrollBarItem;
01080 ItemBool *mGroupContactByGroupItem;
01081 ItemBool *mContactListUseCustomFontItem;
01082 ItemBool *mContactListAutoResizeItem;
01083 ItemEnum *mContactListResizeAnchorItem;
01084 ItemFont *mContactListNormalFontItem;
01085 ItemFont *mContactListSmallFontItem;
01086 ItemColor *mGroupNameColorItem;
01087 ItemBool *mContactListAnimateChangeItem;
01088 ItemBool *mContactListFadingItem;
01089 ItemBool *mContactListFoldingItem;
01090 ItemBool *mContactListAutoHideItem;
01091 ItemBool *mContactListAutoHideVScrollItem;
01092 ItemUInt *mContactListAutoHideTimeoutItem;
01093 ItemBool *mShowOfflineUsersItem;
01094 ItemBool *mShowEmptyGroupsItem;
01095 uint mSettingsChanged;
01096 };
01097
01098 }
01099
01100 #endif
01101