Merge branch 'upstream' into openkylin/yangtze
This commit is contained in:
commit
c7ab8e8c05
|
@ -76,7 +76,7 @@ void MobileFileSecondWidget::initUI()
|
|||
crumb->addTab(tr("QQ")); // QQ
|
||||
}
|
||||
crumb->setCurrentIndex(1);
|
||||
crumb->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
// crumb->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
|
||||
|
||||
//模式
|
||||
m_modeButton = new QPushButton(this);
|
||||
|
@ -280,3 +280,12 @@ void MobileFileSecondWidget::slotDocumentButtonClicked()
|
|||
Q_EMIT sigItemButtonClicked(SECOND_FILE_LIST_TYPE::QQDOCUMENT);
|
||||
}
|
||||
}
|
||||
|
||||
void MobileFileSecondWidget::setTheme(PublicAttributes::Theme theme)
|
||||
{
|
||||
for (int i = 0; i < 4; i++) {
|
||||
MobileFileListItem *fileListItem = dynamic_cast<MobileFileListItem *>
|
||||
(m_fileSecondListWidget->itemWidget(m_fileSecondListWidget->item(i)));
|
||||
fileListItem->setTheme(theme);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ public:
|
|||
enum SECOND_FILE_LIST_WIN_TYPE {WECHAT = 12, QQ, HOMEPAGE};
|
||||
//设置项的个数
|
||||
void setItemCount(const QMap<QString, int> &map);
|
||||
void setTheme(PublicAttributes::Theme theme);
|
||||
|
||||
private Q_SLOTS:
|
||||
//模式切换
|
||||
void slotModeButtonClicked();
|
||||
|
@ -30,6 +32,7 @@ private Q_SLOTS:
|
|||
void slotMusicButtonClicked();
|
||||
//文档项
|
||||
void slotDocumentButtonClicked();
|
||||
|
||||
Q_SIGNALS:
|
||||
void sigShowMobileFileListWidget();
|
||||
void sigHideCopyToComputerWidget();
|
||||
|
|
|
@ -340,35 +340,7 @@ void MobileFileWidget::initUI()
|
|||
});
|
||||
|
||||
connect(m_refreshButton, &QPushButton::clicked, this, [=]() {
|
||||
if (m_text == tr("QQ") + "/" + tr("Picture")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::QQPICTURE);
|
||||
} else if (m_text == tr("QQ") + "/" + tr("Video")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::QQVIDEO);
|
||||
} else if (m_text == tr("QQ") + "/" + tr("Music")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::QQMUSIC);
|
||||
} else if (m_text == tr("QQ") + "/" + tr("Document")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::QQDOCUMENT);
|
||||
} else if (m_text == tr("WeChat") + "/" + tr("Picture")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::WECHATPICTURE);
|
||||
} else if (m_text == tr("WeChat") + "/" + tr("Video")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::WECHATVIDEO);
|
||||
} else if (m_text == tr("WeChat") + "/" + tr("Music")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::WECHATMUSIC);
|
||||
} else if (m_text == tr("WeChat") + "/" + tr("Document")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::WECHATDOCUMENT);
|
||||
} else if (m_text == tr("Picture")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::PICTURE);
|
||||
} else if (m_text == tr("Video")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::VIDEO);
|
||||
} else if (m_text == tr("Music")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::MUSIC);
|
||||
} else if (m_text == tr("Document")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::DOCUMENT);
|
||||
} else if (m_text == tr("WeChat")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::WECHAT);
|
||||
} else if (m_text == tr("QQ")) {
|
||||
Q_EMIT sigUpdateClicked(ALL_FILE_LIST_TYPE::QQ);
|
||||
}
|
||||
Q_EMIT sigUpdateClicked(m_text);
|
||||
});
|
||||
connect(m_modeButton, &QPushButton::clicked, this, &MobileFileWidget::slotModeButtonClicked);
|
||||
connect(m_crumb, &KBreadCrumb::currentChanged, this, [=](int index) {
|
||||
|
@ -556,22 +528,3 @@ void MobileFileWidget::setViewHeight()
|
|||
moveCopyToComputerWidget();
|
||||
}
|
||||
}
|
||||
|
||||
void MobileFileWidget::setTheme(PublicAttributes::Theme theme)
|
||||
{
|
||||
if (theme == PublicAttributes::Theme::Light) {
|
||||
QPalette scrollPalette = m_scrollArea->palette();
|
||||
scrollPalette.setColor(QPalette::Base, QColor("#FFFEFD"));
|
||||
m_scrollArea->setPalette(scrollPalette);
|
||||
if (m_timeLineView != nullptr) {
|
||||
m_timeLineView->setTheme(theme);
|
||||
}
|
||||
} else if (theme == PublicAttributes::Theme::Dark) {
|
||||
QPalette scrollPalette = m_scrollArea->palette();
|
||||
scrollPalette.setColor(QPalette::Base, QColor("#1D1D1D"));
|
||||
m_scrollArea->setPalette(scrollPalette);
|
||||
if (m_timeLineView != nullptr) {
|
||||
m_timeLineView->setTheme(theme);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -56,8 +56,6 @@ public:
|
|||
|
||||
void setViewHeight();
|
||||
|
||||
void setTheme(PublicAttributes::Theme theme);
|
||||
|
||||
private Q_SLOTS:
|
||||
void slotModeButtonClicked();
|
||||
void slotHideCopyToComputerWidget();
|
||||
|
|
|
@ -372,6 +372,12 @@ void MainWindow::changeLightTheme()
|
|||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
}
|
||||
if (m_mobileFileList != nullptr) {
|
||||
m_mobileFileList->setTheme(m_theme);
|
||||
}
|
||||
if (m_mobileFileSecondWidget != nullptr) {
|
||||
m_mobileFileSecondWidget->setTheme(m_theme);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::changeDarkTheme()
|
||||
|
@ -393,6 +399,12 @@ void MainWindow::changeDarkTheme()
|
|||
if (m_suspendTabBar != nullptr) {
|
||||
m_suspendTabBar->setTheme(m_theme);
|
||||
}
|
||||
if (m_mobileFileList != nullptr) {
|
||||
m_mobileFileList->setTheme(m_theme);
|
||||
}
|
||||
if (m_mobileFileSecondWidget != nullptr) {
|
||||
m_mobileFileSecondWidget->setTheme(m_theme);
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::initUI()
|
||||
|
@ -585,7 +597,6 @@ void MainWindow::initMobileListWidget(int tag)
|
|||
int index = m_stackedMobileFileListWin->currentIndex();
|
||||
m_listItemWidget = new MobileFileWidget(tag);
|
||||
m_listItemWidget->sigSearchInstalled(m_isUpdated, m_searchInfoPath);
|
||||
m_listItemWidget->setTheme(m_theme);
|
||||
connectMobileFileWidget();
|
||||
m_stackedMobileFileListWin->addWidget(m_listItemWidget);
|
||||
m_stackedMobileFileListWin->setCurrentIndex(index + 1);
|
||||
|
@ -912,7 +923,6 @@ void MainWindow::slotCurrentDirectoryList(const QMap<QString, FileInfo> &filelis
|
|||
if (m_connectInfo.deviceType == ConnectionService::DeviceType::ANDROID) {
|
||||
m_mobileStorageWidget = new MobileStorageWidget(filelist, deviceName, TYPE::Mobile);
|
||||
m_mobileStorageWidget->sigSearchInstalled(m_isUpdated, m_searchInfoPath);
|
||||
m_mobileStorageWidget->setTheme(m_theme);
|
||||
connect(m_mobileStorageWidget, &MobileStorageWidget::sigModeChange, this, [=](QListView::ViewMode mode) {
|
||||
m_storageMode = mode;
|
||||
});
|
||||
|
@ -930,7 +940,6 @@ void MainWindow::slotCurrentDirectoryList(const QMap<QString, FileInfo> &filelis
|
|||
}
|
||||
m_mobileStorageWidget = new MobileStorageWidget(filelist, deviceName, TYPE::Pctopc);
|
||||
m_mobileStorageWidget->sigSearchInstalled(m_isUpdated, m_searchInfoPath);
|
||||
m_mobileStorageWidget->setTheme(m_theme);
|
||||
connect(m_mobileStorageWidget, &MobileStorageWidget::sigModeChange, this, [=](QListView::ViewMode mode) {
|
||||
m_storageMode = mode;
|
||||
});
|
||||
|
@ -1204,7 +1213,6 @@ void MainWindow::onRecvSearchResult(QMap<QString, FileInfo> searchResult)
|
|||
deleteMobileListWidget();
|
||||
m_mobileStorageWidget = new MobileStorageWidget(searchResult, "Search", TYPE::Search);
|
||||
m_mobileStorageWidget->sigSearchInstalled(m_isUpdated, m_searchInfoPath);
|
||||
m_mobileStorageWidget->setTheme(m_theme);
|
||||
connect(m_mobileStorageWidget, &MobileStorageWidget::sigModeChange, this, [=](QListView::ViewMode mode) {
|
||||
m_storageMode = mode;
|
||||
});
|
||||
|
@ -1433,6 +1441,7 @@ void MainWindow::slotItemButtonClicked(int text)
|
|||
QMap<QString, int> fileNumMap;
|
||||
m_fileSyncManage->getItemCount(fileNumMap);
|
||||
m_mobileFileSecondWidget->setItemCount(fileNumMap);
|
||||
m_mobileFileSecondWidget->setTheme(m_theme);
|
||||
//设置图片时间线的数据
|
||||
m_stackedMobileFileListWin->addWidget(m_mobileFileSecondWidget);
|
||||
m_loadAnimation = new LoadAnimation;
|
||||
|
@ -1824,7 +1833,6 @@ void MainWindow::slotMobileFileListSearchClicked()
|
|||
QMap<QString, FileInfo> searchResult;
|
||||
m_mobileStorageWidget = new MobileStorageWidget(searchResult, "Search", TYPE::Search);
|
||||
m_mobileStorageWidget->sigSearchInstalled(m_isUpdated, m_searchInfoPath);
|
||||
m_mobileStorageWidget->setTheme(m_theme);
|
||||
connect(m_mobileStorageWidget, &MobileStorageWidget::sigModeChange, this, [=](QListView::ViewMode mode) {
|
||||
m_storageMode = mode;
|
||||
});
|
||||
|
|
|
@ -740,19 +740,6 @@ void MobileStorageWidget::setViewHeight()
|
|||
}
|
||||
}
|
||||
|
||||
void MobileStorageWidget::setTheme(PublicAttributes::Theme theme)
|
||||
{
|
||||
if (theme == PublicAttributes::Theme::Light) {
|
||||
QPalette scrollPalette = m_scrollArea->palette();
|
||||
scrollPalette.setColor(QPalette::Base, QColor("#FFFEFD"));
|
||||
m_scrollArea->setPalette(scrollPalette);
|
||||
} else if (theme == PublicAttributes::Theme::Dark) {
|
||||
QPalette scrollPalette = m_scrollArea->palette();
|
||||
scrollPalette.setColor(QPalette::Base, QColor("#1D1D1D"));
|
||||
m_scrollArea->setPalette(scrollPalette);
|
||||
}
|
||||
}
|
||||
|
||||
void MobileStorageWidget::onReturnPressed()
|
||||
{
|
||||
m_searchLine->onReturnPressed();
|
||||
|
|
|
@ -32,8 +32,6 @@ public:
|
|||
|
||||
void setViewHeight();
|
||||
|
||||
void setTheme(PublicAttributes::Theme theme);
|
||||
|
||||
void setEditFocus(bool focus);
|
||||
|
||||
void setLineEditText(QString text);
|
||||
|
|
|
@ -138,6 +138,9 @@ void MobileFileList::initWidget()
|
|||
mainVLayout->addStretch();
|
||||
this->setLayout(mainVLayout);
|
||||
|
||||
this->setAutoFillBackground(true);
|
||||
this->setBackgroundRole(QPalette::Base);
|
||||
|
||||
connect(m_searchButton, &QPushButton::clicked, this, [=]() {
|
||||
Q_EMIT sigMobileFileListSearchClicked();
|
||||
});
|
||||
|
@ -232,20 +235,11 @@ void MobileFileList::slotMobileButtonClicked()
|
|||
|
||||
void MobileFileList::setTheme(PublicAttributes::Theme theme)
|
||||
{
|
||||
if (theme == PublicAttributes::Theme::Light) {
|
||||
QPalette paletteListWid = m_fileListWidget->palette();
|
||||
paletteListWid.setColor(QPalette::Base, QColor("#FFFEFD"));
|
||||
m_fileListWidget->setPalette(paletteListWid);
|
||||
QPalette paletteStorageWid = m_storageWidget->palette();
|
||||
paletteStorageWid.setColor(QPalette::Base, QColor("#FFFEFD"));
|
||||
m_storageWidget->setPalette(paletteStorageWid);
|
||||
} else if (theme == PublicAttributes::Theme::Dark) {
|
||||
QPalette paletteListWid = m_fileListWidget->palette();
|
||||
paletteListWid.setColor(QPalette::Base, QColor("#1D1D1D"));
|
||||
m_fileListWidget->setPalette(paletteListWid);
|
||||
QPalette palette = m_storageWidget->palette();
|
||||
palette.setColor(QPalette::Base, QColor("#1D1D1D"));
|
||||
m_storageWidget->setPalette(palette);
|
||||
for (int i = 0; i < 6; i++) {
|
||||
MobileFileListItem *fileListItem = dynamic_cast<MobileFileListItem *>(m_fileListWidget->itemWidget(m_fileListWidget->item(i)));
|
||||
fileListItem->setTheme(theme);
|
||||
}
|
||||
MobileFileListItem *storageListItem = dynamic_cast<MobileFileListItem *>(m_storageWidget->itemWidget(m_storageWidget->item(0)));
|
||||
storageListItem->setTheme(theme);
|
||||
}
|
||||
|
||||
|
|
|
@ -23,14 +23,16 @@ void MobileFileListItem::initWidget()
|
|||
//项按钮
|
||||
m_itemIconLabel = new QLabel(this);
|
||||
m_itemIconLabel->setFixedSize(ITEM_ICON_WIDTH, ITEM_ICON_HEIGHT);
|
||||
m_itemIconLabel->setStyleSheet("background-color:transparent;");
|
||||
//项名称
|
||||
m_itemNameLabel = new QLabel(this);
|
||||
QFont font;
|
||||
font.setBold(true);
|
||||
m_itemNameLabel->setFont(font);
|
||||
m_itemNameLabel->setStyleSheet("background-color:transparent;");
|
||||
//每一项总数
|
||||
m_itemCountLabel = new QLabel(this);
|
||||
m_itemCountLabel->setStyleSheet("color:#8F9399;font-size:12px");
|
||||
m_itemCountLabel->setStyleSheet("background-color:transparent;color:#8F9399;font-size:12px");
|
||||
|
||||
labelVLayout->setContentsMargins(0, 0, 0, 0);
|
||||
labelVLayout->addStretch();
|
||||
|
@ -39,9 +41,9 @@ void MobileFileListItem::initWidget()
|
|||
labelVLayout->addWidget(m_itemCountLabel);
|
||||
labelVLayout->addStretch();
|
||||
|
||||
QLabel *vectorLab = new QLabel(this);
|
||||
vectorLab->setFixedSize(8, 8);
|
||||
vectorLab->setPixmap(QPixmap(":/svg/Vector1.svg").scaled(8, 8));
|
||||
// QLabel *vectorLab = new QLabel(this);
|
||||
// vectorLab->setFixedSize(8, 8);
|
||||
// vectorLab->setPixmap(QPixmap(":/svg/Vector1.svg").scaled(8, 8));
|
||||
|
||||
mainHLayout->setContentsMargins(19, 0, 13, 0);
|
||||
mainHLayout->setSpacing(0);
|
||||
|
@ -49,13 +51,9 @@ void MobileFileListItem::initWidget()
|
|||
mainHLayout->addSpacing(11);
|
||||
mainHLayout->addLayout(labelVLayout);
|
||||
mainHLayout->addStretch();
|
||||
mainHLayout->addWidget(vectorLab);
|
||||
// mainHLayout->addWidget(vectorLab);
|
||||
setLayout(mainHLayout);
|
||||
|
||||
QPalette palette = this->palette();
|
||||
palette.setColor(QPalette::Button, QColor("#F6F6F6"));
|
||||
this->setPalette(palette);
|
||||
|
||||
this->setProperty("useButtonPalette", true);
|
||||
}
|
||||
|
||||
|
@ -88,15 +86,34 @@ void MobileFileListItem::setAllFile(QString file)
|
|||
bool MobileFileListItem::eventFilter(QObject *watch, QEvent *event)
|
||||
{
|
||||
if (watch == this) {
|
||||
if (event->type() == QEvent::Enter) {
|
||||
QPalette palette = this->palette();
|
||||
palette.setColor(QPalette::Button, QColor("#E6F1FE"));
|
||||
this->setPalette(palette);
|
||||
} else if (event->type() == QEvent::Leave) {
|
||||
QPalette palette = this->palette();
|
||||
palette.setColor(QPalette::Button, QColor("#F6F6F6"));
|
||||
this->setPalette(palette);
|
||||
}
|
||||
}
|
||||
if (m_theme == PublicAttributes::Theme::Light) {
|
||||
if (event->type() == QEvent::Enter) {
|
||||
this->setStyleSheet("background-color:#E6F1FE;");
|
||||
} else if (event->type() == QEvent::Leave) {
|
||||
this->setStyleSheet("background-color:#F6F6F6;");
|
||||
}
|
||||
} else if (m_theme == PublicAttributes::Theme::Dark) {
|
||||
if (event->type() == QEvent::Enter) {
|
||||
this->setStyleSheet("background-color:#373737;");
|
||||
} else if (event->type() == QEvent::Leave) {
|
||||
this->setStyleSheet("background-color:#626267;");
|
||||
}
|
||||
}
|
||||
}
|
||||
return QObject::eventFilter(watch, event);
|
||||
}
|
||||
|
||||
void MobileFileListItem::setTheme(PublicAttributes::Theme theme)
|
||||
{
|
||||
m_theme = theme;
|
||||
switch (theme) {
|
||||
case PublicAttributes::Theme::Light: {
|
||||
this->setStyleSheet("background-color:#F6F6F6;");
|
||||
break; }
|
||||
case PublicAttributes::Theme::Dark: {
|
||||
this->setStyleSheet("background-color:#626267;");
|
||||
break; }
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
|
||||
#include "publicattributes.hpp"
|
||||
|
||||
class MobileFileListItem : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
@ -27,6 +29,8 @@ public:
|
|||
//设置所有文件label样式
|
||||
void setAllFile(QString file);
|
||||
|
||||
void setTheme(PublicAttributes::Theme theme);
|
||||
|
||||
protected:
|
||||
bool eventFilter(QObject *watch, QEvent *event);
|
||||
|
||||
|
@ -40,6 +44,8 @@ private:
|
|||
QLabel *m_itemNameLabel = nullptr;
|
||||
//每一项总数
|
||||
QLabel *m_itemCountLabel = nullptr;
|
||||
|
||||
PublicAttributes::Theme m_theme = PublicAttributes::Theme::Light;
|
||||
};
|
||||
|
||||
#endif // MOBILEFILELISTITEM_H
|
||||
|
|
Loading…
Reference in New Issue