summary refs log tree commit diff
path: root/src/ui/NhekoGlobalObject.cpp
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2021-05-14 23:35:34 +0200
committerNicolas Werner <nicolas.werner@hotmail.de>2021-05-15 13:05:55 +0200
commit567fe81ad78e707a4b914976a92c855d4ac8fc45 (patch)
treeb0f4511c6e5c32fedae69a217df5669c0e5eab0e /src/ui/NhekoGlobalObject.cpp
parentReorganize TimelineView to prepare porting the room list (diff)
downloadnheko-567fe81ad78e707a4b914976a92c855d4ac8fc45.tar.xz
Basic header and footer of room list
Diffstat (limited to 'src/ui/NhekoGlobalObject.cpp')
-rw-r--r--src/ui/NhekoGlobalObject.cpp33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/ui/NhekoGlobalObject.cpp b/src/ui/NhekoGlobalObject.cpp

index e5e6825e..70abfbb8 100644 --- a/src/ui/NhekoGlobalObject.cpp +++ b/src/ui/NhekoGlobalObject.cpp
@@ -7,29 +7,50 @@ #include <QDesktopServices> #include <QUrl> +#include "Cache_p.h" #include "ChatPage.h" +#include "Logging.h" #include "UserSettingsPage.h" +#include "Utils.h" Nheko::Nheko() { connect( UserSettings::instance().get(), &UserSettings::themeChanged, this, &Nheko::colorsChanged); + connect(ChatPage::instance(), &ChatPage::contentLoaded, this, &Nheko::updateUserProfile); +} + +void +Nheko::updateUserProfile() +{ + if (cache::client() && cache::client()->isInitialized()) + currentUser_.reset( + new UserProfile("", utils::localUser(), ChatPage::instance()->timelineManager())); + else + currentUser_.reset(); + emit profileChanged(); } QPalette Nheko::colors() const { - return QPalette(); + return Theme::paletteFromTheme(UserSettings::instance()->theme().toStdString()); } QPalette Nheko::inactiveColors() const { - QPalette p; + auto p = colors(); p.setCurrentColorGroup(QPalette::ColorGroup::Inactive); return p; } +Theme +Nheko::theme() const +{ + return Theme(UserSettings::instance()->theme().toStdString()); +} + void Nheko::openLink(QString link) const { @@ -79,3 +100,11 @@ Nheko::openLink(QString link) const QDesktopServices::openUrl(url); } } + +UserProfile * +Nheko::currentUser() const +{ + nhlog::ui()->debug("Profile requested"); + + return currentUser_.get(); +}