TipDialog.h
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 2015
19 * @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20 * GNU General Public License
21 */
22 
23 #pragma once
24 
25 #include <QDialog>
26 
27 namespace armarx::Ui
28 {
29  class TipDialog;
30 }
31 
32 namespace armarx
33 {
34  /**
35  * @brief The TipDialog is a dialog to show tips/hints to the user, which are optionally only shown once.
36  * This dialog contains a textfield in which the developer can show a tip to the user.
37  * It also contains a checkbox "Do not show again", which upon selection puts the shown string into a blacklist
38  * of messages, which are not shown again.
39  *
40  * To show the dialog use the function showMessage().
41  * The dialog should only be created once and passed around or the blacklist must be passed on each creation to the dialog via
42  * setBlackListedStrings().
43  *
44  *
45  * @see \ref armarx::ArmarXWidgetController::getTipDialog, armarx::ArmarXMainWindow
46  */
47  class TipDialog : public QDialog
48  {
49  Q_OBJECT
50 
51  public:
52  explicit TipDialog(QWidget* parent = 0);
53  ~TipDialog() override;
54 
55  /**
56  * @brief Shows this dialog and shows the message, if it was not blacklisted.
57  * If the message was blacklisted, nothing happens.
58  * @param tipText Text that should be shown in the dialog. If stringIdentifier is empty, this string is used for blacklisting the
59  * message.
60  * @param windowTitle WindowTitle of the Dialog
61  * @param stringIdentifier If not empty, this string is used for the blacklisting instead of the tiptext.
62  */
63  void showMessage(const QString& tipText, const QString& windowTitle, const QString& stringIdentifier = "");
64 
65  /**
66  * @brief Returns all currently blacklisted strings.
67  *
68  */
69  QStringList getBlackListedStrings() const;
70 
71  /**
72  * @brief Sets list of blacklisted strings. Pass empty list to clear.
73  * All previously set strings are forgotten.
74  */
75  void setBlackListedStrings(const QStringList& strings);
76 
77  /**
78  * @brief Checks whether a specific string is blacklisted.
79  * @param stringId String to check
80  * @return True if blacklisted.
81  */
82  bool isBlackListed(const QString& stringId) const;
83  // QWidget interface
84  protected:
85  void hideEvent(QHideEvent*) override;
86  private:
87  Ui::TipDialog* ui;
88  QStringList blackList;
89  QString lastId;
90 
91  };
92 
93 
94 }
armarx::Ui
Definition: GuiUseCaseSelector.h:33
armarx::TipDialog::~TipDialog
~TipDialog() override
Definition: TipDialog.cpp:39
armarx::TipDialog::TipDialog
TipDialog(QWidget *parent=0)
Definition: TipDialog.cpp:32
armarx::TipDialog::isBlackListed
bool isBlackListed(const QString &stringId) const
Checks whether a specific string is blacklisted.
Definition: TipDialog.cpp:74
armarx::TipDialog::getBlackListedStrings
QStringList getBlackListedStrings() const
Returns all currently blacklisted strings.
Definition: TipDialog.cpp:64
armarx::TipDialog
The TipDialog is a dialog to show tips/hints to the user, which are optionally only shown once.
Definition: TipDialog.h:47
armarx::TipDialog::showMessage
void showMessage(const QString &tipText, const QString &windowTitle, const QString &stringIdentifier="")
Shows this dialog and shows the message, if it was not blacklisted.
Definition: TipDialog.cpp:44
armarx::TipDialog::hideEvent
void hideEvent(QHideEvent *) override
Definition: TipDialog.cpp:79
armarx::TipDialog::setBlackListedStrings
void setBlackListedStrings(const QStringList &strings)
Sets list of blacklisted strings.
Definition: TipDialog.cpp:69
armarx
This file offers overloads of toIce() and fromIce() functions for STL container types.
Definition: ArmarXTimeserver.cpp:28