void lmcChatRoomWindow::btnFont_clicked(void) { bool ok; QFont font = ui.txtMessage->font(); font.setPointSize(ui.txtMessage->fontPointSize()); QFont newFont = QFontDialog::getFont(&ok, font, this, tr("Select Font")); if(ok) setMessageFont(newFont); }
void KChatBaseModel::readConfig(KConfig* conf) { if (!conf) { conf = KGlobal::config().data(); } KConfigGroup cg(conf, "KChatBaseModelPrivate"); setNameFont(cg.readEntry("NameFont", QFont())); setMessageFont(cg.readEntry("MessageFont", QFont())); setSystemNameFont(cg.readEntry("SystemNameFont", QFont())); setSystemMessageFont(cg.readEntry("SystemMessageFont", QFont())); setMaxItems(cg.readEntry("MaxMessages", -1)); }
void KChatBaseModel::setBothFont(const QFont& font) { setNameFont(font); setMessageFont(font); }
void lmcChatRoomWindow::init(User* pLocalUser, bool connected, QString thread) { localId = pLocalUser->id; localName = pLocalUser->name; this->pLocalUser = pLocalUser; pMessageLog->localId = localId; // get the avatar image for the users from the cache folder QDir cacheDir(StdLocation::cacheDir()); QString fileName = "avt_" + localId + ".png"; QString filePath = cacheDir.absoluteFilePath(fileName); pMessageLog->participantAvatars.insert(localId, filePath); threadId = thread; groupMode = !threadId.isNull(); createUserMenu(); createSmileyMenu(); createToolBar(); bConnected = connected; if ( !bConnected ) showStatus( IT_Disconnected, true ); pSoundPlayer = new lmcSoundPlayer(); ui.tvUserList->setIconSize(QSize(16, 16)); ui.tvUserList->header()->setSectionsMovable(false); ui.tvUserList->header()->setStretchLastSection(false); ui.tvUserList->header()->setSectionResizeMode(0, QHeaderView::Stretch); lmcUserTreeWidgetGroupItem *pItem = new lmcUserTreeWidgetGroupItem(); pItem->setData(0, IdRole, GroupId); pItem->setData(0, TypeRole, "Group"); pItem->setText(0, "Participants"); pItem->setSizeHint(0, QSize(0, 22)); ui.tvUserList->addTopLevelItem(pItem); ui.tvUserList->expandAll(); pSettings = new lmcSettings(); showSmiley = pSettings->value(IDS_EMOTICON, IDS_EMOTICON_VAL).toBool(); pMessageLog->showSmiley = showSmiley; pMessageLog->autoFile = pSettings->value(IDS_AUTOFILE, IDS_AUTOFILE_VAL).toBool(); pMessageLog->fontSizeVal = pSettings->value(IDS_FONTSIZE, IDS_FONTSIZE_VAL).toInt(); pMessageLog->messageTime = pSettings->value(IDS_MESSAGETIME, IDS_MESSAGETIME_VAL).toBool(); pMessageLog->messageDate = pSettings->value(IDS_MESSAGEDATE, IDS_MESSAGEDATE_VAL).toBool(); pMessageLog->allowLinks = pSettings->value(IDS_ALLOWLINKS, IDS_ALLOWLINKS_VAL).toBool(); pMessageLog->pathToLink = pSettings->value(IDS_PATHTOLINK, IDS_PATHTOLINK_VAL).toBool(); pMessageLog->trimMessage = pSettings->value(IDS_TRIMMESSAGE, IDS_TRIMMESSAGE_VAL).toBool(); QFont font = QApplication::font(); font.fromString(pSettings->value(IDS_FONT, IDS_FONT_VAL).toString()); messageColor = QApplication::palette().text().color(); messageColor.setNamedColor(pSettings->value(IDS_COLOR, IDS_COLOR_VAL).toString()); sendKeyMod = pSettings->value(IDS_SENDKEYMOD, IDS_SENDKEYMOD_VAL).toBool(); if ( !groupMode ) { restoreGeometry(pSettings->value(IDS_WINDOWPUBLICCHAT).toByteArray()); ui.vSplitter->restoreState(pSettings->value(IDS_SPLITTERPUBLICCHATV).toByteArray()); ui.hSplitter->restoreState(pSettings->value(IDS_SPLITTERPUBLICCHATH).toByteArray()); } setUIText(); setMessageFont( font ); ui.txtMessage->setStyleSheet( "QTextEdit {color: " + messageColor.name() + ";}" ); ui.txtMessage->setFocus(); QString themePath = pSettings->value(IDS_THEME, IDS_THEME_VAL).toString(); pMessageLog->initMessageLog(themePath); int viewType = pSettings->value(IDS_USERLISTVIEW, IDS_USERLISTVIEW_VAL).toInt(); ui.tvUserList->setView((UserListView)viewType); // Destroy the window when it closes if in group mode setAttribute(Qt::WA_DeleteOnClose, groupMode); // Add the local user as a participant addUser(pLocalUser); }