ckb-next  v0.2.8 at branch master
ckb-next driver for corsair devices
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
mperfwidget.cpp File Reference
#include "mperfwidget.h"
#include "ui_mperfwidget.h"
#include "modeselectdialog.h"
#include <cmath>
+ Include dependency graph for mperfwidget.cpp:

Go to the source code of this file.

Macros

#define SET_START   if(isSetting) return; isSetting = true
 
#define SET_END   isSetting = false
 

Functions

int dpiExp (int value, int min, int max)
 
int dpiLog (int value, int min, int max)
 
int dpiRound (int value)
 

Variables

static const QString xyLinkPath = "UI/DPI/UnlinkXY"
 
static const double DPI_BASE = (double)KbPerf::DPI_MAX / (double)KbPerf::DPI_MIN
 

Macro Definition Documentation

#define SET_END   isSetting = false
#define SET_START   if(isSetting) return; isSetting = true

Function Documentation

int dpiExp ( int  value,
int  min,
int  max 
)
inline

Definition at line 105 of file mperfwidget.cpp.

References DPI_BASE, KbPerf::DPI_MIN, and min().

Referenced by MPerfWidget::sliderXMoved(), and MPerfWidget::sliderYMoved().

105  {
106  double val = (value - min) / (double)(max - min);
107  val = pow(DPI_BASE, val);
108  return round(KbPerf::DPI_MIN * val);
109 }
static const double DPI_BASE
static const int DPI_MIN
Definition: kbperf.h:47
int max(int a, int b)
Definition: main.c:97
int min(int a, int b)
Definition: main.c:101

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int dpiLog ( int  value,
int  min,
int  max 
)
inline

Definition at line 111 of file mperfwidget.cpp.

References DPI_BASE, and KbPerf::DPI_MIN.

Referenced by MPerfWidget::boxXChanged(), and MPerfWidget::boxYChanged().

111  {
112  double val = value / (double)KbPerf::DPI_MIN;
113  val = log(val) / log(DPI_BASE);
114  return round(val * (max - min) + min);
115 }
static const double DPI_BASE
static const int DPI_MIN
Definition: kbperf.h:47
int max(int a, int b)
Definition: main.c:97
int min(int a, int b)
Definition: main.c:101

+ Here is the caller graph for this function:

int dpiRound ( int  value)
inline

Definition at line 117 of file mperfwidget.cpp.

Referenced by MPerfWidget::sliderXMoved(), and MPerfWidget::sliderYMoved().

117  {
118  if(value > 1000)
119  return round(value / 100.) * 100;
120  else
121  return round(value / 50.) * 50;
122 }

+ Here is the caller graph for this function:

Variable Documentation

const double DPI_BASE = (double)KbPerf::DPI_MAX / (double)KbPerf::DPI_MIN
static

Definition at line 103 of file mperfwidget.cpp.

Referenced by dpiExp(), and dpiLog().

const QString xyLinkPath = "UI/DPI/UnlinkXY"
static

Definition at line 6 of file mperfwidget.cpp.

Referenced by MPerfWidget::on_xyBox_clicked().