File indexing completed on 2024-05-19 05:35:17

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