7 #include "DlgImportAdvanced.h" 9 #include "MainWindow.h" 10 #include <QGridLayout> 12 #include <QRadioButton> 15 const int MINIMUM_DIALOG_WIDTH_COORDS = 800;
22 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgImportAdvanced::DlgImportAdvanced";
26 MINIMUM_DIALOG_WIDTH_COORDS);
35 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgImportAdvanced::createOptionalSaveDefault";
40 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgImportAdvanced::createSubPanel";
42 QWidget *subPanel =
new QWidget ();
43 QGridLayout *layout =
new QGridLayout (subPanel);
44 subPanel->setLayout (layout);
49 QLabel *labelCoordCount =
new QLabel (tr (
"Coordinate System Count:"));
50 layout->addWidget (labelCoordCount, row, 1);
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);
63 QLabel *labelPointCount =
new QLabel (tr (
"Graph Coordinates Definition:"));
64 layout->addWidget (labelPointCount, row, 1);
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);
74 m_btnAxesPointCount3 =
new QRadioButton (tr (
"3 axis points - Used for graphs with both coordinates defined on each axis"));
75 m_btnAxesPointCount3->setChecked (
true);
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) " 81 connect (m_btnAxesPointCount3, SIGNAL (toggled (
bool)),
this, SLOT (slotAxesPointCount (
bool)));
82 layout->addWidget (m_btnAxesPointCount3, row++, 2);
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);
99 if (m_btnAxesPointCount2->isChecked ()) {
100 return DOCUMENT_AXES_POINTS_REQUIRED_2;
101 }
else if (m_btnAxesPointCount3->isChecked ()) {
102 return DOCUMENT_AXES_POINTS_REQUIRED_3;
104 return DOCUMENT_AXES_POINTS_REQUIRED_4;
110 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgImportAdvanced::handleOk";
112 setResult (QDialog::Accepted);
119 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgImportAdvanced::load";
124 return m_spinCoordSystemCount->value ();
131 void DlgImportAdvanced::slotAxesPointCount (
bool)
133 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgCoordSystem::slotAxesPointCount";
136 void DlgImportAdvanced::slotCoordSystemCount (
const QString &)
138 LOG4CPP_INFO_S ((*mainCat)) <<
"DlgCoordSystem::slotImportAdvanced";
virtual QWidget * createSubPanel()
Create dialog-specific panel to which base class will add Ok and Cancel buttons.
void setDisableOkAtStartup(bool disableOkAtStartup)
Override the default Ok button behavior applied in showEvent.
virtual void createOptionalSaveDefault(QHBoxLayout *layout)
Let subclass define an optional Save As Default button.
void finishPanel(QWidget *subPanel, int minimumWidth=MINIMUM_DIALOG_WIDTH, int minimumHeightOrZero=0)
Add Ok and Cancel buttons to subpanel to get the whole dialog.
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.
virtual void handleOk()
Process slotOk.
void enableOk(bool enable)
Let leaf subclass control the Ok button.
DlgImportAdvanced(MainWindow &mainWindow)
Single constructor.
Abstract base class for all Settings dialogs.
virtual void setSmallDialogs(bool smallDialogs)
If false then dialogs have a minimum size so all controls are visible.
Main window consisting of menu, graphics scene, status bar and optional toolbars as a Single Document...