Engauge Digitizer  2
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | List of all members
MainWindowModel Class Reference

Model for DlgSettingsMainWindow. More...

#include <MainWindowModel.h>

Inheritance diagram for MainWindowModel:
Inheritance graph
Collaboration diagram for MainWindowModel:
Collaboration graph

Public Member Functions

 MainWindowModel ()
 Default constructor. More...
 
 MainWindowModel (const MainWindowModel &other)
 Copy constructor. More...
 
MainWindowModeloperator= (const MainWindowModel &other)
 Assignment constructor. More...
 
bool dragDropExport () const
 Get method for drag and drop export. More...
 
double highlightOpacity () const
 Get method for highlight opacity. More...
 
bool imageReplaceRenamesDocument () const
 Get method for image replaces renames document. More...
 
ImportCropping importCropping () const
 Get method for import cropping. More...
 
virtual void loadXml (QXmlStreamReader &reader)
 Load model from serialized xml. More...
 
QLocale locale () const
 Get method for locale. More...
 
MainTitleBarFormat mainTitleBarFormat () const
 Get method for MainWindow titlebar filename format. More...
 
int maximumGridLines () const
 Maximum number of grid lines. More...
 
int pdfResolution () const
 Get method for resolution of imported PDF files, in dots per inch. More...
 
void printStream (QString indentation, QTextStream &str) const
 Debugging method that supports print method of this class and printStream method of some other class(es) More...
 
virtual void saveXml (QXmlStreamWriter &writer) const
 Save entire model as xml into stream. More...
 
void setDragDropExport (bool dragDropExport)
 Set method for drag and drop export. More...
 
void setHighlightOpacity (double highlightOpacity)
 Set method for highlight opacity. More...
 
void setImageReplaceRenamesDocument (bool imageReplaceRenamesDocument)
 Set method for image replace renames document. More...
 
void setImportCropping (ImportCropping importCropping)
 Set method for import cropping. More...
 
void setLocale (QLocale::Language language, QLocale::Country country)
 Set method for locale given attributes. More...
 
void setLocale (const QLocale &locale)
 Set method for locale given locale object. More...
 
void setMainTitleBarFormat (MainTitleBarFormat mainTitleBarFormat)
 Set method for MainWindow titlebar filename format. More...
 
void setMaximumGridLines (int maximumGridLines)
 Set method for maximum number of grid lines. More...
 
void setPdfResolution (int resolution)
 Set method for resolution of imported PDF files, in dots per inch. More...
 
void setSignificantDigits (int significantDigits)
 Set method for significant digits. More...
 
void setSmallDialogs (bool smallDialogs)
 Set method for small dialogs flag. More...
 
void setZoomControl (ZoomControl zoomControl)
 Set method for zoom control. More...
 
void setZoomFactorInitial (ZoomFactorInitial zoomFactorInitial)
 Set method for initial zoom factor. More...
 
int significantDigits () const
 Get method for significant digits. More...
 
bool smallDialogs () const
 Get method for small dialogs flag. More...
 
ZoomControl zoomControl () const
 Get method for zoom control. More...
 
ZoomFactorInitial zoomFactorInitial () const
 Get method for initial zoom factor. More...
 
- Public Member Functions inherited from DocumentModelAbstractBase
 DocumentModelAbstractBase ()
 Single constructor. More...
 
virtual ~DocumentModelAbstractBase ()
 Single destructor. More...
 

Additional Inherited Members

Detailed Description

Model for DlgSettingsMainWindow.

Unlike the other models (DocumentModel*) this data is not saved and loaded within the document, so no xml or working with the Document class is involved. Also, there is no associated Cmd. Instead, the settings are saved using QSettings. Methods involving xml/Document (from DocumentModelAbstractBase) are stubbed out

Definition at line 30 of file MainWindowModel.h.

Constructor & Destructor Documentation

MainWindowModel::MainWindowModel ( )

Default constructor.

Definition at line 31 of file MainWindowModel.cpp.

