IRCChannelWidget::IRCChannelWidget(QWidget *parent, IRCClient* client) :
    QWidget(parent), _kickAction(this), _sendFileAction(this), _whoIsAction(this), _userOptions(this), _defaultChannel(0), _privMsg(this)
{
    _subject = 0;
    _client = client;
    _msgScreen = new QPlainTextEdit(this);
    // we use the text-edit to display text
    _msgScreen->setReadOnly(true);
    _lineEdit = new QLineEdit(this);
    _submitText = new QPushButton(this);
    _submitText->setText("submit");
    _submitText->setMinimumWidth(180);
    _users = new QListWidget(this);
    _users->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Expanding);

    // on entering or pressing submit we let the GUI know that we want to send text
    connect(_lineEdit, SIGNAL(returnPressed()),this, SLOT(textEntered()));
    connect(_submitText, SIGNAL(clicked()), this, SLOT(textEntered()));
    connect(this, SIGNAL(notified()), this, SLOT(updateGui()));

    // create our grid layout
    constructMainLayout();

    stealFocus();

    // create rightclickmenu and actions connected to functions handeling the actions
    _users->setContextMenuPolicy(Qt::CustomContextMenu);
    _whoIsAction.setText("Who Is");
    _sendFileAction.setText("Send File");
    _kickAction.setText("Kick");
    _privMsg.setText("Privmsg");
    _userOptions.addAction(&_whoIsAction);
    _userOptions.addAction(&_sendFileAction);
    _userOptions.addAction(&_kickAction);
    _userOptions.addAction(&_privMsg);


    connect(_users, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(showUserOptionsMenu(const QPoint &)));
    connect(&_whoIsAction, SIGNAL(triggered()), this, SLOT(sendWhoIs()));
    connect(&_sendFileAction, SIGNAL(triggered()), this, SLOT(sendFile()));
    connect(&_kickAction, SIGNAL(triggered()), this, SLOT(kickUser()));
    connect(&_privMsg, SIGNAL(triggered()), this, SLOT(setMsg()));
}
Beispiel #2
0
void OsuUserStatsScreen::update()
{
	OsuScreenBackable::update();
	if (!m_bVisible) return;

	m_container->update();

	if (m_contextMenu->isMouseInside())
		m_scores->stealFocus();

	if (m_osu->getOptionsMenu()->isMouseInside())
	{
		stealFocus();
		m_contextMenu->stealFocus();
		m_container->stealFocus();
	}

	updateLayout();
}
void IRCChannelWidget::setMsg()
{
    _lineEdit->setText("/msg " + _users->selectedItems().front()->text() + " ");
    stealFocus();
}