Basic header and footer of room list
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();
+}
|