StatechartEditorConfigDialog.cpp
Go to the documentation of this file.
1 /*
2 * This file is part of ArmarX.
3 *
4 * ArmarX is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 *
8 * ArmarX is distributed in the hope that it will be useful, but
9 * WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * @package ArmarX::
17 * @author Nikolaus Vahrenkamp ( vahrenkamp at kit dot edu)
18 * @date 2012
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
24 #include <ArmarXGui/gui-plugins/StatechartEditorPlugin/view/dialogs/ui_StatechartEditorConfigDialog.h>
25 
26 #include <QPushButton>
27 
29  QDialog(parent),
30  ui(new Ui_StatechartEditorConfigDialog())
31 {
32  ui->setupUi(this);
33  QPushButton* okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
34  okButton->setEnabled(false);
35 
36  for (StatechartProfilePtr p : profiles->getAllLeaves())
37  {
38  QListWidgetItem* item = new QListWidgetItem(QString::fromUtf8(p->getName().data()));
39  profileMap.insert(std::make_pair(item, p));
40 
41  ui->listWidgetProfiles->addItem(item);
42  }
43  // connect(ui->listWidgetProfiles, SIGNAL(doubleClicked(QModelIndex)), this,
44  connect(ui->listWidgetProfiles, SIGNAL(itemSelectionChanged()), SLOT(itemSelectionChanged()));
45 }
46 
48 {
49  delete ui;
50 }
51 
53 {
54  QList<QListWidgetItem*> selected = ui->listWidgetProfiles->selectedItems();
55 
56  if (selected.size() == 0)
57  {
59  }
60  else
61  {
62  return profileMap.at(selected.at(0));
63  }
64 }
65 
67 {
68  return ui->checkBoxOpenAllStates->isChecked();
69 }
70 
71 void armarx::StatechartEditorConfigDialog::itemSelectionChanged()
72 {
73  QPushButton* okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
74  okButton->setEnabled(ui->listWidgetProfiles->selectedItems().size() > 0);
75 }
76 
77 
78 void armarx::StatechartEditorConfigDialog::on_listWidgetProfiles_doubleClicked(const QModelIndex& index)
79 {
80  accept();
81 }
armarx::StatechartEditorConfigDialog::getSelectedProfile
StatechartProfilePtr getSelectedProfile()
Definition: StatechartEditorConfigDialog.cpp:52
armarx::StatechartEditorConfigDialog::StatechartEditorConfigDialog
StatechartEditorConfigDialog(StatechartProfilesPtr profiles, QWidget *parent=0)
Definition: StatechartEditorConfigDialog.cpp:28
index
uint8_t index
Definition: EtherCATFrame.h:59
armarx::StatechartProfilePtr
std::shared_ptr< class StatechartProfile > StatechartProfilePtr
Definition: StatechartContext.h:52
armarx::StatechartProfilesPtr
std::shared_ptr< StatechartProfiles > StatechartProfilesPtr
Definition: StatechartProfiles.h:35
armarx::StatechartEditorConfigDialog::~StatechartEditorConfigDialog
~StatechartEditorConfigDialog() override
Definition: StatechartEditorConfigDialog.cpp:47
StatechartEditorConfigDialog.h
armarx::StatechartEditorConfigDialog::openAllStatesIsSelected
bool openAllStatesIsSelected()
Definition: StatechartEditorConfigDialog.cpp:66