#include "Audio.h"
#include <QDebug>
#include <QLibraryInfo>
#include <QStandardPaths>
#include <QLabel>

#include "../MainWidget.h"
#include "../Ukui4MainWidget.h"
#include "../ui_audio.h"

Audio::Audio() : m_firstLoad(true)
{
#ifndef QT_NO_TRANSLATION
    QString translatorFileName = QLatin1String("qt_");
    translatorFileName += QLocale::system().name();
    QTranslator *pTranslator = new QTranslator();
    if (pTranslator->load(translatorFileName, QLibraryInfo::location(QLibraryInfo::TranslationsPath)))
        QApplication::installTranslator(pTranslator);
#endif
    QTranslator *translator = new QTranslator(this);
    translator->load("/usr/share/ukui-media/translations/audio/audio_" + QLocale::system().name());
    QApplication::installTranslator(translator);
    m_pluginName = tr("Audio");
    m_pluginType = SYSTEM;
}


QString Audio::plugini18nName()
{
    return m_pluginName;
}

int Audio::pluginTypes()
{
    return m_pluginType;
}

QWidget* Audio::pluginUi()
{
    if (m_firstLoad) {
        m_firstLoad = false;
        m_pWidget = new MainWidget();
    }
    return m_pWidget;
}

bool Audio::isEnable() const
{
    return true;
}

const QString Audio::name() const
{
    return QStringLiteral("Audio");
}

bool Audio::isShowOnHomePage() const
{
    return true;
}

QIcon Audio::icon() const
{
    return QIcon::fromTheme("audio-volume-high-symbolic");
}

QString Audio::translationPath() const
{
    return "/usr/share/ukui-media/translations/audio/audio_%1.ts";
}

void Audio::initSearchText()
{
    //~ contents_path /UkccPlugin/UkccPlugin
    tr("UkccPlugin");
    //~ contents_path /UkccPlugin/ukccplugin test
    tr("ukccplugin test");
}

