Пример #1
0
bool
RemapWidget::reduceGridSize(QString trimRawFile,
			    int dsz, int wsz, int hsz)
{
  bool ok;
  
  QStringList slevels;
  slevels << "No reduction";
  slevels << QString("2 [%1 %2 %3]").arg(dsz/2).arg(wsz/2).arg(hsz/2);
  slevels << QString("3 [%1 %2 %3]").arg(dsz/3).arg(wsz/3).arg(hsz/3);
  slevels << QString("4 [%1 %2 %3]").arg(dsz/4).arg(wsz/4).arg(hsz/4);
  QString option = QInputDialog::getItem(0,
					 "Volume Size",
					 "Volume grid size reduction level",
					 slevels,
					 0,
					 false,
					 &ok);
  if (!ok)
    return false;
   
  int level = 1;
  QStringList op = option.split(' ');
  if (op[0] == "2")
    level = 2;
  else if (op[0] == "3")
    level = 3;
  else if (op[0] == "4")
    level = 4;
  
  if (level == 1)
    return false;

  if (level > 1)
    {
      QStringList flevels;
      flevels << "No Filter" << "Mean" << "Median";
      QString option = QInputDialog::getItem(0,
					     "Select Subsampling Filter",
					     "Subsampling Filter",
					     flevels,
					     0,
					     false,
					     &ok);
      if (!ok)
	return false;
      
      int filter = Raw2Pvl::_NoFilter;
      if (option == "Mean")
	filter = Raw2Pvl::_MeanFilter; 
      else if (option == "Median")
	filter = Raw2Pvl::_MedianFilter;
     
      QString newTrimRawFile = QFileDialog::getSaveFileName(0,
			    "Save subsampled raw volume",
                            Global::previousDirectory(),
	       		    "RAW Files (*.raw)");
      
      int voxelType = m_remapVolume->voxelType();
      int headerBytes = m_remapVolume->headerBytes();

      Raw2Pvl::subsampleVolume(trimRawFile,
			       newTrimRawFile,
			       voxelType,
			       headerBytes,
			       dsz, wsz, hsz,
			       level, filter);
       
      QString mesg;
      mesg += QString("Loading %1\n").arg(newTrimRawFile);
      mesg += "Please reapply mapping as the values will have changed due to filtering";
      QMessageBox::information(0, "Loading Subsampled File",
				mesg);
      
      QStringList flnms;
      flnms << newTrimRawFile;
      setFile(flnms, RAWVolume);
      
      return true;
    }

  return false;
}
ofFileLoggerChannel::ofFileLoggerChannel(const string & path, bool append){
	setFile(path,append);
}
Пример #3
0
/*!
 * \overload
 *
 * Change the \a data for the file named \a filePath.
 * Returns false if the file doesn't exists; otherwise
 * returns true.
 * \sa setFile()
 */
