aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/panel-plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-desktop/panel-plugins')
-rw-r--r--lumina-desktop/panel-plugins/NewPP.h3
-rw-r--r--lumina-desktop/panel-plugins/applauncher/AppLaunchButton.cpp73
-rw-r--r--lumina-desktop/panel-plugins/applauncher/AppLaunchButton.h63
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.cpp4
-rw-r--r--lumina-desktop/panel-plugins/clock/LClock.h4
-rw-r--r--lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp14
-rw-r--r--lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp7
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp4
-rw-r--r--lumina-desktop/panel-plugins/userbutton/UserWidget.cpp12
9 files changed, 175 insertions, 9 deletions
diff --git a/lumina-desktop/panel-plugins/NewPP.h b/lumina-desktop/panel-plugins/NewPP.h
index 6c5c369c..3a593629 100644
--- a/lumina-desktop/panel-plugins/NewPP.h
+++ b/lumina-desktop/panel-plugins/NewPP.h
@@ -23,6 +23,7 @@
#include "systemdashboard/LSysDashboard.h"
#include "showdesktop/LHomeButton.h"
#include "appmenu/LAppMenuPlugin.h"
+#include "applauncher/AppLaunchButton.h"
#include "systemtray/LSysTray.h" //must be last due to X11 compile issues
class NewPP{
@@ -52,6 +53,8 @@ public:
plug = new LSysDashboard(parent, plugin, horizontal);
}else if(plugin.startsWith("appmenu---")){
plug = new LAppMenuPlugin(parent, plugin, horizontal);
+ }else if(plugin.section("---",0,0).section("::",0,0)=="applauncher"){
+ plug = new AppLaunchButtonPlugin(parent, plugin, horizontal);
}else{
qWarning() << "Invalid Panel Plugin:"<<plugin << " -- Ignored";
}
diff --git a/lumina-desktop/panel-plugins/applauncher/AppLaunchButton.cpp b/lumina-desktop/panel-plugins/applauncher/AppLaunchButton.cpp
new file mode 100644
index 00000000..5bd7fa96
--- /dev/null
+++ b/lumina-desktop/panel-plugins/applauncher/AppLaunchButton.cpp
@@ -0,0 +1,73 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "AppLaunchButton.h"
+#include "../../LSession.h"
+
+#include <LuminaXDG.h>
+
+AppLaunchButtonPlugin::AppLaunchButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
+ button = new QToolButton(this);
+ button->setAutoRaise(true);
+ button->setToolButtonStyle(Qt::ToolButtonIconOnly);
+ appfile = id.section("---",0,0).section("::",1,1);
+ if(!QFile::exists(appfile)){ appfile.clear(); }
+ connect(button, SIGNAL(clicked()), this, SLOT(AppClicked()));
+ this->layout()->setContentsMargins(0,0,0,0);
+ this->layout()->addWidget(button);
+
+ QTimer::singleShot(0,this, SLOT(OrientationChange())); //Update icons/sizes
+}
+
+AppLaunchButtonPlugin::~AppLaunchButtonPlugin(){
+
+}
+
+void AppLaunchButtonPlugin::updateButtonVisuals(){
+ QIcon icon;
+ QString tooltip = tr("Click to assign an application");
+ if(appfile.endsWith(".desktop")){
+ bool ok = false;
+ XDGDesktop desk = LXDG::loadDesktopFile(appfile,ok);
+ if(ok){
+ icon = LXDG::findIcon(desk.icon, "unknown");
+ tooltip = QString(tr("Launch %1")).arg(desk.name);
+ }else{
+ icon = LXDG::findIcon("task-attention","");
+ appfile.clear();
+ }
+ }else if(QFile::exists(appfile)){
+ icon = LXDG::findMimeIcon(appfile.section("/",-1));
+ tooltip = QString(tr("Open %1")).arg(appfile.section("/",-1));
+ }else{
+ icon = LXDG::findIcon("task-attention", "");
+ }
+ button->setIcon( icon );
+ button->setToolTip(tooltip);
+}
+
+// ========================
+// PRIVATE FUNCTIONS
+// ========================
+void AppLaunchButtonPlugin::AppClicked(){
+ if(appfile.isEmpty()){
+ //No App File selected
+ QList<XDGDesktop> apps = LSession::handle()->applicationMenu()->currentAppHash()->value("All");
+ QStringList names;
+ for(int i=0; i<apps.length(); i++){ names << apps[i].name; }
+ bool ok = false;
+ QString app = QInputDialog::getItem(this, tr("Select Application"), tr("Name:"), names, 0, false, &ok);
+ if(!ok || names.indexOf(app)<0){ return; } //cancelled
+ appfile = apps[ names.indexOf(app) ].filePath;
+ //Still need to find a way to set this value persistently
+ // --- perhaps replace the plugin in the desktop settings file with the new path?
+ // --- "applauncher::broken---<something>" -> "applauncher::fixed---<something>" ?
+ QTimer::singleShot(0,this, SLOT(updateButtonVisuals()));
+ }else{
+ LSession::LaunchApplication("lumina-open \""+appfile+"\"");
+ }
+}
+
diff --git a/lumina-desktop/panel-plugins/applauncher/AppLaunchButton.h b/lumina-desktop/panel-plugins/applauncher/AppLaunchButton.h
new file mode 100644
index 00000000..3aa3c7ad
--- /dev/null
+++ b/lumina-desktop/panel-plugins/applauncher/AppLaunchButton.h
@@ -0,0 +1,63 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2015, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+// This panel plugin is a simple button to launch a single application
+//===========================================
+#ifndef _LUMINA_DESKTOP_LAUNCH_APP_PANEL_PLUGIN_H
+#define _LUMINA_DESKTOP_LAUNCH_APP_PANEL_PLUGIN_H
+
+// Qt includes
+#include <QToolButton>
+#include <QString>
+#include <QWidget>
+
+
+// Lumina-desktop includes
+#include "../LPPlugin.h" //main plugin widget
+
+// libLumina includes
+#include "LuminaXDG.h"
+
+// PANEL PLUGIN BUTTON
+class AppLaunchButtonPlugin : public LPPlugin{
+ Q_OBJECT
+
+public:
+ AppLaunchButtonPlugin(QWidget *parent = 0, QString id = "applauncher", bool horizontal=true);
+ ~AppLaunchButtonPlugin();
+
+private:
+ QToolButton *button;
+ QString appfile;
+
+ void updateButtonVisuals();
+
+private slots:
+ void AppClicked();
+
+public slots:
+ void OrientationChange(){
+ if(this->layout()->direction()==QBoxLayout::LeftToRight){
+ this->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::MinimumExpanding);
+ button->setIconSize( QSize(this->height(), this->height()) );
+ }else{
+ this->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Preferred);
+ button->setIconSize( QSize(this->width(), this->width()) );
+ }
+ this->layout()->update();
+ updateButtonVisuals();
+ }
+
+ void LocaleChange(){
+ updateButtonVisuals();
+ }
+
+ void ThemeChange(){
+ updateButtonVisuals();
+ }
+};
+
+#endif \ No newline at end of file
diff --git a/lumina-desktop/panel-plugins/clock/LClock.cpp b/lumina-desktop/panel-plugins/clock/LClock.cpp
index e91a3a71..79cae84b 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.cpp
+++ b/lumina-desktop/panel-plugins/clock/LClock.cpp
@@ -35,6 +35,7 @@ LClock::~LClock(){
void LClock::updateTime(){
QDateTime CT = QDateTime::currentDateTime();
+ if(useTZ){ CT = CT.toTimeZone(TZ); }
//Now update the display
QString label;
if(deftime){ label = CT.time().toString(Qt::SystemLocaleShortDate) ; }
@@ -53,5 +54,8 @@ void LClock::updateFormats(){
datefmt = LSession::handle()->sessionSettings()->value("DateFormat","").toString();
deftime = timefmt.simplified().isEmpty();
defdate = datefmt.simplified().isEmpty();
+ useTZ = LSession::handle()->sessionSettings()->value("CustomTimeZone",false).toBool();
+ if(useTZ){ TZ = QTimeZone( LSession::handle()->sessionSettings()->value("TimeZoneByteCode", QByteArray()).toByteArray() ); }
+
}
diff --git a/lumina-desktop/panel-plugins/clock/LClock.h b/lumina-desktop/panel-plugins/clock/LClock.h
index 1e4c8294..8156e7d8 100644
--- a/lumina-desktop/panel-plugins/clock/LClock.h
+++ b/lumina-desktop/panel-plugins/clock/LClock.h
@@ -13,6 +13,7 @@
#include <QWidget>
#include <QString>
#include <QLocale>
+#include <QTimeZone>
#include "../LPPlugin.h"
@@ -26,7 +27,8 @@ private:
QTimer *timer;
QLabel *labelWidget;
QString timefmt, datefmt;
- bool deftime, defdate;
+ bool deftime, defdate, useTZ;
+ QTimeZone TZ;
private slots:
void updateTime();
diff --git a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
index 7e0a30f6..e966f389 100644
--- a/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
+++ b/lumina-desktop/panel-plugins/systemtray/TrayIcon.cpp
@@ -12,6 +12,10 @@
//#include <xcb/damage.h>
//static xcb_damage_damage_t dmgID;
+
+#include <LSession.h>
+#include <QScreen>
+
static int dmgID = 0;
TrayIcon::TrayIcon(QWidget *parent) : QWidget(parent){
@@ -115,17 +119,23 @@ void TrayIcon::paintEvent(QPaintEvent *event){
//qDebug() << " - Draw tray:" << AID << IID << this->winId();
//qDebug() << " - - " << event->rect().x() << event->rect().y() << event->rect().width() << event->rect().height();
//qDebug() << " - Get image:" << AID;
- QPixmap pix = LX11::WindowImage(AID, false);
+ QPixmap pix = LSession::handle()->XCB->WindowImage(AID);
if(pix.isNull()){
//Try to grab the window directly with Qt
qDebug() << " - - Grab window directly";
- pix = QPixmap::grabWindow(AID);
+ QList<QScreen*> scrnlist = QApplication::screens();
+ for(int i=0; i<scrnlist.length(); i++){
+ pix = scrnlist[i]->grabWindow(AID);
+ break; //stop here
+ }
}
//qDebug() << " - Pix size:" << pix.size().width() << pix.size().height();
//qDebug() << " - Geom:" << this->geometry().x() << this->geometry().y() << this->geometry().width() << this->geometry().height();
if(!pix.isNull()){
if(this->size() != pix.size()){ QTimer::singleShot(10, this, SLOT(updateIcon())); qDebug() << "-- Icon size mismatch"; }
painter.drawPixmap(0,0,this->width(), this->height(), pix.scaled(this->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation) );
+ }else{
+ qDebug() << " - - No Tray Icon/Image found!" << "ID:" << AID;
}
//qDebug() << " - Done";
}
diff --git a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp
index 7c24dc3d..20607c60 100644
--- a/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp
+++ b/lumina-desktop/panel-plugins/taskmanager/LTaskButton.cpp
@@ -121,13 +121,14 @@ void LTaskButton::UpdateButton(){
//single window
this->setPopupMode(QToolButton::DelayedPopup);
this->setMenu(actMenu);
- if(showText){ this->setText( this->fontMetrics().elidedText(WINLIST[0].text(), Qt::ElideRight,80) ); }
- else if(noicon){ this->setText( this->fontMetrics().elidedText(cname, Qt::ElideRight ,80) ); }
- else{ this->setText(""); }
+ if(showText){ this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); this->setText( this->fontMetrics().elidedText(WINLIST[0].text(), Qt::ElideRight,80) ); }
+ else if(noicon){ this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); this->setText( this->fontMetrics().elidedText(cname, Qt::ElideRight ,80) ); }
+ else{ this->setToolButtonStyle(Qt::ToolButtonIconOnly); this->setText(""); }
}else if(WINLIST.length() > 1){
//multiple windows
this->setPopupMode(QToolButton::InstantPopup);
this->setMenu(winMenu);
+ this->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
if(noicon || showText){ this->setText( this->fontMetrics().elidedText(cname, Qt::ElideRight ,80) +" ("+QString::number(WINLIST.length())+")" ); }
else{ this->setText("("+QString::number(WINLIST.length())+")"); }
}
diff --git a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
index 3b8be74f..a04c6e43 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp
@@ -30,7 +30,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, bool isDir, bo
}
}else{
if(itemPath.endsWith("/")){ itemPath.chop(1); }
- icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1).section(".",-1)).pixmap(32,32) );
+ icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1)).pixmap(32,32) );
name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, 180) );
}
linkPath = QFile::symLinkTarget(itemPath);
@@ -101,7 +101,7 @@ void UserItemWidget::setupButton(bool disable){
}else if( !QFile::exists( QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1) ) && !QFile::exists( QDir::homePath()+"/.lumina/favorites/"+icon->whatsThis().section("/",-1) ) ){
//This file does not have a desktop shortcut yet -- allow the user to add it
button->setWhatsThis("add");
- button->setIcon( LXDG::findIcon("favorites","") );
+ button->setIcon( LXDG::findIcon("bookmark-toolbar","") );
button->setToolTip(tr("Create Shortcut"));
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
}else{
diff --git a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
index 6ca3ba19..52d60714 100644
--- a/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
+++ b/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp
@@ -16,7 +16,7 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid
sysapps = LSession::handle()->applicationMenu()->currentAppHash(); //get the raw info
//Setup the Icons
// - favorites tab
- this->setTabIcon(0, rotateIcon(LXDG::findIcon("favorites","")) );
+ this->setTabIcon(0, rotateIcon(LXDG::findIcon("folder-favorites","")) );
this->setTabText(0,"");
// - apps tab
this->setTabIcon(1, rotateIcon(LXDG::findIcon("system-run","")) );
@@ -194,6 +194,16 @@ void UserWidget::updateFavItems(){
connect(it, SIGNAL(RemovedShortcut()), this, SLOT(updateFavItems()) );
}
static_cast<QBoxLayout*>(ui->scroll_fav->widget()->layout())->addStretch();
+
+ //Clean up any broken sym-links in the favorites directory
+ /*items = favdir.entryInfoList(QDir::System | QDir::NoDotAndDotDot, QDir::Name);
+ for(int i=0; i<items.length(); i++){
+ if(items[i].isSymLink() && !items[i].exists()){
+ //Broken sym-link - remove it
+ QFile::remove(items[i].absoluteFilePath());
+ }
+ }*/
+
}
//Apps Tab
bgstack15