header_widget.h
Go to the documentation of this file.
1 /*********************************************************************
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2012, Willow Garage, Inc.
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of Willow Garage nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  *********************************************************************/
34 
35 /* Author: Dave Coleman */
36 
37 #pragma once
38 
39 #include <QWidget>
40 #include <QFrame>
41 class QLabel;
42 class QLineEdit;
43 
44 namespace moveit_setup_assistant
45 {
46 // ******************************************************************************************
47 // ******************************************************************************************
48 // Class for showing the title and instructions
49 // ******************************************************************************************
50 // ******************************************************************************************
51 class HeaderWidget : public QWidget
52 {
53  Q_OBJECT
54 
55 public:
57  HeaderWidget(const std::string& title, const std::string& instructions, QWidget* parent);
58 };
59 
60 // ******************************************************************************************
61 // ******************************************************************************************
62 // Class for selecting files
63 // ******************************************************************************************
64 // ******************************************************************************************
65 class LoadPathWidget : public QFrame
66 {
67  Q_OBJECT
68 
69 private:
70  // Only allow user to select folders
71  bool dir_only_;
72  // Only allow user to load files (not save)
73  bool load_only_;
74  // Stores the path qstring
75  QLineEdit* path_box_;
76 
77 Q_SIGNALS:
78  void pathChanged(const QString& path);
79  void pathEditingFinished();
80 
81 private Q_SLOTS:
83  void btnFileDialog();
84 
85 public:
87  LoadPathWidget(const QString& title, const QString& instructions, QWidget* parent, const bool dir_only = false,
88  const bool load_only = false);
89 
91  QString getQPath() const;
92 
94  std::string getPath() const;
95 
97  void setPath(const QString& path);
98 
100  void setPath(const std::string& path);
101 };
102 
105 {
106  Q_OBJECT
107 
108 private:
109  QLineEdit* args_;
111 
112 public:
114  LoadPathArgsWidget(const QString& title, const QString& instructions, const QString& arg_instructions,
115  QWidget* parent, const bool dir_only = false, const bool load_only = false);
116 
117  QString getArgs() const;
118  void setArgs(const QString& args);
119  void setArgsEnabled(bool enabled = true);
120 };
121 } // namespace moveit_setup_assistant
moveit_setup_assistant::LoadPathArgsWidget::setArgsEnabled
void setArgsEnabled(bool enabled=true)
Definition: header_widget.cpp:261
moveit_setup_assistant::LoadPathArgsWidget::args_
QLineEdit * args_
Definition: header_widget.h:109
moveit_setup_assistant::LoadPathArgsWidget::setArgs
void setArgs(const QString &args)
Definition: header_widget.cpp:256
moveit_setup_assistant::LoadPathArgsWidget::args_instructions_
QLabel * args_instructions_
Definition: header_widget.h:110
moveit_setup_assistant::LoadPathWidget::pathChanged
void pathChanged(const QString &path)
moveit_setup_assistant::LoadPathArgsWidget::getArgs
QString getArgs() const
Definition: header_widget.cpp:251
moveit_setup_assistant::LoadPathWidget::setPath
void setPath(const QString &path)
Set the path with QString.
Definition: header_widget.cpp:225
moveit_setup_assistant::LoadPathArgsWidget::LoadPathArgsWidget
LoadPathArgsWidget(const QString &title, const QString &instructions, const QString &arg_instructions, QWidget *parent, const bool dir_only=false, const bool load_only=false)
Constructor.
Definition: header_widget.cpp:238
moveit_setup_assistant::LoadPathWidget::getQPath
QString getQPath() const
Returns the file path in QString format.
Definition: header_widget.cpp:209
moveit_setup_assistant::LoadPathWidget::btnFileDialog
void btnFileDialog()
Load the file dialog.
Definition: header_widget.cpp:177
moveit_setup_assistant::LoadPathWidget::load_only_
bool load_only_
Definition: header_widget.h:73
moveit_setup_assistant::LoadPathWidget::path_box_
QLineEdit * path_box_
Definition: header_widget.h:75
moveit_setup_assistant::LoadPathArgsWidget
Extend LoadPathWidget with additional line edit for arguments.
Definition: header_widget.h:104
moveit_setup_assistant
Definition: compute_default_collisions.h:46
moveit_setup_assistant::LoadPathWidget::getPath
std::string getPath() const
Returns the file path in std::string format.
Definition: header_widget.cpp:217
moveit_setup_assistant::LoadPathWidget::dir_only_
bool dir_only_
Definition: header_widget.h:71
moveit_setup_assistant::LoadPathWidget::pathEditingFinished
void pathEditingFinished()
moveit_setup_assistant::LoadPathWidget::LoadPathWidget
LoadPathWidget(const QString &title, const QString &instructions, QWidget *parent, const bool dir_only=false, const bool load_only=false)
Constructor.
Definition: header_widget.cpp:124
moveit_setup_assistant::HeaderWidget
Definition: header_widget.h:51
moveit_setup_assistant::HeaderWidget::HeaderWidget
HeaderWidget(const std::string &title, const std::string &instructions, QWidget *parent)
Contructor.
Definition: header_widget.cpp:85
moveit_setup_assistant::LoadPathWidget
Definition: header_widget.h:65
args


moveit_setup_assistant
Author(s): Dave Coleman
autogenerated on Sat May 3 2025 02:28:04