当前位置: 首页>>代码示例>>C++>>正文


C++ sendMsg函数代码示例

本文整理汇总了C++中sendMsg函数的典型用法代码示例。如果您正苦于以下问题:C++ sendMsg函数的具体用法?C++ sendMsg怎么用?C++ sendMsg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了sendMsg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: setupUi

dlgIRC::dlgIRC()
{
    setupUi(this);
    session = new IrcSession(this);
    irc->setOpenExternalLinks ( true );
    setUnifiedTitleAndToolBarOnMac( true );
    connect( irc, SIGNAL(anchorClicked(QUrl)), this, SLOT(anchorClicked(QUrl)));
    connect( session, SIGNAL(messageReceived(IrcMessage*)), this, SLOT(onMessageReceived(IrcMessage*)));
    connect( session, SIGNAL(connected()), this, SLOT(onConnected()));
    connect( lineEdit, SIGNAL(returnPressed()), this, SLOT(sendMsg()));

    QFile file( QDir::homePath()+"/.config/mudlet/irc_nick" );
    file.open( QIODevice::ReadOnly );
    QDataStream ifs( & file );
    QString nick;
    ifs >> nick;
    file.close();

    if( nick.isEmpty() )
    {
        nick = tr("Mudlet%1").arg(QString::number(rand()%10000));
        QFile file( QDir::homePath()+"/.config/mudlet/irc_nick" );
        file.open( QIODevice::WriteOnly | QIODevice::Unbuffered );
        QDataStream ofs( & file );
        ofs << nick;
        file.close();
    }

    session->setNickName(nick);
    mNick = nick;
    session->setUserName("mudlet");
    session->setRealName(mudlet::self()->version);
    session->setHost("irc.freenode.net");
    session->setPort(6667);
    session->open();
}
开发者ID:EldFitheach,项目名称:Mudlet,代码行数:36,代码来源:dlgIRC.cpp

示例2: LOGFMTE

bool IServerApp::sendMsg(  uint32_t nSessionID , const char* pBuffer , uint16_t nLen, bool bBroadcast )
{
	if ( isConnected() == false )
	{
		LOGFMTE("target svr is not connect , send msg failed") ;
		return false ;
	}
	stMsgTransferData msgTransData ;
	msgTransData.nSenderPort = getLocalSvrMsgPortType() ;
	msgTransData.bBroadCast = bBroadcast ;
	msgTransData.nSessionID = nSessionID ;
	int nLne = sizeof(msgTransData) ;
	if ( nLne + nLen >= MAX_MSG_BUFFER_LEN )
	{
		stMsg* pmsg = (stMsg*)pBuffer ;
		LOGFMTE("msg send to session id = %d , is too big , cannot send , msg id = %d ",nSessionID,pmsg->usMsgType) ;
		return false;
	}
	memcpy_s(m_pSendBuffer ,sizeof(m_pSendBuffer),&msgTransData,nLne);
	memcpy_s(m_pSendBuffer + nLne ,sizeof(m_pSendBuffer) - nLne, pBuffer,nLen );
	nLne += nLen ;
	sendMsg(m_pSendBuffer,nLne);
	return true ;
}
开发者ID:BillXu,项目名称:NewProject,代码行数:24,代码来源:ISeverApp.cpp