31  :
32  m_zoomControl (ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS),
33  m_zoomFactorInitial (DEFAULT_ZOOM_FACTOR_INITIAL),
34  m_mainTitleBarFormat (MAIN_TITLE_BAR_FORMAT_PATH),
35  m_pdfResolution (DEFAULT_IMPORT_PDF_RESOLUTION),
36  m_importCropping (DEFAULT_IMPORT_CROPPING),
37  m_maximumGridLines (DEFAULT_MAXIMUM_GRID_LINES),
38  m_highlightOpacity (DEFAULT_HIGHLIGHT_OPACITY),
39  m_smallDialogs (DEFAULT_SMALL_DIALOGS),
40  m_dragDropExport (DEFAULT_DRAG_DROP_EXPORT),
41  m_significantDigits (DEFAULT_SIGNIFICANT_DIGITS),
42  m_imageReplaceRenamesDocument (DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT)
43 {
44  // Locale member variable m_locale is initialized to default locale when default constructor is called
45 }
const ZoomFactorInitial DEFAULT_ZOOM_FACTOR_INITIAL
const double DEFAULT_HIGHLIGHT_OPACITY
const ImportCropping DEFAULT_IMPORT_CROPPING
bool DEFAULT_DRAG_DROP_EXPORT
const int DEFAULT_MAXIMUM_GRID_LINES
Default for maximum number of grid lines.
bool DEFAULT_SMALL_DIALOGS
bool DEFAULT_IMAGE_REPLACE_RENAMES_DOCUMENT
int DEFAULT_SIGNIFICANT_DIGITS
int DEFAULT_IMPORT_PDF_RESOLUTION
Filename without path.
MainWindowModel::MainWindowModel ( const MainWindowModel other)

Copy constructor.

Definition at line 47 of file MainWindowModel.cpp.

47  :
48  m_locale (other.locale()),
49  m_zoomControl (other.zoomControl()),
50  m_zoomFactorInitial (other.zoomFactorInitial()),
51  m_mainTitleBarFormat (other.mainTitleBarFormat()),
52  m_pdfResolution (other.pdfResolution()),
53  m_importCropping (other.importCropping()),
54  m_maximumGridLines (other.maximumGridLines()),
55  m_highlightOpacity (other.highlightOpacity()),
56  m_smallDialogs (other.smallDialogs()),
57  m_dragDropExport (other.dragDropExport()),
58  m_significantDigits (other.significantDigits()),
59  m_imageReplaceRenamesDocument (other.imageReplaceRenamesDocument())
60 {
61 }
bool imageReplaceRenamesDocument() const
Get method for image replaces renames document.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
int maximumGridLines() const
Maximum number of grid lines.
bool dragDropExport() const
Get method for drag and drop export.
bool smallDialogs() const
Get method for small dialogs flag.
int significantDigits() const
Get method for significant digits.
ZoomControl zoomControl() const
Get method for zoom control.
double highlightOpacity() const
Get method for highlight opacity.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
ImportCropping importCropping() const
Get method for import cropping.
QLocale locale() const
Get method for locale.

Member Function Documentation

bool MainWindowModel::dragDropExport ( ) const

Get method for drag and drop export.

Definition at line 81 of file MainWindowModel.cpp.

82 {
83  return m_dragDropExport;
84 }
double MainWindowModel::highlightOpacity ( ) const

Get method for highlight opacity.

Definition at line 86 of file MainWindowModel.cpp.

87 {
88  return m_highlightOpacity;
89 }
bool MainWindowModel::imageReplaceRenamesDocument ( ) const

Get method for image replaces renames document.

Definition at line 91 of file MainWindowModel.cpp.

92 {
93  return m_imageReplaceRenamesDocument;
94 }
ImportCropping MainWindowModel::importCropping ( ) const

Get method for import cropping.

Definition at line 96 of file MainWindowModel.cpp.

97 {
98  return m_importCropping;
99 }
void MainWindowModel::loadXml ( QXmlStreamReader &  reader)
virtual

Load model from serialized xml.

Implements DocumentModelAbstractBase.

Definition at line 101 of file MainWindowModel.cpp.

102 {
103  LOG4CPP_INFO_S ((*mainCat)) << "MainWindowModel::loadXml";
104 
105  bool success = true;
106 
107  // Read until end of this subtree
108  while ((reader.tokenType() != QXmlStreamReader::EndElement) ||
109  (reader.name() != DOCUMENT_SERIALIZE_MAIN_WINDOW)){
110  loadNextFromReader(reader);
111  if (reader.atEnd()) {
112  success = false;
113  break;
114  }
115  }
116 
117  if (!success) {
118  reader.raiseError (QObject::tr ("Cannot read main window data"));
119  }
120 }
QXmlStreamReader::TokenType loadNextFromReader(QXmlStreamReader &reader)
Load next token from xml reader.
Definition: Xml.cpp:14
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const QString DOCUMENT_SERIALIZE_MAIN_WINDOW
log4cpp::Category * mainCat
Definition: Logger.cpp:14
QLocale MainWindowModel::locale ( ) const

Get method for locale.

Definition at line 122 of file MainWindowModel.cpp.

123 {
124  return m_locale;
125 }
MainTitleBarFormat MainWindowModel::mainTitleBarFormat ( ) const

Get method for MainWindow titlebar filename format.

