From d2c0301103d860d9bc6ae2bda558f65fe552a883 Mon Sep 17 00:00:00 2001 From: TheSpiritXIII Date: Thu, 25 Jun 2015 11:55:06 -0400 Subject: [PATCH] Circles: Fix circle color on theme change, remove debugging stuff Conflicts: res.qrc --- res.qrc | 1 - src/persistence/settings.cpp | 4 +++- src/widget/categorywidget.cpp | 3 +-- src/widget/friendwidget.cpp | 1 - src/widget/tool/croppinglabel.cpp | 27 +----------------------- src/widget/tool/croppinglabel.h | 1 - src/widget/widget.cpp | 1 + ui/chatroomWidgets/circleWidget.css | 31 ---------------------------- ui/friendList/friendList.css | 32 +++++++++++++++++++++++++++++ 9 files changed, 38 insertions(+), 63 deletions(-) delete mode 100644 ui/chatroomWidgets/circleWidget.css diff --git a/res.qrc b/res.qrc index 2dcc10a75..bcd04d50b 100644 --- a/res.qrc +++ b/res.qrc @@ -118,6 +118,5 @@ ui/volButton/volButtonDisabled.png img/login_logo.svg ui/notificationEdge/notificationEdge.css - ui/chatroomWidgets/circleWidget.css diff --git a/src/persistence/settings.cpp b/src/persistence/settings.cpp index 7e30eaffb..c409f49d7 100644 --- a/src/persistence/settings.cpp +++ b/src/persistence/settings.cpp @@ -296,7 +296,9 @@ void Settings::loadPersonnal(Profile* profile) fp.alias = ps.value("alias").toString(); fp.autoAcceptDir = ps.value("autoAcceptDir").toString(); 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; } diff --git a/src/widget/categorywidget.cpp b/src/widget/categorywidget.cpp index e6fb9056b..3964a1bce 100644 --- a/src/widget/categorywidget.cpp +++ b/src/widget/categorywidget.cpp @@ -38,8 +38,6 @@ void emitChatroomWidget(QLayout* layout, int index) CategoryWidget::CategoryWidget(QWidget* parent) : GenericChatItemWidget(parent) { - setStyleSheet(Style::getStylesheet(":/ui/chatroomWidgets/circleWidget.css")); - container = new QWidget(this); container->setObjectName("circleWidgetContainer"); container->setLayoutDirection(Qt::LeftToRight); @@ -127,6 +125,7 @@ void CategoryWidget::addFriendWidget(FriendWidget* w, Status s) listLayout->addFriendWidget(w, s); updateStatus(); onAddFriendWidget(w); + w->reloadTheme(); // Otherwise theme will change when moving to another circle. } void CategoryWidget::removeFriendWidget(FriendWidget* w, Status s) diff --git a/src/widget/friendwidget.cpp b/src/widget/friendwidget.cpp index 6e0fc2734..cf4a7ce8a 100644 --- a/src/widget/friendwidget.cpp +++ b/src/widget/friendwidget.cpp @@ -183,7 +183,6 @@ void FriendWidget::contextMenuEvent(QContextMenuEvent * event) friendList->addCircleWidget(this); else Settings::getInstance().setFriendCircleID(id, Settings::getInstance().addCircle()); - } else if (groupActions.contains(selectedItem)) { diff --git a/src/widget/tool/croppinglabel.cpp b/src/widget/tool/croppinglabel.cpp index 3afdc35eb..7eb6b3a00 100644 --- a/src/widget/tool/croppinglabel.cpp +++ b/src/widget/tool/croppinglabel.cpp @@ -21,17 +21,6 @@ #include #include -class LineEdit : public QLineEdit -{ -public: - LineEdit(QWidget* parent = 0) : QLineEdit(parent) {} -protected: - void focusOutEvent(QFocusEvent *) - { - emit editingFinished(); - } -}; - CroppingLabel::CroppingLabel(QWidget* parent) : QLabel(parent) , blockPaintEvents(false) @@ -46,23 +35,8 @@ CroppingLabel::CroppingLabel(QWidget* parent) | Qt::ImhNoPredictiveText | Qt::ImhPreferLatin); - installEventFilter(this); - textEdit->installEventFilter(this); - connect(textEdit, &QLineEdit::editingFinished, this, &CroppingLabel::editingFinished); } -#include -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() { @@ -146,6 +120,7 @@ void CroppingLabel::showTextEdit() textEdit->show(); textEdit->setFocus(); textEdit->setText(origText); + textEdit->setFocusPolicy(Qt::ClickFocus); } QString CroppingLabel::fullText() diff --git a/src/widget/tool/croppinglabel.h b/src/widget/tool/croppinglabel.h index 503e0569f..6a731f662 100644 --- a/src/widget/tool/croppinglabel.h +++ b/src/widget/tool/croppinglabel.h @@ -29,7 +29,6 @@ class CroppingLabel : public QLabel Q_OBJECT public: explicit CroppingLabel(QWidget* parent = 0); - bool eventFilter(QObject *, QEvent *) override; void editBegin(); void setEditable(bool editable); diff --git a/src/widget/widget.cpp b/src/widget/widget.cpp index a547c4ce3..fa9b15e61 100644 --- a/src/widget/widget.cpp +++ b/src/widget/widget.cpp @@ -1415,6 +1415,7 @@ void Widget::reloadTheme() ui->statusHead->setStyleSheet(statusPanelStyle); ui->friendList->setStyleSheet(Style::getStylesheet(":ui/friendList/friendList.css")); ui->statusButton->setStyleSheet(Style::getStylesheet(":ui/statusButton/statusButton.css")); + contactListWidget->reDraw(); for (Friend* f : FriendList::getAllFriends()) f->getFriendWidget()->reloadTheme(); diff --git a/ui/chatroomWidgets/circleWidget.css b/ui/chatroomWidgets/circleWidget.css deleted file mode 100644 index 100211dcc..000000000 --- a/ui/chatroomWidgets/circleWidget.css +++ /dev/null @@ -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; -} diff --git a/ui/friendList/friendList.css b/ui/friendList/friendList.css index 2cf285908..a3465b63c 100644 --- a/ui/friendList/friendList.css +++ b/ui/friendList/friendList.css @@ -30,3 +30,35 @@ QScrollBar:sub-line:vertical {height: 0px;subcontrol-position: top;subcontrol-or QScrollBar:add-page:vertical, QScrollBar::sub-page:vertical { 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; +}