Debian Codegraph @

src/album/widgets/themewidget.cpp

raw
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 #include "themewidget.h"
22 #include "utils/baseutils.h"
23
24 #include "application.h"
25
26 ThemeWidget::ThemeWidget(const QString &darkFile, const QString &lightFile, QWidget *parent)
27 : QWidget(parent)
28 , m_darkStyle(utils::base::getFileContent(darkFile))
29 , m_lightStyle(utils::base::getFileContent(lightFile))
30 , m_deepMode(false)
31 {
32
33 // m_darkStyle = utils::base::getFileContent(darkFile);
34 // m_lightStyle = utils::base::getFileContent(lightFile);
35 onThemeChanged(dApp->viewerTheme->getCurrentTheme());
36
37 connect(dApp->viewerTheme, &ViewerThemeManager::viewerThemeChanged, this,
38 &ThemeWidget::onThemeChanged);
39 }
40
41 //bool ThemeWidget::isDeepMode()
42 //{
43 // return m_deepMode;
44 //}
45
46 ThemeWidget::~ThemeWidget() {}
47
48 void ThemeWidget::onThemeChanged(ViewerThemeManager::AppTheme theme)
49 {
50 if (theme == ViewerThemeManager::Dark) {
51 m_deepMode = true;
52 } else {
53 m_deepMode = false;
54 }
55 }
56
57 //ThemeScrollArea::ThemeScrollArea(const QString &darkFile, const QString &lightFile, QWidget *parent)
58 // : QScrollArea(parent)
59 // , m_darkStyle(utils::base::getFileContent(darkFile))
60 // , m_lightStyle(utils::base::getFileContent(lightFile))
61 // , m_deepMode(false)
62 //{
63 //// m_darkStyle = utils::base::getFileContent(darkFile);
64 //// m_lightStyle = utils::base::getFileContent(lightFile);
65 // onThemeChanged(dApp->viewerTheme->getCurrentTheme());
66
67 // connect(dApp->viewerTheme, &ViewerThemeManager::viewerThemeChanged, this,
68 // &ThemeScrollArea::onThemeChanged);
69 //}
70
71 //ThemeScrollArea::~ThemeScrollArea() {}
72
73 //void ThemeScrollArea::onThemeChanged(ViewerThemeManager::AppTheme theme)
74 //{
75 // if (theme == ViewerThemeManager::Dark) {
76 // m_deepMode = true;
77 // } else {
78 // m_deepMode = false;
79 // }
80 //}
81
82 //bool ThemeScrollArea::isDeepMode()
83 //{
84 // return m_deepMode;
85 //}