Example #1
0
// properties.at(0): Login
// properties.at(1): Id
// properties.at(2): Ip
// properties.at(3): Promo
// properties.at(4): State
// properties.at(5): Location
// properties.at(6): Comment
void    QNetsoul::showConversation(const QStringList& properties,
                                   const QString& message)
{
  bool ok;
  const int id = properties.at(1).toInt(&ok);
  if (ok == false)
    qFatal("[QNetsoul::showConversation] Invalid id (%d)", id);

  Chat* window = getChat(id);
  const bool userEvent = message.isEmpty();

  if (NULL == window)
    {
      // DEBUG focus
      //qDebug() << "CASE 1";
      window = createWindowChat(id, properties.at(0), properties.at(5));
      window->show();
    }
  if (false == window->isVisible())
    {
      // DEBUG focus
      //qDebug() << "CASE 2";
      //window->outputTextBrowser->clear();
      //window->inputTextEdit->clear();
      if (userEvent)
        {
          window->show();
          window->activateWindow();
          QApplication::setActiveWindow(window);
          window->inputTextEdit->setFocus();
        }
      else window->showMinimized();
    }
  else
    {
      // DEBUG focus
      //qDebug() << "CASE 3";
      if (userEvent)
        {
          window->showNormal();
          window->activateWindow();
          QApplication::setActiveWindow(window);
          window->inputTextEdit->setFocus();
        }
    }
  if (message.isEmpty() == false)
    {
      if (window)
        {
          window->insertMessage(properties.at(0), message, QColor(204, 0, 0));
          window->autoReply(statusComboBox->currentIndex());
          QApplication::alert(window);
        }
      if (this->_trayIcon && this->_options->chatWidget->notifyMsg())
        this->_trayIcon->showMessage(properties.at(0), tr(" is talking to you."));
    }
}
Example #2
0
int main(int argc, char *argv[])
{
	QApplication a(argc, argv);
	Chat w;
	w.show();
	return a.exec();
}
Example #3
0
void MainWindow::ricevi() //Ricevo una risposta dal server in merito all'esistenza o meno dell'utente.
{
   Chat* w;

   qint64 bytes = buffermain->write(sockmain->readAll()); //Per leggere i messaggi dal server.
       buffermain->seek(buffermain->pos() - bytes);
       while (buffermain->canReadLine())
               {
                       QString line = buffermain->readLine();
                       if(line.startsWith("#"))
                       {
                           if(line.compare("#true\n")==0)
                           {
                               w = new Chat();
                               w->nomeUtente(this->ui->lineEdit->text());
                               w->chatRoom(this->ui->txtChatRoom->text());
                               w->show();
                               this->close();
                               sockmain->disconnectFromHost();
                           }
                           else
                           {
                              this->ui->lineEdit->setText("Non esisti");
                           }
                       }
               }
}
Example #4
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    Chat d;
    QObject::connect(&d, SIGNAL(accepted()), &app, SLOT(quit()));

    d.show();

    app.exec();

    return 0;
}
Example #5
0
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

    Chat d;
    QObject::connect(&d, SIGNAL(accepted()), &app, SLOT(quit()));

#if defined(Q_WS_MAEMO_6)
    d.showFullScreen();
#else
    d.show();
#endif

    app.exec();

    return 0;
}