mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-07-07 02:45:51 +00:00
rewrite formatters to ext classes
This commit is contained in:
80
sources/awesomewidgets/awfloatformatter.h
Normal file
80
sources/awesomewidgets/awfloatformatter.h
Normal file
@ -0,0 +1,80 @@
|
||||
/***************************************************************************
|
||||
* This file is part of awesome-widgets *
|
||||
* *
|
||||
* awesome-widgets is free software: you can redistribute it and/or *
|
||||
* modify it under the terms of the GNU General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of the *
|
||||
* License, or (at your option) any later version. *
|
||||
* *
|
||||
* awesome-widgets is distributed in the hope that it will be useful, *
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||
* GNU General Public License for more details. *
|
||||
* *
|
||||
* You should have received a copy of the GNU General Public License *
|
||||
* along with awesome-widgets. If not, see http://www.gnu.org/licenses/ *
|
||||
***************************************************************************/
|
||||
|
||||
#ifndef AWFLOATFORMATTER_H
|
||||
#define AWFLOATFORMATTER_H
|
||||
|
||||
#include "awabstractformatter.h"
|
||||
|
||||
|
||||
namespace Ui
|
||||
{
|
||||
class AWFloatFormatter;
|
||||
}
|
||||
|
||||
class AWFloatFormatter : public AWAbstractFormatter
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(int count READ count WRITE setCount)
|
||||
Q_PROPERTY(QChar fillChar READ fillChar WRITE setFillChar)
|
||||
Q_PROPERTY(char format READ format WRITE setFormat)
|
||||
Q_PROPERTY(double multiplier READ multiplier WRITE setMultiplier)
|
||||
Q_PROPERTY(int precision READ precision WRITE setPrecision)
|
||||
Q_PROPERTY(double summand READ summand WRITE setSummand)
|
||||
|
||||
public:
|
||||
explicit AWFloatFormatter(QWidget *parent, const QString filePath);
|
||||
explicit AWFloatFormatter(const int count, const QChar fillChar,
|
||||
const char format, const double multiplier,
|
||||
const int precision, const double summand,
|
||||
QWidget *parent);
|
||||
virtual ~AWFloatFormatter();
|
||||
QString convert(const QVariant &_value) const;
|
||||
AWFloatFormatter *copy(const QString _fileName, const int _number);
|
||||
// properties
|
||||
int count() const;
|
||||
QChar fillChar() const;
|
||||
char format() const;
|
||||
double multiplier() const;
|
||||
int precision() const;
|
||||
double summand() const;
|
||||
void setCount(const int _count);
|
||||
void setFillChar(const QChar _fillChar);
|
||||
void setFormat(char _format);
|
||||
void setMultiplier(const double _multiplier);
|
||||
void setPrecision(const int _precision);
|
||||
void setSummand(const double _summand);
|
||||
|
||||
public slots:
|
||||
void readConfiguration();
|
||||
int showConfiguration(const QVariant args = QVariant());
|
||||
void writeConfiguration() const;
|
||||
|
||||
private:
|
||||
Ui::AWFloatFormatter *ui;
|
||||
void translate();
|
||||
// properties
|
||||
int m_count = 0;
|
||||
QChar m_fillChar = QChar();
|
||||
char m_format = 'f';
|
||||
double m_multiplier = 1.0;
|
||||
int m_precision = -1;
|
||||
double m_summand = 0.0;
|
||||
};
|
||||
|
||||
|
||||
#endif /* AWFLOATFORMATTER_H */
|
Reference in New Issue
Block a user