14#include <QApplication>
18#include <QDoubleSpinBox>
19#include <QGraphicsScene>
44 "DlgSettingsMainWindow",
46 m_modelMainWindowBefore (
nullptr),
47 m_modelMainWindowAfter (
nullptr)
83 m_cmbZoomFactor->setWhatsThis(
tr (
"Initial Zoom\n\n"
84 "Select the initial zoom factor when a new document is loaded. Either the previous "
85 "zoom can be kept, or the specified zoom can be applied."));
87 layout->addWidget (m_cmbZoomFactor,
row++, 2);
97 m_cmbZoomControl->setWhatsThis (
tr (
"Zoom Control\n\n"
98 "Select which inputs are used to zoom in and out."));
100 layout->addWidget (m_cmbZoomControl,
row++, 2);
107 m_cmbLocale->setWhatsThis(
tr (
"Locale\n\n"
108 "Select the locale that will be used in numbers (immediately), and the language in the user "
109 "interface (after restart).\n\n"
110 "The locale determines how numbers are formatted. Specifically, either commas or "
111 "periods will be used as group delimiters in each number entered "
112 "by the user, displayed in the user interface, or exported to a file."));
121 m_cmbLocale->addItem (
label, locale);
123 m_cmbLocale->model()->sort(
COLUMN0);
125 layout->addWidget (m_cmbLocale,
row++, 2);
131 m_cmbImportCropping->setWhatsThis (
tr (
"Import Cropping\n\n"
132 "Enables or disables cropping of the imported image when importing. Cropping the image is useful "
133 "for removing unimportant information around a graph, but less useful when the graph already fills "
134 "the entire image.\n\n"
135 "This setting only has an effect when Engauge has been built with support for pdf files."));
141 layout->addWidget (m_cmbImportCropping,
row++, 2);
148 m_cmbPdfResolution->setWhatsThis (
tr (
"Import PDF Resolution\n\n"
149 "Imported Portable Document Format (PDF) files will be converted to this pixel resolution "
150 "in dots per inch (DPI), where each pixel is one dot. A higher value increases the picture resolution "
151 "and may also improve numeric digitizing accuracy. However, a very high value can make the image so "
152 "large that Engauge will slow down."));
153 m_cmbPdfResolution->addItem (
"75", 75);
154 m_cmbPdfResolution->addItem (
"100", 100);
155 m_cmbPdfResolution->addItem (
"150", 150);
156 m_cmbPdfResolution->addItem (
"200", 200);
157 m_cmbPdfResolution->addItem (
"250", 250);
158 m_cmbPdfResolution->addItem (
"300", 300);
160 layout->addWidget (m_cmbPdfResolution,
row++, 2);
166 m_spinMaximumGridLines =
new QSpinBox;
168 m_spinMaximumGridLines->setWhatsThis (
tr (
"Maximum Grid Lines\n\n"
169 "Maximum number of grid lines to be processed. This limit is applied when the step value is too "
170 "small for the start and stop values, which would result in too many grid lines visually and "
171 "possibly extremely long processing time (since each grid line would have to be processed)"));
173 layout->addWidget (m_spinMaximumGridLines,
row++, 2);
179 m_spinHighlightOpacity->setRange (0, 1);
180 m_spinHighlightOpacity->setSingleStep (0.1);
181 m_spinHighlightOpacity->setWhatsThis (
tr (
"Highlight Opacity\n\n"
182 "Opacity to be applied when the cursor is over a curve or axis point in Select mode. The change in "
183 "appearance shows when the point can be selected."));
185 layout->addWidget (m_spinHighlightOpacity,
row++, 2);
191 m_btnRecentClear->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
192 m_btnRecentClear->setWhatsThis (
tr (
"Recent File List Clear\n\n"
193 "Clear the recent file list in the File menu."));
196 layout->addWidget (m_btnRecentClear,
row++, 2);
202 m_chkTitleBarFormat->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
203 m_chkTitleBarFormat->setWhatsThis (
tr (
"Title Bar Filename\n\n"
204 "Includes or excludes the path and file extension from the filename in the title bar."));
206 layout->addWidget (m_chkTitleBarFormat,
row++, 2);
212 m_chkSmallDialogs->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
213 m_chkSmallDialogs->setWhatsThis (
tr (
"Allow Small Dialogs\n\n"
214 "Allows settings dialogs to be made very small so they fit on small computer screens."));
216 layout->addWidget (m_chkSmallDialogs,
row++, 2);
222 m_chkDragDropExport->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
223 m_chkDragDropExport->setWhatsThis (
tr (
"Allow Drag and Drop Export\n\n"
224 "Allows drag and drop export from the Curve Fitting Window and Geometry Window tables.\n\n"
225 "When drag and drop is disabled, a rectangular set of table cells can be selected using click and "
226 "drag. When drag and drop is enabled, a rectangular set of table cells can be selected using Click "
227 "then Shift+Click, since click and drag starts the drag operation."));
229 layout->addWidget (m_chkDragDropExport,
row++, 2);
234 m_chkImageReplaceRenamesDocument =
new QCheckBox;
235 m_chkImageReplaceRenamesDocument->setSizePolicy (QSizePolicy::Fixed, QSizePolicy::Fixed);
236 m_chkImageReplaceRenamesDocument->setWhatsThis (
tr (
"Image Replace Renames Document\n\n"
237 "When an image is imported to replace the current image, the document "
238 "will be renamed if this is true, otherwise the name will stay the same."));
239 connect (m_chkImageReplaceRenamesDocument,
SIGNAL (
toggled (
bool)),
this,
SLOT (slotImageReplaceRenamesDocument (
bool)));
240 layout->addWidget (m_chkImageReplaceRenamesDocument,
row++, 2);
245 m_spinSignificantDigits =
new QSpinBox;
247 m_spinSignificantDigits->setWhatsThis (
tr (
"Significant Digits\n\n"
248 "Number of digits of precision in floating point numbers. This value affects "
249 "calculations for curve fits, since intermediate results smaller than a "
250 "threshold T indicate that a polynomial curve with a specific order cannot be "
251 "fitted to the data. The threshold T is computed from the maximum matrix "
252 "element M and significant digits S as T = M / 10^S."));
254 layout->addWidget (m_spinSignificantDigits,
row++, 2);
270 layout->setColumnStretch(0, 1);
271 layout->setColumnStretch(1, 0);
272 layout->setColumnStretch(2, 0);
273 layout->setColumnStretch(3, 1);
281QStringList DlgSettingsMainWindow::gatherQmFilenames ()
const
315 delete m_modelMainWindowBefore;
316 delete m_modelMainWindowAfter;
323 int index = m_cmbZoomFactor->findData (m_modelMainWindowAfter->
zoomFactorInitial());
324 m_cmbZoomFactor->setCurrentIndex (index);
325 index = m_cmbZoomControl->findData (m_modelMainWindowAfter->
zoomControl());
326 m_cmbZoomControl->setCurrentIndex (index);
328 index = m_cmbLocale->findText (
locLabel);
332 index = m_cmbLocale->findText (
locLabel);
334 m_cmbLocale->setCurrentIndex(index);
335 index = m_cmbImportCropping->findData (m_modelMainWindowAfter->
importCropping());
336 m_cmbImportCropping->setCurrentIndex (index);
339 index = m_cmbPdfResolution->findData (m_modelMainWindowAfter->
pdfResolution());
340 m_cmbPdfResolution->setCurrentIndex(index);
342 m_spinMaximumGridLines->setValue (m_modelMainWindowAfter->
maximumGridLines());
343 m_spinHighlightOpacity->setValue (m_modelMainWindowAfter->
highlightOpacity());
344 m_chkSmallDialogs->setChecked (m_modelMainWindowAfter->
smallDialogs());
345 m_chkDragDropExport->setChecked (m_modelMainWindowAfter->
dragDropExport());
346 m_spinSignificantDigits->setValue (m_modelMainWindowAfter->
significantDigits ());
357void DlgSettingsMainWindow::slotDragDropExport (
bool)
365void DlgSettingsMainWindow::slotHighlightOpacity(
double)
373void DlgSettingsMainWindow::slotImageReplaceRenamesDocument (
bool)
381void DlgSettingsMainWindow::slotImportCropping (
int index)
389void DlgSettingsMainWindow::slotLocale (
int index)
393 QLocale locale = m_cmbLocale->itemData (index).toLocale();
395 m_modelMainWindowAfter->
setLocale (locale);
399void DlgSettingsMainWindow::slotMaximumGridLines (
int limit)
407void DlgSettingsMainWindow::slotPdfResolution(
const QString)
412 m_modelMainWindowAfter->
setPdfResolution(m_cmbPdfResolution->currentData().toInt());
417void DlgSettingsMainWindow::slotRecentFileClear()
425void DlgSettingsMainWindow::slotSignificantDigits(
int)
433void DlgSettingsMainWindow::slotSmallDialogs (
bool)
437 m_modelMainWindowAfter->
setSmallDialogs (m_chkSmallDialogs->isChecked());
441void DlgSettingsMainWindow::slotTitleBarFormat(
bool)
451void DlgSettingsMainWindow::slotZoomControl(
const QString)
459void DlgSettingsMainWindow::slotZoomFactor(
const QString)
467void DlgSettingsMainWindow::updateControls ()
const int INNER_RADIUS_MIN
const int MAX_GRID_LINES_MIN
const int MINIMUM_DIALOG_WIDTH_MAIN_WINDOW
const int MAX_GRID_LINES_MAX
const int MAX_SIGNIFICANT_DIGITS
const int MIN_SIGNIFICANT_DIGITS
#define ENGAUGE_ASSERT(cond)
Drop in replacement for Q_ASSERT if defined(QT_NO_DEBUG) && !defined(QT_FORCE_ASSERTS) define ENGAUGE...
@ 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 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 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.
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
Maximum number of grid lines.
int significantDigits() const
Get method for significant digits.
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.
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)