MythTV master
mythuihelper.cpp
Go to the documentation of this file.
1#include "mythuihelper.h"
2
3#include <cmath>
4#include <unistd.h>
5#include <iostream>
6
7#include <QMutex>
8#include <QMap>
9#include <QDir>
10#include <QFileInfo>
11#include <QApplication>
12#include <QStyleFactory>
13#include <QFile>
14#include <QTimer>
15
16// mythbase headers
17#include "libmythbase/mythdb.h"
20
21// mythui headers
22#include "mythprogressdialog.h"
23#include "mythimage.h"
24#include "mythmainwindow.h"
25#include "themeinfo.h"
26#include "x11colors.h"
27#include "mythdisplay.h"
28
29#define LOC QString("MythUIHelper: ")
30
31static MythUIHelper *mythui = nullptr;
32static QMutex uiLock;
33
35{
36 if (mythui)
37 return mythui;
38
39 uiLock.lock();
40
41 if (!mythui)
42 mythui = new MythUIHelper();
43
44 uiLock.unlock();
45
46 // These directories should always exist. Don't test first as
47 // there's no harm in trying to create an existing directory.
48 QDir dir;
49 dir.mkdir(GetThemeBaseCacheDir());
50 dir.mkdir(GetRemoteCacheDir());
51 dir.mkdir(GetThumbnailDir());
52
53 return mythui;
54}
55
57{
58 uiLock.lock();
59 delete mythui;
60 mythui = nullptr;
61 uiLock.unlock();
62}
63
65{
67}
68
70{
72}
73
75{
76 m_screenSetup = true;
78 m_callbacks = cbs;
79}
80
81// This init is used for showing the startup UI that is shown
82// before the database is initialized. The above init is called later,
83// after the DB is available.
84// This class does not mind being Initialized twice.
86{
87 m_screenSetup = true;
89}
90
92{
93 return &m_callbacks;
94}
95
97{
98 return m_screenSetup;
99}
bool IsScreenSetup() const
bool m_screenSetup
Definition: mythuihelper.h:44
MythUIMenuCallbacks m_callbacks
Definition: mythuihelper.h:43
static void destroyMythUI()
MythUIHelper()=default
static MythUIHelper * getMythUI()
MythUIMenuCallbacks * GetMenuCBs()
QString GetRemoteCacheDir(void)
Returns the directory for all files cached from the backend.
Definition: mythdirs.cpp:280
QString GetThumbnailDir(void)
Returns the directory where all non-theme thumbnail files should be cached.
Definition: mythdirs.cpp:288
QString GetThemeBaseCacheDir(void)
Returns the base directory where all theme related files should be cached.
Definition: mythdirs.cpp:296
void DestroyMythUI()
static QMutex uiLock
MythUIHelper * GetMythUI()
static MythUIHelper * mythui