00001
00002
00003
00004
00005
00006
00007 #include "DlgImportAdvanced.h"
00008 #include "Logger.h"
00009 #include "MainWindow.h"
00010 #include <QGridLayout>
00011 #include <QLabel>
00012 #include <QRadioButton>
00013 #include <QSpinBox>
00014
00015 const int MINIMUM_DIALOG_WIDTH_COORDS = 800;
00016
00017 DlgImportAdvanced::DlgImportAdvanced(MainWindow &mainWindow) :
00018 DlgSettingsAbstractBase (tr ("Import Advanced"),
00019 "DlgImportAdvanced",
00020 mainWindow)
00021 {
00022 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::DlgImportAdvanced";
00023
00024 QWidget *subPanel = createSubPanel ();
00025 finishPanel (subPanel,
00026 MINIMUM_DIALOG_WIDTH_COORDS);
00027
00028
00029 enableOk (true);
00030 setDisableOkAtStartup (false);
00031 }
00032
00033 void DlgImportAdvanced::createOptionalSaveDefault (QHBoxLayout * )
00034 {
00035 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::createOptionalSaveDefault";
00036 }
00037
00038 QWidget *DlgImportAdvanced::createSubPanel ()
00039 {
00040 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::createSubPanel";
00041
00042 QWidget *subPanel = new QWidget ();
00043 QGridLayout *layout = new QGridLayout (subPanel);
00044 subPanel->setLayout (layout);
00045
00046 int row = 0;
00047
00048
00049 QLabel *labelCoordCount = new QLabel (tr ("Coordinate System Count:"));
00050 layout->addWidget (labelCoordCount, row, 1);
00051
00052 m_spinCoordSystemCount = new QSpinBox;
00053 m_spinCoordSystemCount->setMinimum (1);
00054 m_spinCoordSystemCount->setValue (1);
00055 m_spinCoordSystemCount->setWhatsThis (tr ("Coordinate System Count\n\n"
00056 "Specifies the total number of coordinate systems that will be used in the imported image. "
00057 "There can be one or more graphs in the image, and each graph can have one or more "
00058 "coordinate systems. Each coordinate system is defined by a pair of coordinate axes."));
00059 connect (m_spinCoordSystemCount, SIGNAL (valueChanged (const QString &)), this, SLOT (slotImportAdvanced (const QString &)));
00060 layout->addWidget (m_spinCoordSystemCount, row++, 2);
00061
00062
00063 QLabel *labelPointCount = new QLabel (tr ("Axes Points Count:"));
00064 layout->addWidget (labelPointCount, row, 1);
00065
00066 m_btnAxesPointCount3 = new QRadioButton (tr ("3 points"));
00067 m_btnAxesPointCount3->setChecked (true);
00068 m_btnAxesPointCount3->setWhatsThis (tr ("Three axes points will define the coordinate system. Each will have both "
00069 "x and y coordinates.\n\n"
00070 "This setting is always used when importing images in non-advanced mode.\n\n"
00071 "In total, there will be three points as (x1,y1), (x2,y2) "
00072 "and (x3,y3)."));
00073 connect (m_btnAxesPointCount3, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
00074 layout->addWidget (m_btnAxesPointCount3, row++, 2);
00075
00076 m_btnAxesPointCount4 = new QRadioButton (tr ("4 points"));
00077 m_btnAxesPointCount4->setWhatsThis (tr ("Four axes points will define the coordinate system. Each will have a single "
00078 "x or y coordinate.\n\n"
00079 "This setting is required when the x coordinate of the y axis is unknown, and/or "
00080 "the y coordinate of the x axis is unknown.\n\n"
00081 "In total, there will be two points on the x axis as (x1) and "
00082 "(x2), and two points on the y axis as (y1) and (y2)."));
00083 connect (m_btnAxesPointCount4, SIGNAL (toggled (bool)), this, SLOT (slotAxesPointCount (bool)));
00084 layout->addWidget (m_btnAxesPointCount4, row++, 2);
00085
00086 return subPanel;
00087 }
00088
00089 DocumentAxesPointsRequired DlgImportAdvanced::documentAxesPointsRequired () const
00090 {
00091 if (m_btnAxesPointCount3->isChecked ()) {
00092 return DOCUMENT_AXES_POINTS_REQUIRED_3;
00093 } else {
00094 return DOCUMENT_AXES_POINTS_REQUIRED_4;
00095 }
00096 }
00097
00098 void DlgImportAdvanced::handleOk()
00099 {
00100 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::handleOk";
00101
00102 setResult (QDialog::Accepted);
00103
00104 hide ();
00105 }
00106
00107 void DlgImportAdvanced::load(CmdMediator & )
00108 {
00109 LOG4CPP_INFO_S ((*mainCat)) << "DlgImportAdvanced::load";
00110 }
00111
00112 unsigned int DlgImportAdvanced::numberCoordSystem () const
00113 {
00114 return m_spinCoordSystemCount->value ();
00115 }
00116
00117 void DlgImportAdvanced::setSmallDialogs(bool )
00118 {
00119 }
00120
00121 void DlgImportAdvanced::slotAxesPointCount (bool)
00122 {
00123 LOG4CPP_INFO_S ((*mainCat)) << "DlgCoordSystem::slotAxesPointCount";
00124 }
00125
00126 void DlgImportAdvanced::slotCoordSystemCount (const QString &)
00127 {
00128 LOG4CPP_INFO_S ((*mainCat)) << "DlgCoordSystem::slotImportAdvanced";
00129 }
00130