Added confirmation for Upload (#2037)
This commit is contained in:
@@ -13,6 +13,7 @@ target_sources(
|
||||
orientablepushbutton.h
|
||||
historywidget.h
|
||||
updatenotificationwidget.h
|
||||
imguruploaddialog.h
|
||||
capture/capturetoolobjects.h
|
||||
)
|
||||
|
||||
@@ -27,5 +28,6 @@ target_sources(
|
||||
orientablepushbutton.cpp
|
||||
historywidget.cpp
|
||||
updatenotificationwidget.cpp
|
||||
imguruploaddialog.cpp
|
||||
capture/capturetoolobjects.cpp
|
||||
)
|
||||
|
||||
43
src/widgets/imguruploaddialog.cpp
Normal file
43
src/widgets/imguruploaddialog.cpp
Normal file
@@ -0,0 +1,43 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
||||
|
||||
#include "imguruploaddialog.h"
|
||||
#include "src/utils/confighandler.h"
|
||||
#include <QCheckBox>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QLabel>
|
||||
#include <QVBoxLayout>
|
||||
|
||||
ImgurUploadDialog::ImgurUploadDialog(QDialog* parent)
|
||||
: QDialog(parent)
|
||||
{
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
setMinimumSize(400, 120);
|
||||
setWindowIcon(QIcon(":img/app/flameshot.svg"));
|
||||
setWindowTitle(tr("Upload Confirmation"));
|
||||
|
||||
layout = new QVBoxLayout(this);
|
||||
|
||||
m_uploadLabel =
|
||||
new QLabel(tr("Do you want to upload this capture to Imgur?"), this);
|
||||
|
||||
layout->addWidget(m_uploadLabel);
|
||||
|
||||
buttonBox =
|
||||
new QDialogButtonBox(QDialogButtonBox::Yes | QDialogButtonBox::No);
|
||||
|
||||
connect(buttonBox, &QDialogButtonBox::accepted, this, &QDialog::accept);
|
||||
connect(buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
|
||||
|
||||
layout->addWidget(buttonBox);
|
||||
|
||||
m_uploadWithoutConfirmation =
|
||||
new QCheckBox(tr("Upload to Imgur without confirmation"), this);
|
||||
m_uploadWithoutConfirmation->setToolTip(
|
||||
tr("Upload to Imgur without confirmation"));
|
||||
connect(m_uploadWithoutConfirmation, &QCheckBox::clicked, [](bool checked) {
|
||||
ConfigHandler().setUploadWithoutConfirmation(checked);
|
||||
});
|
||||
|
||||
layout->addWidget(m_uploadWithoutConfirmation);
|
||||
}
|
||||
24
src/widgets/imguruploaddialog.h
Normal file
24
src/widgets/imguruploaddialog.h
Normal file
@@ -0,0 +1,24 @@
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
// SPDX-FileCopyrightText: 2017-2019 Alejandro Sirgo Rica & Contributors
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <QDialog>
|
||||
|
||||
class QCheckBox;
|
||||
class QLabel;
|
||||
class QDialogButtonBox;
|
||||
class QVBoxLayout;
|
||||
|
||||
class ImgurUploadDialog : public QDialog
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit ImgurUploadDialog(QDialog* parent = nullptr);
|
||||
|
||||
private:
|
||||
QCheckBox* m_uploadWithoutConfirmation;
|
||||
QLabel* m_uploadLabel;
|
||||
QDialogButtonBox* buttonBox;
|
||||
QVBoxLayout* layout;
|
||||
};
|
||||
Reference in New Issue
Block a user