1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
|
//##########################################################################
//# #
//# CLOUDCOMPARE #
//# #
//# This program is free software; you can redistribute it and/or modify #
//# it under the terms of the GNU General Public License as published by #
//# the Free Software Foundation; version 2 or later of the License. #
//# #
//# This program is distributed in the hope that it will be useful, #
//# but WITHOUT ANY WARRANTY; without even the implied warranty of #
//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
//# GNU General Public License for more details. #
//# #
//# COPYRIGHT: EDF R&D / TELECOM ParisTech (ENST-TSI) #
//# #
//##########################################################################
#include "ccSelectChildrenDlg.h"
#include "ui_selectChildrenDlg.h"
static QString s_lastName;
static bool s_lastNameState = false;
static CC_CLASS_ENUM s_lastType = CC_TYPES::POINT_CLOUD;
static bool s_lastTypeState = true;
static bool s_lastTypeStrictState = true;
static bool s_lastUseRegex = true;
ccSelectChildrenDlg::ccSelectChildrenDlg(QWidget* parent/*=0*/)
: QDialog(parent, Qt::Tool)
, mUI( new Ui::SelectChildrenDialog )
{
mUI->setupUi(this);
mUI->typeCheckBox->setChecked(s_lastTypeState);
mUI->typeStrictCheckBox->setChecked(s_lastTypeStrictState);
mUI->nameCheckBox->setChecked(s_lastNameState);
mUI->nameLineEdit->setText(s_lastName);
mUI->checkBoxRegex->setChecked(s_lastUseRegex);
connect(mUI->buttonBox, &QDialogButtonBox::accepted, this, &ccSelectChildrenDlg::onAccept);
}
ccSelectChildrenDlg::~ccSelectChildrenDlg()
{
delete mUI;
mUI = nullptr;
}
void ccSelectChildrenDlg::addType(QString typeName, CC_CLASS_ENUM type)
{
mUI->typeComboBox->addItem(typeName,QVariant::fromValue<qint64>(type));
//auto select last selected type
if (type == s_lastType)
{
mUI->typeComboBox->setCurrentIndex(mUI->typeComboBox->count()-1);
}
}
void ccSelectChildrenDlg::onAccept()
{
s_lastNameState = mUI->nameCheckBox->isChecked();
s_lastName = mUI->nameLineEdit->text();
s_lastTypeState = mUI->typeCheckBox->isChecked();
s_lastTypeStrictState = mUI->typeCheckBox->isChecked();
s_lastType = getSelectedType();
s_lastUseRegex = getNameIsRegex();
}
CC_CLASS_ENUM ccSelectChildrenDlg::getSelectedType()
{
if (!mUI->typeCheckBox->isChecked())
{
return CC_TYPES::HIERARCHY_OBJECT;
}
int currentIndex = mUI->typeComboBox->currentIndex();
return static_cast<CC_CLASS_ENUM>(mUI->typeComboBox->itemData(currentIndex).value<qint64>());
}
QString ccSelectChildrenDlg::getSelectedName()
{
if (!mUI->nameCheckBox->isChecked())
{
return QString();
}
return mUI->nameLineEdit->text();
}
bool ccSelectChildrenDlg::getStrictMatchState() const
{
return mUI->typeStrictCheckBox->isChecked();
}
bool ccSelectChildrenDlg::getTypeIsUsed() const
{
return mUI->typeCheckBox->isChecked();
}
bool ccSelectChildrenDlg::getNameIsRegex() const
{
return mUI->checkBoxRegex->isChecked();
}
bool ccSelectChildrenDlg::getNameMatchIsUsed() const
{
return mUI->nameCheckBox->isChecked();
}
|