/*! * \brief jpconjmain::doInit Initialize the components of the main window * * This function sets the language and direction of the main window. * You can call it in the constructor of this window. */ void MainWindow::doInit() { workfrm = new SrchFrame(this); ui->formLayout->addWidget(workfrm); hasContent = false; languageChanged = true; currentVerb = ""; //qDebug()<< QString(VERSION); Language::loadTranslations(); bool rtl = Language::mainWindowDirection(this); ui->menu_View->addAction(ui->mainTool->toggleViewAction()); ui->menu_View->addAction(ui->zoomTool->toggleViewAction()); //ui->menu_View->addAction(ui->search->toggleViewAction()); //ui->showt->setLayoutDirection(Qt::LeftToRight); //changeStyle(Style::getCurrentStyle()); Style::addStyleReceiver(this, SLOT(changeStyle(QString))); Style::loadStyles(); Style::addFontReceiver(this, SLOT(changeFont(QString,QString,int))); Style::setFont(); //tray Icon trayIconSys = new JpconjTray(this); actionShow = new QAction(tr("Show"), this); //qApp->translate, "jpconjmain" actionShow->setIcon(QIcon(":/img/show.png")); connect(actionShow, SIGNAL(triggered()), trayIconSys, SLOT(showMain()) ); trayIconSys->addAction(actionShow); trayIconSys->addSeparator(); }
int main(){ pstu_t phead = NULL; char name[] = "asd"; showMain(__DISPALY__MANGEROP__); //phead = stuInitSort(); //stuShow(phead); // stuDelete(&phead,3); //stuShow(phead); stuInserSort(&phead); stuShow(phead); // stuSearchById(phead , 3); stuSearchByName(phead ,name); stuDestory(&phead); system("pasue"); return 0; }
void MainWindow::onHotkey(void) { if((HWND)this->winId() == GetActiveWindow()) { // Already active window. moveSel(SELMOVE_DWN); } else { showMain(); } }
void MainWindow::windowActivationChange(bool state) { if(state) { // Lost focus. hide(); } else { // In focus. updateWinList(); checkSavedWins(); showMain(); } }
void testLCD() { utPtn("init dis\n"); VSTM0802AInit(); #if 0 //先写后读测试,读出的应该和写入的一样,否则就有问题 SetCursorPos(0,0); ramptc (0xff); utPrt("\nget = %x\n\n",ReadData (0, 0)); #endif utPtn("init dis ok\n"); utDelay1ms (200); //showTest(); showInit(); utDelay1s(2); while(1); #if 0 showHeating(); utDelay1s(2); showCheckHome(); utDelay1s(2); showMain(); utDelay1s(2); showDAOut(); utDelay1s(2); showWaveCal(); utDelay1s(2); #endif }
/*notice the default arguments for main. SDL expects main to look like that, so don't change it*/ int main(int argc, char *argv[]) { // SDL_Surface *temp = NULL; int done;// the player const Uint8 *keys;// the player /* This section starts by loading the BG as a surface and converting it to a texture This will have to change if I can manage to scroll the trexture arond the player*/ SDL_CreateWindowAndRenderer(800, 600, SDL_WINDOW_RESIZABLE, &mainWindow, &renderer); SDL_SetWindowTitle(mainWindow, "Nitro Hotness"); if( TTF_Init() == -1 ) { return false; } if( Mix_OpenAudio( 22050, MIX_DEFAULT_FORMAT, 2, 4096 ) == -1 ) { return false; } InitSpriteSystem(); InitEntitySystem(entityMax); map mymap = setWorld(); ObstacleList ol = newObstacleList(); mew = newPlayer(); Obstacle Doh = newObstacle(0); Road_M Path = initRoad(); AI rival = new_AI(); GUI HUD = InitGUI(); mew.position=0; done = 0; //The music that will be played Mix_Music *music = NULL; Mix_Chunk *buzz = NULL; buzz = Mix_LoadWAV( "sfx/buzz.wav" ); readSave(&mew); showTitle(); showMain(); oldTime = 0; currentTime = 0; mytime = 0; do { oldTime = 0; currentTime = 0; mytime = 0; if( Mix_PlayingMusic() == 0 ) { //Play the music if( Mix_PlayMusic( level_music, -1 ) == -1 ) { return 1; } } SDL_Event e; SDL_PollEvent( &e ); if(&e) { //User requests quit if( e.type == SDL_QUIT ) { done = 1; } //user presses enter to go to next menu //User presses a key else if( e.type == SDL_KEYDOWN ) { //Select surfaces based on key press switch( e.key.keysym.sym ) { case SDLK_LEFT: // slog("left is down"); mew.playerX += 3; mew.accel = (mew.accel - .000001); break; case SDLK_RIGHT: // slog("right is down"); mew.playerX -= 3; mew.accel = (mew.accel - .000001); break; case SDLK_UP: // slog("up is down"); mew.accel = (mew.accel + .00007); Mix_PlayChannel( 1, buzz, 0 ); break; case SDLK_DOWN: // slog("down is down"); mew.accel = (mew.accel - .00008); break; } } else if( e.type == SDL_KEYUP ) { //Select surfaces based on key press switch( e.key.keysym.sym ) { case SDLK_RETURN : if(mew.done ==1) { Mix_HaltMusic(); if(GP == 1) { mew.done=0; lvl++; //slog("new level is %i",lvl); mew.position = 0; rival.position =0; setWorld(); Results(mew.rank,lvl); } else if (GP == 0) { mew.done=0; mew.position = 0; rival.position =0; levelSelect(); } } else { slog("too soon"); } case SDLK_LEFT: // slog("left is up"); e.type = SDLK_CLEAR; break; case SDLK_RIGHT: // slog("right is up"); e.type = SDLK_CLEAR; break; case SDLK_UP: // slog("up is up"); mew.accel = (mew.accel - .001); Mix_HaltChannel(1); e.type = SDLK_CLEAR; break; case SDLK_DOWN: // slog("down is up"); mew.accel = 0; e.type = SDLK_CLEAR; break; default: //slog("simple decel"); mew.accel = (mew.accel-0.00001); break; } } if(mew.position > rival.position) { mew.rank = 1 ; } else if( rival.position > mew.position ) { mew.rank = 2 ; } SDL_RenderClear(renderer); DrawBG(BG1,BG2); roadUpdate(Path,mymap,mew); roadDraw(Path,mymap,&mew); roadFetch(Path,mymap,&mew); checkForObstacles(ol , &mew, Doh); update_AI(&rival, &mew); UpdatePlayer(&mew); DrawGui(HUD,mew); NextFrame(); keys = SDL_GetKeyboardState(NULL); if(keys[SDL_SCANCODE_ESCAPE]) { done = 1; } } }while(!done); //Free the sound effects //Free the music Mix_FreeMusic( music ); CloseEntitySystem(); CloseSpriteSystem(); exit(0); /*technically this will end the program, but the compiler likes all functions that can return a value TO return a value*/ return 0; }
BitSplit::BitSplit() { fontDb.addApplicationFont(":/fonts/OpenSans-Light.ttf"); fontDb.addApplicationFont(":/fonts/OpenSans-Regular.ttf"); exit = true; blockToggle = false; searchExisting = false; /* Timer setup*/ guiUpdater = new QTimer( this ); guiUpdater->setInterval(25); syncAnimator = new QTimer( this ); syncAnimator->setInterval(75); /* Interface setup */ fileInterface.debug = false; fileInterface.copyDirection = BothDirections; actionCreator.fileInterface = &fileInterface; smartMatch.fileInterface = &fileInterface; actionHandler.fileInterface = &fileInterface; updater.fileInterface = &fileInterface; /* Set up icons */ remove = new QIcon(":images/general/remove.png"); done = new QIcon(":images/table/tick.png"); errorIcon = new QIcon(":images/table/error.png"); skip = new QIcon(":images/table/skip.png"); sync1 = new QIcon(":images/table/sync1.png"); syncAnimation.append(sync1); sync2 = new QIcon(":images/table/sync2.png"); syncAnimation.append(sync2); sync3 = new QIcon(":images/table/sync3.png"); syncAnimation.append(sync3); sync4 = new QIcon(":images/table/sync4.png"); syncAnimation.append(sync4); sync5 = new QIcon(":images/table/sync5.png"); syncAnimation.append(sync5); sync6 = new QIcon(":images/table/sync6.png"); syncAnimation.append(sync6); sync7 = new QIcon(":images/table/sync7.png"); syncAnimation.append(sync7); sync8 = new QIcon(":images/table/sync8.png"); syncAnimation.append(sync8); ui.setupUi( this ); ui.runButton->setDisabled(true); /* Connect buttons to their dialogs */ connect(ui.editSettingsButton, SIGNAL(clicked()), this, SLOT(editSettings())); connect(ui.newProfileButton, SIGNAL(clicked()), this, SLOT(newProfile())); /* Log Connections*/ connect(ui.actionView_Log, SIGNAL(triggered()), this, SLOT(showLog())); connect(ui.exitLog, SIGNAL(clicked()), this, SLOT(showMain())); connect(&fileInterface, SIGNAL(updateLog(QString)), ui.log, SLOT(append(QString))); connect(ui.errorViewLog, SIGNAL(clicked()), this, SLOT(showLog())); /* Top Bar connections*/ connect(&fileInterface, SIGNAL(matchComplete()), this, SLOT(matchComplete())); connect(&fileInterface, SIGNAL(updateSingle(QString)), ui.topBarSingle, SLOT(setText(QString))); connect(&fileInterface, SIGNAL(updateTopMP(QString)), ui.mp_top, SLOT(setText(QString))); connect(&fileInterface, SIGNAL(updateBottomMP(QString)), ui.mp_bottom, SLOT(setText(QString))); connect(&fileInterface, SIGNAL(updateOperationMP(QString)), ui.mp_operation, SLOT(setText(QString))); connect(guiUpdater, SIGNAL(timeout()), &smartMatch, SLOT(updateGuiLabels())); connect(&smartMatch, SIGNAL(startTime()), guiUpdater, SLOT(start())); connect(&smartMatch, SIGNAL(stopTime()), guiUpdater, SLOT(stop())); connect(&smartMatch, SIGNAL(setTopBarLineStack(int)), this, SLOT(setTopBarLineStack(int))); /* Unmatched files tree Connections */ connect(ui.unmatchedTree, SIGNAL(itemChanged(QTreeWidgetItem*,int)), this, SLOT(toggleTree(QTreeWidgetItem*,int))); connect(&fileInterface, SIGNAL(updateFileTree(bool, QTreeWidgetItem *)), this, SLOT(insertTreeItem(bool, QTreeWidgetItem *))); connect(&fileInterface, SIGNAL(pop()), this, SLOT(popParent())); connect(&fileInterface, SIGNAL(expandTree()), this, SLOT(expandTree())); /* Matched Table Connections */ connect(&fileInterface, SIGNAL(insertMatchTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertMatchTableRow(QList<QTableWidgetItem*>*))); /* Action Table Connections*/ connect(&fileInterface, SIGNAL(insertActionTableRow(QList<QTableWidgetItem*>*)), this, SLOT(insertActionTableRow(QList<QTableWidgetItem*>*))); /* Error connections */ connect(&smartMatch, SIGNAL(operationFailed()), this, SLOT(error())); connect(&actionCreator, SIGNAL(operationFailed()), this, SLOT(error())); connect(&actionHandler, SIGNAL(exception()), this, SLOT(error())); /* Developer Test Connections */ connect(ui.actionDeveloper_Test, SIGNAL(triggered()), this, SLOT(runDeveloperTest())); connect(&smartMatch, SIGNAL(stopTestTime()), this, SLOT(endTimer())); /* Action Handler Connections */ connect(&actionHandler, SIGNAL(updateProgress(int)), ui.progressBar, SLOT(setValue(int))); connect(&actionHandler, SIGNAL(updateActionLabel(QString)), ui.actionLabel, SLOT(setText(QString))); connect(&actionHandler, SIGNAL(updateSpeedLabel(QString)), ui.speedLabel, SLOT(setText(QString))); connect(&actionHandler, SIGNAL(updatePercentageLabel(QString)), ui.mp_busyIndicator, SLOT(setText(QString))); connect(&actionHandler, SIGNAL(setComplete(int)), this, SLOT(setDone(int))); connect(&actionHandler, SIGNAL(setSkipped(int)), this, SLOT(setSkip(int))); connect(&actionHandler, SIGNAL(setError(int)), this, SLOT(setError(int))); connect(&actionHandler, SIGNAL(setInProgress(int)), this, SLOT(setSync(int))); /* Updater Connections */ connect(&updater, SIGNAL(complete()), this, SLOT(updaterComplete())); /* General Connections & Button Stack Connections */ connect(syncAnimator, SIGNAL(timeout()), this, SLOT(showSync())); connect(ui.finishEditButton, SIGNAL(clicked()), this, SLOT(createActions())); connect(&actionCreator, SIGNAL(complete()), this, SLOT(actionsComplete())); connect(ui.runButton, SIGNAL(clicked()), this, SLOT(runActionHandler())); connect(ui.searchButton, SIGNAL(clicked()), this, SLOT(searchForSync())); connect(&actionHandler, SIGNAL(complete()), this, SLOT(actionHandlerComplete())); /* General Setup*/ frame = 0; currentAction = -1; actionHandler.table = ui.actionsTable; ui.mp_ProfileLabel->fontMetrics().width(ui.mp_ProfileLabel->text()); createTrayIcon(); setupTable(); fileInterface.loadDatabase(); recentProfiles = fileInterface.loadRecentProfiles(); if(recentProfiles.size() > 0) showRecentProfiles(); }