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
ExtraSettingsWidget Class Reference

#include <src/ckb/extrasettingswidget.h>

+ Inheritance diagram for ExtraSettingsWidget:
+ Collaboration diagram for ExtraSettingsWidget:

Public Member Functions

 ExtraSettingsWidget (QWidget *parent=0)
 
 ~ExtraSettingsWidget ()
 
void pollUpdates ()
 

Private Slots

void on_trayBox_clicked (bool checked)
 
void on_brightnessBox_clicked (bool checked)
 
void on_animScanButton_clicked ()
 
void on_fpsBox_valueChanged (int arg1)
 
void on_ditherBox_clicked (bool checked)
 
void on_mAccelBox_clicked (bool checked)
 
void on_sAccelBox_clicked (bool checked)
 
void on_sSpeedBox_valueChanged (int arg1)
 
void on_delayBox_clicked (bool checked)
 

Private Attributes

Ui::ExtraSettingsWidgetui
 

Detailed Description

Definition at line 10 of file extrasettingswidget.h.

Constructor & Destructor Documentation

ExtraSettingsWidget::ExtraSettingsWidget ( QWidget parent = 0)
explicit

Read Macro Delay setting, update UI and Kb-internal flag

Definition at line 10 of file extrasettingswidget.cpp.

References Ui_ExtraSettingsWidget::animPathLabel, Ui_ExtraSettingsWidget::brightnessBox, Ui_ExtraSettingsWidget::delayBox, Kb::dither(), Ui_ExtraSettingsWidget::ditherBox, Ui_ExtraSettingsWidget::fpsBox, Ui_ExtraSettingsWidget::fpsWarnLabel, Kb::frameRate(), lastSharedDimming, Ui_ExtraSettingsWidget::mAccelBox, Kb::macroDelay(), KbLight::MAX_DIM, Kb::mouseAccel(), on_animScanButton_clicked(), Ui_ExtraSettingsWidget::osxLabel, Ui_ExtraSettingsWidget::osxLine, AnimScript::path(), Ui_ExtraSettingsWidget::sAccelBox, Kb::scrollSpeed(), Ui_ExtraSettingsWidget::setupUi(), KbLight::shareDimming(), Ui_ExtraSettingsWidget::sSpeedBox, Ui_ExtraSettingsWidget::sSpeedWidget, Ui_ExtraSettingsWidget::trayBox, ui, and CkbSettings::value().

10  :
11  QDialog(parent),
13 {
14  ui->setupUi(this);
15  CkbSettings settings("Program");
16 
17  // Read frame rate from settings
18  int rate = settings.value("framerate").toInt();
19  if(rate <= 0 || rate > 60)
20  rate = 30;
21  ui->fpsBox->setValue(rate);
22  Kb::frameRate(rate);
23  ui->fpsWarnLabel->setVisible(rate > 30);
24 
25  // Read global brightness setting (default = on, 100% brightness)
26  int dimming = settings.value("GlobalBrightness").toInt();
27  if(dimming < -1 || dimming > KbLight::MAX_DIM)
28  dimming = 0;
29  lastSharedDimming = dimming;
30  KbLight::shareDimming(dimming);
31  // Set checkbox value (-1 = don't share)
32  ui->brightnessBox->setChecked(dimming == -1);
33 
34  // Read dither
35  bool dither = settings.value("Dither").toBool();
36  Kb::dither(dither);
37  ui->ditherBox->setChecked(dither);
38 
39 #ifdef Q_OS_MACX
40  // Read OSX settings
41  bool noAccel = settings.value("DisableMouseAccel").toBool();
42  Kb::mouseAccel(!noAccel);
43  ui->mAccelBox->setChecked(noAccel);
44  bool noScrollAccel = settings.value("DisableScrollAccel").toBool();
45  int scrollSpeed = settings.value("ScrollSpeed", 3).toInt();
46  ui->sAccelBox->setChecked(noScrollAccel);
47  ui->sSpeedBox->setValue(scrollSpeed);
48  Kb::scrollSpeed(noScrollAccel ? scrollSpeed : 0);
49  if(!noScrollAccel)
50  ui->sSpeedWidget->hide();
51 #else
52  // Hide all OSX options on Linux
53  ui->osxLabel->hide();
54  ui->osxLine->hide();
55  ui->mAccelBox->hide();
56  ui->sAccelBox->hide();
57  ui->sSpeedWidget->hide();
58 #endif
59 
60  // Read tray icon setting
61  ui->trayBox->setChecked(settings.value("SuppressTrayIcon").toBool());
62 
63  // Update animation info
64  ui->animPathLabel->setText(AnimScript::path());
66 
68  bool macroDelay = settings.value("MacroDelay").toBool();
69  Kb::macroDelay(macroDelay);
70  ui->delayBox->setChecked(macroDelay);
71 }
static bool mouseAccel()
Definition: kb.h:39
static int frameRate()
Definition: kb.h:27
static bool macroDelay()
Definition: kb.h:36
static QString path()
Definition: animscript.cpp:29
static const int MAX_DIM
Definition: kblight.h:38
static int scrollSpeed()
Definition: kb.h:42
void setupUi(QDialog *ExtraSettingsWidget)
static int shareDimming()
Definition: kblight.cpp:78
static bool dither()
Definition: kb.h:33
static int lastSharedDimming
Ui::ExtraSettingsWidget * ui

