PDF4QT/Pdf4QtViewer/pdfencryptionstrengthhintwi...

77 lines
1.9 KiB
C
Raw Normal View History

2021-05-21 19:00:25 +02:00
// Copyright (C) 2021 Jakub Melka
//
2021-08-10 19:22:56 +02:00
// This file is part of PDF4QT.
2021-05-21 19:00:25 +02:00
//
2021-08-10 19:22:56 +02:00
// PDF4QT is free software: you can redistribute it and/or modify
2021-05-21 19:00:25 +02:00
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// with the written consent of the copyright owner, any later version.
//
2021-08-10 19:22:56 +02:00
// PDF4QT is distributed in the hope that it will be useful,
2021-05-21 19:00:25 +02:00
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
2021-08-10 19:22:56 +02:00
// along with PDF4QT. If not, see <https://www.gnu.org/licenses/>.
2021-05-21 19:00:25 +02:00
#ifndef PDFENCRYPTIONSTRENGTHHINTWIDGET_H
#define PDFENCRYPTIONSTRENGTHHINTWIDGET_H
#include "pdfviewerglobal.h"
#include <QWidget>
#include <array>
namespace pdfviewer
{
class PDFEncryptionStrengthHintWidget : public QWidget
{
Q_OBJECT
private:
using BaseClass = QWidget;
public:
explicit PDFEncryptionStrengthHintWidget(QWidget* parent);
virtual QSize sizeHint() const override;
virtual QSize minimumSizeHint() const override;
int getCurrentValue() const;
void setCurrentValue(int currentValue);
int getMinValue() const;
void setMinValue(int minValue);
int getMaxValue() const;
void setMaxValue(int maxValue);
protected:
virtual void paintEvent(QPaintEvent* event) override;
void correctValue();
QSize getMarkSize() const;
int getMarkSpacing() const;
QSize getTextSizeHint() const;
struct Level
{
QColor color;
QString text;
};
int m_minValue;
int m_maxValue;
int m_currentValue;
std::array<Level, 5> m_levels;
};
} // namespace pdfviewer
#endif // PDFENCRYPTIONSTRENGTHHINTWIDGET_H