示例#1
0
SaveStateList DrasculaMetaEngine::listSaves(const char *target) const {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	Common::StringArray filenames;
	Common::String pattern = target;
	pattern += ".###";

	filenames = saveFileMan->listSavefiles(pattern);

	SaveStateList saveList;
	int slotNum = 0;
	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
		// Obtain the last 3 digits of the filename, since they correspond to the save slot
		slotNum = atoi(file->c_str() + file->size() - 3);

		if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
			Common::InSaveFile *in = saveFileMan->openForLoading(*file);
			if (in) {
				SaveStateDescriptor desc = loadMetaData(in, slotNum, false);
				if (desc.getSaveSlot() != slotNum) {
					// invalid
					delete in;
					continue;
				}
				saveList.push_back(desc);
				delete in;
			}
		}
	}

	// Sort saves based on slot number.
	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
	return saveList;
}
示例#2
0
//This function updates/refreshes the contents of this dialog
void DlgPrefRecord::slotUpdate()
{
    // Recordings path
    QString recordingsPath = config->getValueString(ConfigKey(RECORDING_PREF_KEY,"Directory"));
    LineEditRecordings->setText(recordingsPath);

    if (radioWav && radioWav->isChecked())
    {
        config->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_WAVE));
    }
    else if (radioAiff && radioAiff->isChecked())
    {
        config->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_AIFF));
    }
    else if (radioFlac && radioFlac->isChecked())
    {
        config->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_FLAC));
    }
    else if (radioOgg && radioOgg->isChecked())
    {
        config->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_OGG));
    }
    else if (radioMp3 && radioMp3->isChecked())
    {
       config->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_MP3));
    }
    loadMetaData();
}
void processMetaData(struct sqlConnection *conn, struct gbSelect* select,
                     struct gbStatusTbl* statusTbl, char* tmpDir)
