MsgEdit::MsgEdit(QWidget *parent, UserWnd *userWnd) : QMainWindow(parent, NULL, 0) { m_userWnd = userWnd; m_msg = NULL; m_bTyping = false; m_type = NO_TYPE; m_flags = 0; m_retry.msg = NULL; m_bReceived = false; m_processor = NULL; m_recvProcessor = NULL; m_cmd.param = NULL; connect(CorePlugin::m_plugin, SIGNAL(modeChanged()), this, SLOT(modeChanged())); m_frame = new QFrame(this); setCentralWidget(m_frame); m_layout = new QVBoxLayout(m_frame); m_edit = new MsgTextEdit(this, m_frame); m_edit->setBackground(QColor(CorePlugin::m_plugin->getEditBackground() & 0xFFFFFF)); m_edit->setForeground(QColor(CorePlugin::m_plugin->getEditForeground() & 0xFFFFFF), true); m_edit->setFont(CorePlugin::m_plugin->editFont); m_edit->setCtrlMode(!CorePlugin::m_plugin->getSendOnEnter()); setFocusProxy(m_edit); QStyleSheet *style = new QStyleSheet(m_edit); QStyleSheetItem *style_p = style->item("p"); // Disable top and bottom margins for P tags. This will make sure // paragraphs have no more spacing than regular lines, thus matching // RTFs defaut look for paragraphs. style_p->setMargin(QStyleSheetItem::MarginTop, 0); style_p->setMargin(QStyleSheetItem::MarginBottom, 0); m_edit->setStyleSheet(style); connect(m_edit, SIGNAL(lostFocus()), this, SLOT(editLostFocus())); connect(m_edit, SIGNAL(textChanged()), this, SLOT(editTextChanged())); connect(m_edit, SIGNAL(ctrlEnterPressed()), this, SLOT(editEnterPressed())); connect(m_edit, SIGNAL(colorsChanged()), this, SLOT(colorsChanged())); connect(m_edit, SIGNAL(finished()), this, SLOT(editFinished())); connect(m_edit, SIGNAL(fontSelected(const QFont&)), this, SLOT(editFontChanged(const QFont&))); QFontMetrics fm(m_edit->font()); m_edit->setMinimumSize(QSize(fm.maxWidth(), fm.height() + 10)); m_layout->addWidget(m_edit); BarShow b; b.bar_id = ToolBarMsgEdit; b.parent = this; Event e(EventShowBar, &b); m_bar = (CToolBar*)(e.process()); m_bar->setParam(this); if (CorePlugin::m_plugin->getContainerMode() == 0) showCloseSend(false); setDockEnabled(m_bar, Left, false); setDockEnabled(m_bar, Right, false); }
MsgViewBase::MsgViewBase(QWidget *parent, unsigned id) : TextShow(parent) { m_id = id; m_nSelection = 0; m_popupPos = QPoint(0, 0); QStyleSheet *style = new QStyleSheet(this); QStyleSheetItem *style_p = style->item("p"); // Disable top and bottom margins for P tags. This will make sure // paragraphs have no more spacing than regular lines, thus matching // RTF's defaut look for paragraphs. style_p->setMargin(QStyleSheetItem::MarginTop, 0); style_p->setMargin(QStyleSheetItem::MarginBottom, 0); setStyleSheet(style); }