aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/desktop-plugins
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-desktop/desktop-plugins')
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.cpp3
-rw-r--r--lumina-desktop/desktop-plugins/LDPlugin.h1
-rw-r--r--lumina-desktop/desktop-plugins/LDPluginContainer.h12
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp3
-rw-r--r--lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp16
5 files changed, 23 insertions, 12 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp
index 9e9cfeba..84c92530 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp
@@ -11,7 +11,7 @@
LDPlugin::LDPlugin(QWidget *parent, QString id) : QFrame(parent){
PLUGID=id;
prefix = id.replace("/","_")+"/";
- qDebug() << "ID:" << PLUGID << prefix;
+ //qDebug() << "ID:" << PLUGID << prefix;
settings = LSession::handle()->DesktopPluginSettings();
//Use plugin-specific values for stylesheet control (applauncher, desktopview, etc...)
this->setObjectName(id.section("---",0,0).section("::",0,0));
@@ -22,6 +22,7 @@ void LDPlugin::setInitialSize(int width, int height){
// if the plugin is completely new (first time used), it will be this size
if(settings->allKeys().filter(prefix+"location").isEmpty()){
//Brand new plugin: set initial size
+ qDebug() << "Setting Initial Size:" << PLUGID << width << height;
settings->setValue(prefix+"location/width",width);
settings->setValue(prefix+"location/height",height);
settings->sync();
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.h b/lumina-desktop/desktop-plugins/LDPlugin.h
index a69ca9c2..232fd564 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.h
+++ b/lumina-desktop/desktop-plugins/LDPlugin.h
@@ -43,6 +43,7 @@ public:
void setInitialSize(int width, int height);
void saveSetting(QString var, QVariant val){
+ //qDebug() << "Saving Setting:" << prefix+var+QString(" = ")+val.toString();
settings->setValue(prefix+var, val);
settings->sync();
}
diff --git a/lumina-desktop/desktop-plugins/LDPluginContainer.h b/lumina-desktop/desktop-plugins/LDPluginContainer.h
index c4d4c9fc..8719f525 100644
--- a/lumina-desktop/desktop-plugins/LDPluginContainer.h
+++ b/lumina-desktop/desktop-plugins/LDPluginContainer.h
@@ -12,6 +12,7 @@
#include <QObject>
#include <QMdiSubWindow>
+#include <QApplication>
#include <QSettings>
#include <QMoveEvent>
#include <QResizeEvent>
@@ -52,7 +53,7 @@ public:
this->setWhatsThis(plugin->ID());
this->setContentsMargins(0,0,0,0);
if(!locked){
- this->setStyleSheet("LDPluginContainer{ border-size: 1px;}");
+ //this->setStyleSheet("LDPluginContainer{ border-width: 1px;}");
this->setWindowTitle( plugin->ID().replace("---"," - ") );
//this->setWidget( new QWidget() );
this->setWidget( plugin );
@@ -68,8 +69,8 @@ public:
}
void loadInitialPosition(){
- QRect set(PLUG->readSetting("location/x",-12345).toInt(), PLUG->readSetting("location/y",-12345).toInt(), PLUG->readSetting("location/width",this->widget()->size().width()).toInt(), PLUG->readSetting("location/height",this->widget()->size().height()).toInt());
- //qDebug() << "Initial Plugin Location:" << set.x() << set.y() << set.width() << set.height();
+ QRect set(PLUG->readSetting("location/x",-12345).toInt(), PLUG->readSetting("location/y",-12345).toInt(), PLUG->readSetting("location/width",PLUG->size().width()).toInt(), PLUG->readSetting("location/height",PLUG->size().height()).toInt());
+ qDebug() << "Initial Plugin Location:" << set.x() << set.y() << set.width() << set.height();
if(set.height() < 10){ set.setHeight(10); } //to prevent foot-shooting
if(set.width() < 10){ set.setWidth(10); } //to prevent foot-shooting
if(set.x()!=-12345 && set.y()!=-12345){
@@ -81,8 +82,13 @@ public:
//qDebug() << " - Found Size:" << set;
this->resize(set.width(), set.height());
}
+ QApplication::processEvents();
setup=false; //done with setup
}
+
+ bool hasFixedPosition(){
+ return (PLUG->readSetting("location/x",-12345).toInt() != -12345);
+ }
signals:
void PluginRemoved(QString);
diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
index 447f959b..7d6c3d62 100644
--- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
@@ -24,7 +24,7 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) );
//Calculate the initial size of the button
- this->setInitialSize(icosize+8, icosize+8+qRound(2.2*button->fontMetrics().height()));
+ this->setInitialSize((1.2*icosize)+8, icosize+8+qRound(2.3*button->fontMetrics().height()));
QTimer::singleShot(1,this, SLOT(loadButton()) );
}
@@ -102,7 +102,6 @@ void AppLauncherPlugin::loadButton(){
}
button->setFixedSize(icosize+4, icosize+8+qRound(2.1*button->fontMetrics().height()) ); //make sure to adjust the button on first show.
- //this->setInitialSize(button->width()+4, button->height()+4);
QTimer::singleShot(100, this, SLOT(update()) ); //Make sure to re-draw the image in a moment
}
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
index 81f1281b..5fdd1ba0 100644
--- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
@@ -16,14 +16,13 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par
list = new QListWidget(this);
//list->setUniformItemSizes(true);
list->setViewMode(QListView::IconMode);
- list->setLayoutMode(QListView::Batched);
- list->setBatchSize(10); //keep it snappy
+ //list->setLayoutMode(QListView::Batched);
+ list->setFlow(QListWidget::TopToBottom); //Qt bug workaround - need the opposite flow in the widget constructor
+ list->setWrapping(true);
+ //list->setBatchSize(10); //keep it snappy
list->setSpacing(2);
list->setSelectionBehavior(QAbstractItemView::SelectItems);
list->setSelectionMode(QAbstractItemView::ExtendedSelection);
- //int icosize = this->readSetting("IconSize",64).toInt();
- //list->setIconSize(QSize(icosize,icosize));
- //list->setUniformItemSizes(true);
list->setContextMenuPolicy(Qt::CustomContextMenu);
menu = new QMenu(this);
@@ -46,7 +45,7 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par
connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateContents()) );
connect(list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(runItems()) );
connect(list, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(showMenu(const QPoint&)) );
- QTimer::singleShot(0,this, SLOT(updateContents()) );
+ QTimer::singleShot(1000,this, SLOT(updateContents()) ); //wait a second before loading contents
}
DesktopViewPlugin::~DesktopViewPlugin(){
@@ -184,16 +183,21 @@ void DesktopViewPlugin::updateContents(){
QStringList txtL = txt.split("\n");
for(int i=0; i<txtL.length(); i++){ txtL[i] = this->fontMetrics().elidedText(txtL[i], Qt::ElideRight, gridSZ.width()); }
txt = txtL.join("\n");
+ if(txtL.length()>2){ txt = txt.section("\n",0,1); } //only keep the first two lines
}else{
txt = this->fontMetrics().elidedText(txt,Qt::ElideRight, 2*gridSZ.width());
//Now split the line in half for the two lines
txt.insert( (txt.count()/2), "\n");
}
+ }else{
+ txt.append("\n "); //ensure two lines (2nd one invisible) - keeps formatting sane
}
it->setText(txt);
list->addItem(it);
QApplication::processEvents(); //keep the UI snappy
}
+ list->setFlow(QListWidget::LeftToRight); //To ensure this is consistent - issues with putting it in the constructor
+ list->update(); //Re-paint the widget after all items are added
}
void DesktopViewPlugin::displayProperties(){
bgstack15