File indexing completed on 2025-03-09 04:54:34

0001 /*
0002     SPDX-FileCopyrightText: 2013 Sandro Knauß <bugs@sandroknauss.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "testcsshelper.h"
0008 
0009 #include <QApplication>
0010 #include <QColor>
0011 #include <QFont>
0012 #include <QPalette>
0013 
0014 using namespace MessageViewer::Test;
0015 
0016 TestCSSHelper::TestCSSHelper(const QPaintDevice *pd)
0017     : MessageViewer::CSSHelper(pd)
0018 {
0019     mRecycleQuoteColors = false;
0020     mBackgroundColor = QColor(0xff, 0xff, 0xff);
0021     mForegroundColor = QColor(0x1f, 0x1c, 0x1b);
0022     mLinkColor = QColor(0x00, 0x57, 0xae);
0023     cPgpEncrH = QColor(0x00, 0x80, 0xff);
0024     cPgpOk1H = QColor(0x40, 0xff, 0x40);
0025     cPgpOk0H = QColor(0xff, 0xff, 0x40);
0026     cPgpWarnH = QColor(0xff, 0xff, 0x40);
0027     cPgpErrH = QColor(0xff, 0x00, 0x00);
0028 
0029     cPgpEncrHT = QColor(0xff, 0xff, 0xff);
0030     cPgpOk1HT = QColor(0x27, 0xae, 0x60);
0031     cPgpOk0HT = QColor(0xf6, 0x74, 0x00);
0032     cPgpWarnHT = QColor(0xf6, 0x74, 0x00);
0033     cPgpErrHT = QColor(0xda, 0x44, 0x53);
0034 
0035     cInlineMessage[Positive] = QColor(0, 255, 0);
0036     cInlineMessage[Information] = QColor(0, 0, 255);
0037     cInlineMessage[Warning] = QColor(255, 255, 0);
0038     cInlineMessage[Error] = QColor(255, 0, 0);
0039 
0040     for (int i = 0; i < 3; ++i) {
0041         mQuoteColor[i] = QColor(0x00, 0x80 - i * 0x10, 0x00);
0042     }
0043 
0044     QFont defaultFont = QFont(QStringLiteral("Sans Serif"), 9);
0045     mBodyFont = defaultFont;
0046     mPrintFont = defaultFont;
0047     mFixedFont = defaultFont;
0048     mFixedPrintFont = defaultFont;
0049     defaultFont.setItalic(true);
0050     mQuoteFont = defaultFont;
0051 
0052     mShrinkQuotes = false;
0053 
0054     QPalette pal;
0055 
0056     pal.setColor(QPalette::Window, QColor(0xd6, 0xd2, 0xd0));
0057     pal.setColor(QPalette::WindowText, QColor(0x22, 0x1f, 0x1e));
0058     pal.setColor(QPalette::Highlight, QColor(0x43, 0xac, 0xe8));
0059     pal.setColor(QPalette::HighlightedText, QColor(0xff, 0xff, 0xff));
0060     pal.setColor(QPalette::Mid, QColor(0xb3, 0xab, 0xa7));
0061 
0062     QApplication::setPalette(pal);
0063 
0064     recalculatePGPColors();
0065 }
0066 
0067 TestCSSHelper::~TestCSSHelper() = default;
0068 
0069 QString TestCSSHelper::htmlHead(const HtmlHeadSettings &htmlHeadSettings) const
0070 {
0071     Q_UNUSED(htmlHeadSettings)
0072     return QStringLiteral(
0073         "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n"
0074         "<html>\n"
0075         "<body>\n");
0076 }