Skip to content
This repository
Browse code

Show placeholder if QuickLaunch is empty.

  • Loading branch information...
commit 6887d12d5163eedfb4079509e0d128e1100e6d43 1 parent 7c69a60
Alexander Sokolov SokoloffA authored
28 razorqt-panel/plugin-quicklaunch/razorquicklaunch.cpp
@@ -46,10 +46,12 @@
46 46 #include <QtGui/QDesktopServices>
47 47 #include <QtGui/QFileIconProvider>
48 48 #include <QSettings>
  49 +#include <QLabel>
49 50
50 51 RazorQuickLaunch::RazorQuickLaunch(IRazorPanelPlugin *plugin, QWidget* parent) :
51 52 QFrame(parent),
52   - mPlugin(plugin)
  53 + mPlugin(plugin),
  54 + mPlaceHolder(0)
53 55 {
54 56 setAcceptDrops(true);
55 57
@@ -98,6 +100,10 @@ RazorQuickLaunch::RazorQuickLaunch(IRazorPanelPlugin *plugin, QWidget* parent) :
98 100 } // for
99 101
100 102 settings->endArray();
  103 +
  104 + if (mLayout->isEmpty())
  105 + showPlaceHolder();
  106 +
101 107 realign();
102 108 }
103 109
@@ -135,6 +141,7 @@ void RazorQuickLaunch::realign()
135 141
136 142 void RazorQuickLaunch::addButton(QuickLaunchAction* action)
137 143 {
  144 + mLayout->setEnabled(false);
138 145 QuickLaunchButton* btn = new QuickLaunchButton(action, this);
139 146 mLayout->addWidget(btn);
140 147
@@ -142,6 +149,10 @@ void RazorQuickLaunch::addButton(QuickLaunchAction* action)
142 149 connect(btn, SIGNAL(buttonDeleted()), this, SLOT(buttonDeleted()));
143 150 connect(btn, SIGNAL(movedLeft()), this, SLOT(buttonMoveLeft()));
144 151 connect(btn, SIGNAL(movedRight()), this, SLOT(buttonMoveRight()));
  152 +
  153 + delete mPlaceHolder;
  154 + mPlaceHolder = 0;
  155 + mLayout->setEnabled(true);
145 156 }
146 157
147 158 void RazorQuickLaunch::dragEnterEvent(QDragEnterEvent *e)
@@ -224,6 +235,9 @@ void RazorQuickLaunch::buttonDeleted()
224 235 mLayout->removeWidget(btn);
225 236 btn->deleteLater();
226 237 saveSettings();
  238 +
  239 + if (mLayout->isEmpty())
  240 + showPlaceHolder();
227 241 }
228 242
229 243 void RazorQuickLaunch::buttonMoveLeft()
@@ -283,3 +297,15 @@ void RazorQuickLaunch::saveSettings()
283 297
284 298 settings->endArray();
285 299 }
  300 +
  301 +void RazorQuickLaunch::showPlaceHolder()
  302 +{
  303 + if (!mPlaceHolder)
  304 + {
  305 + mPlaceHolder = new QLabel(this);
  306 + mPlaceHolder->setObjectName("QuckLaunchPlaceHolder");
  307 + mPlaceHolder->setText(tr("Drop application\nicons here"));
  308 + }
  309 +
  310 + mLayout->addWidget(mPlaceHolder);
  311 +}
3  razorqt-panel/plugin-quicklaunch/razorquicklaunch.h
@@ -40,6 +40,7 @@ class QDragEnterEvent;
40 40 class RazorGridLayout;
41 41 class QuickLaunchButton;
42 42 class QSettings;
  43 +class QLabel;
43 44
44 45 /*! \brief Loader for "quick launcher" icons in the panel.
45 46 \author Petr Vanek <petr@scribus.info>
@@ -60,11 +61,13 @@ class RazorQuickLaunch : public QFrame
60 61 private:
61 62 RazorGridLayout *mLayout;
62 63 IRazorPanelPlugin *mPlugin;
  64 + QLabel *mPlaceHolder;
63 65
64 66 void dragEnterEvent(QDragEnterEvent *e);
65 67 void dropEvent(QDropEvent *e);
66 68
67 69 void saveSettings();
  70 + void showPlaceHolder();
68 71
69 72 private slots:
70 73 void addButton(QuickLaunchAction* action);
4 razorqt-resources/themes/a-mego/razor-panel.qss
@@ -63,6 +63,10 @@ Plugin > QToolButton:hover{
63 63 border: 1px solid #7f7f7f;
64 64 }
65 65
  66 +#QuckLaunchPlaceHolder {
  67 + color: #777777;
  68 +}
  69 +
66 70 /*
67 71 * QuickLaunch
68 72 */
10 razorqt-resources/themes/ambiance/razor-panel.qss
@@ -28,9 +28,12 @@ RazorPanelPlugin {
28 28 qproperty-moveMarkerColor: #C94C21;
29 29 }
30 30
  31 +Plugin > QWidget,
31 32 Plugin > QWidget > QWidget{
  33 + color: #cacaca;
32 34 }
33 35
  36 +
34 37 Plugin > QToolButton,
35 38 Plugin > QWidget > QToolButton,
36 39 RazorPanelPlugin > QToolButton {
@@ -78,6 +81,10 @@ RazorPanelPlugin > QToolButton:hover {
78 81 margin-right: 2px;
79 82 }
80 83
  84 +#QuckLaunchPlaceHolder {
  85 + color: #AAAAAA;
  86 +}
  87 +
81 88 /*
82 89 * TaskBar
83 90 */
@@ -109,11 +116,9 @@ RazorPanelPlugin > QToolButton:hover {
109 116 }
110 117 #Clock #TimeLabel{
111 118 font-size: 10pt;
112   - color: #cacaca;
113 119 }
114 120 #Clock #DateLabel{
115 121 font-size: 8pt;
116   - color: #cacaca;
117 122 }
118 123
119 124 #Clock QCalendarWidget #qt_calendar_navigationbar,
@@ -286,7 +291,6 @@ TrayIcon {
286 291 */
287 292 #WorldClock{
288 293 font-size: 10pt;
289   - color: #cacaca;
290 294 }
291 295
292 296 #WorldClock *{
4 razorqt-resources/themes/green/razor-panel.qss
@@ -75,6 +75,10 @@ RazorPanel[position="1"] #DesktopSwitch QToolButton
75 75 border: 1px solid #80a8d3;
76 76 }
77 77
  78 +#QuckLaunchPlaceHolder {
  79 + color: #555555;
  80 +}
  81 +
78 82 /*
79 83 * QuickLaunch
80 84 */
4 razorqt-resources/themes/light/razor-panel.qss
@@ -75,6 +75,10 @@ RazorPanel[position="1"] #DesktopSwitch QToolButton
75 75 border: 1px solid #80a8d3;
76 76 }
77 77
  78 +#QuckLaunchPlaceHolder {
  79 + color: #555555;
  80 +}
  81 +
78 82 /*
79 83 * QuickLaunch
80 84 */

0 comments on commit 6887d12

Please sign in to comment.
Something went wrong with that request. Please try again.