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