mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Circles: Fix convention, crash and activity cycling
This commit is contained in:
parent
858b005567
commit
d9d6f20bf7
138
qtox.pro
138
qtox.pro
|
@ -108,9 +108,9 @@ contains(HIGH_DPI, YES) {
|
|||
}
|
||||
|
||||
contains(JENKINS,YES) {
|
||||
INCLUDEPATH += ./libs/include/
|
||||
INCLUDEPATH += ./libs/include/
|
||||
} else {
|
||||
INCLUDEPATH += libs/include
|
||||
INCLUDEPATH += libs/include
|
||||
}
|
||||
|
||||
contains(DEFINES, QTOX_FILTER_AUDIO) {
|
||||
|
@ -133,8 +133,8 @@ contains(DEFINES, QTOX_PLATFORM_EXT) {
|
|||
# Rules for Windows, Mac OSX, and Linux
|
||||
win32 {
|
||||
RC_FILE = windows/qtox.rc
|
||||
LIBS += -L$$PWD/libs/lib -ltoxav -ltoxcore -ltoxencryptsave -ltoxdns -lsodium -lvpx -lpthread
|
||||
LIBS += -L$$PWD/libs/lib -lavformat -lavdevice -lavcodec -lavutil -lswscale -lOpenAL32 -lopus
|
||||
LIBS += -L$$PWD/libs/lib -ltoxav -ltoxcore -ltoxencryptsave -ltoxdns -lsodium -lvpx -lpthread
|
||||
LIBS += -L$$PWD/libs/lib -lavformat -lavdevice -lavcodec -lavutil -lswscale -lOpenAL32 -lopus
|
||||
LIBS += -lopengl32 -lole32 -loleaut32 -lvfw32 -lws2_32 -liphlpapi -lz -luuid
|
||||
LIBS += -lqrencode
|
||||
LIBS += -lstrmiids # For DirectShow
|
||||
|
@ -200,31 +200,31 @@ win32 {
|
|||
# The systray Unity backend implements the system tray icon on Unity (Ubuntu) and GNOME desktops.
|
||||
unix:!macx:!android {
|
||||
contains(ENABLE_SYSTRAY_UNITY_BACKEND, YES) {
|
||||
DEFINES += ENABLE_SYSTRAY_UNITY_BACKEND
|
||||
DEFINES += ENABLE_SYSTRAY_UNITY_BACKEND
|
||||
|
||||
INCLUDEPATH += "/usr/include/glib-2.0"
|
||||
INCLUDEPATH += "/usr/include/gtk-2.0"
|
||||
INCLUDEPATH += "/usr/include/atk-1.0"
|
||||
INCLUDEPATH += "/usr/include/cairo"
|
||||
INCLUDEPATH += "/usr/include/ffmpeg"
|
||||
INCLUDEPATH += "/usr/include/gdk-pixbuf-2.0"
|
||||
INCLUDEPATH += "/usr/include/libappindicator-0.1"
|
||||
INCLUDEPATH += "/usr/include/libdbusmenu-glib-0.4"
|
||||
INCLUDEPATH += "/usr/include/pango-1.0"
|
||||
equals(QT_ARCH, x86_64) {
|
||||
INCLUDEPATH += "/usr/lib64/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib64/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
else {
|
||||
INCLUDEPATH += "/usr/lib/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
INCLUDEPATH += "/usr/include/glib-2.0"
|
||||
INCLUDEPATH += "/usr/include/gtk-2.0"
|
||||
INCLUDEPATH += "/usr/include/atk-1.0"
|
||||
INCLUDEPATH += "/usr/include/cairo"
|
||||
INCLUDEPATH += "/usr/include/ffmpeg"
|
||||
INCLUDEPATH += "/usr/include/gdk-pixbuf-2.0"
|
||||
INCLUDEPATH += "/usr/include/libappindicator-0.1"
|
||||
INCLUDEPATH += "/usr/include/libdbusmenu-glib-0.4"
|
||||
INCLUDEPATH += "/usr/include/pango-1.0"
|
||||
equals(QT_ARCH, x86_64) {
|
||||
INCLUDEPATH += "/usr/lib64/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib64/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
else {
|
||||
INCLUDEPATH += "/usr/lib/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
|
||||
LIBS += -lgobject-2.0 -lappindicator -lgtk-x11-2.0
|
||||
LIBS += -lgobject-2.0 -lappindicator -lgtk-x11-2.0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -232,30 +232,30 @@ contains(ENABLE_SYSTRAY_UNITY_BACKEND, YES) {
|
|||
unix:!macx:!android {
|
||||
contains(ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND, NO) {
|
||||
} else {
|
||||
DEFINES += ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND
|
||||
DEFINES += ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND
|
||||
|
||||
INCLUDEPATH += "/usr/include/glib-2.0"
|
||||
INCLUDEPATH += "/usr/include/gtk-2.0"
|
||||
INCLUDEPATH += "/usr/include/atk-1.0"
|
||||
INCLUDEPATH += "/usr/include/cairo"
|
||||
INCLUDEPATH += "/usr/include/ffmpeg"
|
||||
INCLUDEPATH += "/usr/include/gdk-pixbuf-2.0"
|
||||
INCLUDEPATH += "/usr/include/pango-1.0"
|
||||
equals(QT_ARCH, x86_64) {
|
||||
INCLUDEPATH += "/usr/lib64/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib64/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
else {
|
||||
INCLUDEPATH += "/usr/lib/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
INCLUDEPATH += "/usr/include/glib-2.0"
|
||||
INCLUDEPATH += "/usr/include/gtk-2.0"
|
||||
INCLUDEPATH += "/usr/include/atk-1.0"
|
||||
INCLUDEPATH += "/usr/include/cairo"
|
||||
INCLUDEPATH += "/usr/include/ffmpeg"
|
||||
INCLUDEPATH += "/usr/include/gdk-pixbuf-2.0"
|
||||
INCLUDEPATH += "/usr/include/pango-1.0"
|
||||
equals(QT_ARCH, x86_64) {
|
||||
INCLUDEPATH += "/usr/lib64/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib64/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
else {
|
||||
INCLUDEPATH += "/usr/lib/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
|
||||
|
||||
LIBS += -lglib-2.0 -lgdk_pixbuf-2.0 -lgio-2.0 -lcairo -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0
|
||||
LIBS += -lglib-2.0 -lgdk_pixbuf-2.0 -lgio-2.0 -lcairo -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0
|
||||
|
||||
SOURCES += src/platform/statusnotifier/closures.c \
|
||||
src/platform/statusnotifier/enums.c \
|
||||
|
@ -272,29 +272,29 @@ contains(ENABLE_SYSTRAY_STATUSNOTIFIER_BACKEND, NO) {
|
|||
unix:!macx:!android {
|
||||
contains(ENABLE_SYSTRAY_GTK_BACKEND, NO) {
|
||||
} else {
|
||||
DEFINES += ENABLE_SYSTRAY_GTK_BACKEND
|
||||
DEFINES += ENABLE_SYSTRAY_GTK_BACKEND
|
||||
|
||||
INCLUDEPATH += "/usr/include/glib-2.0"
|
||||
INCLUDEPATH += "/usr/include/gtk-2.0"
|
||||
INCLUDEPATH += "/usr/include/atk-1.0"
|
||||
INCLUDEPATH += "/usr/include/gdk-pixbuf-2.0"
|
||||
INCLUDEPATH += "/usr/include/cairo"
|
||||
INCLUDEPATH += "/usr/include/pango-1.0"
|
||||
equals(QT_ARCH, x86_64) {
|
||||
INCLUDEPATH += "/usr/lib64/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib64/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
else {
|
||||
INCLUDEPATH += "/usr/lib/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
INCLUDEPATH += "/usr/include/glib-2.0"
|
||||
INCLUDEPATH += "/usr/include/gtk-2.0"
|
||||
INCLUDEPATH += "/usr/include/atk-1.0"
|
||||
INCLUDEPATH += "/usr/include/gdk-pixbuf-2.0"
|
||||
INCLUDEPATH += "/usr/include/cairo"
|
||||
INCLUDEPATH += "/usr/include/pango-1.0"
|
||||
equals(QT_ARCH, x86_64) {
|
||||
INCLUDEPATH += "/usr/lib64/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib64/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/x86_64-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
else {
|
||||
INCLUDEPATH += "/usr/lib/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/glib-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/gtk-2.0/include"
|
||||
INCLUDEPATH += "/usr/lib/i386-linux-gnu/gtk-2.0/include"
|
||||
}
|
||||
|
||||
|
||||
LIBS += -lglib-2.0 -lgdk_pixbuf-2.0 -lgio-2.0 -lcairo -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0
|
||||
LIBS += -lglib-2.0 -lgdk_pixbuf-2.0 -lgio-2.0 -lcairo -lgtk-x11-2.0 -lgdk-x11-2.0 -lgobject-2.0
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -535,5 +535,5 @@ HEADERS += \
|
|||
src/widget/circlewidget.h \
|
||||
src/widget/genericchatitemwidget.h \
|
||||
src/widget/friendlistlayout.h \
|
||||
src/widget/genericchatitemlayout.h \
|
||||
src/widget/genericchatitemlayout.h \
|
||||
src/widget/categorywidget.h
|
||||
|
|
|
@ -1022,7 +1022,7 @@ QSplitter:handle{
|
|||
<item>
|
||||
<widget class="QLineEdit" name="searchContactText">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Ignored" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -1032,7 +1032,7 @@ QSplitter:handle{
|
|||
<item>
|
||||
<widget class="QToolButton" name="searchContactFilterBox">
|
||||
<property name="sizePolicy">
|
||||
<sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred">
|
||||
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
|
||||
<horstretch>0</horstretch>
|
||||
<verstretch>0</verstretch>
|
||||
</sizepolicy>
|
||||
|
@ -1047,7 +1047,7 @@ QSplitter:handle{
|
|||
<enum>Qt::ToolButtonTextBesideIcon</enum>
|
||||
</property>
|
||||
<property name="arrowType">
|
||||
<enum>Qt::DownArrow</enum>
|
||||
<enum>Qt::NoArrow</enum>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1084,7 +1084,7 @@ QSplitter:handle{
|
|||
<rect>
|
||||
<x>0</x>
|
||||
<y>0</y>
|
||||
<width>292</width>
|
||||
<width>284</width>
|
||||
<height>353</height>
|
||||
</rect>
|
||||
</property>
|
||||
|
|
|
@ -1302,7 +1302,9 @@ void Settings::setFriendCircleID(const ToxId &id, int circleID)
|
|||
QString key = id.publicKey;
|
||||
auto it = friendLst.find(key);
|
||||
if (it != friendLst.end())
|
||||
{
|
||||
it->circleID = circleID;
|
||||
}
|
||||
else
|
||||
{
|
||||
friendProp fp;
|
||||
|
@ -1329,7 +1331,9 @@ void Settings::setFriendActivity(const ToxId &id, const QDate &activity)
|
|||
QString key = id.publicKey;
|
||||
auto it = friendLst.find(key);
|
||||
if (it != friendLst.end())
|
||||
{
|
||||
it->activity = activity;
|
||||
}
|
||||
else
|
||||
{
|
||||
friendProp fp;
|
||||
|
|
|
@ -71,8 +71,10 @@ void CircleWidget::editName()
|
|||
CircleWidget* CircleWidget::getFromID(int id)
|
||||
{
|
||||
auto circleIt = circleList.find(id);
|
||||
|
||||
if (circleIt != circleList.end())
|
||||
return circleIt.value();
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -84,7 +86,9 @@ void CircleWidget::contextMenuEvent(QContextMenuEvent* event)
|
|||
|
||||
QAction* selectedItem = menu.exec(mapToGlobal(event->pos()));
|
||||
if (selectedItem == renameAction)
|
||||
{
|
||||
editName();
|
||||
}
|
||||
else if (selectedItem == removeAction)
|
||||
{
|
||||
FriendListWidget* friendList = static_cast<FriendListWidget*>(parentWidget());
|
||||
|
@ -106,6 +110,7 @@ void CircleWidget::dragEnterEvent(QDragEnterEvent* event)
|
|||
{
|
||||
if (event->mimeData()->hasFormat("friend"))
|
||||
event->acceptProposedAction();
|
||||
|
||||
setContainerAttribute(Qt::WA_UnderMouse, true); // Simulate hover.
|
||||
}
|
||||
|
||||
|
@ -169,17 +174,15 @@ void CircleWidget::updateID(int index)
|
|||
for (int i = 0; i < friendOnlineLayout()->count(); ++i)
|
||||
{
|
||||
FriendWidget* friendWidget = dynamic_cast<FriendWidget*>(friendOnlineLayout()->itemAt(i));
|
||||
|
||||
if (friendWidget != nullptr)
|
||||
{
|
||||
Settings::getInstance().setFriendCircleID(FriendList::findFriend(friendWidget->friendId)->getToxId(), id);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < friendOfflineLayout()->count(); ++i)
|
||||
{
|
||||
FriendWidget* friendWidget = dynamic_cast<FriendWidget*>(friendOfflineLayout()->itemAt(i));
|
||||
|
||||
if (friendWidget != nullptr)
|
||||
{
|
||||
Settings::getInstance().setFriendCircleID(FriendList::findFriend(friendWidget->friendId)->getToxId(), id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,13 @@ void FriendListLayout::addFriendWidget(FriendWidget* w, Status s)
|
|||
{
|
||||
friendOfflineLayout.removeSortedWidget(w);
|
||||
friendOnlineLayout.removeSortedWidget(w);
|
||||
|
||||
if (s == Status::Offline)
|
||||
{
|
||||
friendOfflineLayout.addSortedWidget(w);
|
||||
return;
|
||||
}
|
||||
|
||||
friendOnlineLayout.addSortedWidget(w);
|
||||
}
|
||||
|
||||
|
|
|
@ -58,22 +58,27 @@ Time getTime(const QDate date)
|
|||
return Never;
|
||||
|
||||
QDate today = QDate::currentDate();
|
||||
|
||||
if (date == today)
|
||||
return Today;
|
||||
|
||||
today = today.addDays(-1);
|
||||
|
||||
if (date == today)
|
||||
return Yesterday;
|
||||
|
||||
today = today.addDays(-6);
|
||||
|
||||
if (date >= today)
|
||||
return ThisWeek;
|
||||
|
||||
today = today.addDays(-today.day() + 1); // Go to the beginning of the month.
|
||||
|
||||
if (last7DaysWasLastMonth())
|
||||
{
|
||||
if (date >= today)
|
||||
return ThisMonth;
|
||||
|
||||
today = today.addMonths(-1);
|
||||
}
|
||||
|
||||
|
@ -81,18 +86,22 @@ Time getTime(const QDate date)
|
|||
return Month1Ago;
|
||||
|
||||
today = today.addMonths(-1);
|
||||
|
||||
if (date >= today)
|
||||
return Month2Ago;
|
||||
|
||||
today = today.addMonths(-1);
|
||||
|
||||
if (date >= today)
|
||||
return Month3Ago;
|
||||
|
||||
today = today.addMonths(-1);
|
||||
|
||||
if (date >= today)
|
||||
return Month4Ago;
|
||||
|
||||
today = today.addMonths(-1);
|
||||
|
||||
if (date >= today)
|
||||
return Month5Ago;
|
||||
|
||||
|
@ -162,9 +171,7 @@ void FriendListWidget::setMode(Mode mode)
|
|||
circleLayout->getLayout()->setMargin(0);
|
||||
|
||||
for (int i = 0; i < Settings::getInstance().getCircleCount(); ++i)
|
||||
{
|
||||
addCircleWidget(i);
|
||||
}
|
||||
|
||||
QList<Friend*> friendList = FriendList::getAllFriends();
|
||||
for (Friend* contact : friendList)
|
||||
|
@ -366,10 +373,13 @@ void FriendListWidget::searchChatrooms(const QString &searchString, bool hideOnl
|
|||
{
|
||||
groupLayout.search(searchString, hideGroups);
|
||||
listLayout->searchChatrooms(searchString, hideOnline, hideOffline);
|
||||
for (int i = 0; i != circleLayout->getLayout()->count(); ++i)
|
||||
if (circleLayout != nullptr)
|
||||
{
|
||||
CircleWidget* circleWidget = static_cast<CircleWidget*>(circleLayout->getLayout()->itemAt(i)->widget());
|
||||
circleWidget->search(searchString, true, hideOnline, hideOffline);
|
||||
for (int i = 0; i != circleLayout->getLayout()->count(); ++i)
|
||||
{
|
||||
CircleWidget* circleWidget = static_cast<CircleWidget*>(circleLayout->getLayout()->itemAt(i)->widget());
|
||||
circleWidget->search(searchString, true, hideOnline, hideOffline);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -409,13 +419,58 @@ void FriendListWidget::cycleContacts(GenericChatroomWidget* activeChatroomWidget
|
|||
if (activeChatroomWidget == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
int index = -1;
|
||||
QLayout* currentLayout = nullptr;
|
||||
|
||||
CircleWidget* circleWidget = nullptr;
|
||||
FriendWidget* friendWidget = dynamic_cast<FriendWidget*>(activeChatroomWidget);
|
||||
|
||||
if (mode == Activity)
|
||||
{
|
||||
if (friendWidget == nullptr)
|
||||
return;
|
||||
|
||||
QDate activityDate = Settings::getInstance().getFriendActivity(FriendList::findFriend(friendWidget->friendId)->getToxId());
|
||||
index = getTime(activityDate);
|
||||
CategoryWidget* categoryWidget = dynamic_cast<CategoryWidget*>(activityLayout->itemAt(index)->widget());
|
||||
|
||||
if (categoryWidget == nullptr || categoryWidget->cycleContacts(friendWidget, forward))
|
||||
return;
|
||||
|
||||
index += forward ? 1 : -1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
// Bounds checking.
|
||||
if (index < Today)
|
||||
{
|
||||
index = Never;
|
||||
continue;
|
||||
}
|
||||
else if (index > Never)
|
||||
{
|
||||
index = Today;
|
||||
continue;
|
||||
}
|
||||
|
||||
CategoryWidget* categoryWidget = dynamic_cast<CategoryWidget*>(activityLayout->itemAt(index)->widget());
|
||||
|
||||
if (categoryWidget != nullptr)
|
||||
{
|
||||
if (!categoryWidget->cycleContacts(forward))
|
||||
{
|
||||
// Skip empty or finished categories.
|
||||
index += forward ? 1 : -1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
QLayout* currentLayout = nullptr;
|
||||
CircleWidget* circleWidget = nullptr;
|
||||
|
||||
if (friendWidget != nullptr)
|
||||
{
|
||||
circleWidget = CircleWidget::getFromID(Settings::getInstance().getFriendCircleID(FriendList::findFriend(friendWidget->friendId)->getToxId()));
|
||||
|
@ -453,6 +508,7 @@ void FriendListWidget::cycleContacts(GenericChatroomWidget* activeChatroomWidget
|
|||
}
|
||||
|
||||
index += forward ? 1 : -1;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
// Bounds checking.
|
||||
|
@ -473,8 +529,10 @@ void FriendListWidget::cycleContacts(GenericChatroomWidget* activeChatroomWidget
|
|||
if (currentLayout == listLayout->getLayoutOnline() || currentLayout == listLayout->getLayoutOffline() || currentLayout == groupLayout.getLayout())
|
||||
{
|
||||
GenericChatroomWidget* chatWidget = dynamic_cast<GenericChatroomWidget*>(currentLayout->itemAt(index)->widget());
|
||||
|
||||
if (chatWidget != nullptr)
|
||||
emit chatWidget->chatroomWidgetClicked(chatWidget);
|
||||
|
||||
return;
|
||||
}
|
||||
else if (currentLayout == circleLayout->getLayout())
|
||||
|
@ -547,6 +605,7 @@ void FriendListWidget::moveWidget(FriendWidget* w, Status s, bool add)
|
|||
{
|
||||
if (circleId != -1)
|
||||
Settings::getInstance().setFriendCircleID(FriendList::findFriend(w->friendId)->getToxId(), -1);
|
||||
|
||||
listLayout->addFriendWidget(w, s);
|
||||
return;
|
||||
}
|
||||
|
@ -603,12 +662,14 @@ QLayout* FriendListWidget::nextLayout(QLayout* layout, bool forward) const
|
|||
{
|
||||
if (groupsOnTop)
|
||||
return listLayout->getLayoutOnline();
|
||||
|
||||
return listLayout->getLayoutOffline();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (groupsOnTop)
|
||||
return circleLayout->getLayout();
|
||||
|
||||
return listLayout->getLayoutOnline();
|
||||
}
|
||||
}
|
||||
|
@ -618,12 +679,14 @@ QLayout* FriendListWidget::nextLayout(QLayout* layout, bool forward) const
|
|||
{
|
||||
if (groupsOnTop)
|
||||
return listLayout->getLayoutOffline();
|
||||
|
||||
return groupLayout.getLayout();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (groupsOnTop)
|
||||
return groupLayout.getLayout();
|
||||
|
||||
return circleLayout->getLayout();
|
||||
}
|
||||
}
|
||||
|
@ -633,6 +696,7 @@ QLayout* FriendListWidget::nextLayout(QLayout* layout, bool forward) const
|
|||
return circleLayout->getLayout();
|
||||
else if (groupsOnTop)
|
||||
return listLayout->getLayoutOnline();
|
||||
|
||||
return groupLayout.getLayout();
|
||||
}
|
||||
else if (layout == circleLayout->getLayout())
|
||||
|
@ -641,6 +705,7 @@ QLayout* FriendListWidget::nextLayout(QLayout* layout, bool forward) const
|
|||
{
|
||||
if (groupsOnTop)
|
||||
return groupLayout.getLayout();
|
||||
|
||||
return listLayout->getLayoutOnline();
|
||||
}
|
||||
else
|
||||
|
|
|
@ -96,8 +96,10 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
|
|||
circleMenu = menu.addMenu(tr("Move to circle...", "Menu to move a friend into a different circle"));
|
||||
|
||||
newCircleAction = circleMenu->addAction(tr("To new circle"));
|
||||
|
||||
if (circleId != -1)
|
||||
removeCircleAction = circleMenu->addAction(tr("Remove from circle '%1'").arg(Settings::getInstance().getCircleName(circleId)));
|
||||
|
||||
circleMenu->addSeparator();
|
||||
|
||||
for (int i = 0; i < Settings::getInstance().getCircleCount(); ++i)
|
||||
|
|
|
@ -44,6 +44,7 @@ int GenericChatItemLayout::indexOfSortedWidget(GenericChatItemWidget* widget) co
|
|||
return -1;
|
||||
|
||||
int index = indexOfClosestSortedWidget(widget);
|
||||
|
||||
if (index >= layout->count())
|
||||
return -1;
|
||||
|
||||
|
@ -52,6 +53,7 @@ int GenericChatItemLayout::indexOfSortedWidget(GenericChatItemWidget* widget) co
|
|||
|
||||
if (atMid == widget)
|
||||
return index;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -64,6 +66,7 @@ void GenericChatItemLayout::removeSortedWidget(GenericChatItemWidget* widget)
|
|||
{
|
||||
if (layout->isEmpty())
|
||||
return;
|
||||
|
||||
int index = indexOfClosestSortedWidget(widget);
|
||||
|
||||
if (layout->itemAt(index) == nullptr)
|
||||
|
@ -104,6 +107,7 @@ int GenericChatItemLayout::indexOfClosestSortedWidget(GenericChatItemWidget* wid
|
|||
|
||||
bool lessThan = false;
|
||||
int compareValue = atMid->getName().localeAwareCompare(widget->getName());
|
||||
|
||||
if (compareValue < 0)
|
||||
lessThan = true;
|
||||
else if (compareValue == 0)
|
||||
|
|
|
@ -137,10 +137,9 @@ void CroppingLabel::minimizeMaximumWidth()
|
|||
void CroppingLabel::editingFinished()
|
||||
{
|
||||
QString newText = textEdit->text().trimmed().remove(QRegExp("[\\t\\n\\v\\f\\r\\x0000]"));
|
||||
|
||||
if (origText != newText)
|
||||
{
|
||||
emit editFinished(textEdit->text());
|
||||
}
|
||||
|
||||
textEdit->hide();
|
||||
blockPaintEvents = false;
|
||||
|
|
|
@ -1412,12 +1412,12 @@ void Widget::reloadTheme()
|
|||
|
||||
void Widget::nextContact()
|
||||
{
|
||||
cycleContacts(1);
|
||||
cycleContacts(true);
|
||||
}
|
||||
|
||||
void Widget::previousContact()
|
||||
{
|
||||
cycleContacts(-1);
|
||||
cycleContacts(false);
|
||||
}
|
||||
|
||||
QString Widget::getStatusIconPath(Status status)
|
||||
|
|
Loading…
Reference in New Issue
Block a user