-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
120 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/*#include "dfmbackgroundsettingdialog.h" | ||
#include <QGridLayout> | ||
#include <QFileDialog> | ||
DFMBackgroundSettingDialog::DFMBackgroundSettingDialog(QWidget *parent) : DDialog(parent) | ||
{ | ||
for (QString i: m_backgroundManager.m_imageTranslateList) { | ||
QPushButton *button = new QPushButton(this); | ||
button->setText(i); | ||
button->setToolTip(tr("Set background: ") + i); | ||
m_settingButtonList.append(button); | ||
connect(button, &QPushButton::clicked, this, &DFMBackgroundSettingDialog::setBackgroundButtonClick); | ||
} | ||
for (int i = 0; i < 9; ++i) { | ||
m_mainLayout.addWidget(m_settingButtonList[i], i / 3, i % 3); | ||
} | ||
m_mainWidget.setLayout(&m_mainLayout); | ||
// 添加 QWidget 至 DDialog | ||
addContent(&m_mainWidget, Qt::AlignmentFlag::AlignCenter); | ||
} | ||
void DFMBackgroundSettingDialog::setBackgroundButtonClick() | ||
{ | ||
QPushButton *clickedButton = static_cast<QPushButton *>(sender()); | ||
int buttonIndex = -1; | ||
// 寻找点击按钮对应的编号 | ||
for (int i = 0; i < m_settingButtonList.count(); ++i) { | ||
if (m_settingButtonList[i] == clickedButton) { | ||
buttonIndex = i; | ||
break; | ||
} | ||
} | ||
if (buttonIndex == -1) { | ||
return; | ||
} | ||
// 获取位置 | ||
QString place = m_backgroundManager.m_imageList.at(buttonIndex); | ||
QString filePath = QFileDialog::getOpenFileName(this, "", QDir::homePath(), "图像文件 (*.jpg);;所有文件 (*.*)"); | ||
if (filePath == NULL || filePath == "") { | ||
return; | ||
} | ||
setBackground(filePath, "light", place); | ||
setBackground(filePath, "dark", place); | ||
} | ||
void DFMBackgroundSettingDialog::setBackground(QString filePath, QString theme, QString place) | ||
{ | ||
} | ||
// 释放内存 | ||
DFMBackgroundSettingDialog::~DFMBackgroundSettingDialog() | ||
{ | ||
for (QPushButton *i: m_settingButtonList) { | ||
delete i; | ||
} | ||
}*/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
#ifndef DFMBACKGROUNDSETTINGDIALOG_H | ||
#define DFMBACKGROUNDSETTINGDIALOG_H | ||
|
||
/*#include <ddialog.h> | ||
#include <QGridLayout> | ||
#include <QPushButton> | ||
#include "dfilemanagerwindowbackground.h" | ||
DWIDGET_USE_NAMESPACE | ||
class DFMBackgroundSettingDialog: public DDialog | ||
{ | ||
public: | ||
DFMBackgroundSettingDialog(QWidget *parent); | ||
~DFMBackgroundSettingDialog(); | ||
private: | ||
void setBackgroundButtonClick(); | ||
void setBackground(QString filePath, QString theme, QString place); | ||
QWidget m_mainWidget; | ||
QGridLayout m_mainLayout; | ||
QList<QPushButton *> m_settingButtonList; | ||
DFileManagerWindowBackground m_backgroundManager; | ||
};*/ | ||
|
||
|
||
#endif // DFMBACKGROUNDSETTINGDIALOG_H |