bool Metadata::appendInt32(int key, int32_t val) { if (!checkKey(key)) { return false; } const size_t begin = mData->dataPosition(); bool ok = true; // 4 int32s: size, key, type, value. ok = ok && mData->writeInt32(4 * sizeof(int32_t)) == OK; ok = ok && mData->writeInt32(key) == OK; ok = ok && mData->writeInt32(INTEGER_VAL) == OK; ok = ok && mData->writeInt32(val) == OK; if (!ok) { mData->setDataPosition(begin); } return ok; }
bool Lz::PresetStorage::loadPresets(const QJsonObject& config) { for(auto key : config.keys()) { if(checkKey(key) && checkPresetConfig(config.value(key))) { Lz::Preset preset; for(auto s: config.value(key).toArray()) { preset.append(s.toString()); } m_presets[key] = preset; } else { /* TODO error report*/ /* then change to 'return false;'. */ } } emit presetsUpdated(); return true; }
//Takes a key and a value from the front end of the server and stores it in the hashtable. int addValue(char* key, char* value, int vSize) { //Takes the key and hashes it, then mods the hash to fit in the table. int hash = hashKey(key); int index = hash % TABLE_SIZE; //Checks if the key already exists. If it does then return as a failure. if(checkKey(key)) return 0; //Creates a new dataNode and stores the information of the key-value. dataNode* newNode = malloc(sizeof(dataNode)); newNode->hash = hash; //For faster searching newNode->key = key; //For preciese searching newNode->value = value; //The data newNode->vSize = vSize; //For creating a header sent to the client //If there is a collision make a linked list of dataNodes. if(kvTable->table[index]) newNode->next = kvTable->table[index]; else newNode->next = NULL; //Add the dataNode to the hashtable kvTable->table[index] = newNode; //Return success. return 1; }
//移動制御 void blc_move() { float naname=1; int ud_flag=0, rl_flag=0; //x,y座標のスピード{上,下,右,左} float sp_x[4]={0, 0, 4.0, -4.0}, sp_y[4]={-4.0, 4.0, 0, 0}; unsigned char allow_key[4]={KEY_INPUT_UP, KEY_INPUT_DOWN, KEY_INPUT_RIGHT, KEY_INPUT_LEFT}; unsigned char char_key[4]={KEY_INPUT_F, KEY_INPUT_A, KEY_INPUT_D, KEY_INPUT_S}; for(int i=0; i<2; i++)//上下キーまたはf・aきーがおされているなら、フラグを立てる if(checkKey(allow_key[i])>0 || checkKey(char_key[i])>0) ud_flag=1; for(int i=2; i<4; i++)//左右キーまたはd・sキーが押されているなら、フラグを立てる if(checkKey(allow_key[i])>0 || checkKey(char_key[i])>0) rl_flag=1; //斜めの入力があれば移動スピードをルート2で割る if(ud_flag==1 && rl_flag==1) naname=(float)sqrt(2.0); //入力の可否で移動する for(int i=0; i<4; i++) { //i方向キーが入力されているなら if(checkKey(allow_key[i])>0 || checkKey(char_key[i])>0) { blc.x+=sp_x[i]/naname; blc.y+=sp_y[i]/naname; //自機が画面外に配置されないようにする if(blc.y<HET_MIN) blc.y=HET_MIN; if(blc.y>HET_MAX) blc.y=HET_MAX; if(blc.x<WID_MIN) blc.x=WID_MIN; if(blc.x>WID_MAX) blc.x=WID_MAX; } } }
//main driver function int main(int argc, char **argv) { int listenfd, connfd, port; socklen_t clientlen; struct sockaddr_in clientaddr; struct hostent; unsigned int secretKey; if (argc != 3) { fprintf(stderr, "usage: %s <port> <secretKey>\n", argv[0]); exit(0); } port = atoi(argv[1]); secretKey = atoi(argv[2]); listenfd = Open_listenfd(port); while (1) { clientlen = sizeof(clientaddr); connfd = Accept(listenfd, (SA *)&clientaddr, &clientlen); int requestType = -1; int status = -1; rio_t rio; Rio_readinitb(&rio, connfd); int KeyCheck = checkKey(&rio, secretKey); if (KeyCheck == 0) { requestType = getRequest(&rio); if (requestType == 0) { printf("Request Type = get\n"); status = retrieveFile(&rio, connfd); } else if (requestType == 1) { printf("Request Type = put\n"); status = store(&rio, connfd); } else if (requestType == 2) { printf("Request Type = del\n"); status = deleteRequest(&rio, connfd); } else if (requestType == 3) { printf("Request Type = list\n"); status = listFilesRequest(&rio, connfd); } else { printf("Request Type = invalid"); } } if (status == 0) { printf("Operation Status = Success\n"); } else { printf("Operation Status = error\n"); } printf("-------------------------------\n"); Close(connfd); } exit(0); }
void ViewReadLinetree3::checkKey(const QString&){ checkKey(); }
void KeyHandler::onKeyboard(unsigned char key, int, int) { keys[key] = true; checkKey(key); }
int BaseNet::connectModule(MessageDelivery* msgDelivery, int portno, const char* moduleHostname, char* authorizationKey) { struct hostent *moduleHostnameHostent; int sockModule; int n; int sum_n = 0; int len =0; struct sockaddr_in serv_addr; char buffer[SIZE_AUTORIZATION_KEY]; pthread_t* newThread; ModuleThreadParam* moduleThreadParam; moduleHostnameHostent = gethostbyname(moduleHostname); sockModule = socket(AF_INET, SOCK_STREAM, 0); if (sockModule < 0) { std::cout << "ERROR opening socket" << std::endl; return -1; } if (moduleHostnameHostent == NULL) { std::cout << "ERROR, no such host" << std::endl; return -2; } bzero((char *) &serv_addr, sizeof(serv_addr)); serv_addr.sin_family = AF_INET; bcopy((char *)(moduleHostnameHostent->h_addr), (char *)&serv_addr.sin_addr.s_addr, moduleHostnameHostent->h_length); serv_addr.sin_port = htons(portno); while(true) { if (connect(sockModule,(struct sockaddr *) &serv_addr,sizeof(serv_addr)) < 0) { std::cout << "ERROR connecting module" << std::endl; } n = read(sockModule, buffer, SIZE_AUTORIZATION_KEY); //write(sockModule, "ok", 2); if(!n) continue; if(checkKey(authorizationKey, buffer)) { newThread = new pthread_t(); moduleThreadParam = (ModuleThreadParam*) malloc(sizeof(ModuleThreadParam)); moduleThreadParam->sock = sockModule; moduleThreadParam->baseNet = this; moduleThreadParam->messageDelivery = msgDelivery; pthread_create(newThread, NULL, moduleThreadFunction, (void*) moduleThreadParam); return sockModule; } } return 0; }
/*! * @brief Set parameters * @param cmd Command to change parameters * @return 0 if no error */ int CommentGenerator::setParams(std::string &cmd){ std::string::size_type loc = 0; int res; //flags bool delimiter_required = false; bool font_set = false; bool scale_set = false; bool color_set = false; bool thick_set = false; while((loc!=std::string::npos)&&(loc<cmd.size())){ //if not empty, read command //std::cout << loc << '/' << cmd.size() << std::endl; // ------------- Ignore spaces ----------------------------- if(cmd[loc] == ' '){ loc++; continue; } // ------------ End ignore spaces -------------------------- // --------------- Check delimiter ------------------------- if(delimiter_required){ if(cmd[loc] == ','){ loc++; delimiter_required = false; continue; }else{ std::cerr << "Error in CommentGenerator::setParams(): invalid command - expected \',\'" << std::endl; return -1; } } // ------------ End check delimiter ------------------------ // --------------- Check command --------------------------- res = checkKey(cmd, loc); //Check if the command is one of the keys if(res==0){ //if not keys res = checkRGB(cmd, loc); //Check if the command is an RGB command if(res==0){ //if not RGB command res = checkSIZE(cmd, loc); //Check if the command is a number } } //Check result if(res>0){ delimiter_required = true; if(res==SET_FONT){ if(font_set){ std::cerr << "Warning in CommentGenerator::setParams(): multiple font paramters in command" << std::endl; } font_set = true; }else if(res==SET_SCALE){ if(scale_set){ std::cerr << "Warning in CommentGenerator::setParams(): multiple scale paramters in command" << std::endl; } scale_set = true; }else if(res==SET_COLOR){ if(color_set){ std::cerr << "Warning in CommentGenerator::setParams(): multiple color paramters in command" << std::endl; } color_set = true; }else if(res==SET_THICKNESS){ if(thick_set){ std::cerr << "Warning in CommentGenerator::setParams(): multiple thickness paramters in command" << std::endl; } thick_set = true; }else if(res==SET_SCALE_AND_THICKNESS){ if(scale_set){ std::cerr << "Warning in CommentGenerator::setParams(): multiple scale paramters in command" << std::endl; } if(thick_set){ std::cerr << "Warning in CommentGenerator::setParams(): multiple thickness paramters in command" << std::endl; } scale_set = true; thick_set = true; } }else if(res<0){ //error in command return -1; }else{ //cannot find any commands std::cerr << "Error in CommentGenerator::setParams(): invalid command - command undefined" << std::endl; return -1; } // --------------- End check command ----------------------- } //end while((loc!=std::string::npos)&&(loc<cmd.size())) return 0; }
bool Scene::playTitle(int title, int time, int mode) { bool interrupted = false; int startTime = _vm->_system->getMillis(); int frameTime = 0; int curTime; int assignedId; int phase = 0; bool done = false; bool playParameter = true; static PalEntry cur_pal[PAL_ENTRIES]; static PalEntry pal_cut[PAL_ENTRIES]; Surface *backBufferSurface = _vm->_render->getBackGroundSurface(); // Load the cutaway _vm->_anim->setCutAwayMode(mode); _vm->_frameCount = 0; _vm->_gfx->getCurrentPal(cur_pal); assignedId = _vm->_anim->playCutaway(title, false); _vm->_gfx->getCurrentPal(pal_cut); while (!done && !_vm->shouldQuit()) { curTime = _vm->_system->getMillis(); switch (phase) { case 0: // fadeout case 1: // fadeout 100% case 7: // fadeout case 8: // fadeout 100% _vm->_gfx->palToBlack(cur_pal, (double)(curTime - startTime) / kNormalFadeDuration); // fall through case 3: // fadein case 4: // fadein 100% if (phase == 3 || phase == 4) _vm->_gfx->blackToPal(pal_cut, (double)(curTime - startTime) / kNormalFadeDuration); if (curTime - startTime > kNormalFadeDuration) { phase++; if (phase == 2 || phase == 5 || phase == 9) startTime = curTime; break; } break; case 2: // display background _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); phase++; startTime = curTime; break; case 5: // playback if (time < 0) { if (_vm->_frameCount >= -time) { phase++; break; } } else { if (curTime - startTime >= time * 1000) { phase++; break; } } if (checkKey()) { _vm->_scene->cutawaySkip(); interrupted = true; phase = 6; // end playback and fade out break; } if (_vm->_anim->getCycles(assignedId)) { // IHNM demo has 0 frames logo if (curTime - frameTime > _vm->_anim->getFrameTime(assignedId)) { _vm->_anim->play(assignedId, 0, playParameter); if (playParameter == true) // Do not loop animations playParameter = false; frameTime = curTime; _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); } } break; case 6: // playback end startTime = curTime; _vm->_gfx->getCurrentPal(cur_pal); phase++; break; case 9: // end done = true; break; } _vm->_system->updateScreen(); _vm->_system->delayMillis(10); } // Clean up _vm->_anim->endVideo(); memset((byte *)backBufferSurface->getPixels(), 0, backBufferSurface->w * backBufferSurface->h); _vm->_system->copyRectToScreen(backBufferSurface->getPixels(), backBufferSurface->w, 0, 0, backBufferSurface->w, backBufferSurface->h); return interrupted; }
int main(){ CBByteArray * walletKeyString = CBNewByteArrayFromString("xpub6DRhpXssnj7X6CwJgseK9oyFxSC8jk6nJz2SWkf5pjsQs12xv89Dfr627TtaZKkFbG6Aq23fmaNaf5KRo9iGfEXTTXvtd6gsXJTB8Sdah3B", false); CBChecksumBytes * walletKeyData = CBNewChecksumBytesFromString(walletKeyString, false); CBHDKey * cbkey = CBNewHDKeyFromData(CBByteArrayGetData(CBGetByteArray(walletKeyData))); CBAddress * address = CBNewAddressFromRIPEMD160Hash(CBHDKeyGetHash(cbkey), CB_NETWORK_PRODUCTION, false); CBByteArray * str = CBChecksumBytesGetString(CBGetChecksumBytes(address)); printf("%s\n", CBByteArrayGetData(str)); CBReleaseObject(address); // Test type if (CBHDKeyGetType(CB_HD_KEY_VERSION_PROD_PRIVATE) != CB_HD_KEY_TYPE_PRIVATE) { printf("CB_HD_KEY_VERSION_PROD_PRIVATE TYPE FAIL\n"); return EXIT_FAILURE; } if (CBHDKeyGetType(CB_HD_KEY_VERSION_PROD_PUBLIC) != CB_HD_KEY_TYPE_PUBLIC) { printf("CB_HD_KEY_VERSION_PROD_PUBLIC TYPE FAIL\n"); return EXIT_FAILURE; } if (CBHDKeyGetType(CB_HD_KEY_VERSION_TEST_PRIVATE) != CB_HD_KEY_TYPE_PRIVATE) { printf("CB_HD_KEY_VERSION_TEST_PRIVATE TYPE FAIL\n"); return EXIT_FAILURE; } if (CBHDKeyGetType(CB_HD_KEY_VERSION_TEST_PUBLIC) != CB_HD_KEY_TYPE_PUBLIC) { printf("CB_HD_KEY_VERSION_TEST_PUBLIC TYPE FAIL\n"); return EXIT_FAILURE; } // Test HMAC-SHA512 uint8_t hash[64]; CBHDKeyHmacSha512((uint8_t [37]){0x2f, 0xf7, 0xd6, 0x9f, 0x7a, 0x59, 0x0b, 0xb0, 0x5e, 0x68, 0xd1, 0xdc, 0x0f, 0xcf, 0x8d, 0xc2, 0x17, 0x59, 0xc9, 0x39, 0xbb, 0x6b, 0x9b, 0x02, 0x0f, 0x65, 0x5d, 0x53, 0x85, 0x3c, 0xb5, 0xc2, 0x14, 0x61, 0x4b, 0x24, 0x42}, (uint8_t [32]){0xa2, 0x55, 0x21, 0xe3, 0xc5, 0x5b, 0x65, 0xd1, 0xcf, 0x25, 0x4b, 0x6c, 0x85, 0x23, 0xdc, 0xbf, 0x89, 0x46, 0x8d, 0x1f, 0x09, 0x1f, 0x15, 0x87, 0x6b, 0xbb, 0xc7, 0xfd, 0xd5, 0x44, 0x28, 0x43}, hash); if (memcmp(hash, (uint8_t [64]){0xfa, 0xa7, 0x9d, 0x85, 0xe0, 0xe4, 0x3d, 0xae, 0x8c, 0x3f, 0x99, 0xf0, 0x70, 0xdf, 0x97, 0x56, 0x2b, 0x3f, 0xbb, 0x17, 0x35, 0x20, 0xe0, 0x87, 0x32, 0xa6, 0x64, 0xca, 0xd4, 0x55, 0x0b, 0xbe, 0xc1, 0x11, 0xe5, 0xf8, 0x80, 0xdb, 0xb7, 0x3d, 0x67, 0x74, 0xbb, 0xc2, 0x9f, 0x67, 0xd9, 0x67, 0xaa, 0x10, 0xac, 0x60, 0x18, 0x90, 0x7f, 0x35, 0x53, 0xe3, 0x21, 0x38, 0xf6, 0x5b, 0xbe, 0x69}, 64) != 0) { printf("HMAC FAIL\n"); return EXIT_FAILURE; } for (uint8_t x = 0; x < NUM_TEST_VECTORS; x++) { // Deserialise private key CBByteArray * masterString = CBNewByteArrayFromString(testVectors[x][0].privString, true); CBChecksumBytes * masterData = CBNewChecksumBytesFromString(masterString, false); CBReleaseObject(masterString); CBHDKey * key = CBNewHDKeyFromData(CBByteArrayGetData(CBGetByteArray(masterData))); CBReleaseObject(masterData); checkKey(key, x, 0); for (uint8_t y = 0; y < NUM_CHILDREN; y++) { if (testVectors[x][y+1].childID.priv == false) { // Derive public child and check public key is correct by address CBHDKey * newKey = CBNewHDKey(false); key->versionBytes = CB_HD_KEY_VERSION_PROD_PUBLIC; CBHDKeyDeriveChild(key, testVectors[x][y+1].childID, newKey); key->versionBytes = CB_HD_KEY_VERSION_PROD_PRIVATE; CBAddress * address = CBNewAddressFromRIPEMD160Hash(CBHDKeyGetHash(newKey), CB_NETWORK_PRODUCTION, false); CBByteArray * str = CBChecksumBytesGetString(CBGetChecksumBytes(address)); CBReleaseObject(address); if (memcmp(CBByteArrayGetData(str), testVectors[x][y + 1].addr, 34) != 0) { printf("ADDR FROM PUB FAIL AT %u - %u\n", x, y + 1); exit(EXIT_FAILURE); } CBReleaseObject(str); // Check serialisation of public key uint8_t * keyData = malloc(82); CBHDKeySerialise(newKey, keyData); CBChecksumBytes * checksumBytes = CBNewChecksumBytesFromBytes(keyData, 82, false); str = CBChecksumBytesGetString(checksumBytes); CBReleaseObject(checksumBytes); if (memcmp(CBByteArrayGetData(str), testVectors[x][y+1].pubString, 111) != 0) { printf("PUBLIC KEY STRING FROM PUB FAIL AT %u - %u\n", x, y); exit(EXIT_FAILURE); } CBReleaseObject(str); free(newKey); } // Derive private child CBHDKey * newKey = CBNewHDKey(true); CBHDKeyDeriveChild(key, testVectors[x][y+1].childID, newKey); free(key); key = newKey; checkKey(key, x, y+1); } free(key); } return EXIT_SUCCESS; }
/***************************************************************************** * * Description: * Implements example game * ****************************************************************************/ void playExample(void) { gameStatus = GAME_NOT_STARTED; setupGame(FALSE); lcdGotoxy(5,40); lcdColor(0,0xe0); lcdPuts("Press to start"); while(gameStatus != GAME_END) { tU8 anyKey; anyKey = checkKey(); switch(gameStatus) { case GAME_NOT_STARTED: if (anyKey != KEY_NOTHING) { gameStatus = GAME_RUNNING; setupGame(TRUE); } break; case GAME_RUNNING: if (anyKey != KEY_NOTHING) { if (anyKey == KEY_UP) { if(isValid(currXpos, currYpos, shift[currFigure])) currFigure = shift[currFigure]; } else if (anyKey == KEY_DOWN) { if(isValid(currXpos, currYpos+1, currFigure)) currYpos++; } else if (anyKey == KEY_RIGHT) { if(isValid(currXpos+1, currYpos, currFigure)) currXpos++; } else if (anyKey == KEY_LEFT) { if(isValid(currXpos-1, currYpos, currFigure)) currXpos--; } else if (anyKey == KEY_CENTER) gameStatus = GAME_OVER; advanceGame(); osSleep(1); } else { advanceGame(); osSleep(1); } break; case GAME_OVER: { tMenu menu; menu.xPos = 10; menu.yPos = 40; menu.xLen = 6+(12*8); menu.yLen = 4*14; menu.noOfChoices = 2; menu.initialChoice = 0; menu.pHeaderText = "Game over!"; menu.headerTextXpos = 20; menu.pChoice[0] = "Restart game"; menu.pChoice[1] = "End game"; menu.bgColor = 0; menu.borderColor = 0x6d; menu.headerColor = 0; menu.choicesColor = 0xfd; menu.selectedColor = 0xe0; switch(drawMenu(menu)) { case 0: gameStatus = GAME_RUNNING; setupGame(TRUE); break; //Restart game case 1: gameStatus = GAME_END; break; //End game default: break; } } break; default: gameStatus = GAME_END; break; } } }
/// check key is present and type is correct, return false if key not found or type is not correct bool checkKeyAndType(const Json::Value& value, const std::string& key, const Json::ValueType& valueType) { return (checkKey(value, key) && checkType(value, key, valueType)); }
ViewReadLinetree3::ViewReadLinetree3( bool open, QWidget* parent, const char* name, bool modal, WFlags fl ) : QDialog( parent, name, modal, fl ), __open(open) { if ( !name ) setName( "ViewReadLinetree3" ); resize( 500, 250 ); if(open)setCaption( tr( "Read Linetree" ) ); else setCaption( tr( "Save Linetree" ) ); buttonLig = new QToolButton( this, "buttonLig" ); buttonLig->setGeometry( QRect( 450, 10, 40, 21 ) ); buttonLig->setText( tr( "..." ) ); QObject::connect( buttonLig,SIGNAL(clicked()),this,SLOT(SelectLigFile())); QLabel * labelDta = new QLabel( this, "labelDta" ); labelDta->setGeometry( QRect( 10, 60, 61, 20 ) ); labelDta->setText( tr( "Dta File" ) ); buttonDta = new QToolButton( this, "buttonDta" ); buttonDta->setGeometry( QRect( 450, 60, 40, 21 ) ); buttonDta->setText( tr( "..." ) ); QObject::connect( buttonDta,SIGNAL(clicked()),this,SLOT(SelectDtaFile())); QLabel * labelSmb = new QLabel( this, "labelSmb" ); labelSmb->setGeometry( QRect( 10, 110, 61, 20 ) ); labelSmb->setText( tr( "SMB Path" ) ); buttonSmb = new QToolButton( this, "buttonSmb" ); buttonSmb->setGeometry( QRect( 450, 110, 40, 21 ) ); buttonSmb->setText( tr( "..." ) ); QObject::connect( buttonSmb,SIGNAL(clicked()),this,SLOT(SelectSMBPath())); QLabel * labelLig = new QLabel( this, "labelLig" ); labelLig->setGeometry( QRect( 10, 10, 61, 20 ) ); labelLig->setText( tr( "Lig File" ) ); editLig = new QLineEdit( this, "editLig" ); editLig->setGeometry( QRect( 100, 10, 350, 22 ) ); editDta = new QLineEdit( this, "editDta" ); editDta->setGeometry( QRect( 100, 60, 350, 22 ) ); if(!DTA_FILENAME.isEmpty())editDta->setText( tr(DTA_FILENAME) ); editSmb = new QLineEdit( this, "editSmb" ); editSmb->setGeometry( QRect( 100, 110, 350, 22 ) ); if(SMB_PATH.isEmpty()) { SMB_PATH = (TOOLS(getPlantGLDir())+"share/plantgl/SMBFiles").c_str() ; } if(!SMB_PATH.isEmpty())editSmb->setText( tr( SMB_PATH ) ); labelKey = new QLabel( this, "labelKey" ); labelKey->setGeometry( QRect( 10, 160, 89, 20 ) ); if(open)labelKey->setText( tr( "Key :" ) ); else labelKey->setText("Key : [AMAPmod]"); editKey = new QLineEdit( this, "editKey" ); editKey->setGeometry( QRect( 100, 160, 350, 22 ) ); editKey->setReadOnly(open); editKey->setFont(QFont("courier", 8)); QPalette pal = editKey->palette(); QColorGroup cg = pal.active(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setActive( cg ); cg = pal.inactive(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setInactive( cg ); cg = pal.disabled(); cg.setColor( QColorGroup::Base, QColor( 212, 208, 200) ); pal.setDisabled( cg ); editKey->setProperty( "palette", pal ); editKey->setEchoMode(QLineEdit::Password); if(!open)editKey->setText(PGL(LinetreePrinter)::PROTECTION.c_str()); QObject::connect( editKey,SIGNAL(textChanged(const QString&)),this,SLOT(checkKey(const QString&))); DblClickEater * dblCkEater = new DblClickEater(editKey); labelKey->installEventFilter( dblCkEater ); if(!open){ QToolButton * buttonKey = new QToolButton( this, "buttonKey" ); buttonKey->setGeometry( QRect( 450, 160, 40, 21 ) ); buttonKey->setText( tr( "Reset" ) ); QObject::connect( buttonKey,SIGNAL(clicked()),this,SLOT(resetKey())); } buttonCancel = new QPushButton( this, "buttonCancel" ); buttonCancel->setGeometry( QRect( 390, 200, 104, 28 ) ); buttonCancel->setText( tr( "&Cancel" ) ); QObject::connect( buttonCancel,SIGNAL(clicked()),this,SLOT(reject())); buttonOk = new QPushButton( this, "buttonOk" ); buttonOk->setGeometry( QRect( 280, 200, 104, 28 ) ); buttonOk->setText( tr( "&Ok" ) ); QObject::connect( buttonOk,SIGNAL(clicked()),this,SLOT(ok())); endianBox = new QCheckBox( this, "endianBox" ); endianBox->setGeometry( QRect( 10, 205, 90, 20 ) ); endianBox->setText( tr( "Big Endian" ) ); endianBox->setChecked(true); if(open){ QPushButton * buttonTestEndianess = new QPushButton( this, "TestEndianess" ); buttonTestEndianess->setGeometry( QRect( 100, 200, 54, 28 ) ); buttonTestEndianess->setText( tr( "Test" ) ); QObject::connect( buttonTestEndianess,SIGNAL(clicked()),this,SLOT(testEndianess())); } if(!LIG_FILENAME.isEmpty()){ editLig->setText( tr(LIG_FILENAME) ); checkKey(); } }
void ViewReadLinetree3::setEndianess( bool bigEndian ){ endianBox->setChecked(bigEndian); checkKey(); }
int main(int argc, char* argv[]) { printf("\n NODE_BIND:%d, NUMA:%d, CPU_BIND:%d, FIRST_TOUCH:%d\n",NODE_BIND, NUMA, CPU_BIND, FIRST_TOUCH); int repetitions, // number of repetition maxThreads, // max number of threads it, N; // array size; int bitCount = 1; int * key; // array of keys long * dataIn; // input data long * dataSTL; // input stl data long * dataRadix; // input radix data repetitions = 1; #pragma omp parallel maxThreads = omp_get_num_threads(); if(argc ==1 ){ printf("prog input_file number_of_elements bit_count number_of_repetitions\n"); printf("NO INPUT FILE"); return 0; } if(argc == 2){ printf("prog input_file number_of_elements bit_count number_of_repetitions\n"); printf("NO ELEMENT COUNT\n"); return 0; } if(argc >2 ){ N = (int) strtol(argv[2], NULL, 10); } if(argc >3){ int tmp; tmp = (int) strtol(argv[3], NULL, 10); if ((tmp > 0) && (tmp<=16 )) // limit bit count bitCount = tmp; } if(argc >4){ int tmp; tmp = (int) strtol(argv[4], NULL, 10); if ((tmp > 0) && (tmp<=10000 )) // limit repetitions repetitions = tmp; } int *input; size_t N2; printf( "Reading data from file.\n" ); if( readIntArrayFile( argv[1], &input, &N2 ) ) return 1; printf( "Data reading done.\n" ); if( (N2<(size_t)N) || (N<=0) ) N = N2; printf( "\nPARALLEL STL SORT for N=%d, max threads = %d, test repetitions: %d\n", N, maxThreads, repetitions); dataIn = new long[N]; dataSTL = new long[N]; #ifdef _WIN32 dataRadix = new long[N]; key = new int[N]; #endif #ifdef linux key = new int[N]; #if NUMA==0 dataRadix = new long[N]; #elif NUMA==1 dataRadix = (long*) numa_alloc_interleaved(N * sizeof(long)); #elif NUMA==2 dataRadix = (long*)numa_alloc_onnode(sizeof(long)*N,1); #endif #endif VTimer stlTimes(maxThreads); VTimer radixTimes(maxThreads); #if TIME_COUNT==1 VTimer partTimes(TIMERS_COUNT); #endif #if FLUSH_CACHE==1 #ifdef linux CacheFlusher cf; #endif #endif for(long i=0;i<N;i++) dataIn[i]=input[i]; delete[] input; // loop from 1 to maxThreads for (int t = 1; t <= maxThreads; t++) { int i; #if TIME_COUNT==1 partTimes.reset(); #endif #if CALC_REF==1 // parallel STL for (it = 0; it < repetitions; it++) { setThreadsNo(t, maxThreads); #pragma omp parallel for private(i) for (i = 0; i < N; i++) dataSTL[i] = dataIn[i]; #if FLUSH_CACHE==1 #ifdef linux cf.flush(); #endif #endif stlTimes.timerStart(t-1); #ifdef linux __gnu_parallel::sort(dataSTL, dataSTL + N); #endif #ifdef _WIN32 std::sort(dataSTL, dataSTL + N); #endif stlTimes.timerEnd(t-1); } #if FLUSH_CACHE==1 #ifdef linux cf.flush(); #endif #endif #endif // radix sort V1 for (it = 0; it < repetitions; it++) { setThreadsNo(t, maxThreads); #pragma omp parallel for private(i) default(shared) for (i = 0; i < N; i++){ dataRadix[i] = dataIn[i]; key[i]=i; } #if FLUSH_CACHE==1 #ifdef linux cf.flush(); #endif #endif omp_set_num_threads(t); radixTimes.timerStart(t-1); #if TIME_COUNT==1 prsort::pradsort<long,int>(dataRadix,key, N, bitCount,&partTimes); #else prsort::pradsort<long,int>(dataRadix,key, N,bitCount,NULL); #endif radixTimes.timerEnd(t-1); } #if CALC_REF==1 printf("|STL SORT(th=%2d) : %1.3fs |\t", t, stlTimes.getTime(t-1)); #endif #if TIME_COUNT==1 for (int i = 0; i < TIMERS_COUNT; i++) { #if CREATE_OUTPUT==1 printf("%d %d %d %d %d %d %d %f\n", NUMA, NODE_BIND, CPU_BIND, FIRST_TOUCH,bitCount , t, i ,partTimes.getTime(i)); #else printf("part%d :%f ", i, partTimes.getTime(i)); #endif } #endif #if CREATE_OUTPUT ==1 printf("%d %d %d %d %d %d calosc %1.3f", NUMA,NODE_BIND,CPU_BIND,FIRST_TOUCH,bitCount, t ,radixTimes.getTime(t-1)); #else printf("|RADIX SORT (th=%2d) : %1.3fs |\t", t, radixTimes.getTime(t-1)); #endif // Attention: checking result only from the last function usage #if CALC_REF==1 checkResults(dataSTL, dataRadix, N); #else printf("\n"); #endif #if CHECK_KEY==1 if(checkKey(dataIn,dataRadix,key,N))printf("Keys are good\n"); #endif } #ifdef linux delete[] key; #if NUMA>0 numa_free(dataRadix, sizeof(long) * N); #else delete[] dataRadix; #endif #endif #ifdef _WIN32 delete[] dataRadix; #endif delete[] dataIn; delete[] dataSTL; #if TIME_COUNT==1 #endif return 0; }
void XCBInput::eventLoop() { xcb_keysym_t pressedKey; xcb_generic_event_t *event; xcb_motion_notify_event_t *motion; xcb_key_press_event_t *kp; xcb_key_release_event_t *kr; while ((event = xcb_poll_for_event(connection))) { switch (event->response_type & ~0x80) { case XCB_MOTION_NOTIFY: motion = reinterpret_cast<xcb_motion_notify_event_t *>(event); mediaLayer->mouseLook(motion->event_x, motion->event_y); break; case XCB_KEY_RELEASE: kr = reinterpret_cast<xcb_key_release_event_t *>(event); pressedKey = xcb_key_symbols_get_keysym(syms, kr->detail, 0); pressedKeys.removeAll(pressedKey); switch (pressedKey) { case XK_Shift_L: inputSpeed = .01; break; } break; case XCB_KEY_PRESS: kp = reinterpret_cast<xcb_key_press_event_t *>(event); pressedKey = xcb_key_symbols_get_keysym(syms, kp->detail, 0); switch (pressedKey) { case XK_Escape: emit shutdown(); break; case XK_m: mediaLayer->toggleMouseGrab(); break; case XK_f: mediaLayer->toggleFullScreen(); break; case XK_p: RenderEngine::Instance().toggleFBO(); break; case XK_c: RenderEngine::Instance().toggleLightView(); break; case XK_Tab: RenderEngine::Instance().toggleWire(); break; case XK_Shift_L: inputSpeed = .1; break; default: pressedKeys.push_back(pressedKey); } break; default: /* Unknown event type, ignore it */ // printf ("Unknown event: %d\n", event->response_type); break; } free(event); } foreach(xcb_keysym_t key, pressedKeys) { checkKey(key); }
void StealthKeyStoreTest::testRandomAccessIteration() { checkKey("3oTYbZG4ZUsJatou8gmtJatRU19Sn5HXDWnhjRStbMpRsyT4UD4hApbnjuvZThmj1TtTgbbLbUiZ9hrKkjRwcTpV7uxBnEoA1ZsiZCw", "{\"address\":\"3oTYbZG4ZUsJatou8gmtJatRU19Sn5HXDWnhjRStbMpRsyT4UD4hApbnjuvZThmj1TtTgbbLbUiZ9hrKkjRwcTpV7uxBnEoA1ZsiZCw\",\"scan\":\"2966bfcaa0e736689eb14ff543f5c396ee41e086651a06bb57d0c3b52c8585c4\",\"spend\":[{\"pub\":\"0281b607128c8211ca903b65aae6e7cb051f66553c8a1ffeee7092aac463c17a05\",\"secret\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"eabb8507072ecaba6964d145dfc6d609\"},\"ciphertext\":\"757e113c66132b33acec2e287d630d4fafda72b31300c53bc9f6ca64991cc64a\",\"kdf\":\"scrypt\",\"kdfparams\":{\"dklen\":32,\"n\":262144,\"p\":1,\"r\":8,\"salt\":\"cabc1fce88dc16f4b968905e057591150fb830b6a87cc19eb62c7ac02cdeffb7\"},\"mac\":\"55d17be909b1589c9db4d7e1d1e017c5ba7892b121df8c6ad6facc152f69eac5\"}}],\"time\":1454983283,\"version\":1}", true); checkKey("3oTYcWA1XeEvkx4JB3MKq8FuSVgESQZG53L8DhMRWY7rnh8tb15cdDLVfGDZKZ5K3XYmwXg3mNSqiZvcWAtXFym4QMR9owhBGTFcgjZ","{\"address\":\"3oTYcWA1XeEvkx4JB3MKq8FuSVgESQZG53L8DhMRWY7rnh8tb15cdDLVfGDZKZ5K3XYmwXg3mNSqiZvcWAtXFym4QMR9owhBGTFcgjZ\",\"scan\":\"b017fb3574239ee68c63aeb9c16c76d8e07e360511df53932feedbd3be453a03\",\"spend\":[{\"pub\":\"030f09073665b53483b2eff73df7c6424352578e037732241ca08512536b36d4dc\",\"secret\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"3d6889095b6b65c7e1ac4b6cd0b9440a\"},\"ciphertext\":\"3618c27251da03981d0910d45253f99f40e8a2fb56960f2a2347084d865a61ad\",\"kdf\":\"scrypt\",\"kdfparams\":{\"dklen\":32,\"n\":262144,\"p\":1,\"r\":8,\"salt\":\"2a8a8e6a603fc3e0e6ebf4d129385e94b5d5e28e9014e2531b403a70a0b661d4\"},\"mac\":\"fd18e450984e73dcfbf9872e0587c48fa6560287bc3a51ff0a2c1eacef73b406\"}}],\"time\":1454983284,\"version\":1}", true); checkKey("3oTYZ99VRU4oAqBarSjVAGZpQ1XfyftWkQYJQZKSRAzWAzCizPFS4sqrfZFXhgpQ473jVUJ5mZ5EYviUp9dfPsnD2kQgLWzFtshbCRf","{\"address\":\"3oTYZ99VRU4oAqBarSjVAGZpQ1XfyftWkQYJQZKSRAzWAzCizPFS4sqrfZFXhgpQ473jVUJ5mZ5EYviUp9dfPsnD2kQgLWzFtshbCRf\",\"scan\":\"89614f860433338a2405daf22f81fbca9eafc4ed68fda64ff560a62cacc8461d\",\"spend\":[{\"pub\":\"02f3a813feef1f06710f7e56f57564c3051d4b006f989d0306415ea9be587c2de1\",\"secret\":{\"cipher\":\"aes-128-ctr\",\"cipherparams\":{\"iv\":\"a53332587289624e0b59c7b32aa50e19\"},\"ciphertext\":\"cbea010dfc9ba2dcf3ad783f6d85d2e740410347b78428fa6d7947c95ed4170c\",\"kdf\":\"scrypt\",\"kdfparams\":{\"dklen\":32,\"n\":262144,\"p\":1,\"r\":8,\"salt\":\"4fbefebf9ba412b11ca4d63c697c1c4528af2c32c39c6c45da61198b20d02606\"},\"mac\":\"fa2fdd3114c5402826d561b5f3bbef51e056b062cc93d03ac28b0591aa64a047\"}}],\"time\":1454983284,\"version\":1}", true); }
/*! This is the main routine of measurement. @param[in,out] prms A pointer to a #AK8975PRMS structure. */ void MeasureSNGLoop(AK8975PRMS* prms) { BYTE i2cData[AKSC_BDATA_SIZE]; int16 i; int16 bData[AKSC_BDATA_SIZE]; // Measuring block data int16 ret; int32 ch; int32 doze; int32_t delay; AKMD_INTERVAL interval; struct timespec tsstart, tsend; if (openKey() < 0) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); return; } if (openFormation() < 0) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); return; } // Get initial interval GetValidInterval(CSPEC_INTERVAL_SNG, &interval); // Initialize if(InitAK8975_Measure(prms) != AKD_SUCCESS){ return; } while(TRUE){ // Get start time if (clock_gettime(CLOCK_REALTIME, &tsstart) < 0) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); return; } // Set to SNG measurement pattern (Set CNTL register) if (AKD_SetMode(AK8975_MODE_SNG_MEASURE) != AKD_SUCCESS) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); return; } // .! : 获取 M snesor 的原始数据. 这里可能阻塞. // Get measurement data from AK8975 // ST1 + (HXL + HXH) + (HYL + HYH) + (HZL + HZH) + ST2 // = 1 + (1 + 1) + (1 + 1) + (1 + 1) + 1 = 8 bytes if (AKD_GetMagneticData(i2cData) != AKD_SUCCESS) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); return; } // Copy to local variable // DBGPRINT(DBG_LEVEL3, "%s: bData(Hex)=", __FUNCTION__); for(i=0; i<AKSC_BDATA_SIZE; i++){ bData[i] = i2cData[i]; // DBGPRINT(DBG_LEVEL3, "%02x,", bData[i]); } // DBGPRINT(DBG_LEVEL3, "\n"); D_WHEN_REPEAT(100, "raw mag x : %d, raw mag y : %d, raw mag z : %d.", (signed short)(bData[1] + (bData[2] << 8) ), (signed short)(bData[3] + (bData[4] << 8) ), (signed short)(bData[5] + (bData[6] << 8) ) ); // .! : // Get acceelration sensor's measurement data. if (GetAccVec(prms) != AKRET_PROC_SUCCEED) { return; } /* DBGPRINT(DBG_LEVEL3, "%s: acc(Hex)=%02x,%02x,%02x\n", __FUNCTION__, prms->m_avec.u.x, prms->m_avec.u.y, prms->m_avec.u.z); */ ret = MeasuringEventProcess( bData, prms, getFormation(), interval.decimator, CSPEC_CNTSUSPEND_SNG ); // Check the return value if(ret == AKRET_PROC_SUCCEED){ if(prms->m_cntSuspend > 0){ // Show message DBGPRINT(DBG_LEVEL2, "Suspend cycle count = %d\n", prms->m_cntSuspend); } else if (prms->m_callcnt <= 1){ // Check interval if (AKD_GetDelay(&delay) != AKD_SUCCESS) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); } else { GetValidInterval(delay, &interval); } } // Display(or dispatch) the result. Disp_MeasurementResultHook(prms); } else if(ret == AKRET_FORMATION_CHANGED){ // Switch formation. SwitchFormation(prms); } else if(ret == AKRET_DATA_READERROR){ DBGPRINT(DBG_LEVEL2, "Data read error occurred.\n\n"); } else if(ret == AKRET_DATA_OVERFLOW){ DBGPRINT(DBG_LEVEL2, "Data overflow occurred.\n\n"); } else if(ret == AKRET_HFLUC_OCCURRED){ DBGPRINT(DBG_LEVEL2, "AKSC_HFlucCheck did not return 1.\n\n"); } else{ // Does not reach here LOGE("MeasuringEventProcess has failed.\n"); break; } // Check user order ch = checkKey(); if (ch == AKKEY_STOP_MEASURE) { break; } else if(ch < 0){ LOGD("Bad key code.\n"); break; } // Get end time if (clock_gettime(CLOCK_REALTIME, &tsend) < 0) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); return; } // calculate wait time doze = interval.interval - ((tsend.tv_sec - tsstart.tv_sec)*1000000 + (tsend.tv_nsec - tsstart.tv_nsec)/1000); if (doze < 0) { doze = 0; } // Adjust sampling frequency // DBGPRINT(DBG_LEVEL3, "Sleep %d usec.\n", doze); usleep(doze); } // Set to PowerDown mode if (AKD_SetMode(AK8975_MODE_POWERDOWN) != AKD_SUCCESS) { DBGPRINT(DBG_LEVEL1, "%s:%d Error.\n", __FUNCTION__, __LINE__); } closeFormation(); closeKey(); }
void StealthKeyStoreTest::testGetEmpty() { checkKey("3oTYdxNtjoTqHdZFTD63VFwwHyywfbo5F7HxgiT4YQH3g7BEM48k23SMqowDBCxC5rLr2KNTvwpXQyBzDQLtouk3LkRKdVVbUNgNfio", "", false); }
vector<ZZ> Buyer::pay(const vector<string>& keys) { checkKey(keys); return endorsement; }
void MultiLevelStore::add(const char *key, const char *value){ std::string tmpKey(key); if(!checkKey(tmpKey)) return; mData.insert(std::make_pair(tmpKey, std::string(value))); return; }
/***************************************************************************** * * Description: * A process entry function * ****************************************************************************/ void displayStartupSequence(void) { tU32 step = 0; tU8 anyKey = KEY_NOTHING; for(step=0; step<=48; step++) { anyKey = checkKey(); if (anyKey != KEY_NOTHING) break; switch(step) { case 0: lcdColor(0xfd,0x00); lcdClrscr(); break; case 1: lcdIcon(0, 0, 130, 90, _fun_0_130x90c[2], _fun_0_130x90c[3], &_fun_0_130x90c[4]); break; case 2: lcdGotoxy(8,100); lcdPutchar('H'); break; case 3: lcdPutchar('A'); break; case 4: lcdPutchar('V'); break; case 5: lcdPutchar('E'); lcdIcon(0, 0, 130, 90, _fun_1_130x90c[2], _fun_1_130x90c[3], &_fun_1_130x90c[4]); break; case 6: lcdGotoxy(8+(8*4),100); lcdPutchar(' '); break; case 7: lcdPutchar('S'); break; case 8: lcdPutchar('O'); break; case 9: lcdPutchar('M'); lcdIcon(0, 0, 130, 90, _fun_0_130x90c[2], _fun_0_130x90c[3], &_fun_0_130x90c[4]); break; case 10: lcdGotoxy(8+(8*8),100); lcdPutchar('E'); break; case 11: lcdPutchar(' '); break; case 12: lcdPutchar('F'); break; case 13: lcdPutchar('U'); lcdIcon(0, 0, 130, 90, _fun_1_130x90c[2], _fun_1_130x90c[3], &_fun_1_130x90c[4]); break; case 14: lcdGotoxy(8+(8*12),100); lcdPutchar('N'); break; case 15: lcdPutchar('!'); break; case 17: case 25: case 33: case 41: lcdIcon(0, 0, 130, 90, _fun_0_130x90c[2], _fun_0_130x90c[3], &_fun_0_130x90c[4]); break; case 21: case 29: case 37: case 45: lcdIcon(0, 0, 130, 90, _fun_1_130x90c[2], _fun_1_130x90c[3], &_fun_1_130x90c[4]); break; default: break; } osSleep(15); } if (anyKey == KEY_NOTHING) for(step=0; step<=257; step++) { anyKey = checkKey(); if (anyKey != KEY_NOTHING) break; switch(step) { case 0: lcdColor(0xff,0x00); lcdClrscr(); break; case 1: lcdIcon(16, 0, 97, 60, _ea_97x60c[2], _ea_97x60c[3], &_ea_97x60c[4]); break; case 2: lcdGotoxy(16,66); lcdPutchar('D'); break; case 3: lcdPutchar('e'); break; case 4: lcdPutchar('s'); break; case 5: lcdPutchar('i'); break; case 6: lcdPutchar('g'); break; case 7: lcdPutchar('n'); break; case 8: lcdPutchar('e'); break; case 9: lcdPutchar('d'); break; case 10: lcdPutchar(' '); break; case 11: lcdPutchar('a'); break; case 12: lcdPutchar('n'); break; case 13: lcdPutchar('d'); break; case 14: lcdGotoxy(20,80); lcdPutchar('p'); break; case 15: lcdPutchar('r'); break; case 16: lcdPutchar('o'); break; case 17: lcdPutchar('d'); break; case 18: lcdPutchar('u'); break; case 19: lcdPutchar('c'); break; case 20: lcdPutchar('e'); break; case 21: lcdPutchar('d'); break; case 22: lcdPutchar(' '); break; case 23: lcdPutchar('b'); break; case 24: lcdPutchar('y'); break; case 25: lcdGotoxy(0,96); lcdPutchar('E'); break; case 26: lcdPutchar('m'); break; case 27: lcdPutchar('b'); break; case 28: lcdPutchar('e'); break; case 29: lcdPutchar('d'); break; case 30: lcdPutchar('d'); break; case 31: lcdPutchar('e'); break; case 32: lcdPutchar('d'); break; case 33: lcdPutchar(' '); break; case 34: lcdPutchar('A'); break; case 35: lcdPutchar('r'); break; case 36: lcdPutchar('t'); break; case 37: lcdPutchar('i'); break; case 38: lcdPutchar('s'); break; case 39: lcdPutchar('t'); break; case 40: lcdPutchar('s'); break; case 41: lcdGotoxy(32,112); lcdPutchar('('); break; case 42: lcdPutchar('C'); break; case 43: lcdPutchar(')'); break; case 44: lcdPutchar(' '); break; case 45: lcdPutchar('2'); break; case 46: lcdPutchar('0'); break; case 47: lcdPutchar('0'); break; case 48: lcdPutchar('6'); break; case 60: lcdClrscr(); lcdIcon(0, 0, 128, 39, _future_128x39c[2], _future_128x39c[3], &_future_128x39c[4]); break; case 61: lcdGotoxy(8,44); lcdPutchar('i'); break; case 62: lcdPutchar('n'); break; case 63: lcdPutchar(' '); break; case 64: lcdPutchar('c'); break; case 65: lcdPutchar('o'); break; case 66: lcdPutchar('o'); break; case 67: lcdPutchar('p'); break; case 68: lcdPutchar('e'); break; case 69: lcdPutchar('r'); break; case 70: lcdPutchar('a'); break; case 71: lcdPutchar('t'); break; case 72: lcdPutchar('i'); break; case 73: lcdPutchar('o'); break; case 74: lcdPutchar('n'); break; case 75: lcdGotoxy(20,60); lcdPutchar('w'); break; case 76: lcdPutchar('i'); break; case 77: lcdPutchar('t'); break; case 78: lcdPutchar('h'); break; case 79: lcdPutchar(' '); break; case 80: lcdPutchar('F'); break; case 81: lcdPutchar('u'); break; case 82: lcdPutchar('t'); break; case 83: lcdPutchar('u'); break; case 84: lcdPutchar('r'); break; case 85: lcdPutchar('e'); break; case 86: lcdGotoxy(4,76); lcdPutchar('E'); break; case 87: lcdPutchar('l'); break; case 88: lcdPutchar('e'); break; case 89: lcdPutchar('c'); break; case 90: lcdPutchar('t'); break; case 91: lcdPutchar('r'); break; case 92: lcdPutchar('o'); break; case 93: lcdPutchar('n'); break; case 94: lcdPutchar('i'); break; case 95: lcdPutchar('c'); break; case 96: lcdPutchar('s'); break; case 97: lcdPutchar(' '); break; case 98: lcdPutchar('a'); break; case 99: lcdPutchar('n'); break; case 100: lcdPutchar('d'); break; case 105: lcdIcon(3, 98, 122, 25, _philips_122x25c[2], _philips_122x25c[3], &_philips_122x25c[4]); break; case 120: lcdClrscr(); lcdIcon(22, 3, 85, 40, _segger_85x40c[2], _segger_85x40c[3], &_segger_85x40c[4]); break; case 121: lcdGotoxy(12,48); lcdPutchar('E'); break; case 122: lcdPutchar('m'); break; case 123: lcdPutchar('b'); break; case 124: lcdPutchar('e'); break; case 125: lcdPutchar('d'); break; case 126: lcdPutchar('d'); break; case 127: lcdPutchar('e'); break; case 128: lcdPutchar('d'); break; case 129: lcdPutchar(' '); break; case 130: lcdPutchar('J'); break; case 131: lcdPutchar('T'); break; case 132: lcdPutchar('A'); break; case 133: lcdPutchar('G'); break; case 134: lcdGotoxy(40,64); lcdPutchar('J'); break; case 135: lcdPutchar('-'); break; case 136: lcdPutchar('l'); break; case 137: lcdPutchar('i'); break; case 138: lcdPutchar('n'); break; case 139: lcdPutchar('k'); break; case 140: lcdGotoxy(20,80); lcdPutchar('t'); break; case 141: lcdPutchar('e'); break; case 142: lcdPutchar('c'); break; case 143: lcdPutchar('h'); break; case 144: lcdPutchar('n'); break; case 145: lcdPutchar('o'); break; case 146: lcdPutchar('l'); break; case 147: lcdPutchar('o'); break; case 148: lcdPutchar('g'); break; case 149: lcdPutchar('y'); break; case 150: lcdGotoxy(16,94); lcdPutchar('l'); break; case 151: lcdPutchar('i'); break; case 152: lcdPutchar('c'); break; case 153: lcdPutchar('e'); break; case 154: lcdPutchar('n'); break; case 155: lcdPutchar('s'); break; case 156: lcdPutchar('e'); break; case 157: lcdPutchar('d'); break; case 158: lcdPutchar(' '); break; case 159: lcdPutchar('b'); break; case 160: lcdPutchar('y'); break; case 161: lcdGotoxy(8,110); lcdPutchar('w'); break; case 162: lcdPutchar('w'); break; case 163: lcdPutchar('w'); break; case 164: lcdPutchar('.'); break; case 165: lcdPutchar('s'); break; case 166: lcdPutchar('e'); break; case 167: lcdPutchar('g'); break; case 168: lcdPutchar('g'); break; case 169: lcdPutchar('e'); break; case 170: lcdPutchar('r'); break; case 171: lcdPutchar('.'); break; case 172: lcdPutchar('c'); break; case 173: lcdPutchar('o'); break; case 174: lcdPutchar('m'); break; case 190: lcdColor(0xff,0x00); lcdClrscr(); break; case 191: lcdIcon(16, 0, 97, 60, _ea_97x60c[2], _ea_97x60c[3], &_ea_97x60c[4]); break; case 192: lcdGotoxy(0,66); lcdPutchar('P'); break; case 193: lcdPutchar('r'); break; case 194: lcdPutchar('o'); break; case 195: lcdPutchar('g'); break; case 196: lcdPutchar('r'); break; case 197: lcdPutchar('a'); break; case 198: lcdPutchar('m'); break; case 199: lcdPutchar(' '); break; case 200: lcdPutchar('v'); break; case 201: lcdPutchar('e'); break; case 202: lcdPutchar('r'); break; case 203: lcdPutchar(':'); break; case 204: lcdPutchar('1'); break; case 205: lcdPutchar('.'); break; case 206: lcdPutchar('8'); break; case 207: lcdGotoxy(20,80); lcdPutchar('C'); break; case 208: lcdPutchar('h'); break; case 209: lcdPutchar('e'); break; case 210: lcdPutchar('c'); break; case 211: lcdPutchar('k'); break; case 212: lcdPutchar(' '); break; case 213: lcdPutchar('f'); break; case 214: lcdPutchar('o'); break; case 215: lcdPutchar('r'); break; case 216: lcdGotoxy(8,96); lcdPutchar('u'); break; case 217: lcdPutchar('p'); break; case 218: lcdPutchar('d'); break; case 219: lcdPutchar('a'); break; case 220: lcdPutchar('t'); break; case 221: lcdPutchar('e'); break; case 222: lcdPutchar('s'); break; case 223: lcdPutchar(' '); break; case 224: lcdPutchar('a'); break; case 225: lcdPutchar('t'); break; case 226: lcdPutchar(' '); break; case 227: lcdPutchar('t'); break; case 228: lcdPutchar('h'); break; case 229: lcdPutchar('e'); break; case 230: lcdGotoxy(8,112); lcdPutchar('s'); break; case 231: lcdPutchar('u'); break; case 232: lcdPutchar('p'); break; case 233: lcdPutchar('p'); break; case 234: lcdPutchar('o'); break; case 235: lcdPutchar('r'); break; case 236: lcdPutchar('t'); break; case 237: lcdPutchar(' '); break; case 238: lcdPutchar('p'); break; case 239: lcdPutchar('a'); break; case 240: lcdPutchar('g'); break; case 241: lcdPutchar('e'); break; case 242: lcdPutchar('.'); break; default: break; } osSleep(10); } lcdColor(0x00,0x00); lcdClrscr(); }
QalfModeratorWidget::QalfModeratorWidget(QWidget * parent) : QWidget(parent) { vlayout = new QVBoxLayout(this) ; noKeySetLabel = new QLabel() ; noKeySetLabel->setWordWrap(true) ; vlayout->addWidget(noKeySetLabel) ; // file path fileLabel = new QLabel(tr("File :")) ; fileValue = new QLineEdit(QString("/home/alf/tentative_de.ogg")) ; openFileButton = new QPushButton(QIcon(":/icons/folder_open.png"),QString()) ; connect(openFileButton,SIGNAL(clicked()),this,SLOT(openFile())) ; fileLayout = new QHBoxLayout() ; fileLayout->addWidget(fileLabel) ; fileLayout->addWidget(fileValue) ; fileLayout->addWidget(openFileButton) ; vlayout->addLayout(fileLayout) ; // general informations infoBox = new QGroupBox(tr("Informations about file")) ; QGridLayout * infoLayout = new QGridLayout() ; titleLabel = new QLabel(tr("title :")) ; titleValue = new QLineEdit("Tentative de") ; authorsLabel = new QLabel(tr("authors :")) ; authorsValue = new QLineEdit("VoX") ; licenseLabel = new QLabel(tr("license :")) ; licenseValue = new QComboBox() ; keywordsLabel = new QLabel(tr("keywords :")) ; keywordsValue = new QLineEdit("VoX") ; infoLayout->addWidget(titleLabel,0,0) ; infoLayout->addWidget(titleValue,0,1) ; infoLayout->addWidget(authorsLabel,1,0) ; infoLayout->addWidget(authorsValue,1,1) ; infoLayout->addWidget(licenseLabel,0,3) ; infoLayout->addWidget(licenseValue,0,4) ; infoLayout->addWidget(keywordsLabel,1,3) ; infoLayout->addWidget(keywordsValue,1,4) ; infoLayout->setColumnMinimumWidth(2,25) ; infoLayout->setRowStretch(2,1) ; infoLayout->setColumnStretch(0,0) ; infoLayout->setColumnStretch(1,2) ; infoLayout->setColumnStretch(2,0) ; infoLayout->setColumnStretch(3,0) ; infoLayout->setColumnStretch(4,1) ; infoBox->setLayout(infoLayout); vlayout->addWidget(infoBox) ; // medium specific mediumBox = new QGroupBox(tr("Informations specific to medium")) ; QVBoxLayout * mediumLayout = new QVBoxLayout() ; mediumInfo = new QStackedWidget() ; mediumInfo->addWidget(new QalfImageInfoWidget()) ; mediumLayout->addWidget(mediumInfo) ; mediumBox->setLayout(mediumLayout) ; vlayout->addWidget(mediumBox) ; vlayout->addStretch(1) ; QSize iconSize(22,22) ; sendButton = new QPushButton(tr("Send torrent")) ; sendButton->setIcon(QIcon(":/icons/vcs_add.png")) ; sendButton->setIconSize(iconSize) ; connect(sendButton,SIGNAL(clicked()),this,SLOT(sendTorrent())) ; buttonLayout = new QHBoxLayout() ; buttonLayout->addStretch() ; buttonLayout->addWidget(sendButton) ; vlayout->addLayout(buttonLayout) ; setLayout(vlayout) ; switchToNokey() ; checkKey() ; }