Permalink
Browse files

Show placeholder if QuickLaunch is empty.

  • Loading branch information...
1 parent 7c69a60 commit 6887d12d5163eedfb4079509e0d128e1100e6d43 @SokoloffA SokoloffA committed Mar 13, 2013
@@ -46,10 +46,12 @@
#include <QtGui/QDesktopServices>
#include <QtGui/QFileIconProvider>
#include <QSettings>
+#include <QLabel>
RazorQuickLaunch::RazorQuickLaunch(IRazorPanelPlugin *plugin, QWidget* parent) :
QFrame(parent),
- mPlugin(plugin)
+ mPlugin(plugin),
+ mPlaceHolder(0)
{
setAcceptDrops(true);
@@ -98,6 +100,10 @@ RazorQuickLaunch::RazorQuickLaunch(IRazorPanelPlugin *plugin, QWidget* parent) :
} // for
settings->endArray();
+
+ if (mLayout->isEmpty())
+ showPlaceHolder();
+
realign();
}
@@ -135,13 +141,18 @@ void RazorQuickLaunch::realign()
void RazorQuickLaunch::addButton(QuickLaunchAction* action)
{
+ mLayout->setEnabled(false);
QuickLaunchButton* btn = new QuickLaunchButton(action, this);
mLayout->addWidget(btn);
connect(btn, SIGNAL(switchButtons(QuickLaunchButton*,QuickLaunchButton*)), this, SLOT(switchButtons(QuickLaunchButton*,QuickLaunchButton*)));
connect(btn, SIGNAL(buttonDeleted()), this, SLOT(buttonDeleted()));
connect(btn, SIGNAL(movedLeft()), this, SLOT(buttonMoveLeft()));
connect(btn, SIGNAL(movedRight()), this, SLOT(buttonMoveRight()));
+
+ delete mPlaceHolder;
+ mPlaceHolder = 0;
+ mLayout->setEnabled(true);
}
void RazorQuickLaunch::dragEnterEvent(QDragEnterEvent *e)
@@ -224,6 +235,9 @@ void RazorQuickLaunch::buttonDeleted()
mLayout->removeWidget(btn);
btn->deleteLater();
saveSettings();
+
+ if (mLayout->isEmpty())
+ showPlaceHolder();
}
void RazorQuickLaunch::buttonMoveLeft()
@@ -283,3 +297,15 @@ void RazorQuickLaunch::saveSettings()
settings->endArray();
}
+
+void RazorQuickLaunch::showPlaceHolder()
+{
+ if (!mPlaceHolder)
+ {
+ mPlaceHolder = new QLabel(this);
+ mPlaceHolder->setObjectName("QuckLaunchPlaceHolder");
+ mPlaceHolder->setText(tr("Drop application\nicons here"));
+ }
+
+ mLayout->addWidget(mPlaceHolder);
+}
@@ -40,6 +40,7 @@ class QDragEnterEvent;
class RazorGridLayout;
class QuickLaunchButton;
class QSettings;
+class QLabel;
/*! \brief Loader for "quick launcher" icons in the panel.
\author Petr Vanek <petr@scribus.info>
@@ -60,11 +61,13 @@ class RazorQuickLaunch : public QFrame
private:
RazorGridLayout *mLayout;
IRazorPanelPlugin *mPlugin;
+ QLabel *mPlaceHolder;
void dragEnterEvent(QDragEnterEvent *e);
void dropEvent(QDropEvent *e);
void saveSettings();
+ void showPlaceHolder();
private slots:
void addButton(QuickLaunchAction* action);
@@ -63,6 +63,10 @@ Plugin > QToolButton:hover{
border: 1px solid #7f7f7f;
}
+#QuckLaunchPlaceHolder {
+ color: #777777;
+}
+
/*
* QuickLaunch
*/
@@ -28,9 +28,12 @@ RazorPanelPlugin {
qproperty-moveMarkerColor: #C94C21;
}
+Plugin > QWidget,
Plugin > QWidget > QWidget{
+ color: #cacaca;
}
+
Plugin > QToolButton,
Plugin > QWidget > QToolButton,
RazorPanelPlugin > QToolButton {
@@ -78,6 +81,10 @@ RazorPanelPlugin > QToolButton:hover {
margin-right: 2px;
}
+#QuckLaunchPlaceHolder {
+ color: #AAAAAA;
+}
+
/*
* TaskBar
*/
@@ -109,11 +116,9 @@ RazorPanelPlugin > QToolButton:hover {
}
#Clock #TimeLabel{
font-size: 10pt;
- color: #cacaca;
}
#Clock #DateLabel{
font-size: 8pt;
- color: #cacaca;
}
#Clock QCalendarWidget #qt_calendar_navigationbar,
@@ -286,7 +291,6 @@ TrayIcon {
*/
#WorldClock{
font-size: 10pt;
- color: #cacaca;
}
#WorldClock *{
@@ -75,6 +75,10 @@ RazorPanel[position="1"] #DesktopSwitch QToolButton
border: 1px solid #80a8d3;
}
+#QuckLaunchPlaceHolder {
+ color: #555555;
+}
+
/*
* QuickLaunch
*/
@@ -75,6 +75,10 @@ RazorPanel[position="1"] #DesktopSwitch QToolButton
border: 1px solid #80a8d3;
}
+#QuckLaunchPlaceHolder {
+ color: #555555;
+}
+
/*
* QuickLaunch
*/

0 comments on commit 6887d12

Please sign in to comment.