Definition at line 127 of file MainWindowModel.cpp.

128 {
129  return m_mainTitleBarFormat;
130 }
int MainWindowModel::maximumGridLines ( ) const

Maximum number of grid lines.

Definition at line 132 of file MainWindowModel.cpp.

133 {
134  return m_maximumGridLines;
135 }
MainWindowModel & MainWindowModel::operator= ( const MainWindowModel other)

Assignment constructor.

Definition at line 63 of file MainWindowModel.cpp.

64 {
65  m_locale = other.locale();
66  m_zoomControl = other.zoomControl();
67  m_zoomFactorInitial = other.zoomFactorInitial();
68  m_mainTitleBarFormat = other.mainTitleBarFormat();
69  m_pdfResolution = other.pdfResolution();
70  m_importCropping = other.importCropping();
71  m_maximumGridLines = other.maximumGridLines();
72  m_highlightOpacity = other.highlightOpacity();
73  m_smallDialogs = other.smallDialogs();
74  m_dragDropExport = other.dragDropExport();
75  m_significantDigits = other.significantDigits();
76  m_imageReplaceRenamesDocument = other.imageReplaceRenamesDocument();
77 
78  return *this;
79 }
bool imageReplaceRenamesDocument() const
Get method for image replaces renames document.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
int maximumGridLines() const
Maximum number of grid lines.
bool dragDropExport() const
Get method for drag and drop export.
bool smallDialogs() const
Get method for small dialogs flag.
int significantDigits() const
Get method for significant digits.
ZoomControl zoomControl() const
Get method for zoom control.
double highlightOpacity() const
Get method for highlight opacity.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
ImportCropping importCropping() const
Get method for import cropping.
QLocale locale() const
Get method for locale.
int MainWindowModel::pdfResolution ( ) const

Get method for resolution of imported PDF files, in dots per inch.

Definition at line 137 of file MainWindowModel.cpp.

138 {
139  return m_pdfResolution;
140 }
void MainWindowModel::printStream ( QString  indentation,
QTextStream &  str 
) const

Debugging method that supports print method of this class and printStream method of some other class(es)

Definition at line 142 of file MainWindowModel.cpp.

144 {
145  str << indentation << "MainWindowModel\n";
146 
147  indentation += INDENTATION_DELTA;
148 
149  str << indentation << "locale=" << m_locale.name() << "\n";
150  str << indentation << "zoomControl=" << m_zoomControl << "\n";
151  str << indentation << "zoomFactorInitial=" << m_zoomFactorInitial << "\n";
152  str << indentation << "mainWindowTitleBarFormat=" << (m_mainTitleBarFormat == MAIN_TITLE_BAR_FORMAT_NO_PATH ?
153  "NoPath" :
154  "Path") << "\n";
155  str << indentation << "pdfResolution=" << m_pdfResolution << "\n";
156  str << indentation << "importCropping=" << ImportCroppingUtilBase::importCroppingToString (m_importCropping).toLatin1().data() << "\n";
157  str << indentation << "maximumGridLines=" << m_maximumGridLines << "\n";
158  str << indentation << "highlightOpacity=" << m_highlightOpacity << "\n";
159  str << indentation << "smallDialogs=" << (m_smallDialogs ? "yes" : "no") << "\n";
160  str << indentation << "dragDropExport=" << (m_dragDropExport ? "yes" : "no") << "\n";
161  str << indentation << "significantDigits=" << m_significantDigits << "\n";
162  str << indentation << "imageReplaceRenamesDocument=" << (m_imageReplaceRenamesDocument ? "yes" : "no") << "\n";
163 }
static QString importCroppingToString(ImportCropping importCropping)
Option as string for display to user.
const QString INDENTATION_DELTA
void MainWindowModel::saveXml ( QXmlStreamWriter &  writer) const
virtual

Save entire model as xml into stream.

Implements DocumentModelAbstractBase.

Definition at line 165 of file MainWindowModel.cpp.

166 {
167  LOG4CPP_INFO_S ((*mainCat)) << "MainWindowModel::saveXml";
168 
169  writer.writeStartElement(DOCUMENT_SERIALIZE_MAIN_WINDOW);
170  writer.writeEndElement();
171 }
#define LOG4CPP_INFO_S(logger)
Definition: convenience.h:18
const QString DOCUMENT_SERIALIZE_MAIN_WINDOW
log4cpp::Category * mainCat
Definition: Logger.cpp:14
void MainWindowModel::setDragDropExport ( bool  dragDropExport)

Set method for drag and drop export.

Definition at line 173 of file MainWindowModel.cpp.

