3 #include "CnetEditorWidget.h" 6 #include <QApplication> 12 #include <QHBoxLayout> 13 #include <QHeaderView> 14 #include <QItemSelection> 16 #include <QMessageBox> 17 #include <QModelIndex> 18 #include <QScrollArea> 23 #include <QStringList> 27 #include <QVBoxLayout> 31 #include "AbstractMeasureItem.h" 32 #include "AbstractPointItem.h" 33 #include "AbstractTreeItem.h" 34 #include "CnetDisplayProperties.h" 35 #include "CnetEditorSortConfigDialog.h" 41 #include "FilterWidget.h" 43 #include "ImageImageTreeModel.h" 44 #include "ImagePointTreeModel.h" 45 #include "MeasureTableModel.h" 46 #include "PointMeasureTreeModel.h" 47 #include "PointTableModel.h" 49 #include "TableView.h" 50 #include "TableViewHeader.h" 52 #include "XmlStackedHandler.h" 53 #include "XmlStackedHandlerReader.h" 69 CnetEditorWidget::CnetEditorWidget(Control *control, QString pathForSettings) {
81 connect(CnetDisplayProperties::getInstance(), SIGNAL(compositionFinished()),
88 setLayout(mainLayout);
96 installEventFilter(
this);
213 bool ignoreAll =
false;
216 item->deleteSource();
219 QString message = e.
what();
222 if (item == itemsToDelete.last()) {
223 QMessageBox::warning(
224 this,
"Failed to delete row", message, QMessageBox::Ok);
227 message +=
"\n\nOkay to continue?";
229 QMessageBox::StandardButton status = QMessageBox::warning(
230 this,
"Failed to delete row", message, QMessageBox::Yes |
231 QMessageBox::YesToAll | QMessageBox::No);
233 if (status == QMessageBox::YesToAll)
235 else if (status == QMessageBox::No)
275 QHBoxLayout *pointTableLayout =
new QHBoxLayout;
281 QHBoxLayout *measureTableLayout =
new QHBoxLayout;
289 QBoxLayout *mainLayout =
new QHBoxLayout;
303 tr(
"&Freeze Tables"),
this);
304 freezeTablesAct->setCheckable(
true);
305 freezeTablesAct->setToolTip(tr(
"Freeze tables (filters will not take " 306 "effect until unfrozen)"));
307 freezeTablesAct->setStatusTip(tr(
"Freeze tables (filters will not take " 308 "effect until unfrozen)"));
309 freezeTablesAct->setWhatsThis(tr(
"<html>When frozen, the contents of the " 310 "tables will be locked. Current filters will not be applied to the " 311 "tables until they are unfrozen.</html>"));
312 connect(freezeTablesAct, SIGNAL(toggled(
bool)),
315 freezeTablesLocation.append(tr(
"&Tables"));
316 m_menuActions->insert(freezeTablesAct, freezeTablesLocation);
319 tr(
"&Sorting Options..."),
this);
320 QString configureSortToolTipText = tr(
"Configure table sorting options");
321 configureSortAct->setToolTip(configureSortToolTipText);
322 configureSortAct->setStatusTip(configureSortToolTipText);
323 configureSortAct->setWhatsThis(tr(
"<html>Click here to configure options " 324 "related to the sorting of table columns.</html>"));
325 connect(configureSortAct, SIGNAL(triggered()),
328 configureSortLocation.append(tr(
"&Tables"));
329 m_menuActions->insert(configureSortAct, configureSortLocation);
331 QAction *whatsThisAct = QWhatsThis::createAction(
this);
333 whatsThisLocation.append(tr(
"&Help"));
337 tbActionList.append(freezeTablesAct);
338 tbActionList.append(configureSortAct);
389 QHBoxLayout *pointFilterLayout =
new QHBoxLayout;
390 pointFilterLayout->addWidget(pointFilter);
392 pointArea->setLayout(pointFilterLayout);
393 QScrollArea *pointFilterScrollArea =
new QScrollArea;
394 pointFilterScrollArea->setWidget(pointArea);
395 pointFilterScrollArea->setWidgetResizable(
true);
403 QHBoxLayout *serialFilterLayout =
new QHBoxLayout;
404 serialFilterLayout->addWidget(serialFilter);
406 serialArea->setLayout(serialFilterLayout);
407 QScrollArea *serialFilterScrollArea =
new QScrollArea;
408 serialFilterScrollArea->setWidget(serialArea);
409 serialFilterScrollArea->setWidgetResizable(
true);
417 QHBoxLayout *connectionFilterLayout =
new QHBoxLayout;
418 connectionFilterLayout->addWidget(connectionFilter);
420 connectionArea->setLayout(connectionFilterLayout);
421 QScrollArea *connectionFilterScrollArea =
new QScrollArea;
422 connectionFilterScrollArea->setWidget(connectionArea);
423 connectionFilterScrollArea->setWidgetResizable(
true);
436 "point. Each column in the table is an attribute of a control " 437 "point.<br/><br/>Cells that are gray are not editable.</html>");
439 this, SIGNAL(cnetModified()));
455 this, SIGNAL(editControlPoint(
ControlPoint *, QString)));
457 for (
int i = 0; i < AbstractPointItem::COLS; i++) {
459 AbstractPointItem::getColumnName((AbstractPointItem::Column) i),
this);
460 act->setCheckable(
true);
466 Qt::ActionsContextMenu);
476 "m_measureTableView");
478 "measure. Each column in the table is an attribute of a control " 479 "measure.<br/><br/>Rows with bold text are reference measures. " 480 "Cells that are gray are not editable.</html>");
494 this, SIGNAL(cnetModified()));
508 this, SIGNAL(editControlPoint(
ControlPoint *, QString)));
510 for (
int i = 0; i < AbstractMeasureItem::COLS; i++) {
512 (AbstractMeasureItem::Column) i),
this);
513 act->setCheckable(
true);
519 Qt::ActionsContextMenu);
538 for (
int i = 0; i < actions.size(); i++) {
540 actions[i]->isChecked());
551 for (
int i = 0; i < actions.size(); i++)
553 actions[i]->isChecked());
567 int visibleRows,
int totalRows) {
569 "Control Point Table");
583 int visibleRows,
int totalRows) {
585 "Control Measure Table");
598 int visibleRows,
int totalRows, QGroupBox *box, QString initialText) {
600 QString newTitle = initialText +
" (";
601 if (visibleRows > -1)
602 newTitle += QString::number(visibleRows);
606 newTitle +=
" / " + QString::number(totalRows) +
")";
608 box->setTitle(newTitle);
637 m_mainSplitter->restoreState(settings.value(
"mainSplitter").toByteArray());
643 for (
int i = 0; i < actions.size(); i++) {
645 AbstractMeasureItem::getColumnName((AbstractMeasureItem::Column) i);
646 key.replace(
" ",
"_");
647 actions[i]->setChecked(settings.value(key,
true).toBool());
651 for (
int i = 0; i < actions.size(); i++) {
653 AbstractPointItem::getColumnName((AbstractPointItem::Column) i);
654 key.replace(
" ",
"_");
655 actions[i]->setChecked(settings.value(key,
true).toBool());
660 settings.value(
"measureTableSortingEnabled",
true).toBool());
662 settings.value(
"measureTableSortLimit", 500000).toInt());
664 settings.value(
"pointTableSortingEnabled",
true).toBool());
666 settings.value(
"pointTableSortLimit", 100000).toInt());
679 settings.setValue(
"version",
VERSION);
686 for (
int i = 0; i < actions.size(); i++) {
688 AbstractMeasureItem::getColumnName((AbstractMeasureItem::Column) i);
689 key.replace(
" ",
"_");
690 settings.setValue(key, actions[i]->isChecked());
694 for (
int i = 0; i < actions.size(); i++) {
696 AbstractPointItem::getColumnName((AbstractPointItem::Column) i);
697 key.replace(
" ",
"_");
698 settings.setValue(key, actions[i]->isChecked());
702 settings.setValue(
"measureTableSortingEnabled",
704 settings.setValue(
"measureTableSortLimit",
706 settings.setValue(
"pointTableSortingEnabled",
708 settings.setValue(
"pointTableSortLimit",
854 AbstractTreeModel::MeasureItems | AbstractTreeModel::PointItems,
true);
861 if (networkItems.isEmpty()) {
865 for (
int measureIndex = 0;
866 measureIndex < cp->GetNumMeasures();
868 cp->
GetMeasure(measureIndex)->SetEditLock(
false);
873 else if (networkItems.last()->getPointerType() ==
874 AbstractTreeItem::Point) {
881 for (
int measureIndex = 0;
882 measureIndex < cp->GetNumMeasures();
884 cp->
GetMeasure(measureIndex)->SetEditLock(
false);
890 networkItems.removeLast();
893 else if (networkItems.last()->getPointerType() ==
894 AbstractTreeItem::Measure) {
899 if (cp->
GetId() != networkItemsCm->Parent()->
GetId()) {
902 for (
int measureIndex = 0;
903 measureIndex < cp->GetNumMeasures();
905 cp->
GetMeasure(measureIndex)->SetEditLock(
false);
912 for (
int measureIndex = cp->GetNumMeasures() - 1;
913 networkItemsCm && measureIndex >= 0;
918 cm->SetEditLock(
false);
922 networkItems.removeLast();
923 networkItemsCm = NULL;
925 if (networkItems.last()->getPointerType() ==
926 AbstractTreeItem::Measure) {
const char * what() const
Returns a string representation of this exception in its current state.
File name manipulation and expansion.
const ControlMeasure * GetMeasure(QString serialNumber) const
Get a control measure based on its cube's serial number.
Configure user's sorting settings for the cneteditor widget.
Tree model for control points and control measures.
Tree model for images and control points.
Status SetEditLock(bool editLock)
Set the EditLock state.
TableViewHeader * getHorizontalHeader()
Returns the horizontal header.
int GetNumPoints() const
Return the number of control points in the network.
QString GetId() const
Return the Id of the control point.
Translates the tree model into a table model.
Tree model for images and images.
int DeletePoint(ControlPoint *point)
Delete a ControlPoint from the network by the point's address.
ControlNet * controlNet()
Open and return a pointer to the ControlNet for this Control.
void setColumnVisible(QString, bool)
Sets the specified column visible or invisible.
void setModified(bool modified=true)
Sets the modification state of this control.
Namespace for ISIS/Bullet specific routines.
int Delete(ControlMeasure *measure)
Remove a measurement from the control point, deleting reference measure is allowed.
Table model for control measures.
Base class for an item in the tree.
QString GetCubeSerialNumber() const
Return the serial number of the cube containing the coordinate.
Table model for control points.