/*
 * Copyright (C) 2020, KylinSoft Co., Ltd.
 *
 * This program 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.
 *
 * This program 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 this program.  If not, see <https://www.gnu.org/licenses/>.
 */
#ifndef KAGLOBAL_H
#define KAGLOBAL_H

#include <QUrl>

#include <aiconfig/modelconfig.h>
#include <kylin-ai/private/osassistant/osassistant.h>
#include <kylin-ai/coreai/speech/error.h>
#include <QProcess>
#include <math.h>
#include <ukui-log4qt.h>
#include "configmanager.h"
#include <QDir>


using namespace kyai::assistant;
using namespace kyai::config::model;

// 文件类型
enum FileType
{
    ERROR = 0,
    IMAGE,
    DOCUMENT,
    SOURCE,
    SCHEDULE
};
// 消息去向
enum TartgetType
{
    RECVMSG = 0,
    SUMMARY,
    CALENDAR,
    TODOLIST
};
// 页面状态
enum PageType {
    MAIN_PAGE_SIDEBAR_MODE = 0,       // 侧边栏模式下主页面
    SHOW_SIDEBAR,                     // 显示侧边栏
    MAIN_PAGE_WINDOW_MODE,            // 窗口模式下显示主界面
};
extern bool isSettingOpen;
extern bool isTextAreaFocus;
extern bool isSpeechSynthesizing;
extern bool isWayland;
extern bool isSupportWindowMode;
extern PageType g_currentPage;

//static QGSettings *g_gsettings = new QGSettings("org.kylin.aiassistant.settings");
static ConfigManager * g_configManager = new ConfigManager(QDir::homePath().append("/.config/kylin-aiassistant/settings.ini"));


class globals
{
public:
    static int themeColor;      // 主題顏色
    static float fontSize;        // 字体大小
    static QUrl openLink;       // 帮助文档链接
    static double scaleFactor;  // 屏幕缩放比
    static QString defaultPath; // 助手文件存储路径

    static void borderColor(QWidget *widget,int xradius,int yradius, QColor borderColor);
    static void borderRound(QWidget *widget,int xradius,int yradius);
    static QString getErrorMsg(int errorCode);  //根据文本对话错误码，返回错误信息
    static QString getErrorMsg(SpeechErrorCode errorCode);//根据语音对话错误码，返回错误信息
    static bool getIsSupportWindowMode(); //根据主题版本号判断，是否开启大窗口模式、独占模式
    static QString getFileIconName(QString filePath);

};

#endif // KAGLOBAL_H