示例3: sendMsg

 void TcpThread::opeatorData()
 {
      OperatorSql w;
      char ch = data[2].at(0).toAscii(); //将QChar 转换为标准C语言的ASCII,上网找了,switch在QT中只能支持整型对象
                      //操作数据库

      if (!w.createConnection()) {


         sendMsg(tr("SQL_LINK_ERROR"));

         return;
      }


/*
      if(!w.verifyUser(data[0],data[1]))//用户名密码错误
     {


         sendMsg(tr("USER_PASSWORD_ERROR"));
         tcpSocket->disconnectFromHost();//断开连接
      QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8"));
         qDebug()<< tr("用户或者密码不正确!")<<"\n";

         return;
     }

*/

       QString sqlstr = data[3];//取出SQL语句
         switch(ch)
         {

             case 'Q':  {

            w.queryRecode(sqlstr);

             saveLog();
             break;//保存日志
         }
         case 'A':  {
            if(w.addRecode(sqlstr))
            {
            sendMsg(tr("ADD_SUCCESS"));
            saveLog();
             break;
            }
            else
             {
                 sendMsg(tr("ADD_FAILED"));
                 break;
             }
             }
         case 'D': {

            if(w.deleteRecode(sqlstr))
            {
             sendMsg(tr("DELETE_SUCCESS")) ;
             saveLog();
             break;
         }
            else
             {
                 sendMsg(tr("DELETE_FAILED"));
                 break;
             }
              }
         case 'U':   {
            if( w.updateRecode(sqlstr)) {
              sendMsg(tr("UPDATE_SUCCESS"));
             saveLog();
             break;
         }
         else
                 {
                     sendMsg(tr("UPDATE_FAILED"));
                     break;
                 }
            }
             default:  sendMsg(tr("UNKOWN_ERROR")); break;


        }

}
开发者ID:sunjunior,项目名称:Application-with-QT-SDK,代码行数:86,代码来源:tcpthread.cpp

示例4: move

bool
Monitor::coach_move( const char * command )
{
    char obj[128];
    double x = 0.0, y = 0.0, ang = 0.0, velx = 0.0, vely = 0.0;

    int n = std::sscanf( command,
                         " ( move ( %127[^)] ) %lf %lf %lf %lf %lf ) ",
                         obj, &x, &y, &ang, &velx, &vely );

    if ( n < 3
         || std::isnan( x ) != 0
         || std::isnan( y ) != 0
         || std::isnan( ang ) != 0
         || std::isnan( velx ) != 0
         || std::isnan( vely ) != 0 )
    {
        sendMsg( MSG_BOARD, "(error illegal_object_form)" );
        return false;
    }

    std::string obj_name = "(";
    obj_name += obj;
    obj_name += ')';

    if ( obj_name == BALL_NAME )
    {
        M_stadium.clearBallCatcher();

        if ( n == 3 || n == 4 )
        {
            M_stadium.moveBall( PVector( x, y ), PVector( 0.0, 0.0 ) );
        }
        else if ( n == 6 )
        {
            M_stadium.moveBall( PVector( x, y ), PVector( velx, vely ) );
        }
        else
        {
            sendMsg( MSG_BOARD, "(error illegal_command_form)" );
            return false;
        }
    }
    else
    {
        char teamname[128];
        int unum = 0;

        if ( std::sscanf( obj_name.c_str(),
                          PLAYER_NAME_FORMAT,
                          teamname, &unum ) != 2
             || unum < 1
             || MAX_PLAYER < unum )
        {
            sendMsg( MSG_BOARD, "(error illegal_object_form)" );
            return false;
        }

        Side side = ( M_stadium.teamLeft().name() == teamname
                      ? LEFT
                      : M_stadium.teamRight().name() == teamname
                      ? RIGHT
                      : NEUTRAL );

        PVector pos( x, y );
        PVector vel( velx, vely );
        ang = Deg2Rad( rcss::bound( ServerParam::instance().minMoment(),
                                    ang,
                                    ServerParam::instance().maxMoment() ) );
        if ( n == 3 )
        {
            M_stadium.movePlayer( side, unum, pos, NULL, NULL );
        }
        else if ( n == 4 )
        {
            M_stadium.movePlayer( side, unum, pos, &ang, NULL );
        }
        else if ( n == 6 )
        {
            M_stadium.movePlayer( side, unum, pos, &ang, &vel );
        }
        else
        {
            sendMsg( MSG_BOARD, "(error illegal_command_form)" );
            return false;
        }
    }

    sendMsg( MSG_BOARD, "(ok move)" );
    return true;
}
开发者ID:edymanoloiu,项目名称:FotbalRobotic,代码行数:91,代码来源:monitor.cpp

示例5: sendMsg

void elFlowPort::sendCmd( const std::string& cmd )
{
    sendMsg( cmd.c_str(), cmd.size(), false );
}
开发者ID:bchjoerni,项目名称:mlab,代码行数:4,代码来源:elflowport.cpp

