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
25#include <QPushButton>
26
27#include <ArmarXGui/gui-plugins/StatechartEditorPlugin/view/dialogs/ui_StatechartEditorConfigDialog.h>
28
30 QWidget* parent) :
31 QDialog(parent), ui(new Ui_StatechartEditorConfigDialog())
32{
33 ui->setupUi(this);
34 QPushButton* okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
35 okButton->setEnabled(false);
36
37 for (StatechartProfilePtr p : profiles->getAllLeaves())
38 {
39 QListWidgetItem* item = new QListWidgetItem(QString::fromUtf8(p->getName().data()));
40 profileMap.insert(std::make_pair(item, p));
41
42 ui->listWidgetProfiles->addItem(item);
43 }
44 // connect(ui->listWidgetProfiles, SIGNAL(doubleClicked(QModelIndex)), this,
45 connect(ui->listWidgetProfiles, SIGNAL(itemSelectionChanged()), SLOT(itemSelectionChanged()));
46}
47
52
55{
56 QList<QListWidgetItem*> selected = ui->listWidgetProfiles->selectedItems();
57
58 if (selected.size() == 0)
59 {
61 }
62 else
63 {
64 return profileMap.at(selected.at(0));
65 }
66}
67
68bool
70{
71 return ui->checkBoxOpenAllStates->isChecked();
72}
73
74void
75armarx::StatechartEditorConfigDialog::itemSelectionChanged()
76{
77 QPushButton* okButton = ui->buttonBox->button(QDialogButtonBox::Ok);
78 okButton->setEnabled(ui->listWidgetProfiles->selectedItems().size() > 0);
79}
80
81void
82armarx::StatechartEditorConfigDialog::on_listWidgetProfiles_doubleClicked(const QModelIndex& index)
83{
84 accept();
85}
uint8_t index
StatechartEditorConfigDialog(StatechartProfilesPtr profiles, QWidget *parent=0)
std::shared_ptr< StatechartProfiles > StatechartProfilesPtr
std::shared_ptr< class StatechartProfile > StatechartProfilePtr