aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/desktop-plugins/LDPlugin.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-10-07 11:11:59 -0400
committerKen Moore <moorekou@gmail.com>2015-10-07 11:11:59 -0400
commit8c693c2ef0f7a33f9f9970c342e23e9a5823468a (patch)
tree47cb61f2d7e897f14134a33d039cb260d78a602f /lumina-desktop/desktop-plugins/LDPlugin.cpp
parentClean up the quicklaunch buttons a bit more - also add a context menu for rem... (diff)
downloadlumina-8c693c2ef0f7a33f9f9970c342e23e9a5823468a.tar.gz
lumina-8c693c2ef0f7a33f9f9970c342e23e9a5823468a.tar.bz2
lumina-8c693c2ef0f7a33f9f9970c342e23e9a5823468a.zip
Commit the 3rd iteration of the desktop plugin container system.
- Now the desktop plugins are drag-and-drop based, resulting in the user being able to simply drag the plugins around as necessry. - All the plugins now have a special context menu (right-click, or click and hold the left mouse button for 1/2 second), which provides options to start moving/resizing the plugin as well as the removal option. Known Issues: - The cross-application drop event for files is currently flagged as valid - but does not actually run anything yet (to be finished up soon) - Hidden panels are not being updated when plugins are moved around yet - resulting in some screen artifacting on the panel. (to be fixed soon)
Diffstat (limited to 'lumina-desktop/desktop-plugins/LDPlugin.cpp')
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.cpp24
1 files changed, 22 insertions, 2 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp
index 26ed7eff..c6d2e320 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp
@@ -7,16 +7,36 @@
#include "LDPlugin.h"
#include "../LSession.h"
+#include <LuminaXDG.h>
LDPlugin::LDPlugin(QWidget *parent, QString id) : QFrame(parent){
PLUGID=id;
prefix = id.replace("/","_")+"/";
//qDebug() << "ID:" << PLUGID << prefix;
settings = LSession::handle()->DesktopPluginSettings();
+ //Setup the plugin system control menu
+ menu = new QMenu(this);
+ setupMenu();
+ //Setup the internal timer for when to start/stop drag events
+ dragTimer = new QTimer(this);
+ dragTimer->setSingleShot(true);
+ dragTimer->setInterval(500); //1/2 second to show the plugin menu
+ connect(dragTimer, SIGNAL(timeout()), this, SLOT(showPluginMenu()));
//Use plugin-specific values for stylesheet control (applauncher, desktopview, etc...)
this->setObjectName(id.section("---",0,0).section("::",0,0));
+ this->setContextMenuPolicy(Qt::CustomContextMenu);
+ this->setMouseTracking(false); //only catch mouse movement events if the mouse is clicked/held on the plugin
connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChange()) );
connect(QApplication::instance(), SIGNAL(IconThemeChanged()), this, SLOT(ThemeChange()) );
+ connect(this, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showPluginMenu()) );
+}
+
+void LDPlugin::setupMenu(){
+ menu->clear();
+ menu->addAction( LXDG::findIcon("transform-move",""), tr("Start Moving Item"), this, SLOT(slotStartMove()) );
+ menu->addAction( LXDG::findIcon("transform-scale",""), tr("Start Resizing Item"), this, SLOT(slotStartResize()) );
+ menu->addSeparator();
+ menu->addAction( LXDG::findIcon("edit-delete",""), tr("Remove Item"), this, SLOT(slotRemovePlugin()) );
}
void LDPlugin::setInitialSize(int width, int height){
@@ -33,10 +53,10 @@ void LDPlugin::setInitialSize(int width, int height){
this->resize( settings->value(prefix+"location/width").toInt(), settings->value(prefix+"location/height").toInt());
}
-void LDPlugin::adjustSize(int width, int height){
+/*void LDPlugin::adjustSize(int width, int height){
settings->setValue(prefix+"location/width",width);
settings->setValue(prefix+"location/height",height);
settings->sync();
this->resize(width,height);
emit PluginResized();
-} \ No newline at end of file
+}*/ \ No newline at end of file
bgstack15