#ifndef LOAPPTOOLS_H
#define LOAPPTOOLS_H

#include <QApplication>
#include <QObject>
#include <QBrush>
#include <QColor>
#include <QTimer>
#include <QPushButton>
#include <QFileDialog>

class wPageItem;
class LoAppTools : public QObject
{
    Q_OBJECT
private:
    LoAppTools(QObject *parent = nullptr);

public:
    static LoAppTools* getInstance();

signals:
    void sTick();

public:
    QBrush  getBrush(const QColor& color);
    QColor  int2Color(int value);
    int     color2Int(const QColor& color);

public: // For edit program
    void setCurPage(wPageItem *page) { m_page = page; }
    bool checkFileConflicted(const QString &fileNew);
    QString selectFile(const QString &filter, QWidget *parent);
    QStringList selectPhotoFile(const QString &filter, QWidget *parent);
    QString selectFile(const QString &filter, QWidget *parent,bool bSame);
    QString selectStr(bool f, const QString &s0, const QString &s1 = "");
    //QString convertFileSize(quint64 n);
    QString convertFileSize(const qlonglong & bytes) ;

private:
    static LoAppTools* m_instance;

private:
    wPageItem *m_page;
    QTimer    *m_tick;
};

#endif // LOAPPTOOLS_H
