MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { iTrytoClose = false; iDownloader = new FileDownloader(this); iAudioExtractor = new AudioExtractor(this); ui->setupUi(this); ui->progressBar->setMinimum(0); ui->progressBar->setMaximum(100); ui->progressBar->setValue(0); connect(ui->startButton, SIGNAL(clicked()), this, SLOT(startDownload())); connect(ui->cancelButton, SIGNAL(clicked()), this, SLOT(cancelDownload())); connect(iDownloader, SIGNAL(downloadProgress(int)), this, SLOT(updateProgress(int))); connect(iDownloader, SIGNAL(stateChanged(DownloadState)), this, SLOT(stateChanged(DownloadState))); connect(ui->extractButton, SIGNAL(clicked()), this, SLOT(extractAudio())); connect(ui->codecButton, SIGNAL(clicked()), this, SLOT(codecInfo())); connect(ui->encodeButton, SIGNAL(clicked()), this, SLOT(encodeX264())); connect(ui->closeButton, SIGNAL(clicked()), this, SLOT(closeApp())); connect(iDownloader, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&))); connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clearInfoText())); connect(ui->actionSettings, SIGNAL(triggered()), this, SLOT(openSettings())); connect(ui->actionAbout, SIGNAL(triggered()), this, SLOT(openAbout())); connect(iAudioExtractor, SIGNAL(infoChanged(const QString&)), this, SLOT(infoChanged(const QString&))); connect(iAudioExtractor, SIGNAL(extractStateChanged(int)), this, SLOT(extractStateChanged(int))); connect(iAudioExtractor, SIGNAL(encodeStateChanged(int)), this, SLOT(extractStateChanged(int))); ui->videoIdEdit->setText("nVjsGKrE6E8"); }
CLSID GetEncoderClsid(const WCHAR* format) { CLSID null = {0}; UINT numEncoders, size; Status ok = GetImageEncodersSize(&numEncoders, &size); if (ok != Ok || 0 == size) return null; ScopedMem<ImageCodecInfo> codecInfo((ImageCodecInfo*)malloc(size)); if (!codecInfo) return null; GetImageEncoders(numEncoders, size, codecInfo); for (UINT j = 0; j < numEncoders; j++) { if (str::Eq(codecInfo[j].MimeType, format)) { return codecInfo[j].Clsid; } } return null; }