mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
Merge pull request #5934
TriKriSta (5): fix(ui): implement and connect reloadTheme in leaf classes refactor: delete classes that were used to reload theme refactor: save friendScroll as a class member refactor: reorder of includes fix: clear custom style before update style
This commit is contained in:
commit
4fab6faea6
|
@ -22,6 +22,7 @@
|
||||||
#include "chatlinecontentproxy.h"
|
#include "chatlinecontentproxy.h"
|
||||||
#include "chatmessage.h"
|
#include "chatmessage.h"
|
||||||
#include "content/filetransferwidget.h"
|
#include "content/filetransferwidget.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include "src/widget/translator.h"
|
#include "src/widget/translator.h"
|
||||||
#include "src/widget/style.h"
|
#include "src/widget/style.h"
|
||||||
|
|
||||||
|
@ -121,6 +122,9 @@ ChatLog::ChatLog(QWidget* parent)
|
||||||
copySelectedText(true);
|
copySelectedText(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &ChatLog::reloadTheme);
|
||||||
|
|
||||||
|
reloadTheme();
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
Translator::registerHandler(std::bind(&ChatLog::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&ChatLog::retranslateUi, this), this);
|
||||||
}
|
}
|
||||||
|
@ -718,6 +722,7 @@ void ChatLog::fontChanged(const QFont& font)
|
||||||
|
|
||||||
void ChatLog::reloadTheme()
|
void ChatLog::reloadTheme()
|
||||||
{
|
{
|
||||||
|
setStyleSheet(Style::getStylesheet("chatArea/chatArea.css"));
|
||||||
setBackgroundBrush(QBrush(Style::getColor(Style::GroundBase), Qt::SolidPattern));
|
setBackgroundBrush(QBrush(Style::getColor(Style::GroundBase), Qt::SolidPattern));
|
||||||
selectionRectColor = Style::getColor(Style::SelectText);
|
selectionRectColor = Style::getColor(Style::SelectText);
|
||||||
selGraphItem->setBrush(QBrush(selectionRectColor));
|
selGraphItem->setBrush(QBrush(selectionRectColor));
|
||||||
|
|
|
@ -56,7 +56,6 @@ public:
|
||||||
void scrollToLine(ChatLine::Ptr line);
|
void scrollToLine(ChatLine::Ptr line);
|
||||||
void selectAll();
|
void selectAll();
|
||||||
void fontChanged(const QFont& font);
|
void fontChanged(const QFont& font);
|
||||||
void reloadTheme();
|
|
||||||
void removeFirsts(const int num);
|
void removeFirsts(const int num);
|
||||||
void removeLasts(const int num);
|
void removeLasts(const int num);
|
||||||
void setScroll(const bool scroll);
|
void setScroll(const bool scroll);
|
||||||
|
@ -83,6 +82,7 @@ signals:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void forceRelayout();
|
void forceRelayout();
|
||||||
|
void reloadTheme();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onSelectionTimerTimeout();
|
void onSelectionTimerTimeout();
|
||||||
|
|
|
@ -90,6 +90,8 @@ FileTransferWidget::FileTransferWidget(QWidget* parent, CoreFile& _coreFile, Tox
|
||||||
connect(ui->previewButton, &QPushButton::clicked, this,
|
connect(ui->previewButton, &QPushButton::clicked, this,
|
||||||
&FileTransferWidget::onPreviewButtonClicked);
|
&FileTransferWidget::onPreviewButtonClicked);
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &FileTransferWidget::reloadTheme);
|
||||||
|
|
||||||
// Set lastStatus to anything but the file's current value, this forces an update
|
// Set lastStatus to anything but the file's current value, this forces an update
|
||||||
lastStatus = file.status == ToxFile::FINISHED ? ToxFile::INITIALIZING : ToxFile::FINISHED;
|
lastStatus = file.status == ToxFile::FINISHED ? ToxFile::INITIALIZING : ToxFile::FINISHED;
|
||||||
updateWidget(file);
|
updateWidget(file);
|
||||||
|
@ -227,6 +229,11 @@ void FileTransferWidget::paintEvent(QPaintEvent*)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileTransferWidget::reloadTheme()
|
||||||
|
{
|
||||||
|
updateBackgroundColor(lastStatus);
|
||||||
|
}
|
||||||
|
|
||||||
QString FileTransferWidget::getHumanReadableSize(qint64 size)
|
QString FileTransferWidget::getHumanReadableSize(qint64 size)
|
||||||
{
|
{
|
||||||
static const char* suffix[] = {"B", "KiB", "MiB", "GiB", "TiB"};
|
static const char* suffix[] = {"B", "KiB", "MiB", "GiB", "TiB"};
|
||||||
|
@ -245,23 +252,7 @@ void FileTransferWidget::updateWidgetColor(ToxFile const& file)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (file.status) {
|
updateBackgroundColor(file.status);
|
||||||
case ToxFile::INITIALIZING:
|
|
||||||
case ToxFile::PAUSED:
|
|
||||||
case ToxFile::TRANSMITTING:
|
|
||||||
setBackgroundColor(Style::getColor(Style::TransferMiddle), false);
|
|
||||||
break;
|
|
||||||
case ToxFile::BROKEN:
|
|
||||||
case ToxFile::CANCELED:
|
|
||||||
setBackgroundColor(Style::getColor(Style::TransferBad), true);
|
|
||||||
break;
|
|
||||||
case ToxFile::FINISHED:
|
|
||||||
setBackgroundColor(Style::getColor(Style::TransferGood), true);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qCritical() << "Invalid file status";
|
|
||||||
assert(false);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileTransferWidget::updateWidgetText(ToxFile const& file)
|
void FileTransferWidget::updateWidgetText(ToxFile const& file)
|
||||||
|
@ -623,3 +614,24 @@ void FileTransferWidget::updateWidget(ToxFile const& file)
|
||||||
update();
|
update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void FileTransferWidget::updateBackgroundColor(const ToxFile::FileStatus status)
|
||||||
|
{
|
||||||
|
switch (status) {
|
||||||
|
case ToxFile::INITIALIZING:
|
||||||
|
case ToxFile::PAUSED:
|
||||||
|
case ToxFile::TRANSMITTING:
|
||||||
|
setBackgroundColor(Style::getColor(Style::TransferMiddle), false);
|
||||||
|
break;
|
||||||
|
case ToxFile::BROKEN:
|
||||||
|
case ToxFile::CANCELED:
|
||||||
|
setBackgroundColor(Style::getColor(Style::TransferBad), true);
|
||||||
|
break;
|
||||||
|
case ToxFile::FINISHED:
|
||||||
|
setBackgroundColor(Style::getColor(Style::TransferGood), true);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
qCritical() << "Invalid file status";
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -64,6 +64,9 @@ protected:
|
||||||
|
|
||||||
void paintEvent(QPaintEvent*) final;
|
void paintEvent(QPaintEvent*) final;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void reloadTheme();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onLeftButtonClicked();
|
void onLeftButtonClicked();
|
||||||
void onRightButtonClicked();
|
void onRightButtonClicked();
|
||||||
|
@ -76,6 +79,7 @@ private:
|
||||||
static bool tryRemoveFile(const QString &filepath);
|
static bool tryRemoveFile(const QString &filepath);
|
||||||
|
|
||||||
void updateWidget(ToxFile const& file);
|
void updateWidget(ToxFile const& file);
|
||||||
|
void updateBackgroundColor(const ToxFile::FileStatus status);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CoreFile& coreFile;
|
CoreFile& coreFile;
|
||||||
|
|
|
@ -67,7 +67,9 @@ AboutFriendForm::AboutFriendForm(std::unique_ptr<IAboutFriend> _about, QWidget*
|
||||||
ui->statusMessage->setText(about->getStatusMessage());
|
ui->statusMessage->setText(about->getStatusMessage());
|
||||||
ui->avatar->setPixmap(about->getAvatar());
|
ui->avatar->setPixmap(about->getAvatar());
|
||||||
|
|
||||||
setStyleSheet(Style::getStylesheet("window/general.css"));
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &AboutFriendForm::reloadTheme);
|
||||||
|
|
||||||
|
reloadTheme();
|
||||||
}
|
}
|
||||||
|
|
||||||
static QString getAutoAcceptDir(const QString& dir)
|
static QString getAutoAcceptDir(const QString& dir)
|
||||||
|
@ -90,6 +92,11 @@ void AboutFriendForm::onAutoAcceptDirClicked()
|
||||||
about->setAutoAcceptDir(dir);
|
about->setAutoAcceptDir(dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AboutFriendForm::reloadTheme()
|
||||||
|
{
|
||||||
|
setStyleSheet(Style::getStylesheet("window/general.css"));
|
||||||
|
}
|
||||||
|
|
||||||
void AboutFriendForm::onAutoAcceptDirChanged(const QString& path)
|
void AboutFriendForm::onAutoAcceptDirChanged(const QString& path)
|
||||||
{
|
{
|
||||||
const bool enabled = !path.isNull();
|
const bool enabled = !path.isNull();
|
||||||
|
|
|
@ -45,6 +45,9 @@ private:
|
||||||
signals:
|
signals:
|
||||||
void histroyRemoved();
|
void histroyRemoved();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void reloadTheme();
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void onAutoAcceptDirChanged(const QString& path);
|
void onAutoAcceptDirChanged(const QString& path);
|
||||||
void onAcceptedClicked();
|
void onAcceptedClicked();
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "chatformheader.h"
|
#include "chatformheader.h"
|
||||||
|
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include "src/widget/maskablepixmapwidget.h"
|
#include "src/widget/maskablepixmapwidget.h"
|
||||||
#include "src/widget/style.h"
|
#include "src/widget/style.h"
|
||||||
#include "src/widget/tool/callconfirmwidget.h"
|
#include "src/widget/tool/callconfirmwidget.h"
|
||||||
|
@ -154,6 +155,8 @@ ChatFormHeader::ChatFormHeader(QWidget* parent)
|
||||||
|
|
||||||
updateButtonsView();
|
updateButtonsView();
|
||||||
Translator::registerHandler(std::bind(&ChatFormHeader::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&ChatFormHeader::retranslateUi, this), this);
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &ChatFormHeader::reloadTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
ChatFormHeader::~ChatFormHeader() = default;
|
ChatFormHeader::~ChatFormHeader() = default;
|
||||||
|
@ -283,6 +286,7 @@ QSize ChatFormHeader::getAvatarSize() const
|
||||||
|
|
||||||
void ChatFormHeader::reloadTheme()
|
void ChatFormHeader::reloadTheme()
|
||||||
{
|
{
|
||||||
|
setStyleSheet(Style::getStylesheet("chatArea/chatHead.css"));
|
||||||
callButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
callButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
||||||
videoButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
videoButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
||||||
volButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
volButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
||||||
|
|
|
@ -71,13 +71,14 @@ public:
|
||||||
void setAvatar(const QPixmap& img);
|
void setAvatar(const QPixmap& img);
|
||||||
QSize getAvatarSize() const;
|
QSize getAvatarSize() const;
|
||||||
|
|
||||||
void reloadTheme();
|
|
||||||
|
|
||||||
// TODO: Remove
|
// TODO: Remove
|
||||||
void addWidget(QWidget* widget, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
|
void addWidget(QWidget* widget, int stretch = 0, Qt::Alignment alignment = Qt::Alignment());
|
||||||
void addLayout(QLayout* layout);
|
void addLayout(QLayout* layout);
|
||||||
void addStretch();
|
void addStretch();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void reloadTheme();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void callTriggered();
|
void callTriggered();
|
||||||
void videoCallTriggered();
|
void videoCallTriggered();
|
||||||
|
|
|
@ -59,8 +59,7 @@ ContentDialog::ContentDialog(const Core &core, QWidget* parent)
|
||||||
, videoSurfaceSize(QSize())
|
, videoSurfaceSize(QSize())
|
||||||
, videoCount(0)
|
, videoCount(0)
|
||||||
{
|
{
|
||||||
const Settings& s = Settings::getInstance();
|
const Settings& s = Settings::getInstance();
|
||||||
setStyleSheet(Style::getStylesheet("contentDialog/contentDialog.css"));
|
|
||||||
|
|
||||||
friendLayout->setMargin(0);
|
friendLayout->setMargin(0);
|
||||||
friendLayout->setSpacing(0);
|
friendLayout->setSpacing(0);
|
||||||
|
@ -83,12 +82,11 @@ ContentDialog::ContentDialog(const Core &core, QWidget* parent)
|
||||||
|
|
||||||
onGroupchatPositionChanged(s.getGroupchatPosition());
|
onGroupchatPositionChanged(s.getGroupchatPosition());
|
||||||
|
|
||||||
QScrollArea* friendScroll = new QScrollArea(this);
|
friendScroll = new QScrollArea(this);
|
||||||
friendScroll->setMinimumWidth(minWidget);
|
friendScroll->setMinimumWidth(minWidget);
|
||||||
friendScroll->setFrameStyle(QFrame::NoFrame);
|
friendScroll->setFrameStyle(QFrame::NoFrame);
|
||||||
friendScroll->setLayoutDirection(Qt::RightToLeft);
|
friendScroll->setLayoutDirection(Qt::RightToLeft);
|
||||||
friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
friendScroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||||
friendScroll->setStyleSheet(Style::getStylesheet("friendList/friendList.css"));
|
|
||||||
friendScroll->setWidgetResizable(true);
|
friendScroll->setWidgetResizable(true);
|
||||||
friendScroll->setWidget(friendWidget);
|
friendScroll->setWidget(friendWidget);
|
||||||
|
|
||||||
|
@ -128,6 +126,8 @@ ContentDialog::ContentDialog(const Core &core, QWidget* parent)
|
||||||
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
|
reloadTheme();
|
||||||
|
|
||||||
new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close()));
|
new QShortcut(Qt::CTRL + Qt::Key_Q, this, SLOT(close()));
|
||||||
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(previousContact()));
|
new QShortcut(Qt::CTRL + Qt::SHIFT + Qt::Key_Tab, this, SLOT(previousContact()));
|
||||||
new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(nextContact()));
|
new QShortcut(Qt::CTRL + Qt::Key_Tab, this, SLOT(nextContact()));
|
||||||
|
@ -435,6 +435,12 @@ void ContentDialog::setUsername(const QString& newName)
|
||||||
updateTitleAndStatusIcon();
|
updateTitleAndStatusIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ContentDialog::reloadTheme()
|
||||||
|
{
|
||||||
|
setStyleSheet(Style::getStylesheet("contentDialog/contentDialog.css"));
|
||||||
|
friendScroll->setStyleSheet(Style::getStylesheet("friendList/friendList.css"));
|
||||||
|
}
|
||||||
|
|
||||||
bool ContentDialog::event(QEvent* event)
|
bool ContentDialog::event(QEvent* event)
|
||||||
{
|
{
|
||||||
switch (event->type()) {
|
switch (event->type()) {
|
||||||
|
|
|
@ -44,6 +44,7 @@ class GroupChatroom;
|
||||||
class GroupWidget;
|
class GroupWidget;
|
||||||
class QCloseEvent;
|
class QCloseEvent;
|
||||||
class QSplitter;
|
class QSplitter;
|
||||||
|
class QScrollArea;
|
||||||
|
|
||||||
class ContentDialog : public ActivateDialog, public IDialogs
|
class ContentDialog : public ActivateDialog, public IDialogs
|
||||||
{
|
{
|
||||||
|
@ -90,6 +91,7 @@ public slots:
|
||||||
void previousContact();
|
void previousContact();
|
||||||
void nextContact();
|
void nextContact();
|
||||||
void setUsername(const QString& newName);
|
void setUsername(const QString& newName);
|
||||||
|
void reloadTheme() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool event(QEvent* event) final;
|
bool event(QEvent* event) final;
|
||||||
|
@ -121,6 +123,7 @@ private:
|
||||||
private:
|
private:
|
||||||
QList<QLayout*> layouts;
|
QList<QLayout*> layouts;
|
||||||
QSplitter* splitter;
|
QSplitter* splitter;
|
||||||
|
QScrollArea* friendScroll;
|
||||||
FriendListLayout* friendLayout;
|
FriendListLayout* friendLayout;
|
||||||
GenericChatItemLayout groupLayout;
|
GenericChatItemLayout groupLayout;
|
||||||
ContentLayout* contentLayout;
|
ContentLayout* contentLayout;
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
#include "contentlayout.h"
|
#include "contentlayout.h"
|
||||||
#include "style.h"
|
#include "style.h"
|
||||||
#include "src/persistence/settings.h"
|
#include "src/persistence/settings.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include <QFrame>
|
#include <QFrame>
|
||||||
#include <QStyleFactory>
|
#include <QStyleFactory>
|
||||||
|
|
||||||
|
@ -118,6 +119,8 @@ void ContentLayout::init()
|
||||||
mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
mainContent->setStyle(QStyleFactory::create(Settings::getInstance().getStyle()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &ContentLayout::reloadTheme);
|
||||||
|
|
||||||
reloadTheme();
|
reloadTheme();
|
||||||
|
|
||||||
mainHLineLayout.addSpacing(4);
|
mainHLineLayout.addSpacing(4);
|
||||||
|
|
|
@ -29,7 +29,6 @@ public:
|
||||||
explicit ContentLayout(QWidget* parent);
|
explicit ContentLayout(QWidget* parent);
|
||||||
~ContentLayout();
|
~ContentLayout();
|
||||||
|
|
||||||
void reloadTheme();
|
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
QFrame mainHLine;
|
QFrame mainHLine;
|
||||||
|
@ -37,6 +36,9 @@ public:
|
||||||
QWidget* mainContent;
|
QWidget* mainContent;
|
||||||
QWidget* mainHead;
|
QWidget* mainHead;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void reloadTheme();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init();
|
void init();
|
||||||
};
|
};
|
||||||
|
|
|
@ -53,7 +53,6 @@ public:
|
||||||
void setFriendTyping(bool isTyping);
|
void setFriendTyping(bool isTyping);
|
||||||
|
|
||||||
void show(ContentLayout* contentLayout) final;
|
void show(ContentLayout* contentLayout) final;
|
||||||
void reloadTheme() final;
|
|
||||||
|
|
||||||
static const QString ACTION_PREFIX;
|
static const QString ACTION_PREFIX;
|
||||||
|
|
||||||
|
@ -76,6 +75,7 @@ public slots:
|
||||||
void clearChatArea();
|
void clearChatArea();
|
||||||
void onShowMessagesClicked();
|
void onShowMessagesClicked();
|
||||||
void onSplitterMoved(int pos, int index);
|
void onSplitterMoved(int pos, int index);
|
||||||
|
void reloadTheme() final;
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void updateFriendActivityForFile(const ToxFile& file);
|
void updateFriendActivityForFile(const ToxFile& file);
|
||||||
|
|
|
@ -36,6 +36,7 @@
|
||||||
#include "src/widget/contentlayout.h"
|
#include "src/widget/contentlayout.h"
|
||||||
#include "src/widget/emoticonswidget.h"
|
#include "src/widget/emoticonswidget.h"
|
||||||
#include "src/widget/form/chatform.h"
|
#include "src/widget/form/chatform.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include "src/widget/maskablepixmapwidget.h"
|
#include "src/widget/maskablepixmapwidget.h"
|
||||||
#include "src/widget/searchform.h"
|
#include "src/widget/searchform.h"
|
||||||
#include "src/widget/style.h"
|
#include "src/widget/style.h"
|
||||||
|
@ -335,6 +336,8 @@ GenericChatForm::GenericChatForm(const Core& _core, const Contact* contact, ICha
|
||||||
|
|
||||||
connect(msgEdit, &ChatTextEdit::enterPressed, this, &GenericChatForm::onSendTriggered);
|
connect(msgEdit, &ChatTextEdit::enterPressed, this, &GenericChatForm::onSendTriggered);
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &GenericChatForm::reloadTheme);
|
||||||
|
|
||||||
reloadTheme();
|
reloadTheme();
|
||||||
|
|
||||||
fileFlyout->setFixedSize(FILE_FLYOUT_SIZE);
|
fileFlyout->setFixedSize(FILE_FLYOUT_SIZE);
|
||||||
|
@ -414,12 +417,6 @@ void GenericChatForm::reloadTheme()
|
||||||
msgEdit->setStyleSheet(Style::getStylesheet("msgEdit/msgEdit.css")
|
msgEdit->setStyleSheet(Style::getStylesheet("msgEdit/msgEdit.css")
|
||||||
+ fontToCss(s.getChatMessageFont(), "QTextEdit"));
|
+ fontToCss(s.getChatMessageFont(), "QTextEdit"));
|
||||||
|
|
||||||
chatWidget->setStyleSheet(Style::getStylesheet("chatArea/chatArea.css"));
|
|
||||||
headWidget->setStyleSheet(Style::getStylesheet("chatArea/chatHead.css"));
|
|
||||||
chatWidget->reloadTheme();
|
|
||||||
headWidget->reloadTheme();
|
|
||||||
searchForm->reloadTheme();
|
|
||||||
|
|
||||||
emoteButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
emoteButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
||||||
fileButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
fileButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
||||||
screenshotButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
screenshotButton->setStyleSheet(Style::getStylesheet(STYLE_PATH));
|
||||||
|
|
|
@ -75,7 +75,6 @@ public:
|
||||||
|
|
||||||
void setName(const QString& newName);
|
void setName(const QString& newName);
|
||||||
virtual void show(ContentLayout* contentLayout);
|
virtual void show(ContentLayout* contentLayout);
|
||||||
virtual void reloadTheme();
|
|
||||||
|
|
||||||
void addSystemInfoMessage(const QString& message, ChatMessage::SystemMessageType type,
|
void addSystemInfoMessage(const QString& message, ChatMessage::SystemMessageType type,
|
||||||
const QDateTime& datetime);
|
const QDateTime& datetime);
|
||||||
|
@ -91,6 +90,7 @@ public slots:
|
||||||
void focusInput();
|
void focusInput();
|
||||||
void onChatMessageFontChanged(const QFont& font);
|
void onChatMessageFontChanged(const QFont& font);
|
||||||
void setColorizedNames(bool enable);
|
void setColorizedNames(bool enable);
|
||||||
|
virtual void reloadTheme();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void onChatContextMenuRequested(QPoint pos);
|
void onChatContextMenuRequested(QPoint pos);
|
||||||
|
|
|
@ -182,6 +182,11 @@ void AboutForm::onUpdateCheckFailed()
|
||||||
bodyUI->updateStack->setCurrentIndex(static_cast<int>(updateIndex::failed));
|
bodyUI->updateStack->setCurrentIndex(static_cast<int>(updateIndex::failed));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AboutForm::reloadTheme()
|
||||||
|
{
|
||||||
|
replaceVersions();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates hyperlink with specific style.
|
* @brief Creates hyperlink with specific style.
|
||||||
* @param path The URL of the page the link goes to.
|
* @param path The URL of the page the link goes to.
|
||||||
|
|
|
@ -47,6 +47,7 @@ public slots:
|
||||||
void onUpdateAvailable(QString latestVersion, QUrl link);
|
void onUpdateAvailable(QString latestVersion, QUrl link);
|
||||||
void onUpToDate();
|
void onUpToDate();
|
||||||
void onUpdateCheckFailed();
|
void onUpdateCheckFailed();
|
||||||
|
void reloadTheme() override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "genericsettings.h"
|
#include "genericsettings.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
|
|
||||||
#include <QCheckBox>
|
#include <QCheckBox>
|
||||||
#include <QComboBox>
|
#include <QComboBox>
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
GenericForm::GenericForm(const QPixmap& icon)
|
GenericForm::GenericForm(const QPixmap& icon)
|
||||||
: formIcon(icon)
|
: formIcon(icon)
|
||||||
{
|
{
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &GenericForm::reloadTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap GenericForm::getFormIcon()
|
QPixmap GenericForm::getFormIcon()
|
||||||
|
|
|
@ -33,6 +33,9 @@ public:
|
||||||
virtual QString getFormName() = 0;
|
virtual QString getFormName() = 0;
|
||||||
QPixmap getFormIcon();
|
QPixmap getFormIcon();
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void reloadTheme() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool eventFilter(QObject* o, QEvent* e) final;
|
bool eventFilter(QObject* o, QEvent* e) final;
|
||||||
void eventsInit();
|
void eventsInit();
|
||||||
|
|
|
@ -19,8 +19,8 @@
|
||||||
|
|
||||||
#include "genericchatitemwidget.h"
|
#include "genericchatitemwidget.h"
|
||||||
#include "src/persistence/settings.h"
|
#include "src/persistence/settings.h"
|
||||||
#include "src/widget/style.h"
|
|
||||||
#include "src/widget/tool/croppinglabel.h"
|
#include "src/widget/tool/croppinglabel.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
GenericChatItemWidget::GenericChatItemWidget(bool compact, QWidget* parent)
|
GenericChatItemWidget::GenericChatItemWidget(bool compact, QWidget* parent)
|
||||||
|
@ -32,6 +32,8 @@ GenericChatItemWidget::GenericChatItemWidget(bool compact, QWidget* parent)
|
||||||
nameLabel = new CroppingLabel(this);
|
nameLabel = new CroppingLabel(this);
|
||||||
nameLabel->setObjectName("name");
|
nameLabel->setObjectName("name");
|
||||||
nameLabel->setTextFormat(Qt::PlainText);
|
nameLabel->setTextFormat(Qt::PlainText);
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &GenericChatItemWidget::reloadTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GenericChatItemWidget::isCompact() const
|
bool GenericChatItemWidget::isCompact() const
|
||||||
|
|
|
@ -46,6 +46,9 @@ public:
|
||||||
|
|
||||||
Q_PROPERTY(bool compact READ isCompact WRITE setCompact)
|
Q_PROPERTY(bool compact READ isCompact WRITE setCompact)
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void reloadTheme() {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
CroppingLabel* nameLabel;
|
CroppingLabel* nameLabel;
|
||||||
QLabel statusPic;
|
QLabel statusPic;
|
||||||
|
|
|
@ -60,10 +60,9 @@ public slots:
|
||||||
QString getStatusMsg() const;
|
QString getStatusMsg() const;
|
||||||
QString getTitle() const;
|
QString getTitle() const;
|
||||||
|
|
||||||
void reloadTheme();
|
|
||||||
|
|
||||||
void activate();
|
void activate();
|
||||||
void compactChange(bool compact);
|
void compactChange(bool compact);
|
||||||
|
void reloadTheme() override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void chatroomWidgetClicked(GenericChatroomWidget* widget);
|
void chatroomWidgetClicked(GenericChatroomWidget* widget);
|
||||||
|
|
|
@ -94,13 +94,16 @@ void GUI::setWindowTitle(const QString& title)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reloads the application theme and redraw the window.
|
* @brief Reloads the application theme and redraw the window.
|
||||||
|
*
|
||||||
|
* For reload theme need connect signal themeReload() to function for reload
|
||||||
|
* For example: connect(&GUI::getInstance(), &GUI::themeReload, this, &SomeClass::reloadTheme);
|
||||||
*/
|
*/
|
||||||
void GUI::reloadTheme()
|
void GUI::reloadTheme()
|
||||||
{
|
{
|
||||||
if (QThread::currentThread() == qApp->thread()) {
|
if (QThread::currentThread() == qApp->thread()) {
|
||||||
getInstance()._reloadTheme();
|
getInstance().themeReload();
|
||||||
} else {
|
} else {
|
||||||
QMetaObject::invokeMethod(&getInstance(), "_reloadTheme", Qt::BlockingQueuedConnection);
|
QMetaObject::invokeMethod(&getInstance(), "themeReload", Qt::BlockingQueuedConnection);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -224,13 +227,6 @@ void GUI::_setWindowTitle(const QString& title)
|
||||||
w->setWindowTitle("qTox - " + title);
|
w->setWindowTitle("qTox - " + title);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GUI::_reloadTheme()
|
|
||||||
{
|
|
||||||
Widget* w = Nexus::getDesktopGUI();
|
|
||||||
if (w)
|
|
||||||
w->reloadTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
void GUI::_showInfo(const QString& title, const QString& msg)
|
void GUI::_showInfo(const QString& title, const QString& msg)
|
||||||
{
|
{
|
||||||
QMessageBox messageBox(QMessageBox::Information, title, msg, QMessageBox::Ok, getMainWidget());
|
QMessageBox messageBox(QMessageBox::Information, title, msg, QMessageBox::Ok, getMainWidget());
|
||||||
|
|
|
@ -50,7 +50,6 @@ private slots:
|
||||||
// Private implementation, those must be called from the GUI thread
|
// Private implementation, those must be called from the GUI thread
|
||||||
void _setEnabled(bool state);
|
void _setEnabled(bool state);
|
||||||
void _setWindowTitle(const QString& title);
|
void _setWindowTitle(const QString& title);
|
||||||
void _reloadTheme();
|
|
||||||
void _showInfo(const QString& title, const QString& msg);
|
void _showInfo(const QString& title, const QString& msg);
|
||||||
void _showWarning(const QString& title, const QString& msg);
|
void _showWarning(const QString& title, const QString& msg);
|
||||||
void _showError(const QString& title, const QString& msg);
|
void _showError(const QString& title, const QString& msg);
|
||||||
|
@ -58,4 +57,7 @@ private slots:
|
||||||
bool warning = true, bool yesno = true);
|
bool warning = true, bool yesno = true);
|
||||||
bool _askQuestion(const QString& title, const QString& msg, const QString& button1,
|
bool _askQuestion(const QString& title, const QString& msg, const QString& button1,
|
||||||
const QString& button2, bool defaultAns = false, bool warning = true);
|
const QString& button2, bool defaultAns = false, bool warning = true);
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void themeReload();
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include "searchform.h"
|
#include "searchform.h"
|
||||||
#include "form/searchsettingsform.h"
|
#include "form/searchsettingsform.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include "src/widget/style.h"
|
#include "src/widget/style.h"
|
||||||
|
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
|
@ -91,6 +92,8 @@ SearchForm::SearchForm(QWidget* parent) : QWidget(parent)
|
||||||
connect(settingsButton, &QPushButton::clicked, this, &SearchForm::clickedSearch);
|
connect(settingsButton, &QPushButton::clicked, this, &SearchForm::clickedSearch);
|
||||||
|
|
||||||
connect(settings, &SearchSettingsForm::updateSettings, this, &SearchForm::changedState);
|
connect(settings, &SearchSettingsForm::updateSettings, this, &SearchForm::changedState);
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &SearchForm::reloadTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchForm::removeSearchPhrase()
|
void SearchForm::removeSearchPhrase()
|
||||||
|
|
|
@ -44,7 +44,6 @@ public:
|
||||||
ParameterSearch getParameterSearch();
|
ParameterSearch getParameterSearch();
|
||||||
void setFocusEditor();
|
void setFocusEditor();
|
||||||
void insertEditor(const QString &text);
|
void insertEditor(const QString &text);
|
||||||
void reloadTheme();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void showEvent(QShowEvent* event) final;
|
void showEvent(QShowEvent* event) final;
|
||||||
|
@ -84,6 +83,7 @@ private slots:
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void showMessageNotFound(SearchDirection direction);
|
void showMessageNotFound(SearchDirection direction);
|
||||||
|
void reloadTheme();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void searchInBegin(const QString& phrase, const ParameterSearch& parameter);
|
void searchInBegin(const QString& phrase, const ParameterSearch& parameter);
|
||||||
|
|
|
@ -19,11 +19,13 @@
|
||||||
|
|
||||||
|
|
||||||
#include "activatedialog.h"
|
#include "activatedialog.h"
|
||||||
|
#include "src/widget/gui.h"
|
||||||
#include <QEvent>
|
#include <QEvent>
|
||||||
|
|
||||||
ActivateDialog::ActivateDialog(QWidget* parent, Qt::WindowFlags f)
|
ActivateDialog::ActivateDialog(QWidget* parent, Qt::WindowFlags f)
|
||||||
: QDialog(parent, f)
|
: QDialog(parent, f)
|
||||||
{
|
{
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &ActivateDialog::reloadTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActivateDialog::event(QEvent* event)
|
bool ActivateDialog::event(QEvent* event)
|
||||||
|
|
|
@ -32,6 +32,9 @@ public:
|
||||||
#endif
|
#endif
|
||||||
bool event(QEvent* event) override;
|
bool event(QEvent* event) override;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
virtual void reloadTheme() {}
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void windowStateChanged(Qt::WindowStates state);
|
void windowStateChanged(Qt::WindowStates state);
|
||||||
};
|
};
|
||||||
|
|
|
@ -463,6 +463,8 @@ void Widget::init()
|
||||||
connect(&settings, &Settings::groupchatPositionChanged, contactListWidget,
|
connect(&settings, &Settings::groupchatPositionChanged, contactListWidget,
|
||||||
&FriendListWidget::onGroupchatPositionChanged);
|
&FriendListWidget::onGroupchatPositionChanged);
|
||||||
|
|
||||||
|
connect(&GUI::getInstance(), &GUI::themeReload, this, &Widget::reloadTheme);
|
||||||
|
|
||||||
reloadTheme();
|
reloadTheme();
|
||||||
updateIcons();
|
updateIcons();
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
|
@ -1825,7 +1827,7 @@ ContentLayout* Widget::createContentDialog(DialogType type) const
|
||||||
Translator::registerHandler(std::bind(&Dialog::retranslateUi, this), this);
|
Translator::registerHandler(std::bind(&Dialog::retranslateUi, this), this);
|
||||||
retranslateUi();
|
retranslateUi();
|
||||||
setWindowIcon(QIcon(":/img/icons/qtox.svg"));
|
setWindowIcon(QIcon(":/img/icons/qtox.svg"));
|
||||||
setStyleSheet(Style::getStylesheet("window/general.css"));
|
reloadTheme();
|
||||||
|
|
||||||
connect(core, &Core::usernameSet, this, &Dialog::retranslateUi);
|
connect(core, &Core::usernameSet, this, &Dialog::retranslateUi);
|
||||||
}
|
}
|
||||||
|
@ -1842,6 +1844,11 @@ ContentLayout* Widget::createContentDialog(DialogType type) const
|
||||||
setWindowTitle(core->getUsername() + QStringLiteral(" - ") + Widget::fromDialogType(type));
|
setWindowTitle(core->getUsername() + QStringLiteral(" - ") + Widget::fromDialogType(type));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reloadTheme() final
|
||||||
|
{
|
||||||
|
setStyleSheet(Style::getStylesheet("window/general.css"));
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void resizeEvent(QResizeEvent* event) override
|
void resizeEvent(QResizeEvent* event) override
|
||||||
{
|
{
|
||||||
|
@ -2394,6 +2401,12 @@ void Widget::clearAllReceipts()
|
||||||
|
|
||||||
void Widget::reloadTheme()
|
void Widget::reloadTheme()
|
||||||
{
|
{
|
||||||
|
setStyleSheet("");
|
||||||
|
QWidgetList wgts = findChildren<QWidget*>();
|
||||||
|
for (auto x : wgts) {
|
||||||
|
x->setStyleSheet("");
|
||||||
|
}
|
||||||
|
|
||||||
this->setStyleSheet(Style::getStylesheet("window/general.css"));
|
this->setStyleSheet(Style::getStylesheet("window/general.css"));
|
||||||
QString statusPanelStyle = Style::getStylesheet("window/statusPanel.css");
|
QString statusPanelStyle = Style::getStylesheet("window/statusPanel.css");
|
||||||
ui->tooliconsZone->setStyleSheet(Style::getStylesheet("tooliconsZone/tooliconsZone.css"));
|
ui->tooliconsZone->setStyleSheet(Style::getStylesheet("tooliconsZone/tooliconsZone.css"));
|
||||||
|
@ -2404,27 +2417,6 @@ void Widget::reloadTheme()
|
||||||
contactListWidget->reDraw();
|
contactListWidget->reDraw();
|
||||||
|
|
||||||
profilePicture->setStyleSheet(Style::getStylesheet("window/profile.css"));
|
profilePicture->setStyleSheet(Style::getStylesheet("window/profile.css"));
|
||||||
|
|
||||||
if (contentLayout != nullptr) {
|
|
||||||
contentLayout->reloadTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Friend* f : FriendList::getAllFriends()) {
|
|
||||||
friendWidgets[f->getPublicKey()]->reloadTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (Group* g : GroupList::getAllGroups()) {
|
|
||||||
groupWidgets[g->getPersistentId()]->reloadTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
for (auto f : FriendList::getAllFriends()) {
|
|
||||||
chatForms[f->getPublicKey()]->reloadTheme();
|
|
||||||
}
|
|
||||||
|
|
||||||
for (auto g : GroupList::getAllGroups()) {
|
|
||||||
groupChatForms[g->getPersistentId()]->reloadTheme();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::nextContact()
|
void Widget::nextContact()
|
||||||
|
|
|
@ -142,7 +142,6 @@ public:
|
||||||
|
|
||||||
void clearAllReceipts();
|
void clearAllReceipts();
|
||||||
|
|
||||||
void reloadTheme();
|
|
||||||
static inline QIcon prepareIcon(QString path, int w = 0, int h = 0);
|
static inline QIcon prepareIcon(QString path, int w = 0, int h = 0);
|
||||||
|
|
||||||
bool groupsVisible() const;
|
bool groupsVisible() const;
|
||||||
|
@ -150,6 +149,7 @@ public:
|
||||||
void resetIcon();
|
void resetIcon();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
void reloadTheme();
|
||||||
void onShowSettings();
|
void onShowSettings();
|
||||||
void onSeparateWindowClicked(bool separate);
|
void onSeparateWindowClicked(bool separate);
|
||||||
void onSeparateWindowChanged(bool separate, bool clicked);
|
void onSeparateWindowChanged(bool separate, bool clicked);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user