示例6: contextMnu

void IdDialog::IdListCustomPopupMenu( QPoint )
{
	QMenu contextMnu( this );


	std::list<RsGxsId> own_identities ;
	rsIdentity->getOwnIds(own_identities) ;

	QTreeWidgetItem *item = ui->idTreeWidget->currentItem();
	if (item) {
		uint32_t item_flags = item->data(RSID_COL_KEYID,Qt::UserRole).toUInt() ;

		if(!(item_flags & RSID_FILTER_OWNED_BY_YOU))
		{
			if(own_identities.size() <= 1)
			{
				QAction *action = contextMnu.addAction(QIcon(":/images/chat_24.png"), tr("Chat with this person"), this, SLOT(chatIdentity()));

				if(own_identities.empty())
					action->setEnabled(false) ;
				else
					action->setData(QString::fromStdString((own_identities.front()).toStdString())) ;
			}
			else
			{
				QMenu *mnu = contextMnu.addMenu(QIcon(":/images/chat_24.png"),tr("Chat with this person as...")) ;

				for(std::list<RsGxsId>::const_iterator it=own_identities.begin();it!=own_identities.end();++it)
				{
					RsIdentityDetails idd ;
					rsIdentity->getIdDetails(*it,idd) ;

					QPixmap pixmap ;

					if(idd.mAvatar.mSize == 0 || !pixmap.loadFromData(idd.mAvatar.mData, idd.mAvatar.mSize, "PNG"))
						pixmap = QPixmap::fromImage(GxsIdDetails::makeDefaultIcon(*it)) ;

					QAction *action = mnu->addAction(QIcon(pixmap), QString("%1 (%2)").arg(QString::fromUtf8(idd.mNickname.c_str()), QString::fromStdString((*it).toStdString())), this, SLOT(chatIdentity()));
					action->setData(QString::fromStdString((*it).toStdString())) ;
				}
			}

			contextMnu.addAction(QIcon(":/images/mail_new.png"), tr("Send message to this person"), this, SLOT(sendMsg()));
		}
	}

	contextMnu.addSeparator();

	contextMnu.addAction(ui->editIdentity);
	contextMnu.addAction(ui->removeIdentity);
	
	contextMnu.addSeparator();

	contextMnu.exec(QCursor::pos());
}
开发者ID:rodneyrod,项目名称:RetroShare,代码行数:55,代码来源:IdDialog.cpp

示例7: sendMsg

//
// bool sendState(toID)
// Last modified: 27Aug2006
//
// Attempts to send the state of the cell
// to the neighbor with the parameterized ID,
// returning true if successful, false otherwise.
//
// Returns:     true if successful, false otherwise
// Parameters:
//      toID    in      the ID of the receiving neighbor
//
bool Cell::sendState(const GLint toID)
{
    return sendMsg(new State(*this), toID, STATE);
}   // sendState(const GLint)
开发者ID:dtbinh,项目名称:lego-rover-formation,代码行数:16,代码来源:Cell.cpp

示例8: obp_canraw


//.........这里部分代码省略.........
			break;
		    case PARAM_CANRAW_SENDID:
			protocolConfig->recvID = args->args[ARG_VALUE_1];
			createCommandResultMsg(FBID_PROTOCOL_SPEC,
					       ERR_CODE_NO_ERR, 0, NULL);
			break;
		    default:
			createCommandResultMsg(FBID_PROTOCOL_SPEC,
					       ERR_CODE_OS_UNKNOWN_COMMAND,
					       0,
					       ERR_CODE_OS_UNKNOWN_COMMAND_TEXT);
			break;
		    }
		    break;
//>>>> oobdtemple protocol MSG_OTHERS >>>>    
		case FBID_BUS_GENERIC:
		case FBID_BUS_SPEC:
		    actBus_param(args);	/* forward the received params to the underlying bus. */
		    break;
		default:
		    createCommandResultMsg(FBID_PROTOCOL_SPEC,
					   ERR_CODE_OS_UNKNOWN_COMMAND,
					   0,
					   ERR_CODE_OS_UNKNOWN_COMMAND_TEXT);
		    break;
		}
