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

0001 //////////////////////////////////////////////////////////////////////////////
0002 // breezeexceptionlistwidget.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 "breezeexceptionmodel.h"
0013 #include "ui_breezeexceptionlistwidget.h"
0014 
0015 //* QDialog used to commit selected files
0016 namespace Breeze
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();
0032 
0033     //* true if changed
0034     virtual bool isChanged() const
0035     {
0036         return m_changed;
0037     }
0038 
0039 Q_SIGNALS:
0040 
0041     //* emitted when changed
0042     void changed(bool);
0043 
0044 protected:
0045     //* model
0046     const ExceptionModel &model() const
0047     {
0048         return m_model;
0049     }
0050 
0051     //* model
0052     ExceptionModel &model()
0053     {
0054         return m_model;
0055     }
0056 
0057 protected Q_SLOTS:
0058 
0059     //* update button states
0060     virtual void updateButtons();
0061 
0062     //* add
0063     virtual void add();
0064 
0065     //* edit
0066     virtual void edit();
0067 
0068     //* remove
0069     virtual void remove();
0070 
0071     //* toggle
0072     virtual void toggle(const QModelIndex &);
0073 
0074     //* move up
0075     virtual void up();
0076 
0077     //* move down
0078     virtual void down();
0079 
0080 protected:
0081     //* resize columns
0082     void resizeColumns() const;
0083 
0084     //* check exception
0085     bool checkException(InternalSettingsPtr);
0086 
0087     //* set changed state
0088     virtual void setChanged(bool value)
0089     {
0090         m_changed = value;
0091         emit changed(value);
0092     }
0093 
0094 private:
0095     //* model
0096     ExceptionModel m_model;
0097 
0098     //* ui
0099     Ui_BreezeExceptionListWidget m_ui;
0100 
0101     //* changed state
0102     bool m_changed = false;
0103 };
0104 
0105 }