Krita Source Code Documentation
Loading...
Searching...
No Matches
recorder_profile_settings.cpp
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2020 Dmitrii Utkin <loentar@gmail.com>
3
*
4
* SPDX-License-Identifier: LGPL-2.1-only
5
*/
6
7
#include "
recorder_profile_settings.h
"
8
#include "
recorder_export_config.h
"
9
#include "ui_recorder_profile_settings.h"
10
11
#include <klocalizedstring.h>
12
#include <kstandardguiitem.h>
13
#include <
kis_icon_utils.h
>
14
15
namespace
16
{
17
enum
ArgumentsPageIndex
18
{
19
PageEdit,
20
PagePreview
21
};
22
}
23
24
25
RecorderProfileSettings::RecorderProfileSettings
(QWidget *parent)
26
: QDialog(parent)
27
, ui(new
Ui
::
RecorderProfileSettings
)
28
{
29
ui
->setupUi(
this
);
30
31
KGuiItem::assign(
ui
->buttonBox->button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
32
KGuiItem::assign(
ui
->buttonBox->button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
33
34
ui
->buttonPresetRevert->setIcon(
KisIconUtils::loadIcon
(
"edit-undo"
));
35
ui
->stackedWidget->setCurrentIndex(ArgumentsPageIndex::PageEdit);
36
37
connect(
ui
->labelSupportedVariables, SIGNAL(linkActivated(QString)),
this
, SLOT(
onLinkActivated
(QString)));
38
connect(
ui
->checkPreview, SIGNAL(toggled(
bool
)),
this
, SLOT(
onPreviewToggled
(
bool
)));
39
}
40
41
RecorderProfileSettings::~RecorderProfileSettings
()
42
{
43
delete
ui
;
44
}
45
46
bool
RecorderProfileSettings::editProfile
(
RecorderProfile
*profile,
const
RecorderProfile
&defaultProfile)
47
{
48
fillProfile
(*profile);
49
50
disconnect(
ui
->buttonPresetRevert);
51
connect(
ui
->buttonPresetRevert, &QPushButton::clicked,
this
, [&] { fillProfile(defaultProfile); });
52
53
if
(exec() != QDialog::Accepted)
54
return
false
;
55
56
profile->
name
=
ui
->editProfileName->text();
57
profile->
extension
=
ui
->editFileExtension->text();
58
profile->
arguments
=
ui
->editFfmpegArguments->toPlainText();
59
60
return
true
;
61
}
62
63
void
RecorderProfileSettings::setPreview
(
const
QString &preview)
64
{
65
ui
->editPreview->setPlainText(preview);
66
}
67
68
void
RecorderProfileSettings::onInputChanged
()
69
{
70
const
QString &name =
ui
->editProfileName->text();
71
const
QString &extension =
ui
->editFileExtension->text();
72
const
QString &arguments =
ui
->editFfmpegArguments->toPlainText();
73
74
bool
isValid = (!name.isEmpty()) && (!extension.isEmpty()) && (!arguments.isEmpty());
75
ui
->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(isValid);
76
}
77
78
void
RecorderProfileSettings::onLinkActivated
(
const
QString &link)
79
{
80
ui
->editFfmpegArguments->insertPlainText(link);
81
ui
->editFfmpegArguments->setFocus();
82
}
83
84
void
RecorderProfileSettings::onPreviewToggled
(
bool
checked)
85
{
86
if
(checked)
87
Q_EMIT
requestPreview
(
ui
->editFfmpegArguments->toPlainText());
88
89
ui
->stackedWidget->setCurrentIndex(checked ? ArgumentsPageIndex::PagePreview : ArgumentsPageIndex::PageEdit);
90
}
91
92
void
RecorderProfileSettings::fillProfile
(
const
RecorderProfile
&profile)
93
{
94
ui
->editProfileName->setText(profile.
name
);
95
ui
->editFileExtension->setText(profile.
extension
);
96
ui
->editFfmpegArguments->setPlainText(profile.
arguments
);
97
}
RecorderProfileSettings
Definition
recorder_profile_settings.h:20
RecorderProfileSettings::editProfile
bool editProfile(RecorderProfile *profile, const RecorderProfile &defaultProfile)
Definition
recorder_profile_settings.cpp:46
RecorderProfileSettings::onLinkActivated
void onLinkActivated(const QString &link)
Definition
recorder_profile_settings.cpp:78
RecorderProfileSettings::fillProfile
void fillProfile(const RecorderProfile &profile)
Definition
recorder_profile_settings.cpp:92
RecorderProfileSettings::onInputChanged
void onInputChanged()
Definition
recorder_profile_settings.cpp:68
RecorderProfileSettings::ui
Ui::RecorderProfileSettings * ui
Definition
recorder_profile_settings.h:44
RecorderProfileSettings::setPreview
void setPreview(const QString &preview)
Definition
recorder_profile_settings.cpp:63
RecorderProfileSettings::RecorderProfileSettings
RecorderProfileSettings(QWidget *parent=nullptr)
Definition
recorder_profile_settings.cpp:25
RecorderProfileSettings::onPreviewToggled
void onPreviewToggled(bool checked)
Definition
recorder_profile_settings.cpp:84
RecorderProfileSettings::requestPreview
void requestPreview(QString arguments)
RecorderProfileSettings::~RecorderProfileSettings
~RecorderProfileSettings()
Definition
recorder_profile_settings.cpp:41
kis_icon_utils.h
KisIconUtils::loadIcon
QIcon loadIcon(const QString &name)
Definition
kis_icon_utils.cpp:29
Ui
Definition
VideoExportOptionsDialog.h:18
recorder_export_config.h
recorder_profile_settings.h
RecorderProfile
Definition
recorder_export_settings.h:21
RecorderProfile::arguments
QString arguments
Definition
recorder_export_settings.h:24
RecorderProfile::extension
QString extension
Definition
recorder_export_settings.h:23
RecorderProfile::name
QString name
Definition
recorder_export_settings.h:22
plugins
dockers
recorder
recorder_profile_settings.cpp
Generated at
2026-12-01 02:30:03+01:00
from
Krita
branch
master
, commit
b26c9f3874ea47e043fb7787ab8ff9a3254784df