Exemple #1
0
void RipCDDialog::ClickedRipButton() {
  if (ripper_->MediaChanged()) {
    QMessageBox cdio_fail(QMessageBox::Critical, tr("Error Ripping CD"),
                          tr("Media has changed. Reloading"));
    cdio_fail.exec();
    if (CheckCDIOIsValid()) {
      BuildTrackListTable();
    } else {
      ui_->tableWidget->clearContents();
    }
    return;
  }

  // Add tracks and album information to the ripper.
  ripper_->ClearTracks();
  TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
                                .value<TranscoderPreset>();
  for (int i = 1; i <= ui_->tableWidget->rowCount(); ++i) {
    if (!checkboxes_.value(i - 1)->isChecked()) {
      continue;
    }
    QString transcoded_filename = GetOutputFileName(
        ParseFileFormatString(ui_->format_filename->text(), i));
    QString title = track_names_.value(i - 1)->text();
    ripper_->AddTrack(i, title, transcoded_filename, preset);
  }
  ripper_->SetAlbumInformation(
      ui_->albumLineEdit->text(), ui_->artistLineEdit->text(),
      ui_->genreLineEdit->text(), ui_->yearLineEdit->text().toInt(),
      ui_->discLineEdit->text().toInt(), preset.type_);

  SetWorking(true);
  ripper_->Start();
}
Exemple #2
0
void RipCD::AllJobsComplete() {
  RemoveTemporaryDirectory();

  // having a little trouble on wav files, works fine on ogg-vorbis
  qSort(generated_files_);

  for (int i = 0; i < generated_files_.length(); i++) {
    TagLib::FileRef f(generated_files_.value(i).toUtf8().constData());

    f.tag()->setTitle(track_names_.value(tracks_to_rip_.value(i) - 1)
                          ->text()
                          .toUtf8()
                          .constData());
    f.tag()->setAlbum(ui_->albumLineEdit->text().toUtf8().constData());
    f.tag()->setArtist(ui_->artistLineEdit->text().toUtf8().constData());
    f.tag()->setGenre(ui_->genreLineEdit->text().toUtf8().constData());
    f.tag()->setYear(ui_->yearLineEdit->text().toInt());
    f.tag()->setTrack(tracks_to_rip_.value(i) - 1);
    // Need to check this
    // f.tag()->setDisc(ui_->discLineEdit->text().toInt());
    f.save();
  }
  // Resets lists
  generated_files_.clear();
  tracks_to_rip_.clear();

  SetWorking(false);
}
void TranscodeDialog::Start() {
  SetWorking(true);

  QAbstractItemModel* file_model = ui_->files->model();
  TranscoderPreset preset = ui_->format->itemData(ui_->format->currentIndex())
                                .value<TranscoderPreset>();

  // Add jobs to the transcoder
  for (int i = 0; i < file_model->rowCount(); ++i) {
    QString filename = file_model->index(i, 0).data(Qt::UserRole).toString();
    QString outfilename = GetOutputFileName(filename, preset);
    transcoder_->AddJob(filename, preset, outfilename);
  }

  // Set up the progressbar
  ui_->progress_bar->setValue(0);
  ui_->progress_bar->setMaximum(file_model->rowCount() * 100);

  // Reset the UI
  queued_ = file_model->rowCount();
  finished_success_ = 0;
  finished_failed_ = 0;
  UpdateStatusText();

  // Start transcoding
  transcoder_->Start();

  // Save the last output format
  QSettings s;
  s.beginGroup(kSettingsGroup);
  s.setValue("last_output_format", preset.extension_);
}
void InterruptHandler::Run()
{
	StartTrace(InterruptHandler.Run);

	// the just wait for the signal to happen
	Trace("Thread: " << Thread::MyId());
	Trace("Pid: " << (long)coast::system::getpid());
	Trace("Server [" << (fServer ? (const char *)(fServer->fName) : "no-name") << "]");

	if ( fServer ) {
		fServer->WritePIDFile(coast::system::getpid());
	}

	sigset_t set;
	int isignal;
	// setup the signal set that catches control-c
	sigemptyset(&set);
	sigaddset(&set, SIGINT);
	sigaddset(&set, SIGTERM);
	sigaddset(&set, SIGHUP);

handlesignal:
	SetWorking();
	Trace("calling sigwait");
	sigwait(&set, &isignal);
	SetReady();

	Trace("got signal: " << (long)isignal);
	if (fServer) {
		String sigName;
		sigName << (long)isignal;
		if ( isignal == SIGHUP ) {
			SYSINFO("caught SIGHUP, resetting server");
			int retVal = fServer->GlobalReinit();
			if ( retVal == 0 ) {
				// everything ok, wait on next signal
				goto handlesignal;
			}
			sigName = "SIGHUP";
			// shutdown if any mishap happens
			SYSERROR("GlobalReinit failed, shutting down...");
		} else if ( isignal == SIGINT ) {
			sigName = "SIGINT";
		} else if ( isignal == SIGTERM ) {
			sigName = "SIGTERM";
		} else {
			SYSINFO("caught unknown signal " << sigName << " ...ignoring!");
			goto handlesignal;
		}
		SYSINFO("caught " << sigName << " shutting down server");
		// prepare the server for shutdown
		// by causing him to leave the accept-loop
		fServer->PrepareShutdown();
	}
	// the job is done, just die...
}
Exemple #5
0
void RipCD::Cancel() {
  transcoder_->Cancel();
  RemoveTemporaryDirectory();
  SetWorking(false);
}
Exemple #6
0
void RipCD::ClickedRipButton() {
  SetWorking(true);
  QtConcurrent::run(this, &RipCD::ThreadClickedRipButton);
}
Exemple #7
0
void RipCDDialog::Cancelled() {
  ui_->progress_bar->setValue(0);
  SetWorking(false);
}
Exemple #8
0
void RipCDDialog::Finished() { SetWorking(false); }
void TranscodeDialog::AllJobsComplete() { SetWorking(false); }
void TranscodeDialog::Cancel() {
  transcoder_->Cancel();
  SetWorking(false);
}