⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainwin.cpp

📁 qgo-1.5.4-r3.tar.gz linux下一个很好玩的游戏
💻 CPP
📖 第 1 页 / 共 5 页
字号:
			slot_message(txt);			// clear send buffer			do			{				// enable sending				set_tn_ready();			} while (sendTextFromApp(NULL) != 0);			// check if tables are sorted#if (QT_VERSION > 0x030006)			if (ListView_players->sortColumn() == -1)				ListView_players->setSorting(2);			if (ListView_games->sortColumn() == -1)				ListView_games->setSorting(2);#endif			switch(myAccount->get_gsname())			{				case IGS:				{					// IGS - check if client mode					bool ok;					/*int cmd_nr =*/ element(txt, 0, " ").toInt(&ok);					if (!ok)						set_sessionparameter("client", true);					// set quiet true; refresh players, games					//if (myAccount->get_status() == GUEST)					set_sessionparameter("quiet", true);					//else					// set id - only available if registerd; who knows why...					sendcommand("id qGo " + QString(VERSION), true);					sendcommand("toggle newrating");//					if (setting->readBoolEntry("USE_NMATCH"))//					{// we wanted to allow user to disable 'nmatch', but IGS disables 'seek' with nmatch					set_sessionparameter("nmatch",true);						//temporaary settings to prevent use of Koryo BY on IGS (as opposed to canadian)						//sendcommand("nmatchrange BWN 0-9 19-19 60-60 60-3600 25-25 0 0 0-0",false);					send_nmatch_range_parameters();//					}					sendcommand("toggle newundo");					sendcommand("toggle seek");					sendcommand("seek config_list ");					sendcommand("room");											slot_refresh(11);					slot_refresh(10);					break;				}									default:					set_sessionparameter("client", true);					// set quiet false; refresh players, games					//if (myAccount->get_status() == GUEST)					set_sessionparameter("quiet", false);					slot_refresh(11);					if (myAccount->get_gsname() != CWS)						slot_refresh(10);					break;			}			// set menu			Connect->setEnabled(false);			Disconnect->setEnabled(true);			toolConnect->setOn(true);			toolConnect->setPixmap(connectedIcon);			QToolTip::remove(toolConnect);			QToolTip::add(toolConnect, tr("Disconnect from") + " " + cb_connect->currentText());			// quiet mode? if yes do clear table before refresh			gamesListSteadyUpdate = ! setQuietMode->isOn(); 			playerListSteadyUpdate = ! setQuietMode->isOn(); 			// enable extended user info features			setColumnsForExtUserInfo();			// check for messages			if (youhavemsg)				sendcommand("message", false);			// let qgo know which server			qgoif->set_gsName(myAccount->get_gsname());			// show current Server name in status bar			statusServer->setText(" " + myAccount->svname + " ");			// start timer: event every second			onlineCount = 0;			startTimer(1000);			// init shouts			slot_talk("Shouts*", 0, true);						qgoif->get_qgo()->playConnectSound();			break;		// end of 'who'/'user' cmd		case PLAYER42_END:		case PLAYER27_END:			// anyway, end of fast filling			if (store_sort_col != -1)				ListView_players->setSorting(store_sort_col);			store_sort_col = -1;			if (myAccount->get_gsname()==IGS)				ListView_players->showOpen(whoOpenCheck->isChecked());			ListView_players->sort();			playerListEmpty = false;			break;		// skip table if initial table is to be loaded		case PLAYER27_START:		case PLAYER42_START:			// disable sorting for fast operation; store sort column index			store_sort_col = ListView_players->sortColumn();			ListView_players->setSorting(-1);			if (playerListEmpty)				prepare_tables(WHO);			break;		case GAME7_START:			// "emulate" GAME7_END			player7active = true;			// disable sorting for fast operation; store sort column index			// unfortunately there is not GAME7_END cmd, thus, it's emulated			if (playerListEmpty)			{				// only if playerListEmpty, else PLAYERXX_END would not arise				store_games_sort_col = ListView_games->sortColumn();				ListView_games->setSorting(-1);			}			break;		case ACCOUNT:			// let qgo and parser know which account in case of setting something for own games			qgoif->set_myName(myAccount->acc_name);			parser->set_myname(myAccount->acc_name);			break;    case STATS:        // we just received a players name as first line of stats -> create the dialog tab        currentCommand->txt="stats";       // if (!talklist.current())            slot_talk( parser->get_statsPlayer()->name,0,true);                //else if (parser->get_statsPlayer()->name != talklist.current()->get_name())        //    slot_talk( parser->get_statsPlayer()->name,0,true);      break;      		case BEEP://			QApplication::beep();			break;		default:			break;	}/*	// skip player list and game list	if (!DODEBUG)		switch (it_)		{			case PLAYER42:				if (!extUserInfo || myAccount->get_gsname() != IGS)					slot_message(txt);			case PLAYER:			case GAME://			case WS:			case READY:			case GAME7:			case PLAYER27:			case MOVE:			case SHOUT:			case BEEP:			case KIBITZ:				return;				break;			default:				break;		}	// show all in messages window, but players and games	// Scroll at bottom of text, set cursor to end of line	MultiLineEdit_messages->insertLine(txt);*/	if (DODEBUG)		qDebug(txt);}// used for singleShot actionsvoid ClientWindow::set_tn_ready(){	tn_ready = true;	tn_wait_for_tn_ready = false;	sendTextFromApp(0);}// send text via telnet session; skipping empty string!int ClientWindow::sendTextFromApp(const QString &txt, bool localecho){	// implements a simple buffer	int valid = txt.length();	// some statistics	if (valid)		setBytesOut(valid+2);	if (myAccount->get_status() == OFFLINE)	{		// skip all commands while not telnet connection		sendTextToApp("Command skipped - no telnet connection: " + txt);		// reset buffer		sendBuffer.clear();		return 0;	}	// check if telnet ready	if (tn_ready)	{		sendBuf *s = sendBuffer.getFirst();		if (s)		{			// send buffer cmd first; then put current cmd to buffer			telnetConnection->sendTextFromApp(s->get_txt());//qDebug("SENDBUFFER send: " + s->get_txt());			// hold the line if cmd is sent; 'ayt' is autosend cmd			if (s->get_txt().find("ayt") != -1)				resetCounter();			if (s->get_localecho())				sendTextToApp(CONSOLECMDPREFIX + QString(" ") + s->get_txt());			tn_ready = false;			// delete sent command from buffer       //currentCommand->txt = s->get_txt();      sendBuffer.removeFirst();      			if (valid)			{				// append current command to send as soon as possible				sendBuffer.append(new sendBuf(txt, localecho));//qDebug("SENDBUFFER added: " + txt);			}		}		else if (valid)		{			// buffer empty -> send direct			telnetConnection->sendTextFromApp(txt);      //currentCommand->txt = txt;      			if (!txt.contains("ayt"))				resetCounter();			if (localecho)				sendTextToApp(CONSOLECMDPREFIX + QString(" ") + txt);			tn_ready = false;//qDebug("SENDBUFFER send direct: " + txt);		}	}	else if (valid)	{//qDebug("SENDBUFFER added: " + txt);		sendBuffer.append(new sendBuf(txt, localecho));	}	return sendBuffer.count();}// show command, send it, and tell parservoid ClientWindow::sendcommand(const QString &cmd, bool localecho) {	QString testcmd = cmd;	// for testing	if (cmd.find("#") == 0)	{		qDebug("detected TEST (#) command");		testcmd = testcmd.remove(0, 1).stripWhiteSpace();		// help		if (testcmd.length() <= 1)		{			sendTextToApp("local cmds available:\n"				"#+dbgwin\t#+dbg\t\t#-dbg\n");			return;		}		// detect internal commands		if (testcmd.contains("+dbgwin"))		{			// show debug window			DD->show();			this->setActiveWindow();		}		else if (testcmd.contains("+dbg"))		{			// show debug window and activate debug mode			qDebug("*** set Debug on ***");			DD->show();			DODEBUG = true;			this->setActiveWindow();		}		else if (testcmd.contains("-dbg"))		{			// hide debug window and deactivate debug mode			qDebug("*** set Debug off ***");			DODEBUG = false;			DD->hide();		}		sendTextToApp(testcmd);		return;	}	// echo	if (localecho)	{		// add to Messages, anyway		// Scroll at bottom of text, set cursor to end of line		if (DODEBUG)			qDebug(cmd);    slot_message(cmd,Qt::blue);	}	// send to Host	sendTextFromApp(cmd, localecho);}// howver, sendcommand is no slot...void ClientWindow::slot_sendcommand(const QString &cmd, bool localecho){	sendcommand(cmd, localecho);}void ClientWindow::slot_toolbaractivated(const QString &cmd){	// do some cmd lind checks for toolbar too	bool valid_marker = cmd_valid;	cmd_valid = true;	slot_cmdactivated(cmd);	cmd_valid = valid_marker;}// return pressed in edit line -> command to sendvoid ClientWindow::slot_cmdactivated(const QString &cmd){	if (!cmd)		return;qDebug("cmd_valid: %i", (int)cmd_valid);	// check if valid cmd -> cmd number risen	if (cmd_valid)	{		// clear field, and restore the blank line at top    cb_cmdLine->removeItem(1);    cb_cmdLine->insertItem("",0);    cb_cmdLine->clearEdit();    		// echo & send		QString cmdLine = cmd;		sendcommand(cmdLine.stripWhiteSpace(),true);		cmd_valid = false;		// check for known commands		if (cmdLine.mid(0,2).contains("ob"))		{			QString testcmd;			qDebug("found cmd: observe");			testcmd = element(cmdLine, 1, " ");			if (testcmd)			{//				qgoif->set_observe(testcmd);				sendcommand("games " + testcmd);			}		}		if (cmdLine.mid(0,3).contains("who"))		{			// clear table if manually entered			prepare_tables(WHO);			playerListSteadyUpdate = false;		}		if (cmdLine.mid(0,5).contains("; \\-1") && myAccount->get_gsname() == IGS)		{			// exit all channels			prepare_tables(CHANNELS);		}	}}// number of activated cmdvoid ClientWindow::slot_cmdactivated_int(int){	if (cb_cmdLine->count() > cmd_count)	{		cmd_count = cb_cmdLine->count();		cmd_valid = true;	}	else		cmd_valid = false;}// set session parametervoid ClientWindow::set_sessionparameter(QString par, bool val){	QString value;	if (val)		value = " true";	else		value = " false";	switch(myAccount->get_gsname())	{		// only toggling...		case IGS:			sendcommand("toggle " + par + value);			break;					default:			sendcommand("set " + par + value);			break;	}}// select connection or create new one - combobox connectionvoid ClientWindow::slot_cbconnect(const QString &txt){	QString text = txt;	Host *h = NULL;	int i=1;	if (!text)	{		// txt empty: update combobox - server table has been edited...		// keep current host		text = cb_connect->currentText();		// refill combobox		cb_connect->clear();		for (Host *h_ = hostlist.first(); h_ != NULL; h_ = hostlist.next())		{			cb_connect->insertItem(h_->title());			if (h_->title() == text)			{						i = cb_connect->count();						h = h_;			}		}	}	else	{		// view active host in cb_connect		h = hostlist.first();		while (h != NULL && h->title() != text)		{			h = hostlist.next();			i++;		}	}	// view selected host

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -