Isis 3.0 Application Source Code Reference |
Home |
00001 #include "QnetNewMeasureDialog.h" 00002 00003 #include <algorithm> 00004 #include <string> 00005 00006 #include <QtGui> 00007 00008 #include "ControlPoint.h" 00009 #include "iString.h" 00010 #include "SerialNumberList.h" 00011 00012 #include "qnet.h" 00013 00014 using namespace Isis::Qnet; 00015 00016 namespace Isis { 00017 /** 00018 * Contructor. 00019 * 00020 * @param parent The parent widget for the 00021 * cube points filter 00022 * @internal 00023 * @history 2010-06-03 Jeannie Walldren - Initialized pointers 00024 * to null. 00025 * 00026 */ 00027 QnetNewMeasureDialog::QnetNewMeasureDialog(QWidget *parent) : QDialog(parent) { 00028 fileList = NULL; 00029 p_okButton = NULL; 00030 00031 00032 QLabel *listLabel = new QLabel("Select Files:"); 00033 00034 fileList = new QListWidget; 00035 fileList->setSelectionMode(QAbstractItemView::ExtendedSelection); 00036 00037 // Create OK & Cancel buttons 00038 p_okButton = new QPushButton("OK"); 00039 //p_okButton->setEnabled(false); 00040 QPushButton *cancelButton = new QPushButton("Cancel"); 00041 QHBoxLayout *buttonLayout = new QHBoxLayout; 00042 buttonLayout->addWidget(p_okButton); 00043 buttonLayout->addWidget(cancelButton); 00044 00045 connect(p_okButton, SIGNAL(clicked()), this, SLOT(accept())); 00046 connect(cancelButton, SIGNAL(clicked()), this, SLOT(reject())); 00047 00048 QVBoxLayout *vLayout = new QVBoxLayout; 00049 vLayout->addWidget(listLabel); 00050 vLayout->addWidget(fileList); 00051 vLayout->addLayout(buttonLayout); 00052 00053 setLayout(vLayout); 00054 setWindowTitle("Add Measures to ControlPoint"); 00055 00056 } 00057 00058 00059 /** 00060 * @internal 00061 * @history 2010-06-03 Jeannie Walldren - Removed "std::" 00062 * since "using namespace std" 00063 * @history 2010-10-29 Tracie Sucharski - Changed std::vector<std::string> 00064 * to QSringList 00065 */ 00066 void QnetNewMeasureDialog::SetFiles(ControlPoint point, 00067 QStringList pointFiles) { 00068 int bottomMostSelectedItemIndex = 0; 00069 00070 // Add all entries in the SerialNumberList 00071 for (int i = 0; i < g_serialNumberList->Size(); i++) { 00072 00073 iString curSerialNum = g_serialNumberList->SerialNumber(i); 00074 00075 // Don't add if already in this point 00076 if (point.HasSerialNumber(curSerialNum)) 00077 continue; 00078 00079 // build new item... 00080 iString label(g_serialNumberList->Filename(i)); 00081 QListWidgetItem *item = new QListWidgetItem(label); 00082 00083 // if this entry of the SerialNumberList is also in the pointFiles then 00084 // mark it as selected and insert after the last selected item (toward 00085 // the top, otherwise add it to the end 00086 if (pointFiles.contains(label)) { 00087 fileList->insertItem(bottomMostSelectedItemIndex++, item); 00088 item->setSelected(true); 00089 } 00090 else { 00091 fileList->addItem(item); 00092 } 00093 } 00094 } 00095 00096 00097 void QnetNewMeasureDialog::enableOkButton(const QString &text) { 00098 p_okButton->setEnabled(!text.isEmpty()); 00099 } 00100 00101 }