Just Intonation
Version 1.3.1 (19)
Explore key-independent dynamically adapting tuning in just intonation
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
platformtools.h
Go to the documentation of this file.
1
/*****************************************************************************
2
* Copyright 2016-2017 Karolin Stange, Christoph Wick, and Haye Hinrichsen
3
*
4
* This file is part of JustIntonation.
5
*
6
* JustIntonation is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by the
8
* Free Software Foundation, either version 3 of the License, or (at your
9
* option) any later version.
10
*
11
* JustIntonation is distributed in the hope that it will be useful, but
12
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14
* for more details.
15
*
16
* You should have received a copy of the GNU General Public License along
17
* with JustIntonation. If not, see http://www.gnu.org/licenses/.
18
*****************************************************************************/
19
20
#ifndef PLATFORMTOOLS_H
21
#define PLATFORMTOOLS_H
22
23
#include <memory>
24
#include <assert.h>
25
26
#include <QStorageInfo>
27
28
class
Application
;
29
39
40
class
PlatformTools
41
{
42
protected
:
43
PlatformTools
() {}
44
45
public
:
46
55
56
static
PlatformTools
&
getSingleton
()
57
{
58
assert(
getPointerToInstance
());
59
return
*
getPointerToInstance
();
60
}
61
65
66
virtual
void
init
(
Application
&application) {(void)application;}
67
68
72
73
virtual
void
disableScreensaver
() {}
74
75
79
80
virtual
void
enableScreensaver
() {}
81
82
83
//-------------------------------------------------------------------------
84
// Determine free disk space
85
//-------------------------------------------------------------------------
92
93
virtual
qint64
getFreeDiskSpace
(
const
QString &path)
94
{
95
return
QStorageInfo(path).bytesTotal();
96
}
97
98
99
//=================================================================================
100
101
public
:
102
106
107
static
std::unique_ptr<PlatformTools> &
getPointerToInstance
()
108
{
109
static
std::unique_ptr<PlatformTools> mInstance(
new
PlatformTools
);
110
return
mInstance;
111
}
112
};
113
117
118
template
<
class
T>
119
class
PlatformToolsInstanciator
{
120
public
:
121
friend
class
PlatformTools
;
122
PlatformToolsInstanciator
()
123
{
124
PlatformTools::getPointerToInstance
().reset(
new
T());
125
}
126
};
127
128
#endif // PLATFORMTOOLS_H
PlatformTools::PlatformTools
PlatformTools()
Definition:
platformtools.h:43
PlatformTools::init
virtual void init(Application &application)
Platform-dependent initialization.
Definition:
platformtools.h:66
PlatformToolsInstanciator::PlatformToolsInstanciator
PlatformToolsInstanciator()
Definition:
platformtools.h:122
PlatformTools::getSingleton
static PlatformTools & getSingleton()
Definition:
platformtools.h:56
PlatformTools::getFreeDiskSpace
virtual qint64 getFreeDiskSpace(const QString &path)
Determine free disk space.
Definition:
platformtools.h:93
PlatformTools::enableScreensaver
virtual void enableScreensaver()
Function to enable the screen saver.
Definition:
platformtools.h:80
PlatformTools::disableScreensaver
virtual void disableScreensaver()
Function to disable the screen saver.
Definition:
platformtools.h:73
Application
Main application.
Definition:
application.h:60
PlatformTools
Base class providing support for various platforms.
Definition:
platformtools.h:40
PlatformToolsInstanciator
Helper class for instantiating objects derived from PlatformTools.
Definition:
platformtools.h:119
PlatformTools::getPointerToInstance
static std::unique_ptr< PlatformTools > & getPointerToInstance()
Function holding the instance pointer as a static unique pointer.
Definition:
platformtools.h:107
application
modules
platformtools
platformtools.h
Generated on Wed Jul 12 2017 10:39:47 for Just Intonation by
1.8.11