| 1 | // -*- c-basic-offset: 2 -*- |
|---|
| 2 | /* |
|---|
| 3 | * This file is part of Licq, an instant messaging client for UNIX. |
|---|
| 4 | * Copyright (C) 2007 Licq developers |
|---|
| 5 | * |
|---|
| 6 | * Licq is free software; you can redistribute it and/or modify |
|---|
| 7 | * it under the terms of the GNU General Public License as published by |
|---|
| 8 | * the Free Software Foundation; either version 2 of the License, or |
|---|
| 9 | * (at your option) any later version. |
|---|
| 10 | * |
|---|
| 11 | * Licq 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 Licq; if not, write to the Free Software |
|---|
| 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
|---|
| 19 | */ |
|---|
| 20 | |
|---|
| 21 | #ifndef CONFIG_CHAT_H |
|---|
| 22 | #define CONFIG_CHAT_H |
|---|
| 23 | |
|---|
| 24 | #include "config.h" |
|---|
| 25 | |
|---|
| 26 | #include <QObject> |
|---|
| 27 | #include <QRect> |
|---|
| 28 | |
|---|
| 29 | class CIniFile; |
|---|
| 30 | |
|---|
| 31 | namespace LicqQtGui |
|---|
| 32 | { |
|---|
| 33 | namespace Config |
|---|
| 34 | { |
|---|
| 35 | /** |
|---|
| 36 | * Chat and history configuration |
|---|
| 37 | */ |
|---|
| 38 | class Chat : public QObject |
|---|
| 39 | { |
|---|
| 40 | Q_OBJECT |
|---|
| 41 | |
|---|
| 42 | public: |
|---|
| 43 | /** |
|---|
| 44 | * Create the singleton instance |
|---|
| 45 | * |
|---|
| 46 | * @param parent Parent object |
|---|
| 47 | */ |
|---|
| 48 | static void createInstance(QObject* parent = NULL); |
|---|
| 49 | |
|---|
| 50 | /** |
|---|
| 51 | * Get the singleton instance |
|---|
| 52 | * |
|---|
| 53 | * @return The instance |
|---|
| 54 | */ |
|---|
| 55 | static Chat* instance() |
|---|
| 56 | { return myInstance; } |
|---|
| 57 | |
|---|
| 58 | /** |
|---|
| 59 | * Constuctor |
|---|
| 60 | */ |
|---|
| 61 | Chat(QObject* parent = 0); |
|---|
| 62 | |
|---|
| 63 | ~Chat() {} |
|---|
| 64 | |
|---|
| 65 | void blockUpdates(bool block); |
|---|
| 66 | |
|---|
| 67 | // Get functions |
|---|
| 68 | bool autoClose() const { return myAutoClose; } |
|---|
| 69 | unsigned short autoPopup() const { return myAutoPopup; } |
|---|
| 70 | bool autoFocus() const { return myAutoFocus; } |
|---|
| 71 | bool manualNewUser() const { return myManualNewUser; } |
|---|
| 72 | bool sendFromClipboard() const { return mySendFromClipboard; } |
|---|
| 73 | bool msgChatView() const { return myMsgChatView; } |
|---|
| 74 | bool autoPosReplyWin() const { return myAutoPosReplyWin; } |
|---|
| 75 | bool autoSendThroughServer() const { return myAutoSendThroughServer; } |
|---|
| 76 | bool showDlgButtons() const { return myShowDlgButtons; } |
|---|
| 77 | bool showAllEncodings() const { return myShowAllEncodings; } |
|---|
| 78 | bool tabbedChatting() const { return myTabbedChatting; } |
|---|
| 79 | bool showHistory() const { return myShowHistory; } |
|---|
| 80 | bool showNotices() const { return myShowNotices; } |
|---|
| 81 | bool showUserPic() const { return myShowUserPic; } |
|---|
| 82 | bool showUserPicHidden() const { return myShowUserPicHidden; } |
|---|
| 83 | bool popupAutoResponse() const { return myPopupAutoResponse; } |
|---|
| 84 | bool chatVertSpacing() const { return myChatVertSpacing; } |
|---|
| 85 | bool chatAppendLineBreak() const { return myChatAppendLineBreak; } |
|---|
| 86 | bool flashTaskbar() const { return myFlashTaskbar; } |
|---|
| 87 | bool msgWinSticky() const { return myMsgWinSticky; } |
|---|
| 88 | bool singleLineChatMode() const { return mySingleLineChatMode; } |
|---|
| 89 | bool checkSpelling() const { return myCheckSpelling; } |
|---|
| 90 | bool histVertSpacing() const { return myHistVertSpacing; } |
|---|
| 91 | bool reverseHistory() const { return myReverseHistory; } |
|---|
| 92 | bool useCustomUrlBrowser() const { return myUseCustomUrlBrowser; } |
|---|
| 93 | unsigned short chatMsgStyle() const { return myChatMsgStyle; } |
|---|
| 94 | unsigned short histMsgStyle() const { return myHistMsgStyle; } |
|---|
| 95 | QString chatDateFormat() const { return myChatDateFormat; } |
|---|
| 96 | QString histDateFormat() const { return myHistDateFormat; } |
|---|
| 97 | QString recvHistoryColor() const { return myRecvHistoryColor; } |
|---|
| 98 | QString sentHistoryColor() const { return mySentHistoryColor; } |
|---|
| 99 | QString recvColor() const { return myRecvColor; } |
|---|
| 100 | QString sentColor() const { return mySentColor; } |
|---|
| 101 | QString noticeColor() const { return myNoticeColor; } |
|---|
| 102 | QString tabTypingColor() const { return myTabTypingColor; } |
|---|
| 103 | QString chatBackColor() const { return myChatBackColor; } |
|---|
| 104 | QRect dialogRect() const { return myDialogRect; } |
|---|
| 105 | |
|---|
| 106 | public slots: |
|---|
| 107 | /** |
|---|
| 108 | * Load configuration from file |
|---|
| 109 | */ |
|---|
| 110 | void loadConfiguration(CIniFile& iniFile); |
|---|
| 111 | |
|---|
| 112 | /** |
|---|
| 113 | * Save configuration to file |
|---|
| 114 | */ |
|---|
| 115 | void saveConfiguration(CIniFile& iniFile) const; |
|---|
| 116 | |
|---|
| 117 | // Set functions |
|---|
| 118 | void setAutoClose(bool autoClose); |
|---|
| 119 | void setAutoPopup(unsigned short autoPopup); |
|---|
| 120 | void setAutoFocus(bool autoFocus); |
|---|
| 121 | void setManualNewUser(bool manualNewUser); |
|---|
| 122 | void setSendFromClipboard(bool sendFromClipboard); |
|---|
| 123 | void setMsgChatView(bool msgChatView); |
|---|
| 124 | void setAutoPosReplyWin(bool autoPosReplyWin); |
|---|
| 125 | void setAutoSendThroughServer(bool autoSendThroughServer); |
|---|
| 126 | void setShowDlgButtons(bool showDlgButtons); |
|---|
| 127 | void setShowAllEncodings(bool showAllEncodings); |
|---|
| 128 | void setTabbedChatting(bool tabbedChatting); |
|---|
| 129 | void setShowHistory(bool showHistory); |
|---|
| 130 | void setShowNotices(bool showNotices); |
|---|
| 131 | void setShowUserPic(bool showUserPic); |
|---|
| 132 | void setShowUserPicHidden(bool showUserPicHidden); |
|---|
| 133 | void setPopupAutoResponse(bool popupAutoResponse); |
|---|
| 134 | void setChatVertSpacing(bool chatVertSpacing); |
|---|
| 135 | void setChatAppendLineBreak(bool chatAppendLineBreak); |
|---|
| 136 | void setFlashTaskbar(bool flashTaskbar); |
|---|
| 137 | void setMsgWinSticky(bool msgWinSticky); |
|---|
| 138 | void setSingleLineChatMode(bool singleLineChatMode); |
|---|
| 139 | void setCheckSpelling(bool checkSpelling); |
|---|
| 140 | void setHistVertSpacing(bool histVertSpacing); |
|---|
| 141 | void setReverseHistory(bool reverseHistory); |
|---|
| 142 | void setUseCustomUrlBrowser(bool customUrlBrowser); |
|---|
| 143 | void setChatMsgStyle(unsigned short chatMsgStyle); |
|---|
| 144 | void setHistMsgStyle(unsigned short histMsgStyle); |
|---|
| 145 | void setChatDateFormat(QString chatDateFormat); |
|---|
| 146 | void setHistDateFormat(QString histDateFormat); |
|---|
| 147 | void setRecvHistoryColor(QString recvHistoryColor); |
|---|
| 148 | void setSentHistoryColor(QString sentHistoryColor); |
|---|
| 149 | void setRecvColor(QString recvColor); |
|---|
| 150 | void setSentColor(QString sentColor); |
|---|
| 151 | void setNoticeColor(QString noticeColor); |
|---|
| 152 | void setTabTypingColor(QString tabTypingColor); |
|---|
| 153 | void setChatBackColor(QString chatBackColor); |
|---|
| 154 | void setDialogRect(const QRect& geometry); |
|---|
| 155 | |
|---|
| 156 | signals: |
|---|
| 157 | void chatColorsChanged(); |
|---|
| 158 | |
|---|
| 159 | private: |
|---|
| 160 | static Chat* myInstance; |
|---|
| 161 | |
|---|
| 162 | // Changes have been made that should trigger changed() signal |
|---|
| 163 | bool myBlockUpdates; |
|---|
| 164 | bool myColorsHaveChanged; |
|---|
| 165 | |
|---|
| 166 | bool myAutoFocus; |
|---|
| 167 | unsigned short myAutoPopup; |
|---|
| 168 | bool myAutoClose; |
|---|
| 169 | bool myManualNewUser; |
|---|
| 170 | bool mySendFromClipboard; |
|---|
| 171 | bool myMsgChatView; |
|---|
| 172 | bool myAutoPosReplyWin; |
|---|
| 173 | bool myAutoSendThroughServer; |
|---|
| 174 | bool myShowDlgButtons; |
|---|
| 175 | bool myShowAllEncodings; |
|---|
| 176 | bool myTabbedChatting; |
|---|
| 177 | bool myShowHistory; |
|---|
| 178 | bool myShowNotices; |
|---|
| 179 | bool myChatVertSpacing; |
|---|
| 180 | bool myChatAppendLineBreak; |
|---|
| 181 | bool myMsgWinSticky; |
|---|
| 182 | bool mySingleLineChatMode; |
|---|
| 183 | bool myFlashTaskbar; |
|---|
| 184 | bool myCheckSpelling; |
|---|
| 185 | bool myHistVertSpacing; |
|---|
| 186 | bool myReverseHistory; |
|---|
| 187 | bool myShowUserPic; |
|---|
| 188 | bool myShowUserPicHidden; |
|---|
| 189 | bool myPopupAutoResponse; |
|---|
| 190 | bool myUseCustomUrlBrowser; |
|---|
| 191 | |
|---|
| 192 | unsigned short myChatMsgStyle; |
|---|
| 193 | unsigned short myHistMsgStyle; |
|---|
| 194 | |
|---|
| 195 | QString myChatDateFormat; |
|---|
| 196 | QString myHistDateFormat; |
|---|
| 197 | |
|---|
| 198 | QString myRecvHistoryColor; |
|---|
| 199 | QString mySentHistoryColor; |
|---|
| 200 | QString myRecvColor; |
|---|
| 201 | QString mySentColor; |
|---|
| 202 | QString myNoticeColor; |
|---|
| 203 | QString myTabTypingColor; |
|---|
| 204 | QString myChatBackColor; |
|---|
| 205 | |
|---|
| 206 | QRect myDialogRect; |
|---|
| 207 | |
|---|
| 208 | void changeChatColors(); |
|---|
| 209 | }; |
|---|
| 210 | |
|---|
| 211 | } // namespace Config |
|---|
| 212 | } // namespace LicqQtGui |
|---|
| 213 | |
|---|
| 214 | #endif |
|---|