示例#1
0
int 
main(int argc, char *argv[]) {
	// call this ONLY when linking with FreeImage as a static library
#ifdef FREEIMAGE_LIB
	FreeImage_Initialise();
#endif // FREEIMAGE_LIB

	// initialize FreeImage error handler

	FreeImage_SetOutputMessage(MyMessageFunc);

	// print version & copyright infos

	cout << "FreeImage " << FreeImage_GetVersion() << "\n";
	cout << FreeImage_GetCopyrightMessage() << "\n\n";

	// Print input formats (including external plugins) known by the library
	fstream importFile("fif_import.csv", ios::out);
	PrintImportFormats(importFile);
	importFile.close();

	// Print output formats (including plugins) known by the library
	// for each export format, supported bitdepths are given
	fstream exportFile("fif_export.csv", ios::out);
	PrintExportFormats(exportFile);
	exportFile.close();

	// call this ONLY when linking with FreeImage as a static library
#ifdef FREEIMAGE_LIB
	FreeImage_DeInitialise();
#endif // FREEIMAGE_LIB

	return 0;

}
示例#2
0
void KInfoCenter::exportClickedSlot()
{
    QString moduleName = m_contain->name();

    if(m_contain->exportText().isEmpty()) {
        KInfoCenter::showError(this,i18n("Export of the module has produced no output."));
        return;
    }

    QString fileName = QFileDialog::getSaveFileName(this, QString(moduleName + ".txt"));
    if(fileName.isEmpty()) return;

    QFile exportFile(fileName);

    if(!exportFile.open(QIODevice::WriteOnly)) {
        KInfoCenter::showError(this,i18n("Unable to open file to write export information"));
        return;
    }

    QTextStream exportTextStream( &exportFile );
    exportTextStream << (i18n("Export information for %1", moduleName))
        << "\n\n" << m_contain->exportText() << endl;

    exportFile.close();
    KInfoCenter::showError(this, i18n("Information exported"));
}
示例#3
0
//--------------------------------------------------------------------------
// 
//--------------------------------------------------------------------------
void tLogDatabaseExport::ExportFile( const QString& filepath )
{
    tFile exportFile( filepath );
    if ( !exportFile.open( QIODevice::WriteOnly ) )
    {
        m_Result = eExportResult_Error;
        m_ErrorCode = exportFile.error();
        m_ErrorMessage = exportFile.errorString();
        return;
    }

    // We need to open all the log files and write them in to the user selected file
    // in the correct order.
    QDir dir(tPath::HistoryFile());

    QStringList filter;
    filter << "Nmea0183log???.log";

    QStringList logs(dir.entryList(filter));

    // Work out what the resulting file size will be so we can emit a % signal
    // during the export
    quint64 totalExportSize = 0;
    quint64 exportedSize    = 0;
    foreach (QString log, logs)
    {
        QFileInfo fileInfo(dir.filePath(log));
        totalExportSize += fileInfo.size();
    }
示例#4
0
bool NoteItem::shortCut(int k)
{
    switch(k) {
        case Qt::Key_N:
            if(MainWindow::s_query.length()) {
                if(m_rich) {
                    TextBrowser* textBrowser = findChild<TextBrowser *>("contentWidget");
                    textBrowser->find(MainWindow::s_query);
                }
                else {
                    PlainTextBrowser* textBrowser = findChild<PlainTextBrowser *>("contentWidget");
                    textBrowser->find(MainWindow::s_query);
                }
            }
            return true;
        case Qt::Key_X:
            exportFile();
            return true;
        case Qt::Key_Left:
        case Qt::Key_Right:
            {
                NoteList *noteList = qobject_cast<NoteList*>(parentWidget());
                NoteItem* item = noteList->getNextNote(this,(k==Qt::Key_Right)?1:-1);
                if(item)
                    NoteItem::setActiveItem(item);
            }
            return true;
        case Qt::Key_Return:
            g_mainWindow->editActiveNote();
            return true;
        default:
            return false;
    }
}
示例#5
0
文件: mainwindow.cpp 项目: jabouzi/qt
void MainWindow::enginioFinished(EnginioReply *msg)
{
  if(msg->errorType() != EnginioReply::NoError) {
    return;
  }

  logDebug(QJsonDocument(msg->data()).toJson());

  if(msg == m_exportReply) {
    QJsonArray jsonArray(m_exportReply->data().value("results").toArray());
    QByteArray jsonText = QJsonDocument(jsonArray).toJson();
    QFile exportFile(m_exportFile->text());
    bool ok = exportFile.open(QIODevice::WriteOnly);
    if(ok) {
      exportFile.write(jsonText);
      log(tr("%1 object(s) exported to %2").arg(jsonArray.size()).arg(exportFile.fileName()));
    }
    else {
      logError(tr("Error %1 opening file %2").arg(exportFile.error()).arg(exportFile.fileName()));
    }
  }
  if(msg == m_queryForRemovalReply) {
    QJsonArray jsonArray(m_queryForRemovalReply->data().value("results").toArray());
    foreach(const QJsonValue &v, jsonArray) {
      QJsonObject removeObject(v.toObject());
      setObjectType(&removeObject);
      m_client->remove(removeObject);
    }
示例#6
0
void FileEditionWidget::setFiles(const QStringList &filenames)
{
	ui->tableWidget->clear();
	ui->tableWidget->setColumnCount(2);
	ui->tableWidget->setRowCount(filenames.count());
	ui->tableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
	ui->tableWidget->horizontalHeader()->setSectionResizeMode(FilenamePos, QHeaderView::Stretch);

	int row = 0;
	foreach(const QString& file, filenames)
	{
		QTableWidgetItem* item = new QTableWidgetItem(file);
		ui->tableWidget->setItem(row, FilenamePos, item);

		ButtonWidget* btns = new ButtonWidget(this);
		ui->tableWidget->setCellWidget(row, ButtonsPos, btns);

		_editMapper->setMapping(btns, file);
		_exportMapper->setMapping(btns, file);
		_importMapper->setMapping(btns, file);
		_resetMapper->setMapping(btns, file);

		connect(btns, SIGNAL(editFile()), _editMapper, SLOT(map()));
		connect(btns, SIGNAL(exportFile()), _exportMapper, SLOT(map()));
		connect(btns, SIGNAL(importFile()), _importMapper, SLOT(map()));
		connect(btns, SIGNAL(removeFile()), _resetMapper, SLOT(map()));

		++row;
	}
示例#7
0
int ProgramSenoko::prepGPIO(void)
{
    QFile exportFile("/sys/class/gpio/export");
    if (!exportFile.open(QIODevice::WriteOnly)) {
        testError(QString() + "Unable to open GPIO export file: " + exportFile.errorString());
        return 1;
    }
    exportFile.write("149");
    exportFile.close();

    QFile directionFile("/sys/class/gpio/gpio149/direction");
    if (!directionFile.open(QIODevice::WriteOnly)) {
        testError(QString() + "Unable to open GPIO149 direction file: " + directionFile.errorString());
        return 1;
    }
    directionFile.write("out\n");
    directionFile.close();

    QFile valueFile("/sys/class/gpio/gpio149/value");
    if (!valueFile.open(QIODevice::WriteOnly)) {
        testError(QString() + "Unable to open GPIO149 value file: " + valueFile.errorString());
        return 1;
    }
    valueFile.write("0\n");
    valueFile.close();

    return 0;
}
示例#8
0
PmChart::PmChart() : QMainWindow(NULL)
{
    my.dialogsSetup = false;
    setIconSize(QSize(22, 22));

    setupUi(this);

    my.statusBar = new StatusBar;
    setStatusBar(my.statusBar);
    connect(my.statusBar->timeFrame(), SIGNAL(clicked()),
				this, SLOT(editSamples()));
    connect(my.statusBar->timeButton(), SIGNAL(clicked()),
				this, SLOT(optionsShowTimeControl()));

    my.timeAxisRightAlign = toolBar->height();
    toolBar->setAllowedAreas(Qt::RightToolBarArea | Qt::TopToolBarArea);
    connect(toolBar, SIGNAL(orientationChanged(Qt::Orientation)),
		this, SLOT(updateToolbarOrientation(Qt::Orientation)));
    updateToolbarLocation();
    setupEnabledActionsList();
    if (!globalSettings.initialToolbar && !outfile)
	toolBar->hide();

    toolbarAction->setChecked(true);
    my.toolbarHidden = !globalSettings.initialToolbar;
    my.consoleHidden = true;
    if (!pmDebug)
	consoleAction->setVisible(false);
    consoleAction->setChecked(false);

    if (outfile)
	QTimer::singleShot(0, this, SLOT(exportFile()));
    else
	QTimer::singleShot(PmChart::defaultTimeout(), this, SLOT(timeout()));
}
示例#9
0
//////////////////////////////////////////////////////////////////////
// Set Functions
//////////////////////////////////////////////////////////////////////
bool GLC_WorldTo3ds::exportToFile(const QString& fileName, bool useAbsolutePosition)
{
	m_ReferenceToMesh.clear();
	m_NameToMaterial.clear();
	m_pRootLib3dsNode= NULL;
	m_CurrentNodeId= 0;
	m_OccIdToNodeId.clear();
	m_CurrentMeshIndex= 0;
	m_UseAbsolutePosition= useAbsolutePosition;
	m_TextureToFileName.clear();

	m_FileName= fileName;
	bool subject= false;
	{
		QFile exportFile(m_FileName);
		subject= exportFile.open(QIODevice::WriteOnly);
		exportFile.close();
	}
	if (subject)
	{
		m_pLib3dsFile= lib3ds_file_new();
		saveWorld();
		subject= lib3ds_file_save(m_pLib3dsFile, fileName.toLocal8Bit().data());
	}

	return subject;
}
示例#10
0
// Methodes
void Pin::exportPin() {
	ofstream exportFile(PATH_OF_EXPORT);
	if(!exportFile) {
		throw("EXPORT FAILED : " + string(strerror(errno)));
	}
	exportFile << this->m_number;
	exportFile.close();
}
示例#11
0
void LLWearable::saveNewAsset()
{
//	llinfos << "LLWearable::saveNewAsset() type: " << getTypeName() << llendl;
	//llinfos << *this << llendl;

	std::string new_asset_id_string;
	mAssetID.toString(new_asset_id_string);
	std::string filename;
	filename = gDirUtilp->getExpandedFilename(LL_PATH_CACHE,new_asset_id_string) + ".wbl";
	LLFILE* fp = LLFile::fopen(filename, "wb");		/* Flawfinder: ignore */
	BOOL successful_save = FALSE;
	if(fp && exportFile(fp))
	{
		successful_save = TRUE;
	}
	if(fp)
	{
		fclose(fp);
		fp = NULL;
	}
	if(!successful_save)
	{
		std::string buffer = llformat("Unable to save '%s' to wearable file.", mName.c_str());
		llwarns << buffer << llendl;
		
		LLStringUtil::format_map_t args;
		args["[NAME]"] = mName;
		gViewerWindow->alertXml("CannotSaveWearableOutOfSpace", args);
		return;
	}

	// save it out to database
	if( gAssetStorage )
	{
		 /*
		std::string url = gAgent.getRegion()->getCapability("NewAgentInventory");
		if (!url.empty())
		{
			llinfos << "Update Agent Inventory via capability" << llendl;
			LLSD body;
			body["folder_id"] = gInventory.findCategoryUUIDForType(getAssetType());
			body["asset_type"] = LLAssetType::lookup(getAssetType());
			body["inventory_type"] = LLInventoryType::lookup(LLInventoryType::IT_WEARABLE);
			body["name"] = getName();
			body["description"] = getDescription();
			LLHTTPClient::post(url, body, new LLNewAgentInventoryResponder(body, filename));
		}
		else
		{
		}
		 */
		 LLWearableSaveData* data = new LLWearableSaveData;
		 data->mType = mType;
		 gAssetStorage->storeAssetData(filename, mTransactionID, getAssetType(),
                                     &LLWearable::onSaveNewAssetComplete,
                                     (void*)data);
	}
}
示例#12
0
void StandardActions::createStandardActions()
{
    QAction *newAction = new QAction(tr("New"), mainWindow);
    newAction->setShortcut(QKeySequence("Ctrl+N"));
    mainWindow->getActionCollection()->addAction("new", newAction);
    connect(newAction, SIGNAL(triggered()), this, SLOT(newFile()));

    QAction *openAction = new QAction(tr("Open"), mainWindow);
    openAction->setShortcut(QKeySequence("Ctrl+O"));
    mainWindow->getActionCollection()->addAction("open", openAction);
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));

    QAction *saveAction = new QAction(tr("Save"), mainWindow);
    saveAction->setShortcut(QKeySequence("Ctrl+S"));
    mainWindow->getActionCollection()->addAction("save", saveAction);
    connect(saveAction, SIGNAL(triggered()), this, SLOT(saveFile()));

    QAction *saveAsAction = new QAction(tr("Save As"), mainWindow);
    mainWindow->getActionCollection()->addAction("saveas", saveAsAction);
    connect(saveAsAction, SIGNAL(triggered()), this, SLOT(saveFileAs()));

    QAction *exportAction = new QAction(tr("Export"), mainWindow);
    mainWindow->getActionCollection()->addAction("export", exportAction);
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportFile()));

    QAction *exitAction = new QAction(tr("Exit"), mainWindow);
    exitAction->setShortcut(QKeySequence("Ctrl+Q"));
    mainWindow->getActionCollection()->addAction("exit", exitAction);
    connect(exitAction, SIGNAL(triggered()), this, SLOT(exitApplication()));

    QAction* cutAction = new QAction(tr("Cut"), mainWindow);
    cutAction->setShortcut(QKeySequence("Ctrl+X"));
    mainWindow->getActionCollection()->addAction("cut", cutAction);
    connect(cutAction, SIGNAL(triggered()), this, SLOT(cut()));

    QAction* copyAction = new QAction(tr("Copy"), mainWindow);
    copyAction->setShortcut(QKeySequence("Ctrl+C"));
    mainWindow->getActionCollection()->addAction("copy", copyAction);
    connect(copyAction, SIGNAL(triggered()), this , SLOT(copy()));

    QAction* pasteAction = new QAction(tr("Paste"), mainWindow);
    pasteAction->setShortcut(QKeySequence("Ctrl+V"));
    mainWindow->getActionCollection()->addAction("paste", pasteAction);
    connect(pasteAction, SIGNAL(triggered()), this, SLOT(paste()));

    QAction* undoAction = new QAction(tr("Undo"), mainWindow);
    undoAction->setShortcut(QKeySequence("Ctrl+Z"));
    mainWindow->getActionCollection()->addAction("undo", undoAction);
    connect(undoAction, SIGNAL(triggered()), this, SLOT(undo()));

    QAction* redoAction = new QAction(tr("Redo"), mainWindow);
    redoAction->setShortcut(QKeySequence("Ctrl+R"));
    mainWindow->getActionCollection()->addAction("redo", redoAction);
    connect(redoAction, SIGNAL(triggered(bool)), this, SLOT(redo()));
}
示例#13
0
void PDFFactory::createActions()
{
    openAction = new QAction(tr("&Open"), this);
    openAction->setIcon(QIcon(":/images/open.png"));
    openAction->setShortcut(tr("Ctrl+O"));
    openAction->setStatusTip(tr("Open a PDF"));
    connect(openAction, SIGNAL(triggered()), this, SLOT(openFile()));

    exportAction = new QAction(tr("&Export a single file"), this);
    exportAction->setIcon(QIcon(":/images/export.png"));
    exportAction->setShortcut(tr("Ctrl+S"));
    exportAction->setStatusTip(tr("Export the selected file to a new PDF"));
    connect(exportAction, SIGNAL(triggered()), this, SLOT(exportFile()));

    exportAllAction = new QAction(tr("Export all"), this);
    exportAllAction->setIcon(QIcon(":/images/exportall.png"));
    exportAllAction->setShortcut(tr("Shift+Ctrl+S"));
    exportAllAction->setStatusTip(tr("Export all to multiple PDF files"));
    connect(exportAllAction, SIGNAL(triggered()), this, SLOT(exportAllFiles()));

    cutAction = new QAction(tr("C&ut"), this);
    cutAction->setIcon(QIcon(":/images/cut.png"));
    cutAction->setShortcut(tr("Ctrl+X"));
    cutAction->setStatusTip(tr("Cut selected contents to clipboard"));
    connect(cutAction, SIGNAL(triggered()), pdfTableView, SLOT(cutSelected()));

    copyAction = new QAction(tr("&Copy"), this);
    copyAction->setIcon(QIcon(":/images/copy.png"));
    copyAction->setShortcut(tr("Ctrl+C"));
    copyAction->setStatusTip(tr("Copy selected contents to clipboard"));
    connect(copyAction, SIGNAL(triggered()), pdfTableView, SLOT(copySelected()));

    pasteAction = new QAction(tr("&Paste"), this);
    pasteAction->setIcon(QIcon(":/images/paste.png"));
    pasteAction->setShortcut(tr("Ctrl+V"));
    pasteAction->setStatusTip(tr("Paste clipboard's contents into current selection"));
    //connect(pasteAction, SIGNAL(triggered()), textEdit, SLOT(paste()));

    deleteAction = new QAction(tr("&Delete"), this);
    deleteAction->setIcon(QIcon(":/images/delete.png"));
    deleteAction->setShortcut(tr("Ctrl+D"));
    deleteAction->setStatusTip(tr("Delete selected contents"));
    connect(deleteAction, SIGNAL(triggered()), pdfTableView, SLOT(deleteSelected()));

    rotateAction = new QAction(tr("&Rotate"), this);
    rotateAction->setIcon(QIcon(":/images/rotate.png"));
    rotateAction->setShortcut(tr("Ctrl+R"));
    rotateAction->setStatusTip(tr("Rotate selected pages"));
    connect(rotateAction, SIGNAL(triggered()), pdfTableView, SLOT(rotateSelected()));

    aboutAction = new QAction(tr("A&bout"), this);
    aboutAction->setIcon(QIcon(":/images/about.png"));
    aboutAction->setStatusTip(tr("About this program"));
    connect(aboutAction, SIGNAL(triggered()), this, SLOT(about()));
}
ReadWidget::ReadWidget(QWidget * parent) : QWidget(parent)
{
	// resource file reader
	reader = 0;

	// table model
	QStringList modelHeaderData;
	modelHeaderData << "Index" << "File Name" << "File Size";
	tableModel = new TableModel(modelHeaderData, false, this);

	// entire page layout
    pageLayout = new QVBoxLayout(this);

	// layout for the load controls
    loadLayout = new QHBoxLayout();
    pageLayout->addLayout(loadLayout);

	// line edit for file path
    loadLocation = new QLineEdit();
	loadLocation->setReadOnly(true);
    loadLayout->addWidget(loadLocation);

	// button to load open the file selection dialog
    loadButton = new QPushButton();
    loadButton->setText("Load Resource File");
    loadLayout->addWidget(loadButton);

	// layout to hold the table and controls
    tableLayout = new QHBoxLayout();
    pageLayout->addLayout(tableLayout);

	// table view
	tableView = new TableView();
	tableView->setModel(tableModel);
    tableLayout->addWidget(tableView);

	// layout to hold the table controls
    tableControlsLayout = new QVBoxLayout();
    tableLayout->addLayout(tableControlsLayout);

    tableControlsLayout->addStretch();

	// export button
    exportButton = new QPushButton();
    exportButton->setText("Export");
    tableControlsLayout->addWidget(exportButton);

    tableControlsLayout->addStretch();

	// connect actions
	connect(loadButton, SIGNAL(clicked()), this, SLOT(load()));
	connect(exportButton, SIGNAL(clicked()), this, SLOT(exportFile()));
}
示例#15
0
void PhotonMapExportDB::RemoveExistingFiles()
{

	QDir exportDirectory( m_dbDirectory );
	QString filename = m_dbFileName;

	QString exportFilename = exportDirectory.absoluteFilePath( filename.append( QLatin1String( ".db" ) ) );
	QFile exportFile( exportFilename );

	if(exportFile.exists() && !exportFile.remove() )
	{
		QString message= QString( "Error deleting database:%1.\n"
				"The database is in use. Please, close it before continuing. \n" ).arg( exportFilename );
		QMessageBox::warning( NULL, QLatin1String( "Tonatiuh" ), message );
		RemoveExistingFiles();
	}
}
示例#16
0
WaterWidget::WaterWidget(MapTile *file, QWidget *parent) :
    WoWFileWidget(parent)
  ,adtFile(file)
{
    saveButton = new QPushButton(tr("&Export"),this);
    importButton = new QPushButton(tr("&Import"),this);
    QLabel *label = new QLabel("Water Import/Export more features will be added in future",this);

    QVBoxLayout *mainLayout = new QVBoxLayout;
    mainLayout->addWidget(label);
    mainLayout->addWidget(saveButton,0,Qt::AlignRight);
    mainLayout->addWidget(importButton,0,Qt::AlignRight);

    connect(saveButton,SIGNAL(clicked()),this,SLOT(exportFile()));
    connect(importButton,SIGNAL(clicked()),this,SLOT(importFile()));

    this->setLayout(mainLayout);
}
示例#17
0
int MyExportButton::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QPushButton::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: requestMesh(); break;
        case 1: requestMtl(); break;
        case 2: exportFile(); break;
        case 3: acceptMesh((*reinterpret_cast< Mesh*(*)>(_a[1]))); break;
        case 4: acceptMtl((*reinterpret_cast< string(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 5;
    }
    return _id;
}
int MainWindow::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QMainWindow::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: eventChanged((*reinterpret_cast< AGSEventType(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 1: newFile(); break;
        case 2: openFile(); break;
        case 3: closeFile(); break;
        case 4: exportFile(); break;
        case 5: importToDatabase(); break;
        case 6: loadFile((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 7: openRecentFile(); break;
        case 8: showOptions(); break;
        case 9: updateTime(); break;
        case 10: lookupAGS_ID(); break;
        case 11: lookupPCC_ID(); break;
        case 12: lookupPCC_ID((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 13: setEventTypeID((*reinterpret_cast< QString(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 14: setEvent((*reinterpret_cast< AGSEventType(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 15: setLogoutTime(); break;
        case 16: setLogoutTime((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 17: setTShirtCalc((*reinterpret_cast< double(*)>(_a[1])),(*reinterpret_cast< bool(*)>(_a[2]))); break;
        case 18: setTimer((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2])),(*reinterpret_cast< int(*)>(_a[3]))); break;
        case 19: setTimer((*reinterpret_cast< int(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 20: boo(); break;
        case 21: showError((*reinterpret_cast< QString(*)>(_a[1]))); break;
        case 22: login(); break;
        case 23: logout(); break;
        case 24: about(); break;
        case 25: tutorial(); break;
        case 26: reportABug(); break;
        case 27: testConnection(); break;
        case 28: { QString _r = generateHeader();
            if (_a[0]) *reinterpret_cast< QString*>(_a[0]) = _r; }  break;
        case 29: rewriteHeader(); break;
        default: ;
        }
        _id -= 30;
    }
    return _id;
}
示例#19
0
/*
 * Export the flux distribution
 */
void FluxAnalysis::ExportAnalysis( QString directory, QString fileName, bool saveCoords )
{
	if( m_pPhotonMap == 0 || !m_pPhotonMap ) return;

	if( directory.isEmpty() ) return;

	if( fileName.isEmpty() ) return;

	QFileInfo exportFileInfo( fileName );
	if( exportFileInfo.completeSuffix().compare( "txt" ) )	fileName.append( ".txt" );

	QFile exportFile( directory + "/" + fileName  );
	exportFile.open( QIODevice::WriteOnly );
	QTextStream out( &exportFile );

	double widthCell = ( m_xmax - m_xmin ) / m_widthDivisions;
	double heightCell = ( m_ymax - m_ymin ) / m_heightDivisions;
	double areaCell = widthCell * heightCell;

	if( saveCoords )
	{
		out<<"x(m)\ty(m)\tFlux(W/m2)"<<"\n";

		for( int i = 0; i < m_heightDivisions; i++ )
		{
			for( int j = 0; j < m_widthDivisions; j++ )
			{
				out<< m_xmin + widthCell/2 + j * widthCell  << "\t" << m_ymin + heightCell/2 + i * heightCell <<  "\t" << m_photonCounts[i][j] * m_wPhoton / areaCell << "\n";
			}
		}
	}
	else
	{
		for( int i = 0; i < m_heightDivisions; i++ )
		{
			for( int j = 0; j < m_widthDivisions; j++ )
			{
				out<< m_photonCounts[m_heightDivisions-1-i][j] * m_wPhoton / areaCell << "\t";
			}
			out<<"\n" ;
		}
	}
	exportFile.close();
}
示例#20
0
bool IoController::writeToGPIOFile( const QString file, QString outputData )
{
  QFile exportFile( file );

  if ( exportFile.open( QIODevice::WriteOnly ) )
  {
    QTextStream exportStream( &exportFile );

    exportStream << outputData;

    exportFile.close();

    return true;
   }

  //qDebug() << "Error writing " << file;

  return false;
}
示例#21
0
void EmberEntityFactory::dumpAttributesOfEntity(const std::string& entityId) const
{
	EmberEntity* entity = static_cast<EmberEntity*>(mView.getEntity(entityId));
	if (entity) {
		//make sure the directory exists
		std::string dir(EmberServices::getSingleton().getConfigService().getHomeDirectory() + "/entityexport/");

		if (!oslink::directory(dir).isExisting()) {
			S_LOG_INFO("Creating directory " << dir);
			oslink::directory::mkdir(dir.c_str());
		}

		const std::string fileName(dir + entityId + ".atlas");
		std::fstream exportFile(fileName.c_str(), std::fstream::out);

		S_LOG_INFO("Dumping attributes to " << fileName);
		entity->dumpAttributes(exportFile, std::cout);
		ConsoleBackend::getSingletonPtr()->pushMessage(std::string("Dumped attributes to ") + fileName, "info");
	}
}
示例#22
0
FileEditionWidget::FileEditionWidget(QWidget *parent) :
	QWidget(parent),
	ui(new Ui::FileEditionWidget),  _askFileContext(None), _gridEditor(nullptr), _propertiesBrowser(nullptr),
    _propertyDialog(nullptr), _plainTextEditor(nullptr), _textDialog(nullptr),
	_nsEditor(nullptr), _nsDialog(nullptr)
{
	ui->setupUi(this);

	_editMapper = new QSignalMapper(this);
    connect(_editMapper, SIGNAL(mapped(QString)), this, SLOT(editFile(QString)));
	connect(ui->tableWidget, SIGNAL(cellDoubleClicked(int,int)), this, SLOT(rowDoubleClicked(int)));

	_exportMapper = new QSignalMapper(this);
    connect(_exportMapper, SIGNAL(mapped(QString)), this, SLOT(exportFile(QString)));

	_importMapper = new QSignalMapper(this);
    connect(_importMapper, SIGNAL(mapped(QString)), this, SLOT(importFile(QString)));

	_resetMapper = new QSignalMapper(this);
    connect(_resetMapper, SIGNAL(mapped(QString)), this, SLOT(resetFile(QString)));

    connect(ui->btnImportFile, SIGNAL(clicked()), this, SLOT(importFromDisk()));
    connect(ui->btnNewFile, SIGNAL(clicked()), this, SLOT(newFile()));
}
示例#23
0
void ReginaMain::exportSource() {
    exportFile(SourceHandler::instance, tr(FILTER_CPP_SOURCE),
        tr("Export C++ Source"));
}
示例#24
0
void ReginaMain::exportRegina() {
    exportFile(ReginaHandler(true), tr(FILTER_REGINA),
        tr("Export Regina Data File"));
}
示例#25
0
void ReginaMain::exportPython() {
    exportFile(PythonHandler::instance, tr(FILTER_PYTHON_SCRIPTS),
        tr("Export Python Script"));
}
示例#26
0
void ReginaMain::exportReginaUncompressed() {
    exportFile(ReginaHandler(false), tr(FILTER_REGINA),
        tr("Export Regina Data File"));
}
示例#27
0
void ReginaMain::exportSnapPea() {
    exportFile(SnapPeaHandler::instance, tr(FILTER_SNAPPEA),
        tr("Export SnapPea Triangulation"));
}
示例#28
0
void ArcInfoExportFileNode::update(void)
	{
	/* Do nothing if there is no export file name: */
	if(url.getNumValues()==0)
		return;
	
	/* Open the ARC/INFO export file: */
	IO::AutoFile exportFileSource(Comm::openFile(multiplexer,url.getValue(0).c_str()));
	IO::ValueSource exportFile(*exportFileSource);
	
	/* Check the file's format: */
	if(exportFile.readString()!="EXP"||exportFile.readInteger()!=0)
		return;
	
	/* Skip the rest of the header line: */
	exportFile.skipLine();
	exportFile.skipWs();
	
	/* Create a shape node to contain the polylines read from embedded ARC files: */
	ShapeNode* arcShape=new ShapeNode;
	IndexedLineSetNode* arcLineSet=new IndexedLineSetNode;
	arcShape->geometry.setValue(arcLineSet);
	ColorNode* arcLineSetColors=new ColorNode;
	arcLineSet->color.setValue(arcLineSetColors);
	CoordinateNode* arcLineSetCoords=new CoordinateNode;
	arcLineSet->coord.setValue(arcLineSetCoords);
	arcLineSet->colorPerVertex.setValue(false);
	
	/* Read embedded files until end-of-file: */
	while(!exportFile.eof())
		{
		/* Read the next embedded file's header: */
		std::string fileType=exportFile.readString();
		if(fileType=="EOS")
			{
			/* Marks the end of the file; ignore everything after here: */
			break;
			}
		else if(fileType=="ARC")
			{
			/* Skip the rest of the line: */
			exportFile.skipLine();
			exportFile.skipWs();
			
			/* Read polylines from the ARC file: */
			while(true)
				{
				/* Read the next block header: */
				int blockHeader[7];
				if(!readBlockHeader(exportFile,blockHeader)||blockHeader[0]==-1)
					break;
				
				/* Read all vertices in this polyline: */
				for(int i=0;i<blockHeader[6];++i)
					{
					/* Read the next vertex's 2D position: */
					double px=exportFile.readNumber();
					double py=exportFile.readNumber();
					
					/* Add the vertex to the current polyline: */
					arcLineSet->coordIndex.appendValue(arcLineSetCoords->point.getNumValues());
					arcLineSetCoords->point.appendValue(Point(px,py,0));
					}
				
				/* Finalize the current polyline: */
				arcLineSet->coordIndex.appendValue(-1);
				arcLineSetColors->color.appendValue(Color(1.0f,1.0f,1.0f));
				}
			}
		else if(fileType=="SIN")
			{
			/* Skip a SIN file: */
			while(!exportFile.eof()&&exportFile.readString()!="EOX")
				;
			}
		else if(fileType=="LOG")
			{
			/* Skip a LOG file: */
			while(!exportFile.eof()&&exportFile.readString()!="EOL")
				;
			}
		else if(fileType=="PRJ")
			{
			/* Skip a PRJ file: */
			while(!exportFile.eof()&&exportFile.readString()!="EOP")
				;
			}
		else if(fileType=="TX6"||fileType=="TX7"||fileType=="RXP"||fileType=="RPL")
			{
			/* Skip a text file: */
			while(!exportFile.eof()&&exportFile.readString()!="JABBERWOCKY") // What the hell?
				;
			}
		else if(fileType=="MTD")
			{
			/* Skip a MTD file: */
			while(!exportFile.eof()&&exportFile.readString()!="EOD")
				;
			}
		else if(fileType=="IFO")
			{
			/* Skip a IFO file: */
			while(!exportFile.eof()&&exportFile.readString()!="EOI")
				;
			}
		else
			{
			/* Temporarily mark newline characters as punctuation: */
			exportFile.setPunctuation('\n',true);
			
			/* Skip an unrecognized file: */
			while(!exportFile.eof())
				{
				/* Try to read a block header: */
				int values[7];
				if(readBlockHeader(exportFile,values)&&values[0]==-1)
					break;
				
				/* Skip the rest of the line: */
				exportFile.skipLine();
				exportFile.skipWs();
				}
			
			/* Mark newline characters as whitespace again: */
			exportFile.setWhitespace('\n',true);
			}
		}
	
	/* Finalize the generated nodes: */
	arcLineSetColors->update();
	arcLineSetCoords->update();
	arcLineSet->update();
	arcShape->update();
	
	/* Store all generated nodes as children: */
	children.appendValue(arcShape);
	GroupNode::update();
	}
示例#29
0
void ReginaMain::exportRecogniser() {
    exportFile(RecogniserHandler::instance, tr(FILTER_RECOGNISER),
        tr("Export Triangulation to 3-Manifold Recogniser"));
}
示例#30
0
bool GLC_WorldTo3dxml::exportTo3dxml(const QString& filename, GLC_WorldTo3dxml::ExportType exportType, bool exportMaterial)
{
	m_3dxmlFileSet.clear();
	m_ListOfOverLoadedOccurence.clear();
	m_FileNameIncrement= 0;
	m_ExportMaterial= exportMaterial;
	m_FileName= filename;
	m_ExportType= exportType;
	bool isExported= false;
	if (m_ExportType == Compressed3dxml)
	{
		m_p3dxmlArchive= new QuaZip(m_FileName);
		isExported= m_p3dxmlArchive->open(QuaZip::mdCreate);
		// Add the manifest
		addManifest();

	}
	else
	{
		m_AbsolutePath= QFileInfo(m_FileName).absolutePath() + QDir::separator();
		QFile exportFile(m_FileName);
		isExported= exportFile.open(QIODevice::WriteOnly);
		exportFile.close();
	}
	if (isExported)
	{
		if (m_ExportMaterial && (m_ExportType != StructureOnly))
		{
			writeAllMaterialRelatedFilesIn3dxml();
		}

		// Export the assembly structure from the list of structure reference
		exportAssemblyStructure();

		if (m_ExportType != StructureOnly)
		{
			int previousQuantumValue= 0;
			int currentQuantumValue= 0;
			emit currentQuantum(currentQuantumValue);

			int currentRepIndex= 0;
			const int size= m_ReferenceRepTo3dxmlFileName.size();
			// Export the representation
			QHash<const GLC_3DRep*, QString>::const_iterator iRep= m_ReferenceRepTo3dxmlFileName.constBegin();
			while ((m_ReferenceRepTo3dxmlFileName.constEnd() != iRep) && continu())
			{
				write3DRep(iRep.key(), iRep.value());
				++iRep;

				// Progrees bar indicator
				++currentRepIndex;
				currentQuantumValue = static_cast<int>((static_cast<double>(currentRepIndex) / size) * 100);
				if (currentQuantumValue > previousQuantumValue)
				{
					emit currentQuantum(currentQuantumValue);
				}
				previousQuantumValue= currentQuantumValue;
				if (!m_IsThreaded)
				{
					QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
				}
			}
		}
	}

	emit currentQuantum(100);
	return isExported;
}