OutputFileHandler::OutputFileHandler(const char *filename) { outputIFF = new Iff(MAXIFFDATASIZE); outFilename = NULL; setCurrentFilename(filename); }
void Document::initCanvas() { delete m_canvas; m_canvas = new canvas::CanvasModel(m_client->myId(), this); m_toolctrl->setModel(m_canvas); connect(m_client, &net::Client::messageReceived, m_canvas, &canvas::CanvasModel::handleCommand); connect(m_client, &net::Client::drawingCommandLocal, m_canvas, &canvas::CanvasModel::handleLocalCommand); connect(m_client, &net::Client::sessionResetted, m_canvas, &canvas::CanvasModel::resetCanvas); connect(m_canvas, &canvas::CanvasModel::canvasModified, this, &Document::markDirty); connect(m_canvas->layerlist(), &canvas::LayerListModel::layerCommand, m_client, &net::Client::sendMessage); connect(m_canvas, &canvas::CanvasModel::titleChanged, this, &Document::sessionTitleChanged); connect(qApp, SIGNAL(settingsChanged()), m_canvas, SLOT(updateLayerViewOptions())); m_canvas->stateTracker()->setMaxHistorySize(1024*1024*10u); emit canvasChanged(m_canvas); setCurrentFilename(QString()); }
bool Document::loadCanvas(canvas::SessionLoader &loader) { QList<protocol::MessagePtr> init = loader.loadInitCommands(); if(init.isEmpty()) return false; setAutosave(false); initCanvas(); // Set local history size limit. This must be at least as big as the initializer, // otherwise a new snapshot will always have to be generated when hosting a session. uint minsizelimit = 0; for(protocol::MessagePtr msg : init) minsizelimit += msg->length(); minsizelimit *= 2; m_canvas->stateTracker()->setMaxHistorySize(qMax(1024*1024*10u, minsizelimit)); m_client->sendInitialSnapshot(init); setCurrentFilename(loader.filename()); unmarkDirty(); return true; }
bool Document::saveCanvas(const QString &filename) { if(m_canvas->save(filename)) { setCurrentFilename(filename); unmarkDirty(); return true; } return false; }
QString AMExporterGeneralAscii::exportScan(const AMScan *scan, const QString &destinationFolderPath, const AMExporterOption *option, int autoIndex) { setCurrentAutoIndex(autoIndex); setCurrentFilename(option->fileName()); setDestinationFolderPath(destinationFolderPath); // prepare scan and option setCurrentScan(scan); option_ = qobject_cast<const AMExporterOptionGeneralAscii*>(option); if(!option_) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -2, "Invalid options specified for the General Ascii Exporter. Please report this bug to the Acquaman developers.")); return QString(); } // prepare data sources if(!prepareDataSources()) return QString(); // prepare export file mainFileName_ = parseKeywordString( destinationFolderPath % "/" % option->fileName() ); qDebug() << "Wants to save as " << mainFileName_; if(!openFile(mainFileName_)) { AMErrorMon::report(AMErrorReport(this, AMErrorReport::Alert, -3, "Export failed: Could not open the file '" % mainFileName_ % "' for writing. Check that you have permission to save files there, and that a file with that name doesn't already exists.")); return QString(); } writeHeader(); writeMainTable(); writeSeparateSections(); if(option_->includeHigherDimensionSources() && !writeSeparateFiles(destinationFolderPath)) { file_->close(); return QString(); } file_->close(); return mainFileName_; }