mirror of
https://github.com/linuxdeepin/dde-dock.git
synced 2025-06-04 17:33:05 +00:00
Update DockConstants
This commit is contained in:
parent
d340b25b8e
commit
1b04e2a3bc
@ -34,8 +34,8 @@ void AppItem::resizeResources()
|
|||||||
{
|
{
|
||||||
if (m_appIcon != NULL)
|
if (m_appIcon != NULL)
|
||||||
{
|
{
|
||||||
m_appIcon->resize(DockConstants::getInstants()->getIconSize(),
|
m_appIcon->resize(DockConstants::getInstants()->getAppIconSize(),
|
||||||
DockConstants::getInstants()->getIconSize());
|
DockConstants::getInstants()->getAppIconSize());
|
||||||
m_appIcon->move(width() / 2 - m_appIcon->width() / 2,
|
m_appIcon->move(width() / 2 - m_appIcon->width() / 2,
|
||||||
height() / 2 - m_appIcon->height() / 2);
|
height() / 2 - m_appIcon->height() / 2);
|
||||||
}
|
}
|
||||||
|
@ -14,12 +14,166 @@ DockConstants * DockConstants::getInstants()
|
|||||||
return dockConstants;
|
return dockConstants;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DockConstants::getIconSize()
|
DockConstants::DockMode DockConstants::getDockMode()
|
||||||
{
|
{
|
||||||
return this->iconSize;
|
return m_currentMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DockConstants::setIconSize(int value)
|
void DockConstants::setDockMode(DockMode value)
|
||||||
{
|
{
|
||||||
this->iconSize = value;
|
DockMode tmpValue = m_currentMode;
|
||||||
|
m_currentMode = value;
|
||||||
|
|
||||||
|
emit dockModeChanged(value, tmpValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int DockConstants::getDockHeight()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 60;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 50;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 40;
|
||||||
|
default:
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getItemHeight()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 60;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 50;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 40;
|
||||||
|
default:
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getNormalItemWidth()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 60;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 50;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 40;
|
||||||
|
default:
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getActivedItemWidth()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 60;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 50;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 80;
|
||||||
|
default:
|
||||||
|
return 50;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getAppItemSpacing()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 10;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 15;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 8;
|
||||||
|
default:
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getAppIconSize()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 48;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 32;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 24;
|
||||||
|
default:
|
||||||
|
return 32;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getAppletsItemHeight()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 60;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 50;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 40;
|
||||||
|
default:
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getAppletsItemWidth()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 60;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 40;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 40;
|
||||||
|
default:
|
||||||
|
return 40;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getAppletsItemSpacing()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 10;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 6;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 6;
|
||||||
|
default:
|
||||||
|
return 6;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int DockConstants::getAppletsIconSize()
|
||||||
|
{
|
||||||
|
switch (m_currentMode)
|
||||||
|
{
|
||||||
|
case DockConstants::FashionMode:
|
||||||
|
return 48;
|
||||||
|
case DockConstants::EfficientMode:
|
||||||
|
return 24;
|
||||||
|
case DockConstants::ClassicMode:
|
||||||
|
return 24;
|
||||||
|
default:
|
||||||
|
return 24;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -4,18 +4,9 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
struct DockItemData {
|
|
||||||
QString appTitle;
|
|
||||||
QString appIconPath;
|
|
||||||
QString appExePath;
|
|
||||||
bool appActived;
|
|
||||||
QStringList appPreviews;
|
|
||||||
};
|
|
||||||
|
|
||||||
class DockConstants : public QObject
|
class DockConstants : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int iconSize READ getIconSize WRITE setIconSize)
|
|
||||||
public:
|
public:
|
||||||
static DockConstants * getInstants();
|
static DockConstants * getInstants();
|
||||||
|
|
||||||
@ -25,8 +16,22 @@ public:
|
|||||||
ClassicMode
|
ClassicMode
|
||||||
};
|
};
|
||||||
|
|
||||||
int getIconSize();
|
DockMode getDockMode();
|
||||||
void setIconSize(int value);
|
void setDockMode(DockMode value);
|
||||||
|
|
||||||
|
int getDockHeight();
|
||||||
|
int getItemHeight();
|
||||||
|
int getNormalItemWidth();
|
||||||
|
int getActivedItemWidth();
|
||||||
|
int getAppItemSpacing();
|
||||||
|
int getAppIconSize();
|
||||||
|
int getAppletsItemHeight();
|
||||||
|
int getAppletsItemWidth();
|
||||||
|
int getAppletsItemSpacing();
|
||||||
|
int getAppletsIconSize();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void dockModeChanged(DockConstants::DockMode newMode,DockConstants::DockMode oldMode);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
explicit DockConstants(QObject *parent = 0);
|
explicit DockConstants(QObject *parent = 0);
|
||||||
@ -34,8 +39,8 @@ private:
|
|||||||
private:
|
private:
|
||||||
static DockConstants * dockConstants;
|
static DockConstants * dockConstants;
|
||||||
|
|
||||||
DockMode currentMode = DockConstants::FashionMode;
|
DockMode m_currentMode = DockConstants::FashionMode;
|
||||||
int iconSize = 42;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // DOCKCONSTANTS_H
|
#endif // DOCKCONSTANTS_H
|
||||||
|
Loading…
x
Reference in New Issue
Block a user