//<<<< oobdtemple protocol MSG_OTHERS <<<<
//>>>> oobdtemple protocol MSG_INIT >>>>    
	    case MSG_INIT:
		if (protocolBuffer != NULL) {
		    protocolBuffer->len = 0;
		}
//<<<< oobdtemple protocol MSG_INIT <<<<
//>>>> oobdtemple protocol MSG_PROTOCOL_STOP >>>>    
		break;
	    case MSG_PROTOCOL_STOP:
		keeprunning = 0;
		break;
//<<<< oobdtemple protocol MSG_PROTOCOL_STOP <<<<
//>>>> oobdtemple protocol MSG_SEND_BUFFER >>>>    
	    case MSG_SEND_BUFFER:
		/* let's Dance: Starting the transfer protocol */
//<<<< oobdtemple protocol MSG_SEND_BUFFER <<<<
		if (protocolBuffer->len > 0) {
		    actBufferPos = 0;
		    for (; sendMoreFrames(protocolBuffer, &actBufferPos, &protocolConfig->showBusTransfer, &stateMachine_state, &timeout, printdata_CAN, actBus_send););	// fire all in one shot.
//>>>> oobdtemple protocol MSG_SEND_BUFFER_2 >>>>    
		} else {	/* no data to send? */
		    createCommandResultMsg
			(FBID_PROTOCOL_GENERIC, ERR_CODE_NO_ERR, 0, NULL);
		    /* just release the input again */
		    if (pdPASS !=
			sendMsg(MSG_SERIAL_RELEASE, inputQueue, NULL)) {
			printser_string("Input queue is full!");
			DEBUGPRINT
			    ("FATAL ERROR: input queue is full!\n", 'a');
		    }
		}
		break;
//<<<< oobdtemple protocol MSG_SEND_BUFFER_2 <<<<
//>>>> oobdtemple protocol MSG_TICK >>>>    
	    case MSG_TICK:
//<<<< oobdtemple protocol MSG_TICK <<<<
		if (timeout > 0) {	/* we just waiting for the next frame to send */
		    if (timeout == 1) {	/* time's gone... */
			for (; sendMoreFrames(protocolBuffer, &actBufferPos, &protocolConfig->showBusTransfer, &stateMachine_state, &timeout, printdata_CAN, actBus_send););	// fire all in one shot.
			if (timeout < 2) {	//
			    protocolBuffer->len = 0;
			    createCommandResultMsg
				(FBID_PROTOCOL_GENERIC,
				 ERR_CODE_NO_ERR, 0, NULL);
			    stateMachine_state = SM_CANRAW_STANDBY;
			    if (pdPASS !=
				sendMsg(MSG_SERIAL_RELEASE, inputQueue,
					NULL)) {
				printser_string("INPQUE_FULL");
				DEBUGPRINT
				    ("FATAL ERROR: input queue is full!\n",
				     'a');
			    }
			}
		    }
		    timeout--;
		}
//>>>> oobdtemple protocol final >>>>    
		break;
	    }
	    disposeMsg(msg);
	}
	/* vTaskDelay (5000 / portTICK_PERIOD_MS); */

    }

    /* Do all cleanup here to finish task */
    actBus_close();
    vPortFree(protocolConfig);
    freeODPBuffer(protocolBuffer);
    xSemaphoreGive(protocollBinarySemaphore);
    vTaskDelete(NULL);
}
开发者ID:fkuppens,项目名称:oobd,代码行数:101,代码来源:odp_canraw.c

示例9: main

