diff --git a/dde-dock/images.qrc b/dde-dock/images.qrc index dbecc416f..fd2b8f899 100644 --- a/dde-dock/images.qrc +++ b/dde-dock/images.qrc @@ -1,3 +1,23 @@ - + + Resources/images/brasero.png + Resources/images/crossover.png + Resources/images/d-feet.png + Resources/images/deepin-multitasking-view.svg + Resources/images/display-im6.q16.png + Resources/images/eog.png + Resources/images/file-roller.png + Resources/images/gcr-gnupg.png + Resources/images/gcr-key-pair.png + Resources/images/gcr-key.png + Resources/images/gcr-password.png + Resources/images/gcr-smart-card.png + Resources/images/google-chrome.png + Resources/images/gparted.png + Resources/images/inkscape.png + Resources/images/QtProject-qtcreator.png + Resources/images/remmina.png + Resources/images/terminator.png + Resources/images/vim.png + diff --git a/dde-dock/src/Panel/panel.cpp b/dde-dock/src/Panel/panel.cpp index 14a324f58..0d2ad6e28 100644 --- a/dde-dock/src/Panel/panel.cpp +++ b/dde-dock/src/Panel/panel.cpp @@ -1,17 +1,19 @@ #include "panel.h" Panel::Panel(QWidget *parent) - : QWidget(parent),parentWidget(parent) + : QLabel(parent),parentWidget(parent) { + this->setStyleSheet("QWidget{background-color: rgba(0,0,0,0.3);}"); + leftLayout = new DockLayout(this); leftLayout->resize(1024,50); leftLayout->move(0,0); - AppItem * b1 = new AppItem("App","../Resources/images/brasero.png");b1->resize(50,50);b1->setAcceptDrops(true); - AppItem * b2 = new AppItem("App","../Resources/images/crossover.png");b2->resize(50,50);b2->setAcceptDrops(true); - AppItem * b3 = new AppItem("App","../Resources/images/gcr-gnupg.png");b3->resize(50,50);b3->setAcceptDrops(true); - AppItem * b4 = new AppItem("App","../Resources/images/display-im6.q16.png");b4->resize(50,50);b4->setAcceptDrops(true); - AppItem * b5 = new AppItem("App","../Resources/images/eog.png");b5->resize(50,50);b5->setAcceptDrops(true); + AppItem * b1 = new AppItem("App",":/test/Resources/images/brasero.png"); + AppItem * b2 = new AppItem("App",":/test/Resources/images/crossover.png"); + AppItem * b3 = new AppItem("App",":/test/Resources/images/vim.png"); + AppItem * b4 = new AppItem("App",":/test/Resources/images/google-chrome.png"); + AppItem * b5 = new AppItem("App",":/test/Resources/images/QtProject-qtcreator.png"); leftLayout->addItem(b1); leftLayout->addItem(b2); @@ -22,8 +24,8 @@ Panel::Panel(QWidget *parent) connect(leftLayout,SIGNAL(dragStarted()),this,SLOT(slotDragStarted())); connect(leftLayout,SIGNAL(itemDropped()),this,SLOT(slotItemDropped())); - AppItem * b6 = new AppItem("App","../Resources/images/display-im6.q16.png");b6->resize(50,50);b6->setAcceptDrops(true); - AppItem * b7 = new AppItem("App","../Resources/images/eog.png");b7->resize(50,50);b7->setAcceptDrops(true); + AppItem * b6 = new AppItem("App","../Resources/images/display-im6.q16.png"); + AppItem * b7 = new AppItem("App","../Resources/images/eog.png"); rightLayout = new DockLayout(this); rightLayout->setSortDirection(DockLayout::RightToLeft); rightLayout->resize(300,50); diff --git a/dde-dock/src/Panel/panel.h b/dde-dock/src/Panel/panel.h index 98ffeffbd..c95aae3db 100644 --- a/dde-dock/src/Panel/panel.h +++ b/dde-dock/src/Panel/panel.h @@ -2,13 +2,14 @@ #define PANEL_H #include +#include #include #include #include "Widgets/appitem.h" #include "Widgets/docklayout.h" #include "Widgets/screenmask.h" -class Panel : public QWidget +class Panel : public QLabel { Q_OBJECT public: diff --git a/dde-dock/src/Widgets/appbackground.cpp b/dde-dock/src/Widgets/appbackground.cpp index e756e3b37..cfd5ad7b3 100644 --- a/dde-dock/src/Widgets/appbackground.cpp +++ b/dde-dock/src/Widgets/appbackground.cpp @@ -3,5 +3,5 @@ AppBackground::AppBackground(QWidget *parent) : QLabel(parent) { - this->setStyleSheet("background:#121922;border-radius: 4px;"); + this->setStyleSheet("QLabel#AppBackground{background: rgba(255,255,255,0.3);border-radius: 4px;}"); } diff --git a/dde-dock/src/Widgets/appicon.cpp b/dde-dock/src/Widgets/appicon.cpp index b03abbb07..699815401 100644 --- a/dde-dock/src/Widgets/appicon.cpp +++ b/dde-dock/src/Widgets/appicon.cpp @@ -11,6 +11,8 @@ AppIcon::AppIcon(QWidget *parent,Qt::WindowFlags f) : { this->setParent(parent); this->setWindowFlags(f); + this->setAttribute(Qt::WA_TranslucentBackground); + this->setAlignment(Qt::AlignCenter); } AppIcon::AppIcon(QString iconPath, QWidget *parent, Qt::WindowFlags f) : @@ -18,9 +20,11 @@ AppIcon::AppIcon(QString iconPath, QWidget *parent, Qt::WindowFlags f) : { this->setParent(parent); this->setWindowFlags(f); + this->setAttribute(Qt::WA_TranslucentBackground); + this->setAlignment(Qt::AlignCenter); QString sysIconPath = getSysIcon(iconPath); - QPixmap iconPixmap(this->width(),this->height()); + QPixmap iconPixmap; if (sysIconPath != "") { iconPixmap.load(sysIconPath); diff --git a/dde-dock/src/Widgets/appicon.h b/dde-dock/src/Widgets/appicon.h index 0c715bc0b..de5f91f54 100644 --- a/dde-dock/src/Widgets/appicon.h +++ b/dde-dock/src/Widgets/appicon.h @@ -5,6 +5,7 @@ #include #include #include +#include class AppIcon : public QLabel { diff --git a/dde-dock/src/Widgets/appitem.cpp b/dde-dock/src/Widgets/appitem.cpp index 17a1322c0..ff6eba4bf 100644 --- a/dde-dock/src/Widgets/appitem.cpp +++ b/dde-dock/src/Widgets/appitem.cpp @@ -5,8 +5,9 @@ AppItem::AppItem(QWidget *parent) : { setParent(parent); - initBackground(); setAcceptDrops(true); + resize(itemWidth,itemHeight); + initBackground(); } AppItem::AppItem(QString title, QWidget *parent): @@ -15,7 +16,9 @@ AppItem::AppItem(QString title, QWidget *parent): this->setParent(parent); this->itemTitle = title; - this->initBackground(); + setAcceptDrops(true); + resize(itemWidth,itemHeight); + initBackground(); } AppItem::AppItem(QString title, QString iconPath, QWidget *parent) : @@ -25,20 +28,10 @@ AppItem::AppItem(QString title, QString iconPath, QWidget *parent) : this->itemTitle = title; this->itemIconPath = iconPath; - this->initBackground(); - this->setIcon(itemIconPath); -} - -void AppItem::resize(const QSize &size) -{ - QFrame::resize(size); - resizeResources(); -} - -void AppItem::resize(int width, int height) -{ - QFrame::resize(width,height); - resizeResources(); + setAcceptDrops(true); + resize(itemWidth,itemHeight); + initBackground(); + setIcon(itemIconPath); } QPoint AppItem::getNextPos() diff --git a/dde-dock/src/Widgets/appitem.h b/dde-dock/src/Widgets/appitem.h index 849cd0fe4..479acbc0c 100644 --- a/dde-dock/src/Widgets/appitem.h +++ b/dde-dock/src/Widgets/appitem.h @@ -27,8 +27,6 @@ public: AppItem(QString title, QString iconPath, QWidget *parent = 0); ~AppItem(); - void resize(const QSize &size); - void resize(int width, int height); QPoint getNextPos(); void setNextPos(const QPoint &value); void setNextPos(int x, int y); @@ -62,6 +60,8 @@ private: private: AppBackground * appBackground = NULL; QPoint nextPos; + const int itemWidth = 60; + const int itemHeight = 50; }; #endif // APPITEM_H diff --git a/dde-dock/src/Widgets/dockitem.cpp b/dde-dock/src/Widgets/dockitem.cpp index b43001111..ce9d40491 100644 --- a/dde-dock/src/Widgets/dockitem.cpp +++ b/dde-dock/src/Widgets/dockitem.cpp @@ -19,7 +19,7 @@ void DockItem::setIcon(const QString &iconPath, int size) { appIcon = new AppIcon(iconPath,this); appIcon->resize(size,size); - appIcon->move(this->width() / 2, this->height() / 2); + appIcon->move((this->height() - appIcon->height()) / 2, (this->height() - appIcon->height()) / 2); } void DockItem::setActived(bool value) diff --git a/dde-dock/src/Widgets/docklayout.cpp b/dde-dock/src/Widgets/docklayout.cpp index 0ed280d2e..aff2804e0 100644 --- a/dde-dock/src/Widgets/docklayout.cpp +++ b/dde-dock/src/Widgets/docklayout.cpp @@ -91,7 +91,7 @@ void DockLayout::sortLeftToRight() if (appList.count() <= 0) return; - appList.at(0)->move(0,0); + appList.at(0)->move(itemSpacing,0); for (int i = 1; i < appList.count(); i ++) { @@ -172,7 +172,7 @@ void DockLayout::addSpacingItem() animation->setStartValue(targetItem->pos()); animation->setEndValue(targetItem->getNextPos()); animation->setDuration(150 + i * 10); - animation->setEasingCurve(QEasingCurve::InOutBack); + animation->setEasingCurve(QEasingCurve::OutCubic); animation->start(); } @@ -272,7 +272,7 @@ void DockLayout::slotItemEntered(QDragEnterEvent * event,AppItem *item) animation->setStartValue(targetItem->pos()); animation->setEndValue(targetItem->getNextPos()); animation->setDuration(200); - animation->setEasingCurve(QEasingCurve::InOutBack); + animation->setEasingCurve(QEasingCurve::OutCubic); animation->start(); } } diff --git a/dde-dock/src/mainwidget.cpp b/dde-dock/src/mainwidget.cpp index 5b4e680ed..25139191d 100644 --- a/dde-dock/src/mainwidget.cpp +++ b/dde-dock/src/mainwidget.cpp @@ -9,7 +9,10 @@ MainWidget::MainWidget(QWidget *parent) mainPanel->setMinimumSize(this->width(),this->height()); mainPanel->resize(this->width(),this->height()); mainPanel->move(0,0); + this->setWindowFlags(Qt::ToolTip); + this->setAttribute(Qt::WA_TranslucentBackground); + this->move(0,800); } MainWidget::~MainWidget()