• 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/showmanager/timingstool.cpp
1
/*
2
  Q Light Controller Plus
3
  timingstool.cpp
4

5
  Copyright (C) Massimo Callegari
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 <QBoxLayout>
21
#include <QSettings>
22

23
#include "timingstool.h"
24
#include "speeddial.h"
25
#include "showitem.h"
26
#include "apputil.h"
27

28
#define WINDOW_FLAGS Qt::WindowFlags( \
29
    (Qt::CustomizeWindowHint | Qt::WindowTitleHint | Qt::Window | \
30
     Qt::WindowStaysOnTopHint | Qt::WindowMinimizeButtonHint | Qt::WindowCloseButtonHint))
31

32
#define SETTINGS_GEOMETRY "timingstool/geometry"
33

34
TimingsTool::TimingsTool(ShowItem *item, QWidget *parent)
×
35
    : QWidget(parent)
36
    , m_startDial(NULL)
×
37
    , m_durationDial(NULL)
×
38
    , m_item(item)
×
39
{
40
    Q_ASSERT(item != NULL);
41

42
    setWindowFlags(WINDOW_FLAGS);
×
43
    setAttribute(Qt::WA_DeleteOnClose);
×
44
    setWindowTitle(m_item->functionName());
×
45

46
    QBoxLayout* lay = new QBoxLayout(QBoxLayout::TopToBottom, this);
×
47

48
    /* Create dials */
49
    m_startDial = new SpeedDial(this);
×
50
    m_startDial->setTitle(tr("Start Time"));
×
51
    ushort dialMask = m_startDial->visibilityMask();
×
52
    dialMask = (dialMask & ~SpeedDial::Infinite);
53
    dialMask = (dialMask & ~SpeedDial::Tap);
×
54
    m_startDial->setVisibilityMask(dialMask);
×
55
    m_startDial->setValue(m_item->getStartTime());
×
56
    layout()->addWidget(m_startDial);
×
57
    connect(m_startDial, SIGNAL(valueChanged(int)),
×
58
            this, SLOT(slotStartTimeChanged(int)));
59

60
    m_durationDial = new SpeedDial(this);
×
61
    m_durationDial->setTitle(tr("Duration"));
×
62
    m_durationDial->setVisibilityMask(dialMask);
×
63
    m_durationDial->setValue(m_item->getDuration());
×
64
    layout()->addWidget(m_durationDial);
×
65
    connect(m_durationDial, SIGNAL(valueChanged(int)),
×
66
            this, SLOT(slotDurationChanged(int)));
67

68
    m_durationOptions = new QGroupBox(tr("Duration options"));
×
69

70
    m_stretchOriginalRadio = new QRadioButton(tr("Stretch the original function duration"));
×
71
    m_expandLoopRadio = new QRadioButton(tr("Loop function until duration is reached"));
×
72
    m_expandLoopRadio->setChecked(true);
×
73

74
    m_durationOptions->setLayout(new QVBoxLayout());
×
75
    m_durationOptions->layout()->addWidget(m_stretchOriginalRadio);
×
76
    m_durationOptions->layout()->addWidget(m_expandLoopRadio);
×
77
    m_durationOptions->hide();
×
78
    layout()->addWidget(m_durationOptions);
×
79

80
    lay->addStretch();
×
81

82
    /* Position */
83
    QSettings settings;
×
84
    QVariant var = settings.value(SETTINGS_GEOMETRY);
×
85
    if (var.isValid() == true)
×
86
        this->restoreGeometry(var.toByteArray());
×
87
    AppUtil::ensureWidgetIsVisible(this);
×
88
}
×
89

90
TimingsTool::~TimingsTool()
×
91
{
92
    QSettings settings;
×
93
    settings.setValue(SETTINGS_GEOMETRY, saveGeometry());
×
94
}
×
95

96
void TimingsTool::showDurationControls(bool show)
×
97
{
98
    if (show == true)
×
99
        m_durationDial->show();
×
100
    else
101
        m_durationDial->hide();
×
102
}
×
103

104
void TimingsTool::showDurationOptions(bool show)
×
105
{
106
    if (show == true)
×
107
        m_durationOptions->show();
×
108
    else
109
        m_durationOptions->hide();
×
110
}
×
111

112
void TimingsTool::slotStartTimeChanged(int msec)
×
113
{
114
    emit startTimeChanged(m_item, msec);
×
115
}
×
116

117
void TimingsTool::slotDurationChanged(int msec)
×
118
{
119
    if (m_stretchOriginalRadio->isChecked())
×
120
        emit durationChanged(m_item, msec, true);
×
121
    else
122
        emit durationChanged(m_item, msec, false);
×
123
}
×
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