int main()
{
	unsigned long nMsg = 0;
	char *cmnd, *uname1, *uname2;
	int k;
	user *users = NULL;
	
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	
	cmnd = (char*)malloc(sizeof(char)*10);
	while(scanf("%s", cmnd)!=EOF)
	{
		if(DEBUG)
			printf("cmnd read: %s\n", cmnd);
			
		if(!strcmp(cmnd, "ADD"))
		{
			uname1 = getUser();
			if(users==NULL)
				init(uname1, &users);
			else
				addUser(uname1, users);
		}
		else if(!strcmp(cmnd, "FOLLOW"))
		{
			uname1 = getUser(), uname2 = getUser();
			follow(uname1, uname2, users);
		}
		else if(!strcmp(cmnd, "SEND"))
		{
			uname1 = getUser();
			sendMsg(uname1, ++nMsg, users);
		}
		else if(!strcmp(cmnd, "RESEND"))
		{
			uname1 = getUser();
			scanf("%d", &k);
			resendMsg(uname1, k, users);
		}
		else if(!strcmp(cmnd, "INACTIVE"))
		{
			uname1 = getUser();
			inactivate(uname1, users);
		}
		else if(!strcmp(cmnd, "ACTIVE"))
		{
			uname1 = getUser();
			activate(uname1, users);
		}
		else //UNFOLLOW
		{
			uname1 = getUser(), uname2 = getUser();
			unfollow(uname1, uname2, users);
		}
	}
	
	user *cur = users;
	do
	{
		print(*cur);
		cur = cur->next;
	}
	while(cur!=users);
	
	return 0;
}
开发者ID:Trietptm-on-Coding-Algorithms,项目名称:Algorithms-1,代码行数:67,代码来源:the3.c

示例10: sendMsg

// Get the msg types for Destination and Position.
void PathingController::receivePosMsg(const owr_messages::position &msg) {
   currLat = msg.latitude;
   currLong = msg.longitude;
   currHeading = msg.heading;
   sendMsg();
}
开发者ID:bluesat,项目名称:owr_software,代码行数:7,代码来源:PathingController.cpp

示例11: pthread_mutex_lock

int
ManagerFilter::handleNeedMore(AHData* msg)
{
    int* iMsg = (int*)msg->getData();
    int pId = iMsg[0];
    int mId = iMsg[1];

    pthread_mutex_lock(&mLog);
//    log << "Received work request from " << pId << " with mId: " << mId;
//    log << ", expected mId: " << lastId[pId]+1 << std::endl;
    pthread_mutex_unlock(&mLog);

    // Handle Work Request
    // Check if we should answer the request.
    if (mId <= lastId[pId] ) return 1;

    int* pMsg;
    size_t msgSize = 0;
    pthread_mutex_lock(&mWorkQueue);
    // If we have work
    if (!workQueue.empty()) 
    {
        // Mark that he has work and update lastId
        hasWork[pId] = true;
        lastId[pId]++;

        // Build char message
        std::list<Candidate> workToSend;
        workToSend.push_front(workQueue.front());
        workQueue.pop();
        pMsg = list2Msg(workToSend, pId, msgSize);
    }
    // If we don't have work
    else
    {
        // Mark no work for this pId
        hasWork[pId] = false;

        // Loop through all known clients, to see if someone has work
        bool someWork = false;
        std::map<int,bool>::iterator it;
        for (it = hasWork.begin(); it != hasWork.end(); it++) 
        {
            if (it->second)
            {
                someWork = true;
                break;
            }
        }

        // If none has work to do, we can stop
        if (!someWork) 
        {
            pMsg = buildEowMsg(msgSize);
            closeEventList(this->sNeedMore);
            closeEventList(this->sNewWork);
        }
        // Otherwise, ask for work
        else
        {
            // Send msg
            pthread_mutex_lock(&mStatus);
            if (!this->hasRequest) {
                this->hasRequest = true;
                AHData* askForMore = new AHData(new int(msgId), sizeof(int), 
                                                sWorkRequest);
                sendMsg(askForMore);
            }
            pthread_mutex_unlock(&mStatus);
            pMsg = 0;
        }
    }
    pthread_mutex_unlock(&mWorkQueue);

    if (msgSize != 0)
    {
        std::cout << ">>>>> MANAGER <<<<<<" << std::endl;
        std::cout << " >> MSG: " << pMsg << std::endl;
        AHData* d = new AHData(pMsg, msgSize, sOut);
        sendMsg(d);
    }

    delete msg;
    return 1; 
}
开发者ID:leolvt,项目名称:FSPD-SCORP,代码行数:85,代码来源:ManagerFilter.cpp

