StatechartEditorSettingsDialog.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 Mirko Waechter ( mirko.waechter at kit dot edu)
18 * @date 2014
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
24 
25 #include <QFileDialog>
26 #include <QtGui>
27 
29 
30 #include <ArmarXGui/gui-plugins/StatechartEditorPlugin/view/dialogs/ui_StatechartEditorSettingsDialog.h>
31 
32 namespace armarx
33 {
34 
36  QDialog(parent), ui(new Ui::StatechartEditorSettingsDialog)
37  {
38  ui->setupUi(this);
39  connect(ui->btnAddPath, SIGNAL(clicked()), this, SLOT(selectNewPath()));
40  }
41 
43  {
44  delete ui;
45  }
46 
47  QStringList
49  {
50  return ui->textEditSearchPaths->toPlainText().split(";");
51  }
52 
53  void
55  {
56  ui->cbLockRemoteStates->setChecked(locked);
57  }
58 
59  bool
61  {
62  return ui->cbLockRemoteStates->isChecked();
63  }
64 
65  void
67  {
68  ui->textEditSearchPaths->setText(paths.join(";"));
69  }
70 
71  void
73  {
74  QFileDialog selectFolder(this, "Select new search folder");
75  // selectFolder.setOption(QFileDialog::ShowDirsOnly, true);
76  selectFolder.setOption(QFileDialog::ReadOnly, true);
77  selectFolder.setOption(QFileDialog::HideNameFilterDetails, false);
78  selectFolder.setFileMode(QFileDialog::Directory);
79  QList<QUrl> urls;
80  urls << QUrl::fromLocalFile(
81  QDesktopServices::storageLocation(QDesktopServices::HomeLocation))
82  << QUrl::fromLocalFile(
83  QDesktopServices::storageLocation(QDesktopServices::DesktopLocation));
84 
86  {
87  urls << QUrl::fromLocalFile(QString::fromStdString(ArmarXDataPath::getHomePath()));
88  }
89 
90  selectFolder.setSidebarUrls(urls);
91 
92  if (selectFolder.exec() == QDialog::Accepted)
93  {
94  if (ui->textEditSearchPaths->toPlainText().isEmpty())
95  {
96  ui->textEditSearchPaths->setText(*selectFolder.selectedFiles().begin());
97  }
98  else
99  {
100  ui->textEditSearchPaths->setText(ui->textEditSearchPaths->toPlainText() + ";\n" +
101  *selectFolder.selectedFiles().begin());
102  }
103  }
104  }
105 
106 } // namespace armarx
armarx::StatechartEditorSettingsDialog::setPaths
void setPaths(QStringList paths)
Definition: StatechartEditorSettingsDialog.cpp:66
armarx::ArmarXDataPath::getHomePath
static std::string getHomePath()
Definition: ArmarXDataPath.cpp:583
armarx::StatechartEditorSettingsDialog::setRemoteStatesLocked
void setRemoteStatesLocked(bool locked)
Definition: StatechartEditorSettingsDialog.cpp:54
armarx::StatechartEditorSettingsDialog::getPaths
QStringList getPaths() const
Definition: StatechartEditorSettingsDialog.cpp:48
armarx::StatechartEditorSettingsDialog::~StatechartEditorSettingsDialog
~StatechartEditorSettingsDialog() override
Definition: StatechartEditorSettingsDialog.cpp:42
cxxopts::empty
bool empty(const std::string &s)
Definition: cxxopts.hpp:255
armarx::StatechartEditorSettingsDialog::selectNewPath
void selectNewPath()
Definition: StatechartEditorSettingsDialog.cpp:72
armarx::StatechartEditorSettingsDialog
Definition: StatechartEditorSettingsDialog.h:34
Ui
ArmarX Headers.
Definition: ArmarXMainWindow.h:58
armarx::StatechartEditorSettingsDialog::getRemoteStatesLocked
bool getRemoteStatesLocked() const
Definition: StatechartEditorSettingsDialog.cpp:60
StatechartEditorSettingsDialog.h
ArmarXDataPath.h
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28
armarx::StatechartEditorSettingsDialog::StatechartEditorSettingsDialog
StatechartEditorSettingsDialog(QWidget *parent=0)
Definition: StatechartEditorSettingsDialog.cpp:35