MythTV
master
mythplugins
mytharchive
mytharchive
editmetadata.cpp
Go to the documentation of this file.
1
2
// myth
3
#include <
libmyth/mythcontext.h
>
4
#include <
libmythui/mythuibutton.h
>
5
#include <
libmythui/mythuitext.h
>
6
#include <
libmythui/mythuitextedit.h
>
7
8
// mytharchive
9
#include "
editmetadata.h
"
10
11
bool
EditMetadataDialog::Create
(
void
)
12
{
13
// Load the theme for this screen
14
bool
foundtheme =
LoadWindowFromXML
(
"mythburn-ui.xml"
,
"edit_metadata"
,
this
);
15
if
(!foundtheme)
16
return
false
;
17
18
bool
err =
false
;
19
UIUtilE::Assign
(
this
,
m_titleEdit
,
"title_edit"
, &err);
20
UIUtilE::Assign
(
this
,
m_subtitleEdit
,
"subtitle_edit"
, &err);
21
UIUtilE::Assign
(
this
,
m_descriptionEdit
,
"description_edit"
, &err);
22
UIUtilE::Assign
(
this
,
m_starttimeEdit
,
"starttime_edit"
, &err);
23
UIUtilE::Assign
(
this
,
m_startdateEdit
,
"startdate_edit"
, &err);
24
UIUtilE::Assign
(
this
,
m_okButton
,
"ok_button"
, &err);
25
UIUtilE::Assign
(
this
,
m_cancelButton
,
"cancel_button"
, &err);
26
27
if
(err)
28
{
29
LOG
(VB_GENERAL, LOG_ERR,
"Cannot load screen 'edit_metadata'"
);
30
return
false
;
31
}
32
33
connect(
m_okButton
, &
MythUIButton::Clicked
,
this
, &
EditMetadataDialog::okPressed
);
34
connect(
m_cancelButton
, &
MythUIButton::Clicked
,
this
, &
EditMetadataDialog::cancelPressed
);
35
36
m_titleEdit
->
SetText
(
m_sourceMetadata
->
title
);
37
m_subtitleEdit
->
SetText
(
m_sourceMetadata
->
subtitle
);
38
m_descriptionEdit
->
SetText
(
m_sourceMetadata
->
description
);
39
m_startdateEdit
->
SetText
(
m_sourceMetadata
->
startDate
);
40
m_starttimeEdit
->
SetText
(
m_sourceMetadata
->
startTime
);
41
42
BuildFocusList
();
43
44
SetFocusWidget
(
m_titleEdit
);
45
46
return
true
;
47
}
48
49
bool
EditMetadataDialog::keyPressEvent
(QKeyEvent *event)
50
{
51
if
(
GetFocusWidget
()->
keyPressEvent
(event))
52
return
true
;
53
54
if
(
MythScreenType::keyPressEvent
(event))
55
return
true
;
56
57
return
false
;
58
}
59
60
void
EditMetadataDialog::okPressed
(
void
)
61
{
62
m_sourceMetadata
->
title
=
m_titleEdit
->
GetText
();
63
m_sourceMetadata
->
subtitle
=
m_subtitleEdit
->
GetText
();
64
m_sourceMetadata
->
startDate
=
m_startdateEdit
->
GetText
();
65
m_sourceMetadata
->
startTime
=
m_starttimeEdit
->
GetText
();
66
m_sourceMetadata
->
description
=
m_descriptionEdit
->
GetText
();
67
m_sourceMetadata
->
editedDetails
=
true
;
68
69
emit
haveResult
(
true
,
m_sourceMetadata
);
70
Close
();
71
}
72
73
void
EditMetadataDialog::cancelPressed
(
void
)
74
{
75
emit
haveResult
(
false
,
m_sourceMetadata
);
76
Close
();
77
}
MythUIButton::Clicked
void Clicked()
mythuitext.h
EditMetadataDialog::Create
bool Create() override
Definition:
editvideometadata.cpp:54
MythScreenType::Close
virtual void Close()
Definition:
mythscreentype.cpp:383
EditMetadataDialog::haveResult
void haveResult(bool ok, ArchiveItem *item)
ArchiveItem::startTime
QString startTime
Definition:
archiveutil.h:58
LOG
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Definition:
mythlogging.h:39
EditMetadataDialog::m_okButton
MythUIButton * m_okButton
Definition:
editmetadata.h:49
MythUITextEdit::GetText
QString GetText(void) const
Definition:
mythuitextedit.h:50
EditMetadataDialog::m_subtitleEdit
MythUITextEdit * m_subtitleEdit
Definition:
editvideometadata.h:94
ArchiveItem::title
QString title
Definition:
archiveutil.h:54
EditMetadataDialog::m_sourceMetadata
ArchiveItem * m_sourceMetadata
Definition:
editmetadata.h:41
MythScreenType::GetFocusWidget
MythUIType * GetFocusWidget(void) const
Definition:
mythscreentype.cpp:110
EditMetadataDialog::cancelPressed
void cancelPressed(void)
Definition:
editmetadata.cpp:73
MythUITextEdit::SetText
void SetText(const QString &text, bool moveCursor=true)
Definition:
mythuitextedit.cpp:198
EditMetadataDialog::m_cancelButton
MythUIButton * m_cancelButton
Definition:
editmetadata.h:48
MythScreenType::SetFocusWidget
bool SetFocusWidget(MythUIType *widget=nullptr)
Definition:
mythscreentype.cpp:115
MythScreenType::BuildFocusList
void BuildFocusList(void)
Definition:
mythscreentype.cpp:203
EditMetadataDialog::okPressed
void okPressed(void)
Definition:
editmetadata.cpp:60
ArchiveItem::startDate
QString startDate
Definition:
archiveutil.h:57
editmetadata.h
UIUtilDisp::Assign
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
Definition:
mythuiutils.h:27
MythScreenType::keyPressEvent
bool keyPressEvent(QKeyEvent *event) override
Key event handler.
Definition:
mythscreentype.cpp:401
ArchiveItem::description
QString description
Definition:
archiveutil.h:56
mythuitextedit.h
XMLParseBase::LoadWindowFromXML
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
Definition:
xmlparsebase.cpp:701
mythcontext.h
EditMetadataDialog::m_descriptionEdit
MythUITextEdit * m_descriptionEdit
Definition:
editmetadata.h:45
EditMetadataDialog::m_startdateEdit
MythUITextEdit * m_startdateEdit
Definition:
editmetadata.h:46
mythuibutton.h
ArchiveItem::subtitle
QString subtitle
Definition:
archiveutil.h:55
EditMetadataDialog::m_starttimeEdit
MythUITextEdit * m_starttimeEdit
Definition:
editmetadata.h:47
EditMetadataDialog::keyPressEvent
bool keyPressEvent(QKeyEvent *e) override
Key event handler.
Definition:
editmetadata.cpp:49
EditMetadataDialog::m_titleEdit
MythUITextEdit * m_titleEdit
Definition:
editvideometadata.h:93
ArchiveItem::editedDetails
bool editedDetails
Definition:
archiveutil.h:71
Generated on Sun Jan 19 2025 03:16:43 for MythTV by
1.8.17