summaryrefslogtreecommitdiff
path: root/plugins-unmaintained/Themes/Windows/factory.cpp
blob: dbce51a827199dbd3e2e33edad5f47b465169199 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/** \file factory.cpp
\brief Define the factory core
\author alpha_one_x86
*/

#include "factory.h"

QRegularExpression ThemesFactory::slashEnd;
QRegularExpression ThemesFactory::isolateName;

ThemesFactory::ThemesFactory()
{
    slashEnd=QRegularExpression("/$");
    isolateName=QRegularExpression("^.*/([^/]+)$");
}

PluginInterface_Themes * ThemesFactory::getInstance()
{
    Themes * newInterface=new Themes(facilityEngine);
    connect(this,&ThemesFactory::reloadLanguage,newInterface,&Themes::newLanguageLoaded);
    return newInterface;
}

void ThemesFactory::setResources(OptionInterface * options,const QString &writePath,const QString &pluginPath,FacilityInterface * facilityEngine,const bool &portableVersion)
{
    Q_UNUSED(options)
    Q_UNUSED(writePath)
    Q_UNUSED(pluginPath)
    this->facilityEngine=facilityEngine;
    Q_UNUSED(portableVersion)
}

QWidget * ThemesFactory::options()
{
        return NULL;
}

QIcon ThemesFactory::getIcon(const QString &fileName) const
{
    if(fileName=="SystemTrayIcon/exit.png")
    {
        QIcon tempIcon=QIcon::fromTheme("application-exit");
        if(!tempIcon.isNull())
            return tempIcon;
    }
    if(fileName=="SystemTrayIcon/add.png")
    {
        QIcon tempIcon=QIcon::fromTheme("list-add");
        if(!tempIcon.isNull())
            return tempIcon;
    }
    if(fileName=="SystemTrayIcon/informations.png")
    {
        QIcon tempIcon=QIcon::fromTheme("help-about");
        if(!tempIcon.isNull())
            return tempIcon;
    }
    if(fileName=="SystemTrayIcon/options.png")
    {
        QIcon tempIcon=QIcon::fromTheme("applications-system");
        if(!tempIcon.isNull())
            return tempIcon;
    }
    return QIcon(":/Themes/Windows/resources/"+fileName);
}

void ThemesFactory::resetOptions()
{
}

void ThemesFactory::newLanguageLoaded()
{
    emit reloadLanguage();
}