qTox
Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
src
widget
genericchatitemwidget.cpp
Go to the documentation of this file.
1
/*
2
Copyright © 2015-2019 by The qTox Project Contributors
3
4
This file is part of qTox, a Qt-based graphical interface for Tox.
5
6
qTox is libre software: you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation, either version 3 of the License, or
9
(at your option) any later version.
10
11
qTox is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
15
16
You should have received a copy of the GNU General Public License
17
along with qTox. If not, see <http://www.gnu.org/licenses/>.
18
*/
19
20
#include "
genericchatitemwidget.h
"
21
#include "
src/persistence/settings.h
"
22
#include "
src/widget/tool/croppinglabel.h
"
23
#include "
src/widget/gui.h
"
24
#include <QVariant>
25
26
GenericChatItemWidget::GenericChatItemWidget
(
bool
compact, QWidget* parent)
27
: QFrame(parent)
28
, compact(false)
29
{
30
setProperty(
"compact"
,
compact
);
31
32
nameLabel
=
new
CroppingLabel
(
this
);
33
nameLabel
->setObjectName(
"name"
);
34
nameLabel
->setTextFormat(Qt::PlainText);
35
36
connect(&
GUI::getInstance
(), &
GUI::themeReload
,
this
, &
GenericChatItemWidget::reloadTheme
);
37
}
38
39
bool
GenericChatItemWidget::isCompact
()
const
40
{
41
return
compact
;
42
}
43
44
void
GenericChatItemWidget::setCompact
(
bool
compact)
45
{
46
this->compact =
compact
;
47
}
48
49
QString
GenericChatItemWidget::getName
()
const
50
{
51
return
nameLabel
->
fullText
();
52
}
53
54
void
GenericChatItemWidget::searchName
(
const
QString& searchString,
bool
hide)
55
{
56
setVisible(!hide &&
getName
().contains(searchString, Qt::CaseInsensitive));
57
}
GenericChatItemWidget::reloadTheme
virtual void reloadTheme()
Definition:
genericchatitemwidget.h:50
genericchatitemwidget.h
GenericChatItemWidget::getName
QString getName() const
Definition:
genericchatitemwidget.cpp:49
GenericChatItemWidget::compact
bool compact
Definition:
genericchatitemwidget.h:47
settings.h
CroppingLabel
Definition:
croppinglabel.h:26
GenericChatItemWidget::searchName
void searchName(const QString &searchString, bool hideAll)
Definition:
genericchatitemwidget.cpp:54
croppinglabel.h
GUI::getInstance
static GUI & getInstance()
Returns the singleton instance.
Definition:
gui.cpp:56
GenericChatItemWidget::nameLabel
CroppingLabel * nameLabel
Definition:
genericchatitemwidget.h:53
GenericChatItemWidget::GenericChatItemWidget
GenericChatItemWidget(bool compact, QWidget *parent=nullptr)
Definition:
genericchatitemwidget.cpp:26
GUI::themeReload
void themeReload()
GenericChatItemWidget::setCompact
void setCompact(bool compact)
Definition:
genericchatitemwidget.cpp:44
CroppingLabel::fullText
QString fullText()
Get original full text.
Definition:
croppinglabel.cpp:168
gui.h
GenericChatItemWidget::isCompact
bool isCompact() const
Definition:
genericchatitemwidget.cpp:39
Generated by
1.8.17