Skip to content

Commit

Permalink
调整部分控件配色
Browse files Browse the repository at this point in the history
  • Loading branch information
gfdgd-xi committed Nov 26, 2024
1 parent 0365b9f commit b0dee33
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 13 deletions.
6 changes: 3 additions & 3 deletions dde-file-manager-lib/themes/dark/DFileManagerWindow.theme
Original file line number Diff line number Diff line change
Expand Up @@ -458,19 +458,19 @@ QScrollArea#ComputerView{
}

QScrollArea#ComputerView #TitleLabel {
color: #bdbdbd;
color: #67bdbdbd;
}

QScrollArea#ComputerView #LineLabel {
background-color: rgba(255, 255, 255, 0.1);
}

QScrollArea#ComputerView #DiskSize {
color: #616161;
color: #67616161;
}

QScrollArea#ComputerView ComputerViewItem QTextEdit {
color: #bdbdbd;
color: #67bdbdbd;
}

/*TabBar*/
Expand Down
4 changes: 2 additions & 2 deletions dde-file-manager-lib/themes/dark/DStatusBar.theme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DStatusBar {
color: "#bdbdbd";
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #171717, stop: 0.98 #1d1d1d);
color: "#67bdbdbd";
background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #171717, stop: 0.98 #671d1d1d);
border-top: 1px solid rgba(255, 255, 255, 0.1);
}

Expand Down
2 changes: 1 addition & 1 deletion dde-file-manager-lib/themes/dark/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ color=#70ffffff
color=white

[Tab]
background=#1c1c1c
background=#671c1c1c
color=#949494
border=#0d000000
[Tab:hover]
Expand Down
2 changes: 1 addition & 1 deletion dde-file-manager-lib/themes/light/DFileManagerWindow.theme
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ QScrollArea#ComputerView #LineLabel {
}

QScrollArea#ComputerView #DiskSize {
color: #a2a2a2;
color: #67a2a2a2;
}

/*TabBar*/
Expand Down
2 changes: 1 addition & 1 deletion dde-file-manager-lib/themes/light/DFileView.theme
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ QListView::item:hover {

QHeaderView {
background-color: qlineargradient(x1:0, y1:0, x2:0, y2:1,
stop:0 #f8f8f8, stop:1 rgba(255, 255, 255, 0.8));
stop:0 #f8f8f8, stop:1 rgba(255, 255, 255, 0.1));
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
max-height: 21px;
}
Expand Down
4 changes: 2 additions & 2 deletions dde-file-manager-lib/themes/light/DStatusBar.theme
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
DStatusBar {
color: "#797979";
background-color: white;
color: "#67797979";
background-color: "#67ffffff";
}

DStatusBar QLabel {
Expand Down
4 changes: 2 additions & 2 deletions dde-file-manager-lib/themes/light/config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -339,12 +339,12 @@ background=#da0076F9
color=#797979
[FileView:inactive]
background=#BFE4FC
color=#797979
color=#70797979
[FileView:inactive.checked]
color=#e9e9e9

[Tab]
background=#fafafa
background=#67fafafa
color=#949494
border=#21000000
[Tab:hover]
Expand Down
6 changes: 6 additions & 0 deletions dde-file-manager-lib/views/dfilemanagerwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@
DWIDGET_USE_NAMESPACE

const QColor DARK_TOP_BORDERCOLOR = QColor(255, 255, 255, 13);
const QColor LIGHT_TOP_BORDERCOLOR = QColor(0, 0, 0, 13);

std::unique_ptr<RecordRenameBarState> DFileManagerWindow::renameBarState{ nullptr };
std::atomic<bool> DFileManagerWindow::flagForNewWindowFromTab{ false };
Expand Down Expand Up @@ -950,6 +951,11 @@ void DFileManagerWindow::initTitleBar()
palette.setColor(QPalette::Window, DARK_TOP_BORDERCOLOR);
d->toolbar->setPalette(palette);
}
else {
QPalette palette;
palette.setColor(QPalette::Window, LIGHT_TOP_BORDERCOLOR);
d->toolbar->setPalette(palette);
}
connect(set_theme_action, &QAction::triggered, this, &DFileManagerWindow::onThemeChanged);
}

Expand Down
22 changes: 21 additions & 1 deletion dde-file-manager-lib/views/dfilemanagerwindowbackground.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ DFileManagerWindowBackground::DFileManagerWindowBackground(DMainWindow *window)

void DFileManagerWindowBackground::drawInWidget(QPainter *painter)
{
QString theme = DThemeManager::instance()->theme(m_dmainWindow);

QList<BackgroundPlace> list = {
BackgroundPlace::FullWindow,
BackgroundPlace::Center,
Expand All @@ -29,9 +31,27 @@ void DFileManagerWindowBackground::drawInWidget(QPainter *painter)
QList<int> xy = getImageXY(DFileManagerWindowBackground::BackgroundPlace(i));
int x = xy[0];
int y = xy[1];
qDebug() << i << x << y;
painter->drawImage(x, y, getImage(DFileManagerWindowBackground::BackgroundPlace(i)));
}
//// 绘制半透明图层
// 备份原来的 QPen 和 QBrush
QPen oldPen = painter->pen();
QBrush oldBrush = painter->brush();
if (theme == "dark") {
painter->setPen(QPen(QColor("#99252525")));
painter->setBrush(QBrush(QColor("#99252525")));
}
else {
painter->setPen(QPen(QColor("#99ffffff")));
painter->setBrush(QBrush(QColor("#99ffffff")));
}
int windowWidth = m_dmainWindow->size().width();
int windowHeight = m_dmainWindow->size().height();
painter->drawRect(0, 0, windowWidth, windowHeight);
// 还原原来的 QPen 和 QBrush
painter->setPen(oldPen);
painter->setBrush(oldBrush);

}

void DFileManagerWindowBackground::setMainWindow(DMainWindow *window)
Expand Down

0 comments on commit b0dee33

Please sign in to comment.