File indexing completed on 2025-01-26 05:06:23

0001 /*
0002     SPDX-FileCopyrightText: 2014 Eike Hein <hein@kde.org>
0003 
0004     SPDX-License-Identifier: GPL-2.0-or-later
0005 */
0006 
0007 #pragma once
0008 
0009 #include "folderplugin_private_export.h"
0010 #include <QObject>
0011 class QAction;
0012 class QActionGroup;
0013 class QMenu;
0014 
0015 class FOLDERPLUGIN_TESTS_EXPORT ViewPropertiesMenu : public QObject
0016 {
0017     Q_OBJECT
0018 
0019     Q_PROPERTY(QObject *menu READ menu CONSTANT)
0020 
0021     Q_PROPERTY(bool showLayoutActions READ showLayoutActions WRITE setShowLayoutActions NOTIFY showLayoutActionsChanged)
0022     Q_PROPERTY(bool showLockAction READ showLockAction WRITE setShowLockAction NOTIFY showLockActionChanged)
0023     Q_PROPERTY(bool showIconSizeActions READ showIconSizeActions WRITE setShowIconSizeActions NOTIFY showIconSizeActionsChanged)
0024 
0025     Q_PROPERTY(int arrangement READ arrangement WRITE setArrangement NOTIFY arrangementChanged)
0026     Q_PROPERTY(int alignment READ alignment WRITE setAlignment NOTIFY alignmentChanged)
0027     Q_PROPERTY(bool previews READ previews WRITE setPreviews NOTIFY previewsChanged)
0028     Q_PROPERTY(bool locked READ locked WRITE setLocked NOTIFY lockedChanged)
0029     Q_PROPERTY(bool lockedEnabled READ lockedEnabled WRITE setLockedEnabled NOTIFY lockedEnabledChanged)
0030     Q_PROPERTY(int sortMode READ sortMode WRITE setSortMode NOTIFY sortModeChanged)
0031     Q_PROPERTY(bool sortDesc READ sortDesc WRITE setSortDesc NOTIFY sortDescChanged)
0032     Q_PROPERTY(bool sortDirsFirst READ sortDirsFirst WRITE setSortDirsFirst NOTIFY sortDirsFirstChanged)
0033     Q_PROPERTY(int iconSize READ iconSize WRITE setIconSize NOTIFY iconSizeChanged)
0034 
0035 public:
0036     explicit ViewPropertiesMenu(QObject *parent = nullptr);
0037     ~ViewPropertiesMenu() override;
0038 
0039     QObject *menu() const;
0040 
0041     bool showLayoutActions() const;
0042     void setShowLayoutActions(bool show);
0043 
0044     bool showLockAction() const;
0045     void setShowLockAction(bool show);
0046 
0047     bool showIconSizeActions() const;
0048     void setShowIconSizeActions(bool show);
0049 
0050     int arrangement() const;
0051     void setArrangement(int arrangement);
0052 
0053     int alignment() const;
0054     void setAlignment(int alignment);
0055 
0056     bool previews() const;
0057     void setPreviews(bool previews);
0058 
0059     bool locked() const;
0060     void setLocked(bool locked);
0061 
0062     bool lockedEnabled() const;
0063     void setLockedEnabled(bool lockedEnabled);
0064 
0065     int sortMode() const;
0066     void setSortMode(int sortMode);
0067 
0068     bool sortDesc() const;
0069     void setSortDesc(bool sortDesc);
0070 
0071     bool sortDirsFirst() const;
0072     void setSortDirsFirst(bool sortDirsFirst);
0073 
0074     int iconSize() const;
0075     void setIconSize(int iconSize);
0076 
0077 Q_SIGNALS:
0078     void showLayoutActionsChanged() const;
0079     void showLockActionChanged() const;
0080     void showIconSizeActionsChanged();
0081     void arrangementChanged() const;
0082     void alignmentChanged() const;
0083     void previewsChanged() const;
0084     void lockedChanged() const;
0085     void lockedEnabledChanged() const;
0086     void sortModeChanged() const;
0087     void sortDescChanged() const;
0088     void sortDirsFirstChanged() const;
0089     void iconSizeChanged();
0090 
0091 private:
0092     QMenu *m_menu;
0093     QMenu *m_arrangementMenu;
0094     QActionGroup *m_arrangement;
0095     QMenu *m_alignmentMenu;
0096     QActionGroup *m_alignment;
0097     QActionGroup *m_sortMode;
0098     QMenu *m_iconSizeMenu;
0099     QActionGroup *m_iconSize;
0100     QAction *m_sortDesc;
0101     QAction *m_sortDirsFirst;
0102     QAction *m_previews;
0103     QAction *m_locked;
0104 };