+ Here is the call graph for this function:

ExtraSettingsWidget::~ExtraSettingsWidget ( )

Definition at line 73 of file extrasettingswidget.cpp.

References ui.

73  {
74  delete ui;
75 }
Ui::ExtraSettingsWidget * ui

Member Function Documentation

void ExtraSettingsWidget::on_animScanButton_clicked ( )
privateslot

Definition at line 87 of file extrasettingswidget.cpp.

References Ui_ExtraSettingsWidget::animCountLabel, AnimScript::count(), AnimScript::scan(), and ui.

Referenced by ExtraSettingsWidget().

87  {
89  int count = AnimScript::count();
90  if(count == 0)
91  ui->animCountLabel->setText("No animations found");
92  else if(count == 1)
93  ui->animCountLabel->setText("1 animation found");
94  else
95  ui->animCountLabel->setText(QString("%1 animations found").arg(count));
96 }
static int count()
Definition: animscript.h:54
static void scan()
Definition: animscript.cpp:37
Ui::ExtraSettingsWidget * ui

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void ExtraSettingsWidget::on_brightnessBox_clicked ( bool  checked)
privateslot

Definition at line 82 of file extrasettingswidget.cpp.

References pollUpdates(), and KbLight::shareDimming().

82  {
83  KbLight::shareDimming(checked ? -1 : 0);
84  pollUpdates();
85 }
static int shareDimming()
Definition: kblight.cpp:78

+ Here is the call graph for this function:

void ExtraSettingsWidget::on_delayBox_clicked ( bool  checked)
privateslot

Definition at line 143 of file extrasettingswidget.cpp.

References Kb::macroDelay(), and CkbSettings::set().

143  {
144  CkbSettings::set("Program/MacroDelay", checked);
145  Kb::macroDelay(checked);
146 }
static void set(const QString &key, const QVariant &value)
static bool macroDelay()
Definition: kb.h:36

+ Here is the call graph for this function:

void ExtraSettingsWidget::on_ditherBox_clicked ( bool  checked)
privateslot

Definition at line 110 of file extrasettingswidget.cpp.

References Kb::dither(), and CkbSettings::set().

110  {
111  CkbSettings::set("Program/Dither", checked);
112  Kb::dither(checked);
113 }
static void set(const QString &key, const QVariant &value)
static bool dither()
Definition: kb.h:33

+ Here is the call graph for this function:

void ExtraSettingsWidget::on_fpsBox_valueChanged ( int  arg1)
privateslot

Definition at line 98 of file extrasettingswidget.cpp.

References Ui_ExtraSettingsWidget::fpsWarnLabel, Kb::frameRate(), CkbSettings::setValue(), and ui.

