mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Minor code cleanup for circles and related
This commit is contained in:
parent
8e796a1d8b
commit
cc9edf6f90
|
@ -51,12 +51,11 @@ CircleWidget::CircleWidget(FriendListWidget *parent, int id_)
|
|||
container->setLayoutDirection(Qt::LeftToRight);
|
||||
|
||||
// status text
|
||||
statusLabel = new QLabel("0 / 0", this);
|
||||
statusLabel = new QLabel(this);
|
||||
statusLabel->setObjectName("status");
|
||||
statusLabel->setTextFormat(Qt::PlainText);
|
||||
|
||||
arrowLabel = new QLabel(this);
|
||||
arrowLabel->setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg"));
|
||||
statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg"));
|
||||
|
||||
fullLayout = new QVBoxLayout(this);
|
||||
fullLayout->setSpacing(0);
|
||||
|
@ -109,6 +108,8 @@ CircleWidget::CircleWidget(FriendListWidget *parent, int id_)
|
|||
renameCircle();
|
||||
|
||||
setExpanded(Settings::getInstance().getCircleExpanded(id));
|
||||
|
||||
updateStatus();
|
||||
}
|
||||
|
||||
void CircleWidget::addFriendWidget(FriendWidget *w, Status s)
|
||||
|
@ -124,11 +125,11 @@ void CircleWidget::setExpanded(bool isExpanded)
|
|||
listWidget->setVisible(isExpanded);
|
||||
if (isExpanded)
|
||||
{
|
||||
arrowLabel->setPixmap(QPixmap(":/ui/chatArea/scrollBarDownArrow.svg"));
|
||||
statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarDownArrow.svg"));
|
||||
}
|
||||
else
|
||||
{
|
||||
arrowLabel->setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg"));
|
||||
statusPic.setPixmap(QPixmap(":/ui/chatArea/scrollBarRightArrow.svg"));
|
||||
}
|
||||
|
||||
Settings::getInstance().setCircleExpanded(id, isExpanded);
|
||||
|
@ -286,7 +287,7 @@ void CircleWidget::onCompactChanged(bool _compact)
|
|||
container->setLayout(topLayout);
|
||||
|
||||
topLayout->addSpacing(18);
|
||||
topLayout->addWidget(arrowLabel);
|
||||
topLayout->addWidget(&statusPic);
|
||||
topLayout->addSpacing(5);
|
||||
topLayout->addWidget(nameLabel, 100);
|
||||
topLayout->addWidget(lineFrame, 1);
|
||||
|
@ -306,7 +307,7 @@ void CircleWidget::onCompactChanged(bool _compact)
|
|||
container->setFixedHeight(55);
|
||||
container->setLayout(mainLayout);
|
||||
|
||||
topLayout->addWidget(arrowLabel);
|
||||
topLayout->addWidget(&statusPic);
|
||||
topLayout->addSpacing(10);
|
||||
topLayout->addWidget(nameLabel, 1);
|
||||
topLayout->addSpacing(5);
|
||||
|
@ -405,7 +406,7 @@ void CircleWidget::updateStatus()
|
|||
void CircleWidget::updateID(int index)
|
||||
{
|
||||
// For when a circle gets destroyed, another takes its id.
|
||||
// This function updates all friends widgets.
|
||||
// This function updates all friends widgets for this new id.
|
||||
id = index;
|
||||
circleList[id] = this;
|
||||
|
||||
|
|
|
@ -72,7 +72,6 @@ private:
|
|||
FriendListLayout* listLayout;
|
||||
QVBoxLayout* fullLayout;
|
||||
QVBoxLayout* mainLayout = nullptr;
|
||||
QLabel* arrowLabel;
|
||||
QLabel* statusLabel;
|
||||
QFrame* lineFrame;
|
||||
QWidget* container;
|
||||
|
|
|
@ -25,15 +25,13 @@
|
|||
#include "friendwidget.h"
|
||||
#include "groupwidget.h"
|
||||
#include "circlewidget.h"
|
||||
#include "widget.h"
|
||||
#include <QGridLayout>
|
||||
#include <QMimeData>
|
||||
#include <QDragEnterEvent>
|
||||
#include <QDragLeaveEvent>
|
||||
#include <cassert>
|
||||
|
||||
#include <QDebug>
|
||||
#include "widget.h"
|
||||
|
||||
FriendListWidget::FriendListWidget(Widget* parent, bool groupsOnTop)
|
||||
: QWidget(parent)
|
||||
, groupsOnTop(groupsOnTop)
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
#include "src/group.h"
|
||||
#include "src/grouplist.h"
|
||||
#include "groupwidget.h"
|
||||
#include "circlewidget.h"
|
||||
#include "friendlistwidget.h"
|
||||
#include "src/friendlist.h"
|
||||
#include "src/friend.h"
|
||||
#include "src/core/core.h"
|
||||
|
@ -37,9 +39,6 @@
|
|||
#include <QFileDialog>
|
||||
#include <QDebug>
|
||||
#include <QInputDialog>
|
||||
|
||||
#include "circlewidget.h"
|
||||
#include "friendlistwidget.h"
|
||||
#include <cassert>
|
||||
|
||||
FriendWidget::FriendWidget(int FriendId, QString id)
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
#define GENERICCHATITEMWIDGET_H
|
||||
|
||||
#include <QFrame>
|
||||
#include <QLabel>
|
||||
|
||||
class CroppingLabel;
|
||||
|
||||
|
@ -43,6 +44,7 @@ public:
|
|||
|
||||
protected:
|
||||
CroppingLabel* nameLabel;
|
||||
QLabel statusPic;
|
||||
|
||||
private:
|
||||
bool compact;
|
||||
|
|
|
@ -39,11 +39,6 @@ GenericChatroomWidget::GenericChatroomWidget(QWidget *parent)
|
|||
statusMessageLabel->setTextFormat(Qt::PlainText);
|
||||
statusMessageLabel->setForegroundRole(QPalette::WindowText);
|
||||
|
||||
// name text
|
||||
nameLabel = new CroppingLabel(this);
|
||||
nameLabel->setTextFormat(Qt::PlainText);
|
||||
nameLabel->setForegroundRole(QPalette::WindowText);*/
|
||||
|
||||
setAutoFillBackground(true);
|
||||
reloadTheme();
|
||||
setCompact(compact);
|
||||
|
|
|
@ -76,7 +76,6 @@ protected:
|
|||
QHBoxLayout* mainLayout = nullptr;
|
||||
QVBoxLayout* textLayout = nullptr;
|
||||
MaskablePixmapWidget* avatar;
|
||||
QLabel statusPic;
|
||||
CroppingLabel* statusMessageLabel;
|
||||
bool compact, active;
|
||||
};
|
||||
|
|
|
@ -581,7 +581,6 @@ void Widget::reloadHistory()
|
|||
|
||||
void Widget::addFriend(int friendId, const QString &userId)
|
||||
{
|
||||
qDebug() << "ADDING FRIEND ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;";
|
||||
ToxId userToxId = ToxId(userId);
|
||||
Friend* newfriend = FriendList::addFriend(friendId, userToxId);
|
||||
contactListWidget->addFriendWidget(newfriend->getFriendWidget(),Status::Offline,Settings::getInstance().getFriendCircleID(newfriend->getToxId()));
|
||||
|
|
Loading…
Reference in New Issue
Block a user