Skip to content
This repository has been archived by the owner on Dec 17, 2017. It is now read-only.

Commit

Permalink
Show placeholder if QuickLaunch is empty.
Browse files Browse the repository at this point in the history
  • Loading branch information
SokoloffA committed Mar 13, 2013
1 parent 7c69a60 commit 6887d12
Show file tree
Hide file tree
Showing 6 changed files with 49 additions and 4 deletions.
28 changes: 27 additions & 1 deletion razorqt-panel/plugin-quicklaunch/razorquicklaunch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -98,6 +100,10 @@ RazorQuickLaunch::RazorQuickLaunch(IRazorPanelPlugin *plugin, QWidget* parent) :
} // for

settings->endArray();

if (mLayout->isEmpty())
showPlaceHolder();

realign();
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -224,6 +235,9 @@ void RazorQuickLaunch::buttonDeleted()
mLayout->removeWidget(btn);
btn->deleteLater();
saveSettings();

if (mLayout->isEmpty())
showPlaceHolder();
}

void RazorQuickLaunch::buttonMoveLeft()
Expand Down Expand Up @@ -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);
}
3 changes: 3 additions & 0 deletions razorqt-panel/plugin-quicklaunch/razorquicklaunch.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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);
Expand Down
4 changes: 4 additions & 0 deletions razorqt-resources/themes/a-mego/razor-panel.qss
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ Plugin > QToolButton:hover{
border: 1px solid #7f7f7f;
}

#QuckLaunchPlaceHolder {
color: #777777;
}

/*
* QuickLaunch
*/
Expand Down
10 changes: 7 additions & 3 deletions razorqt-resources/themes/ambiance/razor-panel.qss
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,12 @@ RazorPanelPlugin {
qproperty-moveMarkerColor: #C94C21;
}

Plugin > QWidget,
Plugin > QWidget > QWidget{
color: #cacaca;
}


Plugin > QToolButton,
Plugin > QWidget > QToolButton,
RazorPanelPlugin > QToolButton {
Expand Down Expand Up @@ -78,6 +81,10 @@ RazorPanelPlugin > QToolButton:hover {
margin-right: 2px;
}

#QuckLaunchPlaceHolder {
color: #AAAAAA;
}

/*
* TaskBar
*/
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -286,7 +291,6 @@ TrayIcon {
*/
#WorldClock{
font-size: 10pt;
color: #cacaca;
}

#WorldClock *{
Expand Down
4 changes: 4 additions & 0 deletions razorqt-resources/themes/green/razor-panel.qss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ RazorPanel[position="1"] #DesktopSwitch QToolButton
border: 1px solid #80a8d3;
}

#QuckLaunchPlaceHolder {
color: #555555;
}

/*
* QuickLaunch
*/
Expand Down
4 changes: 4 additions & 0 deletions razorqt-resources/themes/light/razor-panel.qss
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ RazorPanel[position="1"] #DesktopSwitch QToolButton
border: 1px solid #80a8d3;
}

#QuckLaunchPlaceHolder {
color: #555555;
}

/*
* QuickLaunch
*/
Expand Down

0 comments on commit 6887d12

Please sign in to comment.