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_SMALL_DIALOGS =
false;
29 m_zoomControl (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS),
30 m_zoomFactorInitial (DEFAULT_ZOOM_FACTOR_INITIAL),
31 m_mainTitleBarFormat (MAIN_TITLE_BAR_FORMAT_PATH),
32 m_pdfResolution (DEFAULT_IMPORT_PDF_RESOLUTION),
33 m_importCropping (DEFAULT_IMPORT_CROPPING),
34 m_maximumGridLines (DEFAULT_MAXIMUM_GRID_LINES),
35 m_highlightOpacity (DEFAULT_HIGHLIGHT_OPACITY),
36 m_smallDialogs (DEFAULT_SMALL_DIALOGS)
71 return m_highlightOpacity;
76 return m_importCropping;
81 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindowModel::loadXml";
86 while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
87 (reader.name() != DOCUMENT_SERIALIZE_MAIN_WINDOW)){
88 loadNextFromReader(reader);
96 reader.raiseError (QObject::tr (
"Cannot read main window data"));
107 return m_mainTitleBarFormat;
112 return m_maximumGridLines;
117 return m_pdfResolution;
121 QTextStream &str)
const 123 str << indentation <<
"MainWindowModel\n";
125 indentation += INDENTATION_DELTA;
127 str << indentation <<
"locale=" << m_locale.name() <<
"\n";
128 str << indentation <<
"zoomControl=" << m_zoomControl <<
"\n";
129 str << indentation <<
"zoomFactorInitial=" << m_zoomFactorInitial <<
"\n";
130 str << indentation <<
"mainWindowTitleBarFormat=" << (m_mainTitleBarFormat == MAIN_TITLE_BAR_FORMAT_NO_PATH ?
133 str << indentation <<
"pdfResolution=" << m_pdfResolution <<
"\n";
135 str << indentation <<
"maximumGridLines=" << m_maximumGridLines <<
"\n";
136 str << indentation <<
"highlightOpacity=" << m_highlightOpacity <<
"\n";
137 str << indentation <<
"smallDialogs=" << (m_smallDialogs ?
"yes" :
"no") <<
"\n";
142 LOG4CPP_INFO_S ((*mainCat)) <<
"MainWindowModel::saveXml";
144 writer.writeStartElement(DOCUMENT_SERIALIZE_MAIN_WINDOW);
145 writer.writeEndElement();
159 QLocale::Country country)
163 locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
171 m_locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
186 m_pdfResolution = resolution;
206 return m_smallDialogs;
211 return m_zoomControl;
216 return m_zoomFactorInitial;
static QString importCroppingToString(ImportCropping importCropping)
Option as string for display to user.
MainWindowModel & operator=(const MainWindowModel &other)
Assignment constructor.
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.
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(...