MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), changed(false), pictureWidget(0), pictureProject(0), unmarkedModel(0), markedModel(0) { setupUi(this); connect(actionOpen, SIGNAL(triggered()), this, SLOT(openSlot())); connect(actionSave, SIGNAL(triggered()), this, SLOT(saveSlot())); connect(actionExit, SIGNAL(triggered()), this, SLOT(close())); connect(unmarkedList, SIGNAL(activated(const QModelIndex &)), this, SLOT(unmarkedListObjectSelectSlot(const QModelIndex &))); connect(markedList, SIGNAL(activated(const QModelIndex &)), this, SLOT(markedListObjectSelectSlot(const QModelIndex &))); connect(unmarkedList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(unmarkedListDoubleClickedSlot(const QModelIndex &))); connect(markedList, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(markedListDoubleClickedSlot(const QModelIndex &))); }
// GameNode constructor. Opens the output slot and assigns default values. GameNode::GameNode(short nNumber, char* szUserInfo) { hOutputSlot = openSlot(nNumber); nIndex = nNumber; bInGame = false; bHasThread = false; // Read sysop status flag if ( atoi( strtok(szUserInfo, "&") ) == 1 ) bSysop = true; else bSysop = false; // Read gender char* szTemp = strtok(NULL, "&"); cGender = szTemp[0]; // Read platform nPlatform = atoi( strtok(NULL, "&") ); // Read alias strcpy( szAlias, strtok(NULL, "&") ); // Read real name strcpy( szRealName, strtok(NULL, "") ); }
void FFCP::createActions() { newAct = new QAction( tr("新建"), this); //QIcon("./images/open.png"), 暂时不设置图片 newAct->setShortcut(tr("N")); connect(newAct, SIGNAL(triggered()), this, SLOT(newSlot())); openAct = new QAction(tr("打开"), this); openAct->setShortcut(tr("O")); connect(openAct, SIGNAL(triggered()), this, SLOT(openSlot())); saveAct = new QAction(tr("保存"), this); saveAct->setShortcut(tr("S")); connect(saveAct, SIGNAL(triggered()), this, SLOT(saveSlot())); quitAct = new QAction(tr("退出"), this); quitAct->setShortcut(tr("Q")); connect(quitAct, SIGNAL(triggered()), this, SLOT(close())); aboutAct = new QAction(tr("关于"), this); aboutAct->setShortcut(tr("A")); connect(aboutAct, SIGNAL(triggered()), this, SLOT(aboutSlot())); compileAct = new QAction(tr("编译"), this); compileAct->setShortcut(tr("F7")); connect(compileAct, SIGNAL(triggered()), this, SLOT(compileSlot())); simulationAct = new QAction(tr("仿真"), this); simulationAct->setShortcut(tr("F6")); connect(simulationAct, SIGNAL(triggered()), this, SLOT(simulationSlot())); downloadAct = new QAction(tr("下载"), this); downloadAct->setShortcut(tr("F5")); connect(downloadAct, SIGNAL(triggered()), this, SLOT(downloadSlot())); clearAct = new QAction(tr("清除"), this); clearAct->setShortcut(tr("F8")); connect(clearAct, SIGNAL(triggered()), this, SLOT(clearSlot())); //在工具中添加变量定义 defineAct = new QAction(tr("变量定义"),this); defineAct->setShortcut(tr("F1")); connect(defineAct, SIGNAL(triggered()), this, SLOT(defineSlot())); hardwareAct = new QAction(tr("硬件结构图"), this); defineAct->setShortcut(tr("F3")); connect(hardwareAct, SIGNAL(triggered()), this, SLOT(hardwareSlot())); softwareAct = new QAction(tr("软件流程图"), this); defineAct->setShortcut(tr("F2")); connect(softwareAct, SIGNAL(triggered()), this, SLOT(softwareSlot())); }
CFrmSettings::CFrmSettings() { this->gvc = gvContext(); Ui_Dialog tempDia; tempDia.setupUi(this); graph = NULL; activeWindow = NULL; QString path; #ifndef WIN32 char *s = getenv("GVEDIT_PATH"); if (s) path = s; else path = GVEDIT_DATADIR; #endif connect(WIDGET(QPushButton, pbAdd), SIGNAL(clicked()), this, SLOT(addSlot())); connect(WIDGET(QPushButton, pbNew), SIGNAL(clicked()), this, SLOT(newSlot())); connect(WIDGET(QPushButton, pbOpen), SIGNAL(clicked()), this, SLOT(openSlot())); connect(WIDGET(QPushButton, pbSave), SIGNAL(clicked()), this, SLOT(saveSlot())); connect(WIDGET(QPushButton, btnOK), SIGNAL(clicked()), this, SLOT(okSlot())); connect(WIDGET(QPushButton, btnCancel), SIGNAL(clicked()), this, SLOT(cancelSlot())); connect(WIDGET(QPushButton, pbOut), SIGNAL(clicked()), this, SLOT(outputSlot())); connect(WIDGET(QPushButton, pbHelp), SIGNAL(clicked()), this, SLOT(helpSlot())); connect(WIDGET(QComboBox, cbScope), SIGNAL(currentIndexChanged(int)), this, SLOT(scopeChangedSlot(int))); scopeChangedSlot(0); #ifndef WIN32 loadAttrs(path + "/attrs.txt", WIDGET(QComboBox, cbNameG), WIDGET(QComboBox, cbNameN), WIDGET(QComboBox, cbNameE)); #else loadAttrs("../share/graphviz/gvedit/attributes.txt", WIDGET(QComboBox, cbNameG), WIDGET(QComboBox, cbNameN), WIDGET(QComboBox, cbNameE)); #endif setWindowIcon(QIcon(":/images/icon.png")); }
void main(int argc, char *argv[]) #endif { char szText[160]; bool bSuccess; short nTries = 0; // Set results of what happens when a call to new fails set_new_handler(badNew); // Call the startup function #ifdef OD32 startup(lpszCmdLine); #else startup(argc, argv); #endif Sleep(500); do { // Attempt to start up the door server process. (No need to check if the door server process is already // running; it does that on its own and shuts down extra copies as needed) bSuccess = CreateProcess(DOOR_SERVER_EXE, NULL, NULL, NULL, false, DETACHED_PROCESS, NULL, NULL, new STARTUPINFO, new PROCESS_INFORMATION); Sleep(1000); nTries++; } while ( bSuccess == false && nTries < 5 ); // Get a handle on the door server's input mailslot hInputSlot = openSlot(-1); // Create this node's output mailslot. hOutputSlot = createSlot( getNode() ); // If unable to open input slot, re-try up to 5 times (intial failure seems to happen on WinXP randomly) // If still failure, this indicates the door server is not running and could not be started, so shut down. nTries = 0; while (hInputSlot == INVALID_HANDLE_VALUE ) { Sleep(500); hInputSlot = openSlot(-1); if ( ++nTries > 5 ) { local("Unable to start door: IPC error"); exitDoor(1); } } // If the output slot for this node is already open, it means the node is already running the door. if ( hOutputSlot == INVALID_HANDLE_VALUE ) { local("Unable to start door: This node is already in use!"); pausePrompt(); exitDoor(1); } // Now that the mailslot handles were successful, call setupExitFunction() to register beforeExit() as the // function called upon exit. setupExitFunction(); // Send an input message to the server, to tell it a user is trying to enter the game. The user's info is // passed as a string in the format below. sprintf(szText, "%d&%c&%d&%s&%s", isSysop(), getGender(), getPlatform(), getAlias(), getRealName()); sendInput(szText, IP_ENTER_GAME); // Handle I/O for the user while (1) { performIO(); } }