Ejemplo n.º 1
0
// Send chat message
void AbstractChat::issueChat()
{
   if(mLineEditor.length() > 0)
   {
      // Send message
      MasterServerConnection *conn = mGame->getConnectionToMaster();
      if(conn)
         conn->c2mSendChat(mLineEditor.c_str());

      // And display it locally
      newMessage(mGame->getClientInfo()->getName().getString(), mLineEditor.getString(), false, false, true);
   }
   clearChat();     // Clear message

   UserInterface::playBoop();
}
Ejemplo n.º 2
0
SeparateChatWindow::SeparateChatWindow(const QString &protocol_name,
                                       const QString &account_name, const QString &item_name,
                                       QWidget *parent)
    : QWidget(parent)
    , m_abstract_chat_layer(AbstractChatLayer::instance())
    , m_protocol_name(protocol_name)
    , m_account_name(account_name)
    , m_item_name(item_name)
    , m_plugin_system(PluginSystem::instance())
    , m_last_message_sender(true)
    , m_lock_for_first_message(false)
    , m_text_changed(false)
    , m_last_message_icon_position(0)
    , m_last_message_position(0)
{
  ui.setupUi(this);
  m_edit = ui.chatInputEdit;
  m_log = ui.chatLog;
  m_log->setOpenExternalLinks(true);
  m_edit->installEventFilter(this);

  QSoftMenuBar::setLabel(this, Qt::Key_Back, QSoftMenuBar::NoLabel);
  QSoftMenuBar::setLabel(m_log, Qt::Key_Back, QSoftMenuBar::NoLabel);
  QSoftMenuBar::setLabel(m_edit, Qt::Key_Back, QString::null, tr("Send"));
  QMenu *menu = QSoftMenuBar::menuFor(this);
  menu->clear();
  menu->addAction(tr("Clear Chat"), this, SLOT(clearChat()));
  menu->addSeparator();
  menu->addAction(tr("Close Chat"), this, SLOT(deleteLater()));

  m_contact_name = m_item_name;
  m_own_name = m_account_name;

  updateInfo();

  setWindowTitle(QString("%1").arg(m_contact_name));
  m_edit->setFocus();

  connect(this, SIGNAL(customContextMenuRequested(const QPoint &)),
          SLOT(onCustomContextMenuRequested(const QPoint &)));
  //setIconsToButtons();

  m_scroll_at_max = true;
  m_current_scroll_position = 0;
  m_last_history = true;
}