int pianWHOA::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: key1(); break; case 1: key2(); break; case 2: key3(); break; case 3: key4(); break; case 4: key5(); break; case 5: key6(); break; case 6: key7(); break; case 7: key8(); break; case 8: key9(); break; case 9: key10(); break; case 10: key11(); break; case 11: key12(); break; case 12: key13(); break; case 13: key14(); break; case 14: key15(); break; case 15: key16(); break; case 16: key17(); break; case 17: key18(); break; case 18: tutor(); break; default: ; } _id -= 19; } return _id; }
void rowTutor::playTutorSong(QList <char> song){ if (arrayCount<song.size()) { playNoteGUI(song[arrayCount]); arrayCount++; } else { QTimer::singleShot(1000, this, SLOT(key1())); QTimer::singleShot(1100, this, SLOT(key5())); QTimer::singleShot(1200, this, SLOT(key8())); QTimer::singleShot(1300, this, SLOT(key13())); } }
void tst_QPixmapCache::pixmapKey() { QPixmapCache::Key key; //Default constructed keys have no d pointer unless //we use them QVERIFY(!getPrivate(key)); //Let's put a d pointer QPixmapCache::KeyData** keyd = getPrivateRef(key); *keyd = new QPixmapCache::KeyData; QCOMPARE(getPrivate(key)->ref, 1); QPixmapCache::Key key2; //Let's put a d pointer QPixmapCache::KeyData** key2d = getPrivateRef(key2); *key2d = new QPixmapCache::KeyData; QCOMPARE(getPrivate(key2)->ref, 1); key = key2; QCOMPARE(getPrivate(key2)->ref, 2); QCOMPARE(getPrivate(key)->ref, 2); QPixmapCache::Key key3; //Let's put a d pointer QPixmapCache::KeyData** key3d = getPrivateRef(key3); *key3d = new QPixmapCache::KeyData; QPixmapCache::Key key4 = key3; QCOMPARE(getPrivate(key3)->ref, 2); QCOMPARE(getPrivate(key4)->ref, 2); key4 = key; QCOMPARE(getPrivate(key4)->ref, 3); QCOMPARE(getPrivate(key3)->ref, 1); QPixmapCache::Key key5(key3); QCOMPARE(getPrivate(key3)->ref, 2); QCOMPARE(getPrivate(key5)->ref, 2); //let test default constructed keys QPixmapCache::Key key6; QVERIFY(!getPrivate(key6)); QPixmapCache::Key key7; QVERIFY(!getPrivate(key7)); key6 = key7; QVERIFY(!getPrivate(key6)); QVERIFY(!getPrivate(key7)); QPixmapCache::Key key8(key7); QVERIFY(!getPrivate(key8)); }
int rowTutor::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QMainWindow::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: playSong(); break; case 1: stopSong(); break; case 2: playTutorSong((*reinterpret_cast< QList<char>(*)>(_a[1]))); break; case 3: playNoteGUI((*reinterpret_cast< char(*)>(_a[1]))); break; case 4: noteCDown(); break; case 5: noteDDown(); break; case 6: noteEDown(); break; case 7: noteFDown(); break; case 8: noteGDown(); break; case 9: noteHiCDown(); break; case 10: key1(); break; case 11: key2(); break; case 12: key3(); break; case 13: key4(); break; case 14: key5(); break; case 15: key6(); break; case 16: key7(); break; case 17: key8(); break; case 18: key9(); break; case 19: key10(); break; case 20: key11(); break; case 21: key12(); break; case 22: key13(); break; case 23: key14(); break; case 24: key15(); break; case 25: key16(); break; case 26: key17(); break; case 27: key18(); break; default: ; } _id -= 28; } return _id; }
twinkleTutor::twinkleTutor(QWidget *parent) : QMainWindow(parent), ui(new Ui::twinkleTutor) { // set up the GUI ui->setupUi(this); Song = new QSound("sounds/twinkle.wav"); connect(ui->aButton, SIGNAL(clicked()), this, SLOT(key1())); keyA = new QSound("sounds/C.wav"); connect(ui->wButton, SIGNAL(clicked()), this, SLOT(key2())); keyW = new QSound("sounds/C#.wav"); connect(ui->sButton, SIGNAL(clicked()), this, SLOT(key3())); keyS = new QSound("sounds/D.wav"); connect(ui->eButton, SIGNAL(clicked()), this, SLOT(key4())); keyE = new QSound("sounds/D#.wav"); connect(ui->dButton, SIGNAL(clicked()), this, SLOT(key5())); keyD = new QSound("sounds/E.wav"); connect(ui->fButton, SIGNAL(clicked()), this, SLOT(key6())); keyF = new QSound("sounds/F.wav"); connect(ui->tButton, SIGNAL(clicked()), this, SLOT(key7())); keyT = new QSound("sounds/F#.wav"); connect(ui->gButton, SIGNAL(clicked()), this, SLOT(key8())); keyG = new QSound("sounds/G.wav"); connect(ui->yButton, SIGNAL(clicked()), this, SLOT(key9())); keyY = new QSound("sounds/G#.wav"); connect(ui->hButton, SIGNAL(clicked()), this, SLOT(key10())); keyH = new QSound("sounds/A.wav"); connect(ui->uButton, SIGNAL(clicked()), this, SLOT(key11())); keyU = new QSound("sounds/A#.wav"); connect(ui->jButton, SIGNAL(clicked()), this, SLOT(key12())); keyJ = new QSound("sounds/B.wav"); connect(ui->kButton, SIGNAL(clicked()), this, SLOT(key13())); keyK = new QSound("sounds/HighC.wav"); connect(ui->oButton, SIGNAL(clicked()), this, SLOT(key14())); keyO = new QSound("sounds/HiC#.wav"); connect(ui->lButton, SIGNAL(clicked()), this, SLOT(key15())); keyL = new QSound("sounds/HiD.wav"); connect(ui->pButton, SIGNAL(clicked()), this, SLOT(key16())); keyP = new QSound("sounds/HiD#.wav"); connect(ui->semiButton, SIGNAL(clicked()), this, SLOT(key17())); keySemi = new QSound("sounds/HiE.wav"); connect(ui->apostButton, SIGNAL(clicked()), this, SLOT(key18())); keyDot = new QSound("sounds/HiF.wav"); twinkle.append('C'); twinkle.append('C'); twinkle.append('G'); twinkle.append('G'); twinkle.append('A'); twinkle.append('A'); twinkle.append('G'); twinkle.append('F'); twinkle.append('F'); twinkle.append('E'); twinkle.append('E'); twinkle.append('D'); twinkle.append('D'); twinkle.append('C'); twinkle.append('G'); twinkle.append('G'); twinkle.append('F'); twinkle.append('F'); twinkle.append('E'); twinkle.append('E'); twinkle.append('D'); twinkle.append('G'); twinkle.append('G'); twinkle.append('F'); twinkle.append('F'); twinkle.append('E'); twinkle.append('E'); twinkle.append('D'); twinkle.append('C'); twinkle.append('C'); twinkle.append('G'); twinkle.append('G'); twinkle.append('A'); twinkle.append('A'); twinkle.append('G'); twinkle.append('F'); twinkle.append('F'); twinkle.append('E'); twinkle.append('E'); twinkle.append('D'); twinkle.append('D'); twinkle.append('C'); arrayCount=0; playTutorSong(twinkle); //enable Event Filters installEventFilter(this); }
int main(int argc, char *argv[]) { int err = 0; int v; RSA *key; unsigned char ptext[256]; unsigned char ctext[256]; static unsigned char ptext_ex[] = "12345678"; unsigned char ctext_ex[256]; int plen; int clen = 0; int num; int n; int i; EVP_PKEY *pkey; printf("ptext_ex: %s\n", ptext_ex); { key = RSA_new(); key5(key); plen = sizeof(ptext_ex) - 1; num = RSA_private_encrypt(plen, ptext_ex, ctext, key, RSA_PKCS1_PADDING); if (num != 128) //模数长度 { printf("PKCS#1 v1.5 encryption failed!\n"); err=1; goto next; } //加密后的数据 printf("encrypted text: \n"); for (i = 0; i < num; i++) { printf("\\x%02x", ctext[i]); } printf("\n"); printf("RSA_private_encrypt num: %d\n", num); num = RSA_public_decrypt(num, ctext, ptext, key, RSA_PKCS1_PADDING); if (num != plen || memcmp(ptext, ptext_ex, num) != 0) { printf("PKCS#1 v1.5 decryption failed!\n"); err=1; } else printf("PKCS #1 v1.5 encryption/decryption ok\n"); printf("RSA_public_decrypt num: %d\n", num); ptext[num] = '\0'; //字符串结尾 printf("ptext: %s\n", ptext); next: //公钥和私钥输出为 PEM 格式: PEM_write_RSAPrivateKey(stdout, key, NULL, NULL, 0, NULL, NULL); PEM_write_RSAPublicKey(stdout, key); //释放申请的内存 RSA_free(key); } if (err) printf("ERROR: %d\n", err); return err; }