| 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 | #include "chat.h" |
|---|
| 22 | |
|---|
| 23 | #include "config.h" |
|---|
| 24 | |
|---|
| 25 | #include <QApplication> |
|---|
| 26 | #include <QDesktopWidget> |
|---|
| 27 | |
|---|
| 28 | #include <licq_file.h> |
|---|
| 29 | |
|---|
| 30 | using namespace LicqQtGui; |
|---|
| 31 | /* TRANSLATOR LicqQtGui::Config::Chat */ |
|---|
| 32 | |
|---|
| 33 | Config::Chat* Config::Chat::myInstance = NULL; |
|---|
| 34 | |
|---|
| 35 | void Config::Chat::createInstance(QObject* parent) |
|---|
| 36 | { |
|---|
| 37 | myInstance = new Config::Chat(parent); |
|---|
| 38 | } |
|---|
| 39 | |
|---|
| 40 | Config::Chat::Chat(QObject* parent) |
|---|
| 41 | : QObject(parent), |
|---|
| 42 | myBlockUpdates(false), |
|---|
| 43 | myColorsHaveChanged(false) |
|---|
| 44 | { |
|---|
| 45 | // Empty |
|---|
| 46 | } |
|---|
| 47 | |
|---|
| 48 | void Config::Chat::loadConfiguration(CIniFile& iniFile) |
|---|
| 49 | { |
|---|
| 50 | char szTemp[255]; |
|---|
| 51 | |
|---|
| 52 | iniFile.SetSection("appearance"); |
|---|
| 53 | iniFile.ReadBool("ManualNewUser", myManualNewUser, false); |
|---|
| 54 | iniFile.ReadBool("SendFromClipboard", mySendFromClipboard, true); |
|---|
| 55 | iniFile.ReadBool("MsgChatView", myMsgChatView, true ); |
|---|
| 56 | iniFile.ReadBool("TabbedChatting", myTabbedChatting, true); |
|---|
| 57 | iniFile.ReadBool("ShowHistory", myShowHistory, true); |
|---|
| 58 | iniFile.ReadBool("ShowNotices", myShowNotices, true); |
|---|
| 59 | iniFile.ReadBool("AutoPosReplyWin", myAutoPosReplyWin, true); |
|---|
| 60 | iniFile.ReadBool("AutoSendThroughServer", myAutoSendThroughServer, false); |
|---|
| 61 | iniFile.ReadBool("ShowChatDlgButtons", myShowDlgButtons, true); |
|---|
| 62 | iniFile.ReadNum("ChatMessageStyle", myChatMsgStyle, 0); |
|---|
| 63 | iniFile.ReadBool("ChatVerticalSpacing", myChatVertSpacing, true); |
|---|
| 64 | iniFile.ReadBool("ChatAppendLinebreak", myChatAppendLineBreak, false); |
|---|
| 65 | iniFile.ReadBool("FlashTaskbar", myFlashTaskbar, true); |
|---|
| 66 | iniFile.ReadBool("MsgWinSticky", myMsgWinSticky, false); |
|---|
| 67 | iniFile.ReadBool("SingleLineChatMode", mySingleLineChatMode, false); |
|---|
| 68 | iniFile.ReadBool("CheckSpellingEnabled", myCheckSpelling, false); |
|---|
| 69 | iniFile.ReadBool("ShowUserPic", myShowUserPic, false); |
|---|
| 70 | iniFile.ReadBool("ShowUserPicHidden", myShowUserPicHidden, false); |
|---|
| 71 | iniFile.ReadStr("DateFormat", szTemp, "hh:mm:ss"); |
|---|
| 72 | myChatDateFormat = QString::fromLatin1(szTemp); |
|---|
| 73 | iniFile.ReadNum("HistoryMessageStyle", myHistMsgStyle, 0); |
|---|
| 74 | iniFile.ReadBool("HistoryVerticalSpacing", myHistVertSpacing, true); |
|---|
| 75 | iniFile.ReadBool("HistoryReverse", myReverseHistory, false); |
|---|
| 76 | iniFile.ReadStr("HistoryDateFormat", szTemp, "hh:mm:ss"); |
|---|
| 77 | myHistDateFormat = QString::fromLatin1(szTemp); |
|---|
| 78 | |
|---|
| 79 | iniFile.ReadStr("ReceiveMessageColor", szTemp, "red"); |
|---|
| 80 | myRecvColor = QString::fromLatin1(szTemp); |
|---|
| 81 | iniFile.ReadStr("ReceiveHistoryColor", szTemp, "lightpink"); |
|---|
| 82 | myRecvHistoryColor = QString::fromLatin1(szTemp); |
|---|
| 83 | iniFile.ReadStr("SentMessageColor", szTemp, "blue"); |
|---|
| 84 | mySentColor = QString::fromLatin1(szTemp); |
|---|
| 85 | iniFile.ReadStr("SentHistoryColor", szTemp, "lightblue"); |
|---|
| 86 | mySentHistoryColor = QString::fromLatin1(szTemp); |
|---|
| 87 | iniFile.ReadStr("NoticeColor", szTemp, "darkgreen"); |
|---|
| 88 | myNoticeColor = QString::fromLatin1(szTemp); |
|---|
| 89 | iniFile.ReadStr("TabOnTypingColor", szTemp, "yellow"); |
|---|
| 90 | myTabTypingColor = QString::fromLatin1(szTemp); |
|---|
| 91 | iniFile.ReadStr("ChatBackground", szTemp, "white"); |
|---|
| 92 | myChatBackColor = QString::fromLatin1(szTemp); |
|---|
| 93 | |
|---|
| 94 | iniFile.SetSection("functions"); |
|---|
| 95 | iniFile.ReadBool("AutoClose", myAutoClose, true); |
|---|
| 96 | iniFile.ReadNum("AutoPopup", myAutoPopup, 0); |
|---|
| 97 | iniFile.ReadBool("AutoFocus", myAutoFocus, true); |
|---|
| 98 | iniFile.ReadBool("PopupAutoResponse", myPopupAutoResponse, true); |
|---|
| 99 | |
|---|
| 100 | iniFile.SetSection("locale"); |
|---|
| 101 | iniFile.ReadBool("ShowAllEncodings", myShowAllEncodings, false); |
|---|
| 102 | |
|---|
| 103 | iniFile.SetSection("extensions"); |
|---|
| 104 | iniFile.ReadBool("UseCustomUrlBrowser", myUseCustomUrlBrowser, false); |
|---|
| 105 | |
|---|
| 106 | iniFile.SetSection("geometry"); |
|---|
| 107 | short xPos, yPos, wVal, hVal; |
|---|
| 108 | iniFile.ReadNum("EventDialog.X", xPos, 0); |
|---|
| 109 | iniFile.ReadNum("EventDialog.Y", yPos, 0); |
|---|
| 110 | iniFile.ReadNum("EventDialog.W", wVal, 0); |
|---|
| 111 | iniFile.ReadNum("EventDialog.H", hVal, 0); |
|---|
| 112 | if (xPos > QApplication::desktop()->width() - 16) |
|---|
| 113 | xPos = 0; |
|---|
| 114 | if (yPos > QApplication::desktop()->height() - 16) |
|---|
| 115 | yPos = 0; |
|---|
| 116 | myDialogRect.setRect(xPos, yPos, wVal, hVal); |
|---|
| 117 | } |
|---|
| 118 | |
|---|
| 119 | void Config::Chat::saveConfiguration(CIniFile& iniFile) const |
|---|
| 120 | { |
|---|
| 121 | iniFile.SetSection("appearance"); |
|---|
| 122 | iniFile.WriteBool("ManualNewUser", myManualNewUser); |
|---|
| 123 | iniFile.WriteBool("SendFromClipboard", mySendFromClipboard); |
|---|
| 124 | iniFile.WriteBool("MsgChatView", myMsgChatView); |
|---|
| 125 | iniFile.WriteBool("TabbedChatting", myTabbedChatting); |
|---|
| 126 | iniFile.WriteBool("ShowHistory", myShowHistory); |
|---|
| 127 | iniFile.WriteBool("ShowNotices", myShowNotices); |
|---|
| 128 | iniFile.WriteBool("AutoPosReplyWin", myAutoPosReplyWin); |
|---|
| 129 | iniFile.WriteBool("AutoSendThroughServer", myAutoSendThroughServer); |
|---|
| 130 | iniFile.WriteBool("ShowChatDlgButtons", myShowDlgButtons); |
|---|
| 131 | iniFile.WriteBool("FlashTaskbar", myFlashTaskbar); |
|---|
| 132 | iniFile.WriteBool("MsgWinSticky", myMsgWinSticky); |
|---|
| 133 | iniFile.WriteBool("SingleLineChatMode", mySingleLineChatMode); |
|---|
| 134 | iniFile.WriteBool("CheckSpellingEnabled", myCheckSpelling); |
|---|
| 135 | iniFile.WriteBool("ShowUserPic", myShowUserPic); |
|---|
| 136 | iniFile.WriteBool("ShowUserPicHidden", myShowUserPicHidden); |
|---|
| 137 | |
|---|
| 138 | iniFile.WriteNum("ChatMessageStyle", myChatMsgStyle); |
|---|
| 139 | iniFile.WriteBool("ChatVerticalSpacing", myChatVertSpacing); |
|---|
| 140 | iniFile.WriteBool("ChatAppendLinebreak", myChatAppendLineBreak); |
|---|
| 141 | iniFile.WriteStr("ReceiveMessageColor", myRecvColor.toLatin1()); |
|---|
| 142 | iniFile.WriteStr("ReceiveHistoryColor", myRecvHistoryColor.toLatin1()); |
|---|
| 143 | iniFile.WriteStr("SentMessageColor", mySentColor.toLatin1()); |
|---|
| 144 | iniFile.WriteStr("SentHistoryColor", mySentHistoryColor.toLatin1()); |
|---|
| 145 | iniFile.WriteStr("NoticeColor", myNoticeColor.toLatin1()); |
|---|
| 146 | iniFile.WriteStr("TabOnTypingColor", myTabTypingColor.toLatin1()); |
|---|
| 147 | iniFile.WriteStr("ChatBackground", myChatBackColor.toLatin1()); |
|---|
| 148 | iniFile.WriteStr("DateFormat", myChatDateFormat.toLatin1()); |
|---|
| 149 | iniFile.WriteNum("HistoryMessageStyle", myHistMsgStyle); |
|---|
| 150 | iniFile.WriteBool("HistoryVerticalSpacing", myHistVertSpacing); |
|---|
| 151 | iniFile.WriteBool("HistoryReverse", myReverseHistory); |
|---|
| 152 | iniFile.WriteStr("HistoryDateFormat", myHistDateFormat.toLatin1()); |
|---|
| 153 | |
|---|
| 154 | iniFile.SetSection("functions"); |
|---|
| 155 | iniFile.WriteBool("AutoClose", myAutoClose); |
|---|
| 156 | iniFile.WriteNum("AutoPopup", myAutoPopup); |
|---|
| 157 | iniFile.WriteBool("AutoFocus", myAutoFocus); |
|---|
| 158 | iniFile.WriteBool("PopupAutoResponse", myPopupAutoResponse); |
|---|
| 159 | |
|---|
| 160 | iniFile.SetSection("extensions"); |
|---|
| 161 | iniFile.WriteBool("UseCustomUrlBrowser", myUseCustomUrlBrowser); |
|---|
| 162 | |
|---|
| 163 | iniFile.SetSection("locale"); |
|---|
| 164 | iniFile.WriteBool("ShowAllEncodings", myShowAllEncodings); |
|---|
| 165 | |
|---|
| 166 | iniFile.SetSection("geometry"); |
|---|
| 167 | iniFile.WriteNum("EventDialog.X", static_cast<short>(myDialogRect.x())); |
|---|
| 168 | iniFile.WriteNum("EventDialog.Y", static_cast<short>(myDialogRect.y())); |
|---|
| 169 | iniFile.WriteNum("EventDialog.W", static_cast<short>(myDialogRect.width())); |
|---|
| 170 | iniFile.WriteNum("EventDialog.H", static_cast<short>(myDialogRect.height())); |
|---|
| 171 | } |
|---|
| 172 | |
|---|
| 173 | void Config::Chat::blockUpdates(bool block) |
|---|
| 174 | { |
|---|
| 175 | myBlockUpdates = block; |
|---|
| 176 | |
|---|
| 177 | if (block) |
|---|
| 178 | return; |
|---|
| 179 | |
|---|
| 180 | if (myColorsHaveChanged) |
|---|
| 181 | { |
|---|
| 182 | myColorsHaveChanged = false; |
|---|
| 183 | emit chatColorsChanged(); |
|---|
| 184 | } |
|---|
| 185 | } |
|---|
| 186 | |
|---|
| 187 | void Config::Chat::setAutoClose(bool autoClose) |
|---|
| 188 | { |
|---|
| 189 | if (autoClose == myAutoClose) |
|---|
| 190 | return; |
|---|
| 191 | |
|---|
| 192 | myAutoClose = autoClose; |
|---|
| 193 | } |
|---|
| 194 | |
|---|
| 195 | void Config::Chat::setAutoPopup(unsigned short autoPopup) |
|---|
| 196 | { |
|---|
| 197 | if (autoPopup == myAutoPopup) |
|---|
| 198 | return; |
|---|
| 199 | |
|---|
| 200 | myAutoPopup = autoPopup; |
|---|
| 201 | } |
|---|
| 202 | |
|---|
| 203 | void Config::Chat::setAutoFocus(bool autoFocus) |
|---|
| 204 | { |
|---|
| 205 | if (autoFocus == myAutoFocus) |
|---|
| 206 | return; |
|---|
| 207 | |
|---|
| 208 | myAutoFocus = autoFocus; |
|---|
| 209 | } |
|---|
| 210 | |
|---|
| 211 | void Config::Chat::setManualNewUser(bool manualNewUser) |
|---|
| 212 | { |
|---|
| 213 | if (manualNewUser == myManualNewUser) |
|---|
| 214 | return; |
|---|
| 215 | |
|---|
| 216 | myManualNewUser = manualNewUser; |
|---|
| 217 | } |
|---|
| 218 | |
|---|
| 219 | void Config::Chat::setSendFromClipboard(bool sendFromClipboard) |
|---|
| 220 | { |
|---|
| 221 | if (sendFromClipboard == mySendFromClipboard) |
|---|
| 222 | return; |
|---|
| 223 | |
|---|
| 224 | mySendFromClipboard = sendFromClipboard; |
|---|
| 225 | } |
|---|
| 226 | |
|---|
| 227 | void Config::Chat::setMsgChatView(bool msgChatView) |
|---|
| 228 | { |
|---|
| 229 | if (msgChatView == myMsgChatView) |
|---|
| 230 | return; |
|---|
| 231 | |
|---|
| 232 | myMsgChatView = msgChatView; |
|---|
| 233 | } |
|---|
| 234 | |
|---|
| 235 | void Config::Chat::setShowAllEncodings(bool showAllEncodings) |
|---|
| 236 | { |
|---|
| 237 | if (showAllEncodings == myShowAllEncodings) |
|---|
| 238 | return; |
|---|
| 239 | |
|---|
| 240 | myShowAllEncodings = showAllEncodings; |
|---|
| 241 | } |
|---|
| 242 | |
|---|
| 243 | void Config::Chat::setTabbedChatting(bool tabbedChatting) |
|---|
| 244 | { |
|---|
| 245 | if (tabbedChatting == myTabbedChatting) |
|---|
| 246 | return; |
|---|
| 247 | |
|---|
| 248 | myTabbedChatting = tabbedChatting; |
|---|
| 249 | } |
|---|
| 250 | |
|---|
| 251 | void Config::Chat::setShowHistory(bool showHistory) |
|---|
| 252 | { |
|---|
| 253 | if (showHistory == myShowHistory) |
|---|
| 254 | return; |
|---|
| 255 | |
|---|
| 256 | myShowHistory = showHistory; |
|---|
| 257 | } |
|---|
| 258 | |
|---|
| 259 | void Config::Chat::setShowNotices(bool showNotices) |
|---|
| 260 | { |
|---|
| 261 | if (showNotices == myShowNotices) |
|---|
| 262 | return; |
|---|
| 263 | |
|---|
| 264 | myShowNotices = showNotices; |
|---|
| 265 | } |
|---|
| 266 | |
|---|
| 267 | void Config::Chat::setShowUserPic(bool showUserPic) |
|---|
| 268 | { |
|---|
| 269 | if (showUserPic == myShowUserPic) |
|---|
| 270 | return; |
|---|
| 271 | |
|---|
| 272 | myShowUserPic = showUserPic; |
|---|
| 273 | } |
|---|
| 274 | |
|---|
| 275 | void Config::Chat::setShowUserPicHidden(bool showUserPicHidden) |
|---|
| 276 | { |
|---|
| 277 | if (showUserPicHidden == myShowUserPicHidden) |
|---|
| 278 | return; |
|---|
| 279 | |
|---|
| 280 | myShowUserPicHidden = showUserPicHidden; |
|---|
| 281 | } |
|---|
| 282 | |
|---|
| 283 | void Config::Chat::setPopupAutoResponse(bool popupAutoResponse) |
|---|
| 284 | { |
|---|
| 285 | if (popupAutoResponse == myPopupAutoResponse) |
|---|
| 286 | return; |
|---|
| 287 | |
|---|
| 288 | myPopupAutoResponse = popupAutoResponse; |
|---|
| 289 | } |
|---|
| 290 | |
|---|
| 291 | void Config::Chat::setAutoPosReplyWin(bool autoPosReplyWin) |
|---|
| 292 | { |
|---|
| 293 | if (autoPosReplyWin == myAutoPosReplyWin) |
|---|
| 294 | return; |
|---|
| 295 | |
|---|
| 296 | myAutoPosReplyWin = autoPosReplyWin; |
|---|
| 297 | } |
|---|
| 298 | |
|---|
| 299 | void Config::Chat::setAutoSendThroughServer(bool autoSendThroughServer) |
|---|
| 300 | { |
|---|
| 301 | if (autoSendThroughServer == myAutoSendThroughServer) |
|---|
| 302 | return; |
|---|
| 303 | |
|---|
| 304 | myAutoSendThroughServer = autoSendThroughServer; |
|---|
| 305 | } |
|---|
| 306 | |
|---|
| 307 | void Config::Chat::setShowDlgButtons(bool showDlgButtons) |
|---|
| 308 | { |
|---|
| 309 | if (showDlgButtons == myShowDlgButtons) |
|---|
| 310 | return; |
|---|
| 311 | |
|---|
| 312 | myShowDlgButtons = showDlgButtons; |
|---|
| 313 | } |
|---|
| 314 | |
|---|
| 315 | void Config::Chat::setChatVertSpacing(bool chatVertSpacing) |
|---|
| 316 | { |
|---|
| 317 | if (chatVertSpacing == myChatVertSpacing) |
|---|
| 318 | return; |
|---|
| 319 | |
|---|
| 320 | myChatVertSpacing = chatVertSpacing; |
|---|
| 321 | } |
|---|
| 322 | |
|---|
| 323 | void Config::Chat::setChatAppendLineBreak(bool chatAppendLineBreak) |
|---|
| 324 | { |
|---|
| 325 | if (chatAppendLineBreak == myChatAppendLineBreak) |
|---|
| 326 | return; |
|---|
| 327 | |
|---|
| 328 | myChatAppendLineBreak = chatAppendLineBreak; |
|---|
| 329 | } |
|---|
| 330 | |
|---|
| 331 | void Config::Chat::setFlashTaskbar(bool flashTaskbar) |
|---|
| 332 | { |
|---|
| 333 | if (flashTaskbar == myFlashTaskbar) |
|---|
| 334 | return; |
|---|
| 335 | |
|---|
| 336 | myFlashTaskbar = flashTaskbar; |
|---|
| 337 | } |
|---|
| 338 | |
|---|
| 339 | void Config::Chat::setMsgWinSticky(bool msgWinSticky) |
|---|
| 340 | { |
|---|
| 341 | if (msgWinSticky == myMsgWinSticky) |
|---|
| 342 | return; |
|---|
| 343 | |
|---|
| 344 | myMsgWinSticky = msgWinSticky; |
|---|
| 345 | } |
|---|
| 346 | |
|---|
| 347 | void Config::Chat::setSingleLineChatMode(bool singleLineChatMode) |
|---|
| 348 | { |
|---|
| 349 | if (singleLineChatMode == mySingleLineChatMode) |
|---|
| 350 | return; |
|---|
| 351 | |
|---|
| 352 | mySingleLineChatMode = singleLineChatMode; |
|---|
| 353 | } |
|---|
| 354 | |
|---|
| 355 | void Config::Chat::setCheckSpelling(bool checkSpelling) |
|---|
| 356 | { |
|---|
| 357 | if (checkSpelling == myCheckSpelling) |
|---|
| 358 | return; |
|---|
| 359 | |
|---|
| 360 | myCheckSpelling = checkSpelling; |
|---|
| 361 | } |
|---|
| 362 | |
|---|
| 363 | void Config::Chat::setHistVertSpacing(bool histVertSpacing) |
|---|
| 364 | { |
|---|
| 365 | if (histVertSpacing == myHistVertSpacing) |
|---|
| 366 | return; |
|---|
| 367 | |
|---|
| 368 | myHistVertSpacing = histVertSpacing; |
|---|
| 369 | } |
|---|
| 370 | |
|---|
| 371 | void Config::Chat::setReverseHistory(bool reverseHistory) |
|---|
| 372 | { |
|---|
| 373 | if (reverseHistory == myReverseHistory) |
|---|
| 374 | return; |
|---|
| 375 | |
|---|
| 376 | myReverseHistory = reverseHistory; |
|---|
| 377 | } |
|---|
| 378 | |
|---|
| 379 | void Config::Chat::setUseCustomUrlBrowser(bool customUrlBrowser) |
|---|
| 380 | { |
|---|
| 381 | if (customUrlBrowser == myUseCustomUrlBrowser) |
|---|
| 382 | return; |
|---|
| 383 | |
|---|
| 384 | myUseCustomUrlBrowser = customUrlBrowser; |
|---|
| 385 | } |
|---|
| 386 | |
|---|
| 387 | void Config::Chat::setChatMsgStyle(unsigned short chatMsgStyle) |
|---|
| 388 | { |
|---|
| 389 | if (chatMsgStyle == myChatMsgStyle) |
|---|
| 390 | return; |
|---|
| 391 | |
|---|
| 392 | myChatMsgStyle = chatMsgStyle; |
|---|
| 393 | } |
|---|
| 394 | |
|---|
| 395 | void Config::Chat::setHistMsgStyle(unsigned short histMsgStyle) |
|---|
| 396 | { |
|---|
| 397 | if (histMsgStyle == myHistMsgStyle) |
|---|
| 398 | return; |
|---|
| 399 | |
|---|
| 400 | myHistMsgStyle = histMsgStyle; |
|---|
| 401 | } |
|---|
| 402 | |
|---|
| 403 | void Config::Chat::setChatDateFormat(QString chatDateFormat) |
|---|
| 404 | { |
|---|
| 405 | if (chatDateFormat == myChatDateFormat) |
|---|
| 406 | return; |
|---|
| 407 | |
|---|
| 408 | myChatDateFormat = chatDateFormat; |
|---|
| 409 | } |
|---|
| 410 | |
|---|
| 411 | void Config::Chat::setHistDateFormat(QString histDateFormat) |
|---|
| 412 | { |
|---|
| 413 | if (histDateFormat == myHistDateFormat) |
|---|
| 414 | return; |
|---|
| 415 | |
|---|
| 416 | myHistDateFormat = histDateFormat; |
|---|
| 417 | } |
|---|
| 418 | |
|---|
| 419 | void Config::Chat::setRecvHistoryColor(QString recvHistoryColor) |
|---|
| 420 | { |
|---|
| 421 | if (recvHistoryColor == myRecvHistoryColor) |
|---|
| 422 | return; |
|---|
| 423 | |
|---|
| 424 | myRecvHistoryColor = recvHistoryColor; |
|---|
| 425 | changeChatColors(); |
|---|
| 426 | } |
|---|
| 427 | |
|---|
| 428 | void Config::Chat::setSentHistoryColor(QString sentHistoryColor) |
|---|
| 429 | { |
|---|
| 430 | if (sentHistoryColor == mySentHistoryColor) |
|---|
| 431 | return; |
|---|
| 432 | |
|---|
| 433 | mySentHistoryColor = sentHistoryColor; |
|---|
| 434 | changeChatColors(); |
|---|
| 435 | } |
|---|
| 436 | |
|---|
| 437 | void Config::Chat::setRecvColor(QString recvColor) |
|---|
| 438 | { |
|---|
| 439 | if (recvColor == myRecvColor) |
|---|
| 440 | return; |
|---|
| 441 | |
|---|
| 442 | myRecvColor = recvColor; |
|---|
| 443 | changeChatColors(); |
|---|
| 444 | } |
|---|
| 445 | |
|---|
| 446 | void Config::Chat::setSentColor(QString sentColor) |
|---|
| 447 | { |
|---|
| 448 | if (sentColor == mySentColor) |
|---|
| 449 | return; |
|---|
| 450 | |
|---|
| 451 | mySentColor = sentColor; |
|---|
| 452 | changeChatColors(); |
|---|
| 453 | } |
|---|
| 454 | |
|---|
| 455 | void Config::Chat::setNoticeColor(QString noticeColor) |
|---|
| 456 | { |
|---|
| 457 | if (noticeColor == myNoticeColor) |
|---|
| 458 | return; |
|---|
| 459 | |
|---|
| 460 | myNoticeColor = noticeColor; |
|---|
| 461 | changeChatColors(); |
|---|
| 462 | } |
|---|
| 463 | |
|---|
| 464 | void Config::Chat::setTabTypingColor(QString tabTypingColor) |
|---|
| 465 | { |
|---|
| 466 | if (tabTypingColor == myTabTypingColor) |
|---|
| 467 | return; |
|---|
| 468 | |
|---|
| 469 | myTabTypingColor = tabTypingColor; |
|---|
| 470 | changeChatColors(); |
|---|
| 471 | } |
|---|
| 472 | |
|---|
| 473 | void Config::Chat::setChatBackColor(QString chatBackColor) |
|---|
| 474 | { |
|---|
| 475 | if (chatBackColor == myChatBackColor) |
|---|
| 476 | return; |
|---|
| 477 | |
|---|
| 478 | myChatBackColor = chatBackColor; |
|---|
| 479 | changeChatColors(); |
|---|
| 480 | } |
|---|
| 481 | |
|---|
| 482 | void Config::Chat::setDialogRect(const QRect& geometry) |
|---|
| 483 | { |
|---|
| 484 | if (geometry.isValid()) |
|---|
| 485 | myDialogRect = geometry; |
|---|
| 486 | } |
|---|
| 487 | |
|---|
| 488 | void Config::Chat::changeChatColors() |
|---|
| 489 | { |
|---|
| 490 | if (myBlockUpdates) |
|---|
| 491 | myColorsHaveChanged = true; |
|---|
| 492 | else |
|---|
| 493 | emit chatColorsChanged(); |
|---|
| 494 | } |
|---|