Warning, file /plasma/latte-dock/app/settings/screensdialog/screensdialog.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /*
0002     SPDX-FileCopyrightText: 2021 Michail Vourlakos <mvourlakos@gmail.com>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #include "screensdialog.h"
0007 
0008 // local
0009 #include "ui_screensdialog.h"
0010 #include "screenshandler.h"
0011 #include "../settingsdialog/layoutscontroller.h"
0012 #include "../../layouts/manager.h"
0013 #include "../../layouts/synchronizer.h"
0014 
0015 namespace Latte {
0016 namespace Settings {
0017 namespace Dialog {
0018 
0019 ScreensDialog::ScreensDialog(SettingsDialog *parent, Controller::Layouts *controller)
0020     : GenericDialog(parent),
0021       m_ui(new Ui::ScreensDialog),
0022       m_layoutsController(controller)
0023 {
0024     setAttribute(Qt::WA_DeleteOnClose, true);
0025     m_corona = parent->corona();
0026 
0027     init();
0028     initRemoveNowButton();
0029     //! we must create handlers after creating/adjusting the ui
0030     m_handler = new Handler::ScreensHandler(this);
0031     initSignals();
0032 }
0033 
0034 ScreensDialog::~ScreensDialog()
0035 {
0036 }
0037 
0038 Latte::Corona *ScreensDialog::corona() const
0039 {
0040     return m_corona;
0041 }
0042 
0043 Ui::ScreensDialog *ScreensDialog::ui() const
0044 {
0045     return m_ui;
0046 }
0047 
0048 Controller::Layouts *ScreensDialog::layoutsController() const
0049 {
0050     return m_layoutsController;
0051 }
0052 
0053 void ScreensDialog::init()
0054 {
0055     //! first we need to setup the ui
0056     m_ui->setupUi(this);
0057     initButtons();
0058 }
0059 
0060 void ScreensDialog::initButtons()
0061 {
0062     connect(m_ui->buttonBox->button(QDialogButtonBox::Cancel), &QPushButton::clicked,
0063             this, &ScreensDialog::onCancel);
0064 }
0065 
0066 void ScreensDialog::initRemoveNowButton()
0067 {
0068     m_removeNowButton = new QPushButton(this);
0069     m_removeNowButton->setText(i18nc("remove selected screens", "Remove Now"));
0070     m_removeNowButton->setIcon(QIcon::fromTheme("edit-delete"));
0071     m_removeNowButton->setToolTip(i18n("Remove selected screen references"));
0072 
0073     m_ui->buttonBox->addButton(m_removeNowButton, QDialogButtonBox::AcceptRole);
0074 }
0075 
0076 void ScreensDialog::initSignals()
0077 {
0078     //connect(m_handler, &Handler::ExportTemplateHandler::dataChanged, this, &ScreensDialog::onDataChanged);
0079     //connect(m_handler, &Handler::ExportTemplateHandler::exportSucceeded, this, &ScreensDialog::onExportSucceeded);
0080 }
0081 
0082 QPushButton *ScreensDialog::removeNowButton() const
0083 {
0084     return m_removeNowButton;
0085 }
0086 
0087 void ScreensDialog::onDataChanged()
0088 {
0089 }
0090 
0091 
0092 void ScreensDialog::accept()
0093 {
0094     qDebug() << Q_FUNC_INFO;
0095     //close();
0096 }
0097 
0098 void ScreensDialog::onCancel()
0099 {
0100     qDebug() << Q_FUNC_INFO;
0101     close();
0102 }
0103 
0104 void ScreensDialog::onReset()
0105 {
0106     qDebug() << Q_FUNC_INFO;
0107 }
0108 
0109 }
0110 }
0111 }