80 lines
1.4 KiB
C++
80 lines
1.4 KiB
C++
#ifndef UTIL_H
|
|
#define UTIL_H
|
|
|
|
#include <QFileInfo>
|
|
#include <QString>
|
|
#include <nlohmann/json.hpp>
|
|
#include <string>
|
|
|
|
class Util
|
|
{
|
|
public:
|
|
Util();
|
|
|
|
public:
|
|
static bool Init();
|
|
|
|
public:
|
|
static std::string GetWorkDir();
|
|
static std::string GetMediaDir();
|
|
static std::string GetConfigPath();
|
|
static std::pair<int, int> GetMainSize();
|
|
static bool SetMainSize(int w, int h);
|
|
static std::string GetEditor();
|
|
static QString NewUUIDName(const QString& path);
|
|
static double GetCurCash();
|
|
static double GetCurSave();
|
|
static int CashInt(double cash);
|
|
static double CashDouble(int cash);
|
|
|
|
private:
|
|
static bool LoadConfig();
|
|
};
|
|
|
|
enum CashFilter {
|
|
FIL_NO_LIMIT = 0,
|
|
FIL_LOWER,
|
|
FIL_HIGHER,
|
|
FIL_BETWEEN
|
|
};
|
|
|
|
class SharedData
|
|
{
|
|
private:
|
|
SharedData() = default;
|
|
~SharedData();
|
|
|
|
public:
|
|
static SharedData* instance();
|
|
|
|
// 条件
|
|
public:
|
|
bool flType{};
|
|
QString type{};
|
|
bool flDays{};
|
|
bool flKeys{};
|
|
bool flClassify{};
|
|
QString classify{};
|
|
QString key{};
|
|
int days{};
|
|
int lowMoney{};
|
|
int highMoney{};
|
|
CashFilter filter{};
|
|
|
|
public:
|
|
void ClearTt();
|
|
|
|
// 结果
|
|
public:
|
|
int32_t ttCashOut_{};
|
|
int32_t ttCashIn_{};
|
|
int32_t ttCreditIn_{};
|
|
int32_t ttCreditOut_{};
|
|
int32_t ttCreditCash_{};
|
|
// 还款金额
|
|
int32_t ttCashPay_{};
|
|
// 不计算现有现金的理论现金
|
|
int32_t ttCash_{};
|
|
};
|
|
#endif // UTIL_H
|