File indexing completed on 2024-04-21 16:30:03

0001 /*
0002  * SPDX-FileCopyrightText: 2006 Peter Penz <peter.penz@gmx.at>
0003  * SPDX-FileCopyrightText: 2018 Elvis Angelaccio <elvis.angelaccio@kde.org>
0004  *
0005  * SPDX-License-Identifier: GPL-2.0-or-later
0006  */
0007 
0008 #ifndef VIEWPROPERTIESDIALOG_H
0009 #define VIEWPROPERTIESDIALOG_H
0010 
0011 #include "dolphin_export.h"
0012 
0013 #include <QDialog>
0014 
0015 class QCheckBox;
0016 class QListWidget;
0017 class QListWidgetItem;
0018 class QComboBox;
0019 class QPushButton;
0020 class QRadioButton;
0021 class ViewProperties;
0022 class DolphinView;
0023 
0024 /**
0025  * @brief Dialog for changing the current view properties of a directory.
0026  *
0027  * It is possible to specify the view mode, the sorting order, whether hidden files
0028  * and previews should be shown. The properties can be assigned to the current folder,
0029  * or recursively to all sub folders.
0030  */
0031 class DOLPHIN_EXPORT ViewPropertiesDialog : public QDialog
0032 {
0033     Q_OBJECT
0034 
0035 public:
0036     explicit ViewPropertiesDialog(DolphinView *dolphinView);
0037     ~ViewPropertiesDialog() override;
0038 
0039 public Q_SLOTS:
0040     void accept() override;
0041 
0042 private Q_SLOTS:
0043     void slotApply();
0044     void slotViewModeChanged(int index);
0045     void slotSortingChanged(int index);
0046     void slotSortOrderChanged(int index);
0047     void slotGroupedSortingChanged();
0048     void slotSortFoldersFirstChanged();
0049     void slotSortHiddenLastChanged();
0050     void slotShowPreviewChanged();
0051     void slotShowHiddenFilesChanged();
0052     void slotItemChanged(QListWidgetItem *item);
0053     void markAsDirty(bool isDirty);
0054 
0055 Q_SIGNALS:
0056     void isDirtyChanged(bool isDirty);
0057 
0058 private:
0059     void applyViewProperties();
0060     void loadSettings();
0061 
0062 private:
0063     bool m_isDirty;
0064     DolphinView *m_dolphinView;
0065     ViewProperties *m_viewProps;
0066 
0067     QComboBox *m_viewMode;
0068     QComboBox *m_sortOrder;
0069     QComboBox *m_sorting;
0070     QCheckBox *m_sortFoldersFirst;
0071     QCheckBox *m_sortHiddenLast;
0072     QCheckBox *m_previewsShown;
0073     QCheckBox *m_showInGroups;
0074     QCheckBox *m_showHiddenFiles;
0075     QRadioButton *m_applyToCurrentFolder;
0076     QRadioButton *m_applyToSubFolders;
0077     QRadioButton *m_applyToAllFolders;
0078     QCheckBox *m_useAsDefault;
0079     QListWidget *m_listWidget;
0080 };
0081 
0082 #endif