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