File indexing completed on 2024-05-05 12:45:57
0001 /* SPDX-FileCopyrightText: 2003-2010 Jesper K. Pedersen <blackie@kde.org> 0002 0003 SPDX-License-Identifier: GPL-2.0-or-later 0004 */ 0005 #ifndef HTMLGENERATOR_IMAGESIZECHECKBOX_H 0006 #define HTMLGENERATOR_IMAGESIZECHECKBOX_H 0007 0008 #include <qcheckbox.h> 0009 0010 namespace HTMLGenerator 0011 { 0012 class ImageSizeCheckBox : public QCheckBox 0013 { 0014 0015 public: 0016 ImageSizeCheckBox(int width, int height, QWidget *parent) 0017 : QCheckBox(QString::fromLatin1("%1x%2").arg(width).arg(height), parent) 0018 , m_width(width) 0019 , m_height(height) 0020 { 0021 } 0022 0023 ImageSizeCheckBox(const QString &text, QWidget *parent) 0024 : QCheckBox(text, parent) 0025 , m_width(-1) 0026 , m_height(-1) 0027 { 0028 } 0029 0030 int width() const 0031 { 0032 return m_width; 0033 } 0034 int height() const 0035 { 0036 return m_height; 0037 } 0038 QString text(bool withOutSpaces) const 0039 { 0040 return text(m_width, m_height, withOutSpaces); 0041 } 0042 static QString text(int width, int height, bool withOutSpaces) 0043 { 0044 if (width == -1) 0045 if (withOutSpaces) 0046 return QString::fromLatin1("fullsize"); 0047 else 0048 return QString::fromLatin1("full size"); 0049 0050 else 0051 return QString::fromLatin1("%1x%2").arg(width).arg(height); 0052 } 0053 0054 bool operator<(const ImageSizeCheckBox &other) const 0055 { 0056 return m_width < other.width(); 0057 } 0058 0059 private: 0060 int m_width; 0061 int m_height; 0062 }; 0063 } 0064 0065 #endif /* HTMLGENERATOR_IMAGESIZECHECKBOX_H */ 0066 0067 // vi:expandtab:tabstop=4 shiftwidth=4: