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.cpp5
-rw-r--r--lumina-desktop/desktop-plugins/LDPluginContainer.h35
-rw-r--r--lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp10
-rw-r--r--lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp2
-rw-r--r--lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h1
-rw-r--r--lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp2
-rw-r--r--lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp5
-rw-r--r--lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h1
-rw-r--r--lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp2
9 files changed, 37 insertions, 26 deletions
diff --git a/lumina-desktop/desktop-plugins/LDPlugin.cpp b/lumina-desktop/desktop-plugins/LDPlugin.cpp
index 5db20232..ebed6d90 100644
--- a/lumina-desktop/desktop-plugins/LDPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/LDPlugin.cpp
@@ -22,16 +22,19 @@ 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;
+ //qDebug() << "Setting Initial Size:" << PLUGID << width << height;
settings->setValue(prefix+"location/width",width);
settings->setValue(prefix+"location/height",height);
settings->sync();
}
+ //Now make sure the plugin is the saved size right away
+ this->resize( settings->value(prefix+"location/width").toInt(), settings->value(prefix+"location/height").toInt());
}
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
diff --git a/lumina-desktop/desktop-plugins/LDPluginContainer.h b/lumina-desktop/desktop-plugins/LDPluginContainer.h
index da8ead6e..e7388a80 100644
--- a/lumina-desktop/desktop-plugins/LDPluginContainer.h
+++ b/lumina-desktop/desktop-plugins/LDPluginContainer.h
@@ -35,12 +35,12 @@ private:
private slots:
void saveGeometry(){
if(PLUG==0){ return; }
- if(!locked && !setup){
+ //if(!locked && !setup){
PLUG->saveSetting("location/x", this->pos().x());
PLUG->saveSetting("location/y", this->pos().y());
- PLUG->saveSetting("location/width", this->size().width());
- PLUG->saveSetting("location/height", this->size().height());
- }
+ PLUG->saveSetting("location/width", this->width()-4);
+ PLUG->saveSetting("location/height", this->height()-4);
+ //}
}
public:
@@ -84,25 +84,27 @@ public:
}
public slots:
+ void loadInitialSize(){
+ if(PLUG==0){ return; }
+ QSize sz(PLUG->readSetting("location/width",100).toInt(), PLUG->readSetting("location/height",100).toInt());
+ this->resize(sz);
+ }
+
void loadInitialPosition(){
QRect set(PLUG->readSetting("location/x",-12345).toInt(), PLUG->readSetting("location/y",-12345).toInt(), PLUG->readSetting("location/width",PLUG->size().width()).toInt() +4, PLUG->readSetting("location/height",PLUG->size().height()).toInt()+4);
- qDebug() << "Initial Plugin Location:" << set.x() << set.y() << set.width() << set.height();
+ //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(!locked){
- //adjust the size to account for the container borders/frame
-
- }*/
if(set.x()!=-12345 && set.y()!=-12345){
- //custom location specified
- //qDebug() << " - Found Geom:" << set;
- this->setGeometry(set);
//this->move(set.x(), set.y());
- //PLUG->resize(set.width(), set.height());
+ this->setGeometry(set);
}else{
- //qDebug() << " - Found Size:" << set;
+ qDebug() << " - Found Size:" << set;
this->resize(set.width(), set.height());
+ qDebug() << " - Assigning location:" << this->pos();
+ saveNewPosition(this->pos());
}
+ this->show();
QApplication::processEvents();
setup=false; //done with setup
}
@@ -113,8 +115,9 @@ signals:
protected:
void moveEvent(QMoveEvent *event){
+ //qDebug() << "Move Event: " << PLUG->ID() << setup;
//Save this location to the settings
- if(!locked && !setup){
+ if( !setup ){
if(syncTimer->isActive()){ syncTimer->stop(); }
syncTimer->start();
//qDebug() << "DP Move:" << event->pos().x() << event->pos().y();
@@ -124,7 +127,7 @@ protected:
void resizeEvent(QResizeEvent *event){
//Save this size info to the settings
- if(!locked && !setup){
+ if(!setup){
//qDebug() << "DP Resize:" << event->size().width() << event->size().height();
if(syncTimer->isActive()){ syncTimer->stop(); }
syncTimer->start();
diff --git a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
index 52c82556..ea42f151 100644
--- a/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/applauncher/AppLauncherPlugin.cpp
@@ -8,7 +8,7 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par
button = new QToolButton(this);
button->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
button->setAutoRaise(true);
- button->setText("..."); //Need to set something here so that initial sizing works properly
+ button->setText("...\n..."); //Need to set something here so that initial sizing works properly
lay->addWidget(button, 0, Qt::AlignCenter);
connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) );
@@ -27,8 +27,9 @@ AppLauncherPlugin::AppLauncherPlugin(QWidget* parent, QString ID) : LDPlugin(par
//qDebug() << "Button Size:" << button->size();
//qDebug() << "Calculated:" << icosize+4 << icosize+8+qRound(2.15*button->fontMetrics().height());
//qDebug() << "Preferred Size:" << button->sizeHint();
- this->setInitialSize(qRound(1.1*icosize)+4, icosize+8+qRound(2.5*button->fontMetrics().height()));
-
+ QSize sz(qRound(1.1*icosize), icosize+qRound(2.7*button->fontMetrics().height()) );
+ button->setFixedSize(sz); //make sure to adjust the button on first show.
+ this->setInitialSize(this->sizeHint().width()+2, this->sizeHint().height()+2); //give the container a bit of a buffer
QTimer::singleShot(100,this, SLOT(loadButton()) );
}
@@ -76,7 +77,7 @@ void AppLauncherPlugin::loadButton(bool onchange){
button->setToolTip(txt);
int icosize = this->readSetting("iconsize",64).toInt();
int bwid = qRound(1.1*icosize);
- button->setFixedSize(bwid, icosize+qRound(2.5*button->fontMetrics().height()) ); //make sure to adjust the button on first show.
+ this->setFixedSize(bwid, icosize+qRound(2.5*button->fontMetrics().height()) ); //make sure to adjust the button on first show.
if(onchange){ this->adjustSize( bwid+4, icosize+8+qRound(2.5*button->fontMetrics().height())); }
//qDebug() << "Initial Button Text:" << txt << icosize;
if(button->fontMetrics().width(txt) > (bwid-2) ){
@@ -97,6 +98,7 @@ void AppLauncherPlugin::loadButton(bool onchange){
txt.insert( (txt.count()/2), "\n");
}
}
+ if(!txt.contains("\n")){ txt.append("\n "); } //always use two lines
//qDebug() << " - Setting Button Text:" << txt;
button->setText(txt);
//Now setup the menu again
diff --git a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
index cc1136f1..459e4610 100644
--- a/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
+++ b/lumina-desktop/desktop-plugins/audioplayer/PlayerWidget.cpp
@@ -262,7 +262,7 @@ AudioPlayerPlugin::AudioPlayerPlugin(QWidget *parent, QString ID) : LDPlugin(par
this->layout()->setContentsMargins(0,0,0,0);
this->layout()->addWidget(player);
- this->setInitialSize(300,75);
+ this->setInitialSize(this->sizeHint().width(), this->sizeHint().height());
}
AudioPlayerPlugin::~AudioPlayerPlugin(){
diff --git a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h
index e861052e..796bc42d 100644
--- a/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h
+++ b/lumina-desktop/desktop-plugins/calendar/CalendarPlugin.h
@@ -21,6 +21,7 @@ public:
this->layout()->setContentsMargins(0,0,0,0);
cal = new QCalendarWidget(this);
this->layout()->addWidget(cal);
+ this->setInitialSize( cal->sizeHint().width(), cal->sizeHint().height() );
}
~CalendarPlugin(){}
diff --git a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
index 5fdd1ba0..c3d2cc8b 100644
--- a/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/desktopview/DesktopViewPlugin.cpp
@@ -40,7 +40,7 @@ DesktopViewPlugin::DesktopViewPlugin(QWidget* parent, QString ID) : LDPlugin(par
menu->addAction( LXDG::findIcon("system-search",""), tr("Properties"), this, SLOT(displayProperties()) );
}
this->layout()->addWidget(list);
- this->setInitialSize(600,600);
+ this->setInitialSize(300,300);
connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateContents()) );
connect(list, SIGNAL(itemActivated(QListWidgetItem*)), this, SLOT(runItems()) );
diff --git a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
index 7d9076c7..f66cb53e 100644
--- a/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
+++ b/lumina-desktop/desktop-plugins/notepad/NotepadPlugin.cpp
@@ -59,11 +59,12 @@ NotePadPlugin::NotePadPlugin(QWidget* parent, QString ID) : LDPlugin(parent, ID)
//qDebug() << "Saving a new setting";
this->saveSetting("customFile",""); //always clear this when the plugin is initialized (only maintained per-session)
//qDebug() << "Loading Notes Dir";
- notesDirChanged();
+ QTimer::singleShot(2000, this, SLOT(notesDirChanged()));
//qDebug() << "Set Sizing";
//Now setup the initial values for the plugin
- this->setInitialSize(200,300);
+ qDebug() << "New Notepad:" << this->sizeHint() << this->size();
+ this->setInitialSize(this->sizeHint().width(),this->sizeHint().height());
//qDebug() << "Connect Signals/slots";
//Setup the button connections
connect(open, SIGNAL(clicked()), this, SLOT(openNote()) );
diff --git a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h
index 2bde5d54..3a14b26c 100644
--- a/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h
+++ b/lumina-desktop/desktop-plugins/quickcontainer/QuickDPlugin.h
@@ -25,6 +25,7 @@ public:
container->setResizeMode(QQuickWidget::SizeRootObjectToView);
this->layout()->addWidget(container);
container->setSource(QUrl::fromLocalFile( LUtils::findQuickPluginFile(ID.section("---",0,0)) ));
+ this->setInitialSize(container->initialSize().width(), container->initialSize().height());
}
~QuickDPlugin(){}
diff --git a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
index 981e411d..6a300b6c 100644
--- a/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
+++ b/lumina-desktop/desktop-plugins/systemmonitor/MonitorWidget.cpp
@@ -55,7 +55,7 @@ SysMonitorPlugin::SysMonitorPlugin(QWidget *parent, QString ID) : LDPlugin(paren
this->layout()->setContentsMargins(0,0,0,0);
this->layout()->addWidget(monitor);
- this->setInitialSize(monitor->width(),monitor->height());
+ this->setInitialSize(monitor->sizeHint().width(),monitor->sizeHint().height());
}
SysMonitorPlugin::~SysMonitorPlugin(){
bgstack15