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/LDPluginContainer.h6
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp16
2 files changed, 17 insertions, 5 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPluginContainer.h b/lumina-desktop/desktop-plugins/LDPluginContainer.h
index 52e426ba..109083da 100644
--- a/lumina-desktop/desktop-plugins/LDPluginContainer.h
+++ b/lumina-desktop/desktop-plugins/LDPluginContainer.h
@@ -39,8 +39,10 @@ public:
if(settings->allKeys().isEmpty()){
//Brand new plugin - no location/size info saved yet
//save the initial size of the plugin - the initial location will be set automatically
- settings->setValue("location/width", plugin->sizeHint().width());
- settings->setValue("location/height", plugin->sizeHint().height());
+ QSize sz = plugin->sizeHint();
+ if(!sz.isValid()){ sz = QSize(64,64); }
+ settings->setValue("location/width", sz.width());
+ settings->setValue("location/height", sz.height());
settings->sync();
}
this->setContentsMargins(0,0,0,0);
diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
index 32937ad4..9ed9e735 100644
--- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
@@ -2,14 +2,22 @@
#include "../../LSession.h"
AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID){
- this->setLayout( new QVBoxLayout());
- this->layout()->setContentsMargins(0,0,0,0);
+ QVBoxLayout *lay = new QVBoxLayout();
+ this->setLayout(lay);
+ lay->setContentsMargins(0,0,0,0);
button = new QToolButton(this);
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button->setIconSize(QSize(64,64));
button->setAutoRaise(true);
- this->layout()->addWidget(button);
+ button->setText("..."); //Need to set something here so that initial sizing works properly
+ lay->addWidget(button, 0, Qt::AlignCenter);
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
+ if(this->settings->allKeys().isEmpty()){
+ //Brand new plugin: set initial size
+ this->settings->setValue("location/width",64);
+ this->settings->setValue("location/height",66+this->fontMetrics().height());
+ this->settings->sync();
+ }
watcher = new QFileSystemWatcher(this);
connect(watcher, SIGNAL(fileChanged(QString)), this, SLOT( loadButton()) );
QTimer::singleShot(1,this, SLOT(loadButton()) );
@@ -33,6 +41,8 @@ void AppLauncherPlugin::loadButton(){
if(!watcher->files().isEmpty()){ watcher->removePaths(watcher->files()); }
watcher->addPath(file.filePath); //make sure to update this shortcut if the file changes
}
+ this->adjustSize(); //make sure to adjust the button on first show.
+ QTimer::singleShot(100, this, SLOT(update()) ); //Make sure to re-draw the image in a moment
}
void AppLauncherPlugin::buttonClicked(){
bgstack15