bool Archive::setFileData(const QString &filePath, const QByteArray &data)
{
	QBuffer *buf = new QBuffer();
	buf->setData(data);
	return setFile(filePath, buf);
}
void Project::Item::setFile (const File& file)
{
    setFile (RelativePath (project.getRelativePathForFile (file), RelativePath::projectFolder));
    jassert (getFile() == file);
}
Пример #5
0
void Field::addPvpFile()
{
	setFile(Pvp);
}
Пример #6
0
/*!
    \overload

    Sets the file that the QFileInfo provides information about to \a
    file.

    If \a file includes a relative path, the QFileInfo will also have
    a relative path.

    \sa isRelative()
*/
void QFileInfo::setFile(const QFile &file)
{
    setFile(file.fileName());
}
Пример #7
0
bool AVPlayer::play(const QString& path)
{
    setFile(path);
    play();
    return true;//isPlaying();
}
Пример #8
0
void Field::addRatFile()
{
	setFile(Rat);
}
void SettingsDialog::browseHomepage()
{
    setFile( homePage, tr( "Qt Assistant - Set Homepage" ) );
}
sqInt sqFileOpen(SQFile *f, char* sqFileName, sqInt sqFileNameSize, sqInt writeFlag) {
	/* Opens the given file using the supplied sqFile structure
	   to record its state. Fails with no side effects if f is
	   already open. Files are always opened in binary mode;
	   Squeak must take care of any line-end character mapping.
	*/

	char cFileName[1001];

	/* don't open an already open file */
	if (sqFileValid(f)) return interpreterProxy->success(false);

	/* copy the file name into a null-terminated C string */
	if (sqFileNameSize > 1000) {
		return interpreterProxy->success(false);
	}

	if (setStdFilename("/dev/stdin", cFileName, sqFileName, sqFileNameSize)) 
	  setFile(f, stdin);
	else if (setStdFilename("/dev/stdout", cFileName, sqFileName, sqFileNameSize))
	  setFile(f, stdout);
	else if (setStdFilename("/dev/stderr", cFileName, sqFileName, sqFileNameSize))
	  setFile(f, stderr);
	else
	  interpreterProxy->ioFilenamefromStringofLengthresolveAliases(cFileName, sqFileName, sqFileNameSize, true);

	if (writeFlag) {
		/* First try to open an existing file read/write: */
		if (getFile(f) == NULL)
			setFile(f, fopen(cFileName, "r+b"));
		if (getFile(f) == NULL) {
			/* Previous call fails if file does not exist. In that case,
			   try opening it in write mode to create a new, empty file.
			*/
			setFile(f, fopen(cFileName, "w+b"));
			if (getFile(f) != NULL) {
			    char type[4],creator[4];
				dir_GetMacFileTypeAndCreator(sqFileName, sqFileNameSize, type, creator);
				if (strncmp(type,"BINA",4) == 0 || strncmp(type,"????",4) == 0 || *(int *)type == 0 ) 
				    dir_SetMacFileTypeAndCreator(sqFileName, sqFileNameSize,"TEXT","R*ch");	
			}
		}
		f->writable = true;
	} else {
		if (getFile(f) == NULL)
			setFile(f, fopen(cFileName, "rb"));
		f->writable = false;
	}

	if (getFile(f) == NULL) {
		f->sessionID = 0;
		setSize(f, 0);
		return interpreterProxy->success(false);
	} else {
		FILE *file= getFile(f);
		f->sessionID = thisSession;
		/* compute and cache file size */
		fseek(file, 0, SEEK_END);
		setSize(f, ftell(file));
		fseek(file, 0, SEEK_SET);
	}
	f->lastOp = UNCOMMITTED;
}
Пример #11
0
void SettingsDialog::browsePDFApplication()
{
    setFile( pdfApp, tr( "Qt Assistant - Set PDF Browser" ) );
}
Пример #12
0
void SettingsDialog::browseWebApp()
{
    setFile( browserApp, tr( "Qt Assistant - Set Web Browser" ) );
}
Пример #13
0
/*!
    \overload

    Sets the file that the QFileInfo provides information about to \a
    file in directory \a dir.

    If \a file includes a relative path, the QFileInfo will also
    have a relative path.

    \sa isRelative()
*/
void QFileInfo::setFile(const QDir &dir, const QString &file)
{
    setFile(dir.filePath(file));
}
Пример #14
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    QLocale::setDefault(QLocale::English);
    //setAttribute(Qt::WA_DeleteOnClose,true);
    ui->setupUi(this);
    experimentSettings=new QSettings (QSettings::IniFormat,QSettings::UserScope,QApplication::organizationName(),"experiment",this);
    experiment=new Experiment();

    tcp=new TcpServer(this);
    tcp->setExperiment(experiment);
    udp=new UdpServer(this);
    udp->setExperiment(experiment);

    connect(tcp,SIGNAL(warning(QString)),SLOT(warning(QString)));
    connect(tcp,SIGNAL(notify(QString)),SLOT(notify(QString)));

    //bind tcp socket to local port 25050
    tcp->bind(25050);

    connect(experiment,SIGNAL(statusChanged(bool)),tcp,SLOT(experimentStatusChanged(bool)));
    connect(experiment,SIGNAL(intervalChanged(int)),tcp,SLOT(experimentIntervalChanged(int)));
    connect(experiment,SIGNAL(TcpForbidden(QString)),tcp,SLOT(experimentForbidden(QString)));


    connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close()));
    connect(ui->actionFullscreen,SIGNAL(triggered(bool)),this,SLOT(setFullscreen(bool)));
    connect(ui->actionAbout_Qt,SIGNAL(triggered()),this,SLOT(showAboutQt()));
    connect(ui->actionNew_experiment,SIGNAL(triggered()),this,SLOT(getExperiment()));
    connect(ui->actionSave,SIGNAL(triggered()),experiment,SLOT(saveFile()));
    connect(ui->actionSave_as,SIGNAL(triggered()),this,SLOT(getFile()));
    connect(ui->actionStartMeasure,SIGNAL(toggled(bool)),experiment,SLOT(start(bool)));
    connect(ui->actionMeasuring_interval,SIGNAL(triggered()),this,SLOT(changeMeasureIntervalDialog()));
    connect(ui->actionControls,SIGNAL(triggered()),SLOT(showExperimentControlMangement()));
    connect(ui->actionData,SIGNAL(triggered()),SLOT(showData()));

    connect(experiment,SIGNAL(statusChanged(bool)),ui->actionStartMeasure,SLOT(setChecked(bool)));
    connect(experiment,SIGNAL(statusChanged(bool)),this,SLOT(statusChanged(bool)));
    connect(experiment,SIGNAL(experimentChanged(QString)),this,SLOT(setExperiment(QString)));
    connect(experiment,SIGNAL(measured(QString)),ui->plainTextEdit,SLOT(appendPlainText(QString)));
    connect(experiment,SIGNAL(fileChanged(QString)),this,SLOT(setFile(QString)));
    connect(experiment,SIGNAL(Notify(QString)),SLOT(notify(QString)));
    connect(experiment,SIGNAL(intervalChanged(int)),SLOT(setMeasureInterval(int)));
    connect(experiment,SIGNAL(updateProgress(int)),ui->measureIntervalProgressBar,SLOT(setValue(int)));

    connect(tcp,SIGNAL(clientCountChanged(int)),&tcpClientsLabel,SLOT(setNum(int)));

    experiment->setInterval(2000);

    // Additional ui preparation
    experimentLabel.setToolTip("Experiment configuration");
    statusLabel.setToolTip("Experiment status:\nR - running\nS - stopped");
    QFont font(statusLabel.font());
    font.setBold(true);
    statusLabel.setFont(font);
    //set experiment status to stopped
    statusChanged(false);
    tcpClientsLabel.setToolTip("Number of tcp clients");
    tcpClientsLabel.setNum(0);

    statusBar()->addPermanentWidget(&tcpClientsLabel);
    statusBar()->addPermanentWidget(&fileLabel);
    statusBar()->addPermanentWidget(&experimentLabel);
    statusBar()->addPermanentWidget(&statusLabel);

    // Ask user to select experiment
    getExperiment();
}
Пример #15
0
bool AVPlayer::load(const QString &path)
{
    setFile(path);
    return load();
}
Пример #16
0
void Field::addMsdFile()
{
	setFile(Msd);
}
Пример #17
0
 void itemDropped (const SourceDetails& dragSourceDetails)
 {
     setFile (dragSourceDetails.description.toString());
     isDragOver = false;
     repaint();
 }
Пример #18
0
void Field::addMrtFile()
{
	setFile(Mrt);
}
void ComAudio::preloadEffect(const char* pszFilePath)
{
    CocosDenshion::SimpleAudioEngine::getInstance()->preloadEffect(pszFilePath);
    setFile(pszFilePath);
    setLoop(false);
}
Пример #20
0
void Field::addMskFile()
{
	setFile(Msk);
}
Пример #21
0
void Qtilities::Core::QtilitiesFileInfo::setFileName(const QString& new_file_name) {
    setFile(FileUtils::toNativeSeparators(path() + QDir::separator() + new_file_name));
}