diff --git a/frame/frame.pro b/frame/frame.pro index e19964ee0..c2bf2f4c3 100644 --- a/frame/frame.pro +++ b/frame/frame.pro @@ -57,3 +57,6 @@ dbus_service.path = /usr/share/dbus-1/services target.path = $${PREFIX}/bin/ INSTALLS += target dbus_service + +RESOURCES += \ + item/resources.qrc diff --git a/frame/item/appitem.cpp b/frame/item/appitem.cpp index 174af07be..e8740b751 100644 --- a/frame/item/appitem.cpp +++ b/frame/item/appitem.cpp @@ -15,7 +15,11 @@ QPoint AppItem::MousePressPos; AppItem::AppItem(const QDBusObjectPath &entry, QWidget *parent) : DockItem(App, parent), m_itemEntry(new DBusDockEntry(entry.path(), this)), - m_draging(false) + m_draging(false), + m_horizontalIndicator(QPixmap(":/indicator/resources/indicator.png")), + m_verticalIndicator(QPixmap(":/indicator/resources/indicator_ver.png")), + m_activeHorizontalIndicator(QPixmap(":/indicator/resources/indicator_active.png")), + m_activeVerticalIndicator(QPixmap(":/indicator/resources/indicator_active_ver.png")) { setAcceptDrops(true); @@ -116,38 +120,74 @@ void AppItem::paintEvent(QPaintEvent *e) { if (!m_titles.isEmpty()) { - const int activeLineWidth = 2; - const int activeLineLength = 20; - QRect activeRect = itemRect; + QPoint p; + QPixmap pixmap; + QPixmap activePixmap; switch (DockPosition) { case Top: - activeRect.setBottom(activeRect.top() + activeLineWidth); - activeRect.moveBottom(activeRect.bottom() + 1); - activeRect.setWidth(activeLineLength); - activeRect.moveLeft((itemRect.width() - activeRect.width()) / 2); + pixmap = m_horizontalIndicator; + activePixmap = m_activeHorizontalIndicator; + p.setX((itemRect.width() - pixmap.width()) / 2); + p.setY(1); break; case Bottom: - activeRect.setTop(activeRect.bottom() - activeLineWidth); - activeRect.moveTop(activeRect.top() - 1); - activeRect.setWidth(activeLineLength); - activeRect.moveLeft((itemRect.width() - activeRect.width()) / 2); + pixmap = m_horizontalIndicator; + activePixmap = m_activeHorizontalIndicator; + p.setX((itemRect.width() - pixmap.width()) / 2); + p.setY(itemRect.height() - pixmap.height() - 1); break; case Left: - activeRect.setRight(activeRect.left() + activeLineWidth); - activeRect.moveRight(activeRect.right() + 1); - activeRect.setHeight(activeLineLength); - activeRect.moveTop((itemRect.height() - activeRect.height()) / 2); + pixmap = m_verticalIndicator; + activePixmap = m_activeVerticalIndicator; + p.setX(1); + p.setY((itemRect.height() - pixmap.height()) / 2); break; case Right: - activeRect.setLeft(activeRect.right() - activeLineWidth); - activeRect.moveLeft(activeRect.left() - 1); - activeRect.setHeight(activeLineLength); - activeRect.moveTop((itemRect.height() - activeRect.height()) / 2); + pixmap = m_verticalIndicator; + activePixmap = m_activeVerticalIndicator; + p.setX(itemRect.width() - pixmap.width() - 1); + p.setY((itemRect.height() - pixmap.height()) / 2); break; } - painter.fillRect(activeRect, QColor(163, 167, 166)); + if (m_active) + painter.drawPixmap(p, activePixmap); + else + painter.drawPixmap(p, pixmap); + +// const int activeLineWidth = 2; +// const int activeLineLength = 20; +// QRect activeRect = itemRect; +// switch (DockPosition) +// { +// case Top: +// activeRect.setBottom(activeRect.top() + activeLineWidth); +// activeRect.moveBottom(activeRect.bottom() + 1); +// activeRect.setWidth(activeLineLength); +// activeRect.moveLeft((itemRect.width() - activeRect.width()) / 2); +// break; +// case Bottom: +// activeRect.setTop(activeRect.bottom() - activeLineWidth); +// activeRect.moveTop(activeRect.top() - 1); +// activeRect.setWidth(activeLineLength); +// activeRect.moveLeft((itemRect.width() - activeRect.width()) / 2); +// break; +// case Left: +// activeRect.setRight(activeRect.left() + activeLineWidth); +// activeRect.moveRight(activeRect.right() + 1); +// activeRect.setHeight(activeLineLength); +// activeRect.moveTop((itemRect.height() - activeRect.height()) / 2); +// break; +// case Right: +// activeRect.setLeft(activeRect.right() - activeLineWidth); +// activeRect.moveLeft(activeRect.left() - 1); +// activeRect.setHeight(activeLineLength); +// activeRect.moveTop((itemRect.height() - activeRect.height()) / 2); +// break; +// } + +// painter.fillRect(activeRect, QColor(163, 167, 166)); } } diff --git a/frame/item/appitem.h b/frame/item/appitem.h index 2c8a57c60..d8a99b60c 100644 --- a/frame/item/appitem.h +++ b/frame/item/appitem.h @@ -47,6 +47,10 @@ private: QString m_id; QPixmap m_smallIcon; QPixmap m_largeIcon; + QPixmap m_horizontalIndicator; + QPixmap m_verticalIndicator; + QPixmap m_activeHorizontalIndicator; + QPixmap m_activeVerticalIndicator; static int IconBaseSize; static QPoint MousePressPos; diff --git a/frame/item/resources.qrc b/frame/item/resources.qrc new file mode 100644 index 000000000..f9318f8cd --- /dev/null +++ b/frame/item/resources.qrc @@ -0,0 +1,8 @@ + + + resources/indicator_active.png + resources/indicator.png + resources/indicator_ver.png + resources/indicator_active_ver.png + + diff --git a/frame/item/resources/indicator.png b/frame/item/resources/indicator.png new file mode 100644 index 000000000..907ba6ed6 Binary files /dev/null and b/frame/item/resources/indicator.png differ diff --git a/frame/item/resources/indicator_active.png b/frame/item/resources/indicator_active.png new file mode 100644 index 000000000..abc8dfb63 Binary files /dev/null and b/frame/item/resources/indicator_active.png differ diff --git a/frame/item/resources/indicator_active_ver.png b/frame/item/resources/indicator_active_ver.png new file mode 100644 index 000000000..4fdfd4a66 Binary files /dev/null and b/frame/item/resources/indicator_active_ver.png differ diff --git a/frame/item/resources/indicator_ver.png b/frame/item/resources/indicator_ver.png new file mode 100644 index 000000000..d3a4f2d3b Binary files /dev/null and b/frame/item/resources/indicator_ver.png differ