File indexing completed on 2024-05-12 05:28:35

0001 //////////////////////////////////////////////////////////////////////////////
0002 // breezeexceptiondialog.h
0003 // -------------------
0004 //
0005 // SPDX-FileCopyrightText: 2009 Hugo Pereira Da Costa <hugo.pereira@free.fr>
0006 //
0007 // SPDX-License-Identifier: MIT
0008 //////////////////////////////////////////////////////////////////////////////
0009 
0010 #pragma once
0011 
0012 #include "breeze.h"
0013 #include "ui_breezeexceptiondialog.h"
0014 
0015 #include <QCheckBox>
0016 #include <QMap>
0017 
0018 namespace Breeze
0019 {
0020 class DetectDialog;
0021 
0022 //* breeze exceptions list
0023 class ExceptionDialog : public QDialog
0024 {
0025     Q_OBJECT
0026 
0027 public:
0028     //* constructor
0029     explicit ExceptionDialog(QWidget *parent);
0030 
0031     //* destructor
0032     virtual ~ExceptionDialog()
0033     {
0034     }
0035 
0036     //* set exception
0037     void setException(InternalSettingsPtr);
0038 
0039     //* save exception
0040     void save();
0041 
0042     //* true if changed
0043     virtual bool isChanged() const
0044     {
0045         return m_changed;
0046     }
0047 
0048 Q_SIGNALS:
0049 
0050     //* emitted when changed
0051     void changed(bool);
0052 
0053 protected:
0054     //* set changed state
0055     virtual void setChanged(bool value)
0056     {
0057         m_changed = value;
0058         emit changed(value);
0059     }
0060 
0061 protected Q_SLOTS:
0062 
0063     //* check whether configuration is changed and emit appropriate signal if yes
0064     virtual void updateChanged();
0065 
0066 private Q_SLOTS:
0067 
0068     //* select window properties from grabbed pointers
0069     void selectWindowProperties();
0070 
0071     //* read properties of selected window
0072     void readWindowProperties(bool);
0073 
0074 private:
0075     //* map mask and checkbox
0076     using CheckBoxMap = QMap<ExceptionMask, QCheckBox *>;
0077 
0078     Ui::BreezeExceptionDialog m_ui;
0079 
0080     //* map mask and checkbox
0081     CheckBoxMap m_checkboxes;
0082 
0083     //* internal exception
0084     InternalSettingsPtr m_exception;
0085 
0086     //* detection dialog
0087     DetectDialog *m_detectDialog = nullptr;
0088 
0089     //* changed state
0090     bool m_changed = false;
0091 };
0092 
0093 }