Merge branch 'theme'

This commit is contained in:
Konstantinos Sideris 2017-11-22 19:09:19 +02:00
commit 929b2df6fb
29 changed files with 326 additions and 95 deletions

View file

@ -38,6 +38,19 @@ struct DescInfo
class RoomInfoListItem : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor highlightedBackgroundColor READ highlightedBackgroundColor WRITE
setHighlightedBackgroundColor)
Q_PROPERTY(
QColor hoverBackgroundColor READ hoverBackgroundColor WRITE setHoverBackgroundColor)
Q_PROPERTY(QColor backgroundColor READ backgroundColor WRITE setBackgroundColor)
Q_PROPERTY(QColor titleColor READ titleColor WRITE setTitleColor)
Q_PROPERTY(QColor subtitleColor READ subtitleColor WRITE setSubtitleColor)
Q_PROPERTY(
QColor highlightedTitleColor READ highlightedTitleColor WRITE setHighlightedTitleColor)
Q_PROPERTY(QColor highlightedSubtitleColor READ highlightedSubtitleColor WRITE
setHighlightedSubtitleColor)
public:
RoomInfoListItem(QSharedPointer<RoomSettings> settings,
@ -51,13 +64,39 @@ public:
void clearUnreadMessageCount();
void setState(const RoomState &state);
bool isPressed() const { return isPressed_; };
RoomState state() const { return state_; };
int unreadMessageCount() const { return unreadMsgCount_; };
bool isPressed() const { return isPressed_; }
RoomState state() const { return state_; }
int unreadMessageCount() const { return unreadMsgCount_; }
void setAvatar(const QImage &avatar_image);
void setDescriptionMessage(const DescInfo &info);
inline QColor highlightedBackgroundColor() const { return highlightedBackgroundColor_; }
inline QColor hoverBackgroundColor() const { return hoverBackgroundColor_; }
inline QColor backgroundColor() const { return backgroundColor_; }
inline QColor highlightedTitleColor() const { return highlightedTitleColor_; }
inline QColor highlightedSubtitleColor() const { return highlightedSubtitleColor_; }
inline QColor titleColor() const { return titleColor_; }
inline QColor subtitleColor() const { return subtitleColor_; }
inline void setHighlightedBackgroundColor(QColor &color)
{
highlightedBackgroundColor_ = color;
}
inline void setHoverBackgroundColor(QColor &color) { hoverBackgroundColor_ = color; }
inline void setBackgroundColor(QColor &color) { backgroundColor_ = color; }
inline void setHighlightedTitleColor(QColor &color) { highlightedTitleColor_ = color; }
inline void setHighlightedSubtitleColor(QColor &color)
{
highlightedSubtitleColor_ = color;
}
inline void setTitleColor(QColor &color) { titleColor_ = color; }
inline void setSubtitleColor(QColor &color) { subtitleColor_ = color; }
signals:
void clicked(const QString &room_id);
void leaveRoom(const QString &room_id);
@ -98,4 +137,14 @@ private:
int maxHeight_;
int unreadMsgCount_ = 0;
QColor highlightedBackgroundColor_;
QColor hoverBackgroundColor_;
QColor backgroundColor_;
QColor highlightedTitleColor_;
QColor highlightedSubtitleColor_;
QColor titleColor_;
QColor subtitleColor_;
};

View file

@ -76,7 +76,7 @@ public:
public slots:
void openFileSelection();
void hideUploadSpinner();
void focusLineEdit() { input_->setFocus(); };
void focusLineEdit() { input_->setFocus(); }
private slots:
void addSelectedEmoji(const QString &emoji);
@ -91,7 +91,8 @@ signals:
void stoppedTyping();
protected:
void focusInEvent(QFocusEvent *event);
void focusInEvent(QFocusEvent *event) override;
void paintEvent(QPaintEvent *) override;
private:
void showUploadSpinner();

View file

@ -19,6 +19,9 @@
#include <QHBoxLayout>
#include <QLabel>
#include <QPainter>
#include <QStyle>
#include <QStyleOption>
#include "Emote.h"
#include "Image.h"
@ -67,6 +70,9 @@ public:
~TimelineItem();
protected:
void paintEvent(QPaintEvent *event) override;
private:
void init();

View file

@ -21,6 +21,8 @@
#include <QList>
#include <QQueue>
#include <QScrollArea>
#include <QStyle>
#include <QStyleOption>
#include "Emote.h"
#include "Image.h"
@ -110,7 +112,7 @@ public slots:
void addBackwardsEvents(const QString &room_id, const RoomMessages &msgs);
// Whether or not the initial batch has been loaded.
bool hasLoaded() { return scroll_layout_->count() > 1 || isTimelineFinished; };
bool hasLoaded() { return scroll_layout_->count() > 1 || isTimelineFinished; }
void handleFailedMessage(int txnid);
@ -120,6 +122,9 @@ private slots:
signals:
void updateLastTimelineMessage(const QString &user, const DescInfo &info);
protected:
void paintEvent(QPaintEvent *event) override;
private:
void init();
void addTimelineItem(TimelineItem *item, TimelineDirection direction);
@ -133,7 +138,7 @@ private:
bool isPendingMessage(const QString &txnid, const QString &sender, const QString &userid);
void removePendingMessage(const QString &txnid);
bool isDuplicate(const QString &event_id) { return eventIds_.contains(event_id); };
bool isDuplicate(const QString &event_id) { return eventIds_.contains(event_id); }
void handleNewUserMessage(PendingMessage msg);

View file

@ -34,7 +34,7 @@ class Menu;
class OverlayModal;
class RoomSettings;
static const QString URL_HTML = "<a href=\"\\1\" style=\"color: #333333\">\\1</a>";
static const QString URL_HTML = "<a href=\"\\1\">\\1</a>";
static const QRegExp URL_REGEX("((?:https?|ftp)://\\S+)");
class TopRoomBar : public QWidget

View file

@ -44,6 +44,7 @@ signals:
protected:
void resizeEvent(QResizeEvent *event) override;
void paintEvent(QPaintEvent *event) override;
private slots:
void closeLogoutDialog(bool isLoggingOut);

View file

@ -9,6 +9,7 @@
class LoadingIndicator : public QWidget
{
Q_OBJECT
Q_PROPERTY(QColor color READ color WRITE setColor)
public:
LoadingIndicator(QWidget *parent = 0);

View file

@ -1,6 +1,8 @@
#pragma once
#include <QEvent>
#include <QPainter>
#include <QStyleOption>
#include <QWidget>
class OverlayWidget : public QWidget
@ -15,4 +17,5 @@ protected:
bool eventFilter(QObject *obj, QEvent *event) override;
QRect overlayGeometry() const;
void paintEvent(QPaintEvent *event) override;
};