| 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 |
|
| 22 |
#ifndef TOPTOOLBAR_H |
| 23 |
#define TOPTOOLBAR_H |
| 24 |
|
| 25 |
|
| 26 |
#include "controller/viewerthememanager.h" |
| 27 |
|
| 28 |
#include <QJsonObject> |
| 29 |
#include <QPointer> |
| 30 |
#include <DTitlebar> |
| 31 |
#include <DLabel> |
| 32 |
#include <QGraphicsDropShadowEffect> |
| 33 |
#include <DFontSizeManager> |
| 34 |
#include <DApplicationHelper> |
| 35 |
#include <DMenu> |
| 36 |
#include <DBlurEffectWidget> |
| 37 |
|
| 38 |
DWIDGET_USE_NAMESPACE |
| 39 |
|
| 40 |
class SettingsWindow; |
| 41 |
class QHBoxLayout; |
| 42 |
class QProcess; |
| 43 |
|
| 44 |
class TopToolbar : public DBlurEffectWidget |
| 45 |
{ |
| 46 |
Q_OBJECT |
| 47 |
public: |
| 48 |
TopToolbar(bool manager, QWidget *parent); |
| 49 |
|
| 50 |
protected: |
| 51 |
void mouseDoubleClickEvent(QMouseEvent *e) override; |
| 52 |
void paintEvent(QPaintEvent *e) override; |
| 53 |
|
| 54 |
signals: |
| 55 |
void updateMaxBtn(); |
| 56 |
|
| 57 |
private: |
| 58 |
enum MenuItemId { |
| 59 |
IdCreateAlbum, |
| 60 |
IdSwitchTheme, |
| 61 |
IdSetting, |
| 62 |
IdImport, |
| 63 |
IdHelp, |
| 64 |
IdAbout, |
| 65 |
IdQuick, |
| 66 |
IdSeparator |
| 67 |
}; |
| 68 |
void initMenu(); |
| 69 |
void initWidgets(); |
| 70 |
QString geteElidedText(QFont font, QString str, int MaxWidth); |
| 71 |
|
| 72 |
private slots: |
| 73 |
void onThemeTypeChanged(); |
| 74 |
void onUpdateFileName(const QString &filename); |
| 75 |
|
| 76 |
private: |
| 77 |
QColor m_coverBrush; |
| 78 |
QColor m_topBorderColor; |
| 79 |
QColor m_bottomBorderColor; |
| 80 |
QPointer<QProcess> m_manualPro; |
| 81 |
QHBoxLayout *m_layout = nullptr; |
| 82 |
QHBoxLayout *m_lLayout = nullptr; |
| 83 |
QHBoxLayout *m_mLayout = nullptr; |
| 84 |
QHBoxLayout *m_rLayout = nullptr; |
| 85 |
DTitlebar *m_titlebar = nullptr; |
| 86 |
DLabel *m_titletxt = nullptr; |
| 87 |
|
| 88 |
#ifndef LITE_DIV |
| 89 |
SettingsWindow *m_settingsWindow; |
| 90 |
#endif |
| 91 |
DMenu *m_menu; |
| 92 |
bool m_manager; |
| 93 |
}; |
| 94 |
|
| 95 |
#endif // TOPTOOLBAR_H |