7 #include "CmdMediator.h"
8 #include "DocumentSerialize.h"
9 #include "GraphicsPoint.h"
10 #include "GridLineLimiter.h"
11 #include "ImportCroppingUtilBase.h"
13 #include "MainWindowModel.h"
14 #include "PdfResolution.h"
17 #include <QTextStream>
18 #include "QtToString.h"
19 #include <QXmlStreamWriter>
21 #include "ZoomFactorInitial.h"
24 const QLocale::NumberOption HIDE_GROUP_SEPARATOR = QLocale::OmitGroupSeparator;
26 bool DEFAULT_DRAG_DROP_EXPORT =
false;
27 int DEFAULT_SIGNIFICANT_DIGITS = 7;
28 bool DEFAULT_SMALL_DIALOGS =
false;
31 m_zoomControl (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS),
32 m_zoomFactorInitial (DEFAULT_ZOOM_FACTOR_INITIAL),
33 m_mainTitleBarFormat (MAIN_TITLE_BAR_FORMAT_PATH),
34 m_pdfResolution (DEFAULT_IMPORT_PDF_RESOLUTION),
35 m_importCropping (DEFAULT_IMPORT_CROPPING),
36 m_maximumGridLines (DEFAULT_MAXIMUM_GRID_LINES),
37 m_highlightOpacity (DEFAULT_HIGHLIGHT_OPACITY),
38 m_smallDialogs (DEFAULT_SMALL_DIALOGS),
39 m_dragDropExport (DEFAULT_DRAG_DROP_EXPORT),
40 m_significantDigits (DEFAULT_SIGNIFICANT_DIGITS)
46 m_locale (other.locale()),
47 m_zoomControl (other.zoomControl()),
48 m_zoomFactorInitial (other.zoomFactorInitial()),
49 m_mainTitleBarFormat (other.mainTitleBarFormat()),
50 m_pdfResolution (other.pdfResolution()),
51 m_importCropping (other.importCropping()),
52 m_maximumGridLines (other.maximumGridLines()),
53 m_highlightOpacity (other.highlightOpacity()),
54 m_smallDialogs (other.smallDialogs()),
55 m_dragDropExport (other.dragDropExport()),
56 m_significantDigits (other.significantDigits())
79 return m_dragDropExport;
84 return m_highlightOpacity;
89 return m_importCropping;
94 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindowModel::loadXml";
99 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
100 (reader.name() != DOCUMENT_SERIALIZE_MAIN_WINDOW)){
101 loadNextFromReader(reader);
102 if (reader.atEnd()) {
109 reader.raiseError (QObject::tr (
"Cannot read main window data"));
120 return m_mainTitleBarFormat;
125 return m_maximumGridLines;
130 return m_pdfResolution;
134 QTextStream &str)
const
136 str << indentation <<
"MainWindowModel\n";
138 indentation += INDENTATION_DELTA;
140 str << indentation <<
"locale=" << m_locale.name() <<
"\n";
141 str << indentation <<
"zoomControl=" << m_zoomControl <<
"\n";
142 str << indentation <<
"zoomFactorInitial=" << m_zoomFactorInitial <<
"\n";
143 str << indentation <<
"mainWindowTitleBarFormat=" << (m_mainTitleBarFormat == MAIN_TITLE_BAR_FORMAT_NO_PATH ?
146 str << indentation <<
"pdfResolution=" << m_pdfResolution <<
"\n";
148 str << indentation <<
"maximumGridLines=" << m_maximumGridLines <<
"\n";
149 str << indentation <<
"highlightOpacity=" << m_highlightOpacity <<
"\n";
150 str << indentation <<
"smallDialogs=" << (m_smallDialogs ?
"yes" :
"no") <<
"\n";
151 str << indentation <<
"dragDropExport=" << (m_dragDropExport ?
"yes" :
"no") <<
"\n";
152 str << indentation <<
"significantDigits=" << m_significantDigits <<
"\n";
157 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindowModel::saveXml";
159 writer.writeStartElement(DOCUMENT_SERIALIZE_MAIN_WINDOW);
160 writer.writeEndElement();
179 QLocale::Country country)
183 locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
191 m_locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
206 m_pdfResolution = resolution;
231 return m_significantDigits;
236 return m_smallDialogs;
241 return m_zoomControl;
246 return m_zoomFactorInitial;
static QString importCroppingToString(ImportCropping importCropping)
Option as string for display to user.
MainWindowModel & operator=(const MainWindowModel &other)
Assignment constructor.
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
void setSignificantDigits(int significantDigits)
Set method for significant digits.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
int maximumGridLines() const
Maximum number of grid lines.
MainWindowModel()
Default constructor.
bool dragDropExport() const
Get method for drag and drop export.
bool smallDialogs() const
Get method for small dialogs flag.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
int significantDigits() const
Get method for significant digits.
ZoomControl zoomControl() const
Get method for zoom control.
Model for DlgSettingsMainWindow.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
double highlightOpacity() const
Get method for highlight opacity.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
ImportCropping importCropping() const
Get method for import cropping.
QLocale locale() const
Get method for locale.
void setPdfResolution(int resolution)
Set method for resolution of imported PDF files, in dots per inch.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.