From 379d4b78bf4168b7c51a59b7717a9b8cb697fb63 Mon Sep 17 00:00:00 2001 From: cutefishd Date: Thu, 6 May 2021 11:24:12 +0800 Subject: [PATCH] Update icon size --- .gitignore | 1 + .vscode/settings.json | 5 ----- qml/AppItem.qml | 5 ++++- src/applicationitem.h | 1 + src/applicationmodel.cpp | 4 ++++ src/applicationmodel.h | 3 ++- src/mainwindow.cpp | 3 ++- 7 files changed, 14 insertions(+), 8 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.gitignore b/.gitignore index 733eeec..98bda1b 100644 --- a/.gitignore +++ b/.gitignore @@ -52,3 +52,4 @@ compile_commands.json *creator.user* build/* +.vscode/ diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index ab54f21..0000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "files.associations": { - "*.moc": "cpp" - } -} \ No newline at end of file diff --git a/qml/AppItem.qml b/qml/AppItem.qml index a870ca2..e2ea3d1 100644 --- a/qml/AppItem.qml +++ b/qml/AppItem.qml @@ -12,7 +12,7 @@ DockItem { isActive: model.isActive popupText: model.visibleName enableActivateDot: windowCount !== 0 - draggable: model.appId === "cutefish-launcher" ? false : true + draggable: !model.fixed dragItemIndex: index onXChanged: { @@ -80,6 +80,9 @@ DockItem { function updateGeometry() { + if (model.fixed) + return + appModel.updateGeometries(model.appId, Qt.rect(appItem.mapToGlobal(0, 0).x, appItem.mapToGlobal(0, 0).y, appItem.width, appItem.height)) diff --git a/src/applicationitem.h b/src/applicationitem.h index c5d3c3d..773866d 100644 --- a/src/applicationitem.h +++ b/src/applicationitem.h @@ -20,6 +20,7 @@ public: int currentActive = 0; bool isActive = false; bool isPinned = false; + bool fixed = false; bool operator==(ApplicationItem item) { return item.id == this->id; diff --git a/src/applicationmodel.cpp b/src/applicationmodel.cpp index 0bd9e63..6f1ec26 100644 --- a/src/applicationmodel.cpp +++ b/src/applicationmodel.cpp @@ -53,6 +53,7 @@ QHash ApplicationModel::roleNames() const roles[WindowCountRole] = "windowCount"; roles[IsPinnedRole] = "isPinned"; roles[DesktopFileRole] = "desktopFile"; + roles[FixedItemRole] = "fixed"; return roles; } @@ -78,6 +79,8 @@ QVariant ApplicationModel::data(const QModelIndex &index, int role) const return item->isPinned; case DesktopFileRole: return item->desktopPath; + case FixedItemRole: + return item->fixed; default: return QVariant(); } @@ -280,6 +283,7 @@ void ApplicationModel::initPinnedApplications() item->exec = "cutefish-launcher"; item->iconName = "qrc:/svg/launcher.svg"; item->visibleName = tr("Launcher"); + item->fixed = true; m_appItems.append(item); // Pinned Apps diff --git a/src/applicationmodel.h b/src/applicationmodel.h index fe77bed..cad5243 100644 --- a/src/applicationmodel.h +++ b/src/applicationmodel.h @@ -37,7 +37,8 @@ public: ActiveRole, WindowCountRole, IsPinnedRole, - DesktopFileRole + DesktopFileRole, + FixedItemRole }; explicit ApplicationModel(QObject *parent = nullptr); diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 990f4af..23f58f8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -91,7 +91,8 @@ QRect MainWindow::windowRect() const : availableGeometry.height() - m_settings->edgeMargins();; int appCount = m_appModel->rowCount(); - qreal iconSize = m_settings->iconSize() * qApp->devicePixelRatio(); + int iconSize = m_settings->iconSize(); + iconSize += iconSize * 0.1; int length = appCount * iconSize; if (length > maxLength) {