Update icon size

This commit is contained in:
cutefishd 2021-05-06 11:24:12 +08:00
parent 4eb3b17f1e
commit 379d4b78bf
7 changed files with 14 additions and 8 deletions

1
.gitignore vendored
View file

@ -52,3 +52,4 @@ compile_commands.json
*creator.user*
build/*
.vscode/

View file

@ -1,5 +0,0 @@
{
"files.associations": {
"*.moc": "cpp"
}
}

View file

@ -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))

View file

@ -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;

View file

@ -53,6 +53,7 @@ QHash<int, QByteArray> 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

View file

@ -37,7 +37,8 @@ public:
ActiveRole,
WindowCountRole,
IsPinnedRole,
DesktopFileRole
DesktopFileRole,
FixedItemRole
};
explicit ApplicationModel(QObject *parent = nullptr);

View file

@ -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) {