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

0001 #ifndef oxygenexceptionlistwidget_h
0002 #define oxygenexceptionlistwidget_h
0003 //////////////////////////////////////////////////////////////////////////////
0004 // oxygenexceptionlistwidget.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 "oxygenexceptionmodel.h"
0013 #include "ui_oxygenexceptionlistwidget.h"
0014 
0015 //* QDialog used to commit selected files
0016 namespace Oxygen
0017 {
0018 class ExceptionListWidget : public QWidget
0019 {
0020     //* Qt meta object
0021     Q_OBJECT
0022 
0023 public:
0024     //* constructor
0025     explicit ExceptionListWidget(QWidget * = nullptr);
0026 
0027     //* set exceptions
0028     void setExceptions(const InternalSettingsList &);
0029 
0030     //* get exceptions
0031     InternalSettingsList exceptions(void);
0032 
0033     //* true if changed
0034     bool isChanged(void) const
0035     {
0036         return m_changed;
0037     }
0038 
0039 Q_SIGNALS:
0040 
0041     //* emitted when changed
0042     void changed(bool);
0043 
0044 private Q_SLOTS:
0045 
0046     //* update button states
0047     void updateButtons(void);
0048 
0049     //* add
0050     void add(void);
0051 
0052     //* edit
0053     void edit(void);
0054 
0055     //* remove
0056     void remove(void);
0057 
0058     //* toggle
0059     void toggle(const QModelIndex &);
0060 
0061     //* move up
0062     void up(void);
0063 
0064     //* move down
0065     void down(void);
0066 
0067 private:
0068     //* resize columns
0069     void resizeColumns(void) const;
0070 
0071     //* check exception
0072     bool checkException(InternalSettingsPtr);
0073 
0074     //* set changed state
0075     virtual void setChanged(bool value)
0076     {
0077         m_changed = value;
0078         emit changed(value);
0079     }
0080 
0081     //* model
0082     const ExceptionModel &model() const
0083     {
0084         return m_model;
0085     }
0086 
0087     //* model
0088     ExceptionModel &model()
0089     {
0090         return m_model;
0091     }
0092 
0093     //* model
0094     ExceptionModel m_model;
0095 
0096     //* ui
0097     Ui_OxygenExceptionListWidget m_ui;
0098 
0099     //* changed state
0100     bool m_changed = false;
0101 };
0102 }
0103 
0104 #endif