Entropy Piano Tuner  1.1.3 (documentation not yet complete)
An open-source experimental software for piano tuning by entropy minimization
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
displaysize.cpp
Go to the documentation of this file.
1 /*****************************************************************************
2  * Copyright 2015 Haye Hinrichsen, Christoph Wick
3  *
4  * This file is part of Entropy Piano Tuner.
5  *
6  * Entropy Piano Tuner 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  * Entropy Piano Tuner 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 for
14  * more details.
15  *
16  * You should have received a copy of the GNU General Public License along with
17  * Entropy Piano Tuner. If not, see http://www.gnu.org/licenses/.
18  *****************************************************************************/
19 
20 #include "displaysize.h"
21 #include <QGuiApplication>
22 #include <QFont>
23 #include <QFontDatabase>
24 
26 
27 std::unique_ptr<DisplaySizeDefines> DisplaySizeDefines::mSingleton;
28 
29 const std::unique_ptr<DisplaySizeDefines> &DisplaySizeDefines::getSingleton() {
30  EptAssert(mSingleton, "Singleton has not been created yet!");
31  return mSingleton;
32 }
33 
34 DisplaySizeDefines::DisplaySizeDefines(double displaySizeInInch, double fontPointSize) :
35  mDisplaySize(inchToDisplaySize(displaySizeInInch)),
36  mFontPointSize(fontPointSize) {
37  EptAssert(!mSingleton, "Singleton may only be created once!");
38  mSingleton.reset(this);
39 }
40 
42  if (inch < 4.5) {
43  return DS_XSMALL;
44  } else if (inch < 7) {
45  return DS_SMALL;
46  } else if (inch < 12) {
47  return DS_MEDIUM;
48  } else {
49  return DS_LARGE;
50  }
51 }
52 
54  return mFontPointSize;
55 }
56 
58  return getSmallIconSize() * 1.5;
59 }
60 
62  return getSmallIconSize() * 2;
63 }
64 
66  if (mDisplaySize >= DS_LARGE) {
67  return Qt::ToolButtonTextBesideIcon;
68  } else {
69  return Qt::ToolButtonTextUnderIcon;
70  }
71 }
72 
74  return mDisplaySize >= DS_SMALL;
75 }
76 
78  return mDisplaySize >= DS_MEDIUM;
79 }
80 
82  if (mDisplaySize <= DS_SMALL) {
83  return GDM_ONE_VISIBLE;
84  } else {
85  return GDM_ALL_VISIBLE;
86  }
87 }
88 
90  if (mDisplaySize <= DS_SMALL) {
92  } else {
93  return KDM_NORMAL;
94  }
95 }
96 
98  if (mDisplaySize <= DS_SMALL) {
99  return MGBDS_WIDGETS;
100  } else {
101  return MGBDS_NORMAL;
102  }
103 }
104 
106  return mDisplaySize <= DS_SMALL;
107 }
108 
110  return mDisplaySize <= DS_XSMALL;
111 }
112 
114  return mDisplaySize > DS_XSMALL;
115 }
double getMediumIconSize()
Definition: displaysize.cpp:57
bool keepKeyboardRatioFixed() const
Definition: displaysize.cpp:77
bool abbrevPlotLabels() const
bool showVolumeGroupBoxInTuningMode() const
Definition: displaysize.cpp:73
static DisplaySize inchToDisplaySize(double inch)
Definition: displaysize.cpp:41
Qt::ToolButtonStyle optionsDialogToolButtonStyle() const
Definition: displaysize.cpp:65
KeyboardDisplayMode getKeyboardDisplayMode() const
Definition: displaysize.cpp:89
const DisplaySize mDisplaySize
Definition: displaysize.h:52
MainGroupBoxDisplayStyle
Definition: displaysize.h:44
DisplaySizeDefines(double displaySizeInInch, double fontPointSize)
Definition: displaysize.cpp:34
bool showMuteOutputButton() const
GraphDisplayMode
Definition: displaysize.h:33
bool showPlotNavigationVertical() const
GraphDisplayMode getGraphDisplayMode() const
Definition: displaysize.cpp:81
DisplaySize
Definition: displaysize.h:26
static std::unique_ptr< DisplaySizeDefines > mSingleton
Definition: displaysize.h:51
double getLargeIconSize()
Definition: displaysize.cpp:61
KeyboardDisplayMode
Definition: displaysize.h:38
#define EptAssert(a, b)
Definition: eptexception.h:47
static const std::unique_ptr< DisplaySizeDefines > & getSingleton()
Definition: displaysize.cpp:29
MainGroupBoxDisplayStyle getMainGroupBoxDisplayStyle() const
Definition: displaysize.cpp:97
const double mFontPointSize
Definition: displaysize.h:53
double getSmallIconSize()
Definition: displaysize.cpp:53