qTox  Version: nightly | Commit: bc751c8e1cac455f9690654fcfe0f560d2d7dfdd
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"
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 
37 }
38 
40 {
41  return compact;
42 }
43 
45 {
46  this->compact = compact;
47 }
48 
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