File indexing completed on 2024-05-12 16:43:58
0001 /* 0002 SPDX-FileCopyrightText: 2006-2018 Thomas Baumgart <tbaumgart@kde.org> 0003 SPDX-FileCopyrightText: 2017-2018 Łukasz Wojniłowicz <lukasz.wojnilowicz@gmail.com> 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef GROUPMARKER_P_H 0008 #define GROUPMARKER_P_H 0009 0010 // ---------------------------------------------------------------------------- 0011 // QT Includes 0012 0013 #include <QString> 0014 #include <QPixmap> 0015 #include <QFontMetrics> 0016 0017 // ---------------------------------------------------------------------------- 0018 // KDE Includes 0019 0020 // ---------------------------------------------------------------------------- 0021 // Project Includes 0022 0023 #include "kmymoneysettings.h" 0024 #include "register.h" 0025 #include "registeritem_p.h" 0026 0027 // clang-format off 0028 static unsigned char fancymarker_bg_image[] = { 0029 /* 200x49 */ 0030 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A, 0031 0x00, 0x00, 0x00, 0x0D, 0x49, 0x48, 0x44, 0x52, 0032 0x00, 0x00, 0x00, 0xC8, 0x00, 0x00, 0x00, 0x31, 0033 0x08, 0x06, 0x00, 0x00, 0x00, 0x9F, 0xC5, 0xE6, 0034 0x4F, 0x00, 0x00, 0x00, 0x06, 0x62, 0x4B, 0x47, 0035 0x44, 0x00, 0xFF, 0x00, 0xFF, 0x00, 0xFF, 0xA0, 0036 0xBD, 0xA7, 0x93, 0x00, 0x00, 0x00, 0x09, 0x70, 0037 0x48, 0x59, 0x73, 0x00, 0x00, 0x0B, 0x13, 0x00, 0038 0x00, 0x0B, 0x13, 0x01, 0x00, 0x9A, 0x9C, 0x18, 0039 0x00, 0x00, 0x00, 0x86, 0x49, 0x44, 0x41, 0x54, 0040 0x78, 0xDA, 0xED, 0xDD, 0x31, 0x0A, 0x84, 0x40, 0041 0x10, 0x44, 0xD1, 0x1A, 0x19, 0x10, 0xCF, 0xE6, 0042 0xFD, 0x4F, 0xB2, 0x88, 0x08, 0x22, 0x9B, 0x18, 0043 0x4E, 0x1B, 0x2C, 0x1B, 0x18, 0xBC, 0x07, 0x7D, 0044 0x81, 0x82, 0x1F, 0x77, 0x4B, 0xB2, 0x06, 0x18, 0045 0xEA, 0x49, 0x3E, 0x66, 0x00, 0x81, 0x80, 0x40, 0046 0xE0, 0xDF, 0x81, 0x6C, 0x66, 0x80, 0x3A, 0x90, 0047 0xDD, 0x0C, 0x50, 0x07, 0x72, 0x98, 0x01, 0xEA, 0048 0x40, 0x4E, 0x33, 0x40, 0x1D, 0xC8, 0x65, 0x06, 0049 0x18, 0x6B, 0xF7, 0x01, 0x00, 0x00, 0x00, 0x00, 0050 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0051 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0052 0x00, 0x00, 0x00, 0x00, 0x00, 0xF0, 0x16, 0x3E, 0053 0x4C, 0xC1, 0x83, 0x9E, 0x64, 0x32, 0x03, 0x08, 0054 0x04, 0x7E, 0x0A, 0xA4, 0x9B, 0x01, 0xEA, 0x40, 0055 0x66, 0x33, 0x40, 0x1D, 0xC8, 0x62, 0x06, 0x18, 0056 0xFB, 0x02, 0x05, 0x87, 0x08, 0x55, 0xFE, 0xDE, 0057 0xA2, 0x9D, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0058 0x4E, 0x44, 0xAE, 0x42, 0x60, 0x82 0059 }; 0060 // clang-format on 0061 0062 namespace KMyMoneyRegister 0063 { 0064 class GroupMarkerPrivate : public RegisterItemPrivate 0065 { 0066 public: 0067 void init() 0068 { 0069 m_showDate = false; 0070 m_erroneous = false; 0071 int h; 0072 if (m_parent) { 0073 h = m_parent->rowHeightHint(); 0074 } else { 0075 QFontMetrics fm(KMyMoneySettings::listCellFontEx()); 0076 h = fm.lineSpacing() + 6; 0077 } 0078 0079 if (GroupMarkerPrivate::m_bg && (GroupMarkerPrivate::m_bg->height() != h)) { 0080 delete GroupMarkerPrivate::m_bg; 0081 GroupMarkerPrivate::m_bg = 0; 0082 } 0083 0084 // convert the backgroud once 0085 if (GroupMarkerPrivate::m_bg == 0) { 0086 GroupMarkerPrivate::m_bg = new QPixmap; 0087 GroupMarkerPrivate::m_bg->loadFromData(fancymarker_bg_image, sizeof(fancymarker_bg_image)); 0088 *GroupMarkerPrivate::m_bg = GroupMarkerPrivate::m_bg->scaled(GroupMarkerPrivate::m_bg->width(), h, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); 0089 } 0090 0091 ++GroupMarkerPrivate::m_bgRefCnt; 0092 } 0093 0094 QString m_txt; 0095 bool m_showDate; 0096 0097 static QPixmap* m_bg; 0098 static int m_bgRefCnt; 0099 0100 bool m_erroneous; 0101 }; 0102 } 0103 0104 #endif