int QtKeyRec::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: on_quitButton_clicked(); break; case 1: on_startButton_clicked(); break; case 2: onVolumeChanged((*reinterpret_cast< int(*)>(_a[1]))); break; default: ; } _id -= 3; } return _id; }
int Schachuhr::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: on_stopButton_clicked(); break; case 1: on_quitButton_clicked(); break; case 2: on_clearButton_clicked(); break; case 3: on_player2Button_clicked(); break; case 4: on_player1Button_clicked(); break; default: ; } _id -= 5; } return _id; }
// When download finished or canceled, this will be called void Downloader::downloaderFinished() { // when canceled if (httpRequestAborted) { if (file) { file->close(); file->remove(); delete file; file = 0; } reply->deleteLater(); progressDialog->hide(); ui->downloadButton->setEnabled(true); ui->downloadButton->setDefault(true); ui->continueButton->setEnabled(false); return; } // download finished normally progressDialog->hide(); file->flush(); file->close(); // get redirection url QVariant redirectionTarget = reply->attribute(QNetworkRequest::RedirectionTargetAttribute); if (reply->error()) { file->remove(); if (!autoDownload) { QMessageBox::information(this, tr("Downloader"), tr("Download failed: %1.").arg(reply->errorString())); } else { printf("Downloader: Download failed.\n"); } ui->downloadButton->setEnabled(true); ui->downloadButton->setDefault(true); ui->continueButton->setEnabled(false); } else { if (!redirectionTarget.isNull()) { QUrl newUrl = url.resolved(redirectionTarget.toUrl()); if (autoDownload || QMessageBox::question(this, tr("Downloader"), tr("Redirect to %1 ?").arg(newUrl.toString()), QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) { url = newUrl; reply->deleteLater(); file->open(QIODevice::WriteOnly); file->resize(0); startRequest(url); return; } } else { ui->statusLabel->setText(tr("Downloaded %1.").arg(fileDest.filePath())); ui->downloadButton->setEnabled(false); ui->continueButton->setEnabled(true); ui->continueButton->setDefault(true); ui->quitButton->setDefault(false); } } reply->deleteLater(); reply = 0; delete file; file = 0; manager = 0; downloadFinished = true; if (autoDownload) { if (ui->continueButton->isEnabled()) { on_continueButton_clicked(); } else { on_quitButton_clicked(); } } }
int main(int argc, char *argv[]) { QApplication a(argc, argv); OSVERSIONINFO osvi; ZeroMemory(&osvi, sizeof(OSVERSIONINFO)); osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); GetVersionEx(&osvi); // check windows version if (!(osvi.dwMajorVersion > 6 || osvi.dwMajorVersion == 6 && osvi.dwMinorVersion >= 1)) { QMessageBox msgBox; msgBox.setText(QObject::tr("Unsupported windows version.")); msgBox.setIcon(QMessageBox::Critical); msgBox.exec(); #ifdef QT_DEBUG std::cout<<"ERR: unsupported windows version"<<std::endl; #endif exit(EXIT_UNSUPPORTED_WINDOWS_VERSION); } // attempt to load the wm dll if (!loadDwmDll(getDwmStatus, setDwmColors, getDwmColors)) { QMessageBox msgBox; msgBox.setText(QObject::tr("Could not load dwmapi.dll.")); msgBox.setIcon(QMessageBox::Critical); msgBox.exec(); #ifdef QT_DEBUG std::cout<<"ERR: could not load dwmapi.dll"<<std::endl; #endif exit(EXIT_DLL_LOAD_FAIL); } BOOL ok; getDwmStatus(&ok); if (!ok) { // TODO: replace with a warning inside the window exit(EXIT_COMPOSITION_DISABLED); } QSharedMemory shared("075fa67f-eefe-43de-91dd-9c2ec23def4b"); if(!shared.create(512, QSharedMemory::ReadWrite)) { QMessageBox msgBox; msgBox.setText(QObject::tr("Can't start more than one instance of ColorShifter.")); msgBox.setIcon(QMessageBox::Critical); msgBox.exec(); #ifdef QT_DEBUG std::cout<<"ERR: can't start multiple instances"<<std::endl; #endif exit(EXIT_MULTIPLE_INSTANCES); } MainWindow w; QApplication::connect(&a, SIGNAL(aboutToQuit()), &w, SLOT(on_quitButton_clicked())); // check if starts minimized bool minimized = false; for (int i = 0; i < argc; i++) { if (!(strcmp(argv[i], "--minimized"))) { minimized = true; } } if (!minimized) { w.show(); } else { #ifdef QT_DEBUG std::cout<<"Starting minimized"<<std::endl; #endif } return a.exec(); /* Color color1, color2; DwmColor crt = { 0 }; color1.SetMerged(0xFFFF0000); color2.SetMerged(0xFF0000FF); crt = exportColor(color1); setDwmColors(&crt, 0); for (int i = 0; i < 100; i++) { crt = exportColor(interpolate(color1, color2, i * 1.0 / 100)); setDwmColors(&crt, 0); Sleep(60); } */ exit(EXIT_A_EXEC_DID_NOT_RETURN); }
//typedef char BYTE; //! [0] Decrypter::Decrypter() { keystreamfilename=""; savefilename=""; QDesktopWidget desk; qreal px_width = desk.width() / 2; //qreal px_height = desk.height() / 2; QVBoxLayout *layout = new QVBoxLayout; QHBoxLayout *versionBox = new QHBoxLayout; QButtonGroup *versiongroup = new QButtonGroup(this); xysave = new QRadioButton( "XY" ); orassave = new QRadioButton( "ORAS" ); versiongroup->addButton(xysave); versiongroup->addButton(orassave); versionBox->addWidget(xysave); versionBox->addWidget(orassave); QHBoxLayout *keyBox = new QHBoxLayout; QPushButton *keystreamButton=new QPushButton("Load Keystream"); connect(keystreamButton, SIGNAL(clicked()), this, SLOT(on_keystreamButton_clicked())); keystreamPathDisplay=new QLineEdit; keystreamPathDisplay->setReadOnly(true); keystreamPathDisplay->setMinimumWidth(px_width); keyBox->addWidget(keystreamPathDisplay); keyBox->addWidget(keystreamButton); QHBoxLayout *saveBox = new QHBoxLayout; QPushButton *saveButton=new QPushButton("Load Save"); connect(saveButton, SIGNAL(clicked()), this, SLOT(on_saveButton_clicked())); savePathDisplay=new QLineEdit; savePathDisplay->setReadOnly(true); savePathDisplay->setMinimumWidth(px_width); saveBox->addWidget(savePathDisplay); saveBox->addWidget(saveButton); //disable this until we have both a keystream and save path decryptButton=new QPushButton("Decrypt Save"); connect(decryptButton, SIGNAL(clicked()), this, SLOT(on_decryptButton_clicked())); decryptButton->setEnabled(false); QPushButton *quitButton=new QPushButton("Quit"); connect(quitButton, SIGNAL(clicked()), this, SLOT(on_quitButton_clicked())); layout->addLayout(versionBox); layout->addLayout(keyBox); layout->addLayout(saveBox); layout->addWidget(decryptButton); layout->addWidget(quitButton); this->setLayout(layout); //! [2] //! [3] //! [4] //mainLayout->addWidget(verticalGroupBox); //! [4] //! [5] //setLayout(mainLayout); setWindowTitle(tr("Pokemon Gen VI Save Decrypter")); }