Reverted last exported filename saving

This commit is contained in:
Vadim Kuznetzov 2015-03-24 11:46:36 +03:00 committed by yodalee
parent 6dc6269d3e
commit 40e453360a
4 changed files with 14 additions and 6 deletions

View File

@ -26,9 +26,10 @@
#include <QtSvg>
ImageWriter::ImageWriter()
ImageWriter::ImageWriter(QString lastfile)
{
onlyDiagram = false;
lastExportFilename = lastfile;
}
ImageWriter::~ImageWriter()
@ -118,6 +119,11 @@ ImageWriter::noGuiPrint(QWidget *doc, QString printFile, QString color)
}
}
QString ImageWriter::getLastSavedFile()
{
return lastExportFilename;
}
void
ImageWriter::print(QWidget *doc)
{
@ -127,8 +133,6 @@ ImageWriter::print(QWidget *doc)
int w,h,wsel,hsel,
xmin, ymin, xmin_sel, ymin_sel;
QString lastExportFilename = QDir::homePath() + QDir::separator() + "export.png";
sch->getSchWidthAndHeight(w, h, xmin, ymin);
sch->getSelAreaWidthAndHeight(wsel, hsel, xmin_sel, ymin_sel);
w += border;

View File

@ -30,14 +30,17 @@ class QWidget;
class ImageWriter
{
public:
ImageWriter ();
ImageWriter (QString lastfile);
virtual ~ImageWriter ();
void print(QWidget *);
void noGuiPrint(QWidget *, QString printFile, QString color);
QString getLastSavedFile();
void setDiagram(bool diagram) { onlyDiagram = diagram; };
private:
bool onlyDiagram;
QString lastExportFilename;
};
#endif

View File

@ -331,7 +331,7 @@ int doPrint(QString schematic, QString printFile,
Printer->setFitToPage(true);
Printer->noGuiPrint(sch, printFile, page, dpi, color, orientation);
} else {
ImageWriter *Printer = new ImageWriter();
ImageWriter *Printer = new ImageWriter("");
Printer->noGuiPrint(sch, printFile, color);
}
return 0;

View File

@ -2783,8 +2783,9 @@ void QucsApp::slotSaveDiagramToGraphicsFile()
void QucsApp::slotSaveSchematicToGraphicsFile(bool diagram)
{
ImageWriter *writer = new ImageWriter();
ImageWriter *writer = new ImageWriter(lastExportFilename);
writer->setDiagram(diagram);
writer->print(DocumentTab->currentPage());
lastExportFilename = writer->getLastSavedFile();
delete writer;
}