예제 #1
0
void UserWnd::showListView(bool bShow, bool bAdd)
{
    if (bShow){
        if (m_list == NULL){
            m_list = new UserList(m_hSplitter);
            m_hSplitter->setResizeMode(m_list, QSplitter::Stretch);
            connect(m_list, SIGNAL(selectChanged()), this, SLOT(selectChanged()));
            if (bAdd)
                m_list->selected.push_back(m_id);
        }
        m_list->show();
        emit multiplyChanged();
        return;
    }
    if (m_list == NULL)
        return;
    delete m_list;
    m_list = NULL;
    emit multiplyChanged();
}
예제 #2
0
void UserWnd::showListView(bool bShow)
{
    if (bShow){
        if (m_list == NULL){
            m_list = new UserList(m_hSplitter);
            m_hSplitter->setResizeMode(m_list, QSplitter::Stretch);
            connect(m_list, SIGNAL(selectChanged()), this, SLOT(selectChanged()));
            if (topLevelWidget()->inherits("Container")){
                Container *c = static_cast<Container*>(topLevelWidget());
                list<UserWnd*> wnd = c->windows();
                for (list<UserWnd*>::iterator it = wnd.begin(); it != wnd.end(); ++it)
                    m_list->selected.push_back((*it)->id());
            }
        }
        m_list->show();
        emit multiplyChanged();
        return;
    }
    if (m_list == NULL)
        return;
    delete m_list;
    m_list = NULL;
    emit multiplyChanged();
}
예제 #3
0
void UserWnd::selectChanged()
{
    emit multiplyChanged();
}
예제 #4
0
MsgGen::MsgGen(CToolCustom *parent, Message *msg)
        : QObject(parent)
{
    m_client = msg->client();
    m_edit = NULL;
    for (QWidget *p = parent->parentWidget(); p; p = p->parentWidget()){
        if (p->inherits("MsgEdit")){
            m_edit = static_cast<MsgEdit*>(p);
            break;
        }
    }
    connect(m_edit->m_userWnd, SIGNAL(multiplyChanged()), this, SLOT(textChanged()));
    parent->setText(i18n(" "));
    m_edit->m_edit->setTextFormat(RichText);
    QString text = msg->getRichText();
    if (!text.isEmpty()){
        m_edit->m_edit->setText(text);
        m_edit->m_edit->moveCursor(QTextEdit::MoveEnd, false);
        if ((msg->getBackground() != msg->getForeground()) && !CorePlugin::m_plugin->getOwnColors()){
            m_edit->m_edit->setBackground(msg->getBackground());
            m_edit->m_edit->setForeground(msg->getForeground());
        }
    }
    Command cmd;
    cmd->id    = CmdSend;
    cmd->param = m_edit;
    Event e(EventCommandWidget, cmd);
    btnSend = (QToolButton*)(e.process());

    QToolButton *btn = new ColorToolButton(parent, QColor(CorePlugin::m_plugin->getEditBackground()));
    set_button(btn, "bgcolor", I18N_NOOP("Bac&kground color"));
    connect(btn, SIGNAL(colorChanged(QColor)), this, SLOT(bgColorChanged(QColor)));
    parent->addWidget(btn);
    btn->show();

    btn = new ColorToolButton(parent, QColor(CorePlugin::m_plugin->getEditForeground()));
    set_button(btn, "fgcolor", I18N_NOOP("&Text color"));
    connect(btn, SIGNAL(colorChanged(QColor)), this, SLOT(fgColorChanged(QColor)));
    parent->addWidget(btn);
    btn->show();

    btnBold = new QToolButton(parent);
    set_button(btnBold, "text_bold", I18N_NOOP("&Bold"));
    btnBold->setToggleButton(true);
    connect(btnBold, SIGNAL(toggled(bool)), this, SLOT(toggleBold(bool)));
    parent->addWidget(btnBold);
    btnBold->show();

    btnItalic = new QToolButton(parent);
    set_button(btnItalic, "text_italic", I18N_NOOP("&Italic"));
    btnItalic->setToggleButton(true);
    connect(btnItalic, SIGNAL(toggled(bool)), this, SLOT(toggleItalic(bool)));
    parent->addWidget(btnItalic);
    btnItalic->show();

    btnUnderline = new QToolButton(parent);
    set_button(btnUnderline, "text_under", I18N_NOOP("&Underline"));
    btnUnderline->setToggleButton(true);
    connect(btnUnderline, SIGNAL(toggled(bool)), this, SLOT(toggleUnderline(bool)));
    parent->addWidget(btnUnderline);
    btnUnderline->show();

    btn = new QToolButton(parent);
    set_button(btn, "text", I18N_NOOP("Text &font"));
    connect(btn, SIGNAL(clicked()), this, SLOT(selectFont()));
    parent->addWidget(btn);
    btn->show();

    connect(m_edit->m_edit, SIGNAL(currentFontChanged(const QFont&)), this, SLOT(fontChanged(const QFont&)));
    connect(m_edit->m_edit, SIGNAL(textChanged()), this, SLOT(textChanged()));
    fontChanged(m_edit->m_edit->font());
    textChanged();
}