14#include <QApplication>
18#include <QDoubleSpinBox>
19#include <QGraphicsScene>
50 "DlgSettingsMainWindow",
52 m_modelMainWindowBefore (
nullptr),
53 m_modelMainWindowAfter (
nullptr)
89 m_cmbZoomFactor->setWhatsThis(
tr (
"Initial Zoom\n\n"
90 "Select the initial zoom factor when a new document is loaded. Either the previous "
91 "zoom can be kept, or the specified zoom can be applied."));
93 layout->addWidget (m_cmbZoomFactor,
row++, 2);
103 m_cmbZoomControl->setWhatsThis (
tr (
"Zoom Control\n\n"
104 "Select which inputs are used to zoom in and out."));
106 layout->addWidget (m_cmbZoomControl,
row++, 2);
113 m_cmbLocale->setWhatsThis(
tr (
"Locale\n\n"
114 "Select the locale that will be used in numbers (immediately), and the language in the user "
115 "interface (after restart).\n\n"
116 "The locale determines how numbers are formatted. Specifically, either commas or "
117 "periods will be used as group delimiters in each number entered "
118 "by the user, displayed in the user interface, or exported to a file."));
127 m_cmbLocale->addItem (
label, locale);
129 m_cmbLocale->model()->sort(
COLUMN0);
131 layout->addWidget (m_cmbLocale,
row++, 2);
137 m_cmbImportCropping->setWhatsThis (
tr (
"Import Cropping\n\n"
138 "Enables or disables cropping of the imported image when importing. Cropping the image is useful "
139 "for removing unimportant information around a graph, but less useful when the graph already fills "
140 "the entire image.\n\n"
141 "This setting only has an effect when Engauge has been built with support for pdf files."));
147 layout->addWidget (m_cmbImportCropping,
row++, 2);
154 m_cmbPdfResolution->setWhatsThis (
tr (
"Import PDF Resolution\n\n"
155 "Imported Portable Document Format (PDF) files will be converted to this pixel resolution "
156 "in dots per inch (DPI), where each pixel is one dot. A higher value increases the picture resolution "
157 "and may also improve numeric digitizing accuracy. However, a very high value can make the image so "
158 "large that Engauge will slow down."));
159 m_cmbPdfResolution->addItem (
"75", 75);
160 m_cmbPdfResolution->addItem (
"100", 100);
161 m_cmbPdfResolution->addItem (
"150", 150);
162 m_cmbPdfResolution->addItem (
"200", 200);
163 m_cmbPdfResolution->addItem (
"250", 250);
164 m_cmbPdfResolution->addItem (
"300", 300);
166 layout->addWidget (m_cmbPdfResolution,
row++, 2);
172 m_spinMaximumGridLines =
new QSpinBox;
174 m_spinMaximumGridLines->setWhatsThis (
tr (
"Maximum Grid Lines\n\n"
175 "Maximum number of grid lines to be processed. This limit is applied when the step value is too "
176 "small for the start and stop values, which would result in too many grid lines visually and "
177 "possibly extremely long processing time (since each grid line would have to be processed)"));
179 layout->addWidget (m_spinMaximumGridLines,
row++, 2);
184 m_spinMaximumExportedPointsPerCurve =
new QSpinBox;
187 m_spinMaximumExportedPointsPerCurve->setWhatsThis (
tr (
"Maximum Exported Points per Curve\n\n"
188 "This is the maximum number of points allowed in each exported curve. No points are "
189 "exported when this is exceeded. This limit prevents delays and overly large file sizes due "
190 "to curves that have too many points."));
192 layout->addWidget (m_spinMaximumExportedPointsPerCurve,
row++, 2);
198 m_spinHighlightOpacity->setRange (0, 1);
199 m_spinHighlightOpacity->setSingleStep (0.1);
200 m_spinHighlightOpacity->setWhatsThis (
tr (
"Highlight Opacity\n\n"
201 "Opacity to be applied when the cursor is over a curve or axis point in Select mode. The change in "
202 "appearance shows when the point can be selected."));
204 layout->addWidget (m_spinHighlightOpacity,
row++, 2);
210 m_btnRecentClear->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
211 m_btnRecentClear->setWhatsThis (
tr (
"Recent File List Clear\n\n"
212 "Clear the recent file list in the File menu."));
215 layout->addWidget (m_btnRecentClear,
row++, 2);
221 m_chkTitleBarFormat->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
222 m_chkTitleBarFormat->setWhatsThis (
tr (
"Title Bar Filename\n\n"
223 "Includes or excludes the path and file extension from the filename in the title bar."));
225 layout->addWidget (m_chkTitleBarFormat,
row++, 2);
231 m_chkSmallDialogs->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
232 m_chkSmallDialogs->setWhatsThis (
tr (
"Allow Small Dialogs\n\n"
233 "Allows settings dialogs to be made very small so they fit on small computer screens."));
235 layout->addWidget (m_chkSmallDialogs,
row++, 2);
241 m_chkDragDropExport->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
242 m_chkDragDropExport->setWhatsThis (
tr (
"Allow Drag and Drop Export\n\n"
243 "Allows drag and drop export from the Curve Fitting Window and Geometry Window tables.\n\n"
244 "When drag and drop is disabled, a rectangular set of table cells can be selected using click and "
245 "drag. When drag and drop is enabled, a rectangular set of table cells can be selected using Click "
246 "then Shift+Click, since click and drag starts the drag operation."));
248 layout->addWidget (m_chkDragDropExport,
row++, 2);
253 m_chkImageReplaceRenamesDocument =
new QCheckBox;
254 m_chkImageReplaceRenamesDocument->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
255 m_chkImageReplaceRenamesDocument->setWhatsThis (
tr (
"Image Replace Renames Document\n\n"
256 "When an image is imported to replace the current image, the document "
257 "will be renamed if this is true, otherwise the name will stay the same."));
258 connect (m_chkImageReplaceRenamesDocument,
SIGNAL (
toggled (
bool)),
this,
SLOT (slotImageReplaceRenamesDocument (
bool)));
259 layout->addWidget (m_chkImageReplaceRenamesDocument,
row++, 2);
264 m_spinSignificantDigits =
new QSpinBox;
266 m_spinSignificantDigits->setWhatsThis (
tr (
"Significant Digits\n\n"
267 "Number of digits of precision in floating point numbers. This value affects "
268 "calculations for curve fits, since intermediate results smaller than a "
269 "threshold T indicate that a polynomial curve with a specific order cannot be "
270 "fitted to the data. The threshold T is computed from the maximum matrix "
271 "element M and significant digits S as T = M / 10^S."));
273 layout->addWidget (m_spinSignificantDigits,
row++, 2);
279 m_cmbGuidelineColor->setWhatsThis (
tr (
"Guidelines Color\n\n"
280 "Set the color of the guidelines that can be dragged from the edges of the scene, and used "
284 layout->addWidget (m_cmbGuidelineColor,
row++, 2);
300 layout->setColumnStretch(0, 1);
301 layout->setColumnStretch(1, 0);
302 layout->setColumnStretch(2, 0);
303 layout->setColumnStretch(3, 1);
311QStringList DlgSettingsMainWindow::gatherQmFilenames ()
const
345 delete m_modelMainWindowBefore;
346 delete m_modelMainWindowAfter;
353 int index = m_cmbZoomFactor->findData (m_modelMainWindowAfter->
zoomFactorInitial());
354 m_cmbZoomFactor->setCurrentIndex (index);
355 index = m_cmbZoomControl->findData (m_modelMainWindowAfter->
zoomControl());
356 m_cmbZoomControl->setCurrentIndex (index);
358 index = m_cmbLocale->findText (
locLabel);
362 index = m_cmbLocale->findText (
locLabel);
364 m_cmbLocale->setCurrentIndex(index);
365 index = m_cmbImportCropping->findData (m_modelMainWindowAfter->
importCropping());
366 m_cmbImportCropping->setCurrentIndex (index);
369 index = m_cmbPdfResolution->findData (m_modelMainWindowAfter->
pdfResolution());
370 m_cmbPdfResolution->setCurrentIndex(index);
372 m_spinMaximumGridLines->setValue (m_modelMainWindowAfter->
maximumGridLines());
373 m_spinHighlightOpacity->setValue (m_modelMainWindowAfter->
highlightOpacity());
374 m_chkSmallDialogs->setChecked (m_modelMainWindowAfter->
smallDialogs());
375 m_chkDragDropExport->setChecked (m_modelMainWindowAfter->
dragDropExport());
376 m_spinSignificantDigits->setValue (m_modelMainWindowAfter->
significantDigits ());
382 m_cmbGuidelineColor->setCurrentIndex(
indexColor);
392void DlgSettingsMainWindow::slotDragDropExport (
bool)
400void DlgSettingsMainWindow::slotGuidelineColor (
QString const &)
408void DlgSettingsMainWindow::slotHighlightOpacity(
double)
416void DlgSettingsMainWindow::slotImageReplaceRenamesDocument (
bool)
424void DlgSettingsMainWindow::slotImportCropping (
int index)
432void DlgSettingsMainWindow::slotLocale (
int index)
436 QLocale locale = m_cmbLocale->itemData (index).toLocale();
438 m_modelMainWindowAfter->
setLocale (locale);
442void DlgSettingsMainWindow::slotMaximumExportedPointsPerCurve (
int limit)
450void DlgSettingsMainWindow::slotMaximumGridLines (
int limit)
458void DlgSettingsMainWindow::slotPdfResolution(
const QString)
463 m_modelMainWindowAfter->
setPdfResolution(m_cmbPdfResolution->currentData().toInt());
468void DlgSettingsMainWindow::slotRecentFileClear()
476void DlgSettingsMainWindow::slotSignificantDigits(
int)
484void DlgSettingsMainWindow::slotSmallDialogs (
bool)
488 m_modelMainWindowAfter->
setSmallDialogs (m_chkSmallDialogs->isChecked());
492void DlgSettingsMainWindow::slotTitleBarFormat(
bool)
502void DlgSettingsMainWindow::slotZoomControl(
const QString)
510void DlgSettingsMainWindow::slotZoomFactor(
const QString)
518void DlgSettingsMainWindow::updateControls ()
const int INNER_RADIUS_MIN
const int MAX_GRID_LINES_MIN
const int MAX_MAX_EXPORTED_POINTS_PER_CURVE
const int MINIMUM_DIALOG_WIDTH_MAIN_WINDOW
const int MIN_MAX_EXPORTED_POINTS_PER_CURVE
const int MAX_GRID_LINES_MAX
const int STEP_MAX_EXPORTED_POINTS_PER_CURVE
const int MAX_SIGNIFICANT_DIGITS
const int MIN_SIGNIFICANT_DIGITS
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT.
@ IMPORT_CROPPING_MULTIPAGE_PDFS
log4cpp::Category * mainCat
@ MAIN_TITLE_BAR_FORMAT_NO_PATH
@ MAIN_TITLE_BAR_FORMAT_PATH
Filename without path.
QString QLocaleToString(const QLocale &locale)
@ ZOOM_CONTROL_MENU_WHEEL_PLUSMINUS
@ ZOOM_CONTROL_MENU_WHEEL
@ ZOOM_CONTROL_MENU_PLUSMINUS
const QString * LABEL_ZOOM_1_TO_4
const QString * LABEL_ZOOM_16_TO_1
const QString * LABEL_ZOOM_1_TO_2
const QString * LABEL_ZOOM_1_TO_8
const QString * LABEL_ZOOM_1_TO_1
const QString * LABEL_ZOOM_2_TO_1
const QString * LABEL_ZOOM_8_TO_1
const QString * LABEL_ZOOM_4_TO_1
const QString * LABEL_ZOOM_PREVIOUS
const QString * LABEL_ZOOM_FILL
const QString * LABEL_ZOOM_1_TO_16
Abstract base class for all Settings dialogs.
void setCmdMediator(CmdMediator &cmdMediator)
Store CmdMediator for easy access by the leaf class.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
CmdMediator & cmdMediator()
Provide access to Document information wrapped inside CmdMediator.
void populateColorComboWithoutTransparent(QComboBox &combo)
Add colors in color palette to combobox, without transparent entry at end.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
MainWindow & mainWindow()
Get method for MainWindow.
void loadMainWindowModel(CmdMediator &cmdMediator, const MainWindowModel &modelMainWindow)
Replaced load method since the main window settings are independent of document, unlike other DlgSett...
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
DlgSettingsMainWindow(MainWindow &mainWindow)
Single constructor.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void handleOk()
Process slotOk.
virtual ~DlgSettingsMainWindow()
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
Utility class for import cropping options.
Model for DlgSettingsMainWindow.
void setSmallDialogs(bool smallDialogs)
Set method for small dialogs flag.
QLocale locale() const
Get method for locale.
void setGuidelineColor(ColorPalette guidelineColor)
Set method for guideline color.
void setImageReplaceRenamesDocument(bool imageReplaceRenamesDocument)
Set method for image replace renames document.
bool dragDropExport() const
Get method for drag and drop export.
bool imageReplaceRenamesDocument() const
Get method for image replaces renames document.
ZoomFactorInitial zoomFactorInitial() const
Get method for initial zoom factor.
void setImportCropping(ImportCropping importCropping)
Set method for import cropping.
void setMaximumExportedPointsPerCurve(int maximumExportedPointsPerCurve)
Set method for maximum number of exported points per curve.
ImportCropping importCropping() const
Get method for import cropping.
bool smallDialogs() const
Get method for small dialogs flag.
void setMainTitleBarFormat(MainTitleBarFormat mainTitleBarFormat)
Set method for MainWindow titlebar filename format.
void setDragDropExport(bool dragDropExport)
Set method for drag and drop export.
double highlightOpacity() const
Get method for highlight opacity.
void setZoomControl(ZoomControl zoomControl)
Set method for zoom control.
void setMaximumGridLines(int maximumGridLines)
Set method for maximum number of grid lines.
ZoomControl zoomControl() const
Get method for zoom control.
void setPdfResolution(int resolution)
Set method for resolution of imported PDF files, in dots per inch.
int maximumGridLines() const
Get method for maximum number of grid lines.
int significantDigits() const
Get method for significant digits.
ColorPalette guidelineColor() const
Get method for guideline color.
void setZoomFactorInitial(ZoomFactorInitial zoomFactorInitial)
Set method for initial zoom factor.
MainTitleBarFormat mainTitleBarFormat() const
Get method for MainWindow titlebar filename format.
void setHighlightOpacity(double highlightOpacity)
Set method for highlight opacity.
int maximumExportedPointsPerCurve() const
Get method for maximum number of exported points per curve.
void setLocale(QLocale::Language language, QLocale::Country country)
Set method for locale given attributes.
int pdfResolution() const
Get method for resolution of imported PDF files, in dots per inch.
void setSignificantDigits(int significantDigits)
Set method for significant digits.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
void updateSettingsMainWindow(const MainWindowModel &modelMainWindow)
Update with new main window properties.
static QString qmDirectory()
Platform dependent directory containing qm translation files.
#define LOG4CPP_INFO_S(logger)
#define LOG4CPP_ERROR_S(logger)