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

Circles: Fix circle color on theme change, remove debugging stuff

Conflicts:
	res.qrc
This commit is contained in:
TheSpiritXIII 2015-06-25 11:55:06 -04:00 committed by tux3
parent b6df8ce34a
commit d2c0301103
9 changed files with 38 additions and 63 deletions

View File

@ -118,6 +118,5 @@
<file>ui/volButton/volButtonDisabled.png</file> <file>ui/volButton/volButtonDisabled.png</file>
<file>img/login_logo.svg</file> <file>img/login_logo.svg</file>
<file>ui/notificationEdge/notificationEdge.css</file> <file>ui/notificationEdge/notificationEdge.css</file>
<file>ui/chatroomWidgets/circleWidget.css</file>
</qresource> </qresource>
</RCC> </RCC>

View File

@ -296,7 +296,9 @@ void Settings::loadPersonnal(Profile* profile)
fp.alias = ps.value("alias").toString(); fp.alias = ps.value("alias").toString();
fp.autoAcceptDir = ps.value("autoAcceptDir").toString(); fp.autoAcceptDir = ps.value("autoAcceptDir").toString();
fp.circleID = ps.value("circle", -1).toInt(); fp.circleID = ps.value("circle", -1).toInt();
fp.activity = ps.value("activity", QDate()).toDate();
if (getEnableLogging())
fp.activity = ps.value("activity", QDate()).toDate();
friendLst[ToxId(fp.addr).publicKey] = fp; friendLst[ToxId(fp.addr).publicKey] = fp;
} }

View File

@ -38,8 +38,6 @@ void emitChatroomWidget(QLayout* layout, int index)
CategoryWidget::CategoryWidget(QWidget* parent) CategoryWidget::CategoryWidget(QWidget* parent)
: GenericChatItemWidget(parent) : GenericChatItemWidget(parent)
{ {
setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/circleWidget.css"));
container = new QWidget(this); container = new QWidget(this);
container->setObjectName("circleWidgetContainer"); container->setObjectName("circleWidgetContainer");
container->setLayoutDirection(Qt::LeftToRight); container->setLayoutDirection(Qt::LeftToRight);
@ -127,6 +125,7 @@ void CategoryWidget::addFriendWidget(FriendWidget* w, Status s)
listLayout->addFriendWidget(w, s); listLayout->addFriendWidget(w, s);
updateStatus(); updateStatus();
onAddFriendWidget(w); onAddFriendWidget(w);
w->reloadTheme(); // Otherwise theme will change when moving to another circle.
} }
void CategoryWidget::removeFriendWidget(FriendWidget* w, Status s) void CategoryWidget::removeFriendWidget(FriendWidget* w, Status s)

View File

@ -183,7 +183,6 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event)
friendList->addCircleWidget(this); friendList->addCircleWidget(this);
else else
Settings::getInstance().setFriendCircleID(id, Settings::getInstance().addCircle()); Settings::getInstance().setFriendCircleID(id, Settings::getInstance().addCircle());
} }
else if (groupActions.contains(selectedItem)) else if (groupActions.contains(selectedItem))
{ {

View File

@ -21,17 +21,6 @@
#include <QResizeEvent> #include <QResizeEvent>
#include <QLineEdit> #include <QLineEdit>
class LineEdit : public QLineEdit
{
public:
LineEdit(QWidget* parent = 0) : QLineEdit(parent) {}
protected:
void focusOutEvent(QFocusEvent *)
{
emit editingFinished();
}
};
CroppingLabel::CroppingLabel(QWidget* parent) CroppingLabel::CroppingLabel(QWidget* parent)
: QLabel(parent) : QLabel(parent)
, blockPaintEvents(false) , blockPaintEvents(false)
@ -46,23 +35,8 @@ CroppingLabel::CroppingLabel(QWidget* parent)
| Qt::ImhNoPredictiveText | Qt::ImhNoPredictiveText
| Qt::ImhPreferLatin); | Qt::ImhPreferLatin);
installEventFilter(this);
textEdit->installEventFilter(this);
connect(textEdit, &QLineEdit::editingFinished, this, &CroppingLabel::editingFinished); connect(textEdit, &QLineEdit::editingFinished, this, &CroppingLabel::editingFinished);
} }
#include <QDebug>
bool CroppingLabel::eventFilter(QObject *, QEvent *event)
{
if (event->type() == QEvent::FocusOut)
{
qDebug() << "Focus out changed!";
textEdit->clearFocus();
emit editingFinished();
return true;
}
return false;
}
void CroppingLabel::editBegin() void CroppingLabel::editBegin()
{ {
@ -146,6 +120,7 @@ void CroppingLabel::showTextEdit()
textEdit->show(); textEdit->show();
textEdit->setFocus(); textEdit->setFocus();
textEdit->setText(origText); textEdit->setText(origText);
textEdit->setFocusPolicy(Qt::ClickFocus);
} }
QString CroppingLabel::fullText() QString CroppingLabel::fullText()

View File

@ -29,7 +29,6 @@ class CroppingLabel : public QLabel
Q_OBJECT Q_OBJECT
public: public:
explicit CroppingLabel(QWidget* parent = 0); explicit CroppingLabel(QWidget* parent = 0);
bool eventFilter(QObject *, QEvent *) override;
void editBegin(); void editBegin();
void setEditable(bool editable); void setEditable(bool editable);

View File

@ -1415,6 +1415,7 @@ void Widget::reloadTheme()
ui->statusHead->setStyleSheet(statusPanelStyle); ui->statusHead->setStyleSheet(statusPanelStyle);
ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css")); ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css"));
ui->statusButton->setStyleSheet(Style::getStylesheet(":ui/statusButton/statusButton.css")); ui->statusButton->setStyleSheet(Style::getStylesheet(":ui/statusButton/statusButton.css"));
contactListWidget->reDraw();
for (Friend* f : FriendList::getAllFriends()) for (Friend* f : FriendList::getAllFriends())
f->getFriendWidget()->reloadTheme(); f->getFriendWidget()->reloadTheme();

View File

@ -1,31 +0,0 @@
QWidget#circleWidgetContainer > QFrame#line
{
color: white;
}
QWidget#circleWidgetContainer
{
background-color: @themeMedium;
}
QWidget#circleWidgetContainer:hover
{
background-color: @themeLight;
}
QWidget#circleWidgetContainer QLineEdit
{
background-color: @themeLight;
}
QWidget#circleWidgetContainer > QLabel#status
{
font: @small;
color: @lightGrey;
}
QWidget#circleWidgetContainer > QLabel#name
{
font: @big;
color: @white;
}

View File

@ -30,3 +30,35 @@ QScrollBar:sub-line:vertical {height: 0px;subcontrol-position: top;subcontrol-or
QScrollBar:add-page:vertical, QScrollBar::sub-page:vertical { QScrollBar:add-page:vertical, QScrollBar::sub-page:vertical {
background: none; background: none;
} }
QWidget#circleWidgetContainer > QFrame#line
{
color: white;
}
QWidget#circleWidgetContainer
{
background-color: @themeMedium;
}
QWidget#circleWidgetContainer:hover
{
background-color: @themeLight;
}
QWidget#circleWidgetContainer QLineEdit
{
background-color: @themeLight;
}
QWidget#circleWidgetContainer > QLabel#status
{
font: @small;
color: @lightGrey;
}
QWidget#circleWidgetContainer > QLabel#name
{
font: @big;
color: @white;
}