Ejemplo n.º 1
0
void FiPage::deleteSymbol()
{
  if(!mSymbols) return;
  if(!mSymbolId) return;
  if(mSymbols->size() < 2)
  {
    emitMessage(FUNC, tr("I will not delete the one and only symbol"), eWarning);
    return;
  }

  int ret = QMessageBox::warning(this, tr("FI Page")
            , tr("\nDelete Symbol '%1 %2 %3'?\t")
                .arg(mSymbols->caption())
                .arg(mSymbols->market())
                .arg(mSymbols->owner())
            , QMessageBox::Yes | QMessageBox::Cancel
            , QMessageBox::Cancel);

  if(ret != QMessageBox::Yes) return;

  mFilu->deleteRecord("symbol", mSymbols->id());
  // FIXME Add check if success/error after delete

  QString msg = tr("Symbol deleted: Id=%1 Caption=%2 Market=%3 Owner=%4")
                  .arg(mSymbols->id())
                  .arg(mSymbols->caption())
                  .arg(mSymbols->market())
                  .arg(mSymbols->owner());

  emitMessage(FUNC, msg);
  record(FUNC, msg);

  setSymbolTable();
}
Ejemplo n.º 2
0
void FiPage::saveSymbol()
{
  if(!mSymbols) return;

  if(mSymbolId)
  {
    if(mSymbols->caption() == mSymbol->text()          and
       mSymbols->market()  == mMarket->currentText()   and
       mSymbols->owner()   == mProvider->currentText()     )
    {
      emitMessage(FUNC, tr("No changes to save"));
      return;
    }
  }

  int ret = mFilu->addSymbol(mSymbol->text(), mMarket->currentText(), mProvider->currentText()
                             , mFi->id(), mSymbolId);

  if(sadFilu(FUNC, tr("Fail to save symbol"), eWarning)) return;

  mFilu->updateField("quality", Filu::ePlatinum, "symbol", ret);

  QString msg;
  if(mSymbolId)
  {
    msg = tr("Symbol updated: Id=%1\n"
                "\tFrom: Caption=%2 Market=%3 Owner=%4\n"
                "\tTo:   Caption=%5 Market=%6 Owner=%7")
                .arg(mSymbolId)
                .arg(mSymbols->caption())
                .arg(mSymbols->market())
                .arg(mSymbols->owner())
                .arg(mSymbol->text())
                .arg(mMarket->currentText())
                .arg(mProvider->currentText());
  }
  else
  {
    mSymbolId = ret;
    msg = tr("Symbol added: Id=%1 Caption=%2 Market=%3 Owner=%4 FI=%5")
            .arg(mSymbolId)
            .arg(mSymbol->text())
            .arg(mMarket->currentText())
            .arg(mProvider->currentText())
            .arg(mFi->name());
  }

  emitMessage(FUNC, msg);
  record(FUNC, msg);

  setSymbolTable(mSymbolId);
}
Ejemplo n.º 3
0
void BluetoothListener::slotProcessFinished(int ex, QProcess::ExitStatus state)
{
    switch (state) {
    case QProcess::NormalExit:
        emitMessage(tr("%1: Process %2 terminated with exit code %3.")
                    .arg(d->device).arg(d->pid).arg(ex));
        break;
    case QProcess::CrashExit:
        emitMessage(tr("%1: Process %2 crashed.").arg(d->device).arg(d->pid));
        break;
    }
    emit terminated();
}
Ejemplo n.º 4
0
void FiPage::deleteSplit()
{
  if(mSplitId < 1) return;

  int ret = QMessageBox::warning(this, tr("FI Page")
            , tr("\nDelete Split '%1 (%2)'?\t").arg(mSplitDate->text(), mSplitComment->text())
            , QMessageBox::Yes | QMessageBox::Cancel
            , QMessageBox::Cancel);

  if(ret != QMessageBox::Yes) return;

  mFilu->deleteRecord("split", mSplitId);
  // FIXME Add check if success/error after delete

  QString msg = QString("Split %5: Id=%1 Date=%2 Comment=%3 FI=%4")
                       .arg(mSplitId)
                       .arg(mSplitDate->text())
                       .arg(mSplitComment->text())
                       .arg(mFi->name())
                       .arg(tr("deleted"));

  emitMessage(FUNC, msg);
  record(FUNC, msg);

  setSplitTable();
  loadBars();
}
Ejemplo n.º 5
0
void FiPage::deleteFi()
{
   if(!mFi) return;

   int ret = QMessageBox::warning(this, tr("FI Page")
              , tr("\nDelete FI '%1 (%2)'?\t").arg(mFi->name()).arg(mFi->type())
              , QMessageBox::Yes | QMessageBox::Cancel
              , QMessageBox::Cancel);

  if(ret != QMessageBox::Yes) return;

  mFilu->deleteRecord("fi", mFi->id());
  // FIXME Add check if success/error after delete

  QString msg = tr("FI deleted: Id=%1 Name=%2 Type=%3")
                      .arg(mFi->id())
                      .arg(mFi->name())
                      .arg(mFi->type());

  emitMessage(FUNC, msg);
  record(FUNC, msg);

  mFiName->setText("");
  mFiType->setCurrentIndex(-1);
  mExpiryDate->setText("");

  delete mFi;
  mFi = 0;
  setSymbolTable();
  mLookUp->setFocus();
  mLookUp->search();
}
Ejemplo n.º 6
0
void QgsMapToolDeleteRing::canvasPressEvent( QMouseEvent *e )
{
  delete mCross;
  mCross = 0;

  mRecentSnappingResults.clear();
  //do snap -> new recent snapping results
  if ( mSnapper.snapToCurrentLayer( e->pos(), mRecentSnappingResults, QgsSnapper::SnapToVertexAndSegment ) != 0 )
  {
    //error
  }

  if ( mRecentSnappingResults.size() > 0 )
  {
    // remove previous warning
    emit discardMessage();

    QgsPoint markerPoint = mRecentSnappingResults.begin()->snappedVertex;

    //show vertex marker
    mCross = new QgsVertexMarker( mCanvas );
    mCross->setIconType( QgsVertexMarker::ICON_X );
    mCross->setCenter( markerPoint );
  }
  else
  {
    emit emitMessage( tr( "could not snap to a ring on the current layer." ) );
  }
}
void CentralServerConnection::onConnectionOpened()
{
	ServerConnection::onConnectionOpened();

	static MessageConnectionCallback m("CentralConnectionOpened");
	emitMessage(m);
}
Ejemplo n.º 8
0
bool AbstractBluetoothStarter::initializeStartupResources(QString *errorMessage)
{
    // Create the listener and forward messages to it.
    BluetoothListener *listener = createListener();
    connect(this, SIGNAL(message(QString)), listener, SLOT(emitMessage(QString)));
    return listener->start(device(), errorMessage);
}
void GameServerConnection::onConnectionClosed()
{
	ServerConnection::onConnectionClosed();

	static MessageConnectionCallback const m("GameConnectionClosed");
	emitMessage(m);
}
Ejemplo n.º 10
0
/*!
  Writes \a message and \a detals to stderr as a formatted
  error message and then exits the program. qdoc prints fatal
  errors in either phase (Prepare or Generate).
 */
