mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Search within contact groupings
This commit is contained in:
parent
3fc9dd1070
commit
682feb7a58
|
@ -21,6 +21,7 @@
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QBoxLayout>
|
#include <QBoxLayout>
|
||||||
|
#include <QMouseEvent>
|
||||||
|
|
||||||
#include <QDragEnterEvent>
|
#include <QDragEnterEvent>
|
||||||
#include <QMimeData>
|
#include <QMimeData>
|
||||||
|
@ -36,7 +37,7 @@ CircleWidget::CircleWidget(QWidget *parent)
|
||||||
{
|
{
|
||||||
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/circleWidget.css"));
|
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/circleWidget.css"));
|
||||||
|
|
||||||
QWidget *container = new QWidget(this);
|
container = new QWidget(this);
|
||||||
container->setObjectName("circleWidgetContainer");
|
container->setObjectName("circleWidgetContainer");
|
||||||
container->setProperty("active", false);
|
container->setProperty("active", false);
|
||||||
mainLayout = new QVBoxLayout(this);
|
mainLayout = new QVBoxLayout(this);
|
||||||
|
@ -137,16 +138,29 @@ void CircleWidget::toggle()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CircleWidget::mousePressEvent(QMouseEvent*)
|
void CircleWidget::searchChatrooms(const QString &searchString, bool hideOnline, bool hideOffline, bool hideGroups)
|
||||||
{
|
{
|
||||||
toggle();
|
listLayout->searchChatrooms(searchString, hideOnline, hideOffline, hideGroups);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircleWidget::mousePressEvent(QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (event->button() == Qt::LeftButton)
|
||||||
|
toggle();
|
||||||
}
|
}
|
||||||
|
|
||||||
void CircleWidget::dragEnterEvent(QDragEnterEvent *event)
|
void CircleWidget::dragEnterEvent(QDragEnterEvent *event)
|
||||||
{
|
{
|
||||||
qDebug() << event->mimeData();
|
|
||||||
if (event->mimeData()->hasFormat("friend"))
|
if (event->mimeData()->hasFormat("friend"))
|
||||||
event->acceptProposedAction();
|
event->acceptProposedAction();
|
||||||
|
container->setAttribute(Qt::WA_UnderMouse, true); // Simulate hover.
|
||||||
|
Style::repolish(container);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CircleWidget::dragLeaveEvent(QDragLeaveEvent *)
|
||||||
|
{
|
||||||
|
container->setAttribute(Qt::WA_UnderMouse, false);
|
||||||
|
Style::repolish(container);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CircleWidget::dropEvent(QDropEvent *event)
|
void CircleWidget::dropEvent(QDropEvent *event)
|
||||||
|
@ -164,5 +178,8 @@ void CircleWidget::dropEvent(QDropEvent *event)
|
||||||
assert(widget != nullptr);
|
assert(widget != nullptr);
|
||||||
|
|
||||||
listLayout->addFriendWidget(widget, f->getStatus());
|
listLayout->addFriendWidget(widget, f->getStatus());
|
||||||
|
|
||||||
|
container->setAttribute(Qt::WA_UnderMouse, false);
|
||||||
|
Style::repolish(container);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,6 +32,8 @@ public:
|
||||||
|
|
||||||
void addFriendWidget(FriendWidget *w, Status s);
|
void addFriendWidget(FriendWidget *w, Status s);
|
||||||
|
|
||||||
|
void searchChatrooms(const QString &searchString, bool hideOnline = false, bool hideOffline = false, bool hideGroups = false);
|
||||||
|
|
||||||
void toggle();
|
void toggle();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
@ -39,6 +41,7 @@ protected:
|
||||||
void mousePressEvent(QMouseEvent *event) override;
|
void mousePressEvent(QMouseEvent *event) override;
|
||||||
|
|
||||||
void dragEnterEvent(QDragEnterEvent* event) override;
|
void dragEnterEvent(QDragEnterEvent* event) override;
|
||||||
|
void dragLeaveEvent(QDragLeaveEvent *event) override;
|
||||||
void dropEvent(QDropEvent* event) override;
|
void dropEvent(QDropEvent* event) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -51,6 +54,7 @@ private:
|
||||||
FriendListLayout *listLayout;
|
FriendListLayout *listLayout;
|
||||||
QVBoxLayout *mainLayout;
|
QVBoxLayout *mainLayout;
|
||||||
QLabel *arrowLabel;
|
QLabel *arrowLabel;
|
||||||
|
QWidget *container;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // CIRCLEWIDGET_H
|
#endif // CIRCLEWIDGET_H
|
||||||
|
|
|
@ -18,6 +18,11 @@
|
||||||
#include "friendwidget.h"
|
#include "friendwidget.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
|
#include "groupwidget.h"
|
||||||
|
#include "friendwidget.h"
|
||||||
|
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
FriendListLayout::FriendListLayout(QWidget *parent, bool groupsOnTop)
|
FriendListLayout::FriendListLayout(QWidget *parent, bool groupsOnTop)
|
||||||
: QVBoxLayout(parent)
|
: QVBoxLayout(parent)
|
||||||
{
|
{
|
||||||
|
@ -37,10 +42,6 @@ FriendListLayout::FriendListLayout(QWidget *parent, bool groupsOnTop)
|
||||||
friendLayouts[Offline]->setSpacing(0);
|
friendLayouts[Offline]->setSpacing(0);
|
||||||
friendLayouts[Offline]->setMargin(0);
|
friendLayouts[Offline]->setMargin(0);
|
||||||
|
|
||||||
circleLayout = new QVBoxLayout();
|
|
||||||
circleLayout->setSpacing(0);
|
|
||||||
circleLayout->setMargin(0);
|
|
||||||
|
|
||||||
if (groupsOnTop)
|
if (groupsOnTop)
|
||||||
{
|
{
|
||||||
QVBoxLayout::addLayout(groupLayout);
|
QVBoxLayout::addLayout(groupLayout);
|
||||||
|
@ -53,7 +54,6 @@ FriendListLayout::FriendListLayout(QWidget *parent, bool groupsOnTop)
|
||||||
QVBoxLayout::addLayout(groupLayout);
|
QVBoxLayout::addLayout(groupLayout);
|
||||||
QVBoxLayout::addLayout(friendLayouts[Offline]);
|
QVBoxLayout::addLayout(friendLayouts[Offline]);
|
||||||
}
|
}
|
||||||
QVBoxLayout::addLayout(circleLayout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendListLayout::addFriendWidget(FriendWidget *w, Status s)
|
void FriendListLayout::addFriendWidget(FriendWidget *w, Status s)
|
||||||
|
@ -85,9 +85,28 @@ void FriendListLayout::addFriendWidget(FriendWidget *w, Status s)
|
||||||
l->insertWidget(min, w);
|
l->insertWidget(min, w);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendListLayout::addItem(QLayoutItem *)
|
template <typename WidgetType>
|
||||||
|
void searchHelper(const QString &searchString, QBoxLayout *boxLayout, bool hideAll)
|
||||||
{
|
{
|
||||||
// Must add items through addFriendWidget, addGroupWidget or addCircleWidget.
|
for (int index = 0; index < boxLayout->count(); ++index)
|
||||||
|
{
|
||||||
|
WidgetType* widgetAt = static_cast<WidgetType*>(boxLayout->itemAt(index)->widget());
|
||||||
|
QString widgetName = widgetAt->getName();
|
||||||
|
|
||||||
|
widgetAt->setVisible(!hideAll && widgetName.contains(searchString, Qt::CaseInsensitive));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void FriendListLayout::searchChatrooms(const QString &searchString, bool hideOnline, bool hideOffline, bool hideGroups)
|
||||||
|
{
|
||||||
|
searchHelper<GroupWidget>(searchString, groupLayout, hideGroups);
|
||||||
|
searchHelper<FriendWidget>(searchString, friendLayouts[Online], hideOnline);
|
||||||
|
searchHelper<FriendWidget>(searchString, friendLayouts[Offline], hideOffline);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool FriendListLayout::hasChatrooms() const
|
||||||
|
{
|
||||||
|
return !groupLayout->isEmpty() || !friendLayouts[Online]->isEmpty() || !friendLayouts[Offline]->isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout* FriendListLayout::getFriendLayout(Status s)
|
QVBoxLayout* FriendListLayout::getFriendLayout(Status s)
|
||||||
|
|
|
@ -29,10 +29,10 @@ public:
|
||||||
explicit FriendListLayout(QWidget *parent, bool groupsOnTop = true);
|
explicit FriendListLayout(QWidget *parent, bool groupsOnTop = true);
|
||||||
|
|
||||||
void addGroupWidget(GroupWidget *widget);
|
void addGroupWidget(GroupWidget *widget);
|
||||||
void addCircleWidget(CircleWidget *widget);
|
|
||||||
void addFriendWidget(FriendWidget *widget, Status s);
|
void addFriendWidget(FriendWidget *widget, Status s);
|
||||||
|
|
||||||
virtual void addItem(QLayoutItem *) override;
|
void searchChatrooms(const QString &searchString, bool hideOnline = false, bool hideOffline = false, bool hideGroups = false);
|
||||||
|
bool hasChatrooms() const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QVBoxLayout* getFriendLayout(Status s);
|
QVBoxLayout* getFriendLayout(Status s);
|
||||||
|
@ -44,7 +44,6 @@ public:
|
||||||
};
|
};
|
||||||
QVBoxLayout *friendLayouts[2];
|
QVBoxLayout *friendLayouts[2];
|
||||||
QVBoxLayout *groupLayout;
|
QVBoxLayout *groupLayout;
|
||||||
QVBoxLayout *circleLayout;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // GENERICFRIENDLISTWIDGET_H
|
#endif // GENERICFRIENDLISTWIDGET_H
|
||||||
|
|
|
@ -23,57 +23,31 @@
|
||||||
#include "src/friendlist.h"
|
#include "src/friendlist.h"
|
||||||
#include "src/widget/friendwidget.h"
|
#include "src/widget/friendwidget.h"
|
||||||
#include "groupwidget.h"
|
#include "groupwidget.h"
|
||||||
#include "circlewidget.hpp"
|
#include "circlewidget.h"
|
||||||
|
#include "friendlistlayout.h"
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
|
|
||||||
FriendListWidget::FriendListWidget(QWidget *parent, bool groupchatPosition) :
|
FriendListWidget::FriendListWidget(QWidget *parent, bool groupsOnTop) :
|
||||||
QWidget(parent)
|
QWidget(parent)
|
||||||
{
|
{
|
||||||
mainLayout = new QVBoxLayout();
|
listLayout = new FriendListLayout(this, groupsOnTop);
|
||||||
setLayout(mainLayout);
|
|
||||||
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
|
||||||
layout()->setSpacing(0);
|
|
||||||
layout()->setMargin(0);
|
|
||||||
|
|
||||||
groupLayout = new QVBoxLayout();
|
|
||||||
groupLayout->setSpacing(0);
|
|
||||||
groupLayout->setMargin(0);
|
|
||||||
|
|
||||||
friendLayouts[Online] = new QVBoxLayout();
|
|
||||||
friendLayouts[Online]->setSpacing(0);
|
|
||||||
friendLayouts[Online]->setMargin(0);
|
|
||||||
|
|
||||||
friendLayouts[Offline] = new QVBoxLayout();
|
|
||||||
friendLayouts[Offline]->setSpacing(0);
|
|
||||||
friendLayouts[Offline]->setMargin(0);
|
|
||||||
|
|
||||||
circleLayout = new QVBoxLayout();
|
circleLayout = new QVBoxLayout();
|
||||||
circleLayout->setSpacing(0);
|
circleLayout->setSpacing(0);
|
||||||
circleLayout->setMargin(0);
|
circleLayout->setMargin(0);
|
||||||
|
|
||||||
if (groupchatPosition)
|
listLayout->addLayout(circleLayout);
|
||||||
{
|
|
||||||
mainLayout->addLayout(groupLayout);
|
|
||||||
mainLayout->addLayout(friendLayouts[Online]);
|
|
||||||
mainLayout->addLayout(friendLayouts[Offline]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
mainLayout->addLayout(friendLayouts[Online]);
|
|
||||||
mainLayout->addLayout(groupLayout);
|
|
||||||
mainLayout->addLayout(friendLayouts[Offline]);
|
|
||||||
}
|
|
||||||
mainLayout->addLayout(circleLayout);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendListWidget::addGroupWidget(GroupWidget *widget)
|
void FriendListWidget::addGroupWidget(GroupWidget *widget)
|
||||||
{
|
{
|
||||||
groupLayout->addWidget(widget);
|
listLayout->groupLayout->addWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendListWidget::hideGroups(QString searchString, bool hideAll)
|
void FriendListWidget::hideGroups(QString searchString, bool hideAll)
|
||||||
{
|
{
|
||||||
QVBoxLayout* groups = groupLayout;
|
QVBoxLayout* groups = listLayout->groupLayout;
|
||||||
int groupCount = groups->count(), index;
|
int groupCount = groups->count(), index;
|
||||||
|
|
||||||
for (index = 0; index<groupCount; index++)
|
for (index = 0; index<groupCount; index++)
|
||||||
|
@ -81,10 +55,7 @@ void FriendListWidget::hideGroups(QString searchString, bool hideAll)
|
||||||
GroupWidget* groupWidget = static_cast<GroupWidget*>(groups->itemAt(index)->widget());
|
GroupWidget* groupWidget = static_cast<GroupWidget*>(groups->itemAt(index)->widget());
|
||||||
QString groupName = groupWidget->getName();
|
QString groupName = groupWidget->getName();
|
||||||
|
|
||||||
if (!groupName.contains(searchString, Qt::CaseInsensitive) | hideAll)
|
groupWidget->setVisible(groupName.contains(searchString, Qt::CaseInsensitive) && !hideAll);
|
||||||
groupWidget->setVisible(false);
|
|
||||||
else
|
|
||||||
groupWidget->setVisible(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,6 +64,16 @@ void FriendListWidget::addCircleWidget(CircleWidget *widget)
|
||||||
circleLayout->addWidget(widget);
|
circleLayout->addWidget(widget);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FriendListWidget::searchChatrooms(const QString &searchString, bool hideOnline, bool hideOffline, bool hideGroups)
|
||||||
|
{
|
||||||
|
listLayout->searchChatrooms(searchString, hideOnline, hideOffline, hideGroups);
|
||||||
|
for (int i = 0; i != circleLayout->count(); ++i)
|
||||||
|
{
|
||||||
|
CircleWidget *circleWidget = static_cast<CircleWidget*>(circleLayout->itemAt(i)->widget());
|
||||||
|
circleWidget->searchChatrooms(searchString, hideOnline, hideOffline, hideGroups);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void FriendListWidget::hideFriends(QString searchString, Status status, bool hideAll)
|
void FriendListWidget::hideFriends(QString searchString, Status status, bool hideAll)
|
||||||
{
|
{
|
||||||
QVBoxLayout* friends = getFriendLayout(status);
|
QVBoxLayout* friends = getFriendLayout(status);
|
||||||
|
@ -103,47 +84,40 @@ void FriendListWidget::hideFriends(QString searchString, Status status, bool hid
|
||||||
FriendWidget* friendWidget = static_cast<FriendWidget*>(friends->itemAt(index)->widget());
|
FriendWidget* friendWidget = static_cast<FriendWidget*>(friends->itemAt(index)->widget());
|
||||||
QString friendName = friendWidget->getName();
|
QString friendName = friendWidget->getName();
|
||||||
|
|
||||||
if (!friendName.contains(searchString, Qt::CaseInsensitive) | hideAll)
|
friendWidget->setVisible(friendName.contains(searchString, Qt::CaseInsensitive) && !hideAll);
|
||||||
friendWidget->setVisible(false);
|
|
||||||
else
|
|
||||||
friendWidget->setVisible(true);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QVBoxLayout* FriendListWidget::getFriendLayout(Status s)
|
QVBoxLayout* FriendListWidget::getFriendLayout(Status s)
|
||||||
{
|
{
|
||||||
if (s == Status::Offline)
|
return s == Status::Offline ? listLayout->friendLayouts[Offline] : listLayout->friendLayouts[Online];
|
||||||
{
|
|
||||||
return friendLayouts[Offline];
|
|
||||||
}
|
|
||||||
return friendLayouts[Online];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendListWidget::onGroupchatPositionChanged(bool top)
|
void FriendListWidget::onGroupchatPositionChanged(bool top)
|
||||||
{
|
{
|
||||||
mainLayout->removeItem(circleLayout);
|
listLayout->removeItem(circleLayout);
|
||||||
mainLayout->removeItem(groupLayout);
|
listLayout->removeItem(listLayout->groupLayout);
|
||||||
mainLayout->removeItem(getFriendLayout(Status::Online));
|
listLayout->removeItem(listLayout->friendLayouts[Online]);
|
||||||
if (top)
|
if (top)
|
||||||
{
|
{
|
||||||
mainLayout->addLayout(groupLayout);
|
listLayout->addLayout(listLayout->groupLayout);
|
||||||
mainLayout->addLayout(friendLayouts[Online]);
|
listLayout->addLayout(listLayout->friendLayouts[Online]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
mainLayout->addLayout(friendLayouts[Online]);
|
listLayout->addLayout(listLayout->friendLayouts[Online]);
|
||||||
mainLayout->addLayout(groupLayout);
|
listLayout->addLayout(listLayout->groupLayout);
|
||||||
}
|
}
|
||||||
mainLayout->addLayout(circleLayout);
|
listLayout->addLayout(circleLayout);
|
||||||
}
|
}
|
||||||
|
|
||||||
QList<GenericChatroomWidget*> FriendListWidget::getAllFriends()
|
QList<GenericChatroomWidget*> FriendListWidget::getAllFriends()
|
||||||
{
|
{
|
||||||
QList<GenericChatroomWidget*> friends;
|
QList<GenericChatroomWidget*> friends;
|
||||||
|
|
||||||
for (int i = 0; i < mainLayout->count(); ++i)
|
for (int i = 0; i < listLayout->count(); ++i)
|
||||||
{
|
{
|
||||||
QLayout* subLayout = mainLayout->itemAt(i)->layout();
|
QLayout* subLayout = listLayout->itemAt(i)->layout();
|
||||||
|
|
||||||
if(!subLayout)
|
if(!subLayout)
|
||||||
continue;
|
continue;
|
||||||
|
@ -163,33 +137,17 @@ QList<GenericChatroomWidget*> FriendListWidget::getAllFriends()
|
||||||
return friends;
|
return friends;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FriendListWidget::moveWidget(QWidget *w, Status s)
|
void FriendListWidget::moveWidget(FriendWidget *w, Status s, bool add)
|
||||||
{
|
{
|
||||||
QVBoxLayout* l = getFriendLayout(s);
|
CircleWidget *circleWidget = dynamic_cast<CircleWidget*>(w->parent());
|
||||||
l->removeWidget(w); // In case the widget is already in this layout.
|
|
||||||
Friend* g = FriendList::findFriend(dynamic_cast<FriendWidget*>(w)->friendId);
|
|
||||||
|
|
||||||
// Binary search.
|
if (circleWidget == nullptr || add)
|
||||||
int min = 0, max = l->count(), mid;
|
|
||||||
while (min < max)
|
|
||||||
{
|
{
|
||||||
mid = (max - min) / 2 + min;
|
listLayout->addFriendWidget(w, s);
|
||||||
FriendWidget* w1 = dynamic_cast<FriendWidget*>(l->itemAt(mid)->widget());
|
return;
|
||||||
assert(w1 != nullptr);
|
|
||||||
|
|
||||||
Friend* f = FriendList::findFriend(w1->friendId);
|
|
||||||
int compareValue = f->getDisplayedName().localeAwareCompare(g->getDisplayedName());
|
|
||||||
if (compareValue > 0)
|
|
||||||
{
|
|
||||||
max = mid;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
min = mid + 1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
l->insertWidget(min, w);
|
circleWidget->addFriendWidget(w, s);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update widget after add/delete/hide/show
|
// update widget after add/delete/hide/show
|
||||||
|
|
|
@ -46,6 +46,8 @@ public:
|
||||||
|
|
||||||
void addCircleWidget(CircleWidget *widget);
|
void addCircleWidget(CircleWidget *widget);
|
||||||
|
|
||||||
|
void searchChatrooms(const QString &searchString, bool hideOnline = false, bool hideOffline = false, bool hideGroups = false);
|
||||||
|
|
||||||
void hideFriends(QString searchString, Status status, bool hideAll = false);
|
void hideFriends(QString searchString, Status status, bool hideAll = false);
|
||||||
QList<GenericChatroomWidget*> getAllFriends();
|
QList<GenericChatroomWidget*> getAllFriends();
|
||||||
|
|
||||||
|
@ -63,6 +65,7 @@ private:
|
||||||
Offline = 1
|
Offline = 1
|
||||||
};
|
};
|
||||||
FriendListLayout *listLayout;
|
FriendListLayout *listLayout;
|
||||||
|
QVBoxLayout *circleLayout;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // FRIENDLISTWIDGET_H
|
#endif // FRIENDLISTWIDGET_H
|
||||||
|
|
|
@ -151,6 +151,14 @@ void GroupWidget::dragEnterEvent(QDragEnterEvent *ev)
|
||||||
{
|
{
|
||||||
if (ev->mimeData()->hasFormat("friend"))
|
if (ev->mimeData()->hasFormat("friend"))
|
||||||
ev->acceptProposedAction();
|
ev->acceptProposedAction();
|
||||||
|
setAttribute(Qt::WA_UnderMouse, true); // Simulate hover.
|
||||||
|
Style::repolish(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void GroupWidget::dragLeaveEvent(QDragLeaveEvent *)
|
||||||
|
{
|
||||||
|
setAttribute(Qt::WA_UnderMouse, false);
|
||||||
|
Style::repolish(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupWidget::dropEvent(QDropEvent *ev)
|
void GroupWidget::dropEvent(QDropEvent *ev)
|
||||||
|
@ -159,6 +167,9 @@ void GroupWidget::dropEvent(QDropEvent *ev)
|
||||||
{
|
{
|
||||||
int friendId = ev->mimeData()->data("friend").toInt();
|
int friendId = ev->mimeData()->data("friend").toInt();
|
||||||
Core::getInstance()->groupInviteFriend(friendId, groupId);
|
Core::getInstance()->groupInviteFriend(friendId, groupId);
|
||||||
|
|
||||||
|
setAttribute(Qt::WA_UnderMouse, false);
|
||||||
|
Style::repolish(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,10 @@ signals:
|
||||||
protected:
|
protected:
|
||||||
// drag & drop
|
// drag & drop
|
||||||
virtual void dragEnterEvent(QDragEnterEvent* ev) final override;
|
virtual void dragEnterEvent(QDragEnterEvent* ev) final override;
|
||||||
|
virtual void dragLeaveEvent(QDragLeaveEvent* ev);
|
||||||
virtual void dropEvent(QDropEvent* ev) final override;
|
virtual void dropEvent(QDropEvent* ev) final override;
|
||||||
|
virtual void keyPressEvent(QKeyEvent* ev);
|
||||||
|
virtual void keyReleaseEvent(QKeyEvent* ev);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int groupId;
|
int groupId;
|
||||||
|
|
|
@ -1388,34 +1388,19 @@ void Widget::searchContacts()
|
||||||
switch(filter)
|
switch(filter)
|
||||||
{
|
{
|
||||||
case FilterCriteria::All:
|
case FilterCriteria::All:
|
||||||
contactListWidget->hideFriends(searchString, Status::Online);
|
contactListWidget->searchChatrooms(searchString, false, false, false);
|
||||||
contactListWidget->hideFriends(searchString, Status::Offline);
|
|
||||||
|
|
||||||
contactListWidget->hideGroups(searchString);
|
|
||||||
break;
|
break;
|
||||||
case FilterCriteria::Online:
|
case FilterCriteria::Online:
|
||||||
contactListWidget->hideFriends(searchString, Status::Online);
|
contactListWidget->searchChatrooms(searchString, false, true, false);
|
||||||
contactListWidget->hideFriends(QString(), Status::Offline, true);
|
|
||||||
|
|
||||||
contactListWidget->hideGroups(searchString);
|
|
||||||
break;
|
break;
|
||||||
case FilterCriteria::Offline:
|
case FilterCriteria::Offline:
|
||||||
contactListWidget->hideFriends(QString(), Status::Online, true);
|
contactListWidget->searchChatrooms(searchString, true, false, true);
|
||||||
contactListWidget->hideFriends(searchString, Status::Offline);
|
|
||||||
|
|
||||||
contactListWidget->hideGroups(QString(), true);
|
|
||||||
break;
|
break;
|
||||||
case FilterCriteria::Friends:
|
case FilterCriteria::Friends:
|
||||||
contactListWidget->hideFriends(searchString, Status::Online);
|
contactListWidget->searchChatrooms(searchString, false, false, true);
|
||||||
contactListWidget->hideFriends(searchString, Status::Offline);
|
|
||||||
|
|
||||||
contactListWidget->hideGroups(QString(), true);
|
|
||||||
break;
|
break;
|
||||||
case FilterCriteria::Groups:
|
case FilterCriteria::Groups:
|
||||||
contactListWidget->hideFriends(QString(), Status::Online, true);
|
contactListWidget->searchChatrooms(searchString, true, true, false);
|
||||||
contactListWidget->hideFriends(QString(), Status::Offline, true);
|
|
||||||
|
|
||||||
contactListWidget->hideGroups(searchString);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user