From 6d2a88a04527035e22cb37e2e0e70a3a70a42527 Mon Sep 17 00:00:00 2001 From: lixueman Date: Mon, 19 Sep 2022 10:32:27 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=84=E8=8C=83=E6=A0=B7=E5=BC=8F=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=8F=98=E9=87=8F=E5=91=BD=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.cpp | 20 +- src/BackProcess/tablet/pagemanager.cpp | 14 +- .../Button/letter_classify_button.cpp | 8 +- src/UserInterface/ListView/fulllistview.cpp | 4 +- src/UserInterface/ListView/tabletlistview.cpp | 72 ++--- .../ViewItem/full_item_delegate.cpp | 12 +- .../ViewItem/right_item_delegate.cpp | 4 +- .../ViewItem/tablet_full_itemdelegate.cpp | 26 +- .../Widget/full_function_widget.cpp | 16 +- .../Widget/full_letter_widget.cpp | 14 +- .../Widget/function_button_widget.cpp | 6 +- src/UserInterface/full_mainwindow.cpp | 2 +- src/UserInterface/mainwindow.cpp | 60 ++-- src/UserInterface/tabletwindow.cpp | 22 +- src/UtilityFunction/Style/style.cpp | 292 ++++++++---------- src/UtilityFunction/Style/style.h | 110 +++---- src/UtilityFunction/thumbnail.cpp | 8 +- 17 files changed, 327 insertions(+), 363 deletions(-) diff --git a/main.cpp b/main.cpp index 4d4c558..d15669b 100755 --- a/main.cpp +++ b/main.cpp @@ -81,17 +81,17 @@ int main(int argc, char *argv[]) if (Style::m_panelPosition == 0) { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { kdk::WindowManager::setGeometry(w.windowHandle(),QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + - Style::m_availableScreenHeight - Style::minh - 3, Style::minw, Style::minh)); + Style::m_availableScreenHeight - Style::m_minh - 3, Style::m_minw, Style::m_minh)); } else { - w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::minh - 3, - Style::minw, Style::minh)); + w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::m_minh - 3, + Style::m_minw, Style::m_minh)); } } else if (Style::m_panelPosition == 1) { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { kdk::WindowManager::setGeometry(w.windowHandle(),QRect(Style::m_primaryScreenX + 4, - Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh)); } else { - w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh)); } } else if (Style::m_panelPosition == 2) { @@ -99,17 +99,17 @@ int main(int argc, char *argv[]) if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { kdk::WindowManager::setGeometry(w.windowHandle(), QRect(Style::m_primaryScreenX + 4, - Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh)); } else { - w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + w.setGeometry(QRect(Style::m_primaryScreenX + 4, Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh)); } } else { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { kdk::WindowManager::setGeometry(w.windowHandle(), QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - - Style::minw - 4, Style::m_primaryScreenY + 4, Style::minw, Style::minh)); + Style::m_minw - 4, Style::m_primaryScreenY + 4, Style::m_minw, Style::m_minh)); } else { - w.setGeometry(QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - Style::minw - 4, Style::m_primaryScreenY + 4, - Style::minw, Style::minh)); + w.setGeometry(QRect(Style::m_primaryScreenX + Style::m_availableScreenWidth - Style::m_minw - 4, Style::m_primaryScreenY + 4, + Style::m_minw, Style::m_minh)); } } diff --git a/src/BackProcess/tablet/pagemanager.cpp b/src/BackProcess/tablet/pagemanager.cpp index c6be8eb..ce09bd2 100755 --- a/src/BackProcess/tablet/pagemanager.cpp +++ b/src/BackProcess/tablet/pagemanager.cpp @@ -39,15 +39,15 @@ int PageManager::getPageNum(const int &appNum) { int pageNum = 0; - if (appNum / (Style::appColumnFirst * Style::appLineFirst) == 0) { + if (appNum / (Style::m_appColumnFirst * Style::m_appLineFirst) == 0) { pageNum = 1; } else { - int appNumOtherPage = appNum - (Style::appColumnFirst * Style::appLineFirst); + int appNumOtherPage = appNum - (Style::m_appColumnFirst * Style::m_appLineFirst); - if (appNumOtherPage % (Style::appColumn * Style::appLine) == 0) { - pageNum = appNumOtherPage / (Style::appColumn * Style::appLine) + 1; + if (appNumOtherPage % (Style::m_appColumn * Style::m_appLine) == 0) { + pageNum = appNumOtherPage / (Style::m_appColumn * Style::m_appLine) + 1; } else { - pageNum = appNumOtherPage / (Style::appColumn * Style::appLine) + 2; + pageNum = appNumOtherPage / (Style::m_appColumn * Style::m_appLine) + 2; } } @@ -67,7 +67,7 @@ QVector PageManager::sortAppInPage(const QVector &appVecto int pageSize = getPageNum(m_data.size()); onePageData.clear(); - for (int j = 0; j < Style::appColumnFirst * Style::appLineFirst; j++) { + for (int j = 0; j < Style::m_appColumnFirst * Style::m_appLineFirst; j++) { if (m_data.size() > 0) { onePageData.append(m_data.at(0)); m_data.pop_front(); @@ -81,7 +81,7 @@ QVector PageManager::sortAppInPage(const QVector &appVecto for (int i = 0; i < pageSize - 1; i++) { onePageData.clear(); - for (int j = 0; j < Style::appColumn * Style::appLine; j++) { + for (int j = 0; j < Style::m_appColumn * Style::m_appLine; j++) { if (m_data.size() > 0) { onePageData.append(m_data.at(0)); m_data.pop_front(); diff --git a/src/UserInterface/Button/letter_classify_button.cpp b/src/UserInterface/Button/letter_classify_button.cpp index 11073a8..04878b7 100755 --- a/src/UserInterface/Button/letter_classify_button.cpp +++ b/src/UserInterface/Button/letter_classify_button.cpp @@ -167,9 +167,9 @@ void LetterClassifyButton::leaveEvent(QEvent *e) if (m_fullscreen) { QFont font; - font.setPixelSize(Style::LeftLetterFontSize); + font.setPixelSize(Style::m_leftLetterFontSize); this->setFont(font); - this->setFixedSize(Style::LeftLetterBtnHeight, Style::LeftLetterBtnHeight); + this->setFixedSize(Style::m_leftLetterBtnHeight, Style::m_leftLetterBtnHeight); tooltip->close(); delete tooltip; tooltip = nullptr; @@ -195,9 +195,9 @@ void LetterClassifyButton::focusInEvent(QEvent *e) if (m_fullscreen) { QFont font; - font.setPixelSize(Style::LeftLetterFontSize * 3); + font.setPixelSize(Style::m_leftLetterFontSize * 3); this->setFont(font); - this->setFixedSize(Style::LeftLetterBtnHeight * 2, Style::LeftLetterBtnHeight * 2); + this->setFixedSize(Style::m_leftLetterBtnHeight * 2, Style::m_leftLetterBtnHeight * 2); } } diff --git a/src/UserInterface/ListView/fulllistview.cpp b/src/UserInterface/ListView/fulllistview.cpp index f55cd19..347e9d9 100755 --- a/src/UserInterface/ListView/fulllistview.cpp +++ b/src/UserInterface/ListView/fulllistview.cpp @@ -96,7 +96,7 @@ void FullListView::keyPressEvent(QKeyEvent *e) case Qt::Key_Left: { this->clearFocus(); - if (mapToGlobal(center.topRight()).y() < Style::QueryLineEditHeight + Style::m_applistGridSizeWidth) { + if (mapToGlobal(center.topRight()).y() < Style::m_queryLineEditHeight + Style::m_applistGridSizeWidth) { Q_EMIT sendSetslidebar(-Style::m_applistGridSizeWidth); } @@ -119,7 +119,7 @@ void FullListView::keyPressEvent(QKeyEvent *e) case Qt::Key_Up: { if (module == 0) { - if (mapToGlobal(center.topRight()).y() < (Style::QueryLineEditHeight + Style::m_applistGridSizeWidth)) { + if (mapToGlobal(center.topRight()).y() < (Style::m_queryLineEditHeight + Style::m_applistGridSizeWidth)) { Q_EMIT sendSetslidebar(-Style::m_applistGridSizeWidth); } } diff --git a/src/UserInterface/ListView/tabletlistview.cpp b/src/UserInterface/ListView/tabletlistview.cpp index 32d0c97..4b73ff3 100755 --- a/src/UserInterface/ListView/tabletlistview.cpp +++ b/src/UserInterface/ListView/tabletlistview.cpp @@ -312,15 +312,15 @@ void TabletListView::mousePressEvent(QMouseEvent *event) //左键 myDebug() << "左键点击,当前点坐标" << event->pos(); - if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && (((pressedpos.x() % Style::TabletItemSizeWidthFirst) >= Style::FirstPageSpace) && - ((pressedpos.x() % Style::TabletItemSizeWidthFirst) <= (Style::FirstPageSpace + Style::AppListIconSize)) && - ((pressedpos.y() % Style::AppListItemSizeHeight) >= Style::m_appTopSpace) && - ((pressedpos.y() % Style::AppListItemSizeHeight) <= (Style::m_appTopSpace + Style::AppListIconSize)))) || + if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && (((pressedpos.x() % Style::m_tabletItemSizeWidthFirst) >= Style::m_firstPageSpace) && + ((pressedpos.x() % Style::m_tabletItemSizeWidthFirst) <= (Style::m_firstPageSpace + Style::m_appListIconSize)) && + ((pressedpos.y() % Style::m_appListItemSizeHeight) >= Style::m_appTopSpace) && + ((pressedpos.y() % Style::m_appListItemSizeHeight) <= (Style::m_appTopSpace + Style::m_appListIconSize)))) || ((this->indexAt(event->pos()).isValid()) && (m_pageNum == OTHERPAGE) && - (pressedpos.x() % Style::TabletItemSizeWidthOther >= Style::OtherPageSpace && - pressedpos.x() % Style::TabletItemSizeWidthOther <= Style::OtherPageSpace + Style::AppListIconSize && - pressedpos.y() % Style::AppListItemSizeHeight >= Style::m_appTopSpace && - pressedpos.y() % Style::AppListItemSizeHeight <= Style::m_appTopSpace + Style::AppListIconSize))) { + (pressedpos.x() % Style::m_tabletItemSizeWidthOther >= Style::m_otherPageSpace && + pressedpos.x() % Style::m_tabletItemSizeWidthOther <= Style::m_otherPageSpace + Style::m_appListIconSize && + pressedpos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace && + pressedpos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize))) { pressApp = listmodel->data(this->indexAt(pressedpos), Qt::DisplayRole); iconClick = true; startPos = event->pos(); @@ -337,15 +337,15 @@ void TabletListView::mousePressEvent(QMouseEvent *event) //右键 myDebug() << "右键点击,当前点坐标" << event->pos(); - if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && ((pressedpos.x()) % Style::TabletItemSizeWidthFirst >= Style::FirstPageSpace && - (pressedpos.x()) % Style::TabletItemSizeWidthFirst <= Style::FirstPageSpace + Style::AppListIconSize && - pressedpos.y() % Style::AppListItemSizeHeight >= Style::m_appTopSpace && - pressedpos.y() % Style::AppListItemSizeHeight <= Style::m_appTopSpace + Style::AppListIconSize)) || + if (((this->indexAt(event->pos()).isValid()) && (m_pageNum == FIRSTPAGE) && ((pressedpos.x()) % Style::m_tabletItemSizeWidthFirst >= Style::m_firstPageSpace && + (pressedpos.x()) % Style::m_tabletItemSizeWidthFirst <= Style::m_firstPageSpace + Style::m_appListIconSize && + pressedpos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace && + pressedpos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize)) || ((this->indexAt(event->pos()).isValid()) && (m_pageNum == OTHERPAGE) && - (pressedpos.x() % Style::TabletItemSizeWidthOther >= Style::OtherPageSpace && - pressedpos.x() % Style::TabletItemSizeWidthOther <= Style::OtherPageSpace + Style::AppListIconSize && - pressedpos.y() % Style::AppListItemSizeHeight >= Style::m_appTopSpace && - pressedpos.y() % Style::AppListItemSizeHeight <= Style::m_appTopSpace + Style::AppListIconSize))) { + (pressedpos.x() % Style::m_tabletItemSizeWidthOther >= Style::m_otherPageSpace && + pressedpos.x() % Style::m_tabletItemSizeWidthOther <= Style::m_otherPageSpace + Style::m_appListIconSize && + pressedpos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace && + pressedpos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize))) { pressApp = listmodel->data(this->indexAt(pressedpos), Qt::DisplayRole); right_iconClick = true; right_pressedpos = pressedpos; @@ -409,17 +409,17 @@ void TabletListView::dragMoveEvent(QDragMoveEvent *event) m_time->start(500); if (m_pageNum == OTHERPAGE) { - if (event->pos().x() >= (Style::OtherPageViewWidth - (Style::OtherPageSpace / 2)) || event->pos().x() <= (Style::OtherPageSpace / 2)) { - if (event->pos().x() <= (Style::OtherPageSpace / 2)) { + if (event->pos().x() >= (Style::m_otherPageViewWidth - (Style::m_otherPageSpace / 2)) || event->pos().x() <= (Style::m_otherPageSpace / 2)) { + if (event->pos().x() <= (Style::m_otherPageSpace / 2)) { Q_EMIT pagenumchanged(false); } - if (event->pos().x() >= (Style::OtherPageViewWidth - (Style::OtherPageSpace / 2))) { + if (event->pos().x() >= (Style::m_otherPageViewWidth - (Style::m_otherPageSpace / 2))) { Q_EMIT pagenumchanged(true); } } } else { - if (event->pos().x() >= (Style::FirsPageViewWidth - (Style::FirstPageSpace / 2))) { + if (event->pos().x() >= (Style::m_firsPageViewWidth - (Style::m_firstPageSpace / 2))) { Q_EMIT pagenumchanged(true); } } @@ -507,9 +507,9 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos) QString desktopfn2 = fileInfo2.fileName(); if (m_pageNum == FIRSTPAGE) { - releasepos.setX(releasepos.x() + Style::OtherPageSpace); + releasepos.setX(releasepos.x() + Style::m_otherPageSpace); } else { - releasepos.setX(releasepos.x() + Style::FirstPageSpace); + releasepos.setX(releasepos.x() + Style::m_firstPageSpace); } QVariant var3 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//释放位置右侧有应用 @@ -518,9 +518,9 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos) QString desktopfn3 = fileInfo3.fileName(); if (m_pageNum == FIRSTPAGE) { - releasepos.setX(releasepos.x() - (Style::OtherPageSpace * 2)); + releasepos.setX(releasepos.x() - (Style::m_otherPageSpace * 2)); } else { - releasepos.setX(releasepos.x() - (Style::FirstPageSpace * 2)); + releasepos.setX(releasepos.x() - (Style::m_firstPageSpace * 2)); } QVariant var4 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//右侧没有左侧有 @@ -624,22 +624,22 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos) QFileInfo fileInfo2(pressDesktopfp); QString desktopfn2 = fileInfo2.fileName(); - if (((this->indexAt(releasepos).isValid()) && (m_pageNum == FIRSTPAGE) && ((releasepos.x()) % Style::TabletItemSizeWidthFirst >= Style::FirstPageSpace && - (releasepos.x()) % Style::TabletItemSizeWidthFirst <= Style::FirstPageSpace + Style::AppListIconSize && - releasepos.y() % Style::AppListItemSizeHeight >= Style::m_appTopSpace && - releasepos.y() % Style::AppListItemSizeHeight <= Style::m_appTopSpace + Style::AppListIconSize)) || + if (((this->indexAt(releasepos).isValid()) && (m_pageNum == FIRSTPAGE) && ((releasepos.x()) % Style::m_tabletItemSizeWidthFirst >= Style::m_firstPageSpace && + (releasepos.x()) % Style::m_tabletItemSizeWidthFirst <= Style::m_firstPageSpace + Style::m_appListIconSize && + releasepos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace && + releasepos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize)) || ((this->indexAt(releasepos).isValid()) && (m_pageNum == OTHERPAGE) && - (releasepos.x() % Style::TabletItemSizeWidthOther >= Style::OtherPageSpace && - releasepos.x() % Style::TabletItemSizeWidthOther <= Style::OtherPageSpace + Style::AppListIconSize && - releasepos.y() % Style::AppListItemSizeHeight >= Style::m_appTopSpace && - releasepos.y() % Style::AppListItemSizeHeight <= Style::m_appTopSpace + Style::AppListIconSize))) { + (releasepos.x() % Style::m_tabletItemSizeWidthOther >= Style::m_otherPageSpace && + releasepos.x() % Style::m_tabletItemSizeWidthOther <= Style::m_otherPageSpace + Style::m_appListIconSize && + releasepos.y() % Style::m_appListItemSizeHeight >= Style::m_appTopSpace && + releasepos.y() % Style::m_appListItemSizeHeight <= Style::m_appTopSpace + Style::m_appListIconSize))) { return; } if (m_pageNum == FIRSTPAGE) { - releasepos.setX(releasepos.x() + Style::FirstPageSpace); + releasepos.setX(releasepos.x() + Style::m_firstPageSpace); } else { - releasepos.setX(releasepos.x() + Style::OtherPageSpace); + releasepos.setX(releasepos.x() + Style::m_otherPageSpace); } QVariant var3 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//释放位置右侧有应用 @@ -648,9 +648,9 @@ void TabletListView::insertApplication(QPoint pressedpos, QPoint releasepos) QString desktopfn3 = fileInfo3.fileName(); if (m_pageNum == FIRSTPAGE) { - releasepos.setX(releasepos.x() - Style::FirstPageSpace * 2); + releasepos.setX(releasepos.x() - Style::m_firstPageSpace * 2); } else { - releasepos.setX(releasepos.x() - Style::OtherPageSpace * 2); + releasepos.setX(releasepos.x() - Style::m_otherPageSpace * 2); } QVariant var4 = listmodel->data(this->indexAt(releasepos), Qt::DisplayRole);//右侧没有左侧有 diff --git a/src/UserInterface/ViewItem/full_item_delegate.cpp b/src/UserInterface/ViewItem/full_item_delegate.cpp index 68f140a..a4b4d3b 100755 --- a/src/UserInterface/ViewItem/full_item_delegate.cpp +++ b/src/UserInterface/ViewItem/full_item_delegate.cpp @@ -121,10 +121,10 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti QString appname = m_ukuiMenuInterface->getAppName(desktopfp); QRect iconRect; QRect textRect; - iconRect = QRect(rect.x() + (rect.width() - Style::AppListIconSize) / 2, + iconRect = QRect(rect.x() + (rect.width() - Style::m_appListIconSize) / 2, rect.y() + Style::m_appTopSpace, - Style::AppListIconSize, - Style::AppListIconSize); + Style::m_appListIconSize, + Style::m_appListIconSize); icon.paint(painter, iconRect); painter->restore(); painter->save(); @@ -143,7 +143,7 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti painter->restore(); textRect = QRect(rect.x() + 5, - iconRect.bottom() + Style::AppSpaceBetweenIconText, + iconRect.bottom() + Style::m_appSpaceBetweenIconText, rect.width() - 10, Style::m_appTextRectHeight); painter->save(); @@ -156,7 +156,7 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti is_recentapp = true; appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 23, Qt::TextShowMnemonic); textRect = QRect(rect.x() + 18, - iconRect.bottom() + Style::AppSpaceBetweenIconText, + iconRect.bottom() + Style::m_appSpaceBetweenIconText, rect.width() - 23, Style::m_appTextRectHeight); painter->setPen(QPen(Qt::NoPen)); @@ -220,5 +220,5 @@ void FullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opti QSize FullItemDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const { - return QSize(Style::AppListItemSizeWidth, Style::AppListItemSizeWidth); + return QSize(Style::m_appListItemSizeWidth, Style::m_appListItemSizeWidth); } diff --git a/src/UserInterface/ViewItem/right_item_delegate.cpp b/src/UserInterface/ViewItem/right_item_delegate.cpp index 03e173f..337d66c 100755 --- a/src/UserInterface/ViewItem/right_item_delegate.cpp +++ b/src/UserInterface/ViewItem/right_item_delegate.cpp @@ -160,9 +160,9 @@ void RightItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &opt is_recentapp = true; appnameElidedText = fm.elidedText(appname, Qt::ElideRight, rect.width() - 23, Qt::TextShowMnemonic); textRect = QRect(rect.x() + 18, - iconRect.bottom() + Style::AppSpaceBetweenIconText, + iconRect.bottom() + Style::m_appSpaceBetweenIconText, rect.width() - 23, - rect.height() - iconRect.height() - Style::AppSpaceBetweenIconText); + rect.height() - iconRect.height() - Style::m_appSpaceBetweenIconText); painter->setPen(QPen(Qt::NoPen)); painter->setBrush(QColor("#4d94ff")); int x = 0; diff --git a/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp b/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp index 58e487a..78562ce 100755 --- a/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp +++ b/src/UserInterface/ViewItem/tablet_full_itemdelegate.cpp @@ -112,14 +112,14 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem } bool bigIcon = index.data(Qt::UserRole + 2).toBool(); - int iconTopSpace = (rect.height() - Style::AppListIconSize) / 2; - int iconLeftSpace = (rect.width() - Style::AppListIconSize) / 2; + int iconTopSpace = (rect.height() - Style::m_appListIconSize) / 2; + int iconLeftSpace = (rect.width() - Style::m_appListIconSize) / 2; if (bigIcon) { iconRect = QRect(rect.x() + iconLeftSpace - 6, rect.y() + iconTopSpace - 6, - Style::AppListIconSize + 12, - Style::AppListIconSize + 12); + Style::m_appListIconSize + 12, + Style::m_appListIconSize + 12); textRect = QRect(rect.x(), rect.bottom() - iconTopSpace, rect.width(), @@ -127,8 +127,8 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem } else { iconRect = QRect(rect.x() + iconLeftSpace, rect.y() + iconTopSpace, - Style::AppListIconSize, - Style::AppListIconSize); + Style::m_appListIconSize, + Style::m_appListIconSize); textRect = QRect(rect.x(), rect.bottom() - iconTopSpace, rect.width(), @@ -165,10 +165,10 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem QPixmap pixmap; if (bigIcon) { - pixmap = icon.pixmap((Style::AppListBigIconSize, Style::AppListBigIconSize), QIcon::Disabled, QIcon::Off); //wgx - pixmap = pixmap.scaled(Style::AppListBigIconSize, Style::AppListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + pixmap = icon.pixmap((Style::m_appListBigIconSize, Style::m_appListBigIconSize), QIcon::Disabled, QIcon::Off); //wgx + pixmap = pixmap.scaled(Style::m_appListBigIconSize, Style::m_appListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } else { - pixmap = icon.pixmap((Style::AppListIconSize, Style::AppListIconSize), QIcon::Disabled, QIcon::Off); //wgx + pixmap = icon.pixmap((Style::m_appListIconSize, Style::m_appListIconSize), QIcon::Disabled, QIcon::Off); //wgx } icon = QIcon(pixmap); @@ -176,10 +176,10 @@ void TabletFullItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem QPixmap mPixmap; if (bigIcon) { - mPixmap = icon.pixmap((Style::AppListBigIconSize, Style::AppListBigIconSize)); //wgx - mPixmap = mPixmap.scaled(Style::AppListBigIconSize, Style::AppListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); + mPixmap = icon.pixmap((Style::m_appListBigIconSize, Style::m_appListBigIconSize)); //wgx + mPixmap = mPixmap.scaled(Style::m_appListBigIconSize, Style::m_appListBigIconSize, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); } else { - mPixmap = icon.pixmap((Style::AppListIconSize, Style::AppListIconSize)); //wgx + mPixmap = icon.pixmap((Style::m_appListIconSize, Style::m_appListIconSize)); //wgx } icon = QIcon(mPixmap); @@ -209,6 +209,6 @@ QSize TabletFullItemDelegate::sizeHint(const QStyleOptionViewItem &option, const // { // return QSize(0,0); // } - return QSize(Style::TabletItemSizeWidthFirst, Style::AppListItemSizeHeight); + return QSize(Style::m_tabletItemSizeWidthFirst, Style::m_appListItemSizeHeight); } diff --git a/src/UserInterface/Widget/full_function_widget.cpp b/src/UserInterface/Widget/full_function_widget.cpp index 05d746f..bec821c 100755 --- a/src/UserInterface/Widget/full_function_widget.cpp +++ b/src/UserInterface/Widget/full_function_widget.cpp @@ -301,7 +301,7 @@ void FullFunctionWidget::resizeScrollAreaControls() void FullFunctionWidget::initIconListWidget() { m_iconListWidLayout = new QVBoxLayout(m_iconListWid); - m_iconListWidLayout->setSpacing(Style::LeftSpaceBetweenItem); + m_iconListWidLayout->setSpacing(Style::m_leftSpaceBetweenItem); m_iconListWidLayout->setContentsMargins(45, 0, 0, 0); m_topSpacerItem = new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding); m_bottomSpacerItem = new QSpacerItem(20, 40, QSizePolicy::Fixed, QSizePolicy::Expanding); @@ -329,9 +329,9 @@ void FullFunctionWidget::initIconListScrollArea() for (int i = 0; i < m_classificationList.size(); i++) { FunctionClassifyButton *iconbtn = new FunctionClassifyButton( - Style::LeftBtnWidth, - Style::LeftBtnHeight, - Style::LeftIconSize, + Style::m_leftBtnWidth, + Style::m_leftBtnHeight, + Style::m_leftIconSize, m_classificationList.at(i), true, true); @@ -451,9 +451,9 @@ void FullFunctionWidget::enterAnimation() m_animation->setDuration(200);//动画总时间 m_animation->setStartValue(QRect(0, 0, 0, m_iconListWid->height())); - m_animation->setEndValue(QRect(Style::LeftMargin, + m_animation->setEndValue(QRect(Style::m_leftMargin, 0, - Style::LeftBtnWidth, + Style::m_leftBtnWidth, m_iconListWid->height())); m_animation->setEasingCurve(QEasingCurve::InQuart); m_animation->start(); @@ -463,9 +463,9 @@ void FullFunctionWidget::enterAnimation() void FullFunctionWidget::setFunctionBtnGeometry() { // int height=m_classificationList.size()*Style::LeftBtnHeight+(m_classificationList.size()-1)*Style::LeftSpaceBetweenItem; - m_iconListScrollAreaWid->setGeometry(QRect(Style::LeftMargin, + m_iconListScrollAreaWid->setGeometry(QRect(Style::m_leftMargin, 0, - Style::LeftBtnWidth, + Style::m_leftBtnWidth, m_iconListWid->height())); m_iconListScrollAreaWid->show(); } diff --git a/src/UserInterface/Widget/full_letter_widget.cpp b/src/UserInterface/Widget/full_letter_widget.cpp index a376de8..e28a66e 100755 --- a/src/UserInterface/Widget/full_letter_widget.cpp +++ b/src/UserInterface/Widget/full_letter_widget.cpp @@ -342,7 +342,7 @@ void FullLetterWidget::initLetterListScrollArea() LetterClassifyButton *letterbtn = new LetterClassifyButton(m_letterListWid, true, m_letterList.at(i)); - letterbtn->setFixedSize(Style::LeftLetterBtnHeight, Style::LeftLetterBtnHeight); + letterbtn->setFixedSize(Style::m_leftLetterBtnHeight, Style::m_leftLetterBtnHeight); m_buttonList.append(letterbtn); m_letterListWidLayout->addWidget(letterbtn); m_letterListWidLayout->setAlignment(letterbtn, Qt::AlignLeft); @@ -459,12 +459,12 @@ void FullLetterWidget::valueChangedSlot(int value) void FullLetterWidget::enterAnimation() { m_animation->setDuration(200);//动画总时间 - m_animation->setStartValue(QRect(0, (m_letterListWid->height() - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight) / 2, - 0, (m_letterList.size() + 1)*Style::LeftLetterBtnHeight)); - m_animation->setEndValue(QRect(Style::LeftMargin, - (m_letterListWid->height() - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight) / 2, - Style::LeftLetterBtnHeight * 2, - (m_letterList.size() + 1)*Style::LeftLetterBtnHeight)); + m_animation->setStartValue(QRect(0, (m_letterListWid->height() - (m_letterList.size() + 1)*Style::m_leftLetterBtnHeight) / 2, + 0, (m_letterList.size() + 1)*Style::m_leftLetterBtnHeight)); + m_animation->setEndValue(QRect(Style::m_leftMargin, + (m_letterListWid->height() - (m_letterList.size() + 1)*Style::m_leftLetterBtnHeight) / 2, + Style::m_leftLetterBtnHeight * 2, + (m_letterList.size() + 1)*Style::m_leftLetterBtnHeight)); m_animation->setEasingCurve(QEasingCurve::InQuart); m_animation->start(); // m_letterListScrollArea->show(); diff --git a/src/UserInterface/Widget/function_button_widget.cpp b/src/UserInterface/Widget/function_button_widget.cpp index 3521ee5..10e6d55 100755 --- a/src/UserInterface/Widget/function_button_widget.cpp +++ b/src/UserInterface/Widget/function_button_widget.cpp @@ -55,9 +55,9 @@ void FunctionButtonWidget::initUi() for (int row = 0; row < 6; row++) for (int col = 0; col < 2; col++) { - FunctionClassifyButton *iconbtn = new FunctionClassifyButton(Style::LeftBtnWidth, - Style::LeftBtnHeight, - Style::LeftIconSize, + FunctionClassifyButton *iconbtn = new FunctionClassifyButton(Style::m_leftBtnWidth, + Style::m_leftBtnHeight, + Style::m_leftIconSize, m_categoryList.at(row * 2 + col), false, false); diff --git a/src/UserInterface/full_mainwindow.cpp b/src/UserInterface/full_mainwindow.cpp index 2feda1b..463b743 100755 --- a/src/UserInterface/full_mainwindow.cpp +++ b/src/UserInterface/full_mainwindow.cpp @@ -337,7 +337,7 @@ bool FullMainWindow::eventFilter(QObject *watched, QEvent *event) m_queryText->setParent(nullptr); } - m_queryWid->setGeometry(6, 2, m_queryIcon->width() + 5, Style::QueryLineEditHeight); + m_queryWid->setGeometry(6, 2, m_queryIcon->width() + 5, Style::m_queryLineEditHeight); m_queryWid->layout()->setAlignment(Qt::AlignVCenter); m_lineEdit->setTextMargins(26, 0, 0, 0); } diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index 13304fd..32132fe 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -41,7 +41,7 @@ MainWindow::MainWindow(QWidget *parent) : Style::initWidStyle(); openDataBase("MainThreadDataBase"); initDatabase(); - this->resize(Style::minw, Style::minh); + this->resize(Style::m_minw, Style::m_minh); this->setAutoFillBackground(false); m_centralwidget = new QWidget(this); m_centerLayout = new QHBoxLayout(m_centralwidget); @@ -319,7 +319,7 @@ void MainWindow::initSearchUi() m_selectMenuButton->setAcceptDrops(true); m_selectMenuButton->setFocusPolicy(Qt::StrongFocus); m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true) - .pixmap(QSize(Style::miniIconSize, Style::miniIconSize))); + .pixmap(QSize(Style::m_miniIconSize, Style::m_miniIconSize))); //搜索框展开页 m_minSearchPage = new QWidget(); m_leftTopSearchHorizontalLayout = new QHBoxLayout(m_minSearchPage); @@ -346,32 +346,32 @@ void MainWindow::initLeftWidget() { //左侧列表区 m_leftStackedWidget = new QStackedWidget(m_viewWidget); - m_leftStackedWidget->setFixedSize(QSize(300, Style::leftPageHeight)); + m_leftStackedWidget->setFixedSize(QSize(300, Style::m_leftPageHeight)); m_minAllPage = new QWidget(); - m_minAllPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minAllPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minAllListView = new ListView(m_minAllPage); - m_minAllListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minAllListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minAllListView->setFrameShape(QFrame::NoFrame); m_leftStackedWidget->addWidget(m_minAllPage); m_minAllListView->installEventFilter(this); m_minLetterPage = new QWidget(); - m_minLetterPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minLetterPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minLetterListView = new ListView(m_minLetterPage); - m_minLetterListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minLetterListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minLetterListView->setFrameShape(QFrame::NoFrame); m_leftStackedWidget->addWidget(m_minLetterPage); m_minLetterListView->installEventFilter(this); m_minFuncPage = new QWidget(); - m_minFuncPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minFuncPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minFuncListView = new ListView(m_minFuncPage); - m_minFuncListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minFuncListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minFuncListView->setFrameShape(QFrame::NoFrame); m_leftStackedWidget->addWidget(m_minFuncPage); m_minFuncListView->installEventFilter(this); m_minSearchResultPage = new QWidget(); - m_minSearchResultPage->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minSearchResultPage->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minSearchResultListView = new ListView(m_minSearchResultPage); - m_minSearchResultListView->setFixedSize(QSize(Style::leftPageWidth, Style::leftPageHeight)); + m_minSearchResultListView->setFixedSize(QSize(Style::m_leftPageWidth, Style::m_leftPageHeight)); m_minSearchResultListView->installEventFilter(this); m_leftStackedWidget->addWidget(m_minSearchResultPage); } @@ -446,9 +446,9 @@ void MainWindow::initRecentWidget() //最近视图 m_recentListView = new ListView(m_recentPage); m_recentListView->installEventFilter(this); - m_recentListView->setFixedSize(QSize(Style::rightViewWidth, Style::rightViewHeight)); + m_recentListView->setFixedSize(QSize(Style::m_rightViewWidth, Style::m_rightViewHeight)); m_recentTextlabel = new QLabel(m_recentPage); - m_recentTextlabel->setFixedSize(QSize(Style::rightViewWidth, Style::rightViewHeight)); + m_recentTextlabel->setFixedSize(QSize(Style::m_rightViewWidth, Style::m_rightViewHeight)); m_recentTextlabel->setAlignment(Qt::AlignCenter); m_recentTextlabel->setText(QApplication::translate("MainWindow", "No recent files")); @@ -847,10 +847,10 @@ void MainWindow::primaryScreenChangeSlot() void MainWindow::appClassificationBtnClickedSlot() { - m_leaveAnimation->setStartValue(QRect(0, 0, Style::leftPageWidth, Style::leftPageHeight)); + m_leaveAnimation->setStartValue(QRect(0, 0, Style::m_leftPageWidth, Style::m_leftPageHeight)); m_leaveAnimation->setEndValue(QRect(0, 0, 0, 0)); - m_enterAnimation->setStartValue(QRect(-40, -40, Style::leftPageWidth + 80, Style::leftPageHeight + 80)); - m_enterAnimation->setEndValue(QRect(10, 0, Style::leftPageWidth - 20, Style::leftPageHeight - 60)); + m_enterAnimation->setStartValue(QRect(-40, -40, Style::m_leftPageWidth + 80, Style::m_leftPageHeight + 80)); + m_enterAnimation->setEndValue(QRect(10, 0, Style::m_leftPageWidth - 20, Style::m_leftPageHeight - 60)); m_leaveAnimation->setDuration(10); m_enterAnimation->setDuration(100); @@ -948,7 +948,7 @@ bool MainWindow::eventFilter(QObject *target, QEvent *event) if (target == m_selectMenuButton) { m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true) - .pixmap(QSize(Style::miniIconSize, Style::miniIconSize))); + .pixmap(QSize(Style::m_miniIconSize, Style::m_miniIconSize))); selectIconAnimation(true); } } @@ -1152,7 +1152,7 @@ void MainWindow::searchAppSlot(QString arg) } void MainWindow::on_selectMenuButton_triggered(QAction *arg1) { - m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true).pixmap(QSize(Style::miniIconSize, Style::miniIconSize))); + m_selectMenuButton->setIcon(getCurIcon(":/data/img/mainviewwidget/downarrow.svg", true).pixmap(QSize(Style::m_miniIconSize, Style::m_miniIconSize))); selectIconAnimation(false); if (arg1 == m_allAction) { @@ -1277,7 +1277,7 @@ void MainWindow::on_minMaxChangeButton_clicked() m_maxAnimation->setDuration(1); } else { m_animationPage->show(); - m_animationPage->setGeometry(this->x(), this->y(), Style::minw, Style::minh); + m_animationPage->setGeometry(this->x(), this->y(), Style::m_minw, Style::m_minh); m_animationPage->raise(); m_animationPage->repaint(); m_maxAnimation->setDuration(260); @@ -1288,7 +1288,7 @@ void MainWindow::on_minMaxChangeButton_clicked() loop.exec(); m_maxAnimation->setEasingCurve(QEasingCurve::OutExpo); // m_maxAnimation->setStartValue(QRect(Style::m_primaryScreenX, Style::m_primaryScreenY + Style::m_availableScreenHeight - Style::minh, Style::minw, Style::minh)); - m_maxAnimation->setStartValue(QRect(this->x(), this->y(), Style::minw, Style::minh)); + m_maxAnimation->setStartValue(QRect(this->x(), this->y(), Style::m_minw, Style::m_minh)); m_maxAnimation->setEndValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); m_maxAnimation->start(QAbstractAnimation::DeleteWhenStopped); @@ -1341,27 +1341,27 @@ void MainWindow::setMinWindowPos() if (position == 0) { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { - kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh)); + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + height - Style::m_minh - 3, Style::m_minw, Style::m_minh)); } else { - this->setGeometry(QRect(x + 4, y + height - Style::minh - 3, Style::minw, Style::minh)); + this->setGeometry(QRect(x + 4, y + height - Style::m_minh - 3, Style::m_minw, Style::m_minh)); } } else if (position == 1) { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { - kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::minw, Style::minh)); + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::m_minw, Style::m_minh)); } else { - this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh)); + this->setGeometry(QRect(x + 4, y + 4, Style::m_minw, Style::m_minh)); } } else if (position == 2) { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { - kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::minw, Style::minh)); + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + 4, y + 4, Style::m_minw, Style::m_minh)); } else { - this->setGeometry(QRect(x + 4, y + 4, Style::minw, Style::minh)); + this->setGeometry(QRect(x + 4, y + 4, Style::m_minw, Style::m_minh)); } } else { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { - kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh)); + kdk::WindowManager::setGeometry(this->windowHandle(), QRect(x + width - Style::m_minw - 4, y + 4, Style::m_minw, Style::m_minh)); } else { - this->setGeometry(QRect(x + width - Style::minw - 4, y + 4, Style::minw, Style::minh)); + this->setGeometry(QRect(x + width - Style::m_minw - 4, y + 4, Style::m_minw, Style::m_minh)); } } } @@ -1376,7 +1376,7 @@ void MainWindow::setMaxWindowPos() void MainWindow::repaintWidget() { Style::initWidStyle(); - this->setMinimumSize(Style::minw, Style::minh); + this->setMinimumSize(Style::m_minw, Style::m_minh); int x = Style::m_primaryScreenX; int y = Style::m_primaryScreenY; int width = Style::m_availableScreenWidth; @@ -1411,7 +1411,7 @@ void MainWindow::showNormalWindowSlot() m_isFullScreen = false; m_minAnimation->setEasingCurve(QEasingCurve::OutExpo); m_minAnimation->setStartValue(QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); - m_minAnimation->setEndValue(QRect(this->x(), this->y(), Style::minw, Style::minh)); + m_minAnimation->setEndValue(QRect(this->x(), this->y(), Style::m_minw, Style::m_minh)); m_minAnimation->start(QAbstractAnimation::DeleteWhenStopped); m_fullWindow->hide(); diff --git a/src/UserInterface/tabletwindow.cpp b/src/UserInterface/tabletwindow.cpp index 378ad1f..168a0ab 100755 --- a/src/UserInterface/tabletwindow.cpp +++ b/src/UserInterface/tabletwindow.cpp @@ -69,12 +69,12 @@ void TabletWindow::initSize() { Style::initWidStyle(); this->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - this->setFixedSize(Style::ScreenWidth, Style::ScreenHeight); - m_leftWidget->setFixedSize(Style::m_leftWidWidth, Style::CenterWindHeight); - m_leftWidget->layout()->setContentsMargins(Style::TimeWidgetLeft, Style::TimeWidgetTop, 0, 0); - m_scrollAreaWid->setFixedHeight(Style::CenterWindHeight); - m_scrollArea->setFixedSize(Style::ScreenWidth, Style::CenterWindHeight); - m_buttonWidget->setFixedSize(Style::OtherPageViewWidth, 30); + this->setFixedSize(Style::m_screenWidth, Style::m_screenHeight); + m_leftWidget->setFixedSize(Style::m_leftWidWidth, Style::m_centerWindHeight); + m_leftWidget->layout()->setContentsMargins(Style::m_timeWidgetLeft, Style::m_timeWidgetTop, 0, 0); + m_scrollAreaWid->setFixedHeight(Style::m_centerWindHeight); + m_scrollArea->setFixedSize(Style::m_screenWidth, Style::m_centerWindHeight); + m_buttonWidget->setFixedSize(Style::m_otherPageViewWidth, 30); } void TabletWindow::initUi() @@ -557,15 +557,15 @@ void TabletWindow::insertAppList(QStringList desktopfplist) m_firstPageLayout->setContentsMargins(0, 0, 0, 0); m_firstPageWidget->setLayout(m_firstPageLayout); m_firstPageLayout->addWidget(m_leftWidget); - listview->setFixedSize(Style::FirsPageViewWidth, Style::CenterWindHeight); + listview->setFixedSize(Style::m_firsPageViewWidth, Style::m_centerWindHeight); m_firstPageLayout->addWidget(listview); m_scrollAreaWidLayout->addWidget(m_firstPageWidget); - listview->setGridSize(QSize(Style::TabletItemSizeWidthFirst, Style::AppListItemSizeHeight)); + listview->setGridSize(QSize(Style::m_tabletItemSizeWidthFirst, Style::m_appListItemSizeHeight)); m_isFirstPage = false; } else { listview = new TabletListView(this, 1); - listview->setFixedSize(Style::OtherPageViewWidth, Style::CenterWindHeight); - listview->setGridSize(QSize(Style::TabletItemSizeWidthOther, Style::AppListItemSizeHeight)); + listview->setFixedSize(Style::m_otherPageViewWidth, Style::m_centerWindHeight); + listview->setGridSize(QSize(Style::m_tabletItemSizeWidthOther, Style::m_appListItemSizeHeight)); m_scrollAreaWidLayout->addWidget(listview); } @@ -936,7 +936,7 @@ void TabletWindow::buttonClicked(QAbstractButton *button) if (!(m_scrollAnimation->state() == QPropertyAnimation::Running)) { int idd = m_buttonGroup->id(button); int preNum = m_curPageNum; - Style::nowpagenum = idd; + Style::m_nowpagenum = idd; // QDBusReply res = usrInterface->call("get_current_tabletmode"); for (int page = 1; page <= m_pagemanager->getAppPageVector().size(); page++) { diff --git a/src/UtilityFunction/Style/style.cpp b/src/UtilityFunction/Style/style.cpp index 793cb7e..c5620ea 100755 --- a/src/UtilityFunction/Style/style.cpp +++ b/src/UtilityFunction/Style/style.cpp @@ -31,11 +31,11 @@ int Style::m_primaryScreenX = 0; int Style::m_primaryScreenY = 0; int Style::m_panelPosition = 0; //默认窗口 -int Style::minw = 0; -int Style::minh = 0; -int Style::leftPageWidth = 0; -int Style::leftPageHeight = 0; -int Style::defaultQueryLineEditIconSize = 0; +int Style::m_minw = 0; +int Style::m_minh = 0; +int Style::m_leftPageWidth = 0; +int Style::m_leftPageHeight = 0; +int Style::m_defaultQueryLineEditIconSize = 0; /** * 全屏窗口 */ @@ -43,75 +43,62 @@ int Style::defaultQueryLineEditIconSize = 0; int Style::m_availableScreenWidth = 0; int Style::m_availableScreenHeight = 0; //搜索栏 -int Style::QueryLineEditHeight = 0; +int Style::m_queryLineEditHeight = 0; //左侧栏 int Style::m_leftWidWidth = 0; -int Style::LeftMargin = 0; -int Style::LeftBtnWidth = 0; -int Style::LeftBtnHeight = 0; -int Style::LeftLetterBtnHeight = 0; -int Style::LeftLetterFontSize = 0; -int Style::LeftIconSize = 0; -int Style::LeftSpaceIconText = 0; -int Style::LeftSpaceBetweenItem = 0; +int Style::m_leftMargin = 0; +int Style::m_leftBtnWidth = 0; +int Style::m_leftBtnHeight = 0; +int Style::m_leftLetterBtnHeight = 0; +int Style::m_leftLetterFontSize = 0; +int Style::m_leftIconSize = 0; +int Style::m_leftSpaceIconText = 0; +int Style::m_leftSpaceBetweenItem = 0; //应用列表栏 int Style::m_applistWidWidth = 0; int Style::m_applistAreaWidth = 0; int Style::m_applistWidHeight = 0; int Style::m_scrollBarHeight = 0; -int Style::AppListIconSize = 0; -int Style::AppListBigIconSize = 0; +int Style::m_appListIconSize = 0; +int Style::m_appListBigIconSize = 0; int Style::m_appTextRectHeight = 0; int Style::m_boundaryOffset = 0; -int Style::AppListItemSizeWidth = 0; -int Style::TabletItemSizeWidthOther = 0; -int Style::TabletItemSizeWidthFirst = 0; -int Style::FirsPageViewWidth = 0; -int Style::OtherPageViewWidth = 0; +int Style::m_appListItemSizeWidth = 0; +int Style::m_tabletItemSizeWidthOther = 0; +int Style::m_tabletItemSizeWidthFirst = 0; +int Style::m_firsPageViewWidth = 0; +int Style::m_otherPageViewWidth = 0; int Style::m_applistGridSizeWidth = 0; -int Style::AppLeftSpace = 0; +int Style::m_appLeftSpace = 0; int Style::m_appTopSpace = 0; -int Style::AppSpaceBetweenIconText = 0; -int Style::FirstPageSpace = 0; -int Style::OtherPageSpace = 0; +int Style::m_appSpaceBetweenIconText = 0; +int Style::m_firstPageSpace = 0; +int Style::m_otherPageSpace = 0; //侧边栏primaryScreen -int Style::SideBarWidWidth = 0; +int Style::m_sideBarWidWidth = 0; -int Style::appLine = 0; -int Style::appColumn = 0; -int Style::appLineFirst = 0; -int Style::appColumnFirst = 0; -int Style::appPage = 1; -int Style::appNum = 0; -int Style::nowpagenum = 1; -int Style::appRows = 0; -bool Style::ScreenRotation = false; -int Style::AppListItemSizeHeight = 270; -int Style::AppListViewTopMargin = 0; -int Style::ScreenWidth = 0; -int Style::ScreenHeight = 0; -int Style::AppListViewLeftMargin = 52; -int Style::AppListViewBottomMargin = 20; -int Style::AppListViewRightMargin = 0; -int Style::TimeWidgetTop = 81; -int Style::TimeWidgetLeft = 112; -int Style::CenterWindHeight = 0; +int Style::m_appLine = 0; +int Style::m_appColumn = 0; +int Style::m_appLineFirst = 0; +int Style::m_appColumnFirst = 0; +int Style::m_appPage = 1; +int Style::m_appNum = 0; +int Style::m_nowpagenum = 1; +int Style::m_appRows = 0; +bool Style::m_screenRotation = false; +int Style::m_appListItemSizeHeight = 270; +int Style::m_appListViewTopMargin = 0; +int Style::m_screenWidth = 0; +int Style::m_screenHeight = 0; +int Style::m_appListViewBottomMargin = 20; +int Style::m_timeWidgetTop = 81; +int Style::m_timeWidgetLeft = 112; +int Style::m_centerWindHeight = 0; -int Style::GroupAppColumn = 1; -int Style::GroupAppRow = 1; - -int Style::ButtonWidgetWidth = 56; - -int Style::ToolWidgetLeft = 24; -bool Style::IsWideScreen = false; - -int Style::DropMenuWidth = 0; -int Style::DropMenuHeight = 0; -int Style::miniIconSize = 0; - -int Style::rightViewWidth = 0; -int Style::rightViewHeight = 0; +int Style::m_miniIconSize = 0; +int Style::m_rightViewWidth = 0; +int Style::m_rightViewHeight = 0; void Style::initWidStyle() { @@ -132,98 +119,95 @@ void Style::initWidStyle() } if (m_availableScreenWidth == 800 && m_availableScreenHeight == 600) { - minw = 320; - minh = 500; - leftPageWidth = 300; - leftPageHeight = 517; + m_minw = 320; + m_minh = 500; + m_leftPageWidth = 300; + m_leftPageHeight = 517; } else { - minw = 652; - minh = 590; - leftPageWidth = 300; - leftPageHeight = 517; + m_minw = 652; + m_minh = 590; + m_leftPageWidth = 300; + m_leftPageHeight = 517; } if (m_availableScreenWidth >= 2000 && m_availableScreenWidth <= 4000) { - LeftMargin = 20; - LeftLetterFontSize = 14; - LeftSpaceBetweenItem = 15; - AppListIconSize = 96; - AppListItemSizeWidth = 168; + m_leftMargin = 20; + m_leftLetterFontSize = 14; + m_leftSpaceBetweenItem = 15; + m_appListIconSize = 96; + m_appListItemSizeWidth = 168; m_applistGridSizeWidth = 240; - AppSpaceBetweenIconText = 20; + m_appSpaceBetweenIconText = 20; } else if (m_availableScreenWidth >= 1920 && m_availableScreenWidth < 2000) { - LeftMargin = 20; - LeftLetterFontSize = 14; - LeftSpaceBetweenItem = 15; - AppListIconSize = 86; - AppListItemSizeWidth = 168; + m_leftMargin = 20; + m_leftLetterFontSize = 14; + m_leftSpaceBetweenItem = 15; + m_appListIconSize = 86; + m_appListItemSizeWidth = 168; m_applistGridSizeWidth = 220; - AppSpaceBetweenIconText = 18; + m_appSpaceBetweenIconText = 18; } else if (m_availableScreenWidth >= 1600 && m_availableScreenWidth < 1920) { - LeftMargin = 10; - LeftLetterFontSize = 11; - LeftSpaceBetweenItem = 10; - AppListIconSize = 86; - AppListItemSizeWidth = 150; + m_leftMargin = 10; + m_leftLetterFontSize = 11; + m_leftSpaceBetweenItem = 10; + m_appListIconSize = 86; + m_appListItemSizeWidth = 150; m_applistGridSizeWidth = 180; - AppSpaceBetweenIconText = 14; + m_appSpaceBetweenIconText = 14; } else if (m_availableScreenWidth >= 1366 && m_availableScreenWidth < 1600) { - LeftMargin = 10; - LeftLetterFontSize = 11; - LeftSpaceBetweenItem = 10; - AppListIconSize = 64; - AppListItemSizeWidth = 112; + m_leftMargin = 10; + m_leftLetterFontSize = 11; + m_leftSpaceBetweenItem = 10; + m_appListIconSize = 64; + m_appListItemSizeWidth = 112; m_applistGridSizeWidth = 140; - AppSpaceBetweenIconText = 0; + m_appSpaceBetweenIconText = 0; } else if (m_availableScreenWidth >= 1280 && m_availableScreenWidth < 1366) { - LeftMargin = 10; - LeftLetterFontSize = 11; - LeftSpaceBetweenItem = 10; - AppListIconSize = 64; - AppListItemSizeWidth = 112; + m_leftMargin = 10; + m_leftLetterFontSize = 11; + m_leftSpaceBetweenItem = 10; + m_appListIconSize = 64; + m_appListItemSizeWidth = 112; m_applistGridSizeWidth = 142; - AppSpaceBetweenIconText = 14; + m_appSpaceBetweenIconText = 14; } else if (m_availableScreenWidth >= 1152 && m_availableScreenWidth < 1280) { - LeftMargin = 10; - LeftLetterFontSize = 11; - LeftSpaceBetweenItem = 10; - AppListIconSize = 64; - AppListItemSizeWidth = 112; + m_leftMargin = 10; + m_leftLetterFontSize = 11; + m_leftSpaceBetweenItem = 10; + m_appListIconSize = 64; + m_appListItemSizeWidth = 112; m_applistGridSizeWidth = 142; - AppSpaceBetweenIconText = 14; + m_appSpaceBetweenIconText = 14; } else if (m_availableScreenWidth > 800 && m_availableScreenWidth < 1152) { - LeftMargin = 10; - LeftLetterFontSize = 11; - LeftSpaceBetweenItem = 10; - AppListIconSize = 64; - AppListItemSizeWidth = 112; + m_leftMargin = 10; + m_leftLetterFontSize = 11; + m_leftSpaceBetweenItem = 10; + m_appListIconSize = 64; + m_appListItemSizeWidth = 112; m_applistGridSizeWidth = 141; - AppSpaceBetweenIconText = 14; + m_appSpaceBetweenIconText = 14; } else { - LeftMargin = 10; - LeftLetterFontSize = 11; - LeftSpaceBetweenItem = 10; - AppListIconSize = 64; - AppListItemSizeWidth = 112; + m_leftMargin = 10; + m_leftLetterFontSize = 11; + m_leftSpaceBetweenItem = 10; + m_appListIconSize = 64; + m_appListItemSizeWidth = 112; m_applistGridSizeWidth = 138; - AppSpaceBetweenIconText = 14; + m_appSpaceBetweenIconText = 14; } - LeftBtnWidth = 68 + 5 * len; - LeftBtnHeight = 34; - QueryLineEditHeight = 30; - LeftLetterBtnHeight = 25; - LeftIconSize = 19; - DropMenuWidth = 170; - DropMenuHeight = 112; - miniIconSize = 8; - rightViewWidth = 324; - rightViewHeight = 470; - LeftSpaceIconText = 14; + m_leftBtnWidth = 68 + 5 * len; + m_leftBtnHeight = 34; + m_queryLineEditHeight = 30; + m_leftLetterBtnHeight = 25; + m_leftIconSize = 19; + m_rightViewWidth = 324; + m_rightViewHeight = 470; + m_leftSpaceIconText = 14; m_appTextRectHeight = 30; - m_appTopSpace = (AppListItemSizeWidth - AppSpaceBetweenIconText - AppListIconSize - m_appTextRectHeight) / 2; - m_boundaryOffset = (m_applistGridSizeWidth - AppListItemSizeWidth) + m_appTopSpace + 10; + m_appTopSpace = (m_appListItemSizeWidth - m_appSpaceBetweenIconText - m_appListIconSize - m_appTextRectHeight) / 2; + m_boundaryOffset = (m_applistGridSizeWidth - m_appListItemSizeWidth) + m_appTopSpace + 10; m_applistWidWidth = m_availableScreenWidth / 1.25; m_applistWidWidth = m_applistWidWidth - (m_applistWidWidth % m_applistGridSizeWidth) + 2; m_applistWidHeight = m_availableScreenHeight - 120; @@ -232,34 +216,32 @@ void Style::initWidStyle() m_applistAreaWidth = m_applistWidWidth + 20; m_scrollBarHeight = 10; } else { - ScreenWidth = QApplication::primaryScreen()->geometry().width(); - ScreenHeight = QApplication::primaryScreen()->geometry().height(); + m_screenWidth = QApplication::primaryScreen()->geometry().width(); + m_screenHeight = QApplication::primaryScreen()->geometry().height(); myDebug() << "Winches" << qApp->desktop()->widthMM(); myDebug() << "Hinches" << qApp->desktop()->heightMM(); - myDebug() << "ScreenWidth" << ScreenWidth; - myDebug() << "ScreenHeight" << ScreenHeight; - appColumn = 6; - appLine = 4; - appLineFirst = 4; - AppListViewTopMargin = 70; - AppListViewLeftMargin = 52; - AppListViewBottomMargin = AppListViewTopMargin - 30; - AppListViewRightMargin = 0; - m_leftWidWidth = ScreenWidth * 0.3; - FirsPageViewWidth = ScreenWidth - m_leftWidWidth - 5; - appColumnFirst = FirsPageViewWidth / 220; - OtherPageViewWidth = ScreenWidth; - TabletItemSizeWidthFirst = FirsPageViewWidth / appColumnFirst; - TabletItemSizeWidthOther = (ScreenWidth - 5) / appColumn; - CenterWindHeight = ScreenHeight - AppListViewBottomMargin - AppListViewTopMargin; - AppListItemSizeHeight = CenterWindHeight / appLine; - AppListIconSize = 96; - AppListBigIconSize = 108; - m_appTopSpace = (AppListItemSizeHeight - AppListIconSize) / 2; - AppLeftSpace = (TabletItemSizeWidthFirst - AppListIconSize) / 2; - TimeWidgetTop = (CenterWindHeight - 870) / 2; - TimeWidgetLeft = (m_leftWidWidth - 400) / 2; - FirstPageSpace = AppLeftSpace; - OtherPageSpace = (TabletItemSizeWidthOther - AppListIconSize) / 2; + myDebug() << "ScreenWidth" << m_screenWidth; + myDebug() << "ScreenHeight" << m_screenHeight; + m_appColumn = 6; + m_appLine = 4; + m_appLineFirst = 4; + m_appListViewTopMargin = 70; + m_appListViewBottomMargin = m_appListViewTopMargin - 30; + m_leftWidWidth = m_screenWidth * 0.3; + m_firsPageViewWidth = m_screenWidth - m_leftWidWidth - 5; + m_appColumnFirst = m_firsPageViewWidth / 220; + m_otherPageViewWidth = m_screenWidth; + m_tabletItemSizeWidthFirst = m_firsPageViewWidth / m_appColumnFirst; + m_tabletItemSizeWidthOther = (m_screenWidth - 5) / m_appColumn; + m_centerWindHeight = m_screenHeight - m_appListViewBottomMargin - m_appListViewTopMargin; + m_appListItemSizeHeight = m_centerWindHeight / m_appLine; + m_appListIconSize = 96; + m_appListBigIconSize = 108; + m_appTopSpace = (m_appListItemSizeHeight - m_appListIconSize) / 2; + m_appLeftSpace = (m_tabletItemSizeWidthFirst - m_appListIconSize) / 2; + m_timeWidgetTop = (m_centerWindHeight - 870) / 2; + m_timeWidgetLeft = (m_leftWidWidth - 400) / 2; + m_firstPageSpace = m_appLeftSpace; + m_otherPageSpace = (m_tabletItemSizeWidthOther - m_appListIconSize) / 2; } } diff --git a/src/UtilityFunction/Style/style.h b/src/UtilityFunction/Style/style.h index 195836d..415ac56 100755 --- a/src/UtilityFunction/Style/style.h +++ b/src/UtilityFunction/Style/style.h @@ -85,11 +85,11 @@ public: static int m_primaryScreenY; static int m_panelPosition; //默认窗口 - static int minw; - static int minh; - static int leftPageWidth; - static int leftPageHeight; - static int defaultQueryLineEditIconSize; + static int m_minw; + static int m_minh; + static int m_leftPageWidth; + static int m_leftPageHeight; + static int m_defaultQueryLineEditIconSize; /** * 全屏 @@ -98,89 +98,71 @@ public: static int m_availableScreenWidth; static int m_availableScreenHeight; //搜索栏 - static int QueryLineEditHeight;//搜索框高度 + static int m_queryLineEditHeight;//搜索框高度 //左侧栏 static int m_leftWidWidth; //宽度 - static int LeftMargin; //内左侧边距 - static int LeftBtnWidth;//按钮宽度 - static int LeftBtnHeight;//按钮高度 - static int LeftLetterBtnHeight;//按钮高度 - static int LeftLetterFontSize; //字体大小 - static int LeftIconSize; //图标大小 - static int LeftSpaceIconText; //按钮图标与文字内边距 - static int LeftSpaceBetweenItem; //item间距 + static int m_leftMargin; //内左侧边距 + static int m_leftBtnWidth;//按钮宽度 + static int m_leftBtnHeight;//按钮高度 + static int m_leftLetterBtnHeight;//按钮高度 + static int m_leftLetterFontSize; //字体大小 + static int m_leftIconSize; //图标大小 + static int m_leftSpaceIconText; //按钮图标与文字内边距 + static int m_leftSpaceBetweenItem; //item间距 //应用列表栏 static int m_applistWidWidth; //宽度 static int m_applistAreaWidth; static int m_applistWidHeight; //高度 static int m_scrollBarHeight; - static int AppListIconSize; //图标大小 - static int AppListBigIconSize; + static int m_appListIconSize; //图标大小 + static int m_appListBigIconSize; static int m_appTextRectHeight; static int m_boundaryOffset; - static int AppListItemSizeWidth; //item大小 - static int TabletItemSizeWidthFirst; - static int TabletItemSizeWidthOther; - static int FirsPageViewWidth; - static int OtherPageViewWidth; + static int m_appListItemSizeWidth; //item大小 + static int m_tabletItemSizeWidthFirst; + static int m_tabletItemSizeWidthOther; + static int m_firsPageViewWidth; + static int m_otherPageViewWidth; static int m_applistGridSizeWidth; //网格大小 - static int AppLeftSpace;//左侧边距 + static int m_appLeftSpace;//左侧边距 static int m_appTopSpace;//上侧边距 - static int AppSpaceBetweenIconText;//图标与文字边距 - static int FirstPageSpace; - static int OtherPageSpace; + static int m_appSpaceBetweenIconText;//图标与文字边距 + static int m_firstPageSpace; + static int m_otherPageSpace; /** * 侧边栏 */ - static int SideBarWidWidth; //宽度 + static int m_sideBarWidWidth; //宽度 - static int appLine; - static int appColumn; - static int appLineFirst; - static int appColumnFirst; - static int appNum; - static int appPage; - static int nowpagenum; - static int appRows; //app的总行数 - static bool ScreenRotation; + static int m_appLine; + static int m_appColumn; + static int m_appLineFirst; + static int m_appColumnFirst; + static int m_appNum; + static int m_appPage; + static int m_nowpagenum; + static int m_appRows; //app的总行数 + static bool m_screenRotation; - static int AppListItemSizeHeight; + static int m_appListItemSizeHeight; // static int ScreenWidth; // static int ScreenHeight; + static int m_screenWidth; + static int m_screenHeight; + static int m_appListViewTopMargin; + static int m_appListViewBottomMargin; + static int m_centerWindHeight; - static int LeftWidgetWidth; + static int m_timeWidgetTop; + static int m_timeWidgetLeft; - static int ScreenWidth; - static int ScreenHeight; - static int AppListViewTopMargin; - static int AppListViewLeftMargin; - static int AppListViewBottomMargin; - static int AppListViewRightMargin; - static int CenterWindHeight; + static int m_miniIconSize; - static int GroupAppRow; - static int GroupAppColumn; - - static int TimeWidgetTop; - static int TimeWidgetLeft; - - static int ButtonWidgetWidth; - - //扩展的开始菜单应用列表 - static int ToolWidgetLeft; - static int WideAppListItemSizeWidth; - static int WideAppListItemSizeHeight; - static int WideAppViewLeftMargin; - static bool IsWideScreen; - static int DropMenuWidth; - static int DropMenuHeight; - static int miniIconSize; - - static int rightViewWidth; - static int rightViewHeight; + static int m_rightViewWidth; + static int m_rightViewHeight; }; diff --git a/src/UtilityFunction/thumbnail.cpp b/src/UtilityFunction/thumbnail.cpp index ed6905a..d7d6e18 100755 --- a/src/UtilityFunction/thumbnail.cpp +++ b/src/UtilityFunction/thumbnail.cpp @@ -40,11 +40,11 @@ void ThumbNail::initUi() setWindowFlags(Qt::FramelessWindowHint); setAttribute(Qt::WA_TranslucentBackground); this->setStyleSheet("border:0px;background:transparent;"); - this->setFixedSize(Style::AppListIconSize, Style::AppListIconSize); + this->setFixedSize(Style::m_appListIconSize, Style::m_appListIconSize); iconLabel = new QLabel(this); iconLabel->setStyleSheet("border:0px;background-color:transparent;"); iconLabel->setFocusPolicy(Qt::NoFocus); - iconLabel->setFixedSize(Style::AppListIconSize, Style::AppListIconSize); + iconLabel->setFixedSize(Style::m_appListIconSize, Style::m_appListIconSize); layout = new QVBoxLayout(this); layout->setContentsMargins(0, 0, 0, 0); layout->setSpacing(0); @@ -134,11 +134,11 @@ void ThumbNail::setupthumbnail(QString desktopfp) QPixmap pixmap ; if (appDisable(desktopfp) == 1) { - pixmap = icon.pixmap((Style::AppListIconSize, Style::AppListIconSize), QIcon::Disabled, QIcon::Off); + pixmap = icon.pixmap((Style::m_appListIconSize, Style::m_appListIconSize), QIcon::Disabled, QIcon::Off); //qDebug()<<"appDisable(desktopfp)"<setPixmap(pixmap);