98  {
99  // Set FPS
100  CkbSettings settings("Program");
101  settings.setValue("framerate", arg1);
102  Kb::frameRate(arg1);
103  // Show warning label if FPS is above 30
104  if(arg1 > 30)
105  ui->fpsWarnLabel->show();
106  else
107  ui->fpsWarnLabel->hide();
108 }
static int frameRate()
Definition: kb.h:27
Ui::ExtraSettingsWidget * ui

+ Here is the call graph for this function:

void ExtraSettingsWidget::on_mAccelBox_clicked ( bool  checked)
privateslot

Definition at line 124 of file extrasettingswidget.cpp.

References Kb::mouseAccel(), and CkbSettings::set().

124  {
125  CkbSettings::set("Program/DisableMouseAccel", checked);
126  Kb::mouseAccel(!checked);
127 }
static bool mouseAccel()
Definition: kb.h:39
static void set(const QString &key, const QVariant &value)

+ Here is the call graph for this function:

void ExtraSettingsWidget::on_sAccelBox_clicked ( bool  checked)
privateslot

Definition at line 129 of file extrasettingswidget.cpp.

References Kb::scrollSpeed(), CkbSettings::set(), Ui_ExtraSettingsWidget::sSpeedBox, Ui_ExtraSettingsWidget::sSpeedWidget, and ui.

129  {
130  CkbSettings::set("Program/DisableScrollAccel", checked);
131  Kb::scrollSpeed(checked ? ui->sSpeedBox->value() : 0);
132  if(checked)
133  ui->sSpeedWidget->show();
134  else
135  ui->sSpeedWidget->hide();
136 }
static void set(const QString &key, const QVariant &value)
static int scrollSpeed()
Definition: kb.h:42
Ui::ExtraSettingsWidget * ui

+ Here is the call graph for this function:

void ExtraSettingsWidget::on_sSpeedBox_valueChanged ( int  arg1)
privateslot

Definition at line 138 of file extrasettingswidget.cpp.

References Ui_ExtraSettingsWidget::sAccelBox, Kb::scrollSpeed(), CkbSettings::set(), and ui.

138  {
139  CkbSettings::set("Program/ScrollSpeed", arg1);
140  Kb::scrollSpeed(ui->sAccelBox->isChecked() ? arg1 : 0);
141 }
static void set(const QString &key, const QVariant &value)
static int scrollSpeed()
Definition: kb.h:42
Ui::ExtraSettingsWidget * ui

+ Here is the call graph for this function:

void ExtraSettingsWidget::on_trayBox_clicked ( bool  checked)
privateslot

Definition at line 77 of file extrasettingswidget.cpp.

References MainWindow::mainWindow, CkbSettings::set(), and MainWindow::toggleTrayIcon().

77  {
78  CkbSettings::set("Program/SuppressTrayIcon", checked);
80 }
static void set(const QString &key, const QVariant &value)
void toggleTrayIcon(bool visible)
Definition: mainwindow.cpp:150
static MainWindow * mainWindow
Definition: mainwindow.h:35

+ Here is the call graph for this function:

void ExtraSettingsWidget::pollUpdates ( )

Definition at line 115 of file extrasettingswidget.cpp.

References CkbSettings::isBusy(), lastSharedDimming, CkbSettings::set(), and KbLight::shareDimming().

Referenced by on_brightnessBox_clicked(), and SettingsWidget::pollUpdates().

115  {
116  // Check for changes to shared brightness setting
117  int dimming = KbLight::shareDimming();
118  if(dimming != lastSharedDimming && !CkbSettings::isBusy()){
119  CkbSettings::set("Program/GlobalBrightness", dimming);
120  lastSharedDimming = dimming;
121  }
122 }
static void set(const QString &key, const QVariant &value)
static int shareDimming()
Definition: kblight.cpp:78
static int lastSharedDimming
static bool isBusy()
Definition: ckbsettings.cpp:42

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation


The documentation for this class was generated from the following files: