2014-08-22 23:19:16 +08:00
|
|
|
/*
|
2016-11-28 21:33:38 +08:00
|
|
|
Copyright © 2014-2015 by The qTox Project Contributors
|
2015-06-06 09:40:08 +08:00
|
|
|
|
2014-08-22 23:19:16 +08:00
|
|
|
This file is part of qTox, a Qt-based graphical interface for Tox.
|
|
|
|
|
2015-06-06 09:40:08 +08:00
|
|
|
qTox is libre software: you can redistribute it and/or modify
|
2014-08-22 23:19:16 +08:00
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
|
|
(at your option) any later version.
|
2015-06-06 09:40:08 +08:00
|
|
|
|
|
|
|
qTox is distributed in the hope that it will be useful,
|
2014-08-22 23:19:16 +08:00
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
2015-06-06 09:40:08 +08:00
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
2014-08-22 23:19:16 +08:00
|
|
|
|
2015-06-06 09:40:08 +08:00
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with qTox. If not, see <http://www.gnu.org/licenses/>.
|
2014-08-22 23:19:16 +08:00
|
|
|
*/
|
2015-06-07 11:20:06 +08:00
|
|
|
|
2014-08-22 23:19:16 +08:00
|
|
|
#include "friendlistwidget.h"
|
2017-02-26 19:52:45 +08:00
|
|
|
#include "circlewidget.h"
|
2015-06-07 11:20:06 +08:00
|
|
|
#include "friendlistlayout.h"
|
|
|
|
#include "friendwidget.h"
|
2015-05-28 01:17:12 +08:00
|
|
|
#include "groupwidget.h"
|
2015-06-10 01:40:45 +08:00
|
|
|
#include "widget.h"
|
2017-02-26 19:52:45 +08:00
|
|
|
#include "src/friend.h"
|
|
|
|
#include "src/friendlist.h"
|
|
|
|
#include "src/persistence/settings.h"
|
2015-06-07 11:20:06 +08:00
|
|
|
#include <QDragEnterEvent>
|
|
|
|
#include <QDragLeaveEvent>
|
2017-02-26 19:52:45 +08:00
|
|
|
#include <QGridLayout>
|
|
|
|
#include <QMimeData>
|
2015-07-31 01:24:34 +08:00
|
|
|
#include <QTimer>
|
2015-05-28 01:17:12 +08:00
|
|
|
#include <cassert>
|
2014-08-22 23:19:16 +08:00
|
|
|
|
2017-04-08 03:47:27 +08:00
|
|
|
enum class Time
|
2015-06-12 03:27:54 +08:00
|
|
|
{
|
2017-04-08 03:47:27 +08:00
|
|
|
Today,
|
|
|
|
Yesterday,
|
|
|
|
ThisWeek,
|
|
|
|
ThisMonth,
|
|
|
|
Month1Ago,
|
|
|
|
Month2Ago,
|
|
|
|
Month3Ago,
|
|
|
|
Month4Ago,
|
|
|
|
Month5Ago,
|
|
|
|
LongAgo,
|
|
|
|
Never
|
2015-06-12 03:27:54 +08:00
|
|
|
};
|
|
|
|
|
2017-04-08 03:47:27 +08:00
|
|
|
static const int LAST_TIME = static_cast<int>(Time::Never);
|
|
|
|
|
2015-07-01 21:10:55 +08:00
|
|
|
Time getTime(const QDate& date)
|
2015-06-12 03:27:54 +08:00
|
|
|
{
|
2017-04-06 16:00:13 +08:00
|
|
|
if (date == QDate()) {
|
2017-04-08 03:47:27 +08:00
|
|
|
return Time::Never;
|
2017-04-06 16:00:13 +08:00
|
|
|
}
|
2015-06-12 03:27:54 +08:00
|
|
|
|
|
|
|
QDate today = QDate::currentDate();
|
2017-06-01 15:41:47 +08:00
|
|
|
// clang-format off
|
2017-04-06 16:00:13 +08:00
|
|
|
const QMap<Time, QDate> dates {
|
|
|
|
{ Time::Today, today.addDays(0) },
|
|
|
|
{ Time::Yesterday, today.addDays(-1) },
|
|
|
|
{ Time::ThisWeek, today.addDays(-6) },
|
|
|
|
{ Time::ThisMonth, today.addMonths(-1) },
|
|
|
|
{ Time::Month1Ago, today.addMonths(-2) },
|
|
|
|
{ Time::Month2Ago, today.addMonths(-3) },
|
|
|
|
{ Time::Month3Ago, today.addMonths(-4) },
|
|
|
|
{ Time::Month4Ago, today.addMonths(-5) },
|
|
|
|
{ Time::Month5Ago, today.addMonths(-6) },
|
|
|
|
};
|
2017-06-01 15:41:47 +08:00
|
|
|
// clang-format on
|
2017-04-06 16:00:13 +08:00
|
|
|
|
|
|
|
for (Time time : dates.keys()) {
|
|
|
|
if (dates[time] <= date) {
|
|
|
|
return time;
|
|
|
|
}
|
2015-06-12 03:27:54 +08:00
|
|
|
}
|
|
|
|
|
2017-04-08 03:47:27 +08:00
|
|
|
return Time::LongAgo;
|
2015-06-12 03:27:54 +08:00
|
|
|
}
|
|
|
|
|
2015-06-18 23:27:50 +08:00
|
|
|
QDate getDateFriend(Friend* contact)
|
|
|
|
{
|
2016-12-30 06:14:48 +08:00
|
|
|
return Settings::getInstance().getFriendActivity(contact->getPublicKey());
|
2015-06-18 23:27:50 +08:00
|
|
|
}
|
|
|
|
|
2015-07-31 01:24:34 +08:00
|
|
|
qint64 timeUntilTomorrow()
|
|
|
|
{
|
|
|
|
QDateTime now = QDateTime::currentDateTime();
|
|
|
|
QDateTime tomorrow = now.addDays(1); // Tomorrow.
|
2017-02-26 19:52:45 +08:00
|
|
|
tomorrow.setTime(QTime()); // Midnight.
|
2015-07-31 01:24:34 +08:00
|
|
|
return now.msecsTo(tomorrow);
|
|
|
|
}
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
FriendListWidget::FriendListWidget(Widget* parent, bool groupsOnTop)
|
2015-06-03 21:51:23 +08:00
|
|
|
: QWidget(parent)
|
2015-06-17 20:40:14 +08:00
|
|
|
// Prevent Valgrind from complaining. We're changing this to Name here.
|
|
|
|
// Must be Activity for change to take effect.
|
|
|
|
, mode(Activity)
|
2015-06-03 21:51:23 +08:00
|
|
|
, groupsOnTop(groupsOnTop)
|
2014-08-22 23:19:16 +08:00
|
|
|
{
|
2015-06-03 21:51:23 +08:00
|
|
|
listLayout = new FriendListLayout();
|
2015-05-29 00:58:44 +08:00
|
|
|
setLayout(listLayout);
|
2014-08-22 23:19:16 +08:00
|
|
|
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
2015-05-28 01:17:12 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
groupLayout.getLayout()->setSpacing(0);
|
|
|
|
groupLayout.getLayout()->setMargin(0);
|
|
|
|
|
2015-06-17 20:40:14 +08:00
|
|
|
// Prevent QLayout's add child warning before setting the mode.
|
|
|
|
listLayout->removeItem(listLayout->getLayoutOnline());
|
|
|
|
listLayout->removeItem(listLayout->getLayoutOffline());
|
|
|
|
|
2015-06-12 03:27:54 +08:00
|
|
|
setMode(Name);
|
2015-05-29 00:58:44 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
onGroupchatPositionChanged(groupsOnTop);
|
2015-07-31 01:24:34 +08:00
|
|
|
dayTimer = new QTimer(this);
|
|
|
|
dayTimer->setTimerType(Qt::VeryCoarseTimer);
|
|
|
|
connect(dayTimer, &QTimer::timeout, this, &FriendListWidget::dayTimeout);
|
|
|
|
dayTimer->start(timeUntilTomorrow());
|
2015-06-03 21:51:23 +08:00
|
|
|
|
2015-05-29 00:58:44 +08:00
|
|
|
setAcceptDrops(true);
|
2014-08-22 23:19:16 +08:00
|
|
|
}
|
|
|
|
|
2015-06-17 20:40:14 +08:00
|
|
|
FriendListWidget::~FriendListWidget()
|
|
|
|
{
|
2017-02-26 19:52:45 +08:00
|
|
|
if (activityLayout != nullptr) {
|
2015-06-17 20:40:14 +08:00
|
|
|
QLayoutItem* item;
|
2017-02-26 19:52:45 +08:00
|
|
|
while ((item = activityLayout->takeAt(0)) != nullptr) {
|
2015-06-17 20:40:14 +08:00
|
|
|
delete item->widget();
|
|
|
|
delete item;
|
|
|
|
}
|
|
|
|
delete activityLayout;
|
|
|
|
}
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (circleLayout != nullptr) {
|
2015-06-17 20:40:14 +08:00
|
|
|
QLayoutItem* item;
|
2017-02-26 19:52:45 +08:00
|
|
|
while ((item = circleLayout->getLayout()->takeAt(0)) != nullptr) {
|
2015-06-17 20:40:14 +08:00
|
|
|
delete item->widget();
|
|
|
|
delete item;
|
|
|
|
}
|
|
|
|
delete circleLayout;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-12 03:27:54 +08:00
|
|
|
void FriendListWidget::setMode(Mode mode)
|
|
|
|
{
|
2015-06-13 02:52:05 +08:00
|
|
|
if (this->mode == mode)
|
|
|
|
return;
|
|
|
|
|
2015-06-12 03:27:54 +08:00
|
|
|
this->mode = mode;
|
2015-06-18 23:27:50 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (mode == Name) {
|
2015-06-12 21:53:44 +08:00
|
|
|
circleLayout = new GenericChatItemLayout;
|
|
|
|
circleLayout->getLayout()->setSpacing(0);
|
|
|
|
circleLayout->getLayout()->setMargin(0);
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
for (int i = 0; i < Settings::getInstance().getCircleCount(); ++i) {
|
2015-06-12 03:27:54 +08:00
|
|
|
addCircleWidget(i);
|
2015-06-18 23:27:50 +08:00
|
|
|
CircleWidget::getFromID(i)->setVisible(false);
|
|
|
|
}
|
2015-06-12 03:27:54 +08:00
|
|
|
|
2015-06-19 00:01:30 +08:00
|
|
|
// Only display circles once all created to avoid artifacts.
|
|
|
|
for (int i = 0; i < Settings::getInstance().getCircleCount(); ++i)
|
|
|
|
CircleWidget::getFromID(i)->setVisible(true);
|
|
|
|
|
2016-08-22 20:24:37 +08:00
|
|
|
int count = activityLayout ? activityLayout->count() : 0;
|
2017-02-26 19:52:45 +08:00
|
|
|
for (int i = 0; i < count; i++) {
|
2017-01-06 19:02:54 +08:00
|
|
|
QWidget* widget = activityLayout->itemAt(i)->widget();
|
2017-02-26 19:52:45 +08:00
|
|
|
CategoryWidget* categoryWidget = qobject_cast<CategoryWidget*>(widget);
|
|
|
|
if (categoryWidget) {
|
2016-08-22 20:24:37 +08:00
|
|
|
categoryWidget->moveFriendWidgets(this);
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2016-08-22 20:24:37 +08:00
|
|
|
qWarning() << "Unexpected widget";
|
|
|
|
}
|
2015-06-12 21:53:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
listLayout->addLayout(listLayout->getLayoutOnline());
|
|
|
|
listLayout->addLayout(listLayout->getLayoutOffline());
|
|
|
|
listLayout->addLayout(circleLayout->getLayout());
|
|
|
|
onGroupchatPositionChanged(groupsOnTop);
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (activityLayout != nullptr) {
|
2015-06-17 20:40:14 +08:00
|
|
|
QLayoutItem* item;
|
2017-02-26 19:52:45 +08:00
|
|
|
while ((item = activityLayout->takeAt(0)) != nullptr) {
|
2015-06-17 20:40:14 +08:00
|
|
|
delete item->widget();
|
|
|
|
delete item;
|
|
|
|
}
|
|
|
|
delete activityLayout;
|
|
|
|
activityLayout = nullptr;
|
2015-06-12 21:53:44 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
reDraw();
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (mode == Activity) {
|
2017-04-06 16:00:13 +08:00
|
|
|
QLocale ql(Settings::getInstance().getTranslation());
|
|
|
|
QDate today = QDate::currentDate();
|
|
|
|
#define COMMENT "Category for sorting friends by activity"
|
2017-06-01 15:41:47 +08:00
|
|
|
// clang-format off
|
2017-04-06 16:00:13 +08:00
|
|
|
const QMap<Time, QString> names {
|
|
|
|
{ Time::Today, tr("Today", COMMENT) },
|
|
|
|
{ Time::Yesterday, tr("Yesterday", COMMENT) },
|
|
|
|
{ Time::ThisWeek, tr("Last 7 days", COMMENT) },
|
|
|
|
{ Time::ThisMonth, tr("This month", COMMENT) },
|
|
|
|
{ Time::LongAgo, tr("Older than 6 Months", COMMENT) },
|
|
|
|
{ Time::Never, tr("Never", COMMENT) },
|
|
|
|
{ Time::Month1Ago, ql.monthName(today.addMonths(-1).month()) },
|
|
|
|
{ Time::Month2Ago, ql.monthName(today.addMonths(-2).month()) },
|
|
|
|
{ Time::Month3Ago, ql.monthName(today.addMonths(-3).month()) },
|
|
|
|
{ Time::Month4Ago, ql.monthName(today.addMonths(-4).month()) },
|
|
|
|
{ Time::Month5Ago, ql.monthName(today.addMonths(-5).month()) },
|
|
|
|
};
|
2017-06-01 15:50:59 +08:00
|
|
|
// clang-format on
|
2017-04-06 16:00:13 +08:00
|
|
|
#undef COMMENT
|
2015-06-12 03:27:54 +08:00
|
|
|
|
2017-04-06 16:00:13 +08:00
|
|
|
activityLayout = new QVBoxLayout();
|
2017-04-18 05:55:23 +08:00
|
|
|
bool compact = Settings::getInstance().getCompactLayout();
|
2017-04-08 03:47:27 +08:00
|
|
|
for (Time t : names.keys()) {
|
2017-04-18 05:55:23 +08:00
|
|
|
CategoryWidget* category = new CategoryWidget(compact, this);
|
2017-04-06 16:00:13 +08:00
|
|
|
category->setName(names[t]);
|
|
|
|
activityLayout->addWidget(category);
|
2015-06-12 03:27:54 +08:00
|
|
|
}
|
|
|
|
|
2016-08-22 20:24:37 +08:00
|
|
|
moveFriends(listLayout->getLayoutOffline());
|
|
|
|
moveFriends(listLayout->getLayoutOnline());
|
|
|
|
moveFriends(circleLayout->getLayout());
|
2015-06-12 03:27:54 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
for (int i = 0; i < activityLayout->count(); ++i) {
|
2017-04-06 16:00:13 +08:00
|
|
|
QWidget* widget = activityLayout->itemAt(i)->widget();
|
|
|
|
CategoryWidget* categoryWidget = qobject_cast<CategoryWidget*>(widget);
|
2015-06-18 23:27:50 +08:00
|
|
|
categoryWidget->setVisible(categoryWidget->hasChatrooms());
|
2015-06-12 03:27:54 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
listLayout->removeItem(listLayout->getLayoutOnline());
|
|
|
|
listLayout->removeItem(listLayout->getLayoutOffline());
|
2015-06-12 21:53:44 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (circleLayout != nullptr) {
|
2016-07-31 22:17:11 +08:00
|
|
|
listLayout->removeItem(circleLayout->getLayout());
|
|
|
|
|
2015-06-17 20:40:14 +08:00
|
|
|
QLayoutItem* item;
|
2017-02-26 19:52:45 +08:00
|
|
|
while ((item = circleLayout->getLayout()->takeAt(0)) != nullptr) {
|
2015-06-17 20:40:14 +08:00
|
|
|
delete item->widget();
|
|
|
|
delete item;
|
|
|
|
}
|
|
|
|
delete circleLayout;
|
|
|
|
circleLayout = nullptr;
|
|
|
|
}
|
2015-06-12 21:53:44 +08:00
|
|
|
|
2016-07-31 22:17:11 +08:00
|
|
|
listLayout->insertLayout(1, activityLayout);
|
|
|
|
|
2015-06-17 20:40:14 +08:00
|
|
|
reDraw();
|
2015-06-12 03:27:54 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2017-01-06 19:02:54 +08:00
|
|
|
void FriendListWidget::moveFriends(QLayout* layout)
|
2016-08-22 20:24:37 +08:00
|
|
|
{
|
2017-02-26 19:52:45 +08:00
|
|
|
for (int i = 0; i < layout->count(); i++) {
|
2017-01-06 19:02:54 +08:00
|
|
|
QWidget* widget = layout->itemAt(i)->widget();
|
2017-02-26 19:52:45 +08:00
|
|
|
FriendWidget* friendWidget = qobject_cast<FriendWidget*>(widget);
|
|
|
|
CircleWidget* circleWidget = qobject_cast<CircleWidget*>(widget);
|
|
|
|
if (circleWidget) {
|
2016-08-22 20:24:37 +08:00
|
|
|
circleWidget->moveFriendWidgets(this);
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (friendWidget) {
|
2016-08-22 20:24:37 +08:00
|
|
|
int friendId = friendWidget->friendId;
|
2017-02-26 19:52:45 +08:00
|
|
|
Friend* contact = FriendList::findFriend(friendId);
|
2016-08-22 20:24:37 +08:00
|
|
|
QDate activityDate = getDateFriend(contact);
|
2017-04-08 03:47:27 +08:00
|
|
|
int time = static_cast<int>(getTime(activityDate));
|
2016-08-22 20:24:37 +08:00
|
|
|
|
2017-01-06 19:02:54 +08:00
|
|
|
QWidget* w = activityLayout->itemAt(time)->widget();
|
2016-08-22 20:24:37 +08:00
|
|
|
CategoryWidget* categoryWidget = qobject_cast<CategoryWidget*>(w);
|
|
|
|
categoryWidget->addFriendWidget(friendWidget, contact->getStatus());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-12 21:53:44 +08:00
|
|
|
FriendListWidget::Mode FriendListWidget::getMode() const
|
|
|
|
{
|
|
|
|
return mode;
|
|
|
|
}
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
void FriendListWidget::addGroupWidget(GroupWidget* widget)
|
2014-08-22 23:19:16 +08:00
|
|
|
{
|
2015-06-03 21:51:23 +08:00
|
|
|
groupLayout.addSortedWidget(widget);
|
|
|
|
connect(widget, &GroupWidget::renameRequested, this, &FriendListWidget::renameGroupWidget);
|
2014-08-22 23:19:16 +08:00
|
|
|
}
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
void FriendListWidget::addFriendWidget(FriendWidget* w, Status s, int circleIndex)
|
2015-05-31 03:10:43 +08:00
|
|
|
{
|
2015-06-05 23:15:59 +08:00
|
|
|
CircleWidget* circleWidget = CircleWidget::getFromID(circleIndex);
|
|
|
|
if (circleWidget == nullptr)
|
2015-05-31 03:10:43 +08:00
|
|
|
moveWidget(w, s, true);
|
|
|
|
else
|
2015-06-05 23:15:59 +08:00
|
|
|
circleWidget->addFriendWidget(w, s);
|
2015-05-31 03:10:43 +08:00
|
|
|
}
|
|
|
|
|
2015-06-15 21:48:34 +08:00
|
|
|
void FriendListWidget::removeFriendWidget(FriendWidget* w)
|
|
|
|
{
|
|
|
|
Friend* contact = FriendList::findFriend(w->friendId);
|
2017-02-26 19:52:45 +08:00
|
|
|
if (mode == Activity) {
|
2015-06-18 23:27:50 +08:00
|
|
|
QDate activityDate = getDateFriend(contact);
|
2017-04-08 03:47:27 +08:00
|
|
|
int time = static_cast<int>(getTime(activityDate));
|
|
|
|
QWidget* widget = activityLayout->itemAt(time)->widget();
|
|
|
|
CategoryWidget* categoryWidget = qobject_cast<CategoryWidget*>(widget);
|
2015-06-15 21:48:34 +08:00
|
|
|
categoryWidget->removeFriendWidget(w, contact->getStatus());
|
|
|
|
categoryWidget->setVisible(categoryWidget->hasChatrooms());
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2016-12-30 06:14:48 +08:00
|
|
|
int id = Settings::getInstance().getFriendCircleID(contact->getPublicKey());
|
2015-06-15 21:48:34 +08:00
|
|
|
CircleWidget* circleWidget = CircleWidget::getFromID(id);
|
2017-02-26 19:52:45 +08:00
|
|
|
if (circleWidget != nullptr) {
|
2015-06-15 21:48:34 +08:00
|
|
|
circleWidget->removeFriendWidget(w, contact->getStatus());
|
|
|
|
Widget::getInstance()->searchCircle(circleWidget);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-04 04:18:40 +08:00
|
|
|
void FriendListWidget::addCircleWidget(int id)
|
2015-05-31 03:10:43 +08:00
|
|
|
{
|
2015-06-07 11:20:06 +08:00
|
|
|
createCircleWidget(id);
|
2015-05-31 03:10:43 +08:00
|
|
|
}
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
void FriendListWidget::addCircleWidget(FriendWidget* friendWidget)
|
2015-05-28 01:17:12 +08:00
|
|
|
{
|
2015-06-07 11:20:06 +08:00
|
|
|
CircleWidget* circleWidget = createCircleWidget();
|
2017-02-26 19:52:45 +08:00
|
|
|
if (circleWidget != nullptr) {
|
|
|
|
if (friendWidget != nullptr) {
|
2017-01-06 19:02:54 +08:00
|
|
|
Friend* f = FriendList::findFriend(friendWidget->friendId);
|
2016-08-22 20:24:37 +08:00
|
|
|
ToxPk toxPk = f->getPublicKey();
|
|
|
|
int circleId = Settings::getInstance().getFriendCircleID(toxPk);
|
|
|
|
CircleWidget* circleOriginal = CircleWidget::getFromID(circleId);
|
2015-06-07 11:20:06 +08:00
|
|
|
|
2016-08-22 20:24:37 +08:00
|
|
|
circleWidget->addFriendWidget(friendWidget, f->getStatus());
|
2015-06-19 00:37:37 +08:00
|
|
|
circleWidget->setExpanded(true);
|
2015-06-07 11:20:06 +08:00
|
|
|
|
2015-06-19 00:37:37 +08:00
|
|
|
if (circleOriginal != nullptr)
|
|
|
|
Widget::getInstance()->searchCircle(circleOriginal);
|
|
|
|
}
|
2015-06-07 11:20:06 +08:00
|
|
|
|
2015-06-19 00:37:37 +08:00
|
|
|
Widget::getInstance()->searchCircle(circleWidget);
|
2015-07-20 20:13:51 +08:00
|
|
|
|
|
|
|
if (window()->isActiveWindow())
|
|
|
|
circleWidget->editName();
|
2015-05-29 21:26:43 +08:00
|
|
|
}
|
2015-07-20 20:13:51 +08:00
|
|
|
reDraw();
|
2015-05-29 06:36:21 +08:00
|
|
|
}
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
void FriendListWidget::removeCircleWidget(CircleWidget* widget)
|
2015-05-29 06:36:21 +08:00
|
|
|
{
|
2015-06-12 21:53:44 +08:00
|
|
|
circleLayout->removeSortedWidget(widget);
|
2015-05-29 06:36:21 +08:00
|
|
|
widget->deleteLater();
|
2015-05-28 01:17:12 +08:00
|
|
|
}
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
void FriendListWidget::searchChatrooms(const QString& searchString, bool hideOnline,
|
|
|
|
bool hideOffline, bool hideGroups)
|
2015-05-28 22:28:11 +08:00
|
|
|
{
|
2015-06-06 00:57:05 +08:00
|
|
|
groupLayout.search(searchString, hideGroups);
|
2015-06-03 21:51:23 +08:00
|
|
|
listLayout->searchChatrooms(searchString, hideOnline, hideOffline);
|
2015-06-18 23:27:50 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (circleLayout != nullptr) {
|
|
|
|
for (int i = 0; i != circleLayout->getLayout()->count(); ++i) {
|
|
|
|
CircleWidget* circleWidget =
|
|
|
|
static_cast<CircleWidget*>(circleLayout->getLayout()->itemAt(i)->widget());
|
2015-06-18 03:45:03 +08:00
|
|
|
circleWidget->search(searchString, true, hideOnline, hideOffline);
|
|
|
|
}
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (activityLayout != nullptr) {
|
|
|
|
for (int i = 0; i != activityLayout->count(); ++i) {
|
|
|
|
CategoryWidget* categoryWidget =
|
|
|
|
static_cast<CategoryWidget*>(activityLayout->itemAt(i)->widget());
|
2015-06-18 23:27:50 +08:00
|
|
|
categoryWidget->search(searchString, true, hideOnline, hideOffline);
|
|
|
|
categoryWidget->setVisible(categoryWidget->hasChatrooms());
|
|
|
|
}
|
|
|
|
}
|
2015-05-28 22:28:11 +08:00
|
|
|
}
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
void FriendListWidget::renameGroupWidget(GroupWidget* groupWidget, const QString& newName)
|
2015-05-28 01:17:12 +08:00
|
|
|
{
|
2015-06-03 21:51:23 +08:00
|
|
|
groupLayout.removeSortedWidget(groupWidget);
|
|
|
|
groupWidget->setName(newName);
|
|
|
|
groupLayout.addSortedWidget(groupWidget);
|
2014-08-22 23:19:16 +08:00
|
|
|
}
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
void FriendListWidget::renameCircleWidget(CircleWidget* circleWidget, const QString& newName)
|
2015-06-02 02:39:40 +08:00
|
|
|
{
|
2015-06-12 21:53:44 +08:00
|
|
|
circleLayout->removeSortedWidget(circleWidget);
|
2015-06-02 02:39:40 +08:00
|
|
|
circleWidget->setName(newName);
|
2015-06-12 21:53:44 +08:00
|
|
|
circleLayout->addSortedWidget(circleWidget);
|
2015-06-02 02:39:40 +08:00
|
|
|
}
|
|
|
|
|
2015-03-12 08:41:18 +08:00
|
|
|
void FriendListWidget::onGroupchatPositionChanged(bool top)
|
|
|
|
{
|
2015-06-03 21:51:23 +08:00
|
|
|
groupsOnTop = top;
|
2015-06-12 21:53:44 +08:00
|
|
|
|
|
|
|
if (mode != Name)
|
|
|
|
return;
|
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
listLayout->removeItem(groupLayout.getLayout());
|
2015-06-12 21:53:44 +08:00
|
|
|
|
2015-03-26 00:27:33 +08:00
|
|
|
if (top)
|
2015-06-03 21:51:23 +08:00
|
|
|
listLayout->insertLayout(0, groupLayout.getLayout());
|
2015-03-23 17:38:24 +08:00
|
|
|
else
|
2015-06-03 21:51:23 +08:00
|
|
|
listLayout->insertLayout(1, groupLayout.getLayout());
|
2015-06-12 21:53:44 +08:00
|
|
|
|
|
|
|
reDraw();
|
2015-06-03 21:51:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void FriendListWidget::cycleContacts(GenericChatroomWidget* activeChatroomWidget, bool forward)
|
|
|
|
{
|
|
|
|
if (activeChatroomWidget == nullptr)
|
|
|
|
return;
|
|
|
|
|
|
|
|
int index = -1;
|
2016-09-23 10:06:20 +08:00
|
|
|
FriendWidget* friendWidget = qobject_cast<FriendWidget*>(activeChatroomWidget);
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (mode == Activity) {
|
2015-06-18 03:45:03 +08:00
|
|
|
if (friendWidget == nullptr)
|
|
|
|
return;
|
|
|
|
|
2015-06-18 23:27:50 +08:00
|
|
|
QDate activityDate = getDateFriend(FriendList::findFriend(friendWidget->friendId));
|
2017-04-08 03:47:27 +08:00
|
|
|
index = static_cast<int>(getTime(activityDate));
|
|
|
|
QWidget* widget = activityLayout->itemAt(index)->widget();
|
|
|
|
CategoryWidget* categoryWidget = qobject_cast<CategoryWidget*>(widget);
|
2015-06-18 03:45:03 +08:00
|
|
|
|
|
|
|
if (categoryWidget == nullptr || categoryWidget->cycleContacts(friendWidget, forward))
|
|
|
|
return;
|
|
|
|
|
|
|
|
index += forward ? 1 : -1;
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
for (;;) {
|
2015-06-18 03:45:03 +08:00
|
|
|
// Bounds checking.
|
2017-04-08 03:47:27 +08:00
|
|
|
if (index < 0) {
|
|
|
|
index = LAST_TIME;
|
2015-06-18 03:45:03 +08:00
|
|
|
continue;
|
2017-04-08 03:47:27 +08:00
|
|
|
} else if (index > LAST_TIME) {
|
|
|
|
index = 0;
|
2015-06-18 03:45:03 +08:00
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
2017-04-08 03:47:27 +08:00
|
|
|
widget = activityLayout->itemAt(index)->widget();
|
|
|
|
categoryWidget = qobject_cast<CategoryWidget*>(widget);
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (categoryWidget != nullptr) {
|
|
|
|
if (!categoryWidget->cycleContacts(forward)) {
|
2015-06-18 03:45:03 +08:00
|
|
|
// Skip empty or finished categories.
|
|
|
|
index += forward ? 1 : -1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
|
|
}
|
2015-06-03 21:51:23 +08:00
|
|
|
|
2015-06-18 03:45:03 +08:00
|
|
|
QLayout* currentLayout = nullptr;
|
2015-06-06 01:38:07 +08:00
|
|
|
CircleWidget* circleWidget = nullptr;
|
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (friendWidget != nullptr) {
|
|
|
|
circleWidget = CircleWidget::getFromID(Settings::getInstance().getFriendCircleID(
|
|
|
|
FriendList::findFriend(friendWidget->friendId)->getPublicKey()));
|
|
|
|
if (circleWidget != nullptr) {
|
2015-06-06 01:38:07 +08:00
|
|
|
if (circleWidget->cycleContacts(friendWidget, forward))
|
|
|
|
return;
|
2015-06-03 21:51:23 +08:00
|
|
|
|
2015-06-12 21:53:44 +08:00
|
|
|
index = circleLayout->indexOfSortedWidget(circleWidget);
|
|
|
|
currentLayout = circleLayout->getLayout();
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2015-06-03 21:51:23 +08:00
|
|
|
currentLayout = listLayout->getLayoutOnline();
|
|
|
|
index = listLayout->indexOfFriendWidget(friendWidget, true);
|
2017-02-26 19:52:45 +08:00
|
|
|
if (index == -1) {
|
2015-06-03 21:51:23 +08:00
|
|
|
currentLayout = listLayout->getLayoutOffline();
|
|
|
|
index = listLayout->indexOfFriendWidget(friendWidget, false);
|
|
|
|
}
|
|
|
|
}
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2016-09-23 10:06:20 +08:00
|
|
|
GroupWidget* groupWidget = qobject_cast<GroupWidget*>(activeChatroomWidget);
|
2017-02-26 19:52:45 +08:00
|
|
|
if (groupWidget != nullptr) {
|
2015-06-06 01:38:07 +08:00
|
|
|
currentLayout = groupLayout.getLayout();
|
|
|
|
index = groupLayout.indexOfSortedWidget(groupWidget);
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2015-06-06 01:38:07 +08:00
|
|
|
return;
|
|
|
|
};
|
2015-06-03 21:51:23 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
index += forward ? 1 : -1;
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
for (;;) {
|
2015-06-03 21:51:23 +08:00
|
|
|
// Bounds checking.
|
2017-02-26 19:52:45 +08:00
|
|
|
if (index < 0) {
|
2015-06-03 21:51:23 +08:00
|
|
|
currentLayout = nextLayout(currentLayout, forward);
|
|
|
|
index = currentLayout->count() - 1;
|
|
|
|
continue;
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (index >= currentLayout->count()) {
|
2015-06-03 21:51:23 +08:00
|
|
|
currentLayout = nextLayout(currentLayout, forward);
|
|
|
|
index = 0;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Go to the actual next index.
|
2017-02-26 19:52:45 +08:00
|
|
|
if (currentLayout == listLayout->getLayoutOnline()
|
|
|
|
|| currentLayout == listLayout->getLayoutOffline()
|
|
|
|
|| currentLayout == groupLayout.getLayout()) {
|
|
|
|
GenericChatroomWidget* chatWidget =
|
|
|
|
qobject_cast<GenericChatroomWidget*>(currentLayout->itemAt(index)->widget());
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
if (chatWidget != nullptr)
|
|
|
|
emit chatWidget->chatroomWidgetClicked(chatWidget);
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
return;
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (currentLayout == circleLayout->getLayout()) {
|
2016-09-23 10:06:20 +08:00
|
|
|
circleWidget = qobject_cast<CircleWidget*>(currentLayout->itemAt(index)->widget());
|
2017-02-26 19:52:45 +08:00
|
|
|
if (circleWidget != nullptr) {
|
|
|
|
if (!circleWidget->cycleContacts(forward)) {
|
2015-06-03 21:51:23 +08:00
|
|
|
// Skip empty or finished circles.
|
|
|
|
index += forward ? 1 : -1;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return;
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2015-06-03 21:51:23 +08:00
|
|
|
return;
|
|
|
|
}
|
2015-03-12 08:41:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
void FriendListWidget::dragEnterEvent(QDragEnterEvent* event)
|
2015-05-29 00:58:44 +08:00
|
|
|
{
|
2016-08-07 03:28:40 +08:00
|
|
|
ToxId toxId(event->mimeData()->text());
|
2017-01-06 19:02:54 +08:00
|
|
|
Friend* frnd = FriendList::findFriend(toxId.getPublicKey());
|
2016-08-07 03:28:40 +08:00
|
|
|
if (frnd)
|
2015-05-29 00:58:44 +08:00
|
|
|
event->acceptProposedAction();
|
|
|
|
}
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
void FriendListWidget::dropEvent(QDropEvent* event)
|
2015-05-29 00:58:44 +08:00
|
|
|
{
|
2016-08-07 03:28:40 +08:00
|
|
|
// Check, that the element is dropped from qTox
|
2017-02-26 19:52:45 +08:00
|
|
|
QObject* o = event->source();
|
|
|
|
FriendWidget* widget = qobject_cast<FriendWidget*>(o);
|
2016-08-07 03:28:40 +08:00
|
|
|
if (!widget)
|
|
|
|
return;
|
2015-05-29 00:58:44 +08:00
|
|
|
|
2016-08-07 03:28:40 +08:00
|
|
|
// Check, that the user has a friend with the same ToxId
|
|
|
|
ToxId toxId(event->mimeData()->text());
|
2017-01-06 19:02:54 +08:00
|
|
|
Friend* f = FriendList::findFriend(toxId.getPublicKey());
|
2016-08-07 03:28:40 +08:00
|
|
|
if (!f)
|
|
|
|
return;
|
2015-05-29 00:58:44 +08:00
|
|
|
|
2016-08-07 03:28:40 +08:00
|
|
|
// Save CircleWidget before changing the Id
|
2016-12-30 06:14:48 +08:00
|
|
|
int circleId = Settings::getInstance().getFriendCircleID(f->getPublicKey());
|
2016-08-07 03:28:40 +08:00
|
|
|
CircleWidget* circleWidget = CircleWidget::getFromID(circleId);
|
2015-05-29 00:58:44 +08:00
|
|
|
|
2016-08-07 03:28:40 +08:00
|
|
|
moveWidget(widget, f->getStatus(), true);
|
2015-05-29 00:58:44 +08:00
|
|
|
|
2016-08-07 03:28:40 +08:00
|
|
|
if (circleWidget)
|
|
|
|
circleWidget->updateStatus();
|
2015-05-29 00:58:44 +08:00
|
|
|
}
|
|
|
|
|
2015-07-31 01:24:34 +08:00
|
|
|
void FriendListWidget::dayTimeout()
|
|
|
|
{
|
2017-02-26 19:52:45 +08:00
|
|
|
if (mode == Activity) {
|
2015-07-31 01:24:34 +08:00
|
|
|
setMode(Name);
|
|
|
|
setMode(Activity); // Refresh all.
|
|
|
|
}
|
|
|
|
|
|
|
|
dayTimer->start(timeUntilTomorrow());
|
|
|
|
}
|
|
|
|
|
2016-08-22 20:24:37 +08:00
|
|
|
void FriendListWidget::moveWidget(FriendWidget* widget, Status s, bool add)
|
2014-08-22 23:19:16 +08:00
|
|
|
{
|
2017-02-26 19:52:45 +08:00
|
|
|
if (mode == Name) {
|
2017-01-06 19:02:54 +08:00
|
|
|
Friend* f = FriendList::findFriend(widget->friendId);
|
2016-08-22 20:24:37 +08:00
|
|
|
int circleId = Settings::getInstance().getFriendCircleID(f->getPublicKey());
|
2015-06-12 03:27:54 +08:00
|
|
|
CircleWidget* circleWidget = CircleWidget::getFromID(circleId);
|
2015-05-28 01:17:12 +08:00
|
|
|
|
2017-02-26 19:52:45 +08:00
|
|
|
if (circleWidget == nullptr || add) {
|
2015-06-12 03:27:54 +08:00
|
|
|
if (circleId != -1)
|
2016-08-22 20:24:37 +08:00
|
|
|
Settings::getInstance().setFriendCircleID(f->getPublicKey(), -1);
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2016-08-22 20:24:37 +08:00
|
|
|
listLayout->addFriendWidget(widget, s);
|
2015-06-12 03:27:54 +08:00
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-08-22 20:24:37 +08:00
|
|
|
circleWidget->addFriendWidget(widget, s);
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2016-08-22 20:24:37 +08:00
|
|
|
Friend* contact = FriendList::findFriend(widget->friendId);
|
2015-06-18 23:27:50 +08:00
|
|
|
QDate activityDate = getDateFriend(contact);
|
2017-04-08 03:47:27 +08:00
|
|
|
int time = static_cast<int>(getTime(activityDate));
|
2017-01-06 19:02:54 +08:00
|
|
|
QWidget* w = activityLayout->itemAt(time)->widget();
|
2016-08-22 20:24:37 +08:00
|
|
|
CategoryWidget* categoryWidget = qobject_cast<CategoryWidget*>(w);
|
|
|
|
categoryWidget->addFriendWidget(widget, contact->getStatus());
|
2015-06-13 00:09:01 +08:00
|
|
|
categoryWidget->show();
|
2015-03-12 08:23:22 +08:00
|
|
|
}
|
2014-08-22 23:19:16 +08:00
|
|
|
}
|
2015-06-03 18:26:48 +08:00
|
|
|
|
2015-07-01 21:10:55 +08:00
|
|
|
void FriendListWidget::updateActivityDate(const QDate& date)
|
|
|
|
{
|
|
|
|
if (mode != Activity)
|
|
|
|
return;
|
|
|
|
|
2017-04-08 03:47:27 +08:00
|
|
|
int time = static_cast<int>(getTime(date));
|
|
|
|
QWidget* widget = activityLayout->itemAt(time)->widget();
|
|
|
|
CategoryWidget* categoryWidget = static_cast<CategoryWidget*>(widget);
|
2015-07-01 21:10:55 +08:00
|
|
|
categoryWidget->updateStatus();
|
|
|
|
|
|
|
|
categoryWidget->setVisible(categoryWidget->hasChatrooms());
|
|
|
|
}
|
|
|
|
|
2015-06-03 18:26:48 +08:00
|
|
|
// update widget after add/delete/hide/show
|
|
|
|
void FriendListWidget::reDraw()
|
|
|
|
{
|
|
|
|
hide();
|
|
|
|
show();
|
2017-02-26 19:52:45 +08:00
|
|
|
resize(QSize()); // lifehack
|
2015-06-03 18:26:48 +08:00
|
|
|
}
|
2015-06-03 21:51:23 +08:00
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
CircleWidget* FriendListWidget::createCircleWidget(int id)
|
|
|
|
{
|
2015-06-12 03:27:54 +08:00
|
|
|
if (id == -1)
|
|
|
|
id = Settings::getInstance().addCircle();
|
|
|
|
|
2015-06-17 04:26:20 +08:00
|
|
|
// Stop, after it has been created. Code after this is for displaying.
|
2015-06-12 03:27:54 +08:00
|
|
|
if (mode == Activity)
|
|
|
|
return nullptr;
|
|
|
|
|
2015-06-18 23:27:50 +08:00
|
|
|
assert(circleLayout != nullptr);
|
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
CircleWidget* circleWidget = new CircleWidget(this, id);
|
2015-06-12 21:53:44 +08:00
|
|
|
circleLayout->addSortedWidget(circleWidget);
|
2015-06-07 11:20:06 +08:00
|
|
|
connect(this, &FriendListWidget::onCompactChanged, circleWidget, &CircleWidget::onCompactChanged);
|
|
|
|
connect(circleWidget, &CircleWidget::renameRequested, this, &FriendListWidget::renameCircleWidget);
|
|
|
|
circleWidget->show(); // Avoid flickering.
|
2015-06-17 04:26:20 +08:00
|
|
|
|
2015-06-07 11:20:06 +08:00
|
|
|
return circleWidget;
|
|
|
|
}
|
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
QLayout* FriendListWidget::nextLayout(QLayout* layout, bool forward) const
|
|
|
|
{
|
2017-02-26 19:52:45 +08:00
|
|
|
if (layout == groupLayout.getLayout()) {
|
|
|
|
if (forward) {
|
2015-06-03 21:51:23 +08:00
|
|
|
if (groupsOnTop)
|
|
|
|
return listLayout->getLayoutOnline();
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
return listLayout->getLayoutOffline();
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2015-06-03 21:51:23 +08:00
|
|
|
if (groupsOnTop)
|
2015-06-12 21:53:44 +08:00
|
|
|
return circleLayout->getLayout();
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
return listLayout->getLayoutOnline();
|
|
|
|
}
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (layout == listLayout->getLayoutOnline()) {
|
|
|
|
if (forward) {
|
2015-06-03 21:51:23 +08:00
|
|
|
if (groupsOnTop)
|
|
|
|
return listLayout->getLayoutOffline();
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
return groupLayout.getLayout();
|
2017-02-26 19:52:45 +08:00
|
|
|
} else {
|
2015-06-03 21:51:23 +08:00
|
|
|
if (groupsOnTop)
|
|
|
|
return groupLayout.getLayout();
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-12 21:53:44 +08:00
|
|
|
return circleLayout->getLayout();
|
2015-06-03 21:51:23 +08:00
|
|
|
}
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (layout == listLayout->getLayoutOffline()) {
|
2015-06-03 21:51:23 +08:00
|
|
|
if (forward)
|
2015-06-12 21:53:44 +08:00
|
|
|
return circleLayout->getLayout();
|
2015-06-03 21:51:23 +08:00
|
|
|
else if (groupsOnTop)
|
|
|
|
return listLayout->getLayoutOnline();
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
return groupLayout.getLayout();
|
2017-02-26 19:52:45 +08:00
|
|
|
} else if (layout == circleLayout->getLayout()) {
|
|
|
|
if (forward) {
|
2015-06-03 21:51:23 +08:00
|
|
|
if (groupsOnTop)
|
|
|
|
return groupLayout.getLayout();
|
2015-06-18 03:45:03 +08:00
|
|
|
|
2015-06-03 21:51:23 +08:00
|
|
|
return listLayout->getLayoutOnline();
|
2017-02-26 19:52:45 +08:00
|
|
|
} else
|
2015-06-03 21:51:23 +08:00
|
|
|
return listLayout->getLayoutOffline();
|
|
|
|
}
|
|
|
|
return nullptr;
|
|
|
|
}
|