1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

style(ipc, widgets, genericcharitemlayout): Small style changes

This commit is contained in:
Polshakov Dmitry 2016-04-19 15:06:06 +03:00 committed by Diadlo
parent 27faec918a
commit 2143e21e89
No known key found for this signature in database
GPG Key ID: 5AF9F2E29107C727
5 changed files with 25 additions and 20 deletions

View File

@ -281,7 +281,9 @@ void IPC::processEvents()
evt->processed = time(0);
}
else
{
evt->processed = time(0);
}
}
}
@ -293,5 +295,5 @@ void IPC::processEvents()
IPC::IPCMemory *IPC::global()
{
return (IPCMemory*)globalMemory.data();
return static_cast<IPCMemory*>(globalMemory.data());
}

View File

@ -28,7 +28,7 @@
#include <QApplication>
void emitChatroomWidget(QLayout* layout, int index)
void CategoryWidget::emitChatroomWidget(QLayout* layout, int index)
{
GenericChatroomWidget* chatWidget = dynamic_cast<GenericChatroomWidget*>(layout->itemAt(index)->widget());
if (chatWidget != nullptr)
@ -83,11 +83,12 @@ void CategoryWidget::setExpanded(bool isExpanded, bool save)
setMouseTracking(true);
listWidget->setVisible(isExpanded);
QString pixmapPath;
if (isExpanded)
statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarDownArrow.svg"));
pixmapPath = ":/ui/chatArea/scrollBarDownArrow.svg";
else
statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg"));
pixmapPath = ":/ui/chatArea/scrollBarRightArrow.svg";
statusPic.setPixmap(QPixmap(pixmapPath));
// The listWidget will recieve a enterEvent for some reason if now visible.
// Using the following, we prevent that.
QApplication::processEvents(QEventLoop::ExcludeSocketNotifiers);
@ -199,19 +200,17 @@ bool CategoryWidget::cycleContacts(FriendWidget* activeChatroomWidget, bool forw
QLayout* currentLayout = nullptr;
FriendWidget* friendWidget = dynamic_cast<FriendWidget*>(activeChatroomWidget);
if (friendWidget != nullptr)
{
currentLayout = listLayout->getLayoutOnline();
index = listLayout->indexOfFriendWidget(friendWidget, true);
if (index == -1)
{
currentLayout = listLayout->getLayoutOffline();
index = listLayout->indexOfFriendWidget(friendWidget, false);
}
}
else
if (friendWidget == nullptr)
return false;
currentLayout = listLayout->getLayoutOnline();
index = listLayout->indexOfFriendWidget(friendWidget, true);
if (index == -1)
{
currentLayout = listLayout->getLayoutOffline();
index = listLayout->indexOfFriendWidget(friendWidget, false);
}
index += forward ? 1 : -1;
for (;;)
{

View File

@ -60,6 +60,7 @@ protected:
QLayout* friendOnlineLayout() const;
QLayout* friendOfflineLayout() const;
void moveFriendWidgets(FriendListWidget* friendList);
void emitChatroomWidget(QLayout *layout, int index);
private:
virtual void onSetName() {}

View File

@ -99,10 +99,10 @@ QLayout* GenericChatItemLayout::getLayout() const
int GenericChatItemLayout::indexOfClosestSortedWidget(GenericChatItemWidget* widget) const
{
// Binary search: Deferred test of equality.
int min = 0, max = layout->count(), mid;
int min = 0, max = layout->count();
while (min < max)
{
mid = (max - min) / 2 + min;
int mid = (max - min) / 2 + min;
GenericChatItemWidget* atMid = dynamic_cast<GenericChatItemWidget*>(layout->itemAt(mid)->widget());
assert(atMid != nullptr);

View File

@ -29,10 +29,13 @@ GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
: GenericChatItemWidget(parent), active{false}
{
// avatar
QSize size;
if (isCompact())
avatar = new MaskablePixmapWidget(this, QSize(20,20), ":/img/avatar_mask.svg");
size = QSize(20,20);
else
avatar = new MaskablePixmapWidget(this, QSize(40,40), ":/img/avatar_mask.svg");
size = QSize(40,40);
avatar = new MaskablePixmapWidget(this, size, ":/img/avatar_mask.svg");
// status text
statusMessageLabel = new CroppingLabel(this);