Basic header and footer of room list

This commit is contained in:
Nicolas Werner 2021-05-14 23:35:34 +02:00
parent 39a43ad4ab
commit 567fe81ad7
No known key found for this signature in database
GPG key ID: C8D75E610773F2D9
19 changed files with 385 additions and 175 deletions

View file

@ -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();
}