-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConfigureDialog.cpp
More file actions
78 lines (64 loc) · 2.33 KB
/
ConfigureDialog.cpp
File metadata and controls
78 lines (64 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#include "ConfigureDialog.h"
#include <QQmlComponent>
#include <QQmlContext>
#include "SoundListModelItem.h"
ConfigureDialog::ConfigureDialog(QObject *parent, QQmlApplicationEngine *engine)
: QObject{parent}
, m_pView(NULL)
, m_pEngine(engine)
{
m_pView = new QQuickWindow();
}
void ConfigureDialog::Show()
{
if ( m_pView == NULL ) { return; }
QQmlComponent comp(m_pEngine, QUrl(QStringLiteral("qrc:/SettingDialog.qml")));
m_pView = qobject_cast<QQuickWindow*>(comp.create(m_pEngine->rootContext()));
connect(m_pView, SIGNAL(emit_changeColor(QColor)), this, SLOT(Slot_GetColor(QColor)), Qt::UniqueConnection);
connect(m_pView, SIGNAL(emit_changeOpcaity(double)), this, SLOT(Slot_GetOpacity(double)), Qt::UniqueConnection);
connect(m_pView, SIGNAL(emit_changeAlwaysOnTop(bool)), this, SLOT(Slot_GetAlwaysOnTop(bool)), Qt::UniqueConnection);
connect(m_pView, SIGNAL(emit_changeAlarmSound(QString)), this, SLOT(Slot_GetAlarmSound(QString)), Qt::UniqueConnection);
connect(m_pView, SIGNAL(closing(QQuickCloseEvent*)), this, SLOT(Slot_Close()), Qt::UniqueConnection);
m_pEngine->rootContext()->setContextProperty("contorlDlg",this);
m_pView->show();
if ( m_pEngine->rootObjects().count() < 1 ) { return; }
QQuickWindow* pObject = qobject_cast<QQuickWindow*>(m_pEngine->rootObjects().value(0));
int x = m_pView->geometry().x() + pObject->width();
m_pView->setX(x);
}
void ConfigureDialog::SetSettingValue(TimerSetting &setValue)
{
m_pView->setProperty("backColor", setValue.color);
m_pView->setProperty("dOpacity", setValue.opacity);
m_pView->setProperty("bAlwaysOnTop", setValue.bAlwaysOnTop);
m_pView->setProperty("sAlarmSound", setValue.sAlarmSound);
qDebug() << setValue.sAlarmSound;
}
void ConfigureDialog::Slot_GetColor(QColor color)
{
emit Emit_setColor(color);
}
void ConfigureDialog::Slot_GetOpacity(double dOpacity)
{
emit Emit_setOpacity(dOpacity);
}
void ConfigureDialog::Slot_GetAlwaysOnTop(bool bChecked)
{
emit Emit_setAlwaysOnTop(bChecked);
}
void ConfigureDialog::Slot_GetAlarmSound(QString sAlarm)
{
emit Emit_setAlarmSound(sAlarm);
qDebug() << "get" << sAlarm;
}
void ConfigureDialog::Slot_Close()
{
emit Emit_Close();
}
ConfigureDialog::~ConfigureDialog()
{
if ( m_pView != NULL ) {
delete m_pView;
m_pView = NULL;
}
}