TipDialog.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 2015
19* @copyright http://www.gnu.org/licenses/gpl-2.0.txt
20* GNU General Public License
21*/
22
23#include "TipDialog.h"
24
26
27#include <ArmarXGui/libraries/ArmarXGuiBase/ui_TipDialog.h>
28
29namespace armarx
30{
31
32 TipDialog::TipDialog(QWidget* parent) : QDialog(parent), ui(new Ui::TipDialog)
33 {
34 ui->setupUi(this);
35 }
36
38 {
39 delete ui;
40 }
41
42 void
43 TipDialog::showMessage(const QString& tipText,
44 const QString& windowTitle,
45 const QString& stringIdentifier)
46 {
47 if (tipText.isEmpty())
48 {
49 return;
50 }
51
52 if (isBlackListed(stringIdentifier.isEmpty() ? tipText : stringIdentifier))
53 {
54 this->setWindowTitle(windowTitle);
55 ui->editTip->setPlainText(tipText);
56 show();
57 lastId = stringIdentifier.isEmpty() ? tipText : stringIdentifier;
58 }
59 else
60 {
61 ARMARX_DEBUG_S << "Not showing because of blacklist";
62 }
63 }
64
65 QStringList
67 {
68 return blackList;
69 }
70
71 void
72 TipDialog::setBlackListedStrings(const QStringList& strings)
73 {
74 blackList = strings;
75 }
76
77 bool
78 TipDialog::isBlackListed(const QString& stringId) const
79 {
80 return !blackList.contains(stringId);
81 }
82
83 void
85 {
86 if (ui->cbDoNotShowAgain->isChecked())
87 {
88 ARMARX_DEBUG_S << "Storing in blacklist";
89
90 if (!blackList.contains(lastId))
91 {
92 blackList.append(lastId);
93 }
94 }
95 }
96
97} // namespace armarx
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:43
bool isBlackListed(const QString &stringId) const
Checks whether a specific string is blacklisted.
Definition TipDialog.cpp:78
QStringList getBlackListedStrings() const
Returns all currently blacklisted strings.
Definition TipDialog.cpp:66
void hideEvent(QHideEvent *) override
Definition TipDialog.cpp:84
TipDialog(QWidget *parent=0)
Definition TipDialog.cpp:32
~TipDialog() override
Definition TipDialog.cpp:37
void setBlackListedStrings(const QStringList &strings)
Sets list of blacklisted strings.
Definition TipDialog.cpp:72
#define ARMARX_DEBUG_S
The logging level for output that is only interesting while debugging.
Definition Logging.h:205
ArmarX Headers.
This file offers overloads of toIce() and fromIce() functions for STL container types.