void Location::fatal(const QString& message, const QString& details) const
{
    emitMessage(Error, message, details);
    information(message);
    information(details);
    information("Aborting");
    exit(EXIT_FAILURE);
}
Ejemplo n.º 11
0
//messages sent for each time segment.
void snowman::sendMessage(){
    QString str;
    if (count<4){
    if (count==1){str="Who turned up the heat?";}
    if (count==2){str="I'm meellllttttiiinnnggg...";}
    if (count==3){str="FAIL";}
    if (count==4){str="I'm done!";}
    emitMessage(str);}
}
void TransferServerConnection::onConnectionOpened()
{
	LOG("TransferServerConnection", ("Connection with the transfer server is open, sending CentralGalaxyName message(%s)", ConfigCentralServer::getClusterName()));
	static MessageConnectionCallback m("TransferServerConnectionOpened");
	emitMessage(m);

	// send galaxy name to the character transfer server
	GenericValueTypeMessage<std::string> cgn("CentralGalaxyName", ConfigCentralServer::getClusterName());
	send(cgn, true);
}
void GameServerConnection::onConnectionOpened()
{
	ServerConnection::onConnectionOpened();

	FATAL((CentralServer::getInstance().getClusterId() == 0),("Got GameServerConnection::onConnectionOpened() before receiving cluster Id from LoginServer"));

	GenericValueTypeMessage<uint32> const msg("ClusterId", static_cast<uint32>(CentralServer::getInstance().getClusterId()));
	send(msg, true);

	static MessageConnectionCallback const m("GameConnectionOpened");
	emitMessage(m);
}
Ejemplo n.º 14
0
void FiPage::saveSplit()
{
  QString msg = "Split %5: Id=%1 Date=%2 Comment=%3 FI=%4";

  if(mSplitId > 0)
  {
    // FIXME Right now we have no fitting addSplit() function
    mFilu->updateField("sdate", mSplitDate->text(), "split", mSplitId);
    mFilu->updateField("sratio", mRatio->text(), "split", mSplitId);
    mFilu->updateField("scomment", mSplitComment->text(), "split", mSplitId);
    mFilu->updateField("quality", Filu::ePlatinum, "split", mSplitId);

    msg = msg.arg(mSplitId)
             .arg(mSplitDate->text())
             .arg(mSplitComment->text())
             .arg(mFi->name())
             .arg(tr("updated"));
  }
  else
  {
    mSplitId = mFilu->addSplit(mSymbol->text()
                             , mSplitDate->text()
                             , mRatio->text().toDouble()
                             , mSplitComment->text()
                             , Filu::ePlatinum);

    msg = msg.arg(mSplitId)
             .arg(mSplitDate->text())
             .arg(mSplitComment->text())
             .arg(mFi->name())
             .arg(tr("added"));
  }

  emitMessage(FUNC, msg);
  record(FUNC, msg);

  int id = mSplitId; // setSplitTable() will change mSplitId
  setSplitTable();
  mSplitView->selectRowWithValue(id, 3);
  loadBars();
}
void TaskManagerConnection::onConnectionOpened()
{
	ServerConnection::onConnectionOpened();
	static MessageConnectionCallback m("TaskConnectionOpened");
	emitMessage(m);

	// get cluster name
	std::string clusterName;
	ConfigFile::Section const * const sec = ConfigFile::getSection("TaskManager");
	if (sec)
	{
		ConfigFile::Key const * const ky = sec->findKey("clusterName");
		if (ky)
		{
			clusterName = ky->getAsString(ky->getCount()-1, "");
		}
	}

	TaskConnectionIdMessage id(TaskConnectionIdMessage::Game, "", clusterName);
	send(id, true);
}
Ejemplo n.º 16
0
void FiPage::saveFi()
{
  if(!mFi) return;

  // FIXME Right now we have no fitting addFi() function
  mFilu->addFi(mFiName->text(), mFiType->currentText(), mFi->id());
  mFilu->updateField("expirydate", mExpiryDate->text(), "fi", mFi->id());
  mFilu->updateField("quality", Filu::ePlatinum, "fi", mFi->id());

  QString msg = tr("FI updated: Id=%1\n"
                   "\tFrom: Name=%2 Type=%3 ExpiryDate=%4\n"
                   "\tTo:   Name=%5 Type=%6 ExpiryDate=%7")
                .arg(mFi->id())
                .arg(mFi->name(), mFi->type(), mFi->expiryDate().toString(Qt::ISODate))
                .arg(mFiName->text(), mFiType->currentText(), mExpiryDate->text());

  emitMessage(FUNC, msg);
  record(FUNC, msg);

  fiClicked(mFi->id());
  mLookUp->search();
}
Ejemplo n.º 17
0
CChatWindow::CChatWindow(QWidget *parent) : QDialog(parent)
{
	setModal(false);
	QVBoxLayout *layout = new QVBoxLayout(this);
	
	setWindowTitle(tr("Chat ;)"));
	
	m_messageArea = new TextWindow;
	layout->addWidget(m_messageArea);
	
	QHBoxLayout *lineLayout = new QHBoxLayout;
	m_prompt = new QLineEdit;
	lineLayout->addWidget(m_prompt);
	
	QPushButton *send = new QPushButton(tr("Send"));
	
	connect(send, SIGNAL(clicked()), this, SLOT(emitMessage()));
	lineLayout->addWidget(send);
	
	layout->addLayout(lineLayout);
	
	setWindowFlags(Qt::WindowStaysOnTopHint);
}
Ejemplo n.º 18
0
/*!
  Writes \a message and \a detals to stderr as a formatted
  error message. Does not write the message if qdoc is in
  the Prepare phase.
 */