示例12: sendMsg

ssize_t CClient::sendWlcomeMsg(){
    string ret = "220 SimpleFtpServer\r\n";
    return sendMsg(ret);
}
开发者ID:jrubin123,项目名称:SimpleFtpServer,代码行数:4,代码来源:CClient.cpp

示例13: mBlogId

/** Constructor */
CreateBlogMsg::CreateBlogMsg(std::string cId ,QWidget* parent, Qt::WFlags flags)
: mBlogId(cId), QMainWindow (parent, flags)
{
	/* Invoke the Qt Designer generated object setup routine */
	ui.setupUi(this);

	setAttribute ( Qt::WA_DeleteOnClose, true );

	setupFileActions();
  setupEditActions();
  setupViewActions();
  setupInsertActions();
  setupParagraphActions();
  
  setAcceptDrops(true);
	setStartupText();
	
	newBlogMsg();
		
	ui.toolBar_2->addAction(ui.actionIncreasefontsize);
  ui.toolBar_2->addAction(ui.actionDecreasefontsize);
  ui.toolBar_2->addAction(ui.actionBlockquoute);
  ui.toolBar_2->addAction(ui.actionOrderedlist);
  ui.toolBar_2->addAction(ui.actionUnorderedlist);
  ui.toolBar_2->addAction(ui.actionBlockquoute);
  ui.toolBar_2->addAction(ui.actionCode);
  ui.toolBar_2->addAction(ui.actionsplitPost);
  
  setupTextActions();

	connect(ui.actionPublish, SIGNAL(triggered()), this, SLOT(sendMsg()));
	connect(ui.actionNew, SIGNAL(triggered()), this, SLOT (fileNew()));
	
	connect(ui.actionIncreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeIncrease()));
  connect(ui.actionDecreasefontsize, SIGNAL (triggered()), this, SLOT (fontSizeDecrease()));
  connect(ui.actionBlockquoute, SIGNAL (triggered()), this, SLOT (blockQuote()));
  connect(ui.actionCode, SIGNAL (triggered()), this, SLOT (toggleCode()));
  connect(ui.actionsplitPost, SIGNAL (triggered()), this, SLOT (addPostSplitter()));  
  connect(ui.actionOrderedlist, SIGNAL (triggered()), this, SLOT (addOrderedList()));
  connect(ui.actionUnorderedlist, SIGNAL (triggered()), this, SLOT (addUnorderedList()));

  //connect(webView, SIGNAL(loadFinished(bool)),this, SLOT(updateTextEdit()));
  connect( ui.msgEdit, SIGNAL( textChanged(const QString &)), this, SLOT(updateTextEdit()));
  
  connect( ui.msgEdit, SIGNAL(currentCharFormatChanged(QTextCharFormat)),
            this, SLOT(currentCharFormatChanged(QTextCharFormat)));
  connect( ui.msgEdit, SIGNAL(cursorPositionChanged()),
            this, SLOT(cursorPositionChanged()));
	
	QPalette palette = QApplication::palette();
  codeBackground = palette.color( QPalette::Active, QPalette::Midlight );
  
  fontChanged(ui.msgEdit->font());
  colorChanged(ui.msgEdit->textColor());
  alignmentChanged(ui.msgEdit->alignment());
  
    connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)),
            actionSave, SLOT(setEnabled(bool)));
    connect( ui.msgEdit->document(), SIGNAL(modificationChanged(bool)),
            this, SLOT(setWindowModified(bool)));
    connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)),
            actionUndo, SLOT(setEnabled(bool)));
    connect( ui.msgEdit->document(), SIGNAL(undoAvailable(bool)),
            ui.actionUndo, SLOT(setEnabled(bool)));        
    connect( ui.msgEdit->document(), SIGNAL(redoAvailable(bool)),
            actionRedo, SLOT(setEnabled(bool)));

    setWindowModified( ui.msgEdit->document()->isModified());
    actionSave->setEnabled( ui.msgEdit->document()->isModified());
    actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable());
    ui.actionUndo->setEnabled( ui.msgEdit->document()->isUndoAvailable());
    actionRedo->setEnabled( ui.msgEdit->document()->isRedoAvailable());

    connect(actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo()));
    connect(ui.actionUndo, SIGNAL(triggered()), ui.msgEdit, SLOT(undo()));
    connect(actionRedo, SIGNAL(triggered()), ui.msgEdit, SLOT(redo()));
    
    actionCut->setEnabled(false);
    actionCopy->setEnabled(false);

    connect(actionCut, SIGNAL(triggered()), ui.msgEdit, SLOT(cut()));
    connect(actionCopy, SIGNAL(triggered()), ui.msgEdit, SLOT(copy()));
    connect(actionPaste, SIGNAL(triggered()), ui.msgEdit, SLOT(paste()));
    
    connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCut, SLOT(setEnabled(bool)));
    connect(ui.msgEdit, SIGNAL(copyAvailable(bool)), actionCopy, SLOT(setEnabled(bool)));
    
