Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_dlg_paste_format.cpp
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2022 L. E. Segovia <amy@amyspark.me>
3 *
4 * SPDX-License-Identifier: LGPL-2.0-or-later
5 */
6
7#include <QPushButton>
9
10
12 : KoDialog(parent)
13 , wdg(new Ui_WdgPasteFormat)
14 , pasteSources()
15{
16 setObjectName("KisDlgPasteFormat");
17
18 setWindowTitle(i18nc("@title:window", "Multiple Paste Sources Detected"));
19
22 button(KoDialog::Ok)->setEnabled(false);
23 auto *page = new QWidget(this);
24 wdg->setupUi(page);
25 setMainWidget(page);
26
28 pasteSources.addButton(wdg->btnUseLocal, KisClipboard::PASTE_FORMAT_LOCAL);
29 pasteSources.addButton(wdg->btnUseBitmap, KisClipboard::PASTE_FORMAT_CLIP);
30 connect(&pasteSources, &QButtonGroup::idClicked, this, &KisDlgPasteFormat::onInputChanged);
31
32 wdg->btnDownload->setEnabled(false);
33 wdg->btnUseLocal->setEnabled(false);
34 wdg->btnUseBitmap->setEnabled(false);
35}
36
41
43{
44 bool isValid = pasteSources.checkedId() >= 0;
45 button(KoDialog::Ok)->setEnabled(isValid);
46}
47
49{
50 if (pasteSources.button(id)) {
51 pasteSources.button(id)->setEnabled(value);
52 }
53}
54
56{
57 return wdg->chkRemember->isChecked();
58}
float value(const T *src, size_t ch)
connect(this, SIGNAL(optionsChanged()), this, SLOT(saveOptions()))
KisDlgPasteFormat(QWidget *parent=nullptr)
KisClipboard::PasteFormatBehaviour source() const
Ui_WdgPasteFormat * wdg
void setSourceAvailable(KisClipboard::PasteFormatBehaviour id, bool value)
A dialog base class with standard buttons and predefined layouts.
Definition KoDialog.h:116
QPushButton * button(ButtonCode id) const
Definition KoDialog.cpp:591
void setMainWidget(QWidget *widget)
Definition KoDialog.cpp:354
void setButtons(ButtonCodes buttonMask)
Definition KoDialog.cpp:195
void setDefaultButton(ButtonCode id)
Definition KoDialog.cpp:302
@ Ok
Show Ok button. (this button accept()s the dialog; result set to QDialog::Accepted)
Definition KoDialog.h:127
@ Cancel
Show Cancel-button. (this button reject()s the dialog; result set to QDialog::Rejected)
Definition KoDialog.h:130