void Location::error(const QString& message, const QString& details) const
{
    if (!Generator::preparing() || Generator::singleExec())
        emitMessage(Error, message, details);
}
Ejemplo n.º 19
0
/*!
  Writes \a message and \a detals to stderr as a formatted
  error message.
 */
void Location::error(const QString& message, const QString& details) const
{
    emitMessage(Error, message, details);
}
Ejemplo n.º 20
0
/*!
  Writes \a message and \a detals to stderr as a formatted
  warning message.
 */
void Location::warning(const QString& message, const QString& details) const
{
    emitMessage(Warning, message, details);
}
Ejemplo n.º 21
0
/**
 * @brief Loads the currently selected Element data to the GPU
 *
 * Loads the currently selected Element data to the GPU, getting rid of any element
 * data that is already there.
 *
 */
void CreationSelectionLayer::LoadDataToGPU()
{
	/* Make sure we've got all of the necessary Buffer Objects created */
	if (!glLoaded)
		InitializeGL();

	/* Make sure initialization succeeded */
	if (glLoaded && selectedState)
	{
		/* Load the connectivity data (elements) to the GPU, getting rid of any data that's already there */
		std::vector<Element*> *currSelection = selectedState->GetState();
		const size_t IndexBufferSize = 3*sizeof(GLuint)*currSelection->size() + sizeof(GLuint)*boundaryNodes.size();
		if (IndexBufferSize && VAOId && IBOId)
		{
			glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, IBOId);
			glBufferData(GL_ELEMENT_ARRAY_BUFFER, IndexBufferSize, NULL, GL_STATIC_DRAW);
			GLuint* glElementData = (GLuint*)glMapBuffer(GL_ELEMENT_ARRAY_BUFFER, GL_WRITE_ONLY);
			if (glElementData)
			{
				Element* currElement;
				unsigned int i=0;
				unsigned int currSelectionSize = currSelection->size();
				for (std::vector<Element*>::iterator it=currSelection->begin(); it != currSelection->end(); ++it, i++)
				{
					currElement = *it;
					glElementData[3*i+0] = (GLuint)currElement->n1->nodeNumber-1;
					glElementData[3*i+1] = (GLuint)currElement->n2->nodeNumber-1;
					glElementData[3*i+2] = (GLuint)currElement->n3->nodeNumber-1;
				}
				for (i=0; i<boundaryNodes.size(); i++)
				{
					glElementData[3*currSelectionSize+i] = boundaryNodes[i]-1;
				}
			} else {
				glLoaded = false;
				DEBUG("ERROR: Mapping index buffer for Subdomain Creation Selection Layer " << GetID());
				emit emitMessage("<p style:color='red'><strong>Error: Unable to load index data to GPU (Subdomain Creation Selection Layer)</strong>");
				return;
			}

			if (glUnmapBuffer(GL_ELEMENT_ARRAY_BUFFER) == GL_FALSE)
			{
				glLoaded = false;
				DEBUG("ERROR: Unmapping index buffer for Subdomain Creation Selection Layer " << GetID());
				return;
			}
		}

		GLenum errorCheck = glGetError();
		if (errorCheck == GL_NO_ERROR)
		{
			if (VAOId && VBOId && IBOId)
			{
				glLoaded = true;
			} else {
				DEBUG("Subdomain Creation Selection Layer Data Not Loaded");
			}
		} else {
			const GLubyte *errString = gluErrorString(errorCheck);
			DEBUG("CreationSelectionLayer OpenGL Error: " << errString);
			glLoaded = false;
		}

		emit Refreshed();
		emit NumElementsSelected(currSelection->size());
	}
}
Ejemplo n.º 22
0
void Trick::MemoryManager::emitWarning( std::string message) {
    std::stringstream ss;
    ss << "WARNING:" << message << std::endl;
    emitMessage( ss.str() );
}
Ejemplo n.º 23
0
void Trick::MemoryManager::emitError( std::string message) {
    std::stringstream ss;
    ss << "ERROR:" << message << std::endl;
    emitMessage( ss.str() );
}
Ejemplo n.º 24
0
/*!
  Writes \a message and \a detals to stderr as a formatted
  report message.
 */
