a very primitive dashboard

right now we have a single view, that gets brought to front and the wallpaper made translucent.
probably it will eventually need splitting the walppaper and the widgets in two separate views, but needs a more complex logic
This commit is contained in:
Marco Martin 2013-09-16 19:30:34 +02:00
parent f654bf31eb
commit 5c25b8675a
5 changed files with 43 additions and 4 deletions

View File

@ -81,6 +81,33 @@ void DesktopView::setFillScreen(bool fillScreen)
emit fillScreenChanged(); emit fillScreenChanged();
} }
void DesktopView::setDashboardShown(bool shown)
{
if (shown) {
if (m_stayBehind) {
KWindowSystem::setType(winId(), NET::Normal);
}
raise();
KWindowSystem::raiseWindow(winId());
QObject *wpGraphicObject = containment()->property("wallpaperGraphicsObject").value<QObject *>();
if (wpGraphicObject) {
wpGraphicObject->setProperty("opacity", 0.3);
}
} else {
if (m_stayBehind) {
KWindowSystem::setType(winId(), NET::Desktop);
}
lower();
KWindowSystem::lowerWindow(winId());
QObject *wpGraphicObject = containment()->property("wallpaperGraphicsObject").value<QObject *>();
if (wpGraphicObject) {
wpGraphicObject->setProperty("opacity", 1);
}
}
}
/* /*
void DesktopView::showConfigurationInterface(Plasma::Applet *applet) void DesktopView::showConfigurationInterface(Plasma::Applet *applet)
{ {

View File

@ -42,6 +42,8 @@ public:
bool fillScreen() const; bool fillScreen() const;
void setFillScreen(bool fillScreen); void setFillScreen(bool fillScreen);
void setDashboardShown(bool shown);
protected Q_SLOTS: protected Q_SLOTS:
/** /**
* It will be called when the configuration is requested * It will be called when the configuration is requested

View File

@ -24,7 +24,7 @@ import org.kde.plasma.core 2.0 as PlasmaCore
Rectangle { Rectangle {
id: root id: root
color: "black" color: Qt.rgba(0, 0, 0, 0.2)
width: 1024 width: 1024
height: 768 height: 768

View File

@ -98,9 +98,10 @@ ShellCorona::ShellCorona(QObject *parent)
QAction *dashboardAction = actions()->add<QAction>("show dashboard"); QAction *dashboardAction = actions()->add<QAction>("show dashboard");
QObject::connect(dashboardAction, &QAction::triggered, QObject::connect(dashboardAction, &QAction::triggered,
this, &ShellCorona::toggleDashboard); this, &ShellCorona::setDashboardShown);
dashboardAction->setText(i18n("Show Dashboard")); dashboardAction->setText(i18n("Show Dashboard"));
dashboardAction->setAutoRepeat(true); dashboardAction->setAutoRepeat(true);
dashboardAction->setCheckable(true);
dashboardAction->setIcon(QIcon::fromTheme("dashboard-show")); dashboardAction->setIcon(QIcon::fromTheme("dashboard-show"));
dashboardAction->setData(Plasma::Types::ControlAction); dashboardAction->setData(Plasma::Types::ControlAction);
dashboardAction->setShortcut(QKeySequence("ctrl+f12")); dashboardAction->setShortcut(QKeySequence("ctrl+f12"));
@ -428,9 +429,18 @@ void ShellCorona::syncAppConfig()
applicationConfig()->sync(); applicationConfig()->sync();
} }
void ShellCorona::toggleDashboard() void ShellCorona::setDashboardShown(bool show)
{ {
qDebug() << "TODO: Toggling dashboard view"; qDebug() << "TODO: Toggling dashboard view";
QAction *dashboardAction = actions()->action("show dashboard");
if (dashboardAction) {
dashboardAction->setText(show ? i18n("Hide Dashboard") : i18n("Show Dashboard"));
}
foreach (DesktopView *view, d->views) {
view->setDashboardShown(show);
}
} }
void ShellCorona::printScriptError(const QString &error) void ShellCorona::printScriptError(const QString &error)

View File

@ -120,7 +120,7 @@ private Q_SLOTS:
void handleContainmentAdded(Plasma::Containment *c); void handleContainmentAdded(Plasma::Containment *c);
void showWidgetExplorer(); void showWidgetExplorer();
void syncAppConfig(); void syncAppConfig();
void toggleDashboard(); void setDashboardShown(bool show);
private: private:
class Private; class Private;