/* Parse and load the metadata */
{
struct gbUpdate* update;

gbVerbEnter(3, "processing metadata");
gbMetaDataInit(conn, select->release->srcDb, &gOptions, 
               gGbdbGenBank, tmpDir);

for (update = select->release->updates; update != NULL; update = update->next)
    {
    if (update->selectProc)
        {
        select->update = update;
        parseUpdateMetaData(conn, select, statusTbl);
        }
    }
select->update = NULL;
gbVerbLeave(3, "processing metadata");
if (!(gOptions.flags & DBLOAD_INITIAL))
    {
    gbMetaDataUpdateChgGenes(conn, select, statusTbl, tmpDir);
    loadMetaData(conn);
    }
}
void loadDelayedTables()
/* If we are delaying table load, now is the time */
{
struct sqlConnection* conn = hAllocConn(gDatabase);
if (gPendingStatusUpdates == NULL)
    errAbort("no data update were found to loaded with -initialLoad");

loadMetaData(conn);
loadAligns(conn);

while (gPendingStatusUpdates != NULL)
    {
    struct sqlUpdater* statUpd = gPendingStatusUpdates;
    gPendingStatusUpdates = gPendingStatusUpdates->next;
    sqlUpdaterCommit(statUpd, conn);
    sqlUpdaterFree(&statUpd);
    }
gbLoadedTblCommit(gLoadedTbl);
hFreeConn(&conn);
}
示例#5
0
SaveStateDescriptor MacVentureMetaEngine::querySaveMetaInfos(const char *target, int slot) const {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	SaveStateDescriptor desc;
	Common::String saveFileName;
	Common::String pattern = target;
	pattern += ".###";
	Common::StringArray filenames = saveFileMan->listSavefiles(pattern);
	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
		int slotNum = atoi(file->c_str() + file->size() - 3);
		if (slotNum == slot) {
			saveFileName = *file;
		}
	}

	Common::InSaveFile *in = saveFileMan->openForLoading(saveFileName);
	if (in) {
		desc = loadMetaData(in, slot);
		delete in;
		return desc;
	}
	return SaveStateDescriptor(-1, "");
}
示例#6
0
SaveStateList MacVentureMetaEngine::listSaves(const char *target) const {
	Common::SaveFileManager *saveFileMan = g_system->getSavefileManager();
	Common::StringArray filenames;
	Common::String pattern = target;
	pattern += ".###";

	filenames = saveFileMan->listSavefiles(pattern);

	SaveStateList saveList;
	for (Common::StringArray::const_iterator file = filenames.begin(); file != filenames.end(); ++file) {
		int slotNum = atoi(file->c_str() + file->size() - 3);
		SaveStateDescriptor desc;
		// Do not allow save slot 0 (used for auto-saving) to be deleted or
		// overwritten.
		desc.setDeletableFlag(slotNum != 0);
		desc.setWriteProtectedFlag(slotNum == 0);

		if (slotNum >= 0 && slotNum <= getMaximumSaveSlot()) {
			Common::InSaveFile *in = saveFileMan->openForLoading(*file);
			if (in) {
				desc = loadMetaData(in, slotNum);
				if (desc.getSaveSlot() != slotNum) {
					// invalid
					delete in;
					continue;
				}
				saveList.push_back(desc);
				delete in;
			}
		}
	}

	// Sort saves based on slot number.
	Common::sort(saveList.begin(), saveList.end(), SaveStateDescriptorSlotComparator());
	return saveList;
}
示例#7
0
DlgPrefRecord::DlgPrefRecord(QWidget* parent, UserSettingsPointer pConfig)
        : DlgPreferencePage(parent),
          m_pConfig(pConfig),
          m_bConfirmOverwrite(false),
          m_pRadioOgg(NULL),
          m_pRadioMp3(NULL),
          m_pRadioAiff(NULL),
          m_pRadioFlac(NULL),
          m_pRadioWav(NULL) {
    setupUi(this);

    // See RECORD_* #defines in defs_recording.h
    m_pRecordControl = new ControlObjectSlave(
            RECORDING_PREF_KEY, "status", this);

    m_pRadioOgg = new QRadioButton("Ogg Vorbis");
    m_pRadioMp3 = new QRadioButton(ENCODING_MP3);

    // Setting recordings path.
    QString recordingsPath = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Directory"));
    if (recordingsPath == "") {
        // Initialize recordings path in config to old default path.
        // Do it here so we show current value in UI correctly.
        QString musicDir = QDesktopServices::storageLocation(QDesktopServices::MusicLocation);
        QDir recordDir(musicDir + "/Mixxx/Recordings");
        recordingsPath = recordDir.absolutePath();
    }
    LineEditRecordings->setText(recordingsPath);

    connect(PushButtonBrowseRecordings, SIGNAL(clicked()),
            this, SLOT(slotBrowseRecordingsDir()));
    connect(LineEditRecordings, SIGNAL(returnPressed()),
            this, SLOT(slotApply()));

    connect(m_pRadioOgg, SIGNAL(clicked()),
            this, SLOT(slotApply()));
    connect(m_pRadioMp3, SIGNAL(clicked()),
            this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioOgg);
    horizontalLayout->addWidget(m_pRadioMp3);

    // AIFF and WAVE are supported by default.
    m_pRadioWav = new QRadioButton(ENCODING_WAVE);
    connect(m_pRadioWav, SIGNAL(clicked()), this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioWav);

    m_pRadioAiff = new QRadioButton(ENCODING_AIFF);
    connect(m_pRadioAiff, SIGNAL(clicked()), this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioAiff);

#ifdef SF_FORMAT_FLAC
    m_pRadioFlac = new QRadioButton(ENCODING_FLAC);
    connect(m_pRadioFlac, SIGNAL(clicked()), this, SLOT(slotApply()));
    horizontalLayout->addWidget(m_pRadioFlac);
#endif

    // Read config and check radio button.
    QString format = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "Encoding"));
    if (format == ENCODING_WAVE) {
        m_pRadioWav->setChecked(true);
    } else if (format == ENCODING_OGG) {
        m_pRadioOgg->setChecked(true);
    } else if (format == ENCODING_MP3) {
        m_pRadioMp3->setChecked(true);
    } else if (format == ENCODING_AIFF) {
        m_pRadioAiff->setChecked(true);
#ifdef SF_FORMAT_FLAC
    } else if (format == ENCODING_FLAC) {
        m_pRadioFlac->setChecked(true);
#endif
    } else {
        // Invalid, so set default and save.
        // If no config was available, set to WAVE as default.
        m_pRadioWav->setChecked(true);
        m_pConfig->set(ConfigKey(RECORDING_PREF_KEY, "Encoding"), ConfigValue(ENCODING_WAVE));
    }

    loadMetaData();

    connect(SliderQuality, SIGNAL(valueChanged(int)),
            this, SLOT(slotSliderQuality()));
    connect(SliderQuality, SIGNAL(sliderMoved(int)),
            this, SLOT(slotSliderQuality()));
    connect(SliderQuality, SIGNAL(sliderReleased()),
            this, SLOT(slotSliderQuality()));
    connect(CheckBoxRecordCueFile, SIGNAL(stateChanged(int)),
            this, SLOT(slotEnableCueFile(int)));
    connect(comboBoxSplitting, SIGNAL(activated(int)),
            this, SLOT(slotChangeSplitSize()));

    slotApply();
    // Make sure a corrupt config file won't cause us to record constantly.
    m_pRecordControl->set(RECORD_OFF);

    comboBoxSplitting->addItem(SPLIT_650MB);
    comboBoxSplitting->addItem(SPLIT_700MB);
    comboBoxSplitting->addItem(SPLIT_1024MB);
    comboBoxSplitting->addItem(SPLIT_2048MB);
    comboBoxSplitting->addItem(SPLIT_4096MB);

    QString fileSizeStr = m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "FileSize"));
    int index = comboBoxSplitting->findText(fileSizeStr);
    if (index > 0) {
        // Set file split size
        comboBoxSplitting->setCurrentIndex(index);
    }
    // Otherwise 650 MB will be default file split size.

    // Read CUEfile info
    CheckBoxRecordCueFile->setChecked(
            (bool) m_pConfig->getValueString(ConfigKey(RECORDING_PREF_KEY, "CueEnabled")).toInt());

}
示例#8
0
void LoadILLSANS::initWorkSpace(NeXus::NXEntry &firstEntry,
                                const std::string &instrumentPath) {

  g_log.debug("Fetching data...");

  NXData dataGroup1 = firstEntry.openNXData("data1");
  NXInt dataRear = dataGroup1.openIntData();
  dataRear.load();
  NXData dataGroup2 = firstEntry.openNXData("data2");
  NXInt dataRight = dataGroup2.openIntData();
  dataRight.load();
  NXData dataGroup3 = firstEntry.openNXData("data3");
  NXInt dataLeft = dataGroup3.openIntData();
  dataLeft.load();
  NXData dataGroup4 = firstEntry.openNXData("data4");
  NXInt dataDown = dataGroup4.openIntData();
  dataDown.load();
  NXData dataGroup5 = firstEntry.openNXData("data5");
  NXInt dataUp = dataGroup5.openIntData();
  dataUp.load();
  g_log.debug("Checking channel numbers...");

  // check number of channels
  if (dataRear.dim2() != dataRight.dim2() &&
      dataRight.dim2() != dataLeft.dim2() &&
      dataLeft.dim2() != dataDown.dim2() && dataDown.dim2() != dataUp.dim2()) {
    throw std::runtime_error(
        "The time bins have not the same dimension for all the 5 detectors!");
  }
  int numberOfHistograms =
      dataRear.dim0() * dataRear.dim1() + dataRight.dim0() * dataRight.dim1() +
      dataLeft.dim0() * dataLeft.dim1() + dataDown.dim0() * dataDown.dim1() +
      dataUp.dim0() * dataUp.dim1();

  g_log.debug("Creating empty workspace...");
  // TODO : Must put this 2 somewhere else: number of monitors!
  createEmptyWorkspace(numberOfHistograms + 2, dataRear.dim2());

  loadMetaData(firstEntry, instrumentPath);

  std::vector<double> binningRear, binningRight, binningLeft, binningDown,
      binningUp;

  if (firstEntry.getFloat("mode") == 0.0) { // Not TOF
    g_log.debug("Getting default wavelength bins...");
    binningRear = m_defaultBinning;
    binningRight = m_defaultBinning;
    binningLeft = m_defaultBinning;
    binningDown = m_defaultBinning;
    binningUp = m_defaultBinning;

  } else {
    g_log.debug("Getting wavelength bins from the nexus file...");
    std::string binPathPrefix(instrumentPath + "/tof/tof_wavelength_detector");

    binningRear =
        m_loader.getTimeBinningFromNexusPath(firstEntry, binPathPrefix + "1");
    binningRight =
        m_loader.getTimeBinningFromNexusPath(firstEntry, binPathPrefix + "2");
    binningLeft =
        m_loader.getTimeBinningFromNexusPath(firstEntry, binPathPrefix + "3");
    binningDown =
        m_loader.getTimeBinningFromNexusPath(firstEntry, binPathPrefix + "4");
    binningUp =
        m_loader.getTimeBinningFromNexusPath(firstEntry, binPathPrefix + "5");
  }
  g_log.debug("Loading the data into the workspace...");
  size_t nextIndex = loadDataIntoWorkspaceFromMonitors(firstEntry, 0);
  nextIndex = loadDataIntoWorkspaceFromHorizontalTubes(dataRear, binningRear,
                                                       nextIndex);
  nextIndex = loadDataIntoWorkspaceFromVerticalTubes(dataRight, binningRight,
                                                     nextIndex);
  nextIndex =
      loadDataIntoWorkspaceFromVerticalTubes(dataLeft, binningLeft, nextIndex);
  nextIndex = loadDataIntoWorkspaceFromHorizontalTubes(dataDown, binningDown,
                                                       nextIndex);
  nextIndex =
      loadDataIntoWorkspaceFromHorizontalTubes(dataUp, binningUp, nextIndex);
}