added AboutPage back in again

This commit is contained in:
fourtf 2018-01-13 00:04:47 +01:00
parent 7772f245f6
commit 2f0658935a
3 changed files with 51 additions and 1 deletions

View file

@ -1,5 +1,12 @@
#include "aboutpage.hpp" #include "aboutpage.hpp"
#include <util/layoutcreator.hpp>
#include <QLabel>
#include <QVBoxLayout>
#define PIXMAP_WIDTH 500
namespace chatterino { namespace chatterino {
namespace widgets { namespace widgets {
namespace settingspages { namespace settingspages {
@ -7,6 +14,44 @@ namespace settingspages {
AboutPage::AboutPage() AboutPage::AboutPage()
: SettingsPage("About", ":/images/about.svg") : SettingsPage("About", ":/images/about.svg")
{ {
util::LayoutCreator<AboutPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>();
{
QPixmap pixmap;
pixmap.load(":/images/aboutlogo.png");
auto logo = layout.emplace<QLabel>().assign(&this->logo);
logo->setPixmap(pixmap);
logo->setFixedSize(PIXMAP_WIDTH, PIXMAP_WIDTH * pixmap.height() / pixmap.width());
logo->setScaledContents(true);
// this does nothing
// QPalette palette;
// palette.setColor(QPalette::Text, Qt::white);
// palette.setColor(QPalette::Link, "#a5cdff");
// palette.setColor(QPalette::LinkVisited, "#a5cdff");
auto created = layout.emplace<QLabel>();
created->setText(
"Twitch Chat Client created by <a href=\"https://github.com/fourtf\">fourtf</a>");
created->setTextFormat(Qt::RichText);
created->setTextInteractionFlags(Qt::TextBrowserInteraction |
Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
created->setOpenExternalLinks(true);
// created->setPalette(palette);
auto github = layout.emplace<QLabel>();
github->setText(
"<a href=\"https://github.com/fourtf/chatterino2\">Chatterino on Github</a>");
github->setTextFormat(Qt::RichText);
github->setTextInteractionFlags(Qt::TextBrowserInteraction | Qt::LinksAccessibleByKeyboard |
Qt::LinksAccessibleByKeyboard);
github->setOpenExternalLinks(true);
// github->setPalette(palette);
}
layout->addStretch(1);
} }
} // namespace settingspages } // namespace settingspages
} // namespace widgets } // namespace widgets

View file

@ -2,6 +2,8 @@
#include "widgets/settingspages/settingspage.hpp" #include "widgets/settingspages/settingspage.hpp"
class QLabel;
namespace chatterino { namespace chatterino {
namespace widgets { namespace widgets {
namespace settingspages { namespace settingspages {
@ -10,6 +12,9 @@ class AboutPage : public SettingsPage
{ {
public: public:
AboutPage(); AboutPage();
private:
QLabel *logo;
}; };
} // namespace settingspages } // namespace settingspages
} // namespace widgets } // namespace widgets

View file

@ -22,7 +22,7 @@ CommandPage::CommandPage()
: SettingsPage("Commands", ":/images/commands.svg") : SettingsPage("Commands", ":/images/commands.svg")
{ {
util::LayoutCreator<CommandPage> layoutCreator(this); util::LayoutCreator<CommandPage> layoutCreator(this);
auto layout = layoutCreator.emplace<QVBoxLayout>(); auto layout = layoutCreator.emplace<QVBoxLayout>().withoutMargin();
layout.emplace<QLabel>(TEXT)->setWordWrap(true); layout.emplace<QLabel>(TEXT)->setWordWrap(true);