| 1 |
/* |
| 2 |
* Copyright (C) 2020 ~ 2021 Uniontech Software Technology Co., Ltd. |
| 3 |
* |
| 4 |
* Author: ZhangYong <[email protected]> |
| 5 |
* |
| 6 |
* Maintainer: ZhangYong <[email protected]> |
| 7 |
* |
| 8 |
* This program is free software: you can redistribute it and/or modify |
| 9 |
* it under the terms of the GNU General Public License as published by |
| 10 |
* the Free Software Foundation, either version 3 of the License, or |
| 11 |
* any later version. |
| 12 |
* |
| 13 |
* This program is distributed in the hope that it will be useful, |
| 14 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 |
* GNU General Public License for more details. |
| 17 |
* |
| 18 |
* You should have received a copy of the GNU General Public License |
| 19 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 20 |
*/ |
| 21 |
#ifndef LEFTLISTVIEW_H |
| 22 |
#define LEFTLISTVIEW_H |
| 23 |
|
| 24 |
#include "dialogs/albumdeletedialog.h" |
| 25 |
#include "albumimagebutton.h" |
| 26 |
#include "leftlistwidget.h" |
| 27 |
|
| 28 |
#include <DScrollArea> |
| 29 |
#include <DWidget> |
| 30 |
#include <DLabel> |
| 31 |
#include <DListWidget> |
| 32 |
#include <DMenu> |
| 33 |
|
| 34 |
DWIDGET_USE_NAMESPACE |
| 35 |
|
| 36 |
class LeftListView : public DScrollArea |
| 37 |
{ |
| 38 |
Q_OBJECT |
| 39 |
public: |
| 40 |
enum MenuItemId { |
| 41 |
IdStartSlideShow, |
| 42 |
IdCreateAlbum, |
| 43 |
IdRenameAlbum, |
| 44 |
IdExport, |
| 45 |
IdDeleteAlbum, |
| 46 |
}; |
| 47 |
|
| 48 |
explicit LeftListView(QWidget *parent = nullptr); |
| 49 |
QString getItemCurrentName(); |
| 50 |
QString getItemCurrentType(); |
| 51 |
int getItemDataType(); |
| 52 |
void updatePhotoListView(); |
| 53 |
void updateAlbumItemsColor(); |
| 54 |
void updateCustomizeListView(); |
| 55 |
|
| 56 |
private: |
| 57 |
void initUI(); |
| 58 |
void initMenu(); |
| 59 |
void initConnections(); |
| 60 |
void showMenu(const QPoint &pos); |
| 61 |
void appendAction(int id, const QString &text, const QString &shortcut); |
| 62 |
QString getNewAlbumName(); |
| 63 |
void resizeEvent(QResizeEvent *e) Q_DECL_OVERRIDE; |
| 64 |
signals: |
| 65 |
void itemClicked(); |
| 66 |
//幻灯片播放 |
| 67 |
void sigSlideShow(QString path); |
| 68 |
void sigKeyDelete(); |
| 69 |
void sigKeyF2(); |
| 70 |
void updateCurrentItemType(int type); |
| 71 |
void sigLeftTabClicked(); |
| 72 |
|
| 73 |
public slots: |
| 74 |
void onMenuClicked(QAction *action); |
| 75 |
void onUpdateLeftListview(); |
| 76 |
void onPhotoLibListViewPressed(const QModelIndex &index); |
| 77 |
void onCustomListViewPressed(const QModelIndex &index); |
| 78 |
void onMountListViewPressed(const QModelIndex &index); |
| 79 |
void onPhotoLibListViewCurrentItemChanged(); |
| 80 |
void onCustomizeListViewCurrentItemChanged(); |
| 81 |
void onMountListWidgetCurrentItemChanged(); |
| 82 |
void onAddListBtnClicked(); |
| 83 |
void onApplicationHelperThemeTypeChanged(); |
| 84 |
void onGuiApplicationHelperThemeTypeChanged(); |
| 85 |
void onMousePressIsNoValid(); |
| 86 |
|
| 87 |
public: |
| 88 |
|
| 89 |
// 照片库 |
| 90 |
DLabel *m_pPhotoLibLabel; |
| 91 |
LeftListWidget *m_pPhotoLibListView; |
| 92 |
|
| 93 |
// 相册列表 |
| 94 |
DLabel *m_pCustomizeLabel; |
| 95 |
AlbumImageButton *m_pAddListBtn; |
| 96 |
LeftListWidget *m_pCustomizeListView; |
| 97 |
|
| 98 |
// 设备 |
| 99 |
DLabel *m_pMountLabel; |
| 100 |
LeftListWidget *m_pMountListWidget; |
| 101 |
DWidget *m_pMountWidget; |
| 102 |
|
| 103 |
private: |
| 104 |
QString m_ItemCurrentName; |
| 105 |
QString m_ItemCurrentType; |
| 106 |
int m_ItemCurrentDataType; |
| 107 |
DMenu *m_pMenu; |
| 108 |
QMap<QString, QAction *> m_MenuActionMap; |
| 109 |
AlbumDeleteDialog *deletDialg; |
| 110 |
}; |
| 111 |
|
| 112 |
#endif // LEFTLISTVIEW_H |