#ifndef QT_NO_CLIPBOARD
    connect(QApplication::clipboard(), SIGNAL(dataChanged()), this, SLOT(clipboardDataChanged()));
#endif
  
  //defaultCharFormat
  defaultCharFormat = ui.msgEdit->currentCharFormat();

  const QFont defaultFont = ui.msgEdit->document()->defaultFont();
  defaultCharFormat.setFont( defaultFont );
  defaultCharFormat.setForeground( ui.msgEdit->currentCharFormat().foreground() );
  defaultCharFormat.setProperty( QTextFormat::FontSizeAdjustment, QVariant( 0 ) );
  defaultCharFormat.setBackground( palette.color( QPalette::Active,
//.........这里部分代码省略.........
开发者ID:boukeversteegh,项目名称:retroshare,代码行数:101,代码来源:CreateBlogMsg.cpp

示例14: solver

int solver(int *map, int x1, int y1, int x2, int y2, int *stones, int n)
{
	int i;
	int x, y;

	/*
	printf("(%d, %d) ~ (%d, %d)\n\n", x1, y1, x2, y2);

	printf("Map\n");
	for (y=0; y<32; y++) {
		printf("\t");
		for (x=0; x<32; x++) printf("%d", MAP(x, y));
		printf("\n");
	}
	printf("\n");

	printf("Stones\n");
	for (i=0; i<n; i++) {
		printf("\tstone %d\n", i+1);
		for (y=0; y<8; y++) {
			printf("\t\t");
			for (x=0; x<8; x++) printf("%d", STONE(i, x, y));
			printf("\n");
		}
	}
	printf("\n");
	*/

	/* Solutions for light.txt */
	char *solutions[] = {
		"H 0 2 2\n",
		"H 0 2 2\nT 0 -6 0\n",
		"H 0 2 2\nT 0 -6 0\n\nH 0 1 -1\n",
		NULL
	};

	printf("Solutions\n");
	for (i=0; (solutions[i] != NULL); i++) {
		sleep(5);
		printf("Solutin %d\n", i+1);

		// Padding
		int j, line = 0;
		for (j=0; (solutions[i][j] != '\0'); j++) {
			if (solutions[i][j] == '\n') line++;
		}

		// Like a START BIT
		sendMsg("S");

		// Main
		sendMsg(solutions[i]);
		for (j=0; j<(n - line); j++) sendMsg("");

		// Prepare for next problem
		if (sendMsg("E") == EXIT_FAILURE)
			return EXIT_SUCCESS;	// transition to `Ready state`
	}

	// Forced termination
	return EXIT_FAILURE;
}
开发者ID:KNCT-KPC,项目名称:Bungo,代码行数:62,代码来源:sample.cpp

示例15: Marmote_StopStreaming

void Marmote_StopStreaming(FT_HANDLE ftHandle)
{
	uint8_t dummy;
	sendMsg(ftHandle, SDR, STOP_STREAMING, &dummy, 0);
}
开发者ID:kitnic,项目名称:marmote,代码行数:5,代码来源:MarmoteControl.cpp


注:本文中的sendMsg函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。