summaryrefslogtreecommitdiffstats
path: root/globals.cpp
blob: 53bd1f09113269e9518d41c58e9c496031c5f89c (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
#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);
}

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

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

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