1 /* 2 * This file is part of Licq, an instant messaging client for UNIX. 3 * Copyright (C) 2007-2012 Licq developers <licq-dev@googlegroups.com> 4 * 5 * Licq is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; either version 2 of the License, or 8 * (at your option) any later version. 9 * 10 * Licq is distributed in the hope that it will be useful, 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 * GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License 16 * along with Licq; if not, write to the Free Software 17 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 18 */ 19 20 #ifndef CONFIG_CHAT_H 21 #define CONFIG_CHAT_H 22 23 #include "config.h" 24 25 #include <QObject> 26 #include <QRect> 27 28 namespace Licq 29 { 30 class IniFile; 31 } 32 33 namespace LicqQtGui 34 { 35 namespace Config 36 { 37 /** 38 * Chat and history configuration 39 */ 40 class Chat : public QObject 41 { 42 Q_OBJECT 43 44 public: 45 /** 46 * Create the singleton instance 47 * 48 * @param parent Parent object 49 */ 50 static void createInstance(QObject* parent = NULL); 51 52 /** 53 * Get the singleton instance 54 * 55 * @return The instance 56 */ instance()57 static Chat* instance() 58 { return myInstance; } 59 60 /** 61 * Constuctor 62 */ 63 Chat(QObject* parent = 0); 64 ~Chat()65 ~Chat() {} 66 67 void blockUpdates(bool block); 68 69 // Get functions autoClose()70 bool autoClose() const { return myAutoClose; } autoPopup()71 int autoPopup() const { return myAutoPopup; } autoPopupUrgentOnly()72 bool autoPopupUrgentOnly() const { return myAutoPopupUrgentOnly; } autoFocus()73 bool autoFocus() const { return myAutoFocus; } manualNewUser()74 bool manualNewUser() const { return myManualNewUser; } sendFromClipboard()75 bool sendFromClipboard() const { return mySendFromClipboard; } msgChatView()76 bool msgChatView() const { return myMsgChatView; } autoPosReplyWin()77 bool autoPosReplyWin() const { return myAutoPosReplyWin; } autoSendThroughServer()78 bool autoSendThroughServer() const { return myAutoSendThroughServer; } showDlgButtons()79 bool showDlgButtons() const { return myShowDlgButtons; } showAllEncodings()80 bool showAllEncodings() const { return myShowAllEncodings; } tabbedChatting()81 bool tabbedChatting() const { return myTabbedChatting; } showHistoryCount()82 int showHistoryCount() const { return myShowHistoryCount; } showHistoryTime()83 int showHistoryTime() const { return myShowHistoryTime; } showNotices()84 bool showNotices() const { return myShowNotices; } showUserPic()85 bool showUserPic() const { return myShowUserPic; } showUserPicHidden()86 bool showUserPicHidden() const { return myShowUserPicHidden; } popupAutoResponse()87 bool popupAutoResponse() const { return myPopupAutoResponse; } chatVertSpacing()88 bool chatVertSpacing() const { return myChatVertSpacing; } chatAppendLineBreak()89 bool chatAppendLineBreak() const { return myChatAppendLineBreak; } flashTaskbar()90 bool flashTaskbar() const { return myFlashTaskbar; } msgWinSticky()91 bool msgWinSticky() const { return myMsgWinSticky; } singleLineChatMode()92 bool singleLineChatMode() const { return mySingleLineChatMode; } checkSpelling()93 bool checkSpelling() const { return myCheckSpelling; } 94 #ifdef HAVE_HUNSPELL spellingDictionary()95 QString spellingDictionary() const { return mySpellingDictionary; } 96 #endif histVertSpacing()97 bool histVertSpacing() const { return myHistVertSpacing; } reverseHistory()98 bool reverseHistory() const { return myReverseHistory; } noSoundInActiveChat()99 bool noSoundInActiveChat() const { return myNoSoundInActiveChat; } chatDateHeader()100 bool chatDateHeader() const { return myChatDateHeader; } chatMsgStyle()101 int chatMsgStyle() const { return myChatMsgStyle; } histMsgStyle()102 int histMsgStyle() const { return myHistMsgStyle; } chatDateFormat()103 const QString& chatDateFormat() const { return myChatDateFormat; } histDateFormat()104 const QString& histDateFormat() const { return myHistDateFormat; } recvHistoryColor()105 const QString& recvHistoryColor() const { return myRecvHistoryColor; } sentHistoryColor()106 const QString& sentHistoryColor() const { return mySentHistoryColor; } recvColor()107 const QString& recvColor() const { return myRecvColor; } sentColor()108 const QString& sentColor() const { return mySentColor; } noticeColor()109 const QString& noticeColor() const { return myNoticeColor; } tabTypingColor()110 const QString& tabTypingColor() const { return myTabTypingColor; } chatBackColor()111 const QString& chatBackColor() const { return myChatBackColor; } tabDialogRect()112 const QRect& tabDialogRect() const { return myTabDialogRect; } sendDialogSize()113 const QSize& sendDialogSize() const { return mySendDialogSize; } viewDialogSize()114 const QSize& viewDialogSize() const { return myViewDialogSize; } 115 116 public slots: 117 /** 118 * Load configuration from file 119 */ 120 void loadConfiguration(Licq::IniFile& iniFile); 121 122 /** 123 * Save configuration to file 124 */ 125 void saveConfiguration(Licq::IniFile& iniFile) const; 126 127 // Set functions 128 void setAutoClose(bool autoClose); 129 void setAutoPopup(int autoPopup); 130 void setAutoPopupUrgentOnly(bool autoPopupUrgentOnly); 131 void setAutoFocus(bool autoFocus); 132 void setManualNewUser(bool manualNewUser); 133 void setSendFromClipboard(bool sendFromClipboard); 134 void setMsgChatView(bool msgChatView); 135 void setAutoPosReplyWin(bool autoPosReplyWin); 136 void setAutoSendThroughServer(bool autoSendThroughServer); 137 void setShowDlgButtons(bool showDlgButtons); 138 void setShowAllEncodings(bool showAllEncodings); 139 void setTabbedChatting(bool tabbedChatting); 140 void setShowHistoryCount(int showHistoryCount); 141 void setShowHistoryTime(int showHistoryTime); 142 void setShowNotices(bool showNotices); 143 void setShowUserPic(bool showUserPic); 144 void setShowUserPicHidden(bool showUserPicHidden); 145 void setPopupAutoResponse(bool popupAutoResponse); 146 void setChatVertSpacing(bool chatVertSpacing); 147 void setChatAppendLineBreak(bool chatAppendLineBreak); 148 void setFlashTaskbar(bool flashTaskbar); 149 void setMsgWinSticky(bool msgWinSticky); 150 void setSingleLineChatMode(bool singleLineChatMode); 151 void setCheckSpelling(bool checkSpelling); 152 #ifdef HAVE_HUNSPELL 153 void setSpellingDictionary(const QString& spellingDictionary); 154 #endif 155 void setHistVertSpacing(bool histVertSpacing); 156 void setReverseHistory(bool reverseHistory); 157 void setNoSoundInActiveChat(bool noSoundInActiveChat); 158 void setChatDateHeader(bool chatDateHeader); 159 void setChatMsgStyle(int chatMsgStyle); 160 void setHistMsgStyle(int histMsgStyle); 161 void setChatDateFormat(const QString& chatDateFormat); 162 void setHistDateFormat(const QString& histDateFormat); 163 void setRecvHistoryColor(const QString& recvHistoryColor); 164 void setSentHistoryColor(const QString& sentHistoryColor); 165 void setRecvColor(const QString& recvColor); 166 void setSentColor(const QString& sentColor); 167 void setNoticeColor(const QString& noticeColor); 168 void setTabTypingColor(const QString& tabTypingColor); 169 void setChatBackColor(const QString& chatBackColor); 170 void setTabDialogRect(const QRect& geometry); 171 void setSendDialogSize(const QSize& geometry); 172 void setViewDialogSize(const QSize& geometry); 173 174 signals: 175 void chatColorsChanged(); 176 177 private: 178 static Chat* myInstance; 179 180 // Changes have been made that should trigger changed() signal 181 bool myBlockUpdates; 182 bool myColorsHaveChanged; 183 184 bool myAutoFocus; 185 int myAutoPopup; 186 bool myAutoPopupUrgentOnly; 187 bool myAutoClose; 188 bool myManualNewUser; 189 bool mySendFromClipboard; 190 bool myMsgChatView; 191 bool myAutoPosReplyWin; 192 bool myAutoSendThroughServer; 193 bool myShowDlgButtons; 194 bool myShowAllEncodings; 195 bool myTabbedChatting; 196 int myShowHistoryCount; 197 int myShowHistoryTime; 198 bool myShowNotices; 199 bool myChatVertSpacing; 200 bool myChatAppendLineBreak; 201 bool myMsgWinSticky; 202 bool mySingleLineChatMode; 203 bool myFlashTaskbar; 204 bool myCheckSpelling; 205 #ifdef HAVE_HUNSPELL 206 QString mySpellingDictionary; 207 #endif 208 bool myHistVertSpacing; 209 bool myReverseHistory; 210 bool myShowUserPic; 211 bool myShowUserPicHidden; 212 bool myPopupAutoResponse; 213 bool myUseCustomUrlBrowser; 214 bool myNoSoundInActiveChat; 215 bool myChatDateHeader; 216 217 int myChatMsgStyle; 218 int myHistMsgStyle; 219 220 QString myChatDateFormat; 221 QString myHistDateFormat; 222 223 QString myRecvHistoryColor; 224 QString mySentHistoryColor; 225 QString myRecvColor; 226 QString mySentColor; 227 QString myNoticeColor; 228 QString myTabTypingColor; 229 QString myChatBackColor; 230 231 QRect myTabDialogRect; 232 QSize mySendDialogSize; 233 QSize myViewDialogSize; 234 235 void changeChatColors(); 236 }; 237 238 } // namespace Config 239 } // namespace LicqQtGui 240 241 #endif 242