bool Audio::setSourceFileName(QString filename) { if (m_sourceFileName.isEmpty() == false) { // unload previous source if (m_decoder != NULL) { delete m_decoder; m_decoder = NULL; } } m_sourceFileName = filename; //QMessageBox::warning(0,"Warning", QString("File complete path: %1").arg(m_sourceFileName)); if (QFile(m_sourceFileName).exists()) setName(QFileInfo(m_sourceFileName).fileName()); else { setName(tr("File not found")); //m_audioDuration = 0; emit changed(id()); return true; } emit sourceFilenameChanged(); m_decoder = m_doc->audioPluginCache()->getDecoderForFile(m_sourceFileName); if (m_decoder == NULL) return false; setTotalDuration(m_decoder->totalTime()); emit changed(id()); return true; }
void Home::input() { lbg->setPixmap(QPixmap(QString("://imagens/bg"))); QFont f; f.setPointSize(50); lTime->setAlignment(Qt::AlignCenter); lTime->setFont(f); lTime->setStyleSheet("color:white;"); f.setPointSize(14); lPercent->setAlignment(Qt::AlignCenter); lPercent->setFont(f); lPercent->setStyleSheet("color:white;"); f.setPointSize(18); lTextStatus->setAlignment(Qt::AlignCenter); lTextStatus->setFont(f); lTextStatus->setStyleSheet("color:white;"); f.setPointSize(10); pbPlay->setFont(f); pbStop->setFont(f); pbRestart->setFont(f); QString button = "QPushButton" "{" "background-color: rgba(255,255,255,20);" "color:white;" "}"; pbPlay->setStyleSheet(button); pbStop->setStyleSheet(button); pbRestart->setStyleSheet(button); progress->setTextVisible(false); progress->setMaximum(100); progress->setMinimum(0); progress->setValue(0); progress->setTextVisible(false); progress->setStyleSheet("QProgressBar" " {" "border: 1px solid rgba(0,0,0,25);" "border-radius: 5px;" "background-color: rgba(240, 240, 240, 255);" "}" "QProgressBar::chunk " "{" "border: 1px solid rgba(0,0,0,25);" "border-radius: 5px;" "background-color:rgba(0,0,0,200);" "}"); pbPlay->setCursor(Qt::PointingHandCursor); pbStop->setCursor(Qt::PointingHandCursor); pbRestart->setCursor(Qt::PointingHandCursor); setTotalDuration(0); setCurrentTime(0); }