summaryrefslogtreecommitdiffstats
path: root/globals.cpp
blob: 68d710a89e9f59ea33d42ebe84a5ba3441d05543 (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
#include <QAction>

#include "globals.h"
#include "viewer.h"

Globals *Globals::mInstance = nullptr;

Globals *Globals::instance(){
    if(!mInstance){
        mInstance = new Globals;
    }
    return mInstance;
}

void Globals::addAction(QAction *a){
    mActions.insert(a->data().toInt(), a);
}

void Globals::addView(QTreeView *v){
    if(!mViews.contains(v)){
        mViews.append(v);
    }
}

QAction *Globals::action(int actionType){
    return mActions.value(actionType);
}

Viewer *Globals::viewer(){
    if(!mViewer){
        mViewer = new Viewer;
    }
    return mViewer;
}

Globals::Globals() : mViewer(nullptr) {}