174 {
175  m_dragDropExport = dragDropExport;
176 }
bool dragDropExport() const
Get method for drag and drop export.
void MainWindowModel::setHighlightOpacity ( double  highlightOpacity)

Set method for highlight opacity.

Definition at line 178 of file MainWindowModel.cpp.

179 {
180  m_highlightOpacity = highlightOpacity;
181 }
double highlightOpacity() const
Get method for highlight opacity.
void MainWindowModel::setImageReplaceRenamesDocument ( bool  imageReplaceRenamesDocument)

Set method for image replace renames document.

Definition at line 183 of file MainWindowModel.cpp.

184 {
185  m_imageReplaceRenamesDocument = imageReplaceRenamesDocument;
186 }
bool imageReplaceRenamesDocument() const
Get method for image replaces renames document.
void MainWindowModel::setImportCropping ( ImportCropping  importCropping)

Set method for import cropping.

Definition at line 188 of file MainWindowModel.cpp.

189 {
190  m_importCropping = importCropping;
191 }
ImportCropping importCropping() const
Get method for import cropping.
void MainWindowModel::setLocale ( QLocale::Language  language,
QLocale::Country  country 
)

Set method for locale given attributes.

Definition at line 193 of file MainWindowModel.cpp.

195 {
196  QLocale locale (language,
197  country);
198  locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
199 
200  m_locale = locale;
201 }
const QLocale::NumberOption HIDE_GROUP_SEPARATOR
QLocale locale() const
Get method for locale.
void MainWindowModel::setLocale ( const QLocale &  locale)

Set method for locale given locale object.

Definition at line 203 of file MainWindowModel.cpp.

204 {
205  m_locale = locale;
206  m_locale.setNumberOptions(HIDE_GROUP_SEPARATOR);
207 }
const QLocale::NumberOption HIDE_GROUP_SEPARATOR
QLocale locale() const
Get method for locale.
void MainWindowModel::setMainTitleBarFormat ( MainTitleBarFormat  mainTitleBarFormat)

Set method for MainWindow titlebar filename format.

Definition at line 209 of file MainWindowModel.cpp.

210 {
211  m_mainTitleBarFormat = mainTitleBarFormat;
212 }
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void MainWindowModel::setMaximumGridLines ( int  maximumGridLines)

Set method for maximum number of grid lines.

Definition at line 214 of file MainWindowModel.cpp.

215 {
216  m_maximumGridLines = maximumGridLines;
217 }
int maximumGridLines() const
Maximum number of grid lines.
void MainWindowModel::setPdfResolution ( int  resolution)

Set method for resolution of imported PDF files, in dots per inch.

Definition at line 219 of file MainWindowModel.cpp.

220 {
221  m_pdfResolution = resolution;
222 }
void MainWindowModel::setSignificantDigits ( int  significantDigits)

Set method for significant digits.

Definition at line 224 of file MainWindowModel.cpp.

225 {
226  m_significantDigits = significantDigits;
227 }
int significantDigits() const
Get method for significant digits.
void MainWindowModel::setSmallDialogs ( bool  smallDialogs)

Set method for small dialogs flag.

Definition at line 229 of file MainWindowModel.cpp.

230 {
231  m_smallDialogs = smallDialogs;
232 }
bool smallDialogs() const
Get method for small dialogs flag.
void MainWindowModel::setZoomControl ( ZoomControl  zoomControl)

Set method for zoom control.

Definition at line 234 of file MainWindowModel.cpp.

235 {
236  m_zoomControl = zoomControl;
237 }
ZoomControl zoomControl() const
Get method for zoom control.
void MainWindowModel::setZoomFactorInitial ( ZoomFactorInitial  zoomFactorInitial)

Set method for initial zoom factor.

Definition at line 239 of file MainWindowModel.cpp.

240 {
241  m_zoomFactorInitial = zoomFactorInitial;
242 }
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
int MainWindowModel::significantDigits ( ) const

Get method for significant digits.

Definition at line 244 of file MainWindowModel.cpp.

245 {
246  return m_significantDigits;
247 }
bool MainWindowModel::smallDialogs ( ) const

Get method for small dialogs flag.

Definition at line 249 of file MainWindowModel.cpp.

250 {
251  return m_smallDialogs;
252 }
ZoomControl MainWindowModel::zoomControl ( ) const

Get method for zoom control.

Definition at line 254 of file MainWindowModel.cpp.

255 {
256  return m_zoomControl;
257 }
ZoomFactorInitial MainWindowModel::zoomFactorInitial ( ) const

Get method for initial zoom factor.

Definition at line 259 of file MainWindowModel.cpp.

260 {
261  return m_zoomFactorInitial;
262 }

The documentation for this class was generated from the following files: