• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mcallegari / qlcplus / 13633248611

03 Mar 2025 02:31PM UTC coverage: 31.871% (+0.4%) from 31.5%
13633248611

push

github

web-flow
actions: add chrpath to profile

14689 of 46089 relevant lines covered (31.87%)

26426.11 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/ui/src/virtualconsole/addvcslidermatrix.cpp
1
/*
2
  Q Light Controller
3
  addvcslidermatrix.cpp
4

5
  Copyright (C) Heikki Junnila
6

7
  Licensed under the Apache License, Version 2.0 (the "License");
8
  you may not use this file except in compliance with the License.
9
  You may obtain a copy of the License at
10

11
      http://www.apache.org/licenses/LICENSE-2.0.txt
12

13
  Unless required by applicable law or agreed to in writing, software
14
  distributed under the License is distributed on an "AS IS" BASIS,
15
  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
  See the License for the specific language governing permissions and
17
  limitations under the License.
18
*/
19

20
#include <QSettings>
21
#include <QSpinBox>
22
#include <QAction>
23

24
#include "addvcslidermatrix.h"
25
#include "vcpropertieseditor.h"
26

27
#define SETTINGS_GEOMETRY "addvcslidermatrix/geometry"
28
#define SETTINGS_SLIDER_MATRIX_SIZE "slidermatrix/defaultSize"
29

30
AddVCSliderMatrix::AddVCSliderMatrix(QWidget* parent)
×
31
    : QDialog(parent)
32
    , m_amount(1)
×
33
    , m_height(100)
×
34
    , m_width(60)
×
35
{
36
    setupUi(this);
×
37

38
    QAction* action = new QAction(this);
×
39
    action->setShortcut(QKeySequence(QKeySequence::Close));
×
40
    connect(action, SIGNAL(triggered(bool)), this, SLOT(reject()));
×
41
    addAction(action);
×
42

43
    QSettings settings;
×
44
    QVariant userVar = settings.value(SETTINGS_SLIDER_SIZE);
×
45
    if (userVar.isValid() == true)
×
46
    {
47
        QSize userSize = userVar.toSize();
×
48
        m_height = userSize.height();
×
49
        m_width = userSize.width();
×
50
    }
51

52
    QVariant var = settings.value(SETTINGS_SLIDER_MATRIX_SIZE);
×
53
    if (var.isValid() == true)
×
54
    {
55
        QSize size = var.toSize();
×
56
        m_amount = size.width();
×
57
        m_height = size.height();
×
58
    }
59

60
    QVariant geometrySettings = settings.value(SETTINGS_GEOMETRY);
×
61
    if (geometrySettings.isValid() == true)
×
62
        restoreGeometry(geometrySettings.toByteArray());
×
63

64
    m_amountSpin->setValue(m_amount);
×
65
    m_heightSpin->setValue(m_height);
×
66
    m_widthSpin->setValue(m_width);
×
67
}
×
68

69
AddVCSliderMatrix::~AddVCSliderMatrix()
×
70
{
71
    QSettings settings;
×
72
    settings.setValue(SETTINGS_GEOMETRY, saveGeometry());
×
73
}
×
74

75
int AddVCSliderMatrix::amount() const
×
76
{
77
    return m_amount;
×
78
}
79

80
int AddVCSliderMatrix::height() const
×
81
{
82
    return m_height;
×
83
}
84

85
int AddVCSliderMatrix::width() const
×
86
{
87
    return m_width;
×
88
}
89

90
void AddVCSliderMatrix::accept()
×
91
{
92
    m_amount = m_amountSpin->value();
×
93
    m_height = m_heightSpin->value();
×
94
    m_width = m_widthSpin->value();
×
95

96
    QSettings settings;
×
97
    QSize size(m_amount, m_height);
×
98
    settings.setValue(SETTINGS_SLIDER_MATRIX_SIZE, size);
×
99

100
    QDialog::accept();
×
101
}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc