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 bool DEFAULT_SMALL_DIALOGS =
false;
30 m_zoomControl (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS),
31 m_zoomFactorInitial (DEFAULT_ZOOM_FACTOR_INITIAL),
32 m_mainTitleBarFormat (MAIN_TITLE_BAR_FORMAT_PATH),
33 m_pdfResolution (DEFAULT_IMPORT_PDF_RESOLUTION),
34 m_importCropping (DEFAULT_IMPORT_CROPPING),
35 m_maximumGridLines (DEFAULT_MAXIMUM_GRID_LINES),
36 m_highlightOpacity (DEFAULT_HIGHLIGHT_OPACITY),
37 m_smallDialogs (DEFAULT_SMALL_DIALOGS),
38 m_dragDropExport (DEFAULT_DRAG_DROP_EXPORT)
75 return m_dragDropExport;
80 return m_highlightOpacity;
85 return m_importCropping;
90 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindowModel::loadXml";
95 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
96 (reader.name() != DOCUMENT_SERIALIZE_MAIN_WINDOW)){
97 loadNextFromReader(reader);
105 reader.raiseError (QObject::tr (
"Cannot read main window data"));
116 return m_mainTitleBarFormat;
121 return m_maximumGridLines;
126 return m_pdfResolution;
130 QTextStream &str)
const 132 str << indentation <<
"MainWindowModel\n";
134 indentation += INDENTATION_DELTA;
136 str << indentation <<
"locale=" << m_locale.name() <<
"\n";
137 str << indentation <<
"zoomControl=" << m_zoomControl <<
"\n";
138 str << indentation <<
"zoomFactorInitial=" << m_zoomFactorInitial <<
"\n";
139 str << indentation <<
"mainWindowTitleBarFormat=" << (m_mainTitleBarFormat == MAIN_TITLE_BAR_FORMAT_NO_PATH ?
142 str << indentation <<
"pdfResolution=" << m_pdfResolution <<
"\n";
144 str << indentation <<
"maximumGridLines=" << m_maximumGridLines <<
"\n";
145 str << indentation <<
"highlightOpacity=" << m_highlightOpacity <<
"\n";
146 str << indentation <<
"smallDialogs=" << (m_smallDialogs ?
"yes" :
"no") <<
"\n";
147 str << indentation <<
"dragDropExport=" << (m_dragDropExport ?
"yes" :
"no") <<
"\n";
152 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindowModel::saveXml";
154 writer.writeStartElement(DOCUMENT_SERIALIZE_MAIN_WINDOW);
155 writer.writeEndElement();
174 QLocale::Country country)
178 locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
186 m_locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
201 m_pdfResolution = resolution;
221 return m_smallDialogs;
226 return m_zoomControl;
231 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.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
double highlightOpacity() const
Get method for highlight opacity.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
bool smallDialogs() const
Get method for small dialogs flag.
MainWindowModel()
Default constructor.
virtual void loadXml(QXmlStreamReader &reader)
Load model from serialized xml.
ZoomControl zoomControl() const
Get method for zoom control.
ImportCropping importCropping() const
Get method for import cropping.
Model for DlgSettingsMainWindow.
virtual void saveXml(QXmlStreamWriter &writer) const
Save entire model as xml into stream.
int maximumGridLines() const
Maximum number of grid lines.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
QLocale locale() const
Get method for locale.
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.
bool dragDropExport() const
Get method for drag and drop export.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
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.
void printStream(QString indentation, QTextStream &str) const
Debugging method that supports print method of this class and printStream method of some other class(...