void Location::report(const QString& message, const QString& details) const
{
    emitMessage(Report, message, details);
}
Ejemplo n.º 25
0
//snowman emits a string which contains a message
void snowman::sendMessage(const QString &str){
    emitMessage(str);
}
Ejemplo n.º 26
0
void* clientHandler(void* arg)
{
    int clt_sock = *(int*)arg;
    char buf[MAX_MESSAGE]; bzero(buf, sizeof(buf));
    long bytes_read;
    char client_name[MAX_MESSAGE]; bzero(client_name, sizeof(buf));
    
    /* Insert new client into clients array */
    int idx = findEmptySlot(clients);
    pthread_mutex_lock(&array_lock);
    clients[idx] = clt_sock;
    pthread_mutex_unlock(&array_lock);
    
    /* Read client name */
    bytes_read = read(clt_sock, buf, sizeof(buf));
    char greeting[] = " connected to the server";
    strcpy(client_name, buf);
    strcat(buf, greeting);
    printf("%s\n", buf);
    
    /* Inform all clients of the connected user */
    int i;
    pthread_mutex_lock(&array_lock);
    for(i = 0; i < MAX_CLIENTS; i++)
    {
        if(clients[i] == -1) continue;
    
        write(clients[i], buf, strlen(buf));
    }
    pthread_mutex_unlock(&array_lock);
    
    bzero(buf, sizeof(buf));
    
    /* Read messages from the client and emit to all other connect clients */
    while( (bytes_read = read(clt_sock, buf, sizeof(buf))) != 0)
    {
        if(strcmp(buf,"/exit")==0 || strcmp(buf,"/quit")==0 || strcmp(buf,"/part")==0)
        {
            break;
        }
        
        printf("%s: %s\n", client_name, buf);
        
        char message[MAX_MESSAGE]; bzero(message, sizeof(message));
        strcpy(message, client_name);
        strcat(message, ": ");
        strcat(message, buf);
        
        emitMessage(message, strlen(message), clt_sock, clients);
        bzero(buf, sizeof(buf));
    }
    
    /* Update client state variables and close socket */
    pthread_mutex_lock(&array_lock);
    clients[idx] = -1;
    pthread_mutex_unlock(&array_lock);
    
    pthread_mutex_lock(&count_lock);
    client_count--;
    pthread_mutex_unlock(&count_lock);
    
    close(clt_sock);
    
    /* Inform users that a user is exiting */
    char exit_message[MAX_MESSAGE]; bzero(exit_message, sizeof(exit_message));
    strcpy(exit_message, client_name);
    strcat(exit_message, " disconnected from the server");
    printf("%s\n", exit_message);
    
    if(bytes_read > 0)
    {
        emitMessage(exit_message, strlen(exit_message), clt_sock, clients);
    }
    
    return NULL;
}
Ejemplo n.º 27
0
void BluetoothListener::slotStdError()
{
    emitMessage(QString::fromLocal8Bit(d->process.readAllStandardError()));
}
Ejemplo n.º 28
0
/*!
  Writes \a message and \a detals to stderr as a formatted
  warning message. Does not write the message if qdoc is in
  the Prepare phase.
 */
void Location::warning(const QString& message, const QString& details) const
{
    if (!Generator::runPrepareOnly())
        emitMessage(Warning, message, details);
}
Ejemplo n.º 29
0
void BluetoothListener::slotProcessError(QProcess::ProcessError error)
{
    emitMessage(tr("%1: Process error %2: %3")
        .arg(d->device).arg(error).arg(d->process.errorString()));
}
Ejemplo n.º 30
0
/*!
  Writes \a message and \a detals to stderr as a formatted
  error message. Does not write the message if qdoc is in
  the Prepare phase.
 */
void Location::error(const QString& message, const QString& details) const
{
    if (!Generator::runPrepareOnly())
        emitMessage(Error, message, details);
}