Engauge Digitizer 2
Loading...
Searching...
No Matches
DlgImportAdvanced.cpp
Go to the documentation of this file.
1/******************************************************************************************************
2 * (C) 2014 markummitchell@github.com. This file is part of Engauge Digitizer, which is released *
3 * under GNU General Public License version 2 (GPLv2) or (at your option) any later version. See file *
4 * LICENSE or go to gnu.org/licenses for details. Distribution requires prior written permission. *
5 ******************************************************************************************************/
6
7#include "DlgImportAdvanced.h"
8#include "Logger.h"
9#include "MainWindow.h"
10#include <QGridLayout>
11#include <QLabel>
12#include <QRadioButton>
13#include <QSpinBox>
14
16
18 DlgSettingsAbstractBase (tr ("Import Advanced"),
19 "DlgImportAdvanced",
21{
22 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::DlgImportAdvanced";
23
24 QWidget *subPanel = createSubPanel ();
25 finishPanel (subPanel,
27
28 // Accept even the default value without any additional actions, rather than delay the Ok button to after a change
29 enableOk (true);
31}
32
33void DlgImportAdvanced::createOptionalSaveDefault (QHBoxLayout * /* layout */)
34{
35 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::createOptionalSaveDefault";
36}
37
39{
40 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::createSubPanel";
41
42 QWidget *subPanel = new QWidget ();
43 QGridLayout *layout = new QGridLayout (subPanel);
44 subPanel->setLayout (layout);
45
46 int row = 0;
47
48 // Coordinate system count
49 QLabel *labelCoordCount = new QLabel (QString ("%1:").arg (tr ("Coordinate System Count")));
50 layout->addWidget (labelCoordCount, row, 1);
51
52 m_spinCoordSystemCount = new QSpinBox;
53 m_spinCoordSystemCount->setMinimum (1);
54 m_spinCoordSystemCount->setValue (1);
55 m_spinCoordSystemCount->setWhatsThis (tr ("Coordinate System Count\n\n"
56 "Specifies the total number of coordinate systems that will be used in the imported image. "
57 "There can be one or more graphs in the image, and each graph can have one or more "
58 "coordinate systems. Each coordinate system is defined by a pair of coordinate axes."));
59 connect (m_spinCoordSystemCount, SIGNAL (valueChanged (const QString &)), this, SLOT (slotCoordSystemCount (const QString &)));
60 layout->addWidget (m_spinCoordSystemCount, row++, 2);
61
62 // Axes point count
63 QLabel *labelPointCount = new QLabel (QString ("%1:").arg (tr ("Graph Coordinates Definition")));
64 layout->addWidget (labelPointCount, row, 1);
65
66 m_btnAxesPointCount2 = new QRadioButton (tr ("1 scale bar - Used for maps with a scale bar defining the map scale"));
67 m_btnAxesPointCount2->setWhatsThis (tr ("The two endpoints of the scale bar will define the scale of a map. The scale bar can "
68 "edited to set its length.\n\n"
69 "This setting is used when importing a map that has only a scale bar "
70 "to define distance, rather than a graph with axes that define two coordinates."));
71 connect (m_btnAxesPointCount2, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
72 layout->addWidget (m_btnAxesPointCount2, row++, 2);
73
74 m_btnAxesPointCount3 = new QRadioButton (tr ("3 axis points - Used for graphs with both coordinates defined on each axis"));
75 m_btnAxesPointCount3->setChecked (true); // This is the traditional setting, and so is used as the default
76 m_btnAxesPointCount3->setWhatsThis (tr ("Three axes points will define the coordinate system. Each will have both "
77 "x and y coordinates.\n\n"
78 "This setting is always used when importing images in non-advanced mode.\n\n"
79 "In total, there will be three points as (x1,y1), (x2,y2) "
80 "and (x3,y3)."));
81 connect (m_btnAxesPointCount3, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
82 layout->addWidget (m_btnAxesPointCount3, row++, 2);
83
84 m_btnAxesPointCount4 = new QRadioButton (tr ("4 axis points - Used for graphs with only one coordinate defined on each axis"));
85 m_btnAxesPointCount4->setWhatsThis (tr ("Four axes points will define the coordinate system. Each will have a single "
86 "x or y coordinate.\n\n"
87 "This setting is required when the x coordinate of the y axis is unknown, and/or "
88 "the y coordinate of the x axis is unknown.\n\n"
89 "In total, there will be two points on the x axis as (x1) and "
90 "(x2), and two points on the y axis as (y1) and (y2)."));
91 connect (m_btnAxesPointCount4, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
92 layout->addWidget (m_btnAxesPointCount4, row++, 2);
93
94 return subPanel;
95}
96
98{
99 if (m_btnAxesPointCount2->isChecked ()) {
101 } else if (m_btnAxesPointCount3->isChecked ()) {
103 } else {
105 }
106}
107
109{
110 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::handleOk";
111
112 setResult (QDialog::Accepted); // Set return value so Ok button is not handled like the Cancel button
113
114 hide ();
115}
116
117void DlgImportAdvanced::load(CmdMediator & /* cmdMediator */)
118{
119 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::load";
120}
121
123{
124 return unsigned (m_spinCoordSystemCount->value ());
125}
126
127void DlgImportAdvanced::setSmallDialogs(bool /* smallDialogs */)
128{
129}
130
131void DlgImportAdvanced::slotAxesPointCount (bool)
132{
133 LOG4CPP_INFO_S ((*mainCat)) << "DlgCoordSystem::slotAxesPointCount";
134}
135
136void DlgImportAdvanced::slotCoordSystemCount (const QString &)
137{
138 LOG4CPP_INFO_S ((*mainCat)) << "DlgCoordSystem::slotImportAdvanced";
139}
140
const int MINIMUM_DIALOG_WIDTH_COORDS
@ DOCUMENT_AXES_POINTS_REQUIRED_3
@ DOCUMENT_AXES_POINTS_REQUIRED_4
@ DOCUMENT_AXES_POINTS_REQUIRED_2
log4cpp::Category * mainCat
Definition Logger.cpp:14
Command queue stack.
Definition CmdMediator.h:24
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
virtual void handleOk()
Process slotOk.
DlgImportAdvanced(MainWindow &mainWindow)
Single constructor.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
unsigned int numberCoordSystem() const
Number of coordinate systems selected by user.
DocumentAxesPointsRequired documentAxesPointsRequired() const
Number of axes points selected by user.
virtual void load(CmdMediator &cmdMediator)
Load settings from Document.
DlgSettingsAbstractBase(const QString &title, const QString &dialogName, MainWindow &mainWindow)
Single constructor.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
void setDisableOkAtStartup(bool disableOkAtStartup)
Override the default Ok button behavior applied in showEvent.
MainWindow & mainWindow()
Get method for MainWindow.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...
Definition MainWindow.h:95
#define LOG4CPP_INFO_S(logger)
Definition convenience.h:18